katucharts.js 0.2.12 → 0.2.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2658,7 +2658,7 @@ const jn = class jn {
2658
2658
  a > o && (o = a);
2659
2659
  }
2660
2660
  if (o > 12) {
2661
- const s = Math.min(o * 16 + 130, 6e3), a = e.scrollablePlotArea && typeof e.scrollablePlotArea == "object" ? e.scrollablePlotArea : {};
2661
+ const s = Math.min(o * 26 + 130, 9e3), a = e.scrollablePlotArea && typeof e.scrollablePlotArea == "object" ? e.scrollablePlotArea : {};
2662
2662
  e.scrollablePlotArea = { ...a, minHeight: s }, e._autoScrollMinHeight = s;
2663
2663
  return;
2664
2664
  }
@@ -1,4 +1,4 @@
1
- (function(St,$e){typeof exports=="object"&&typeof module<"u"?$e(exports):typeof define=="function"&&define.amd?define(["exports"],$e):(St=typeof globalThis<"u"?globalThis:St||self,$e(St.KatuCharts={}))})(this,function(St){"use strict";var XA=Object.defineProperty;var UA=(St,$e,ri)=>$e in St?XA(St,$e,{enumerable:!0,configurable:!0,writable:!0,value:ri}):St[$e]=ri;var xt=(St,$e,ri)=>UA(St,typeof $e!="symbol"?$e+"":$e,ri);function $e(n,t,e){n.prototype=t.prototype=e,e.constructor=n}function ri(n,t){var e=Object.create(n.prototype);for(var i in t)e[i]=t[i];return e}function rr(){}var or=.7,no=1/or,Pi="\\s*([+-]?\\d+)\\s*",sr="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",xn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Up=/^#([0-9a-f]{3,8})$/,jp=new RegExp(`^rgb\\(${Pi},${Pi},${Pi}\\)$`),qp=new RegExp(`^rgb\\(${xn},${xn},${xn}\\)$`),Zp=new RegExp(`^rgba\\(${Pi},${Pi},${Pi},${sr}\\)$`),Kp=new RegExp(`^rgba\\(${xn},${xn},${xn},${sr}\\)$`),Jp=new RegExp(`^hsl\\(${sr},${xn},${xn}\\)$`),Qp=new RegExp(`^hsla\\(${sr},${xn},${xn},${sr}\\)$`),wl={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};$e(rr,se,{copy(n){return Object.assign(new this.constructor,this,n)},displayable(){return this.rgb().displayable()},hex:kl,formatHex:kl,formatHex8:tg,formatHsl:eg,formatRgb:Ml,toString:Ml});function kl(){return this.rgb().formatHex()}function tg(){return this.rgb().formatHex8()}function eg(){return Pl(this).formatHsl()}function Ml(){return this.rgb().formatRgb()}function se(n){var t,e;return n=(n+"").trim().toLowerCase(),(t=Up.exec(n))?(e=t[1].length,t=parseInt(t[1],16),e===6?Al(t):e===3?new Ne(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):e===8?io(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):e===4?io(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=jp.exec(n))?new Ne(t[1],t[2],t[3],1):(t=qp.exec(n))?new Ne(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Zp.exec(n))?io(t[1],t[2],t[3],t[4]):(t=Kp.exec(n))?io(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Jp.exec(n))?Cl(t[1],t[2]/100,t[3]/100,1):(t=Qp.exec(n))?Cl(t[1],t[2]/100,t[3]/100,t[4]):wl.hasOwnProperty(n)?Al(wl[n]):n==="transparent"?new Ne(NaN,NaN,NaN,0):null}function Al(n){return new Ne(n>>16&255,n>>8&255,n&255,1)}function io(n,t,e,i){return i<=0&&(n=t=e=NaN),new Ne(n,t,e,i)}function ng(n){return n instanceof rr||(n=se(n)),n?(n=n.rgb(),new Ne(n.r,n.g,n.b,n.opacity)):new Ne}function Ye(n,t,e,i){return arguments.length===1?ng(n):new Ne(n,t,e,i??1)}function Ne(n,t,e,i){this.r=+n,this.g=+t,this.b=+e,this.opacity=+i}$e(Ne,Ye,ri(rr,{brighter(n){return n=n==null?no:Math.pow(no,n),new Ne(this.r*n,this.g*n,this.b*n,this.opacity)},darker(n){return n=n==null?or:Math.pow(or,n),new Ne(this.r*n,this.g*n,this.b*n,this.opacity)},rgb(){return this},clamp(){return new Ne(oi(this.r),oi(this.g),oi(this.b),ro(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Sl,formatHex:Sl,formatHex8:ig,formatRgb:_l,toString:_l}));function Sl(){return`#${si(this.r)}${si(this.g)}${si(this.b)}`}function ig(){return`#${si(this.r)}${si(this.g)}${si(this.b)}${si((isNaN(this.opacity)?1:this.opacity)*255)}`}function _l(){const n=ro(this.opacity);return`${n===1?"rgb(":"rgba("}${oi(this.r)}, ${oi(this.g)}, ${oi(this.b)}${n===1?")":`, ${n})`}`}function ro(n){return isNaN(n)?1:Math.max(0,Math.min(1,n))}function oi(n){return Math.max(0,Math.min(255,Math.round(n)||0))}function si(n){return n=oi(n),(n<16?"0":"")+n.toString(16)}function Cl(n,t,e,i){return i<=0?n=t=e=NaN:e<=0||e>=1?n=t=NaN:t<=0&&(n=NaN),new dn(n,t,e,i)}function Pl(n){if(n instanceof dn)return new dn(n.h,n.s,n.l,n.opacity);if(n instanceof rr||(n=se(n)),!n)return new dn;if(n instanceof dn)return n;n=n.rgb();var t=n.r/255,e=n.g/255,i=n.b/255,r=Math.min(t,e,i),o=Math.max(t,e,i),s=NaN,a=o-r,l=(o+r)/2;return a?(t===o?s=(e-i)/a+(e<i)*6:e===o?s=(i-t)/a+2:s=(t-e)/a+4,a/=l<.5?o+r:2-o-r,s*=60):a=l>0&&l<1?0:s,new dn(s,a,l,n.opacity)}function ai(n,t,e,i){return arguments.length===1?Pl(n):new dn(n,t,e,i??1)}function dn(n,t,e,i){this.h=+n,this.s=+t,this.l=+e,this.opacity=+i}$e(dn,ai,ri(rr,{brighter(n){return n=n==null?no:Math.pow(no,n),new dn(this.h,this.s,this.l*n,this.opacity)},darker(n){return n=n==null?or:Math.pow(or,n),new dn(this.h,this.s,this.l*n,this.opacity)},rgb(){var n=this.h%360+(this.h<0)*360,t=isNaN(n)||isNaN(this.s)?0:this.s,e=this.l,i=e+(e<.5?e:1-e)*t,r=2*e-i;return new Ne(Bs(n>=240?n-240:n+120,r,i),Bs(n,r,i),Bs(n<120?n+240:n-120,r,i),this.opacity)},clamp(){return new dn(El(this.h),oo(this.s),oo(this.l),ro(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const n=ro(this.opacity);return`${n===1?"hsl(":"hsla("}${El(this.h)}, ${oo(this.s)*100}%, ${oo(this.l)*100}%${n===1?")":`, ${n})`}`}}));function El(n){return n=(n||0)%360,n<0?n+360:n}function oo(n){return Math.max(0,Math.min(1,n||0))}function Bs(n,t,e){return(n<60?t+(e-t)*n/60:n<180?e:n<240?t+(e-t)*(240-n)/60:t)*255}const so=new Map,rg=256;function Os(n){const t=n||"rgba(0,0,0,0)",e=so.get(t);if(e)return e;const i="rgba(0,0,0,0)",r=se(n||i),o=Ye(r||i),s={r:Math.round(o.r),g:Math.round(o.g),b:Math.round(o.b),a:o.opacity,get(a){return a==="rgba"?this.toString():this.toString()},brighten(a){const l=ai(Ye(this.r,this.g,this.b,this.a));l.l+=a*.1,l.l=Math.max(0,Math.min(1,l.l));const c=Ye(l);return Os(c.formatRgb())},setOpacity(a){return Os(`rgba(${this.r},${this.g},${this.b},${a})`)},toString(){return this.a<1?`rgba(${this.r},${this.g},${this.b},${this.a})`:Ye(this.r,this.g,this.b).formatHex()}};return so.size>=rg&&so.clear(),so.set(t,s),s}const ao={default:["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],tableau10:["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],d3classic:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],brewer:["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f","#e5c494","#b3b3b3"],google:["#3366cc","#dc3912","#ff9900","#109618","#990099","#0099c6","#dd4477","#66aa00","#b82e2e","#316395"],ocean:["#003f5c","#2f4b7c","#665191","#a05195","#d45087","#f95d6a","#ff7c43","#ffa600","#58508d","#bc5090"],sunset:["#f94144","#f3722c","#f8961e","#f9844a","#f9c74f","#90be6d","#43aa8b","#4d908e","#577590","#277da1"],earth:["#8c510a","#bf812d","#dfc27d","#c7eae5","#80cdc1","#35978f","#01665e","#543005","#003c30","#f6e8c3"],forest:["#2d6a4f","#40916c","#52b788","#74c69d","#95d5b2","#1b4332","#081c15","#b7e4c7","#d8f3dc","#344e41"],berry:["#7b2cbf","#9d4edd","#c77dff","#e0aaff","#5a189a","#3c096c","#240046","#10002b","#e2afff","#deaaff"],corporate:["#2c3e50","#e74c3c","#3498db","#2ecc71","#f39c12","#9b59b6","#1abc9c","#e67e22","#34495e","#16a085"],minimal:["#264653","#2a9d8f","#e9c46a","#f4a261","#e76f51","#606c38","#283618","#dda15e","#bc6c25","#fefae0"],nordic:["#5e81ac","#81a1c1","#88c0d0","#8fbcbb","#bf616a","#d08770","#ebcb8b","#a3be8c","#b48ead","#4c566a"],darkMode:["#2ecc71","#3498db","#e74c3c","#f1c40f","#9b59b6","#1abc9c","#e67e22","#ecf0f1","#e91e63","#00bcd4"],neon:["#ff006e","#fb5607","#ffbe0b","#8338ec","#3a86ff","#06d6a0","#118ab2","#ef476f","#ffd166","#073b4c"],pastel:["#a8e6cf","#dcedc1","#ffd3b6","#ffaaa5","#ff8b94","#b5ead7","#c7ceea","#e2f0cb","#fceaea","#d4a5a5"],soft:["#6c9bd2","#e6a756","#d46a6a","#7cc5a8","#b28fce","#e8937f","#6bb8a0","#d4b56a","#8e9cc2","#c2847a"],classic:["#7cb5ec","#434348","#90ed7d","#f7a35c","#8085e9","#f15c80","#e4d354","#2b908f","#f45b5b","#91e8e1"],tupi:["#b43417","#1b1a15","#a85429","#ce9a3a","#33503a","#8c2810","#6b6a45","#d97b3f","#5b5240","#7a3b2e"],monochrome:["#1f2933","#3e4c59","#52606d","#7b8794","#9aa5b1","#616e7c","#cbd2d9","#323f4b","#7b8794","#b8c0c9"]};function Tl(n){return ao[n]||ao.default}const og=ao.default,sg={textStrong:"#1f2933",textSoft:"#52606d",axis:"#6b7280",line:"#c8ccd2",grid:"#e6e8eb",tooltipBg:"rgba(255,255,255,0.96)",tooltipBorder:"#d8dce0",legend:"#52606d"},ag={textStrong:"#f3f4f6",textSoft:"#b8bfc7",axis:"#9aa3ad",line:"#3a414a",grid:"rgba(255,255,255,0.08)",tooltipBg:"#20262e",tooltipBorder:"#39414b",legend:"#c2c9d1"};function $l(n,t,e){const i={gridLineColor:e.grid,lineColor:e.line,tickColor:e.line,labels:{style:{color:e.axis}},title:{style:{color:e.axis}}};return{colors:n,chart:{backgroundColor:t},title:{style:{color:e.textStrong}},subtitle:{style:{color:e.textSoft}},xAxis:i,yAxis:i,tooltip:{backgroundColor:e.tooltipBg,borderColor:e.tooltipBorder,style:{color:e.textStrong}},legend:{itemStyle:{color:e.legend},itemHoverStyle:{color:e.textStrong}}}}const Ns={tupi:{light:["#b43417","#1b1a15","#a85429","#ce9a3a","#33503a","#8c2810","#6b6a45","#d97b3f","#5b5240","#7a3b2e"],dark:["#e0673f","#e7dbc0","#d08a4e","#e8c45f","#6fa37a","#c84c2c","#c9b27a","#f0a06a","#a9a07e","#d98b6a"]},ocean:{light:["#0466c8","#0353a4","#3a86ff","#00b4d8","#0096c7","#48cae4","#023e8a","#5e60ce","#0077b6","#90e0ef"],dark:["#48cae4","#4895ef","#56cfe1","#64dfdf","#80ffdb","#5390d9","#7400b8","#4cc9f0","#56cfe1","#72efdd"]},sunset:{light:["#ff6b35","#f7522f","#ff9e00","#ffbf69","#e85d75","#d1495b","#ffd166","#9e2a2b","#f3722c","#bc4749"],dark:["#ff7b54","#ffb26b","#ffd56b","#ff9e7d","#ff6b6b","#feca57","#ff9ff3","#f368e0","#ffa07a","#ffd56b"]},forest:{light:["#2d6a4f","#40916c","#52b788","#74c69d","#1b4332","#95d5b2","#b7e4c7","#344e41","#588157","#a3b18a"],dark:["#74c69d","#52b788","#95d5b2","#40916c","#b7e4c7","#2d6a4f","#d8f3dc","#588157","#a3b18a","#80ed99"]},corporate:{light:["#2c3e50","#3498db","#16a085","#f39c12","#8e44ad","#e74c3c","#34495e","#27ae60","#2980b9","#d35400"],dark:["#5dade2","#48c9b0","#f5b041","#bb8fce","#ec7063","#58d68d","#85c1e9","#76d7c4","#f8c471","#aed6f1"]},vivid:{light:["#ff006e","#fb5607","#ffbe0b","#8338ec","#3a86ff","#06d6a0","#ef476f","#118ab2","#ff70a6","#9b5de5"],dark:["#ff5d8f","#ff7b00","#ffd60a","#9d4edd","#4cc9f0","#06d6a0","#ff70a6","#48cae4","#fb5607","#b5179e"]},monochrome:{light:["#1f2933","#3e4c59","#52606d","#7b8794","#9aa5b1","#616e7c","#cbd2d9","#323f4b","#46545f","#a7b0b8"],dark:["#e4e7eb","#cbd2d9","#9aa5b1","#7b8794","#616e7c","#b8c0c9","#52606d","#d3d9de","#8a949e","#3e4c59"]},nordic:{light:["#5e81ac","#81a1c1","#88c0d0","#8fbcbb","#bf616a","#d08770","#ebcb8b","#a3be8c","#b48ead","#4c566a"],dark:["#88c0d0","#81a1c1","#8fbcbb","#a3be8c","#ebcb8b","#d08770","#bf616a","#b48ead","#5e81ac","#d8dee9"]},pastel:{light:["#a8e6cf","#ffd3b6","#ffaaa5","#c7ceea","#b5ead7","#ff8b94","#dcedc1","#e2afff","#ffdac1","#b5c7ed"],dark:["#a8e6cf","#ffd3b6","#ffaaa5","#c7ceea","#b5ead7","#ff8b94","#dcedc1","#e2afff","#ffdac1","#b5c7ed"]}},Ll={tupi:{light:"#ecdfc4",dark:"#1c1814"},ocean:{light:"#ffffff",dark:"#0b1622"},sunset:{light:"#ffffff",dark:"#1f1410"},forest:{light:"#ffffff",dark:"#0f1f17"},corporate:{light:"#ffffff",dark:"#1a1f26"},vivid:{light:"#ffffff",dark:"#14101c"},monochrome:{light:"#ffffff",dark:"#1a1f24"},nordic:{light:"#eceff4",dark:"#2e3440"},pastel:{light:"#ffffff",dark:"#232026"}},co=(()=>{const n={};for(const t of Object.keys(Ns))n[t]=$l(Ns[t].light,Ll[t].light,sg),n[`${t}-dark`]=$l(Ns[t].dark,Ll[t].dark,ag);return n.light=n.monochrome,n.dark=n["monochrome-dark"],n})(),cg=Object.keys(co);function Il(n){return co[n]}const wt="12px",xe="#000000",Fl="#1a1a1a",lg="#ffffff",hg=3;function Ws(n){const t=n/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4}function Dl(n,t,e){return .2126*Ws(n)+.7152*Ws(t)+.0722*Ws(e)}function Rl(n,t){return(Math.max(n,t)+.05)/(Math.min(n,t)+.05)}const ug=Dl(26,26,26);function Pn(n,t){var s;if(t)return t;const e=n?(s=se(n))==null?void 0:s.rgb():null;if(!e||isNaN(e.r)||e.opacity===0)return xe;const i=Dl(e.r,e.g,e.b),r=Rl(i,ug);return r>=hg?Fl:Rl(i,1)>=r?lg:Fl}function zl(){if(typeof document>"u")return 16;const n=parseFloat(getComputedStyle(document.documentElement).fontSize);return n>0?n:16}function be(n){if(!n)return 12;const t=n.trim();if(/^(clamp|min|max)\s*\(/i.test(t)){const r=t.slice(t.indexOf("(")+1,t.lastIndexOf(")")).match(/-?\d*\.?\d+\s*(px|rem|em)/gi)||[];let o=0;for(const s of r){const a=be(s.trim());a>o&&(o=a)}return o>0?o:12}if(t.endsWith("px"))return parseFloat(t)||12;if(t.endsWith("rem")||t.endsWith("em"))return(parseFloat(t)||1)*zl();const e=parseFloat(t);return isNaN(e)?12:e}let lo=null;function fg(){return lo||(typeof document>"u"?null:(lo=document.createElement("canvas").getContext("2d"),lo))}function Je(n,t,e="normal",i="sans-serif"){const r=fg();return r?(r.font=`${e} ${t}px ${i}`,r.measureText(n).width):n.length*t*.62}const Hs={chart:{type:"line",backgroundColor:"#ffffff",borderWidth:0,borderRadius:0,borderColor:"#335cad",spacing:[10,10,15,10],style:{fontFamily:'"Lucida Grande", "Lucida Sans Unicode", Verdana, Arial, Helvetica, sans-serif',fontSize:"12px"},animation:!0,zoomType:void 0,panning:!1,inverted:!1,polar:!1,reflow:!0},title:{text:void 0,align:"center",margin:15,style:{color:"#333333",fontSize:"18px",fontWeight:"bold"},widthAdjust:-44},subtitle:{text:void 0,align:"center",style:{color:"#666666",fontSize:"12px"},widthAdjust:-44},xAxis:{type:"linear",title:{text:null,style:{fontSize:wt}},labels:{enabled:!0,style:{fontSize:wt},autoRotation:[-45],autoRotationLimit:80,padding:5},tickLength:10,tickWidth:1,tickColor:"#999999",gridLineWidth:1,gridLineColor:"#e6e6e6",lineWidth:1,lineColor:"#999999",offset:0,opposite:!1,reversed:!1,visible:!0,startOnTick:!1,endOnTick:!1,showFirstLabel:!0,showLastLabel:!0,allowDecimals:!0,maxPadding:.01,minPadding:.01,crosshair:!1},yAxis:{type:"linear",title:{text:null,style:{fontSize:wt}},labels:{enabled:!0,style:{fontSize:wt},padding:5},tickLength:10,tickWidth:1,gridLineWidth:1,gridLineColor:"#e6e6e6",lineWidth:1,lineColor:"#999999",offset:0,opposite:!1,reversed:!1,visible:!0,startOnTick:!0,endOnTick:!0,showFirstLabel:!0,showLastLabel:!0,allowDecimals:!0,maxPadding:.05,minPadding:.05,crosshair:!1},colorAxis:void 0,series:[],tooltip:{enabled:!0,shared:!1,split:!1,useHTML:!1,followPointer:!1,headerFormat:'<span style="font-size: 10px">{point.key}</span><br/>',pointFormat:'<span style="color:{point.color}">●</span> {series.name}: <b>{point.y}</b><br/>',footerFormat:"",backgroundColor:"rgba(247,247,247,0.85)",borderColor:void 0,borderWidth:1,borderRadius:3,padding:8,shadow:!0,animation:!0,hideDelay:500,snap:10,outside:!1,style:{color:"#333333",fontSize:"12px"}},legend:{enabled:!0,layout:"horizontal",align:"center",verticalAlign:"bottom",floating:!1,x:0,y:0,margin:15,padding:8,itemMarginTop:0,itemMarginBottom:0,itemDistance:20,itemStyle:{cursor:"pointer",fontSize:wt,fontWeight:"normal"},itemHoverStyle:{color:"#000000"},itemHiddenStyle:{color:"#cccccc"},symbolWidth:12,symbolHeight:12,symbolRadius:2,symbolPadding:5,squareSymbol:!0,borderWidth:0,borderRadius:0,borderColor:"#999999",reversed:!1},plotOptions:{series:{lineWidth:2,marker:{enabled:null,radius:4,symbol:"circle",lineWidth:0,states:{hover:{enabled:!0,radius:6,lineWidth:1}}},states:{hover:{enabled:!0,lineWidthPlus:1},inactive:{opacity:.2}},animation:{duration:1e3},enableMouseTracking:!0,stickyTracking:!0,allowPointSelect:!1,turboThreshold:1e3,dataLabels:{enabled:!1},showInLegend:!0,threshold:0,connectNulls:!1,clip:!0},bubble:{lineWidth:1},scatter:{marker:{symbol:null}},pie:{tooltip:{pointFormat:'<span style="color:{point.color}">●</span> {series.name}: <b>{point.percentage:.1f}%</b><br/>'},dataLabels:{enabled:!0},showInLegend:!1},candlestick:{tooltip:{pointFormat:'<span style="color:{point.color}">●</span> <b>{series.name}</b><br/>Open: <b>{point.open}</b><br/>High: <b>{point.high}</b><br/>Low: <b>{point.low}</b><br/>Close: <b>{point.close}</b><br/>'}},ohlc:{tooltip:{pointFormat:'<span style="color:{point.color}">●</span> <b>{series.name}</b><br/>Open: <b>{point.open}</b><br/>High: <b>{point.high}</b><br/>Low: <b>{point.low}</b><br/>Close: <b>{point.close}</b><br/>'}},heikinashi:{tooltip:{pointFormat:'<span style="color:{point.color}">●</span> <b>{series.name}</b><br/>Open: <b>{point.open}</b><br/>High: <b>{point.high}</b><br/>Low: <b>{point.low}</b><br/>Close: <b>{point.close}</b><br/>'}},hollowcandlestick:{tooltip:{pointFormat:'<span style="color:{point.color}">●</span> <b>{series.name}</b><br/>Open: <b>{point.open}</b><br/>High: <b>{point.high}</b><br/>Low: <b>{point.low}</b><br/>Close: <b>{point.close}</b><br/>'}},arearange:{tooltip:{pointFormat:'<span style="color:{point.color}">●</span> {series.name}: <b>{point.low}</b> - <b>{point.high}</b><br/>'}},donut:{showInLegend:!1},sankey:{dataLabels:{enabled:!0},showInLegend:!1},dependencywheel:{dataLabels:{enabled:!0},showInLegend:!1},networkgraph:{dataLabels:{enabled:!0}},treemap:{dataLabels:{enabled:!0}},gauge:{dataLabels:{enabled:!0}},solidgauge:{dataLabels:{enabled:!0}},timeline:{dataLabels:{enabled:!0}},gantt:{dataLabels:{enabled:!0}},barchartrace:{dataLabels:{enabled:!0}},venn:{dataLabels:{enabled:!0}}},credits:{enabled:!0,text:"Powered by: KatuCharts",href:"https://charts.katudv.com",position:{align:"right",verticalAlign:"bottom",x:-10,y:-5},style:{cursor:"pointer",fontSize:"9px"}},exporting:{enabled:!0,filename:"chart",type:"image/png",scale:2,printMaxWidth:780,buttons:{contextButton:{enabled:!0,symbol:"gear",symbolFill:"#666666",symbolStroke:"#666666",symbolStrokeWidth:3,x:-10,y:10,menuItems:["downloadPNG","downloadJPEG","downloadSVG","downloadPDF","separator","viewFullScreen","printChart"]}}},loading:{hideDuration:100,showDuration:100,labelStyle:{fontWeight:"bold",position:"relative",top:"45%"},style:{position:"absolute",backgroundColor:"#ffffff",opacity:.5,textAlign:"center"}},navigator:{enabled:!1},rangeSelector:{enabled:!1},drilldown:{animation:!0,series:[]},responsive:{rules:[{condition:{maxWidth:500},chartOptions:{chart:{spacing:[5,5,10,5]},title:{style:{fontSize:"14px"},margin:8},subtitle:{style:{fontSize:"10px"}},legend:{itemStyle:{fontSize:"10px"},itemDistance:10,margin:8,symbolWidth:12,symbolHeight:8},yAxis:{title:{text:null},labels:{style:{fontSize:"9px"}}},xAxis:{labels:{style:{fontSize:"9px"},autoRotation:[-45,-90]}},plotOptions:{pie:{size:"65%",dataLabels:{distance:10,style:{fontSize:"9px"},connectorPadding:3}}}}},{condition:{maxWidth:260},chartOptions:{subtitle:{text:null},legend:{enabled:!1},credits:{enabled:!1},plotOptions:{pie:{size:"55%",dataLabels:{distance:5,style:{fontSize:"8px"},connectorWidth:0}}}}}]},accessibility:{enabled:!0},colors:og},Ei=new Set(["pie","donut","sunburst","treemap","treegraph","wordcloud","sankey","dependencywheel","networkgraph","gauge","solidgauge","polar","radar","funnel","pyramid","timeline","map","mappoint","flowmap","barchartrace","venn","clusteredheatmap","phylotree","circos","circosHeatmap","circosComparative","circosSpiral"]),dg=new Set(["pie","donut","funnel","pyramid","sankey","dependencywheel","networkgraph","treemap","sunburst","gauge","solidgauge","timeline","gantt","map","mappoint","flowmap","heatmap","polar","radar","barchartrace","venn","clusteredheatmap","phylotree","circos"]),pg=new Set(["line","spline","column","bar","scatter","bubble","area","areaspline","boxplot","waterfall","volume"]),gg=new Set(["pie","venn","forestplot","pcoa"]),mg=new Set(["scatter","bubble"]),yg=new Set(["column","bar","area","areaspline","waterfall"]);function Bl(n){return n.length>0&&n.every(t=>Ei.has(t._internalType))}const Ol=20;function Nl(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)&&Object.getPrototypeOf(n)===Object.prototype}function he(n,...t){return Wl(n,t,0)}function Wl(n,t,e){if(e>Ol)return n;const i={...n};for(const r of t)if(r)for(const o of Object.keys(r)){if(o==="__proto__"||o==="constructor"||o==="prototype")continue;const s=r[o],a=i[o];s!==void 0&&(s===null?i[o]=null:Nl(s)&&Nl(a)?i[o]=Wl(a,[s],e+1):Array.isArray(s)?i[o]=[...s]:i[o]=s)}return i}function ho(n){return Vs(n,new WeakSet,0)}function Vs(n,t,e){if(n===null||typeof n!="object"||e>Ol||t.has(n))return n;if(t.add(n),Array.isArray(n))return n.map(r=>Vs(r,t,e+1));if(n instanceof Date)return new Date(n.getTime());const i={};for(const r of Object.keys(n))i[r]=Vs(n[r],t,e+1);return i}function Hl(n){return n instanceof Uint8Array||ArrayBuffer.isView(n)&&n.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in n&&n.BYTES_PER_ELEMENT===1}function Gs(n,t=""){if(typeof n!="number"){const e=t&&`"${t}" `;throw new TypeError(`${e}expected number, got ${typeof n}`)}if(!Number.isSafeInteger(n)||n<0){const e=t&&`"${t}" `;throw new RangeError(`${e}expected integer >= 0, got ${n}`)}}function ci(n,t,e=""){const i=Hl(n),r=n==null?void 0:n.length,o=t!==void 0;if(!i||o&&r!==t){const s=e&&`"${e}" `,a=o?` of length ${t}`:"",l=i?`length=${r}`:`type=${typeof n}`,c=s+"expected Uint8Array"+a+", got "+l;throw i?new RangeError(c):new TypeError(c)}return n}function Vl(n,t=!0){if(n.destroyed)throw new Error("Hash instance has been destroyed");if(t&&n.finished)throw new Error("Hash#digest() has already been called")}function xg(n,t){ci(n,void 0,"digestInto() output");const e=t.outputLen;if(n.length<e)throw new RangeError('"digestInto() output" expected to be of length >='+e)}function Ys(...n){for(let t=0;t<n.length;t++)n[t].fill(0)}function Xs(n){return new DataView(n.buffer,n.byteOffset,n.byteLength)}const Gl=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",bg=Array.from({length:256},(n,t)=>t.toString(16).padStart(2,"0"));function Us(n){if(ci(n),Gl)return n.toHex();let t="";for(let e=0;e<n.length;e++)t+=bg[n[e]];return t}const En={_0:48,_9:57,A:65,F:70,a:97,f:102};function Yl(n){if(n>=En._0&&n<=En._9)return n-En._0;if(n>=En.A&&n<=En.F)return n-(En.A-10);if(n>=En.a&&n<=En.f)return n-(En.a-10)}function js(n){if(typeof n!="string")throw new TypeError("hex string expected, got "+typeof n);if(Gl)try{return Uint8Array.fromHex(n)}catch(r){throw r instanceof SyntaxError?new RangeError(r.message):r}const t=n.length,e=t/2;if(t%2)throw new RangeError("hex string expected, got unpadded hex of length "+t);const i=new Uint8Array(e);for(let r=0,o=0;r<e;r++,o+=2){const s=Yl(n.charCodeAt(o)),a=Yl(n.charCodeAt(o+1));if(s===void 0||a===void 0){const l=n[o]+n[o+1];throw new RangeError('hex string expected, got non-hex character "'+l+'" at index '+o)}i[r]=s*16+a}return i}function vg(...n){let t=0;for(let i=0;i<n.length;i++){const r=n[i];ci(r),t+=r.length}const e=new Uint8Array(t);for(let i=0,r=0;i<n.length;i++){const o=n[i];e.set(o,r),r+=o.length}return e}function wg(n,t={}){const e=(r,o)=>n(o).update(r).digest(),i=n(void 0);return e.outputLen=i.outputLen,e.blockLen=i.blockLen,e.canXOF=i.canXOF,e.create=r=>n(r),Object.assign(e,t),Object.freeze(e)}function kg(n=32){Gs(n,"bytesLength");const t=typeof globalThis=="object"?globalThis.crypto:null;if(typeof(t==null?void 0:t.getRandomValues)!="function")throw new Error("crypto.getRandomValues must be defined");if(n>65536)throw new RangeError(`"bytesLength" expected <= 65536, got ${n}`);return t.getRandomValues(new Uint8Array(n))}const Mg=n=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,n])});class Ag{constructor(t,e,i,r){xt(this,"blockLen");xt(this,"outputLen");xt(this,"canXOF",!1);xt(this,"padOffset");xt(this,"isLE");xt(this,"buffer");xt(this,"view");xt(this,"finished",!1);xt(this,"length",0);xt(this,"pos",0);xt(this,"destroyed",!1);this.blockLen=t,this.outputLen=e,this.padOffset=i,this.isLE=r,this.buffer=new Uint8Array(t),this.view=Xs(this.buffer)}update(t){Vl(this),ci(t);const{view:e,buffer:i,blockLen:r}=this,o=t.length;for(let s=0;s<o;){const a=Math.min(r-this.pos,o-s);if(a===r){const l=Xs(t);for(;r<=o-s;s+=r)this.process(l,s);continue}i.set(t.subarray(s,s+a),this.pos),this.pos+=a,s+=a,this.pos===r&&(this.process(e,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){Vl(this),xg(t,this),this.finished=!0;const{buffer:e,view:i,blockLen:r,isLE:o}=this;let{pos:s}=this;e[s++]=128,Ys(this.buffer.subarray(s)),this.padOffset>r-s&&(this.process(i,0),s=0);for(let f=s;f<r;f++)e[f]=0;i.setBigUint64(r-8,BigInt(this.length*8),o),this.process(i,0);const a=Xs(t),l=this.outputLen;if(l%4)throw new Error("_sha2: outputLen must be aligned to 32bit");const c=l/4,h=this.get();if(c>h.length)throw new Error("_sha2: outputLen bigger than state");for(let f=0;f<c;f++)a.setUint32(4*f,h[f],o)}digest(){const{buffer:t,outputLen:e}=this;this.digestInto(t);const i=t.slice(0,e);return this.destroy(),i}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:e,buffer:i,length:r,finished:o,destroyed:s,pos:a}=this;return t.destroyed=s,t.finished=o,t.length=r,t.pos=a,r%e&&t.buffer.set(i),t}clone(){return this._cloneInto()}}const ve=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]),uo=BigInt(2**32-1),Xl=BigInt(32);function Sg(n,t=!1){return t?{h:Number(n&uo),l:Number(n>>Xl&uo)}:{h:Number(n>>Xl&uo)|0,l:Number(n&uo)|0}}function _g(n,t=!1){const e=n.length;let i=new Uint32Array(e),r=new Uint32Array(e);for(let o=0;o<e;o++){const{h:s,l:a}=Sg(n[o],t);[i[o],r[o]]=[s,a]}return[i,r]}const Ul=(n,t,e)=>n>>>e,jl=(n,t,e)=>n<<32-e|t>>>e,Ti=(n,t,e)=>n>>>e|t<<32-e,$i=(n,t,e)=>n<<32-e|t>>>e,fo=(n,t,e)=>n<<64-e|t>>>e-32,po=(n,t,e)=>n>>>e-32|t<<64-e;function Tn(n,t,e,i){const r=(t>>>0)+(i>>>0);return{h:n+e+(r/2**32|0)|0,l:r|0}}const Cg=(n,t,e)=>(n>>>0)+(t>>>0)+(e>>>0),Pg=(n,t,e,i)=>t+e+i+(n/2**32|0)|0,Eg=(n,t,e,i)=>(n>>>0)+(t>>>0)+(e>>>0)+(i>>>0),Tg=(n,t,e,i,r)=>t+e+i+r+(n/2**32|0)|0,$g=(n,t,e,i,r)=>(n>>>0)+(t>>>0)+(e>>>0)+(i>>>0)+(r>>>0),Lg=(n,t,e,i,r,o)=>t+e+i+r+o+(n/2**32|0)|0,ql=_g(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(n=>BigInt(n))),Ig=ql[0],Fg=ql[1],Yn=new Uint32Array(80),Xn=new Uint32Array(80);class Dg extends Ag{constructor(t){super(128,t,16,!1)}get(){const{Ah:t,Al:e,Bh:i,Bl:r,Ch:o,Cl:s,Dh:a,Dl:l,Eh:c,El:h,Fh:f,Fl:u,Gh:d,Gl:p,Hh:y,Hl:g}=this;return[t,e,i,r,o,s,a,l,c,h,f,u,d,p,y,g]}set(t,e,i,r,o,s,a,l,c,h,f,u,d,p,y,g){this.Ah=t|0,this.Al=e|0,this.Bh=i|0,this.Bl=r|0,this.Ch=o|0,this.Cl=s|0,this.Dh=a|0,this.Dl=l|0,this.Eh=c|0,this.El=h|0,this.Fh=f|0,this.Fl=u|0,this.Gh=d|0,this.Gl=p|0,this.Hh=y|0,this.Hl=g|0}process(t,e){for(let v=0;v<16;v++,e+=4)Yn[v]=t.getUint32(e),Xn[v]=t.getUint32(e+=4);for(let v=16;v<80;v++){const b=Yn[v-15]|0,k=Xn[v-15]|0,M=Ti(b,k,1)^Ti(b,k,8)^Ul(b,k,7),C=$i(b,k,1)^$i(b,k,8)^jl(b,k,7),L=Yn[v-2]|0,_=Xn[v-2]|0,T=Ti(L,_,19)^fo(L,_,61)^Ul(L,_,6),I=$i(L,_,19)^po(L,_,61)^jl(L,_,6),E=Eg(C,I,Xn[v-7],Xn[v-16]),P=Tg(E,M,T,Yn[v-7],Yn[v-16]);Yn[v]=P|0,Xn[v]=E|0}let{Ah:i,Al:r,Bh:o,Bl:s,Ch:a,Cl:l,Dh:c,Dl:h,Eh:f,El:u,Fh:d,Fl:p,Gh:y,Gl:g,Hh:m,Hl:x}=this;for(let v=0;v<80;v++){const b=Ti(f,u,14)^Ti(f,u,18)^fo(f,u,41),k=$i(f,u,14)^$i(f,u,18)^po(f,u,41),M=f&d^~f&y,C=u&p^~u&g,L=$g(x,k,C,Fg[v],Xn[v]),_=Lg(L,m,b,M,Ig[v],Yn[v]),T=L|0,I=Ti(i,r,28)^fo(i,r,34)^fo(i,r,39),E=$i(i,r,28)^po(i,r,34)^po(i,r,39),P=i&o^i&a^o&a,S=r&s^r&l^s&l;m=y|0,x=g|0,y=d|0,g=p|0,d=f|0,p=u|0,{h:f,l:u}=Tn(c|0,h|0,_|0,T|0),c=a|0,h=l|0,a=o|0,l=s|0,o=i|0,s=r|0;const w=Cg(T,E,S);i=Pg(w,_,I,P),r=w|0}({h:i,l:r}=Tn(this.Ah|0,this.Al|0,i|0,r|0)),{h:o,l:s}=Tn(this.Bh|0,this.Bl|0,o|0,s|0),{h:a,l}=Tn(this.Ch|0,this.Cl|0,a|0,l|0),{h:c,l:h}=Tn(this.Dh|0,this.Dl|0,c|0,h|0),{h:f,l:u}=Tn(this.Eh|0,this.El|0,f|0,u|0),{h:d,l:p}=Tn(this.Fh|0,this.Fl|0,d|0,p|0),{h:y,l:g}=Tn(this.Gh|0,this.Gl|0,y|0,g|0),{h:m,l:x}=Tn(this.Hh|0,this.Hl|0,m|0,x|0),this.set(i,r,o,s,a,l,c,h,f,u,d,p,y,g,m,x)}roundClean(){Ys(Yn,Xn)}destroy(){this.destroyed=!0,Ys(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}class Rg extends Dg{constructor(){super(64);xt(this,"Ah",ve[0]|0);xt(this,"Al",ve[1]|0);xt(this,"Bh",ve[2]|0);xt(this,"Bl",ve[3]|0);xt(this,"Ch",ve[4]|0);xt(this,"Cl",ve[5]|0);xt(this,"Dh",ve[6]|0);xt(this,"Dl",ve[7]|0);xt(this,"Eh",ve[8]|0);xt(this,"El",ve[9]|0);xt(this,"Fh",ve[10]|0);xt(this,"Fl",ve[11]|0);xt(this,"Gh",ve[12]|0);xt(this,"Gl",ve[13]|0);xt(this,"Hh",ve[14]|0);xt(this,"Hl",ve[15]|0)}}const zg=wg(()=>new Rg,Mg(3));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Le=(n,t,e)=>ci(n,t,e),Zl=Gs,Kl=Us,Jl=(...n)=>vg(...n),Bg=n=>js(n),Og=Hl,Ng=n=>kg(n),go=BigInt(0),qs=BigInt(1);function mo(n,t=""){if(typeof n!="boolean"){const e=t&&`"${t}" `;throw new TypeError(e+"expected boolean, got type="+typeof n)}return n}function Wg(n){if(typeof n=="bigint"){if(!yo(n))throw new RangeError("positive bigint expected, got "+n)}else Zl(n);return n}function Zs(n,t=""){if(typeof n!="number"){const e=t&&`"${t}" `;throw new TypeError(e+"expected number, got type="+typeof n)}if(!Number.isSafeInteger(n)){const e=t&&`"${t}" `;throw new RangeError(e+"expected safe integer, got "+n)}}function Ql(n){if(typeof n!="string")throw new TypeError("hex string expected, got "+typeof n);return n===""?go:BigInt("0x"+n)}function Hg(n){return Ql(Us(n))}function ar(n){return Ql(Us(Ks(ci(n)).reverse()))}function th(n,t){if(Gs(t),t===0)throw new RangeError("zero length");n=Wg(n);const e=n.toString(16);if(e.length>t*2)throw new RangeError("number too large");return js(e.padStart(t*2,"0"))}function Vg(n,t){return th(n,t).reverse()}function Gg(n,t){if(n=Le(n),t=Le(t),n.length!==t.length)return!1;let e=0;for(let i=0;i<n.length;i++)e|=n[i]^t[i];return e===0}function Ks(n){return Uint8Array.from(Le(n))}const yo=n=>typeof n=="bigint"&&go<=n;function Yg(n,t,e){return yo(n)&&yo(t)&&yo(e)&&t<=n&&n<e}function eh(n,t,e,i){if(!Yg(t,e,i))throw new RangeError("expected valid "+n+": "+e+" <= n < "+i+", got "+t)}function Xg(n){if(n<go)throw new Error("expected non-negative bigint, got "+n);let t;for(t=0;n>go;n>>=qs,t+=1);return t}const Ug=n=>(qs<<BigInt(n))-qs;function Js(n,t={},e={}){if(Object.prototype.toString.call(n)!=="[object Object]")throw new TypeError("expected valid options object");function i(o,s,a){if(!a&&s!=="function"&&!Object.hasOwn(n,o))throw new TypeError(`param "${o}" is invalid: expected own property`);const l=n[o];if(a&&l===void 0)return;const c=typeof l;if(c!==s||l===null)throw new TypeError(`param "${o}" is invalid: expected ${s}, got ${c}`)}const r=(o,s)=>Object.entries(o).forEach(([a,l])=>i(a,l,s));r(t,!1),r(e,!0)}const nh=()=>{throw new Error("not implemented")};/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const we=BigInt(0),me=BigInt(1),li=BigInt(2),ih=BigInt(3),rh=BigInt(4),oh=BigInt(5),jg=BigInt(7),sh=BigInt(8),qg=BigInt(9),ah=BigInt(16);function ae(n,t){if(t<=we)throw new Error("mod: expected positive modulus, got "+t);const e=n%t;return e>=we?e:t+e}function bn(n,t,e){if(t<we)throw new Error("pow2: expected non-negative exponent, got "+t);let i=n;for(;t-- >we;)i*=i,i%=e;return i}function ch(n,t){if(n===we)throw new Error("invert: expected non-zero number");if(t<=we)throw new Error("invert: expected positive modulus, got "+t);let e=ae(n,t),i=t,r=we,o=me;for(;e!==we;){const a=i/e,l=i-e*a,c=r-o*a;i=e,e=l,r=o,o=c}if(i!==me)throw new Error("invert: does not exist");return ae(r,t)}function Qs(n,t,e){const i=n;if(!i.eql(i.sqr(t),e))throw new Error("Cannot find square root")}function lh(n,t){const e=n,i=(e.ORDER+me)/rh,r=e.pow(t,i);return Qs(e,r,t),r}function Zg(n,t){const e=n,i=(e.ORDER-oh)/sh,r=e.mul(t,li),o=e.pow(r,i),s=e.mul(t,o),a=e.mul(e.mul(s,li),o),l=e.mul(s,e.sub(a,e.ONE));return Qs(e,l,t),l}function Kg(n){const t=ta(n),e=hh(n),i=e(t,t.neg(t.ONE)),r=e(t,i),o=e(t,t.neg(i)),s=(n+jg)/ah;return(a,l)=>{const c=a;let h=c.pow(l,s),f=c.mul(h,i);const u=c.mul(h,r),d=c.mul(h,o),p=c.eql(c.sqr(f),l),y=c.eql(c.sqr(u),l);h=c.cmov(h,f,p),f=c.cmov(d,u,y);const g=c.eql(c.sqr(f),l),m=c.cmov(h,f,g);return Qs(c,m,l),m}}function hh(n){if(n<ih)throw new Error("sqrt is not defined for small field");let t=n-me,e=0;for(;t%li===we;)t/=li,e++;let i=li;const r=ta(n);for(;fh(r,i)===1;)if(i++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(e===1)return lh;let o=r.pow(i,t);const s=(t+me)/li;return function(l,c){const h=l;if(h.is0(c))return c;if(fh(h,c)!==1)throw new Error("Cannot find square root");let f=e,u=h.mul(h.ONE,o),d=h.pow(c,t),p=h.pow(c,s);for(;!h.eql(d,h.ONE);){if(h.is0(d))return h.ZERO;let y=1,g=h.sqr(d);for(;!h.eql(g,h.ONE);)if(y++,g=h.sqr(g),y===f)throw new Error("Cannot find square root");const m=me<<BigInt(f-y-1),x=h.pow(u,m);f=y,u=h.sqr(x),d=h.mul(d,u),p=h.mul(p,x)}return p}}function Jg(n){return n%rh===ih?lh:n%sh===oh?Zg:n%ah===qg?Kg(n):hh(n)}const hi=(n,t)=>(ae(n,t)&me)===me,Qg=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function t0(n){const t={ORDER:"bigint",BYTES:"number",BITS:"number"},e=Qg.reduce((i,r)=>(i[r]="function",i),t);if(Js(n,e),Zs(n.BYTES,"BYTES"),Zs(n.BITS,"BITS"),n.BYTES<1||n.BITS<1)throw new Error("invalid field: expected BYTES/BITS > 0");if(n.ORDER<=me)throw new Error("invalid field: expected ORDER > 1, got "+n.ORDER);return n}function e0(n,t,e){const i=n;if(e<we)throw new Error("invalid exponent, negatives unsupported");if(e===we)return i.ONE;if(e===me)return t;let r=i.ONE,o=t;for(;e>we;)e&me&&(r=i.mul(r,o)),o=i.sqr(o),e>>=me;return r}function uh(n,t,e=!1){const i=n,r=new Array(t.length).fill(e?i.ZERO:void 0),o=t.reduce((a,l,c)=>i.is0(l)?a:(r[c]=a,i.mul(a,l)),i.ONE),s=i.inv(o);return t.reduceRight((a,l,c)=>i.is0(l)?a:(r[c]=i.mul(a,r[c]),i.mul(a,l)),s),r}function fh(n,t){const e=n,i=(e.ORDER-me)/li,r=e.pow(t,i),o=e.eql(r,e.ONE),s=e.eql(r,e.ZERO),a=e.eql(r,e.neg(e.ONE));if(!o&&!s&&!a)throw new Error("invalid Legendre symbol result");return o?1:s?0:-1}function n0(n,t){if(t!==void 0&&Zl(t),n<=we)throw new Error("invalid n length: expected positive n, got "+n);if(t!==void 0&&t<1)throw new Error("invalid n length: expected positive bit length, got "+t);const e=Xg(n);if(t!==void 0&&t<e)throw new Error(`invalid n length: expected bit length (${e}) >= n.length (${t})`);const i=t!==void 0?t:e,r=Math.ceil(i/8);return{nBitLength:i,nByteLength:r}}const dh=new WeakMap;class ph{constructor(t,e={}){xt(this,"ORDER");xt(this,"BITS");xt(this,"BYTES");xt(this,"isLE");xt(this,"ZERO",we);xt(this,"ONE",me);xt(this,"_lengths");xt(this,"_mod");if(t<=me)throw new Error("invalid field: expected ORDER > 1, got "+t);let i;this.isLE=!1,e!=null&&typeof e=="object"&&(typeof e.BITS=="number"&&(i=e.BITS),typeof e.sqrt=="function"&&Object.defineProperty(this,"sqrt",{value:e.sqrt,enumerable:!0}),typeof e.isLE=="boolean"&&(this.isLE=e.isLE),e.allowedLengths&&(this._lengths=Object.freeze(e.allowedLengths.slice())),typeof e.modFromBytes=="boolean"&&(this._mod=e.modFromBytes));const{nBitLength:r,nByteLength:o}=n0(t,i);if(o>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");this.ORDER=t,this.BITS=r,this.BYTES=o,Object.freeze(this)}create(t){return ae(t,this.ORDER)}isValid(t){if(typeof t!="bigint")throw new TypeError("invalid field element: expected bigint, got "+typeof t);return we<=t&&t<this.ORDER}is0(t){return t===we}isValidNot0(t){return!this.is0(t)&&this.isValid(t)}isOdd(t){return(t&me)===me}neg(t){return ae(-t,this.ORDER)}eql(t,e){return t===e}sqr(t){return ae(t*t,this.ORDER)}add(t,e){return ae(t+e,this.ORDER)}sub(t,e){return ae(t-e,this.ORDER)}mul(t,e){return ae(t*e,this.ORDER)}pow(t,e){return e0(this,t,e)}div(t,e){return ae(t*ch(e,this.ORDER),this.ORDER)}sqrN(t){return t*t}addN(t,e){return t+e}subN(t,e){return t-e}mulN(t,e){return t*e}inv(t){return ch(t,this.ORDER)}sqrt(t){let e=dh.get(this);return e||dh.set(this,e=Jg(this.ORDER)),e(this,t)}toBytes(t){return this.isLE?Vg(t,this.BYTES):th(t,this.BYTES)}fromBytes(t,e=!1){Le(t);const{_lengths:i,BYTES:r,isLE:o,ORDER:s,_mod:a}=this;if(i){if(t.length<1||!i.includes(t.length)||t.length>r)throw new Error("Field.fromBytes: expected "+i+" bytes, got "+t.length);const c=new Uint8Array(r);c.set(t,o?0:c.length-t.length),t=c}if(t.length!==r)throw new Error("Field.fromBytes: expected "+r+" bytes, got "+t.length);let l=o?ar(t):Hg(t);if(a&&(l=ae(l,s)),!e&&!this.isValid(l))throw new Error("invalid field element: outside of range 0..ORDER");return l}invertBatch(t){return uh(this,t)}cmov(t,e,i){return mo(i,"condition"),i?e:t}}Object.freeze(ph.prototype);function ta(n,t={}){return new ph(n,t)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const xo=BigInt(0),ea=BigInt(1);function gh(n,t){const e=t.negate();return n?e:t}function na(n,t){const e=uh(n.Fp,t.map(i=>i.Z));return t.map((i,r)=>n.fromAffine(i.toAffine(e[r])))}function mh(n,t){if(!Number.isSafeInteger(n)||n<=0||n>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+n)}function ia(n,t){mh(n,t);const e=Math.ceil(t/n)+1,i=2**(n-1),r=2**n,o=Ug(n),s=BigInt(n);return{windows:e,windowSize:i,mask:o,maxNumber:r,shiftBy:s}}function yh(n,t,e){const{windowSize:i,mask:r,maxNumber:o,shiftBy:s}=e;let a=Number(n&r),l=n>>s;a>i&&(a-=o,l+=ea);const c=t*i,h=c+Math.abs(a)-1,f=a===0,u=a<0,d=t%2!==0;return{nextN:l,offset:h,isZero:f,isNeg:u,isNegF:d,offsetF:c}}const ra=new WeakMap,xh=new WeakMap;function oa(n){return xh.get(n)||1}function bh(n){if(n!==xo)throw new Error("invalid wNAF")}class i0{constructor(t,e){xt(this,"BASE");xt(this,"ZERO");xt(this,"Fn");xt(this,"bits");this.BASE=t.BASE,this.ZERO=t.ZERO,this.Fn=t.Fn,this.bits=e}_unsafeLadder(t,e,i=this.ZERO){let r=t;for(;e>xo;)e&ea&&(i=i.add(r)),r=r.double(),e>>=ea;return i}precomputeWindow(t,e){const{windows:i,windowSize:r}=ia(e,this.bits),o=[];let s=t,a=s;for(let l=0;l<i;l++){a=s,o.push(a);for(let c=1;c<r;c++)a=a.add(s),o.push(a);s=a.double()}return o}wNAF(t,e,i){if(!this.Fn.isValid(i))throw new Error("invalid scalar");let r=this.ZERO,o=this.BASE;const s=ia(t,this.bits);for(let a=0;a<s.windows;a++){const{nextN:l,offset:c,isZero:h,isNeg:f,isNegF:u,offsetF:d}=yh(i,a,s);i=l,h?o=o.add(gh(u,e[d])):r=r.add(gh(f,e[c]))}return bh(i),{p:r,f:o}}wNAFUnsafe(t,e,i,r=this.ZERO){const o=ia(t,this.bits);for(let s=0;s<o.windows&&i!==xo;s++){const{nextN:a,offset:l,isZero:c,isNeg:h}=yh(i,s,o);if(i=a,!c){const f=e[l];r=r.add(h?f.negate():f)}}return bh(i),r}getPrecomputes(t,e,i){let r=ra.get(e);return r||(r=this.precomputeWindow(e,t),t!==1&&(typeof i=="function"&&(r=i(r)),ra.set(e,r))),r}cached(t,e,i){const r=oa(t);return this.wNAF(r,this.getPrecomputes(r,t,i),e)}unsafe(t,e,i,r){const o=oa(t);return o===1?this._unsafeLadder(t,e,r):this.wNAFUnsafe(o,this.getPrecomputes(o,t,i),e,r)}createCache(t,e){mh(e,this.bits),xh.set(t,e),ra.delete(t)}hasCache(t){return oa(t)!==1}}function vh(n,t,e){if(t){if(t.ORDER!==n)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return t0(t),t}else return ta(n,{isLE:e})}function r0(n,t,e={},i){if(i===void 0&&(i=n==="edwards"),!t||typeof t!="object")throw new Error(`expected valid ${n} CURVE object`);for(const l of["p","n","h"]){const c=t[l];if(!(typeof c=="bigint"&&c>xo))throw new Error(`CURVE.${l} must be positive bigint`)}const r=vh(t.p,e.Fp,i),o=vh(t.n,e.Fn,i),a=["Gx","Gy","a","d"];for(const l of a)if(!r.isValid(t[l]))throw new Error(`CURVE.${l} must be valid field element of CURVE.Fp`);return t=Object.freeze(Object.assign({},t)),{CURVE:t,Fp:r,Fn:o}}function o0(n,t){return function(i){const r=n(i);return{secretKey:r,publicKey:t(r)}}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Un=BigInt(0),ue=BigInt(1),sa=BigInt(2),s0=BigInt(8);function a0(n,t,e,i){const r=n.sqr(e),o=n.sqr(i),s=n.add(n.mul(t.a,r),o),a=n.add(n.ONE,n.mul(t.d,n.mul(r,o)));return n.eql(s,a)}function c0(n,t={}){const e=t,i=r0("edwards",n,e,e.FpFnLE),{Fp:r,Fn:o}=i;let s=i.CURVE;const{h:a}=s;Js(e,{},{uvRatio:"function"});const l=sa<<BigInt(o.BYTES*8)-ue,c=g=>r.create(g),h=e.uvRatio===void 0?(g,m)=>{try{return{isValid:!0,value:r.sqrt(r.div(g,m))}}catch{return{isValid:!1,value:Un}}}:e.uvRatio;if(!a0(r,s,s.Gx,s.Gy))throw new Error("bad curve params: generator point");function f(g,m,x=!1){const v=x?ue:Un;return eh("coordinate "+g,m,v,l),m}function u(g){if(!(g instanceof d))throw new Error("EdwardsPoint expected")}const y=class y{constructor(m,x,v,b){xt(this,"X");xt(this,"Y");xt(this,"Z");xt(this,"T");this.X=f("x",m),this.Y=f("y",x),this.Z=f("z",v,!0),this.T=f("t",b),Object.freeze(this)}static CURVE(){return s}static fromAffine(m){if(m instanceof y)throw new Error("extended point not allowed");const{x,y:v}=m||{};return f("x",x),f("y",v),new y(x,v,ue,c(x*v))}static fromBytes(m,x=!1){const v=r.BYTES,{a:b,d:k}=s;m=Ks(Le(m,v,"point")),mo(x,"zip215");const M=Ks(m),C=m[v-1];M[v-1]=C&-129;const L=ar(M),_=x?l:r.ORDER;eh("point.y",L,Un,_);const T=c(L*L),I=c(T-ue),E=c(k*T-b);let{isValid:P,value:S}=h(I,E);if(!P)throw new Error("bad point: invalid y coordinate");const w=(S&ue)===ue,A=(C&128)!==0;if(!x&&S===Un&&A)throw new Error("bad point: x=0 and x_0=1");return A!==w&&(S=c(-S)),y.fromAffine({x:S,y:L})}static fromHex(m,x=!1){return y.fromBytes(Bg(m),x)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(m=8,x=!0){return p.createCache(this,m),x||this.multiply(sa),this}assertValidity(){const m=this,{a:x,d:v}=s;if(m.is0())throw new Error("bad point: ZERO");const{X:b,Y:k,Z:M,T:C}=m,L=c(b*b),_=c(k*k),T=c(M*M),I=c(T*T),E=c(L*x),P=c(T*c(E+_)),S=c(I+c(v*c(L*_)));if(P!==S)throw new Error("bad point: equation left != right (1)");const w=c(b*k),A=c(M*C);if(w!==A)throw new Error("bad point: equation left != right (2)")}equals(m){u(m);const{X:x,Y:v,Z:b}=this,{X:k,Y:M,Z:C}=m,L=c(x*C),_=c(k*b),T=c(v*C),I=c(M*b);return L===_&&T===I}is0(){return this.equals(y.ZERO)}negate(){return new y(c(-this.X),this.Y,this.Z,c(-this.T))}double(){const{a:m}=s,{X:x,Y:v,Z:b}=this,k=c(x*x),M=c(v*v),C=c(sa*c(b*b)),L=c(m*k),_=x+v,T=c(c(_*_)-k-M),I=L+M,E=I-C,P=L-M,S=c(T*E),w=c(I*P),A=c(T*P),$=c(E*I);return new y(S,w,$,A)}add(m){u(m);const{a:x,d:v}=s,{X:b,Y:k,Z:M,T:C}=this,{X:L,Y:_,Z:T,T:I}=m,E=c(b*L),P=c(k*_),S=c(C*v*I),w=c(M*T),A=c((b+k)*(L+_)-E-P),$=w-S,D=w+S,F=c(P-x*E),R=c(A*$),z=c(D*F),B=c(A*F),H=c($*D);return new y(R,z,H,B)}subtract(m){return u(m),this.add(m.negate())}multiply(m){if(!o.isValidNot0(m))throw new RangeError("invalid scalar: expected 1 <= sc < curve.n");const{p:x,f:v}=p.cached(this,m,b=>na(y,b));return na(y,[x,v])[0]}multiplyUnsafe(m){if(!o.isValid(m))throw new RangeError("invalid scalar: expected 0 <= sc < curve.n");return m===Un?y.ZERO:this.is0()||m===ue?this:p.unsafe(this,m,x=>na(y,x))}isSmallOrder(){return this.clearCofactor().is0()}isTorsionFree(){return p.unsafe(this,s.n).is0()}toAffine(m){const x=this;let v=m;const{X:b,Y:k,Z:M}=x,C=x.is0();v==null&&(v=C?s0:r.inv(M));const L=c(b*v),_=c(k*v),T=r.mul(M,v);if(C)return{x:Un,y:ue};if(T!==ue)throw new Error("invZ was invalid");return{x:L,y:_}}clearCofactor(){return a===ue?this:this.multiplyUnsafe(a)}toBytes(){const{x:m,y:x}=this.toAffine(),v=r.toBytes(x);return v[v.length-1]|=m&ue?128:0,v}toHex(){return Kl(this.toBytes())}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}};xt(y,"BASE",new y(s.Gx,s.Gy,ue,c(s.Gx*s.Gy))),xt(y,"ZERO",new y(Un,ue,ue,Un)),xt(y,"Fp",r),xt(y,"Fn",o);let d=y;const p=new i0(d,o.BITS);return o.BITS>=8&&d.BASE.precompute(8),Object.freeze(d.prototype),Object.freeze(d),d}class cr{constructor(t){xt(this,"ep");this.ep=t}static fromBytes(t){nh()}static fromHex(t){nh()}get x(){return this.toAffine().x}get y(){return this.toAffine().y}clearCofactor(){return this}assertValidity(){this.ep.assertValidity()}toAffine(t){return this.ep.toAffine(t)}toHex(){return Kl(this.toBytes())}toString(){return this.toHex()}isTorsionFree(){return!0}isSmallOrder(){return!1}add(t){return this.assertSame(t),this.init(this.ep.add(t.ep))}subtract(t){return this.assertSame(t),this.init(this.ep.subtract(t.ep))}multiply(t){return this.init(this.ep.multiply(t))}multiplyUnsafe(t){return this.init(this.ep.multiplyUnsafe(t))}double(){return this.init(this.ep.double())}negate(){return this.init(this.ep.negate())}precompute(t,e){return this.ep.precompute(t,e),this}}xt(cr,"BASE"),xt(cr,"ZERO"),xt(cr,"Fp"),xt(cr,"Fn");function l0(n,t,e={}){if(typeof t!="function")throw new Error('"hash" function param is required');const i=t,r=e;Js(r,{},{adjustScalarBytes:"function",randomBytes:"function",domain:"function",prehash:"function",zip215:"boolean",mapToCurve:"function"});const{prehash:o}=r,{BASE:s,Fp:a,Fn:l}=n,c=i.outputLen,h=2*a.BYTES;if(c!==void 0&&(Zs(c,"hash.outputLen"),c!==h))throw new Error(`hash.outputLen must be ${h}, got ${c}`);const f=r.randomBytes===void 0?Ng:r.randomBytes,u=r.adjustScalarBytes===void 0?E=>E:r.adjustScalarBytes,d=r.domain===void 0?(E,P,S)=>{if(mo(S,"phflag"),P.length||S)throw new Error("Contexts/pre-hash are not supported");return E}:r.domain;function p(E){return l.create(ar(E))}function y(E){const P=C.secretKey;Le(E,C.secretKey,"secretKey");const S=Le(i(E),2*P,"hashedSecretKey"),w=u(S.slice(0,P)),A=S.slice(P,2*P),$=p(w);return{head:w,prefix:A,scalar:$}}function g(E){const{head:P,prefix:S,scalar:w}=y(E),A=s.multiply(w),$=A.toBytes();return{head:P,prefix:S,scalar:w,point:A,pointBytes:$}}function m(E){return g(E).pointBytes}function x(E=Uint8Array.of(),...P){const S=Jl(...P);return p(i(d(S,Le(E,void 0,"context"),!!o)))}function v(E,P,S={}){E=Le(E,void 0,"message"),o&&(E=o(E));const{prefix:w,scalar:A,pointBytes:$}=g(P),D=x(S.context,w,E),F=s.multiply(D).toBytes(),R=x(S.context,F,$,E),z=l.create(D+R*A);if(!l.isValid(z))throw new Error("sign failed: invalid s");const B=Jl(F,l.toBytes(z));return Le(B,C.signature,"result")}const b={zip215:r.zip215};function k(E,P,S,w=b){const{context:A}=w,$=w.zip215===void 0?!!b.zip215:w.zip215,D=C.signature;E=Le(E,D,"signature"),P=Le(P,void 0,"message"),S=Le(S,C.publicKey,"publicKey"),$!==void 0&&mo($,"zip215"),o&&(P=o(P));const F=D/2,R=E.subarray(0,F),z=ar(E.subarray(F,D));let B,H,J;try{B=n.fromBytes(S,$),H=n.fromBytes(R,$),J=s.multiplyUnsafe(z)}catch{return!1}if(!$&&B.isSmallOrder())return!1;const X=x(A,R,S,P);return H.add(B.multiplyUnsafe(X)).subtract(J).clearCofactor().is0()}const M=a.BYTES,C={secretKey:M,publicKey:M,signature:2*M,seed:M};function L(E){return E=E===void 0?f(C.seed):E,Le(E,C.seed,"seed")}function _(E){return Og(E)&&E.length===C.secretKey}function T(E,P){try{return!!n.fromBytes(E,P===void 0?b.zip215:P)}catch{return!1}}const I={getExtendedPublicKey:g,randomSecretKey:L,isValidSecretKey:_,isValidPublicKey:T,toMontgomery(E){const{y:P}=n.fromBytes(E),S=C.publicKey,w=S===32;if(!w&&S!==57)throw new Error("only defined for 25519 and 448");const A=w?a.div(ue+P,ue-P):a.div(P-ue,P+ue);return a.toBytes(A)},toMontgomerySecret(E){const P=C.secretKey;Le(E,P);const S=i(E.subarray(0,P));return u(S).subarray(0,P)}};return Object.freeze(C),Object.freeze(I),Object.freeze({keygen:o0(L,m),getPublicKey:m,sign:v,verify:k,utils:I,Point:n,lengths:C})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const h0=BigInt(0),lr=BigInt(1),wh=BigInt(2),u0=BigInt(5),f0=BigInt(8),hr=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"),kh={p:hr,n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),h:f0,a:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),d:BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),Gx:BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),Gy:BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")};function d0(n){const t=BigInt(10),e=BigInt(20),i=BigInt(40),r=BigInt(80),o=hr,a=n*n%o*n%o,l=bn(a,wh,o)*a%o,c=bn(l,lr,o)*n%o,h=bn(c,u0,o)*c%o,f=bn(h,t,o)*h%o,u=bn(f,e,o)*f%o,d=bn(u,i,o)*u%o,p=bn(d,r,o)*d%o,y=bn(p,r,o)*d%o,g=bn(y,t,o)*h%o;return{pow_p_5_8:bn(g,wh,o)*n%o,b2:a}}function p0(n){return n[0]&=248,n[31]&=127,n[31]|=64,n}const aa=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");function Mh(n,t){const e=hr,i=ae(t*t*t,e),r=ae(i*i*t,e),o=d0(n*r).pow_p_5_8;let s=ae(n*i*o,e);const a=ae(t*s*s,e),l=s,c=ae(s*aa,e),h=a===n,f=a===ae(-n,e),u=a===ae(-n*aa,e);return h&&(s=l),(f||u)&&(s=c),hi(s,e)&&(s=ae(-s,e)),{isValid:h||f,value:s}}const ui=c0(kh,{uvRatio:Mh}),fi=ui.Fp,g0=ui.Fn;function m0(n){return l0(ui,zg,Object.assign({adjustScalarBytes:p0,zip215:!0},n))}const y0=m0({}),Ah=aa,x0=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),Sh=n=>Mh(lr,n),b0=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),v0=n=>fi.create(ar(n)&b0),He=class He extends cr{constructor(t){super(t)}static fromAffine(t){return new He(ui.fromAffine(t))}assertSame(t){if(!(t instanceof He))throw new Error("RistrettoPoint expected")}init(t){return new He(t)}static fromBytes(t){ci(t,32);const{a:e,d:i}=kh,r=hr,o=b=>fi.create(b),s=v0(t);if(!Gg(fi.toBytes(s),t)||hi(s,r))throw new Error("invalid ristretto255 encoding 1");const a=o(s*s),l=o(lr+e*a),c=o(lr-e*a),h=o(l*l),f=o(c*c),u=o(e*i*h-f),{isValid:d,value:p}=Sh(o(u*f)),y=o(p*c),g=o(p*y*u);let m=o((s+s)*y);hi(m,r)&&(m=o(-m));const x=o(l*g),v=o(m*x);if(!d||hi(v,r)||x===h0)throw new Error("invalid ristretto255 encoding 2");return new He(new ui(m,x,lr,v))}static fromHex(t){return He.fromBytes(js(t))}toBytes(){let{X:t,Y:e,Z:i,T:r}=this.ep;const o=hr,s=g=>fi.create(g),a=s(s(i+e)*s(i-e)),l=s(t*e),c=s(l*l),{value:h}=Sh(s(a*c)),f=s(h*a),u=s(h*l),d=s(f*u*r);let p;if(hi(r*d,o)){let g=s(e*Ah),m=s(t*Ah);t=g,e=m,p=s(f*x0)}else p=u;hi(t*d,o)&&(e=s(-e));let y=s((i-e)*p);return hi(y,o)&&(y=s(-y)),fi.toBytes(y)}equals(t){this.assertSame(t);const{X:e,Y:i}=this.ep,{X:r,Y:o}=t.ep,s=c=>fi.create(c),a=s(e*o)===s(i*r),l=s(i*o)===s(e*r);return a||l}is0(){return this.equals(He.ZERO)}};xt(He,"BASE",new He(ui.BASE)),xt(He,"ZERO",new He(ui.ZERO)),xt(He,"Fp",fi),xt(He,"Fn",g0);let Li=He;Object.freeze(Li.BASE),Object.freeze(Li.ZERO),Object.freeze(Li.prototype),Object.freeze(Li);const _h="katucharts_license",w0=7*24*60*60*1e3,k0=60*60*1e3,M0=8e3,jA="3ab57dfcba56a3c6b1949906ef075ff6536f2a40b328a77733e4d8d837cb6abe";class A0{constructor(){this.licenseKey=null,this.payload=null,this.offlineValid=!1,this.verifyUrl=null,this.mode="lenient",this.gracePeriodMs=w0,this.recheckIntervalMs=k0,this.cache=null,this.pending=!1,this.timer=null,this.listeners=new Set,this.lastEmitted=null}configure(t){t.verifyUrl!==void 0&&(this.verifyUrl=t.verifyUrl||null),t.mode&&(this.mode=t.mode),t.gracePeriodMs!==void 0&&(this.gracePeriodMs=t.gracePeriodMs),t.recheckIntervalMs!==void 0&&(this.recheckIntervalMs=t.recheckIntervalMs),this.offlineValid&&this.verifyUrl&&this.startOnlineChecks(),this.emit()}setKey(t){this.licenseKey=t,this.payload=null,this.offlineValid=!1,this.cache=null;const e=this.validate(t);return e&&(this.payload=e,this.offlineValid=!0,this.cache=this.loadCache(e.kid)),this.offlineValid&&this.verifyUrl&&this.startOnlineChecks(),this.emit(),this.isLicensed()}isLicensed(){var t;return this.offlineValid?this.verifyUrl?((t=this.cache)==null?void 0:t.lastResult)==="invalid"?!1:this.cache&&this.cache.lastValidAt>0&&ca()-this.cache.lastValidAt<this.gracePeriodMs||this.pending?!0:this.mode!=="strict":!0:!1}getPayload(){return this.payload}onChange(t){return this.listeners.add(t),()=>this.listeners.delete(t)}startOnlineChecks(){var t,e;this.verifyOnline(),this.timer==null&&typeof setInterval<"u"&&this.recheckIntervalMs>0&&(this.timer=setInterval(()=>void this.verifyOnline(),this.recheckIntervalMs),(e=(t=this.timer)==null?void 0:t.unref)==null||e.call(t))}async verifyOnline(){if(!this.verifyUrl||!this.licenseKey||!this.payload||typeof fetch>"u")return;this.pending=!0;const t=this.payload.kid??"",e=typeof window<"u"?window.location.hostname:"";let i="unreachable";try{const r=typeof AbortController<"u"?new AbortController:null,o=r?setTimeout(()=>r.abort(),M0):null,s=await fetch(this.verifyUrl,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({key:this.licenseKey,domain:e,kid:t}),signal:r==null?void 0:r.signal});o&&clearTimeout(o),s.ok?i=(await s.json()).valid?"valid":"invalid":s.status>=400&&s.status<500&&(i="invalid")}catch{i="unreachable"}this.pending=!1,this.applyResult(t,i)}applyResult(t,e){const i=this.cache,r={kid:t,lastResult:e,lastValidAt:e==="valid"?ca():(i==null?void 0:i.lastValidAt)??0,updatedAt:ca()};this.cache=r,this.saveCache(r),this.emit()}emit(){const t=this.isLicensed();t!==this.lastEmitted&&(this.lastEmitted=t,this.listeners.forEach(e=>{try{e(t)}catch{}}))}loadCache(t){if(!t||typeof localStorage>"u")return null;try{const e=localStorage.getItem(_h);if(!e)return null;const i=JSON.parse(e);return i.kid===t?i:null}catch{return null}}saveCache(t){if(!(typeof localStorage>"u"))try{localStorage.setItem(_h,JSON.stringify(t))}catch{}}validate(t){try{const e=t.indexOf(".");if(e===-1)return null;const i=t.substring(0,e),r=t.substring(e+1),o="3ab57dfcba56a3c6b1949906ef075ff6536f2a40b328a77733e4d8d837cb6abe",s=new TextEncoder().encode(i);if(!y0.verify(Ch(r),s,Ch(o)))return null;const a=atob(i),l=JSON.parse(a);return!l.customer||!this.checkExpiry(l.expiry)||!this.checkDomain(l.domains)?null:l}catch{return null}}checkExpiry(t){if(!t)return!0;try{return new Date(t).getTime()>=Date.now()}catch{return!1}}checkDomain(t){if(!t||t.length===0||typeof window>"u")return!0;const e=window.location.hostname;return t.some(i=>{if(i.startsWith("*.")){const r=i.substring(1);return e.endsWith(r)||e===i.substring(2)}return e===i})}}function ca(){return Date.now()}function Ch(n){if(n.length%2!==0)throw new Error("invalid hex length");const t=new Uint8Array(n.length/2);for(let e=0;e<t.length;e++)t[e]=parseInt(n.slice(e*2,e*2+2),16);return t}const Qe=new A0;class S0{constructor(){this.indicators=new Map}register(t){this.indicators.set(t.name.toLowerCase(),t)}get(t){return this.indicators.get(t.toLowerCase())}getAll(){return new Map(this.indicators)}}const Ph=globalThis,_0=Ph.__katuIndicatorRegistry||(Ph.__katuIndicatorRegistry=new S0),la={sma:"sma",ema:"ema",wma:"wma",rsi:"rsi",macd:"macd",stochastic:"stochastic",stoch:"stochastic",bb:"bollingerbands",bollinger:"bollingerbands",bollingerbands:"bollingerbands",atr:"atr",vwap:"vwap",obv:"obv",vbp:"vbp",ichimoku:"ichimoku",ikh:"ichimoku",cci:"cci",roc:"roc",momentum:"momentum",mom:"momentum",dema:"dema",tema:"tema",adx:"adx",psar:"psar"},C0=new Set(Object.keys(la));function ha(n){return!!n&&C0.has(n.toLowerCase())}const Eh="#7798BF",ua="#f15c80",P0="#90ed7d";function E0(n){return n.map((t,e)=>{const i=t.close??t.y??0;return{x:t.x??e,open:t.open??i,high:t.high??i,low:t.low??i,close:i,volume:t.volume??t.z}})}function T0(n,t){const e=n.linkedTo;if(typeof e=="string"){const i=t.find(r=>r.id===e);if(i)return i}return typeof e=="number"&&t[e]?t[e]:t.find(i=>i!==n&&!ha(i._internalType))??null}const $0={sma:"SMA",ema:"EMA",wma:"WMA",rsi:"RSI",macd:"MACD",stochastic:"Stochastic",bollingerbands:"Bollinger Bands",atr:"ATR",vwap:"VWAP",obv:"OBV",ichimoku:"Ichimoku",cci:"CCI",roc:"ROC",momentum:"Momentum",dema:"DEMA",tema:"TEMA",adx:"ADX",psar:"PSAR"};function L0(n,t){const e=$0[n]||n.toUpperCase(),i=t.period;return i?`${e} (${i})`:e}function tn(n,t,e,i){return{...n,type:t,_internalType:t,_processedData:e,data:e,params:void 0,linkedTo:void 0,...i}}function I0(n,t){return n.map((e,i)=>{var r;return{x:e.x,low:((r=t[i])==null?void 0:r.y)??null,high:e.y??null}})}function F0(n,t,e,i){const r=[],o=n.color||Eh,s=n.lineWidth??1.5,a=n.name||L0(t,i);if(e.bands){if(r.push(tn(n,"arearange",I0(e.bands.upper,e.bands.lower),{name:`${a} band`,color:n.color||Eh,fillOpacity:n.fillOpacity??.15,lineWidth:0,showInLegend:!1,enableMouseTracking:!1})),t==="ichimoku")r.push(tn(n,"line",e.values,{name:`${a} Tenkan`,color:o,lineWidth:s,marker:{enabled:!1}})),e.signal&&r.push(tn(n,"line",e.signal,{name:`${a} Kijun`,color:ua,lineWidth:s,marker:{enabled:!1}}));else{const l=e.bands.middle??e.values;r.push(tn(n,"line",l,{name:a,color:o,lineWidth:s,marker:{enabled:!1}}))}return r}return e.histogram?(r.push(tn(n,"column",e.histogram,{name:`${a} Histogram`,color:P0,showInLegend:!1,enableMouseTracking:!1})),r.push(tn(n,"line",e.values,{name:a,color:o,lineWidth:s,marker:{enabled:!1}})),e.signal&&r.push(tn(n,"line",e.signal,{name:`${a} Signal`,color:ua,lineWidth:s,marker:{enabled:!1}})),r):e.signal?(r.push(tn(n,"line",e.values,{name:`${a} %K`,color:o,lineWidth:s,marker:{enabled:!1}})),r.push(tn(n,"line",e.signal,{name:`${a} %D`,color:ua,lineWidth:s,marker:{enabled:!1}})),r):t==="vbp"?(r.push(tn(n,"vbp",e.values,{name:a,showInLegend:n.showInLegend??!1})),r):t==="psar"?(r.push(tn(n,"scatter",e.values,{name:a,color:o,marker:{enabled:!0,radius:2,symbol:"circle"}})),r):(r.push(tn(n,"line",e.values,{name:a,color:o,lineWidth:s,marker:{enabled:!1}})),r)}function D0(n){if(!n.some(e=>ha(e._internalType)))return n;const t=[];for(const e of n){const i=(e._internalType||"").toLowerCase();if(!ha(i)){t.push(e);continue}const r=_0.get(la[i]),o=T0(e,n);if(!r||!o){t.push({...e,type:"line",_internalType:"line",_processedData:[],data:[]});continue}const s=e.params||{},a=r.calculate(E0(o._processedData||[]),s);t.push(...F0(e,la[i],a,s))}return t.map((e,i)=>({...e,index:i}))}let bo={};function fa(n){bo=he(bo,n)}function Th(){return bo}const Qn=class Qn{parse(t){var o;(o=t.chart)!=null&&o.palette&&!t.colors&&(t={...t,colors:Tl(t.chart.palette)});const e=t.theme?Il(t.theme):void 0,i=this.mergeWithDefaults(t,e),r=this.normalize(i);return this.toInternal(r)}mergeWithDefaults(t,e){return he(he({},Hs),bo,e??{},t)}normalize(t){var c,h,f;const e={...t};e.xAxis&&!Array.isArray(e.xAxis)&&(e.xAxis=[e.xAxis]),e.yAxis&&!Array.isArray(e.yAxis)&&(e.yAxis=[e.yAxis]),e.colorAxis&&!Array.isArray(e.colorAxis)&&(e.colorAxis=[e.colorAxis]),(!e.xAxis||Array.isArray(e.xAxis)&&e.xAxis.length===0)&&(e.xAxis=[he({},Hs.xAxis)]),(!e.yAxis||Array.isArray(e.yAxis)&&e.yAxis.length===0)&&(e.yAxis=[he({},Hs.yAxis)]);for(const u of[e.xAxis,e.yAxis])if(Array.isArray(u))for(const d of u)d.categories&&d.categories.length>0&&(d.type="category");e.series&&!Array.isArray(e.series)&&(e.series=[e.series]);const i=((c=e.chart)==null?void 0:c.type)||"line",r=i==="bar"||Array.isArray(e.series)&&e.series.some(u=>u.type==="bar");if(e.chart&&(r?(e.chart.inverted=!0,e.chart._invertedFromBar=!0):e.chart._invertedFromBar&&(e.chart.inverted=!1,delete e.chart._invertedFromBar)),(i==="manhattan"||Array.isArray(e.series)&&e.series.some(u=>u.type==="manhattan"))&&Array.isArray(e.xAxis)&&(!Array.isArray(e.series)||e.series.some(d=>(d.type==="manhattan"||!d.type&&i==="manhattan")&&d.showChromosomeLabels!==!1)))for(const d of e.xAxis)d.labels={...d.labels,enabled:!1},d.tickLength=0;const s=!!((h=e.chart)!=null&&h.polar),a=(f=e.chart)==null?void 0:f.type;s&&Array.isArray(e.series)&&(e.series=e.series.map(u=>{const d=u.type||a||"line",p=!u.type||u.type==="line"||u.type==="spline",y=!u.type&&(a==="line"||a==="spline"),g={...u,type:p?"radar":u.type};return u.type==="line"||u.type==="spline"||y?g._polarSubType="line":(d==="column"||d==="bar")&&(g._polarSubType="column"),g}));const l=Array.isArray(e.colorAxis)?e.colorAxis[0]:e.colorAxis;return Array.isArray(e.series)&&(e.series=e.series.map(u=>{const d=this.normalizeSeries(u,s&&(!u.type||u.type==="line"||u.type==="spline")?"radar":i,e.plotOptions);return(d.type==="heatmap"||d.type==="treemap")&&l&&!d.colorAxis&&(d.colorAxis=l),(d.type==="map"||d.type==="mappoint"||d.type==="flowmap")&&this.applyMapTopLevelOptions(d,e,l),d})),this.applyAutoHeight(e),e}applyAutoHeight(t){var i;const e=t.chart;if(e){if(e._autoScrollMinHeight!=null){const r=e.scrollablePlotArea;if(r&&typeof r=="object"&&r.minHeight===e._autoScrollMinHeight){const o={...r};delete o.minHeight,e.scrollablePlotArea=Object.keys(o).length?o:void 0}delete e._autoScrollMinHeight}if(e.height==null&&e.inverted){const r=Array.isArray(t.xAxis)?t.xAxis:t.xAxis?[t.xAxis]:[];let o=0;for(const s of r){const a=((i=s==null?void 0:s.categories)==null?void 0:i.length)??0;a>o&&(o=a)}if(o>12){const s=Math.min(o*16+130,6e3),a=e.scrollablePlotArea&&typeof e.scrollablePlotArea=="object"?e.scrollablePlotArea:{};e.scrollablePlotArea={...a,minHeight:s},e._autoScrollMinHeight=s;return}}}}applyMapTopLevelOptions(t,e,i){var r,o;i&&(!t.colorAxis||typeof t.colorAxis!="object")&&(t.colorAxis=i),t.mapNavigation==null&&e.mapNavigation!=null&&(t.mapNavigation=e.mapNavigation),t.projection==null&&((r=e.mapView)==null?void 0:r.projection)!=null&&(t.projection=e.mapView.projection),t.mapData==null&&((o=e.chart)==null?void 0:o.map)!=null&&(t.mapData=e.chart.map)}static mergeDataLabels(t){let e;for(const i of t)i!==void 0&&(e=Qn.mergeTwoDataLabels(e,i));return e}static mergeTwoDataLabels(t,e){if(t===void 0)return e;if(e===void 0)return t;const i=Array.isArray(t)?t:[t],r=Array.isArray(e)?e:[e],o=Math.max(i.length,r.length),s=[];for(let a=0;a<o;a++){const l=i[a]??i[0]??{},c=r[a]??r[0]??{};s.push(he({},l,c))}return s.length===1&&!Array.isArray(t)&&!Array.isArray(e)?s[0]:s}normalizeSeries(t,e,i){let r={...t};if(r.type?delete r._typeFromChart:(r.type=e,r._typeFromChart=!0),i){const o=i.series||{},s=i[r.type]||{},a=r._polarSubType,l=a?i[a]||{}:{},c=Qn.mergeDataLabels([o,l,s,r].map(h=>h.dataLabels));r=he({},o,l,s,r),c!==void 0&&(r.dataLabels=c)}if(Array.isArray(r.data)){const o=r.turboThreshold??1e3;if(r.data.length>o){const s=r.data[0];if(s!==null&&typeof s=="object"&&!Array.isArray(s)&&console.warn(`KatuCharts: series data length (${r.data.length}) exceeds turboThreshold (${o}). Use array format (numbers or [x,y] pairs) for better performance.`),typeof s=="number"||Array.isArray(s)&&typeof s[0]=="number")return r.data=this.normalizeDataBulk(r.data,r),r}r.data=r.data.map((s,a)=>this.normalizeDataPoint(s,a,r))}else r.data!=null&&(r.data=[]);return r}defaultArrayKeys(t,e){return t?Qn.OHLC_TYPES.has(t)?e>=5?["x","open","high","low","close"]:["open","high","low","close"]:Qn.RANGE_TYPES.has(t)?e>=3?["x","low","high"]:["low","high"]:null:null}normalizeDataPoint(t,e,i){if(t===null)return{x:(i.pointStart??0)+e*(i.pointInterval??1),y:null};if(typeof t=="number")return{x:(i.pointStart??0)+e*(i.pointInterval??1),y:t};if(Array.isArray(t)&&t.length===5&&i.type==="boxplot"){const r=t;return{x:(i.pointStart??0)+e*(i.pointInterval??1),low:r[0],q1:r[1],median:r[2],q3:r[3],high:r[4]}}if(Array.isArray(t)&&i.type==="flowmap")return{from:t[0],to:t[1],weight:t[2]};if(Array.isArray(t)){if(i.keys&&i.keys.length>0){const o={};for(let s=0;s<i.keys.length&&s<t.length;s++)o[i.keys[s]]=t[s];return o.x===void 0&&(!Ei.has(i.type)||!o.name)&&(o.x=(i.pointStart??0)+e*(i.pointInterval??1)),o}const r=this.defaultArrayKeys(i.type,t.length);if(r){const o={};for(let s=0;s<r.length&&s<t.length;s++)o[r[s]]=t[s];return o.x===void 0&&(o.x=(i.pointStart??0)+e*(i.pointInterval??1)),o.close!==void 0&&o.y===void 0&&(o.y=o.close),o}if(typeof t[0]=="string"){const o={name:t[0],y:t[1]};return Ei.has(i.type)||(o.x=(i.pointStart??0)+e*(i.pointInterval??1)),o}return t.length>=3?{x:t[0],y:t[1],z:t[2]}:{x:t[0],y:t[1]}}if(typeof t=="object"){const r={...t},o=i.type==="map"||i.type==="mappoint"||i.type==="flowmap",s=!Ei.has(i.type);return!o&&r.x===void 0&&(s||!r.name)&&(r.x=(i.pointStart??0)+e*(i.pointInterval??1)),r}return{y:null}}normalizeDataBulk(t,e){const i=t.length,r=new Array(i),o=e.pointStart??0,s=e.pointInterval??1,a=t[0];if(typeof a=="number")for(let l=0;l<i;l++)r[l]={x:o+l*s,y:t[l]};else{const l=Array.isArray(a)?this.defaultArrayKeys(e.type,a.length):null;if(l)for(let c=0;c<i;c++){const h=t[c],f={};for(let u=0;u<l.length&&u<h.length;u++)f[l[u]]=h[u];f.x===void 0&&(f.x=o+c*s),f.close!==void 0&&f.y===void 0&&(f.y=f.close),r[c]=f}else for(let c=0;c<i;c++){const h=t[c];h.length>=3?r[c]={x:h[0],y:h[1],z:h[2]}:r[c]={x:h[0],y:h[1]}}}return r}enforceCredits(t){return Qe.isLicensed()?t:{...t,enabled:!0,text:!t.text||!t.text.trim()?"Powered by: KatuCharts":t.text}}toInternal(t){var l,c,h;const e=!!((l=t.chart)!=null&&l.inverted),i=(c=t.chart)==null?void 0:c.backgroundColor,r=t.xAxis.map((f,u)=>({...f,index:u,isX:!0,_inverted:e,_backgroundColor:i})),o=t.yAxis.map((f,u)=>({...f,index:u,isX:!1,_inverted:e,_backgroundColor:i})),s=(t.series||[]).map((f,u)=>{var m;const d=typeof f.xAxis=="number"?f.xAxis:0,p=typeof f.yAxis=="number"?f.yAxis:0,y=f.type||((m=t.chart)==null?void 0:m.type)||"line",g=y==="pie"||y==="donut"||y==="sankey";return{...f,index:u,_internalType:y,_xAxisIndex:d,_yAxisIndex:p,_xAxis:r[d]||r[0],_yAxis:o[p]||o[0],_processedData:f.data||[],...g&&f.showInLegend===void 0?{showInLegend:!1}:{}}}),a=D0(s);return{chart:{width:null,height:null,backgroundColor:"#ffffff",animation:!0,reflow:!0,...t.chart},title:t.title||{},subtitle:t.subtitle||{},xAxis:r,yAxis:o,colorAxis:t.colorAxis||[],series:a,tooltip:t.tooltip||{},legend:{...t.legend||{},_backgroundColor:(h=t.chart)==null?void 0:h.backgroundColor},plotOptions:t.plotOptions||{},credits:this.enforceCredits(t.credits||{}),exporting:t.exporting||{},loading:t.loading||{},navigator:t.navigator||{},rangeSelector:t.rangeSelector||{},drilldown:t.drilldown||{},responsive:t.responsive||{},accessibility:t.accessibility||{},colors:t.colors||[],time:t.time||{}}}};Qn.OHLC_TYPES=new Set(["candlestick","ohlc","heikinashi","hollowcandlestick"]),Qn.RANGE_TYPES=new Set(["arearange","areasplinerange","columnrange"]);let jn=Qn;var da="http://www.w3.org/1999/xhtml";const $h={svg:"http://www.w3.org/2000/svg",xhtml:da,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function vo(n){var t=n+="",e=t.indexOf(":");return e>=0&&(t=n.slice(0,e))!=="xmlns"&&(n=n.slice(e+1)),$h.hasOwnProperty(t)?{space:$h[t],local:n}:n}function R0(n){return function(){var t=this.ownerDocument,e=this.namespaceURI;return e===da&&t.documentElement.namespaceURI===da?t.createElement(n):t.createElementNS(e,n)}}function z0(n){return function(){return this.ownerDocument.createElementNS(n.space,n.local)}}function Lh(n){var t=vo(n);return(t.local?z0:R0)(t)}function B0(){}function pa(n){return n==null?B0:function(){return this.querySelector(n)}}function O0(n){typeof n!="function"&&(n=pa(n));for(var t=this._groups,e=t.length,i=new Array(e),r=0;r<e;++r)for(var o=t[r],s=o.length,a=i[r]=new Array(s),l,c,h=0;h<s;++h)(l=o[h])&&(c=n.call(l,l.__data__,h,o))&&("__data__"in l&&(c.__data__=l.__data__),a[h]=c);return new Xe(i,this._parents)}function N0(n){return n==null?[]:Array.isArray(n)?n:Array.from(n)}function W0(){return[]}function Ih(n){return n==null?W0:function(){return this.querySelectorAll(n)}}function H0(n){return function(){return N0(n.apply(this,arguments))}}function V0(n){typeof n=="function"?n=H0(n):n=Ih(n);for(var t=this._groups,e=t.length,i=[],r=[],o=0;o<e;++o)for(var s=t[o],a=s.length,l,c=0;c<a;++c)(l=s[c])&&(i.push(n.call(l,l.__data__,c,s)),r.push(l));return new Xe(i,r)}function Fh(n){return function(){return this.matches(n)}}function Dh(n){return function(t){return t.matches(n)}}var G0=Array.prototype.find;function Y0(n){return function(){return G0.call(this.children,n)}}function X0(){return this.firstElementChild}function U0(n){return this.select(n==null?X0:Y0(typeof n=="function"?n:Dh(n)))}var j0=Array.prototype.filter;function q0(){return Array.from(this.children)}function Z0(n){return function(){return j0.call(this.children,n)}}function K0(n){return this.selectAll(n==null?q0:Z0(typeof n=="function"?n:Dh(n)))}function J0(n){typeof n!="function"&&(n=Fh(n));for(var t=this._groups,e=t.length,i=new Array(e),r=0;r<e;++r)for(var o=t[r],s=o.length,a=i[r]=[],l,c=0;c<s;++c)(l=o[c])&&n.call(l,l.__data__,c,o)&&a.push(l);return new Xe(i,this._parents)}function Rh(n){return new Array(n.length)}function Q0(){return new Xe(this._enter||this._groups.map(Rh),this._parents)}function wo(n,t){this.ownerDocument=n.ownerDocument,this.namespaceURI=n.namespaceURI,this._next=null,this._parent=n,this.__data__=t}wo.prototype={constructor:wo,appendChild:function(n){return this._parent.insertBefore(n,this._next)},insertBefore:function(n,t){return this._parent.insertBefore(n,t)},querySelector:function(n){return this._parent.querySelector(n)},querySelectorAll:function(n){return this._parent.querySelectorAll(n)}};function tm(n){return function(){return n}}function em(n,t,e,i,r,o){for(var s=0,a,l=t.length,c=o.length;s<c;++s)(a=t[s])?(a.__data__=o[s],i[s]=a):e[s]=new wo(n,o[s]);for(;s<l;++s)(a=t[s])&&(r[s]=a)}function nm(n,t,e,i,r,o,s){var a,l,c=new Map,h=t.length,f=o.length,u=new Array(h),d;for(a=0;a<h;++a)(l=t[a])&&(u[a]=d=s.call(l,l.__data__,a,t)+"",c.has(d)?r[a]=l:c.set(d,l));for(a=0;a<f;++a)d=s.call(n,o[a],a,o)+"",(l=c.get(d))?(i[a]=l,l.__data__=o[a],c.delete(d)):e[a]=new wo(n,o[a]);for(a=0;a<h;++a)(l=t[a])&&c.get(u[a])===l&&(r[a]=l)}function im(n){return n.__data__}function rm(n,t){if(!arguments.length)return Array.from(this,im);var e=t?nm:em,i=this._parents,r=this._groups;typeof n!="function"&&(n=tm(n));for(var o=r.length,s=new Array(o),a=new Array(o),l=new Array(o),c=0;c<o;++c){var h=i[c],f=r[c],u=f.length,d=om(n.call(h,h&&h.__data__,c,i)),p=d.length,y=a[c]=new Array(p),g=s[c]=new Array(p),m=l[c]=new Array(u);e(h,f,y,g,m,d,t);for(var x=0,v=0,b,k;x<p;++x)if(b=y[x]){for(x>=v&&(v=x+1);!(k=g[v])&&++v<p;);b._next=k||null}}return s=new Xe(s,i),s._enter=a,s._exit=l,s}function om(n){return typeof n=="object"&&"length"in n?n:Array.from(n)}function sm(){return new Xe(this._exit||this._groups.map(Rh),this._parents)}function am(n,t,e){var i=this.enter(),r=this,o=this.exit();return typeof n=="function"?(i=n(i),i&&(i=i.selection())):i=i.append(n+""),t!=null&&(r=t(r),r&&(r=r.selection())),e==null?o.remove():e(o),i&&r?i.merge(r).order():r}function cm(n){for(var t=n.selection?n.selection():n,e=this._groups,i=t._groups,r=e.length,o=i.length,s=Math.min(r,o),a=new Array(r),l=0;l<s;++l)for(var c=e[l],h=i[l],f=c.length,u=a[l]=new Array(f),d,p=0;p<f;++p)(d=c[p]||h[p])&&(u[p]=d);for(;l<r;++l)a[l]=e[l];return new Xe(a,this._parents)}function lm(){for(var n=this._groups,t=-1,e=n.length;++t<e;)for(var i=n[t],r=i.length-1,o=i[r],s;--r>=0;)(s=i[r])&&(o&&s.compareDocumentPosition(o)^4&&o.parentNode.insertBefore(s,o),o=s);return this}function hm(n){n||(n=um);function t(f,u){return f&&u?n(f.__data__,u.__data__):!f-!u}for(var e=this._groups,i=e.length,r=new Array(i),o=0;o<i;++o){for(var s=e[o],a=s.length,l=r[o]=new Array(a),c,h=0;h<a;++h)(c=s[h])&&(l[h]=c);l.sort(t)}return new Xe(r,this._parents).order()}function um(n,t){return n<t?-1:n>t?1:n>=t?0:NaN}function fm(){var n=arguments[0];return arguments[0]=this,n.apply(null,arguments),this}function dm(){return Array.from(this)}function pm(){for(var n=this._groups,t=0,e=n.length;t<e;++t)for(var i=n[t],r=0,o=i.length;r<o;++r){var s=i[r];if(s)return s}return null}function gm(){let n=0;for(const t of this)++n;return n}function mm(){return!this.node()}function ym(n){for(var t=this._groups,e=0,i=t.length;e<i;++e)for(var r=t[e],o=0,s=r.length,a;o<s;++o)(a=r[o])&&n.call(a,a.__data__,o,r);return this}function xm(n){return function(){this.removeAttribute(n)}}function bm(n){return function(){this.removeAttributeNS(n.space,n.local)}}function vm(n,t){return function(){this.setAttribute(n,t)}}function wm(n,t){return function(){this.setAttributeNS(n.space,n.local,t)}}function km(n,t){return function(){var e=t.apply(this,arguments);e==null?this.removeAttribute(n):this.setAttribute(n,e)}}function Mm(n,t){return function(){var e=t.apply(this,arguments);e==null?this.removeAttributeNS(n.space,n.local):this.setAttributeNS(n.space,n.local,e)}}function Am(n,t){var e=vo(n);if(arguments.length<2){var i=this.node();return e.local?i.getAttributeNS(e.space,e.local):i.getAttribute(e)}return this.each((t==null?e.local?bm:xm:typeof t=="function"?e.local?Mm:km:e.local?wm:vm)(e,t))}function zh(n){return n.ownerDocument&&n.ownerDocument.defaultView||n.document&&n||n.defaultView}function Sm(n){return function(){this.style.removeProperty(n)}}function _m(n,t,e){return function(){this.style.setProperty(n,t,e)}}function Cm(n,t,e){return function(){var i=t.apply(this,arguments);i==null?this.style.removeProperty(n):this.style.setProperty(n,i,e)}}function Pm(n,t,e){return arguments.length>1?this.each((t==null?Sm:typeof t=="function"?Cm:_m)(n,t,e??"")):Ii(this.node(),n)}function Ii(n,t){return n.style.getPropertyValue(t)||zh(n).getComputedStyle(n,null).getPropertyValue(t)}function Em(n){return function(){delete this[n]}}function Tm(n,t){return function(){this[n]=t}}function $m(n,t){return function(){var e=t.apply(this,arguments);e==null?delete this[n]:this[n]=e}}function Lm(n,t){return arguments.length>1?this.each((t==null?Em:typeof t=="function"?$m:Tm)(n,t)):this.node()[n]}function Bh(n){return n.trim().split(/^|\s+/)}function ga(n){return n.classList||new Oh(n)}function Oh(n){this._node=n,this._names=Bh(n.getAttribute("class")||"")}Oh.prototype={add:function(n){var t=this._names.indexOf(n);t<0&&(this._names.push(n),this._node.setAttribute("class",this._names.join(" ")))},remove:function(n){var t=this._names.indexOf(n);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(n){return this._names.indexOf(n)>=0}};function Nh(n,t){for(var e=ga(n),i=-1,r=t.length;++i<r;)e.add(t[i])}function Wh(n,t){for(var e=ga(n),i=-1,r=t.length;++i<r;)e.remove(t[i])}function Im(n){return function(){Nh(this,n)}}function Fm(n){return function(){Wh(this,n)}}function Dm(n,t){return function(){(t.apply(this,arguments)?Nh:Wh)(this,n)}}function Rm(n,t){var e=Bh(n+"");if(arguments.length<2){for(var i=ga(this.node()),r=-1,o=e.length;++r<o;)if(!i.contains(e[r]))return!1;return!0}return this.each((typeof t=="function"?Dm:t?Im:Fm)(e,t))}function zm(){this.textContent=""}function Bm(n){return function(){this.textContent=n}}function Om(n){return function(){var t=n.apply(this,arguments);this.textContent=t??""}}function Nm(n){return arguments.length?this.each(n==null?zm:(typeof n=="function"?Om:Bm)(n)):this.node().textContent}function Wm(){this.innerHTML=""}function Hm(n){return function(){this.innerHTML=n}}function Vm(n){return function(){var t=n.apply(this,arguments);this.innerHTML=t??""}}function Gm(n){return arguments.length?this.each(n==null?Wm:(typeof n=="function"?Vm:Hm)(n)):this.node().innerHTML}function Ym(){this.nextSibling&&this.parentNode.appendChild(this)}function Xm(){return this.each(Ym)}function Um(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function jm(){return this.each(Um)}function qm(n){var t=typeof n=="function"?n:Lh(n);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Zm(){return null}function Km(n,t){var e=typeof n=="function"?n:Lh(n),i=t==null?Zm:typeof t=="function"?t:pa(t);return this.select(function(){return this.insertBefore(e.apply(this,arguments),i.apply(this,arguments)||null)})}function Jm(){var n=this.parentNode;n&&n.removeChild(this)}function Qm(){return this.each(Jm)}function ty(){var n=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(n,this.nextSibling):n}function ey(){var n=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(n,this.nextSibling):n}function ny(n){return this.select(n?ey:ty)}function iy(n){return arguments.length?this.property("__data__",n):this.node().__data__}function ry(n){return function(t){n.call(this,t,this.__data__)}}function oy(n){return n.trim().split(/^|\s+/).map(function(t){var e="",i=t.indexOf(".");return i>=0&&(e=t.slice(i+1),t=t.slice(0,i)),{type:t,name:e}})}function sy(n){return function(){var t=this.__on;if(t){for(var e=0,i=-1,r=t.length,o;e<r;++e)o=t[e],(!n.type||o.type===n.type)&&o.name===n.name?this.removeEventListener(o.type,o.listener,o.options):t[++i]=o;++i?t.length=i:delete this.__on}}}function ay(n,t,e){return function(){var i=this.__on,r,o=ry(t);if(i){for(var s=0,a=i.length;s<a;++s)if((r=i[s]).type===n.type&&r.name===n.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=o,r.options=e),r.value=t;return}}this.addEventListener(n.type,o,e),r={type:n.type,name:n.name,value:t,listener:o,options:e},i?i.push(r):this.__on=[r]}}function cy(n,t,e){var i=oy(n+""),r,o=i.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var l=0,c=a.length,h;l<c;++l)for(r=0,h=a[l];r<o;++r)if((s=i[r]).type===h.type&&s.name===h.name)return h.value}return}for(a=t?ay:sy,r=0;r<o;++r)this.each(a(i[r],t,e));return this}function Hh(n,t,e){var i=zh(n),r=i.CustomEvent;typeof r=="function"?r=new r(t,e):(r=i.document.createEvent("Event"),e?(r.initEvent(t,e.bubbles,e.cancelable),r.detail=e.detail):r.initEvent(t,!1,!1)),n.dispatchEvent(r)}function ly(n,t){return function(){return Hh(this,n,t)}}function hy(n,t){return function(){return Hh(this,n,t.apply(this,arguments))}}function uy(n,t){return this.each((typeof t=="function"?hy:ly)(n,t))}function*fy(){for(var n=this._groups,t=0,e=n.length;t<e;++t)for(var i=n[t],r=0,o=i.length,s;r<o;++r)(s=i[r])&&(yield s)}var Vh=[null];function Xe(n,t){this._groups=n,this._parents=t}function ur(){return new Xe([[document.documentElement]],Vh)}function dy(){return this}Xe.prototype=ur.prototype={constructor:Xe,select:O0,selectAll:V0,selectChild:U0,selectChildren:K0,filter:J0,data:rm,enter:Q0,exit:sm,join:am,merge:cm,selection:dy,order:lm,sort:hm,call:fm,nodes:dm,node:pm,size:gm,empty:mm,each:ym,attr:Am,style:Pm,property:Lm,classed:Rm,text:Nm,html:Gm,raise:Xm,lower:jm,append:qm,insert:Km,remove:Qm,clone:ny,datum:iy,on:cy,dispatch:uy,[Symbol.iterator]:fy};function rt(n){return typeof n=="string"?new Xe([[document.querySelector(n)]],[document.documentElement]):new Xe([[n]],Vh)}function py(n){let t;for(;t=n.sourceEvent;)n=t;return n}function pn(n,t){if(n=py(n),t===void 0&&(t=n.currentTarget),t){var e=t.ownerSVGElement||t;if(e.createSVGPoint){var i=e.createSVGPoint();return i.x=n.clientX,i.y=n.clientY,i=i.matrixTransform(t.getScreenCTM().inverse()),[i.x,i.y]}if(t.getBoundingClientRect){var r=t.getBoundingClientRect();return[n.clientX-r.left-t.clientLeft,n.clientY-r.top-t.clientTop]}}return[n.pageX,n.pageY]}class gy{constructor(t){this.el=t}attr(t){for(const[e,i]of Object.entries(t))e!=="zIndex"&&this.el.attr(e,i);return this}css(t){for(const[e,i]of Object.entries(t)){const r=e.replace(/[A-Z]/g,o=>"-"+o.toLowerCase());this.el.style(r,i),e==="color"&&this.el.attr("fill",i)}return this}add(){return this}getBBox(){const t=this.el.node();if(!t||typeof t.getBBox!="function")return{x:0,y:0,width:0,height:0};try{return t.getBBox()}catch{return{x:0,y:0,width:0,height:0}}}destroy(){this.el.remove()}}const nr=class nr{constructor(t,e,i){this.svg=rt(t).append("svg").attr("class","katucharts-root").attr("xmlns","http://www.w3.org/2000/svg").attr("width",e).attr("height",i).style("overflow","hidden").style("outline","none").style("display","block").style("max-width","100%"),this.defs=this.svg.append("defs")}setSize(t,e){this.svg.attr("width",t).attr("height",e)}createGroup(t,e){const r=(e||this.svg).append("g");return t&&r.attr("class",t),r}text(t,e,i){const r=this.svg.append("text").attr("x",e).attr("y",i).style("pointer-events","none").text(t);return new gy(r)}createClipPath(t,e,i,r){const o=`katucharts-clip-${++nr.clipPathCounter}`;return this.defs.append("clipPath").attr("id",o).append("rect").attr("x",t).attr("y",e).attr("width",i).attr("height",r),o}updateClipPath(t,e,i,r,o){this.defs.select(`#${t} rect`).attr("x",e).attr("y",i).attr("width",r).attr("height",o)}createLinearGradient(t,e,i,r,o,s){const a=t||`katucharts-grad-${++nr.gradientCounter}`,l=this.defs.append("linearGradient").attr("id",a).attr("x1",e).attr("y1",i).attr("x2",r).attr("y2",o);for(const c of s)l.append("stop").attr("offset",c.offset).attr("stop-color",c.color).attr("stop-opacity",c.opacity??1);return a}getSVGNode(){return this.svg.node()}destroy(){this.svg.remove()}getSerializedSVG(){const t=this.svg.node();return t?new XMLSerializer().serializeToString(t):""}};nr.clipPathCounter=0,nr.gradientCounter=0;let ko=nr;class Gh{constructor(){this.listeners=new Map}on(t,e){return this.listeners.has(t)||this.listeners.set(t,[]),this.listeners.get(t).push({callback:e,once:!1}),this}once(t,e){return this.listeners.has(t)||this.listeners.set(t,[]),this.listeners.get(t).push({callback:e,once:!0}),this}off(t,e){if(!e)return this.listeners.delete(t),this;const i=this.listeners.get(t);return i&&this.listeners.set(t,i.filter(r=>r.callback!==e)),this}emit(t,...e){const i=this.listeners.get(t);if(!i)return this;const r=[];for(const o of i)o.callback(...e),o.once&&r.push(o);return r.length&&this.listeners.set(t,i.filter(o=>!r.includes(o))),this}removeAllListeners(){this.listeners.clear()}static mapEvent(t,e){return`${t}:${e.toLowerCase()}`}}class my{constructor(t,e){this.config=t,this.events=e}getConfig(){return this.config}updateConfig(t){this.config=he(this.config,t),this.events.emit("state:configChanged",this.config)}getSeries(){return this.config.series}getSeriesById(t){return this.config.series.find(e=>e.id===t)}getSeriesByIndex(t){return this.config.series[t]}addSeries(t){this.config.series=[...this.config.series,t],this.events.emit("state:seriesAdded",t)}removeSeries(t){const e=this.config.series[t];return e&&(this.config.series=this.config.series.filter((i,r)=>r!==t),this.events.emit("state:seriesRemoved",e,t)),e}updateSeries(t,e){const i=this.config.series[t];i&&(this.config.series[t]=he(i,e),this.events.emit("state:seriesUpdated",this.config.series[t],t))}getXAxes(){return this.config.xAxis}getYAxes(){return this.config.yAxis}updateAxis(t,e,i){const r=t?this.config.xAxis:this.config.yAxis;r[e]&&(r[e]=he(r[e],i),this.events.emit("state:axisUpdated",{isX:t,index:e,config:r[e]}))}}class yy{constructor(){this.types=new Map}registerType(t,e){this.types.set(t,e)}getType(t){return this.types.get(t)}hasType(t){return this.types.has(t)}getRegisteredTypes(){return Array.from(this.types.keys())}}const Yh=globalThis,$t=Yh.__katuChartRegistry||(Yh.__katuChartRegistry=new yy);class xy{constructor(){this.modules=new Map}register(t){this.modules.set(t.name,t)}get(t){return this.modules.get(t)}getAll(){return Array.from(this.modules.values())}}const Xh=new xy;class by{compute(t,e,i){var F,R,z,B,H,J,X,q,W,U,G,N,Y,O,ct;const r=this.getSpacing(t);let o=r.top,s=r.bottom;const a=r.left,l=r.right,c=((F=t.title)==null?void 0:F.widthAdjust)??-44,h=e+c,f=(z=(R=t.title)==null?void 0:R.style)!=null&&z.fontSize?t.title.style:{...(B=t.title)==null?void 0:B.style,fontSize:"18px"},u=(H=t.title)!=null&&H.text?this.estimateWrappedTextHeight(t.title.text,f,h):0,d=((J=t.title)==null?void 0:J.margin)??8,p=(X=t.subtitle)!=null&&X.text?this.estimateWrappedTextHeight(t.subtitle.text,t.subtitle.style,h):0;u>0&&(o=r.top+u+(p>0?3:d)),p>0&&(o+=p+d);const y=t.series.some(it=>it._internalType==="heatmap"),g=((q=t.legend)==null?void 0:q.align)||"center",m=!y&&((W=t.legend)==null?void 0:W.enabled)!==!1&&((U=t.legend)==null?void 0:U.layout)==="vertical"&&(g==="left"||g==="right"),x=y||m?0:this.estimateLegendHeight(t,e),v=((G=t.legend)==null?void 0:G.verticalAlign)||"bottom";!m&&v==="bottom"?s=Math.max(s,r.bottom)+x:!m&&v==="top"&&(o+=x);const b=m?this.estimateLegendWidth(t):0,k=m&&g==="left"?b:0,M=m&&g==="right"?b:0;if((N=t.navigator)!=null&&N.enabled){const it=t.navigator;s+=(it.height??40)+(it.margin??20)}const C=this.isNonCartesian(t),_=!!t.chart.inverted?{...t,xAxis:t.yAxis,yAxis:t.xAxis}:t,T=C?0:this.estimateAxisWidth(_,!0,i,e),I=C?0:this.estimateAxisWidth(_,!1,i,e),E=C?0:this.estimateAxisHeight(_);let P=0;y&&((Y=t.colorAxis)==null?void 0:Y.length)>0&&((O=t.legend)==null?void 0:O.layout)==="vertical"&&(P=55);const S=a+T+k,w=o,A=Math.max(0,e-a-l-T-I-P-k-M),$=((ct=t.chart)==null?void 0:ct.marginBottom)!==void 0,D=Math.max(0,i-o-s-($?0:E));return{plotArea:{x:S,y:w,width:A,height:D},titleArea:{x:r.left,y:r.top,width:e-r.left-r.right,height:u+d},subtitleArea:{x:r.left,y:r.top+u+d,width:e-r.left-r.right,height:p},legendArea:m?{x:g==="right"?e-l-M:a,y:w,width:b,height:D}:{x:0,y:v==="top"?o-x:i-s,width:e,height:x}}}isNonCartesian(t){return t.series.length>0&&t.series.every(e=>Ei.has(e._internalType))}getSpacing(t){var s;const e=t.chart;if(e.margin!==void 0){const a=e.margin;if(typeof a=="number")return{top:a,right:a,bottom:a,left:a};if(Array.isArray(a))return{top:a[0]??10,right:a[1]??10,bottom:a[2]??15,left:a[3]??10}}const i=e.spacing||[10,10,15,10],o=((s=t.exporting)==null?void 0:s.enabled)!==!1&&!this.isNonCartesian(t)?40:i[1]??10;return{top:e.marginTop??e.spacingTop??i[0],right:e.marginRight??e.spacingRight??o,bottom:e.marginBottom??e.spacingBottom??i[2],left:e.marginLeft??e.spacingLeft??i[3]}}estimateTextHeight(t){return be(t==null?void 0:t.fontSize)*1.4}estimateWrappedTextHeight(t,e,i){const r=be(e==null?void 0:e.fontSize),o=r*1.4;if(!i||i<=0)return o;const s=r*.55,a=Math.floor(i/s);if(a<=0)return o;const l=Math.ceil(t.length/a);return o*Math.max(l,1)}computeAutoFontSize(t,e){return e||"12px"}estimateLegendHeight(t,e){var r,o;const i=this.estimateSeriesLegendHeight(t,e);if((r=t.legend)!=null&&r.enabled&&((o=t.legend.bubbleLegend)!=null&&o.enabled)){const s=t.series.find(a=>a._internalType==="bubble");if(s){const a=t.legend.margin??8,c=(t.legend.bubbleLegend.maxSize??(typeof s.maxSize=="number"?s.maxSize:30))*2+16+a;return(t.legend.layout||"horizontal")==="horizontal"&&t.legend.bubbleLegend.layout==="separate"?i+c:Math.max(i,c)}}return i}estimateLegendWidth(t){var u;const e=t.legend;if(!e)return 0;const i=t.series.filter(d=>d.showInLegend!==!1),r=e.itemStyle||{},o=be(r.fontSize||wt),s=e.symbolWidth??12,a=e.symbolPadding??5,l=e.padding??8;let c=0;i.forEach((d,p)=>{const y=Je(d.name||`Series ${p+1}`,o);y>c&&(c=y)});let h=s+a+c;if((u=e.bubbleLegend)!=null&&u.enabled){const d=t.series.find(p=>p._internalType==="bubble");if(d){const p=e.bubbleLegend.maxSize??(typeof d.maxSize=="number"?d.maxSize:30),y=e.bubbleLegend.connectorDistance??16;h=Math.max(h,p*2+y+30)}}const f=e.margin??12;return h+l*2+f}estimateSeriesLegendHeight(t,e){var p;if(!((p=t.legend)!=null&&p.enabled))return 0;const i=t.series.filter(y=>y.showInLegend!==!1),r=i.length;if(r===0)return 0;const o=t.legend.margin??8,s=t.legend.layout||"horizontal",l=(t.legend.itemStyle||{}).fontSize||wt,c=this.computeAutoFontSize(r,l),h=t.legend.lineHeight??16,f=t.legend.itemMarginBottom??2,u=t.legend.itemMarginTop??0,d=h+f+u;if(s==="horizontal"){const y=t.legend.padding??4,g=t.legend.symbolWidth??10,m=t.legend.symbolPadding??5,x=t.legend.itemDistance??20,v=this.getSpacing(t),b=t.legend.width||e-v.left-v.right-y*2,k=be(c),M=i.map((P,S)=>P.name||`Series ${S+1}`);let C=0;for(let P=0;P<M.length;P++){const S=t.legend.itemWidth||Je(M[P],k),w=g+m+S;C+=w+(P<M.length-1?x:0)}if(r>8&&C>b){let P=0;for(const F of M){const R=Je(F,k);R>P&&(P=R)}let S,w;if(t.legend.itemWidth)S=t.legend.itemWidth,w=Math.max(2,Math.floor(b/S));else{const F=g+m+P+8;w=Math.max(1,Math.floor(b/F)),S=b/w}const $=Math.ceil(r/w)*d+y*2,D=t.legend.maxHeight;return(D?Math.min($,D):$)+o}let _=y,T=1;for(let P=0;P<r;P++){const S=t.legend.itemWidth||Je(M[P],k),w=g+m+S;P>0&&_+w>b&&(T++,_=y),_+=w+x}const I=T*d+y*2,E=t.legend.maxHeight;return(E?Math.min(I,E):I)+o}return r*d+(t.legend.padding??8)*2+o}estimateAxisWidth(t,e,i,r){var a,l;const o=t.yAxis.filter(c=>e?!c.opposite:c.opposite);if(o.length===0)return 0;let s=0;for(const c of o){if(c.visible===!1)continue;const h=((a=c.labels)==null?void 0:a.enabled)!==!1,f=(l=c.title)==null?void 0:l.text,u=h?this.estimateLabelWidth(c,i,r):0;s+=u+(f?30:0)+(c.offset||0)}return s||30}estimateLabelWidth(t,e,i){var s,a,l,c;if(t.categories&&t.categories.length>0){const h=be(((a=(s=t.labels)==null?void 0:s.style)==null?void 0:a.fontSize)||wt);let f=h;if(e&&t.categories.length>1){const m=e*.8/t.categories.length*.7;h>m&&(f=Math.min(h,Math.max(5,Math.round(m*1.1))))}const u=((c=(l=t.labels)==null?void 0:l.style)==null?void 0:c.fontWeight)||"normal";let d=0;for(const y of t.categories){const g=Je(y,f,u);g>d&&(d=g)}const p=i?Math.max(120,i*.3):460;return Math.max(25,Math.min(d*1.3+16,p))}const r=t.min??null,o=t.max??null;if(r!=null&&o!=null){const f=String(Math.round(Math.max(Math.abs(r),Math.abs(o)))).length+(r<0?1:0);return Math.max(20,f*7+10)}return 25}estimateAxisHeight(t){var r,o,s,a,l,c,h;const e=t.xAxis.filter(f=>!f.opposite);if(e.length===0)return 0;let i=0;for(const f of e){if(f.visible===!1)continue;const u=((r=f.labels)==null?void 0:r.enabled)!==!1,d=(o=f.title)==null?void 0:o.text,p=!!((s=f.labels)!=null&&s.rotation);let y=30;if(u){if(p&&f.categories&&f.categories.length>0){let m=0;for(const k of f.categories)k.length>m&&(m=k.length);const x=be(((l=(a=f.labels)==null?void 0:a.style)==null?void 0:l.fontSize)||wt),v=Math.abs(f.labels.rotation)*(Math.PI/180),b=Math.min(m*x*.62*Math.sin(v),150);y=Math.max(30,b)}else if(p)y=45;else if(f.categories&&f.categories.length>0){let m=0;for(const b of f.categories)b.length>m&&(m=b.length);const x=be(((h=(c=f.labels)==null?void 0:c.style)==null?void 0:h.fontSize)||wt);if(f.categories.length>6||m>8){const b=Math.min(m*x*.4*Math.sin(Math.PI/4),120);y=Math.max(30,b)}}}else y=0;const g=u?f.tickLength||10:5;i+=y+(d?25:0)+g}return i||40}}function Mo(n,t){return n==null||t==null?NaN:n<t?-1:n>t?1:n>=t?0:NaN}function vy(n,t){return n==null||t==null?NaN:t<n?-1:t>n?1:t>=n?0:NaN}function ma(n){let t,e,i;n.length!==2?(t=Mo,e=(a,l)=>Mo(n(a),l),i=(a,l)=>n(a)-l):(t=n===Mo||n===vy?n:wy,e=n,i=n);function r(a,l,c=0,h=a.length){if(c<h){if(t(l,l)!==0)return h;do{const f=c+h>>>1;e(a[f],l)<0?c=f+1:h=f}while(c<h)}return c}function o(a,l,c=0,h=a.length){if(c<h){if(t(l,l)!==0)return h;do{const f=c+h>>>1;e(a[f],l)<=0?c=f+1:h=f}while(c<h)}return c}function s(a,l,c=0,h=a.length){const f=r(a,l,c,h-1);return f>c&&i(a[f-1],l)>-i(a[f],l)?f-1:f}return{left:r,center:s,right:o}}function wy(){return 0}function ky(n){return n===null?NaN:+n}const My=ma(Mo).right;ma(ky).center;class di{constructor(){this._partials=new Float64Array(32),this._n=0}add(t){const e=this._partials;let i=0;for(let r=0;r<this._n&&r<32;r++){const o=e[r],s=t+o,a=Math.abs(t)<Math.abs(o)?t-(s-o):o-(s-t);a&&(e[i++]=a),t=s}return e[i]=t,this._n=i+1,this}valueOf(){const t=this._partials;let e=this._n,i,r,o,s=0;if(e>0){for(s=t[--e];e>0&&(i=s,r=t[--e],s=i+r,o=r-(s-i),!o););e>0&&(o<0&&t[e-1]<0||o>0&&t[e-1]>0)&&(r=o*2,i=s+r,r==i-s&&(s=i))}return s}}class Uh extends Map{constructor(t,e=_y){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:e}}),t!=null)for(const[i,r]of t)this.set(i,r)}get(t){return super.get(jh(this,t))}has(t){return super.has(jh(this,t))}set(t,e){return super.set(Ay(this,t),e)}delete(t){return super.delete(Sy(this,t))}}function jh({_intern:n,_key:t},e){const i=t(e);return n.has(i)?n.get(i):e}function Ay({_intern:n,_key:t},e){const i=t(e);return n.has(i)?n.get(i):(n.set(i,e),e)}function Sy({_intern:n,_key:t},e){const i=t(e);return n.has(i)&&(e=n.get(i),n.delete(i)),e}function _y(n){return n!==null&&typeof n=="object"?n.valueOf():n}const Cy=Math.sqrt(50),Py=Math.sqrt(10),Ey=Math.sqrt(2);function Ao(n,t,e){const i=(t-n)/Math.max(0,e),r=Math.floor(Math.log10(i)),o=i/Math.pow(10,r),s=o>=Cy?10:o>=Py?5:o>=Ey?2:1;let a,l,c;return r<0?(c=Math.pow(10,-r)/s,a=Math.round(n*c),l=Math.round(t*c),a/c<n&&++a,l/c>t&&--l,c=-c):(c=Math.pow(10,r)*s,a=Math.round(n/c),l=Math.round(t/c),a*c<n&&++a,l*c>t&&--l),l<a&&.5<=e&&e<2?Ao(n,t,e*2):[a,l,c]}function ya(n,t,e){if(t=+t,n=+n,e=+e,!(e>0))return[];if(n===t)return[n];const i=t<n,[r,o,s]=i?Ao(t,n,e):Ao(n,t,e);if(!(o>=r))return[];const a=o-r+1,l=new Array(a);if(i)if(s<0)for(let c=0;c<a;++c)l[c]=(o-c)/-s;else for(let c=0;c<a;++c)l[c]=(o-c)*s;else if(s<0)for(let c=0;c<a;++c)l[c]=(r+c)/-s;else for(let c=0;c<a;++c)l[c]=(r+c)*s;return l}function xa(n,t,e){return t=+t,n=+n,e=+e,Ao(n,t,e)[2]}function ba(n,t,e){t=+t,n=+n,e=+e;const i=t<n,r=i?xa(t,n,e):xa(n,t,e);return(i?-1:1)*(r<0?1/-r:r)}function*Ty(n){for(const t of n)yield*t}function qh(n){return Array.from(Ty(n))}function pi(n,t,e){n=+n,t=+t,e=(r=arguments.length)<2?(t=n,n=0,1):r<3?1:+e;for(var i=-1,r=Math.max(0,Math.ceil((t-n)/e))|0,o=new Array(r);++i<r;)o[i]=n+i*e;return o}function gi(n,t){switch(arguments.length){case 0:break;case 1:this.range(n);break;default:this.range(t).domain(n);break}return this}function $y(n,t){switch(arguments.length){case 0:break;case 1:{typeof n=="function"?this.interpolator(n):this.range(n);break}default:{this.domain(n),typeof t=="function"?this.interpolator(t):this.range(t);break}}return this}const Zh=Symbol("implicit");function Kh(){var n=new Uh,t=[],e=[],i=Zh;function r(o){let s=n.get(o);if(s===void 0){if(i!==Zh)return i;n.set(o,s=t.push(o)-1)}return e[s%e.length]}return r.domain=function(o){if(!arguments.length)return t.slice();t=[],n=new Uh;for(const s of o)n.has(s)||n.set(s,t.push(s)-1);return r},r.range=function(o){return arguments.length?(e=Array.from(o),r):e.slice()},r.unknown=function(o){return arguments.length?(i=o,r):i},r.copy=function(){return Kh(t,e).unknown(i)},gi.apply(r,arguments),r}function Jh(){var n=Kh().unknown(void 0),t=n.domain,e=n.range,i=0,r=1,o,s,a=!1,l=0,c=0,h=.5;delete n.unknown;function f(){var u=t().length,d=r<i,p=d?r:i,y=d?i:r;o=(y-p)/Math.max(1,u-l+c*2),a&&(o=Math.floor(o)),p+=(y-p-o*(u-l))*h,s=o*(1-l),a&&(p=Math.round(p),s=Math.round(s));var g=pi(u).map(function(m){return p+o*m});return e(d?g.reverse():g)}return n.domain=function(u){return arguments.length?(t(u),f()):t()},n.range=function(u){return arguments.length?([i,r]=u,i=+i,r=+r,f()):[i,r]},n.rangeRound=function(u){return[i,r]=u,i=+i,r=+r,a=!0,f()},n.bandwidth=function(){return s},n.step=function(){return o},n.round=function(u){return arguments.length?(a=!!u,f()):a},n.padding=function(u){return arguments.length?(l=Math.min(1,c=+u),f()):l},n.paddingInner=function(u){return arguments.length?(l=Math.min(1,u),f()):l},n.paddingOuter=function(u){return arguments.length?(c=+u,f()):c},n.align=function(u){return arguments.length?(h=Math.max(0,Math.min(1,u)),f()):h},n.copy=function(){return Jh(t(),[i,r]).round(a).paddingInner(l).paddingOuter(c).align(h)},gi.apply(f(),arguments)}function Ly(n,t,e,i,r){var o=n*n,s=o*n;return((1-3*n+3*o-s)*t+(4-6*o+3*s)*e+(1+3*n+3*o-3*s)*i+s*r)/6}function Iy(n){var t=n.length-1;return function(e){var i=e<=0?e=0:e>=1?(e=1,t-1):Math.floor(e*t),r=n[i],o=n[i+1],s=i>0?n[i-1]:2*r-o,a=i<t-1?n[i+2]:2*o-r;return Ly((e-i/t)*t,s,r,o,a)}}const va=n=>()=>n;function Fy(n,t){return function(e){return n+e*t}}function Dy(n,t,e){return n=Math.pow(n,e),t=Math.pow(t,e)-n,e=1/e,function(i){return Math.pow(n+i*t,e)}}function Ry(n){return(n=+n)==1?Qh:function(t,e){return e-t?Dy(t,e,n):va(isNaN(t)?e:t)}}function Qh(n,t){var e=t-n;return e?Fy(n,e):va(isNaN(n)?t:n)}const mi=function n(t){var e=Ry(t);function i(r,o){var s=e((r=Ye(r)).r,(o=Ye(o)).r),a=e(r.g,o.g),l=e(r.b,o.b),c=Qh(r.opacity,o.opacity);return function(h){return r.r=s(h),r.g=a(h),r.b=l(h),r.opacity=c(h),r+""}}return i.gamma=n,i}(1);function zy(n){return function(t){var e=t.length,i=new Array(e),r=new Array(e),o=new Array(e),s,a;for(s=0;s<e;++s)a=Ye(t[s]),i[s]=a.r||0,r[s]=a.g||0,o[s]=a.b||0;return i=n(i),r=n(r),o=n(o),a.opacity=1,function(l){return a.r=i(l),a.g=r(l),a.b=o(l),a+""}}}var By=zy(Iy);function Oy(n,t){t||(t=[]);var e=n?Math.min(t.length,n.length):0,i=t.slice(),r;return function(o){for(r=0;r<e;++r)i[r]=n[r]*(1-o)+t[r]*o;return i}}function Ny(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}function Wy(n,t){var e=t?t.length:0,i=n?Math.min(e,n.length):0,r=new Array(i),o=new Array(e),s;for(s=0;s<i;++s)r[s]=ce(n[s],t[s]);for(;s<e;++s)o[s]=t[s];return function(a){for(s=0;s<i;++s)o[s]=r[s](a);return o}}function Hy(n,t){var e=new Date;return n=+n,t=+t,function(i){return e.setTime(n*(1-i)+t*i),e}}function gn(n,t){return n=+n,t=+t,function(e){return n*(1-e)+t*e}}function Vy(n,t){var e={},i={},r;(n===null||typeof n!="object")&&(n={}),(t===null||typeof t!="object")&&(t={});for(r in t)r in n?e[r]=ce(n[r],t[r]):i[r]=t[r];return function(o){for(r in e)i[r]=e[r](o);return i}}var wa=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ka=new RegExp(wa.source,"g");function Gy(n){return function(){return n}}function Yy(n){return function(t){return n(t)+""}}function tu(n,t){var e=wa.lastIndex=ka.lastIndex=0,i,r,o,s=-1,a=[],l=[];for(n=n+"",t=t+"";(i=wa.exec(n))&&(r=ka.exec(t));)(o=r.index)>e&&(o=t.slice(e,o),a[s]?a[s]+=o:a[++s]=o),(i=i[0])===(r=r[0])?a[s]?a[s]+=r:a[++s]=r:(a[++s]=null,l.push({i:s,x:gn(i,r)})),e=ka.lastIndex;return e<t.length&&(o=t.slice(e),a[s]?a[s]+=o:a[++s]=o),a.length<2?l[0]?Yy(l[0].x):Gy(t):(t=l.length,function(c){for(var h=0,f;h<t;++h)a[(f=l[h]).i]=f.x(c);return a.join("")})}function ce(n,t){var e=typeof t,i;return t==null||e==="boolean"?va(t):(e==="number"?gn:e==="string"?(i=se(t))?(t=i,mi):tu:t instanceof se?mi:t instanceof Date?Hy:Ny(t)?Oy:Array.isArray(t)?Wy:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?Vy:gn)(n,t)}function eu(n,t){return n=+n,t=+t,function(e){return Math.round(n*(1-e)+t*e)}}var nu=180/Math.PI,Ma={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function iu(n,t,e,i,r,o){var s,a,l;return(s=Math.sqrt(n*n+t*t))&&(n/=s,t/=s),(l=n*e+t*i)&&(e-=n*l,i-=t*l),(a=Math.sqrt(e*e+i*i))&&(e/=a,i/=a,l/=a),n*i<t*e&&(n=-n,t=-t,l=-l,s=-s),{translateX:r,translateY:o,rotate:Math.atan2(t,n)*nu,skewX:Math.atan(l)*nu,scaleX:s,scaleY:a}}var So;function Xy(n){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(n+"");return t.isIdentity?Ma:iu(t.a,t.b,t.c,t.d,t.e,t.f)}function Uy(n){return n==null||(So||(So=document.createElementNS("http://www.w3.org/2000/svg","g")),So.setAttribute("transform",n),!(n=So.transform.baseVal.consolidate()))?Ma:(n=n.matrix,iu(n.a,n.b,n.c,n.d,n.e,n.f))}function ru(n,t,e,i){function r(c){return c.length?c.pop()+" ":""}function o(c,h,f,u,d,p){if(c!==f||h!==u){var y=d.push("translate(",null,t,null,e);p.push({i:y-4,x:gn(c,f)},{i:y-2,x:gn(h,u)})}else(f||u)&&d.push("translate("+f+t+u+e)}function s(c,h,f,u){c!==h?(c-h>180?h+=360:h-c>180&&(c+=360),u.push({i:f.push(r(f)+"rotate(",null,i)-2,x:gn(c,h)})):h&&f.push(r(f)+"rotate("+h+i)}function a(c,h,f,u){c!==h?u.push({i:f.push(r(f)+"skewX(",null,i)-2,x:gn(c,h)}):h&&f.push(r(f)+"skewX("+h+i)}function l(c,h,f,u,d,p){if(c!==f||h!==u){var y=d.push(r(d)+"scale(",null,",",null,")");p.push({i:y-4,x:gn(c,f)},{i:y-2,x:gn(h,u)})}else(f!==1||u!==1)&&d.push(r(d)+"scale("+f+","+u+")")}return function(c,h){var f=[],u=[];return c=n(c),h=n(h),o(c.translateX,c.translateY,h.translateX,h.translateY,f,u),s(c.rotate,h.rotate,f,u),a(c.skewX,h.skewX,f,u),l(c.scaleX,c.scaleY,h.scaleX,h.scaleY,f,u),c=h=null,function(d){for(var p=-1,y=u.length,g;++p<y;)f[(g=u[p]).i]=g.x(d);return f.join("")}}}var jy=ru(Xy,"px, ","px)","deg)"),qy=ru(Uy,", ",")",")"),Zy=1e-12;function ou(n){return((n=Math.exp(n))+1/n)/2}function Ky(n){return((n=Math.exp(n))-1/n)/2}function Jy(n){return((n=Math.exp(2*n))-1)/(n+1)}const Qy=function n(t,e,i){function r(o,s){var a=o[0],l=o[1],c=o[2],h=s[0],f=s[1],u=s[2],d=h-a,p=f-l,y=d*d+p*p,g,m;if(y<Zy)m=Math.log(u/c)/t,g=function(C){return[a+C*d,l+C*p,c*Math.exp(t*C*m)]};else{var x=Math.sqrt(y),v=(u*u-c*c+i*y)/(2*c*e*x),b=(u*u-c*c-i*y)/(2*u*e*x),k=Math.log(Math.sqrt(v*v+1)-v),M=Math.log(Math.sqrt(b*b+1)-b);m=(M-k)/t,g=function(C){var L=C*m,_=ou(k),T=c/(e*x)*(_*Jy(t*L+k)-Ky(k));return[a+T*d,l+T*p,c*_/ou(t*L+k)]}}return g.duration=m*1e3*t/Math.SQRT2,g}return r.rho=function(o){var s=Math.max(.001,+o),a=s*s,l=a*a;return n(s,a,l)},r}(Math.SQRT2,2,4);function tx(n){return function(){return n}}function ex(n){return+n}var su=[0,1];function en(n){return n}function Aa(n,t){return(t-=n=+n)?function(e){return(e-n)/t}:tx(isNaN(t)?NaN:.5)}function nx(n,t){var e;return n>t&&(e=n,n=t,t=e),function(i){return Math.max(n,Math.min(t,i))}}function ix(n,t,e){var i=n[0],r=n[1],o=t[0],s=t[1];return r<i?(i=Aa(r,i),o=e(s,o)):(i=Aa(i,r),o=e(o,s)),function(a){return o(i(a))}}function rx(n,t,e){var i=Math.min(n.length,t.length)-1,r=new Array(i),o=new Array(i),s=-1;for(n[i]<n[0]&&(n=n.slice().reverse(),t=t.slice().reverse());++s<i;)r[s]=Aa(n[s],n[s+1]),o[s]=e(t[s],t[s+1]);return function(a){var l=My(n,a,1,i)-1;return o[l](r[l](a))}}function _o(n,t){return t.domain(n.domain()).range(n.range()).interpolate(n.interpolate()).clamp(n.clamp()).unknown(n.unknown())}function Sa(){var n=su,t=su,e=ce,i,r,o,s=en,a,l,c;function h(){var u=Math.min(n.length,t.length);return s!==en&&(s=nx(n[0],n[u-1])),a=u>2?rx:ix,l=c=null,f}function f(u){return u==null||isNaN(u=+u)?o:(l||(l=a(n.map(i),t,e)))(i(s(u)))}return f.invert=function(u){return s(r((c||(c=a(t,n.map(i),gn)))(u)))},f.domain=function(u){return arguments.length?(n=Array.from(u,ex),h()):n.slice()},f.range=function(u){return arguments.length?(t=Array.from(u),h()):t.slice()},f.rangeRound=function(u){return t=Array.from(u),e=eu,h()},f.clamp=function(u){return arguments.length?(s=u?!0:en,h()):s!==en},f.interpolate=function(u){return arguments.length?(e=u,h()):e},f.unknown=function(u){return arguments.length?(o=u,f):o},function(u,d){return i=u,r=d,h()}}function au(){return Sa()(en,en)}function ox(n){return Math.abs(n=Math.round(n))>=1e21?n.toLocaleString("en").replace(/,/g,""):n.toString(10)}function Co(n,t){if(!isFinite(n)||n===0)return null;var e=(n=t?n.toExponential(t-1):n.toExponential()).indexOf("e"),i=n.slice(0,e);return[i.length>1?i[0]+i.slice(2):i,+n.slice(e+1)]}function Fi(n){return n=Co(Math.abs(n)),n?n[1]:NaN}function sx(n,t){return function(e,i){for(var r=e.length,o=[],s=0,a=n[0],l=0;r>0&&a>0&&(l+a+1>i&&(a=Math.max(1,i-l)),o.push(e.substring(r-=a,r+a)),!((l+=a+1)>i));)a=n[s=(s+1)%n.length];return o.reverse().join(t)}}function ax(n){return function(t){return t.replace(/[0-9]/g,function(e){return n[+e]})}}var cx=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function fr(n){if(!(t=cx.exec(n)))throw new Error("invalid format: "+n);var t;return new _a({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}fr.prototype=_a.prototype;function _a(n){this.fill=n.fill===void 0?" ":n.fill+"",this.align=n.align===void 0?">":n.align+"",this.sign=n.sign===void 0?"-":n.sign+"",this.symbol=n.symbol===void 0?"":n.symbol+"",this.zero=!!n.zero,this.width=n.width===void 0?void 0:+n.width,this.comma=!!n.comma,this.precision=n.precision===void 0?void 0:+n.precision,this.trim=!!n.trim,this.type=n.type===void 0?"":n.type+""}_a.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function lx(n){t:for(var t=n.length,e=1,i=-1,r;e<t;++e)switch(n[e]){case".":i=r=e;break;case"0":i===0&&(i=e),r=e;break;default:if(!+n[e])break t;i>0&&(i=0);break}return i>0?n.slice(0,i)+n.slice(r+1):n}var Po;function hx(n,t){var e=Co(n,t);if(!e)return Po=void 0,n.toPrecision(t);var i=e[0],r=e[1],o=r-(Po=Math.max(-8,Math.min(8,Math.floor(r/3)))*3)+1,s=i.length;return o===s?i:o>s?i+new Array(o-s+1).join("0"):o>0?i.slice(0,o)+"."+i.slice(o):"0."+new Array(1-o).join("0")+Co(n,Math.max(0,t+o-1))[0]}function cu(n,t){var e=Co(n,t);if(!e)return n+"";var i=e[0],r=e[1];return r<0?"0."+new Array(-r).join("0")+i:i.length>r+1?i.slice(0,r+1)+"."+i.slice(r+1):i+new Array(r-i.length+2).join("0")}const lu={"%":(n,t)=>(n*100).toFixed(t),b:n=>Math.round(n).toString(2),c:n=>n+"",d:ox,e:(n,t)=>n.toExponential(t),f:(n,t)=>n.toFixed(t),g:(n,t)=>n.toPrecision(t),o:n=>Math.round(n).toString(8),p:(n,t)=>cu(n*100,t),r:cu,s:hx,X:n=>Math.round(n).toString(16).toUpperCase(),x:n=>Math.round(n).toString(16)};function hu(n){return n}var uu=Array.prototype.map,fu=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function ux(n){var t=n.grouping===void 0||n.thousands===void 0?hu:sx(uu.call(n.grouping,Number),n.thousands+""),e=n.currency===void 0?"":n.currency[0]+"",i=n.currency===void 0?"":n.currency[1]+"",r=n.decimal===void 0?".":n.decimal+"",o=n.numerals===void 0?hu:ax(uu.call(n.numerals,String)),s=n.percent===void 0?"%":n.percent+"",a=n.minus===void 0?"−":n.minus+"",l=n.nan===void 0?"NaN":n.nan+"";function c(f,u){f=fr(f);var d=f.fill,p=f.align,y=f.sign,g=f.symbol,m=f.zero,x=f.width,v=f.comma,b=f.precision,k=f.trim,M=f.type;M==="n"?(v=!0,M="g"):lu[M]||(b===void 0&&(b=12),k=!0,M="g"),(m||d==="0"&&p==="=")&&(m=!0,d="0",p="=");var C=(u&&u.prefix!==void 0?u.prefix:"")+(g==="$"?e:g==="#"&&/[boxX]/.test(M)?"0"+M.toLowerCase():""),L=(g==="$"?i:/[%p]/.test(M)?s:"")+(u&&u.suffix!==void 0?u.suffix:""),_=lu[M],T=/[defgprs%]/.test(M);b=b===void 0?6:/[gprs]/.test(M)?Math.max(1,Math.min(21,b)):Math.max(0,Math.min(20,b));function I(E){var P=C,S=L,w,A,$;if(M==="c")S=_(E)+S,E="";else{E=+E;var D=E<0||1/E<0;if(E=isNaN(E)?l:_(Math.abs(E),b),k&&(E=lx(E)),D&&+E==0&&y!=="+"&&(D=!1),P=(D?y==="("?y:a:y==="-"||y==="("?"":y)+P,S=(M==="s"&&!isNaN(E)&&Po!==void 0?fu[8+Po/3]:"")+S+(D&&y==="("?")":""),T){for(w=-1,A=E.length;++w<A;)if($=E.charCodeAt(w),48>$||$>57){S=($===46?r+E.slice(w+1):E.slice(w))+S,E=E.slice(0,w);break}}}v&&!m&&(E=t(E,1/0));var F=P.length+E.length+S.length,R=F<x?new Array(x-F+1).join(d):"";switch(v&&m&&(E=t(R+E,R.length?x-S.length:1/0),R=""),p){case"<":E=P+E+S+R;break;case"=":E=P+R+E+S;break;case"^":E=R.slice(0,F=R.length>>1)+P+E+S+R.slice(F);break;default:E=R+P+E+S;break}return o(E)}return I.toString=function(){return f+""},I}function h(f,u){var d=Math.max(-8,Math.min(8,Math.floor(Fi(u)/3)))*3,p=Math.pow(10,-d),y=c((f=fr(f),f.type="f",f),{suffix:fu[8+d/3]});return function(g){return y(p*g)}}return{format:c,formatPrefix:h}}var Eo,dr,du;fx({thousands:",",grouping:[3],currency:["$",""]});function fx(n){return Eo=ux(n),dr=Eo.format,du=Eo.formatPrefix,Eo}function dx(n){return Math.max(0,-Fi(Math.abs(n)))}function px(n,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Fi(t)/3)))*3-Fi(Math.abs(n)))}function gx(n,t){return n=Math.abs(n),t=Math.abs(t)-n,Math.max(0,Fi(t)-Fi(n))+1}function mx(n,t,e,i){var r=ba(n,t,e),o;switch(i=fr(i??",f"),i.type){case"s":{var s=Math.max(Math.abs(n),Math.abs(t));return i.precision==null&&!isNaN(o=px(r,s))&&(i.precision=o),du(i,s)}case"":case"e":case"g":case"p":case"r":{i.precision==null&&!isNaN(o=gx(r,Math.max(Math.abs(n),Math.abs(t))))&&(i.precision=o-(i.type==="e"));break}case"f":case"%":{i.precision==null&&!isNaN(o=dx(r))&&(i.precision=o-(i.type==="%")*2);break}}return dr(i)}function Ca(n){var t=n.domain;return n.ticks=function(e){var i=t();return ya(i[0],i[i.length-1],e??10)},n.tickFormat=function(e,i){var r=t();return mx(r[0],r[r.length-1],e??10,i)},n.nice=function(e){e==null&&(e=10);var i=t(),r=0,o=i.length-1,s=i[r],a=i[o],l,c,h=10;for(a<s&&(c=s,s=a,a=c,c=r,r=o,o=c);h-- >0;){if(c=xa(s,a,e),c===l)return i[r]=s,i[o]=a,t(i);if(c>0)s=Math.floor(s/c)*c,a=Math.ceil(a/c)*c;else if(c<0)s=Math.ceil(s*c)/c,a=Math.floor(a*c)/c;else break;l=c}return n},n}function ke(){var n=au();return n.copy=function(){return _o(n,ke())},gi.apply(n,arguments),Ca(n)}function pu(n,t){n=n.slice();var e=0,i=n.length-1,r=n[e],o=n[i],s;return o<r&&(s=e,e=i,i=s,s=r,r=o,o=s),n[e]=t.floor(r),n[i]=t.ceil(o),n}function gu(n){return Math.log(n)}function mu(n){return Math.exp(n)}function yx(n){return-Math.log(-n)}function xx(n){return-Math.exp(-n)}function bx(n){return isFinite(n)?+("1e"+n):n<0?0:n}function vx(n){return n===10?bx:n===Math.E?Math.exp:t=>Math.pow(n,t)}function wx(n){return n===Math.E?Math.log:n===10&&Math.log10||n===2&&Math.log2||(n=Math.log(n),t=>Math.log(t)/n)}function yu(n){return(t,e)=>-n(-t,e)}function kx(n){const t=n(gu,mu),e=t.domain;let i=10,r,o;function s(){return r=wx(i),o=vx(i),e()[0]<0?(r=yu(r),o=yu(o),n(yx,xx)):n(gu,mu),t}return t.base=function(a){return arguments.length?(i=+a,s()):i},t.domain=function(a){return arguments.length?(e(a),s()):e()},t.ticks=a=>{const l=e();let c=l[0],h=l[l.length-1];const f=h<c;f&&([c,h]=[h,c]);let u=r(c),d=r(h),p,y;const g=a==null?10:+a;let m=[];if(!(i%1)&&d-u<g){if(u=Math.floor(u),d=Math.ceil(d),c>0){for(;u<=d;++u)for(p=1;p<i;++p)if(y=u<0?p/o(-u):p*o(u),!(y<c)){if(y>h)break;m.push(y)}}else for(;u<=d;++u)for(p=i-1;p>=1;--p)if(y=u>0?p/o(-u):p*o(u),!(y<c)){if(y>h)break;m.push(y)}m.length*2<g&&(m=ya(c,h,g))}else m=ya(u,d,Math.min(d-u,g)).map(o);return f?m.reverse():m},t.tickFormat=(a,l)=>{if(a==null&&(a=10),l==null&&(l=i===10?"s":","),typeof l!="function"&&(!(i%1)&&(l=fr(l)).precision==null&&(l.trim=!0),l=dr(l)),a===1/0)return l;const c=Math.max(1,i*a/t.ticks().length);return h=>{let f=h/o(Math.round(r(h)));return f*i<i-.5&&(f*=i),f<=c?l(h):""}},t.nice=()=>e(pu(e(),{floor:a=>o(Math.floor(r(a))),ceil:a=>o(Math.ceil(r(a)))})),t}function To(){const n=kx(Sa()).domain([1,10]);return n.copy=()=>_o(n,To()).base(n.base()),gi.apply(n,arguments),n}function xu(n){return function(t){return t<0?-Math.pow(-t,n):Math.pow(t,n)}}function Mx(n){return n<0?-Math.sqrt(-n):Math.sqrt(n)}function Ax(n){return n<0?-n*n:n*n}function Sx(n){var t=n(en,en),e=1;function i(){return e===1?n(en,en):e===.5?n(Mx,Ax):n(xu(e),xu(1/e))}return t.exponent=function(r){return arguments.length?(e=+r,i()):e},Ca(t)}function bu(){var n=Sx(Sa());return n.copy=function(){return _o(n,bu()).exponent(n.exponent())},gi.apply(n,arguments),n}function _x(){return bu.apply(null,arguments).exponent(.5)}const Pa=new Date,Ea=new Date;function le(n,t,e,i){function r(o){return n(o=arguments.length===0?new Date:new Date(+o)),o}return r.floor=o=>(n(o=new Date(+o)),o),r.ceil=o=>(n(o=new Date(o-1)),t(o,1),n(o),o),r.round=o=>{const s=r(o),a=r.ceil(o);return o-s<a-o?s:a},r.offset=(o,s)=>(t(o=new Date(+o),s==null?1:Math.floor(s)),o),r.range=(o,s,a)=>{const l=[];if(o=r.ceil(o),a=a==null?1:Math.floor(a),!(o<s)||!(a>0))return l;let c;do l.push(c=new Date(+o)),t(o,a),n(o);while(c<o&&o<s);return l},r.filter=o=>le(s=>{if(s>=s)for(;n(s),!o(s);)s.setTime(s-1)},(s,a)=>{if(s>=s)if(a<0)for(;++a<=0;)for(;t(s,-1),!o(s););else for(;--a>=0;)for(;t(s,1),!o(s););}),e&&(r.count=(o,s)=>(Pa.setTime(+o),Ea.setTime(+s),n(Pa),n(Ea),Math.floor(e(Pa,Ea))),r.every=o=>(o=Math.floor(o),!isFinite(o)||!(o>0)?null:o>1?r.filter(i?s=>i(s)%o===0:s=>r.count(0,s)%o===0):r)),r}const $o=le(()=>{},(n,t)=>{n.setTime(+n+t)},(n,t)=>t-n);$o.every=n=>(n=Math.floor(n),!isFinite(n)||!(n>0)?null:n>1?le(t=>{t.setTime(Math.floor(t/n)*n)},(t,e)=>{t.setTime(+t+e*n)},(t,e)=>(e-t)/n):$o),$o.range;const $n=1e3,nn=$n*60,Ln=nn*60,In=Ln*24,Ta=In*7,vu=In*30,$a=In*365,yi=le(n=>{n.setTime(n-n.getMilliseconds())},(n,t)=>{n.setTime(+n+t*$n)},(n,t)=>(t-n)/$n,n=>n.getUTCSeconds());yi.range;const La=le(n=>{n.setTime(n-n.getMilliseconds()-n.getSeconds()*$n)},(n,t)=>{n.setTime(+n+t*nn)},(n,t)=>(t-n)/nn,n=>n.getMinutes());La.range;const Ia=le(n=>{n.setUTCSeconds(0,0)},(n,t)=>{n.setTime(+n+t*nn)},(n,t)=>(t-n)/nn,n=>n.getUTCMinutes());Ia.range;const Fa=le(n=>{n.setTime(n-n.getMilliseconds()-n.getSeconds()*$n-n.getMinutes()*nn)},(n,t)=>{n.setTime(+n+t*Ln)},(n,t)=>(t-n)/Ln,n=>n.getHours());Fa.range;const Da=le(n=>{n.setUTCMinutes(0,0,0)},(n,t)=>{n.setTime(+n+t*Ln)},(n,t)=>(t-n)/Ln,n=>n.getUTCHours());Da.range;const pr=le(n=>n.setHours(0,0,0,0),(n,t)=>n.setDate(n.getDate()+t),(n,t)=>(t-n-(t.getTimezoneOffset()-n.getTimezoneOffset())*nn)/In,n=>n.getDate()-1);pr.range;const Lo=le(n=>{n.setUTCHours(0,0,0,0)},(n,t)=>{n.setUTCDate(n.getUTCDate()+t)},(n,t)=>(t-n)/In,n=>n.getUTCDate()-1);Lo.range;const wu=le(n=>{n.setUTCHours(0,0,0,0)},(n,t)=>{n.setUTCDate(n.getUTCDate()+t)},(n,t)=>(t-n)/In,n=>Math.floor(n/In));wu.range;function xi(n){return le(t=>{t.setDate(t.getDate()-(t.getDay()+7-n)%7),t.setHours(0,0,0,0)},(t,e)=>{t.setDate(t.getDate()+e*7)},(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*nn)/Ta)}const Io=xi(0),Fo=xi(1),Cx=xi(2),Px=xi(3),Di=xi(4),Ex=xi(5),Tx=xi(6);Io.range,Fo.range,Cx.range,Px.range,Di.range,Ex.range,Tx.range;function bi(n){return le(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-n)%7),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e*7)},(t,e)=>(e-t)/Ta)}const Do=bi(0),Ro=bi(1),$x=bi(2),Lx=bi(3),Ri=bi(4),Ix=bi(5),Fx=bi(6);Do.range,Ro.range,$x.range,Lx.range,Ri.range,Ix.range,Fx.range;const Ra=le(n=>{n.setDate(1),n.setHours(0,0,0,0)},(n,t)=>{n.setMonth(n.getMonth()+t)},(n,t)=>t.getMonth()-n.getMonth()+(t.getFullYear()-n.getFullYear())*12,n=>n.getMonth());Ra.range;const za=le(n=>{n.setUTCDate(1),n.setUTCHours(0,0,0,0)},(n,t)=>{n.setUTCMonth(n.getUTCMonth()+t)},(n,t)=>t.getUTCMonth()-n.getUTCMonth()+(t.getUTCFullYear()-n.getUTCFullYear())*12,n=>n.getUTCMonth());za.range;const Fn=le(n=>{n.setMonth(0,1),n.setHours(0,0,0,0)},(n,t)=>{n.setFullYear(n.getFullYear()+t)},(n,t)=>t.getFullYear()-n.getFullYear(),n=>n.getFullYear());Fn.every=n=>!isFinite(n=Math.floor(n))||!(n>0)?null:le(t=>{t.setFullYear(Math.floor(t.getFullYear()/n)*n),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,e)=>{t.setFullYear(t.getFullYear()+e*n)}),Fn.range;const Dn=le(n=>{n.setUTCMonth(0,1),n.setUTCHours(0,0,0,0)},(n,t)=>{n.setUTCFullYear(n.getUTCFullYear()+t)},(n,t)=>t.getUTCFullYear()-n.getUTCFullYear(),n=>n.getUTCFullYear());Dn.every=n=>!isFinite(n=Math.floor(n))||!(n>0)?null:le(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/n)*n),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e*n)}),Dn.range;function ku(n,t,e,i,r,o){const s=[[yi,1,$n],[yi,5,5*$n],[yi,15,15*$n],[yi,30,30*$n],[o,1,nn],[o,5,5*nn],[o,15,15*nn],[o,30,30*nn],[r,1,Ln],[r,3,3*Ln],[r,6,6*Ln],[r,12,12*Ln],[i,1,In],[i,2,2*In],[e,1,Ta],[t,1,vu],[t,3,3*vu],[n,1,$a]];function a(c,h,f){const u=h<c;u&&([c,h]=[h,c]);const d=f&&typeof f.range=="function"?f:l(c,h,f),p=d?d.range(c,+h+1):[];return u?p.reverse():p}function l(c,h,f){const u=Math.abs(h-c)/f,d=ma(([,,g])=>g).right(s,u);if(d===s.length)return n.every(ba(c/$a,h/$a,f));if(d===0)return $o.every(Math.max(ba(c,h,f),1));const[p,y]=s[u/s[d-1][2]<s[d][2]/u?d-1:d];return p.every(y)}return[a,l]}const[Dx,Rx]=ku(Dn,za,Do,wu,Da,Ia),[zx,Bx]=ku(Fn,Ra,Io,pr,Fa,La);function Ba(n){if(0<=n.y&&n.y<100){var t=new Date(-1,n.m,n.d,n.H,n.M,n.S,n.L);return t.setFullYear(n.y),t}return new Date(n.y,n.m,n.d,n.H,n.M,n.S,n.L)}function Oa(n){if(0<=n.y&&n.y<100){var t=new Date(Date.UTC(-1,n.m,n.d,n.H,n.M,n.S,n.L));return t.setUTCFullYear(n.y),t}return new Date(Date.UTC(n.y,n.m,n.d,n.H,n.M,n.S,n.L))}function gr(n,t,e){return{y:n,m:t,d:e,H:0,M:0,S:0,L:0}}function Ox(n){var t=n.dateTime,e=n.date,i=n.time,r=n.periods,o=n.days,s=n.shortDays,a=n.months,l=n.shortMonths,c=mr(r),h=yr(r),f=mr(o),u=yr(o),d=mr(s),p=yr(s),y=mr(a),g=yr(a),m=mr(l),x=yr(l),v={a:$,A:D,b:F,B:R,c:null,d:Pu,e:Pu,f:c1,g:x1,G:v1,H:o1,I:s1,j:a1,L:Eu,m:l1,M:h1,p:z,q:B,Q:Du,s:Ru,S:u1,u:f1,U:d1,V:p1,w:g1,W:m1,x:null,X:null,y:y1,Y:b1,Z:w1,"%":Fu},b={a:H,A:J,b:X,B:q,c:null,d:$u,e:$u,f:S1,g:D1,G:z1,H:k1,I:M1,j:A1,L:Lu,m:_1,M:C1,p:W,q:U,Q:Du,s:Ru,S:P1,u:E1,U:T1,V:$1,w:L1,W:I1,x:null,X:null,y:F1,Y:R1,Z:B1,"%":Fu},k={a:T,A:I,b:E,B:P,c:S,d:_u,e:_u,f:e1,g:Su,G:Au,H:Cu,I:Cu,j:Kx,L:t1,m:Zx,M:Jx,p:_,q:qx,Q:i1,s:r1,S:Qx,u:Gx,U:Yx,V:Xx,w:Vx,W:Ux,x:w,X:A,y:Su,Y:Au,Z:jx,"%":n1};v.x=M(e,v),v.X=M(i,v),v.c=M(t,v),b.x=M(e,b),b.X=M(i,b),b.c=M(t,b);function M(G,N){return function(Y){var O=[],ct=-1,it=0,ft=G.length,dt,at,ot;for(Y instanceof Date||(Y=new Date(+Y));++ct<ft;)G.charCodeAt(ct)===37&&(O.push(G.slice(it,ct)),(at=Mu[dt=G.charAt(++ct)])!=null?dt=G.charAt(++ct):at=dt==="e"?" ":"0",(ot=N[dt])&&(dt=ot(Y,at)),O.push(dt),it=ct+1);return O.push(G.slice(it,ct)),O.join("")}}function C(G,N){return function(Y){var O=gr(1900,void 0,1),ct=L(O,G,Y+="",0),it,ft;if(ct!=Y.length)return null;if("Q"in O)return new Date(O.Q);if("s"in O)return new Date(O.s*1e3+("L"in O?O.L:0));if(N&&!("Z"in O)&&(O.Z=0),"p"in O&&(O.H=O.H%12+O.p*12),O.m===void 0&&(O.m="q"in O?O.q:0),"V"in O){if(O.V<1||O.V>53)return null;"w"in O||(O.w=1),"Z"in O?(it=Oa(gr(O.y,0,1)),ft=it.getUTCDay(),it=ft>4||ft===0?Ro.ceil(it):Ro(it),it=Lo.offset(it,(O.V-1)*7),O.y=it.getUTCFullYear(),O.m=it.getUTCMonth(),O.d=it.getUTCDate()+(O.w+6)%7):(it=Ba(gr(O.y,0,1)),ft=it.getDay(),it=ft>4||ft===0?Fo.ceil(it):Fo(it),it=pr.offset(it,(O.V-1)*7),O.y=it.getFullYear(),O.m=it.getMonth(),O.d=it.getDate()+(O.w+6)%7)}else("W"in O||"U"in O)&&("w"in O||(O.w="u"in O?O.u%7:"W"in O?1:0),ft="Z"in O?Oa(gr(O.y,0,1)).getUTCDay():Ba(gr(O.y,0,1)).getDay(),O.m=0,O.d="W"in O?(O.w+6)%7+O.W*7-(ft+5)%7:O.w+O.U*7-(ft+6)%7);return"Z"in O?(O.H+=O.Z/100|0,O.M+=O.Z%100,Oa(O)):Ba(O)}}function L(G,N,Y,O){for(var ct=0,it=N.length,ft=Y.length,dt,at;ct<it;){if(O>=ft)return-1;if(dt=N.charCodeAt(ct++),dt===37){if(dt=N.charAt(ct++),at=k[dt in Mu?N.charAt(ct++):dt],!at||(O=at(G,Y,O))<0)return-1}else if(dt!=Y.charCodeAt(O++))return-1}return O}function _(G,N,Y){var O=c.exec(N.slice(Y));return O?(G.p=h.get(O[0].toLowerCase()),Y+O[0].length):-1}function T(G,N,Y){var O=d.exec(N.slice(Y));return O?(G.w=p.get(O[0].toLowerCase()),Y+O[0].length):-1}function I(G,N,Y){var O=f.exec(N.slice(Y));return O?(G.w=u.get(O[0].toLowerCase()),Y+O[0].length):-1}function E(G,N,Y){var O=m.exec(N.slice(Y));return O?(G.m=x.get(O[0].toLowerCase()),Y+O[0].length):-1}function P(G,N,Y){var O=y.exec(N.slice(Y));return O?(G.m=g.get(O[0].toLowerCase()),Y+O[0].length):-1}function S(G,N,Y){return L(G,t,N,Y)}function w(G,N,Y){return L(G,e,N,Y)}function A(G,N,Y){return L(G,i,N,Y)}function $(G){return s[G.getDay()]}function D(G){return o[G.getDay()]}function F(G){return l[G.getMonth()]}function R(G){return a[G.getMonth()]}function z(G){return r[+(G.getHours()>=12)]}function B(G){return 1+~~(G.getMonth()/3)}function H(G){return s[G.getUTCDay()]}function J(G){return o[G.getUTCDay()]}function X(G){return l[G.getUTCMonth()]}function q(G){return a[G.getUTCMonth()]}function W(G){return r[+(G.getUTCHours()>=12)]}function U(G){return 1+~~(G.getUTCMonth()/3)}return{format:function(G){var N=M(G+="",v);return N.toString=function(){return G},N},parse:function(G){var N=C(G+="",!1);return N.toString=function(){return G},N},utcFormat:function(G){var N=M(G+="",b);return N.toString=function(){return G},N},utcParse:function(G){var N=C(G+="",!0);return N.toString=function(){return G},N}}}var Mu={"-":"",_:" ",0:"0"},fe=/^\s*\d+/,Nx=/^%/,Wx=/[\\^$*+?|[\]().{}]/g;function Yt(n,t,e){var i=n<0?"-":"",r=(i?-n:n)+"",o=r.length;return i+(o<e?new Array(e-o+1).join(t)+r:r)}function Hx(n){return n.replace(Wx,"\\$&")}function mr(n){return new RegExp("^(?:"+n.map(Hx).join("|")+")","i")}function yr(n){return new Map(n.map((t,e)=>[t.toLowerCase(),e]))}function Vx(n,t,e){var i=fe.exec(t.slice(e,e+1));return i?(n.w=+i[0],e+i[0].length):-1}function Gx(n,t,e){var i=fe.exec(t.slice(e,e+1));return i?(n.u=+i[0],e+i[0].length):-1}function Yx(n,t,e){var i=fe.exec(t.slice(e,e+2));return i?(n.U=+i[0],e+i[0].length):-1}function Xx(n,t,e){var i=fe.exec(t.slice(e,e+2));return i?(n.V=+i[0],e+i[0].length):-1}function Ux(n,t,e){var i=fe.exec(t.slice(e,e+2));return i?(n.W=+i[0],e+i[0].length):-1}function Au(n,t,e){var i=fe.exec(t.slice(e,e+4));return i?(n.y=+i[0],e+i[0].length):-1}function Su(n,t,e){var i=fe.exec(t.slice(e,e+2));return i?(n.y=+i[0]+(+i[0]>68?1900:2e3),e+i[0].length):-1}function jx(n,t,e){var i=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(e,e+6));return i?(n.Z=i[1]?0:-(i[2]+(i[3]||"00")),e+i[0].length):-1}function qx(n,t,e){var i=fe.exec(t.slice(e,e+1));return i?(n.q=i[0]*3-3,e+i[0].length):-1}function Zx(n,t,e){var i=fe.exec(t.slice(e,e+2));return i?(n.m=i[0]-1,e+i[0].length):-1}function _u(n,t,e){var i=fe.exec(t.slice(e,e+2));return i?(n.d=+i[0],e+i[0].length):-1}function Kx(n,t,e){var i=fe.exec(t.slice(e,e+3));return i?(n.m=0,n.d=+i[0],e+i[0].length):-1}function Cu(n,t,e){var i=fe.exec(t.slice(e,e+2));return i?(n.H=+i[0],e+i[0].length):-1}function Jx(n,t,e){var i=fe.exec(t.slice(e,e+2));return i?(n.M=+i[0],e+i[0].length):-1}function Qx(n,t,e){var i=fe.exec(t.slice(e,e+2));return i?(n.S=+i[0],e+i[0].length):-1}function t1(n,t,e){var i=fe.exec(t.slice(e,e+3));return i?(n.L=+i[0],e+i[0].length):-1}function e1(n,t,e){var i=fe.exec(t.slice(e,e+6));return i?(n.L=Math.floor(i[0]/1e3),e+i[0].length):-1}function n1(n,t,e){var i=Nx.exec(t.slice(e,e+1));return i?e+i[0].length:-1}function i1(n,t,e){var i=fe.exec(t.slice(e));return i?(n.Q=+i[0],e+i[0].length):-1}function r1(n,t,e){var i=fe.exec(t.slice(e));return i?(n.s=+i[0],e+i[0].length):-1}function Pu(n,t){return Yt(n.getDate(),t,2)}function o1(n,t){return Yt(n.getHours(),t,2)}function s1(n,t){return Yt(n.getHours()%12||12,t,2)}function a1(n,t){return Yt(1+pr.count(Fn(n),n),t,3)}function Eu(n,t){return Yt(n.getMilliseconds(),t,3)}function c1(n,t){return Eu(n,t)+"000"}function l1(n,t){return Yt(n.getMonth()+1,t,2)}function h1(n,t){return Yt(n.getMinutes(),t,2)}function u1(n,t){return Yt(n.getSeconds(),t,2)}function f1(n){var t=n.getDay();return t===0?7:t}function d1(n,t){return Yt(Io.count(Fn(n)-1,n),t,2)}function Tu(n){var t=n.getDay();return t>=4||t===0?Di(n):Di.ceil(n)}function p1(n,t){return n=Tu(n),Yt(Di.count(Fn(n),n)+(Fn(n).getDay()===4),t,2)}function g1(n){return n.getDay()}function m1(n,t){return Yt(Fo.count(Fn(n)-1,n),t,2)}function y1(n,t){return Yt(n.getFullYear()%100,t,2)}function x1(n,t){return n=Tu(n),Yt(n.getFullYear()%100,t,2)}function b1(n,t){return Yt(n.getFullYear()%1e4,t,4)}function v1(n,t){var e=n.getDay();return n=e>=4||e===0?Di(n):Di.ceil(n),Yt(n.getFullYear()%1e4,t,4)}function w1(n){var t=n.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+Yt(t/60|0,"0",2)+Yt(t%60,"0",2)}function $u(n,t){return Yt(n.getUTCDate(),t,2)}function k1(n,t){return Yt(n.getUTCHours(),t,2)}function M1(n,t){return Yt(n.getUTCHours()%12||12,t,2)}function A1(n,t){return Yt(1+Lo.count(Dn(n),n),t,3)}function Lu(n,t){return Yt(n.getUTCMilliseconds(),t,3)}function S1(n,t){return Lu(n,t)+"000"}function _1(n,t){return Yt(n.getUTCMonth()+1,t,2)}function C1(n,t){return Yt(n.getUTCMinutes(),t,2)}function P1(n,t){return Yt(n.getUTCSeconds(),t,2)}function E1(n){var t=n.getUTCDay();return t===0?7:t}function T1(n,t){return Yt(Do.count(Dn(n)-1,n),t,2)}function Iu(n){var t=n.getUTCDay();return t>=4||t===0?Ri(n):Ri.ceil(n)}function $1(n,t){return n=Iu(n),Yt(Ri.count(Dn(n),n)+(Dn(n).getUTCDay()===4),t,2)}function L1(n){return n.getUTCDay()}function I1(n,t){return Yt(Ro.count(Dn(n)-1,n),t,2)}function F1(n,t){return Yt(n.getUTCFullYear()%100,t,2)}function D1(n,t){return n=Iu(n),Yt(n.getUTCFullYear()%100,t,2)}function R1(n,t){return Yt(n.getUTCFullYear()%1e4,t,4)}function z1(n,t){var e=n.getUTCDay();return n=e>=4||e===0?Ri(n):Ri.ceil(n),Yt(n.getUTCFullYear()%1e4,t,4)}function B1(){return"+0000"}function Fu(){return"%"}function Du(n){return+n}function Ru(n){return Math.floor(+n/1e3)}var zi,zo,Bo;O1({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function O1(n){return zi=Ox(n),zo=zi.format,zi.parse,Bo=zi.utcFormat,zi.utcParse,zi}function N1(n){return new Date(n)}function W1(n){return n instanceof Date?+n:+new Date(+n)}function Na(n,t,e,i,r,o,s,a,l,c){var h=au(),f=h.invert,u=h.domain,d=c(".%L"),p=c(":%S"),y=c("%I:%M"),g=c("%I %p"),m=c("%a %d"),x=c("%b %d"),v=c("%B"),b=c("%Y");function k(M){return(l(M)<M?d:a(M)<M?p:s(M)<M?y:o(M)<M?g:i(M)<M?r(M)<M?m:x:e(M)<M?v:b)(M)}return h.invert=function(M){return new Date(f(M))},h.domain=function(M){return arguments.length?u(Array.from(M,W1)):u().map(N1)},h.ticks=function(M){var C=u();return n(C[0],C[C.length-1],M??10)},h.tickFormat=function(M,C){return C==null?k:c(C)},h.nice=function(M){var C=u();return(!M||typeof M.range!="function")&&(M=t(C[0],C[C.length-1],M??10)),M?u(pu(C,M)):h},h.copy=function(){return _o(h,Na(n,t,e,i,r,o,s,a,l,c))},h}function H1(){return gi.apply(Na(zx,Bx,Fn,Ra,Io,pr,Fa,La,yi,zo).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function V1(){return gi.apply(Na(Dx,Rx,Dn,za,Do,Lo,Da,Ia,yi,Bo).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function G1(){var n=0,t=1,e,i,r,o,s=en,a=!1,l;function c(f){return f==null||isNaN(f=+f)?l:s(r===0?.5:(f=(o(f)-e)*r,a?Math.max(0,Math.min(1,f)):f))}c.domain=function(f){return arguments.length?([n,t]=f,e=o(n=+n),i=o(t=+t),r=e===i?0:1/(i-e),c):[n,t]},c.clamp=function(f){return arguments.length?(a=!!f,c):a},c.interpolator=function(f){return arguments.length?(s=f,c):s};function h(f){return function(u){var d,p;return arguments.length?([d,p]=u,s=f(d,p),c):[s(0),s(1)]}}return c.range=h(ce),c.rangeRound=h(eu),c.unknown=function(f){return arguments.length?(l=f,c):l},function(f){return o=f,e=f(n),i=f(t),r=e===i?0:1/(i-e),c}}function Y1(n,t){return t.domain(n.domain()).interpolator(n.interpolator()).clamp(n.clamp()).unknown(n.unknown())}function zu(){var n=Ca(G1()(en));return n.copy=function(){return Y1(n,zu())},$y.apply(n,arguments)}function X1(n){return n}var Oo=1,No=2,Wa=3,xr=4,Bu=1e-6;function U1(n){return"translate("+n+",0)"}function j1(n){return"translate(0,"+n+")"}function q1(n){return t=>+n(t)}function Z1(n,t){return t=Math.max(0,n.bandwidth()-t*2)/2,n.round()&&(t=Math.round(t)),e=>+n(e)+t}function K1(){return!this.__axis}function Wo(n,t){var e=[],i=null,r=null,o=6,s=6,a=3,l=typeof window<"u"&&window.devicePixelRatio>1?0:.5,c=n===Oo||n===xr?-1:1,h=n===xr||n===No?"x":"y",f=n===Oo||n===Wa?U1:j1;function u(d){var p=i??(t.ticks?t.ticks.apply(t,e):t.domain()),y=r??(t.tickFormat?t.tickFormat.apply(t,e):X1),g=Math.max(o,0)+a,m=t.range(),x=+m[0]+l,v=+m[m.length-1]+l,b=(t.bandwidth?Z1:q1)(t.copy(),l),k=d.selection?d.selection():d,M=k.selectAll(".domain").data([null]),C=k.selectAll(".tick").data(p,t).order(),L=C.exit(),_=C.enter().append("g").attr("class","tick"),T=C.select("line"),I=C.select("text");M=M.merge(M.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),C=C.merge(_),T=T.merge(_.append("line").attr("stroke","currentColor").attr(h+"2",c*o)),I=I.merge(_.append("text").attr("fill","currentColor").attr(h,c*g).attr("dy",n===Oo?"0em":n===Wa?"0.71em":"0.32em")),d!==k&&(M=M.transition(d),C=C.transition(d),T=T.transition(d),I=I.transition(d),L=L.transition(d).attr("opacity",Bu).attr("transform",function(E){return isFinite(E=b(E))?f(E+l):this.getAttribute("transform")}),_.attr("opacity",Bu).attr("transform",function(E){var P=this.parentNode.__axis;return f((P&&isFinite(P=P(E))?P:b(E))+l)})),L.remove(),M.attr("d",n===xr||n===No?s?"M"+c*s+","+x+"H"+l+"V"+v+"H"+c*s:"M"+l+","+x+"V"+v:s?"M"+x+","+c*s+"V"+l+"H"+v+"V"+c*s:"M"+x+","+l+"H"+v),C.attr("opacity",1).attr("transform",function(E){return f(b(E)+l)}),T.attr(h+"2",c*o),I.attr(h,c*g).text(y),k.filter(K1).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",n===No?"start":n===xr?"end":"middle"),k.each(function(){this.__axis=b})}return u.scale=function(d){return arguments.length?(t=d,u):t},u.ticks=function(){return e=Array.from(arguments),u},u.tickArguments=function(d){return arguments.length?(e=d==null?[]:Array.from(d),u):e.slice()},u.tickValues=function(d){return arguments.length?(i=d==null?null:Array.from(d),u):i&&i.slice()},u.tickFormat=function(d){return arguments.length?(r=d,u):r},u.tickSize=function(d){return arguments.length?(o=s=+d,u):o},u.tickSizeInner=function(d){return arguments.length?(o=+d,u):o},u.tickSizeOuter=function(d){return arguments.length?(s=+d,u):s},u.tickPadding=function(d){return arguments.length?(a=+d,u):a},u.offset=function(d){return arguments.length?(l=+d,u):l},u}function Ha(n){return Wo(Oo,n)}function Ou(n){return Wo(No,n)}function Nu(n){return Wo(Wa,n)}function Wu(n){return Wo(xr,n)}var J1={value:()=>{}};function Bi(){for(var n=0,t=arguments.length,e={},i;n<t;++n){if(!(i=arguments[n]+"")||i in e||/[\s.]/.test(i))throw new Error("illegal type: "+i);e[i]=[]}return new Ho(e)}function Ho(n){this._=n}function Q1(n,t){return n.trim().split(/^|\s+/).map(function(e){var i="",r=e.indexOf(".");if(r>=0&&(i=e.slice(r+1),e=e.slice(0,r)),e&&!t.hasOwnProperty(e))throw new Error("unknown type: "+e);return{type:e,name:i}})}Ho.prototype=Bi.prototype={constructor:Ho,on:function(n,t){var e=this._,i=Q1(n+"",e),r,o=-1,s=i.length;if(arguments.length<2){for(;++o<s;)if((r=(n=i[o]).type)&&(r=tb(e[r],n.name)))return r;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++o<s;)if(r=(n=i[o]).type)e[r]=Hu(e[r],n.name,t);else if(t==null)for(r in e)e[r]=Hu(e[r],n.name,null);return this},copy:function(){var n={},t=this._;for(var e in t)n[e]=t[e].slice();return new Ho(n)},call:function(n,t){if((r=arguments.length-2)>0)for(var e=new Array(r),i=0,r,o;i<r;++i)e[i]=arguments[i+2];if(!this._.hasOwnProperty(n))throw new Error("unknown type: "+n);for(o=this._[n],i=0,r=o.length;i<r;++i)o[i].value.apply(t,e)},apply:function(n,t,e){if(!this._.hasOwnProperty(n))throw new Error("unknown type: "+n);for(var i=this._[n],r=0,o=i.length;r<o;++r)i[r].value.apply(t,e)}};function tb(n,t){for(var e=0,i=n.length,r;e<i;++e)if((r=n[e]).name===t)return r.value}function Hu(n,t,e){for(var i=0,r=n.length;i<r;++i)if(n[i].name===t){n[i]=J1,n=n.slice(0,i).concat(n.slice(i+1));break}return e!=null&&n.push({name:t,value:e}),n}var Oi=0,br=0,vr=0,Vu=1e3,Vo,wr,Go=0,vi=0,Yo=0,kr=typeof performance=="object"&&performance.now?performance:Date,Gu=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(n){setTimeout(n,17)};function Va(){return vi||(Gu(eb),vi=kr.now()+Yo)}function eb(){vi=0}function Xo(){this._call=this._time=this._next=null}Xo.prototype=Uo.prototype={constructor:Xo,restart:function(n,t,e){if(typeof n!="function")throw new TypeError("callback is not a function");e=(e==null?Va():+e)+(t==null?0:+t),!this._next&&wr!==this&&(wr?wr._next=this:Vo=this,wr=this),this._call=n,this._time=e,Ga()},stop:function(){this._call&&(this._call=null,this._time=1/0,Ga())}};function Uo(n,t,e){var i=new Xo;return i.restart(n,t,e),i}function nb(){Va(),++Oi;for(var n=Vo,t;n;)(t=vi-n._time)>=0&&n._call.call(void 0,t),n=n._next;--Oi}function Yu(){vi=(Go=kr.now())+Yo,Oi=br=0;try{nb()}finally{Oi=0,rb(),vi=0}}function ib(){var n=kr.now(),t=n-Go;t>Vu&&(Yo-=t,Go=n)}function rb(){for(var n,t=Vo,e,i=1/0;t;)t._call?(i>t._time&&(i=t._time),n=t,t=t._next):(e=t._next,t._next=null,t=n?n._next=e:Vo=e);wr=n,Ga(i)}function Ga(n){if(!Oi){br&&(br=clearTimeout(br));var t=n-vi;t>24?(n<1/0&&(br=setTimeout(Yu,n-kr.now()-Yo)),vr&&(vr=clearInterval(vr))):(vr||(Go=kr.now(),vr=setInterval(ib,Vu)),Oi=1,Gu(Yu))}}function Xu(n,t,e){var i=new Xo;return t=t==null?0:+t,i.restart(r=>{i.stop(),n(r+t)},t,e),i}var ob=Bi("start","end","cancel","interrupt"),sb=[],Uu=0,ju=1,Ya=2,jo=3,qu=4,Xa=5,qo=6;function Zo(n,t,e,i,r,o){var s=n.__transition;if(!s)n.__transition={};else if(e in s)return;ab(n,e,{name:t,index:i,group:r,on:ob,tween:sb,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:Uu})}function Ua(n,t){var e=mn(n,t);if(e.state>Uu)throw new Error("too late; already scheduled");return e}function vn(n,t){var e=mn(n,t);if(e.state>jo)throw new Error("too late; already running");return e}function mn(n,t){var e=n.__transition;if(!e||!(e=e[t]))throw new Error("transition not found");return e}function ab(n,t,e){var i=n.__transition,r;i[t]=e,e.timer=Uo(o,0,e.time);function o(c){e.state=ju,e.timer.restart(s,e.delay,e.time),e.delay<=c&&s(c-e.delay)}function s(c){var h,f,u,d;if(e.state!==ju)return l();for(h in i)if(d=i[h],d.name===e.name){if(d.state===jo)return Xu(s);d.state===qu?(d.state=qo,d.timer.stop(),d.on.call("interrupt",n,n.__data__,d.index,d.group),delete i[h]):+h<t&&(d.state=qo,d.timer.stop(),d.on.call("cancel",n,n.__data__,d.index,d.group),delete i[h])}if(Xu(function(){e.state===jo&&(e.state=qu,e.timer.restart(a,e.delay,e.time),a(c))}),e.state=Ya,e.on.call("start",n,n.__data__,e.index,e.group),e.state===Ya){for(e.state=jo,r=new Array(u=e.tween.length),h=0,f=-1;h<u;++h)(d=e.tween[h].value.call(n,n.__data__,e.index,e.group))&&(r[++f]=d);r.length=f+1}}function a(c){for(var h=c<e.duration?e.ease.call(null,c/e.duration):(e.timer.restart(l),e.state=Xa,1),f=-1,u=r.length;++f<u;)r[f].call(n,h);e.state===Xa&&(e.on.call("end",n,n.__data__,e.index,e.group),l())}function l(){e.state=qo,e.timer.stop(),delete i[t];for(var c in i)return;delete n.__transition}}function Ni(n,t){var e=n.__transition,i,r,o=!0,s;if(e){t=t==null?null:t+"";for(s in e){if((i=e[s]).name!==t){o=!1;continue}r=i.state>Ya&&i.state<Xa,i.state=qo,i.timer.stop(),i.on.call(r?"interrupt":"cancel",n,n.__data__,i.index,i.group),delete e[s]}o&&delete n.__transition}}function cb(n){return this.each(function(){Ni(this,n)})}function lb(n,t){var e,i;return function(){var r=vn(this,n),o=r.tween;if(o!==e){i=e=o;for(var s=0,a=i.length;s<a;++s)if(i[s].name===t){i=i.slice(),i.splice(s,1);break}}r.tween=i}}function hb(n,t,e){var i,r;if(typeof e!="function")throw new Error;return function(){var o=vn(this,n),s=o.tween;if(s!==i){r=(i=s).slice();for(var a={name:t,value:e},l=0,c=r.length;l<c;++l)if(r[l].name===t){r[l]=a;break}l===c&&r.push(a)}o.tween=r}}function ub(n,t){var e=this._id;if(n+="",arguments.length<2){for(var i=mn(this.node(),e).tween,r=0,o=i.length,s;r<o;++r)if((s=i[r]).name===n)return s.value;return null}return this.each((t==null?lb:hb)(e,n,t))}function ja(n,t,e){var i=n._id;return n.each(function(){var r=vn(this,i);(r.value||(r.value={}))[t]=e.apply(this,arguments)}),function(r){return mn(r,i).value[t]}}function Zu(n,t){var e;return(typeof t=="number"?gn:t instanceof se?mi:(e=se(t))?(t=e,mi):tu)(n,t)}function fb(n){return function(){this.removeAttribute(n)}}function db(n){return function(){this.removeAttributeNS(n.space,n.local)}}function pb(n,t,e){var i,r=e+"",o;return function(){var s=this.getAttribute(n);return s===r?null:s===i?o:o=t(i=s,e)}}function gb(n,t,e){var i,r=e+"",o;return function(){var s=this.getAttributeNS(n.space,n.local);return s===r?null:s===i?o:o=t(i=s,e)}}function mb(n,t,e){var i,r,o;return function(){var s,a=e(this),l;return a==null?void this.removeAttribute(n):(s=this.getAttribute(n),l=a+"",s===l?null:s===i&&l===r?o:(r=l,o=t(i=s,a)))}}function yb(n,t,e){var i,r,o;return function(){var s,a=e(this),l;return a==null?void this.removeAttributeNS(n.space,n.local):(s=this.getAttributeNS(n.space,n.local),l=a+"",s===l?null:s===i&&l===r?o:(r=l,o=t(i=s,a)))}}function xb(n,t){var e=vo(n),i=e==="transform"?qy:Zu;return this.attrTween(n,typeof t=="function"?(e.local?yb:mb)(e,i,ja(this,"attr."+n,t)):t==null?(e.local?db:fb)(e):(e.local?gb:pb)(e,i,t))}function bb(n,t){return function(e){this.setAttribute(n,t.call(this,e))}}function vb(n,t){return function(e){this.setAttributeNS(n.space,n.local,t.call(this,e))}}function wb(n,t){var e,i;function r(){var o=t.apply(this,arguments);return o!==i&&(e=(i=o)&&vb(n,o)),e}return r._value=t,r}function kb(n,t){var e,i;function r(){var o=t.apply(this,arguments);return o!==i&&(e=(i=o)&&bb(n,o)),e}return r._value=t,r}function Mb(n,t){var e="attr."+n;if(arguments.length<2)return(e=this.tween(e))&&e._value;if(t==null)return this.tween(e,null);if(typeof t!="function")throw new Error;var i=vo(n);return this.tween(e,(i.local?wb:kb)(i,t))}function Ab(n,t){return function(){Ua(this,n).delay=+t.apply(this,arguments)}}function Sb(n,t){return t=+t,function(){Ua(this,n).delay=t}}function _b(n){var t=this._id;return arguments.length?this.each((typeof n=="function"?Ab:Sb)(t,n)):mn(this.node(),t).delay}function Cb(n,t){return function(){vn(this,n).duration=+t.apply(this,arguments)}}function Pb(n,t){return t=+t,function(){vn(this,n).duration=t}}function Eb(n){var t=this._id;return arguments.length?this.each((typeof n=="function"?Cb:Pb)(t,n)):mn(this.node(),t).duration}function Tb(n,t){if(typeof t!="function")throw new Error;return function(){vn(this,n).ease=t}}function $b(n){var t=this._id;return arguments.length?this.each(Tb(t,n)):mn(this.node(),t).ease}function Lb(n,t){return function(){var e=t.apply(this,arguments);if(typeof e!="function")throw new Error;vn(this,n).ease=e}}function Ib(n){if(typeof n!="function")throw new Error;return this.each(Lb(this._id,n))}function Fb(n){typeof n!="function"&&(n=Fh(n));for(var t=this._groups,e=t.length,i=new Array(e),r=0;r<e;++r)for(var o=t[r],s=o.length,a=i[r]=[],l,c=0;c<s;++c)(l=o[c])&&n.call(l,l.__data__,c,o)&&a.push(l);return new Rn(i,this._parents,this._name,this._id)}function Db(n){if(n._id!==this._id)throw new Error;for(var t=this._groups,e=n._groups,i=t.length,r=e.length,o=Math.min(i,r),s=new Array(i),a=0;a<o;++a)for(var l=t[a],c=e[a],h=l.length,f=s[a]=new Array(h),u,d=0;d<h;++d)(u=l[d]||c[d])&&(f[d]=u);for(;a<i;++a)s[a]=t[a];return new Rn(s,this._parents,this._name,this._id)}function Rb(n){return(n+"").trim().split(/^|\s+/).every(function(t){var e=t.indexOf(".");return e>=0&&(t=t.slice(0,e)),!t||t==="start"})}function zb(n,t,e){var i,r,o=Rb(t)?Ua:vn;return function(){var s=o(this,n),a=s.on;a!==i&&(r=(i=a).copy()).on(t,e),s.on=r}}function Bb(n,t){var e=this._id;return arguments.length<2?mn(this.node(),e).on.on(n):this.each(zb(e,n,t))}function Ob(n){return function(){var t=this.parentNode;for(var e in this.__transition)if(+e!==n)return;t&&t.removeChild(this)}}function Nb(){return this.on("end.remove",Ob(this._id))}function Wb(n){var t=this._name,e=this._id;typeof n!="function"&&(n=pa(n));for(var i=this._groups,r=i.length,o=new Array(r),s=0;s<r;++s)for(var a=i[s],l=a.length,c=o[s]=new Array(l),h,f,u=0;u<l;++u)(h=a[u])&&(f=n.call(h,h.__data__,u,a))&&("__data__"in h&&(f.__data__=h.__data__),c[u]=f,Zo(c[u],t,e,u,c,mn(h,e)));return new Rn(o,this._parents,t,e)}function Hb(n){var t=this._name,e=this._id;typeof n!="function"&&(n=Ih(n));for(var i=this._groups,r=i.length,o=[],s=[],a=0;a<r;++a)for(var l=i[a],c=l.length,h,f=0;f<c;++f)if(h=l[f]){for(var u=n.call(h,h.__data__,f,l),d,p=mn(h,e),y=0,g=u.length;y<g;++y)(d=u[y])&&Zo(d,t,e,y,u,p);o.push(u),s.push(h)}return new Rn(o,s,t,e)}var Vb=ur.prototype.constructor;function Gb(){return new Vb(this._groups,this._parents)}function Yb(n,t){var e,i,r;return function(){var o=Ii(this,n),s=(this.style.removeProperty(n),Ii(this,n));return o===s?null:o===e&&s===i?r:r=t(e=o,i=s)}}function Ku(n){return function(){this.style.removeProperty(n)}}function Xb(n,t,e){var i,r=e+"",o;return function(){var s=Ii(this,n);return s===r?null:s===i?o:o=t(i=s,e)}}function Ub(n,t,e){var i,r,o;return function(){var s=Ii(this,n),a=e(this),l=a+"";return a==null&&(l=a=(this.style.removeProperty(n),Ii(this,n))),s===l?null:s===i&&l===r?o:(r=l,o=t(i=s,a))}}function jb(n,t){var e,i,r,o="style."+t,s="end."+o,a;return function(){var l=vn(this,n),c=l.on,h=l.value[o]==null?a||(a=Ku(t)):void 0;(c!==e||r!==h)&&(i=(e=c).copy()).on(s,r=h),l.on=i}}function qb(n,t,e){var i=(n+="")=="transform"?jy:Zu;return t==null?this.styleTween(n,Yb(n,i)).on("end.style."+n,Ku(n)):typeof t=="function"?this.styleTween(n,Ub(n,i,ja(this,"style."+n,t))).each(jb(this._id,n)):this.styleTween(n,Xb(n,i,t),e).on("end.style."+n,null)}function Zb(n,t,e){return function(i){this.style.setProperty(n,t.call(this,i),e)}}function Kb(n,t,e){var i,r;function o(){var s=t.apply(this,arguments);return s!==r&&(i=(r=s)&&Zb(n,s,e)),i}return o._value=t,o}function Jb(n,t,e){var i="style."+(n+="");if(arguments.length<2)return(i=this.tween(i))&&i._value;if(t==null)return this.tween(i,null);if(typeof t!="function")throw new Error;return this.tween(i,Kb(n,t,e??""))}function Qb(n){return function(){this.textContent=n}}function tv(n){return function(){var t=n(this);this.textContent=t??""}}function ev(n){return this.tween("text",typeof n=="function"?tv(ja(this,"text",n)):Qb(n==null?"":n+""))}function nv(n){return function(t){this.textContent=n.call(this,t)}}function iv(n){var t,e;function i(){var r=n.apply(this,arguments);return r!==e&&(t=(e=r)&&nv(r)),t}return i._value=n,i}function rv(n){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(n==null)return this.tween(t,null);if(typeof n!="function")throw new Error;return this.tween(t,iv(n))}function ov(){for(var n=this._name,t=this._id,e=Ju(),i=this._groups,r=i.length,o=0;o<r;++o)for(var s=i[o],a=s.length,l,c=0;c<a;++c)if(l=s[c]){var h=mn(l,t);Zo(l,n,e,c,s,{time:h.time+h.delay+h.duration,delay:0,duration:h.duration,ease:h.ease})}return new Rn(i,this._parents,n,e)}function sv(){var n,t,e=this,i=e._id,r=e.size();return new Promise(function(o,s){var a={value:s},l={value:function(){--r===0&&o()}};e.each(function(){var c=vn(this,i),h=c.on;h!==n&&(t=(n=h).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(l)),c.on=t}),r===0&&o()})}var av=0;function Rn(n,t,e,i){this._groups=n,this._parents=t,this._name=e,this._id=i}function Ju(){return++av}var zn=ur.prototype;Rn.prototype={constructor:Rn,select:Wb,selectAll:Hb,selectChild:zn.selectChild,selectChildren:zn.selectChildren,filter:Fb,merge:Db,selection:Gb,transition:ov,call:zn.call,nodes:zn.nodes,node:zn.node,size:zn.size,empty:zn.empty,each:zn.each,on:Bb,attr:xb,attrTween:Mb,style:qb,styleTween:Jb,text:ev,textTween:rv,remove:Nb,tween:ub,delay:_b,duration:Eb,ease:$b,easeVarying:Ib,end:sv,[Symbol.iterator]:zn[Symbol.iterator]};const Mr=n=>+n;function Qu(n){return--n*n*n+1}function cv(n){return((n*=2)<=1?n*n*n:(n-=2)*n*n+2)/2}var lv={time:null,delay:0,duration:250,ease:cv};function hv(n,t){for(var e;!(e=n.__transition)||!(e=e[t]);)if(!(n=n.parentNode))throw new Error(`transition ${t} not found`);return e}function uv(n){var t,e;n instanceof Rn?(t=n._id,n=n._name):(t=Ju(),(e=lv).time=Va(),n=n==null?null:n+"");for(var i=this._groups,r=i.length,o=0;o<r;++o)for(var s=i[o],a=s.length,l,c=0;c<a;++c)(l=s[c])&&Zo(l,n,t,c,s,e||hv(l,t));return new Rn(i,this._parents,n,t)}ur.prototype.interrupt=cb,ur.prototype.transition=uv;let qa=!0;function fv(n){qa=n}function Za(){return qa}const dv=Object.entries({"%A":"%A","%a":"%a","%d":"%d","%e":"%-d","%b":"%b","%B":"%B","%m":"%m","%y":"%y","%Y":"%Y","%H":"%H","%I":"%I","%k":"%-H","%l":"%-I","%M":"%M","%p":"%p","%P":"%p","%S":"%S","%L":"%L"}).map(([n,t])=>[new RegExp(n.replace("%","\\%"),"g"),t]),tf=new Map;function Ka(n,t){let e=tf.get(n);if(!e){e=n;for(const[r,o]of dv)e=e.replace(r,o);tf.set(n,e)}return(qa?Bo(e):zo(e))(new Date(t))}function Ko(n,t=-1,e=".",i=","){if(!Number.isFinite(n))return"0";if(t===-1){const l=n.toString(),c=l.indexOf(".");t=c===-1?0:l.length-c-1}const r=n.toFixed(t),[o,s]=r.split("."),a=o.replace(/\B(?=(\d{3})+(?!\d))/g,i);return s?`${a}${e}${s}`:a}const pv=[[1e12,"T"],[1e9,"G"],[1e6,"M"],[1e3,"k"]];function Ja(n){const t=Math.abs(n);if(t<1e3)return t===Math.floor(t)?Ko(n,0,".",","):n.toPrecision(4).replace(/\.?0+$/,"");for(const[e,i]of pv)if(t>=e){const r=n/e;return(r===Math.floor(r)?String(r):r.toPrecision(4).replace(/\.?0+$/,""))+i}return String(n)}const gv=/\{([^}]+)\}/g;function Kt(n,t,e=!1){return n.replace(gv,(i,r)=>{const o=r.indexOf(":");let s=r,a=null;o!==-1&&(s=r.slice(0,o),a=r.slice(o+1));const l=s.trim().split(".");let c=t;for(const f of l){if(c==null)return"";c=c[f]}if(c==null)return"";let h;if(a){const f=typeof c=="number"?c:parseFloat(String(c));if(isNaN(f))h=String(c);else try{h=dr(a)(f)}catch{h=String(c)}}else h=String(c);return e?qn(h):h})}const mv=/[&<>"']/g,yv={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function qn(n){return String(n).replace(mv,t=>yv[t])}const xv=/^[=+\-@\t\r]/,bv=/^-?\d+(?:[.,]\d+)?$/;function Jo(n,t=","){let e=n==null?"":String(n);return xv.test(e)&&!bv.test(e)&&(e="'"+e),(e.includes(t)||e.includes('"')||e.includes(`
1
+ (function(St,$e){typeof exports=="object"&&typeof module<"u"?$e(exports):typeof define=="function"&&define.amd?define(["exports"],$e):(St=typeof globalThis<"u"?globalThis:St||self,$e(St.KatuCharts={}))})(this,function(St){"use strict";var XA=Object.defineProperty;var UA=(St,$e,ri)=>$e in St?XA(St,$e,{enumerable:!0,configurable:!0,writable:!0,value:ri}):St[$e]=ri;var xt=(St,$e,ri)=>UA(St,typeof $e!="symbol"?$e+"":$e,ri);function $e(n,t,e){n.prototype=t.prototype=e,e.constructor=n}function ri(n,t){var e=Object.create(n.prototype);for(var i in t)e[i]=t[i];return e}function rr(){}var or=.7,no=1/or,Pi="\\s*([+-]?\\d+)\\s*",sr="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",xn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Up=/^#([0-9a-f]{3,8})$/,jp=new RegExp(`^rgb\\(${Pi},${Pi},${Pi}\\)$`),qp=new RegExp(`^rgb\\(${xn},${xn},${xn}\\)$`),Zp=new RegExp(`^rgba\\(${Pi},${Pi},${Pi},${sr}\\)$`),Kp=new RegExp(`^rgba\\(${xn},${xn},${xn},${sr}\\)$`),Jp=new RegExp(`^hsl\\(${sr},${xn},${xn}\\)$`),Qp=new RegExp(`^hsla\\(${sr},${xn},${xn},${sr}\\)$`),wl={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};$e(rr,se,{copy(n){return Object.assign(new this.constructor,this,n)},displayable(){return this.rgb().displayable()},hex:kl,formatHex:kl,formatHex8:tg,formatHsl:eg,formatRgb:Ml,toString:Ml});function kl(){return this.rgb().formatHex()}function tg(){return this.rgb().formatHex8()}function eg(){return Pl(this).formatHsl()}function Ml(){return this.rgb().formatRgb()}function se(n){var t,e;return n=(n+"").trim().toLowerCase(),(t=Up.exec(n))?(e=t[1].length,t=parseInt(t[1],16),e===6?Al(t):e===3?new Ne(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):e===8?io(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):e===4?io(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=jp.exec(n))?new Ne(t[1],t[2],t[3],1):(t=qp.exec(n))?new Ne(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Zp.exec(n))?io(t[1],t[2],t[3],t[4]):(t=Kp.exec(n))?io(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Jp.exec(n))?Cl(t[1],t[2]/100,t[3]/100,1):(t=Qp.exec(n))?Cl(t[1],t[2]/100,t[3]/100,t[4]):wl.hasOwnProperty(n)?Al(wl[n]):n==="transparent"?new Ne(NaN,NaN,NaN,0):null}function Al(n){return new Ne(n>>16&255,n>>8&255,n&255,1)}function io(n,t,e,i){return i<=0&&(n=t=e=NaN),new Ne(n,t,e,i)}function ng(n){return n instanceof rr||(n=se(n)),n?(n=n.rgb(),new Ne(n.r,n.g,n.b,n.opacity)):new Ne}function Ye(n,t,e,i){return arguments.length===1?ng(n):new Ne(n,t,e,i??1)}function Ne(n,t,e,i){this.r=+n,this.g=+t,this.b=+e,this.opacity=+i}$e(Ne,Ye,ri(rr,{brighter(n){return n=n==null?no:Math.pow(no,n),new Ne(this.r*n,this.g*n,this.b*n,this.opacity)},darker(n){return n=n==null?or:Math.pow(or,n),new Ne(this.r*n,this.g*n,this.b*n,this.opacity)},rgb(){return this},clamp(){return new Ne(oi(this.r),oi(this.g),oi(this.b),ro(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Sl,formatHex:Sl,formatHex8:ig,formatRgb:_l,toString:_l}));function Sl(){return`#${si(this.r)}${si(this.g)}${si(this.b)}`}function ig(){return`#${si(this.r)}${si(this.g)}${si(this.b)}${si((isNaN(this.opacity)?1:this.opacity)*255)}`}function _l(){const n=ro(this.opacity);return`${n===1?"rgb(":"rgba("}${oi(this.r)}, ${oi(this.g)}, ${oi(this.b)}${n===1?")":`, ${n})`}`}function ro(n){return isNaN(n)?1:Math.max(0,Math.min(1,n))}function oi(n){return Math.max(0,Math.min(255,Math.round(n)||0))}function si(n){return n=oi(n),(n<16?"0":"")+n.toString(16)}function Cl(n,t,e,i){return i<=0?n=t=e=NaN:e<=0||e>=1?n=t=NaN:t<=0&&(n=NaN),new dn(n,t,e,i)}function Pl(n){if(n instanceof dn)return new dn(n.h,n.s,n.l,n.opacity);if(n instanceof rr||(n=se(n)),!n)return new dn;if(n instanceof dn)return n;n=n.rgb();var t=n.r/255,e=n.g/255,i=n.b/255,r=Math.min(t,e,i),o=Math.max(t,e,i),s=NaN,a=o-r,l=(o+r)/2;return a?(t===o?s=(e-i)/a+(e<i)*6:e===o?s=(i-t)/a+2:s=(t-e)/a+4,a/=l<.5?o+r:2-o-r,s*=60):a=l>0&&l<1?0:s,new dn(s,a,l,n.opacity)}function ai(n,t,e,i){return arguments.length===1?Pl(n):new dn(n,t,e,i??1)}function dn(n,t,e,i){this.h=+n,this.s=+t,this.l=+e,this.opacity=+i}$e(dn,ai,ri(rr,{brighter(n){return n=n==null?no:Math.pow(no,n),new dn(this.h,this.s,this.l*n,this.opacity)},darker(n){return n=n==null?or:Math.pow(or,n),new dn(this.h,this.s,this.l*n,this.opacity)},rgb(){var n=this.h%360+(this.h<0)*360,t=isNaN(n)||isNaN(this.s)?0:this.s,e=this.l,i=e+(e<.5?e:1-e)*t,r=2*e-i;return new Ne(Bs(n>=240?n-240:n+120,r,i),Bs(n,r,i),Bs(n<120?n+240:n-120,r,i),this.opacity)},clamp(){return new dn(El(this.h),oo(this.s),oo(this.l),ro(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const n=ro(this.opacity);return`${n===1?"hsl(":"hsla("}${El(this.h)}, ${oo(this.s)*100}%, ${oo(this.l)*100}%${n===1?")":`, ${n})`}`}}));function El(n){return n=(n||0)%360,n<0?n+360:n}function oo(n){return Math.max(0,Math.min(1,n||0))}function Bs(n,t,e){return(n<60?t+(e-t)*n/60:n<180?e:n<240?t+(e-t)*(240-n)/60:t)*255}const so=new Map,rg=256;function Os(n){const t=n||"rgba(0,0,0,0)",e=so.get(t);if(e)return e;const i="rgba(0,0,0,0)",r=se(n||i),o=Ye(r||i),s={r:Math.round(o.r),g:Math.round(o.g),b:Math.round(o.b),a:o.opacity,get(a){return a==="rgba"?this.toString():this.toString()},brighten(a){const l=ai(Ye(this.r,this.g,this.b,this.a));l.l+=a*.1,l.l=Math.max(0,Math.min(1,l.l));const c=Ye(l);return Os(c.formatRgb())},setOpacity(a){return Os(`rgba(${this.r},${this.g},${this.b},${a})`)},toString(){return this.a<1?`rgba(${this.r},${this.g},${this.b},${this.a})`:Ye(this.r,this.g,this.b).formatHex()}};return so.size>=rg&&so.clear(),so.set(t,s),s}const ao={default:["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],tableau10:["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],d3classic:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],brewer:["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f","#e5c494","#b3b3b3"],google:["#3366cc","#dc3912","#ff9900","#109618","#990099","#0099c6","#dd4477","#66aa00","#b82e2e","#316395"],ocean:["#003f5c","#2f4b7c","#665191","#a05195","#d45087","#f95d6a","#ff7c43","#ffa600","#58508d","#bc5090"],sunset:["#f94144","#f3722c","#f8961e","#f9844a","#f9c74f","#90be6d","#43aa8b","#4d908e","#577590","#277da1"],earth:["#8c510a","#bf812d","#dfc27d","#c7eae5","#80cdc1","#35978f","#01665e","#543005","#003c30","#f6e8c3"],forest:["#2d6a4f","#40916c","#52b788","#74c69d","#95d5b2","#1b4332","#081c15","#b7e4c7","#d8f3dc","#344e41"],berry:["#7b2cbf","#9d4edd","#c77dff","#e0aaff","#5a189a","#3c096c","#240046","#10002b","#e2afff","#deaaff"],corporate:["#2c3e50","#e74c3c","#3498db","#2ecc71","#f39c12","#9b59b6","#1abc9c","#e67e22","#34495e","#16a085"],minimal:["#264653","#2a9d8f","#e9c46a","#f4a261","#e76f51","#606c38","#283618","#dda15e","#bc6c25","#fefae0"],nordic:["#5e81ac","#81a1c1","#88c0d0","#8fbcbb","#bf616a","#d08770","#ebcb8b","#a3be8c","#b48ead","#4c566a"],darkMode:["#2ecc71","#3498db","#e74c3c","#f1c40f","#9b59b6","#1abc9c","#e67e22","#ecf0f1","#e91e63","#00bcd4"],neon:["#ff006e","#fb5607","#ffbe0b","#8338ec","#3a86ff","#06d6a0","#118ab2","#ef476f","#ffd166","#073b4c"],pastel:["#a8e6cf","#dcedc1","#ffd3b6","#ffaaa5","#ff8b94","#b5ead7","#c7ceea","#e2f0cb","#fceaea","#d4a5a5"],soft:["#6c9bd2","#e6a756","#d46a6a","#7cc5a8","#b28fce","#e8937f","#6bb8a0","#d4b56a","#8e9cc2","#c2847a"],classic:["#7cb5ec","#434348","#90ed7d","#f7a35c","#8085e9","#f15c80","#e4d354","#2b908f","#f45b5b","#91e8e1"],tupi:["#b43417","#1b1a15","#a85429","#ce9a3a","#33503a","#8c2810","#6b6a45","#d97b3f","#5b5240","#7a3b2e"],monochrome:["#1f2933","#3e4c59","#52606d","#7b8794","#9aa5b1","#616e7c","#cbd2d9","#323f4b","#7b8794","#b8c0c9"]};function Tl(n){return ao[n]||ao.default}const og=ao.default,sg={textStrong:"#1f2933",textSoft:"#52606d",axis:"#6b7280",line:"#c8ccd2",grid:"#e6e8eb",tooltipBg:"rgba(255,255,255,0.96)",tooltipBorder:"#d8dce0",legend:"#52606d"},ag={textStrong:"#f3f4f6",textSoft:"#b8bfc7",axis:"#9aa3ad",line:"#3a414a",grid:"rgba(255,255,255,0.08)",tooltipBg:"#20262e",tooltipBorder:"#39414b",legend:"#c2c9d1"};function $l(n,t,e){const i={gridLineColor:e.grid,lineColor:e.line,tickColor:e.line,labels:{style:{color:e.axis}},title:{style:{color:e.axis}}};return{colors:n,chart:{backgroundColor:t},title:{style:{color:e.textStrong}},subtitle:{style:{color:e.textSoft}},xAxis:i,yAxis:i,tooltip:{backgroundColor:e.tooltipBg,borderColor:e.tooltipBorder,style:{color:e.textStrong}},legend:{itemStyle:{color:e.legend},itemHoverStyle:{color:e.textStrong}}}}const Ns={tupi:{light:["#b43417","#1b1a15","#a85429","#ce9a3a","#33503a","#8c2810","#6b6a45","#d97b3f","#5b5240","#7a3b2e"],dark:["#e0673f","#e7dbc0","#d08a4e","#e8c45f","#6fa37a","#c84c2c","#c9b27a","#f0a06a","#a9a07e","#d98b6a"]},ocean:{light:["#0466c8","#0353a4","#3a86ff","#00b4d8","#0096c7","#48cae4","#023e8a","#5e60ce","#0077b6","#90e0ef"],dark:["#48cae4","#4895ef","#56cfe1","#64dfdf","#80ffdb","#5390d9","#7400b8","#4cc9f0","#56cfe1","#72efdd"]},sunset:{light:["#ff6b35","#f7522f","#ff9e00","#ffbf69","#e85d75","#d1495b","#ffd166","#9e2a2b","#f3722c","#bc4749"],dark:["#ff7b54","#ffb26b","#ffd56b","#ff9e7d","#ff6b6b","#feca57","#ff9ff3","#f368e0","#ffa07a","#ffd56b"]},forest:{light:["#2d6a4f","#40916c","#52b788","#74c69d","#1b4332","#95d5b2","#b7e4c7","#344e41","#588157","#a3b18a"],dark:["#74c69d","#52b788","#95d5b2","#40916c","#b7e4c7","#2d6a4f","#d8f3dc","#588157","#a3b18a","#80ed99"]},corporate:{light:["#2c3e50","#3498db","#16a085","#f39c12","#8e44ad","#e74c3c","#34495e","#27ae60","#2980b9","#d35400"],dark:["#5dade2","#48c9b0","#f5b041","#bb8fce","#ec7063","#58d68d","#85c1e9","#76d7c4","#f8c471","#aed6f1"]},vivid:{light:["#ff006e","#fb5607","#ffbe0b","#8338ec","#3a86ff","#06d6a0","#ef476f","#118ab2","#ff70a6","#9b5de5"],dark:["#ff5d8f","#ff7b00","#ffd60a","#9d4edd","#4cc9f0","#06d6a0","#ff70a6","#48cae4","#fb5607","#b5179e"]},monochrome:{light:["#1f2933","#3e4c59","#52606d","#7b8794","#9aa5b1","#616e7c","#cbd2d9","#323f4b","#46545f","#a7b0b8"],dark:["#e4e7eb","#cbd2d9","#9aa5b1","#7b8794","#616e7c","#b8c0c9","#52606d","#d3d9de","#8a949e","#3e4c59"]},nordic:{light:["#5e81ac","#81a1c1","#88c0d0","#8fbcbb","#bf616a","#d08770","#ebcb8b","#a3be8c","#b48ead","#4c566a"],dark:["#88c0d0","#81a1c1","#8fbcbb","#a3be8c","#ebcb8b","#d08770","#bf616a","#b48ead","#5e81ac","#d8dee9"]},pastel:{light:["#a8e6cf","#ffd3b6","#ffaaa5","#c7ceea","#b5ead7","#ff8b94","#dcedc1","#e2afff","#ffdac1","#b5c7ed"],dark:["#a8e6cf","#ffd3b6","#ffaaa5","#c7ceea","#b5ead7","#ff8b94","#dcedc1","#e2afff","#ffdac1","#b5c7ed"]}},Ll={tupi:{light:"#ecdfc4",dark:"#1c1814"},ocean:{light:"#ffffff",dark:"#0b1622"},sunset:{light:"#ffffff",dark:"#1f1410"},forest:{light:"#ffffff",dark:"#0f1f17"},corporate:{light:"#ffffff",dark:"#1a1f26"},vivid:{light:"#ffffff",dark:"#14101c"},monochrome:{light:"#ffffff",dark:"#1a1f24"},nordic:{light:"#eceff4",dark:"#2e3440"},pastel:{light:"#ffffff",dark:"#232026"}},co=(()=>{const n={};for(const t of Object.keys(Ns))n[t]=$l(Ns[t].light,Ll[t].light,sg),n[`${t}-dark`]=$l(Ns[t].dark,Ll[t].dark,ag);return n.light=n.monochrome,n.dark=n["monochrome-dark"],n})(),cg=Object.keys(co);function Il(n){return co[n]}const wt="12px",xe="#000000",Fl="#1a1a1a",lg="#ffffff",hg=3;function Ws(n){const t=n/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4}function Dl(n,t,e){return .2126*Ws(n)+.7152*Ws(t)+.0722*Ws(e)}function Rl(n,t){return(Math.max(n,t)+.05)/(Math.min(n,t)+.05)}const ug=Dl(26,26,26);function Pn(n,t){var s;if(t)return t;const e=n?(s=se(n))==null?void 0:s.rgb():null;if(!e||isNaN(e.r)||e.opacity===0)return xe;const i=Dl(e.r,e.g,e.b),r=Rl(i,ug);return r>=hg?Fl:Rl(i,1)>=r?lg:Fl}function zl(){if(typeof document>"u")return 16;const n=parseFloat(getComputedStyle(document.documentElement).fontSize);return n>0?n:16}function be(n){if(!n)return 12;const t=n.trim();if(/^(clamp|min|max)\s*\(/i.test(t)){const r=t.slice(t.indexOf("(")+1,t.lastIndexOf(")")).match(/-?\d*\.?\d+\s*(px|rem|em)/gi)||[];let o=0;for(const s of r){const a=be(s.trim());a>o&&(o=a)}return o>0?o:12}if(t.endsWith("px"))return parseFloat(t)||12;if(t.endsWith("rem")||t.endsWith("em"))return(parseFloat(t)||1)*zl();const e=parseFloat(t);return isNaN(e)?12:e}let lo=null;function fg(){return lo||(typeof document>"u"?null:(lo=document.createElement("canvas").getContext("2d"),lo))}function Je(n,t,e="normal",i="sans-serif"){const r=fg();return r?(r.font=`${e} ${t}px ${i}`,r.measureText(n).width):n.length*t*.62}const Hs={chart:{type:"line",backgroundColor:"#ffffff",borderWidth:0,borderRadius:0,borderColor:"#335cad",spacing:[10,10,15,10],style:{fontFamily:'"Lucida Grande", "Lucida Sans Unicode", Verdana, Arial, Helvetica, sans-serif',fontSize:"12px"},animation:!0,zoomType:void 0,panning:!1,inverted:!1,polar:!1,reflow:!0},title:{text:void 0,align:"center",margin:15,style:{color:"#333333",fontSize:"18px",fontWeight:"bold"},widthAdjust:-44},subtitle:{text:void 0,align:"center",style:{color:"#666666",fontSize:"12px"},widthAdjust:-44},xAxis:{type:"linear",title:{text:null,style:{fontSize:wt}},labels:{enabled:!0,style:{fontSize:wt},autoRotation:[-45],autoRotationLimit:80,padding:5},tickLength:10,tickWidth:1,tickColor:"#999999",gridLineWidth:1,gridLineColor:"#e6e6e6",lineWidth:1,lineColor:"#999999",offset:0,opposite:!1,reversed:!1,visible:!0,startOnTick:!1,endOnTick:!1,showFirstLabel:!0,showLastLabel:!0,allowDecimals:!0,maxPadding:.01,minPadding:.01,crosshair:!1},yAxis:{type:"linear",title:{text:null,style:{fontSize:wt}},labels:{enabled:!0,style:{fontSize:wt},padding:5},tickLength:10,tickWidth:1,gridLineWidth:1,gridLineColor:"#e6e6e6",lineWidth:1,lineColor:"#999999",offset:0,opposite:!1,reversed:!1,visible:!0,startOnTick:!0,endOnTick:!0,showFirstLabel:!0,showLastLabel:!0,allowDecimals:!0,maxPadding:.05,minPadding:.05,crosshair:!1},colorAxis:void 0,series:[],tooltip:{enabled:!0,shared:!1,split:!1,useHTML:!1,followPointer:!1,headerFormat:'<span style="font-size: 10px">{point.key}</span><br/>',pointFormat:'<span style="color:{point.color}">●</span> {series.name}: <b>{point.y}</b><br/>',footerFormat:"",backgroundColor:"rgba(247,247,247,0.85)",borderColor:void 0,borderWidth:1,borderRadius:3,padding:8,shadow:!0,animation:!0,hideDelay:500,snap:10,outside:!1,style:{color:"#333333",fontSize:"12px"}},legend:{enabled:!0,layout:"horizontal",align:"center",verticalAlign:"bottom",floating:!1,x:0,y:0,margin:15,padding:8,itemMarginTop:0,itemMarginBottom:0,itemDistance:20,itemStyle:{cursor:"pointer",fontSize:wt,fontWeight:"normal"},itemHoverStyle:{color:"#000000"},itemHiddenStyle:{color:"#cccccc"},symbolWidth:12,symbolHeight:12,symbolRadius:2,symbolPadding:5,squareSymbol:!0,borderWidth:0,borderRadius:0,borderColor:"#999999",reversed:!1},plotOptions:{series:{lineWidth:2,marker:{enabled:null,radius:4,symbol:"circle",lineWidth:0,states:{hover:{enabled:!0,radius:6,lineWidth:1}}},states:{hover:{enabled:!0,lineWidthPlus:1},inactive:{opacity:.2}},animation:{duration:1e3},enableMouseTracking:!0,stickyTracking:!0,allowPointSelect:!1,turboThreshold:1e3,dataLabels:{enabled:!1},showInLegend:!0,threshold:0,connectNulls:!1,clip:!0},bubble:{lineWidth:1},scatter:{marker:{symbol:null}},pie:{tooltip:{pointFormat:'<span style="color:{point.color}">●</span> {series.name}: <b>{point.percentage:.1f}%</b><br/>'},dataLabels:{enabled:!0},showInLegend:!1},candlestick:{tooltip:{pointFormat:'<span style="color:{point.color}">●</span> <b>{series.name}</b><br/>Open: <b>{point.open}</b><br/>High: <b>{point.high}</b><br/>Low: <b>{point.low}</b><br/>Close: <b>{point.close}</b><br/>'}},ohlc:{tooltip:{pointFormat:'<span style="color:{point.color}">●</span> <b>{series.name}</b><br/>Open: <b>{point.open}</b><br/>High: <b>{point.high}</b><br/>Low: <b>{point.low}</b><br/>Close: <b>{point.close}</b><br/>'}},heikinashi:{tooltip:{pointFormat:'<span style="color:{point.color}">●</span> <b>{series.name}</b><br/>Open: <b>{point.open}</b><br/>High: <b>{point.high}</b><br/>Low: <b>{point.low}</b><br/>Close: <b>{point.close}</b><br/>'}},hollowcandlestick:{tooltip:{pointFormat:'<span style="color:{point.color}">●</span> <b>{series.name}</b><br/>Open: <b>{point.open}</b><br/>High: <b>{point.high}</b><br/>Low: <b>{point.low}</b><br/>Close: <b>{point.close}</b><br/>'}},arearange:{tooltip:{pointFormat:'<span style="color:{point.color}">●</span> {series.name}: <b>{point.low}</b> - <b>{point.high}</b><br/>'}},donut:{showInLegend:!1},sankey:{dataLabels:{enabled:!0},showInLegend:!1},dependencywheel:{dataLabels:{enabled:!0},showInLegend:!1},networkgraph:{dataLabels:{enabled:!0}},treemap:{dataLabels:{enabled:!0}},gauge:{dataLabels:{enabled:!0}},solidgauge:{dataLabels:{enabled:!0}},timeline:{dataLabels:{enabled:!0}},gantt:{dataLabels:{enabled:!0}},barchartrace:{dataLabels:{enabled:!0}},venn:{dataLabels:{enabled:!0}}},credits:{enabled:!0,text:"Powered by: KatuCharts",href:"https://charts.katudv.com",position:{align:"right",verticalAlign:"bottom",x:-10,y:-5},style:{cursor:"pointer",fontSize:"9px"}},exporting:{enabled:!0,filename:"chart",type:"image/png",scale:2,printMaxWidth:780,buttons:{contextButton:{enabled:!0,symbol:"gear",symbolFill:"#666666",symbolStroke:"#666666",symbolStrokeWidth:3,x:-10,y:10,menuItems:["downloadPNG","downloadJPEG","downloadSVG","downloadPDF","separator","viewFullScreen","printChart"]}}},loading:{hideDuration:100,showDuration:100,labelStyle:{fontWeight:"bold",position:"relative",top:"45%"},style:{position:"absolute",backgroundColor:"#ffffff",opacity:.5,textAlign:"center"}},navigator:{enabled:!1},rangeSelector:{enabled:!1},drilldown:{animation:!0,series:[]},responsive:{rules:[{condition:{maxWidth:500},chartOptions:{chart:{spacing:[5,5,10,5]},title:{style:{fontSize:"14px"},margin:8},subtitle:{style:{fontSize:"10px"}},legend:{itemStyle:{fontSize:"10px"},itemDistance:10,margin:8,symbolWidth:12,symbolHeight:8},yAxis:{title:{text:null},labels:{style:{fontSize:"9px"}}},xAxis:{labels:{style:{fontSize:"9px"},autoRotation:[-45,-90]}},plotOptions:{pie:{size:"65%",dataLabels:{distance:10,style:{fontSize:"9px"},connectorPadding:3}}}}},{condition:{maxWidth:260},chartOptions:{subtitle:{text:null},legend:{enabled:!1},credits:{enabled:!1},plotOptions:{pie:{size:"55%",dataLabels:{distance:5,style:{fontSize:"8px"},connectorWidth:0}}}}}]},accessibility:{enabled:!0},colors:og},Ei=new Set(["pie","donut","sunburst","treemap","treegraph","wordcloud","sankey","dependencywheel","networkgraph","gauge","solidgauge","polar","radar","funnel","pyramid","timeline","map","mappoint","flowmap","barchartrace","venn","clusteredheatmap","phylotree","circos","circosHeatmap","circosComparative","circosSpiral"]),dg=new Set(["pie","donut","funnel","pyramid","sankey","dependencywheel","networkgraph","treemap","sunburst","gauge","solidgauge","timeline","gantt","map","mappoint","flowmap","heatmap","polar","radar","barchartrace","venn","clusteredheatmap","phylotree","circos"]),pg=new Set(["line","spline","column","bar","scatter","bubble","area","areaspline","boxplot","waterfall","volume"]),gg=new Set(["pie","venn","forestplot","pcoa"]),mg=new Set(["scatter","bubble"]),yg=new Set(["column","bar","area","areaspline","waterfall"]);function Bl(n){return n.length>0&&n.every(t=>Ei.has(t._internalType))}const Ol=20;function Nl(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)&&Object.getPrototypeOf(n)===Object.prototype}function he(n,...t){return Wl(n,t,0)}function Wl(n,t,e){if(e>Ol)return n;const i={...n};for(const r of t)if(r)for(const o of Object.keys(r)){if(o==="__proto__"||o==="constructor"||o==="prototype")continue;const s=r[o],a=i[o];s!==void 0&&(s===null?i[o]=null:Nl(s)&&Nl(a)?i[o]=Wl(a,[s],e+1):Array.isArray(s)?i[o]=[...s]:i[o]=s)}return i}function ho(n){return Vs(n,new WeakSet,0)}function Vs(n,t,e){if(n===null||typeof n!="object"||e>Ol||t.has(n))return n;if(t.add(n),Array.isArray(n))return n.map(r=>Vs(r,t,e+1));if(n instanceof Date)return new Date(n.getTime());const i={};for(const r of Object.keys(n))i[r]=Vs(n[r],t,e+1);return i}function Hl(n){return n instanceof Uint8Array||ArrayBuffer.isView(n)&&n.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in n&&n.BYTES_PER_ELEMENT===1}function Gs(n,t=""){if(typeof n!="number"){const e=t&&`"${t}" `;throw new TypeError(`${e}expected number, got ${typeof n}`)}if(!Number.isSafeInteger(n)||n<0){const e=t&&`"${t}" `;throw new RangeError(`${e}expected integer >= 0, got ${n}`)}}function ci(n,t,e=""){const i=Hl(n),r=n==null?void 0:n.length,o=t!==void 0;if(!i||o&&r!==t){const s=e&&`"${e}" `,a=o?` of length ${t}`:"",l=i?`length=${r}`:`type=${typeof n}`,c=s+"expected Uint8Array"+a+", got "+l;throw i?new RangeError(c):new TypeError(c)}return n}function Vl(n,t=!0){if(n.destroyed)throw new Error("Hash instance has been destroyed");if(t&&n.finished)throw new Error("Hash#digest() has already been called")}function xg(n,t){ci(n,void 0,"digestInto() output");const e=t.outputLen;if(n.length<e)throw new RangeError('"digestInto() output" expected to be of length >='+e)}function Ys(...n){for(let t=0;t<n.length;t++)n[t].fill(0)}function Xs(n){return new DataView(n.buffer,n.byteOffset,n.byteLength)}const Gl=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",bg=Array.from({length:256},(n,t)=>t.toString(16).padStart(2,"0"));function Us(n){if(ci(n),Gl)return n.toHex();let t="";for(let e=0;e<n.length;e++)t+=bg[n[e]];return t}const En={_0:48,_9:57,A:65,F:70,a:97,f:102};function Yl(n){if(n>=En._0&&n<=En._9)return n-En._0;if(n>=En.A&&n<=En.F)return n-(En.A-10);if(n>=En.a&&n<=En.f)return n-(En.a-10)}function js(n){if(typeof n!="string")throw new TypeError("hex string expected, got "+typeof n);if(Gl)try{return Uint8Array.fromHex(n)}catch(r){throw r instanceof SyntaxError?new RangeError(r.message):r}const t=n.length,e=t/2;if(t%2)throw new RangeError("hex string expected, got unpadded hex of length "+t);const i=new Uint8Array(e);for(let r=0,o=0;r<e;r++,o+=2){const s=Yl(n.charCodeAt(o)),a=Yl(n.charCodeAt(o+1));if(s===void 0||a===void 0){const l=n[o]+n[o+1];throw new RangeError('hex string expected, got non-hex character "'+l+'" at index '+o)}i[r]=s*16+a}return i}function vg(...n){let t=0;for(let i=0;i<n.length;i++){const r=n[i];ci(r),t+=r.length}const e=new Uint8Array(t);for(let i=0,r=0;i<n.length;i++){const o=n[i];e.set(o,r),r+=o.length}return e}function wg(n,t={}){const e=(r,o)=>n(o).update(r).digest(),i=n(void 0);return e.outputLen=i.outputLen,e.blockLen=i.blockLen,e.canXOF=i.canXOF,e.create=r=>n(r),Object.assign(e,t),Object.freeze(e)}function kg(n=32){Gs(n,"bytesLength");const t=typeof globalThis=="object"?globalThis.crypto:null;if(typeof(t==null?void 0:t.getRandomValues)!="function")throw new Error("crypto.getRandomValues must be defined");if(n>65536)throw new RangeError(`"bytesLength" expected <= 65536, got ${n}`);return t.getRandomValues(new Uint8Array(n))}const Mg=n=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,n])});class Ag{constructor(t,e,i,r){xt(this,"blockLen");xt(this,"outputLen");xt(this,"canXOF",!1);xt(this,"padOffset");xt(this,"isLE");xt(this,"buffer");xt(this,"view");xt(this,"finished",!1);xt(this,"length",0);xt(this,"pos",0);xt(this,"destroyed",!1);this.blockLen=t,this.outputLen=e,this.padOffset=i,this.isLE=r,this.buffer=new Uint8Array(t),this.view=Xs(this.buffer)}update(t){Vl(this),ci(t);const{view:e,buffer:i,blockLen:r}=this,o=t.length;for(let s=0;s<o;){const a=Math.min(r-this.pos,o-s);if(a===r){const l=Xs(t);for(;r<=o-s;s+=r)this.process(l,s);continue}i.set(t.subarray(s,s+a),this.pos),this.pos+=a,s+=a,this.pos===r&&(this.process(e,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){Vl(this),xg(t,this),this.finished=!0;const{buffer:e,view:i,blockLen:r,isLE:o}=this;let{pos:s}=this;e[s++]=128,Ys(this.buffer.subarray(s)),this.padOffset>r-s&&(this.process(i,0),s=0);for(let f=s;f<r;f++)e[f]=0;i.setBigUint64(r-8,BigInt(this.length*8),o),this.process(i,0);const a=Xs(t),l=this.outputLen;if(l%4)throw new Error("_sha2: outputLen must be aligned to 32bit");const c=l/4,h=this.get();if(c>h.length)throw new Error("_sha2: outputLen bigger than state");for(let f=0;f<c;f++)a.setUint32(4*f,h[f],o)}digest(){const{buffer:t,outputLen:e}=this;this.digestInto(t);const i=t.slice(0,e);return this.destroy(),i}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:e,buffer:i,length:r,finished:o,destroyed:s,pos:a}=this;return t.destroyed=s,t.finished=o,t.length=r,t.pos=a,r%e&&t.buffer.set(i),t}clone(){return this._cloneInto()}}const ve=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]),uo=BigInt(2**32-1),Xl=BigInt(32);function Sg(n,t=!1){return t?{h:Number(n&uo),l:Number(n>>Xl&uo)}:{h:Number(n>>Xl&uo)|0,l:Number(n&uo)|0}}function _g(n,t=!1){const e=n.length;let i=new Uint32Array(e),r=new Uint32Array(e);for(let o=0;o<e;o++){const{h:s,l:a}=Sg(n[o],t);[i[o],r[o]]=[s,a]}return[i,r]}const Ul=(n,t,e)=>n>>>e,jl=(n,t,e)=>n<<32-e|t>>>e,Ti=(n,t,e)=>n>>>e|t<<32-e,$i=(n,t,e)=>n<<32-e|t>>>e,fo=(n,t,e)=>n<<64-e|t>>>e-32,po=(n,t,e)=>n>>>e-32|t<<64-e;function Tn(n,t,e,i){const r=(t>>>0)+(i>>>0);return{h:n+e+(r/2**32|0)|0,l:r|0}}const Cg=(n,t,e)=>(n>>>0)+(t>>>0)+(e>>>0),Pg=(n,t,e,i)=>t+e+i+(n/2**32|0)|0,Eg=(n,t,e,i)=>(n>>>0)+(t>>>0)+(e>>>0)+(i>>>0),Tg=(n,t,e,i,r)=>t+e+i+r+(n/2**32|0)|0,$g=(n,t,e,i,r)=>(n>>>0)+(t>>>0)+(e>>>0)+(i>>>0)+(r>>>0),Lg=(n,t,e,i,r,o)=>t+e+i+r+o+(n/2**32|0)|0,ql=_g(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(n=>BigInt(n))),Ig=ql[0],Fg=ql[1],Yn=new Uint32Array(80),Xn=new Uint32Array(80);class Dg extends Ag{constructor(t){super(128,t,16,!1)}get(){const{Ah:t,Al:e,Bh:i,Bl:r,Ch:o,Cl:s,Dh:a,Dl:l,Eh:c,El:h,Fh:f,Fl:u,Gh:d,Gl:p,Hh:y,Hl:g}=this;return[t,e,i,r,o,s,a,l,c,h,f,u,d,p,y,g]}set(t,e,i,r,o,s,a,l,c,h,f,u,d,p,y,g){this.Ah=t|0,this.Al=e|0,this.Bh=i|0,this.Bl=r|0,this.Ch=o|0,this.Cl=s|0,this.Dh=a|0,this.Dl=l|0,this.Eh=c|0,this.El=h|0,this.Fh=f|0,this.Fl=u|0,this.Gh=d|0,this.Gl=p|0,this.Hh=y|0,this.Hl=g|0}process(t,e){for(let v=0;v<16;v++,e+=4)Yn[v]=t.getUint32(e),Xn[v]=t.getUint32(e+=4);for(let v=16;v<80;v++){const b=Yn[v-15]|0,k=Xn[v-15]|0,M=Ti(b,k,1)^Ti(b,k,8)^Ul(b,k,7),C=$i(b,k,1)^$i(b,k,8)^jl(b,k,7),L=Yn[v-2]|0,_=Xn[v-2]|0,T=Ti(L,_,19)^fo(L,_,61)^Ul(L,_,6),I=$i(L,_,19)^po(L,_,61)^jl(L,_,6),E=Eg(C,I,Xn[v-7],Xn[v-16]),P=Tg(E,M,T,Yn[v-7],Yn[v-16]);Yn[v]=P|0,Xn[v]=E|0}let{Ah:i,Al:r,Bh:o,Bl:s,Ch:a,Cl:l,Dh:c,Dl:h,Eh:f,El:u,Fh:d,Fl:p,Gh:y,Gl:g,Hh:m,Hl:x}=this;for(let v=0;v<80;v++){const b=Ti(f,u,14)^Ti(f,u,18)^fo(f,u,41),k=$i(f,u,14)^$i(f,u,18)^po(f,u,41),M=f&d^~f&y,C=u&p^~u&g,L=$g(x,k,C,Fg[v],Xn[v]),_=Lg(L,m,b,M,Ig[v],Yn[v]),T=L|0,I=Ti(i,r,28)^fo(i,r,34)^fo(i,r,39),E=$i(i,r,28)^po(i,r,34)^po(i,r,39),P=i&o^i&a^o&a,S=r&s^r&l^s&l;m=y|0,x=g|0,y=d|0,g=p|0,d=f|0,p=u|0,{h:f,l:u}=Tn(c|0,h|0,_|0,T|0),c=a|0,h=l|0,a=o|0,l=s|0,o=i|0,s=r|0;const w=Cg(T,E,S);i=Pg(w,_,I,P),r=w|0}({h:i,l:r}=Tn(this.Ah|0,this.Al|0,i|0,r|0)),{h:o,l:s}=Tn(this.Bh|0,this.Bl|0,o|0,s|0),{h:a,l}=Tn(this.Ch|0,this.Cl|0,a|0,l|0),{h:c,l:h}=Tn(this.Dh|0,this.Dl|0,c|0,h|0),{h:f,l:u}=Tn(this.Eh|0,this.El|0,f|0,u|0),{h:d,l:p}=Tn(this.Fh|0,this.Fl|0,d|0,p|0),{h:y,l:g}=Tn(this.Gh|0,this.Gl|0,y|0,g|0),{h:m,l:x}=Tn(this.Hh|0,this.Hl|0,m|0,x|0),this.set(i,r,o,s,a,l,c,h,f,u,d,p,y,g,m,x)}roundClean(){Ys(Yn,Xn)}destroy(){this.destroyed=!0,Ys(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}class Rg extends Dg{constructor(){super(64);xt(this,"Ah",ve[0]|0);xt(this,"Al",ve[1]|0);xt(this,"Bh",ve[2]|0);xt(this,"Bl",ve[3]|0);xt(this,"Ch",ve[4]|0);xt(this,"Cl",ve[5]|0);xt(this,"Dh",ve[6]|0);xt(this,"Dl",ve[7]|0);xt(this,"Eh",ve[8]|0);xt(this,"El",ve[9]|0);xt(this,"Fh",ve[10]|0);xt(this,"Fl",ve[11]|0);xt(this,"Gh",ve[12]|0);xt(this,"Gl",ve[13]|0);xt(this,"Hh",ve[14]|0);xt(this,"Hl",ve[15]|0)}}const zg=wg(()=>new Rg,Mg(3));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Le=(n,t,e)=>ci(n,t,e),Zl=Gs,Kl=Us,Jl=(...n)=>vg(...n),Bg=n=>js(n),Og=Hl,Ng=n=>kg(n),go=BigInt(0),qs=BigInt(1);function mo(n,t=""){if(typeof n!="boolean"){const e=t&&`"${t}" `;throw new TypeError(e+"expected boolean, got type="+typeof n)}return n}function Wg(n){if(typeof n=="bigint"){if(!yo(n))throw new RangeError("positive bigint expected, got "+n)}else Zl(n);return n}function Zs(n,t=""){if(typeof n!="number"){const e=t&&`"${t}" `;throw new TypeError(e+"expected number, got type="+typeof n)}if(!Number.isSafeInteger(n)){const e=t&&`"${t}" `;throw new RangeError(e+"expected safe integer, got "+n)}}function Ql(n){if(typeof n!="string")throw new TypeError("hex string expected, got "+typeof n);return n===""?go:BigInt("0x"+n)}function Hg(n){return Ql(Us(n))}function ar(n){return Ql(Us(Ks(ci(n)).reverse()))}function th(n,t){if(Gs(t),t===0)throw new RangeError("zero length");n=Wg(n);const e=n.toString(16);if(e.length>t*2)throw new RangeError("number too large");return js(e.padStart(t*2,"0"))}function Vg(n,t){return th(n,t).reverse()}function Gg(n,t){if(n=Le(n),t=Le(t),n.length!==t.length)return!1;let e=0;for(let i=0;i<n.length;i++)e|=n[i]^t[i];return e===0}function Ks(n){return Uint8Array.from(Le(n))}const yo=n=>typeof n=="bigint"&&go<=n;function Yg(n,t,e){return yo(n)&&yo(t)&&yo(e)&&t<=n&&n<e}function eh(n,t,e,i){if(!Yg(t,e,i))throw new RangeError("expected valid "+n+": "+e+" <= n < "+i+", got "+t)}function Xg(n){if(n<go)throw new Error("expected non-negative bigint, got "+n);let t;for(t=0;n>go;n>>=qs,t+=1);return t}const Ug=n=>(qs<<BigInt(n))-qs;function Js(n,t={},e={}){if(Object.prototype.toString.call(n)!=="[object Object]")throw new TypeError("expected valid options object");function i(o,s,a){if(!a&&s!=="function"&&!Object.hasOwn(n,o))throw new TypeError(`param "${o}" is invalid: expected own property`);const l=n[o];if(a&&l===void 0)return;const c=typeof l;if(c!==s||l===null)throw new TypeError(`param "${o}" is invalid: expected ${s}, got ${c}`)}const r=(o,s)=>Object.entries(o).forEach(([a,l])=>i(a,l,s));r(t,!1),r(e,!0)}const nh=()=>{throw new Error("not implemented")};/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const we=BigInt(0),me=BigInt(1),li=BigInt(2),ih=BigInt(3),rh=BigInt(4),oh=BigInt(5),jg=BigInt(7),sh=BigInt(8),qg=BigInt(9),ah=BigInt(16);function ae(n,t){if(t<=we)throw new Error("mod: expected positive modulus, got "+t);const e=n%t;return e>=we?e:t+e}function bn(n,t,e){if(t<we)throw new Error("pow2: expected non-negative exponent, got "+t);let i=n;for(;t-- >we;)i*=i,i%=e;return i}function ch(n,t){if(n===we)throw new Error("invert: expected non-zero number");if(t<=we)throw new Error("invert: expected positive modulus, got "+t);let e=ae(n,t),i=t,r=we,o=me;for(;e!==we;){const a=i/e,l=i-e*a,c=r-o*a;i=e,e=l,r=o,o=c}if(i!==me)throw new Error("invert: does not exist");return ae(r,t)}function Qs(n,t,e){const i=n;if(!i.eql(i.sqr(t),e))throw new Error("Cannot find square root")}function lh(n,t){const e=n,i=(e.ORDER+me)/rh,r=e.pow(t,i);return Qs(e,r,t),r}function Zg(n,t){const e=n,i=(e.ORDER-oh)/sh,r=e.mul(t,li),o=e.pow(r,i),s=e.mul(t,o),a=e.mul(e.mul(s,li),o),l=e.mul(s,e.sub(a,e.ONE));return Qs(e,l,t),l}function Kg(n){const t=ta(n),e=hh(n),i=e(t,t.neg(t.ONE)),r=e(t,i),o=e(t,t.neg(i)),s=(n+jg)/ah;return(a,l)=>{const c=a;let h=c.pow(l,s),f=c.mul(h,i);const u=c.mul(h,r),d=c.mul(h,o),p=c.eql(c.sqr(f),l),y=c.eql(c.sqr(u),l);h=c.cmov(h,f,p),f=c.cmov(d,u,y);const g=c.eql(c.sqr(f),l),m=c.cmov(h,f,g);return Qs(c,m,l),m}}function hh(n){if(n<ih)throw new Error("sqrt is not defined for small field");let t=n-me,e=0;for(;t%li===we;)t/=li,e++;let i=li;const r=ta(n);for(;fh(r,i)===1;)if(i++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(e===1)return lh;let o=r.pow(i,t);const s=(t+me)/li;return function(l,c){const h=l;if(h.is0(c))return c;if(fh(h,c)!==1)throw new Error("Cannot find square root");let f=e,u=h.mul(h.ONE,o),d=h.pow(c,t),p=h.pow(c,s);for(;!h.eql(d,h.ONE);){if(h.is0(d))return h.ZERO;let y=1,g=h.sqr(d);for(;!h.eql(g,h.ONE);)if(y++,g=h.sqr(g),y===f)throw new Error("Cannot find square root");const m=me<<BigInt(f-y-1),x=h.pow(u,m);f=y,u=h.sqr(x),d=h.mul(d,u),p=h.mul(p,x)}return p}}function Jg(n){return n%rh===ih?lh:n%sh===oh?Zg:n%ah===qg?Kg(n):hh(n)}const hi=(n,t)=>(ae(n,t)&me)===me,Qg=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function t0(n){const t={ORDER:"bigint",BYTES:"number",BITS:"number"},e=Qg.reduce((i,r)=>(i[r]="function",i),t);if(Js(n,e),Zs(n.BYTES,"BYTES"),Zs(n.BITS,"BITS"),n.BYTES<1||n.BITS<1)throw new Error("invalid field: expected BYTES/BITS > 0");if(n.ORDER<=me)throw new Error("invalid field: expected ORDER > 1, got "+n.ORDER);return n}function e0(n,t,e){const i=n;if(e<we)throw new Error("invalid exponent, negatives unsupported");if(e===we)return i.ONE;if(e===me)return t;let r=i.ONE,o=t;for(;e>we;)e&me&&(r=i.mul(r,o)),o=i.sqr(o),e>>=me;return r}function uh(n,t,e=!1){const i=n,r=new Array(t.length).fill(e?i.ZERO:void 0),o=t.reduce((a,l,c)=>i.is0(l)?a:(r[c]=a,i.mul(a,l)),i.ONE),s=i.inv(o);return t.reduceRight((a,l,c)=>i.is0(l)?a:(r[c]=i.mul(a,r[c]),i.mul(a,l)),s),r}function fh(n,t){const e=n,i=(e.ORDER-me)/li,r=e.pow(t,i),o=e.eql(r,e.ONE),s=e.eql(r,e.ZERO),a=e.eql(r,e.neg(e.ONE));if(!o&&!s&&!a)throw new Error("invalid Legendre symbol result");return o?1:s?0:-1}function n0(n,t){if(t!==void 0&&Zl(t),n<=we)throw new Error("invalid n length: expected positive n, got "+n);if(t!==void 0&&t<1)throw new Error("invalid n length: expected positive bit length, got "+t);const e=Xg(n);if(t!==void 0&&t<e)throw new Error(`invalid n length: expected bit length (${e}) >= n.length (${t})`);const i=t!==void 0?t:e,r=Math.ceil(i/8);return{nBitLength:i,nByteLength:r}}const dh=new WeakMap;class ph{constructor(t,e={}){xt(this,"ORDER");xt(this,"BITS");xt(this,"BYTES");xt(this,"isLE");xt(this,"ZERO",we);xt(this,"ONE",me);xt(this,"_lengths");xt(this,"_mod");if(t<=me)throw new Error("invalid field: expected ORDER > 1, got "+t);let i;this.isLE=!1,e!=null&&typeof e=="object"&&(typeof e.BITS=="number"&&(i=e.BITS),typeof e.sqrt=="function"&&Object.defineProperty(this,"sqrt",{value:e.sqrt,enumerable:!0}),typeof e.isLE=="boolean"&&(this.isLE=e.isLE),e.allowedLengths&&(this._lengths=Object.freeze(e.allowedLengths.slice())),typeof e.modFromBytes=="boolean"&&(this._mod=e.modFromBytes));const{nBitLength:r,nByteLength:o}=n0(t,i);if(o>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");this.ORDER=t,this.BITS=r,this.BYTES=o,Object.freeze(this)}create(t){return ae(t,this.ORDER)}isValid(t){if(typeof t!="bigint")throw new TypeError("invalid field element: expected bigint, got "+typeof t);return we<=t&&t<this.ORDER}is0(t){return t===we}isValidNot0(t){return!this.is0(t)&&this.isValid(t)}isOdd(t){return(t&me)===me}neg(t){return ae(-t,this.ORDER)}eql(t,e){return t===e}sqr(t){return ae(t*t,this.ORDER)}add(t,e){return ae(t+e,this.ORDER)}sub(t,e){return ae(t-e,this.ORDER)}mul(t,e){return ae(t*e,this.ORDER)}pow(t,e){return e0(this,t,e)}div(t,e){return ae(t*ch(e,this.ORDER),this.ORDER)}sqrN(t){return t*t}addN(t,e){return t+e}subN(t,e){return t-e}mulN(t,e){return t*e}inv(t){return ch(t,this.ORDER)}sqrt(t){let e=dh.get(this);return e||dh.set(this,e=Jg(this.ORDER)),e(this,t)}toBytes(t){return this.isLE?Vg(t,this.BYTES):th(t,this.BYTES)}fromBytes(t,e=!1){Le(t);const{_lengths:i,BYTES:r,isLE:o,ORDER:s,_mod:a}=this;if(i){if(t.length<1||!i.includes(t.length)||t.length>r)throw new Error("Field.fromBytes: expected "+i+" bytes, got "+t.length);const c=new Uint8Array(r);c.set(t,o?0:c.length-t.length),t=c}if(t.length!==r)throw new Error("Field.fromBytes: expected "+r+" bytes, got "+t.length);let l=o?ar(t):Hg(t);if(a&&(l=ae(l,s)),!e&&!this.isValid(l))throw new Error("invalid field element: outside of range 0..ORDER");return l}invertBatch(t){return uh(this,t)}cmov(t,e,i){return mo(i,"condition"),i?e:t}}Object.freeze(ph.prototype);function ta(n,t={}){return new ph(n,t)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const xo=BigInt(0),ea=BigInt(1);function gh(n,t){const e=t.negate();return n?e:t}function na(n,t){const e=uh(n.Fp,t.map(i=>i.Z));return t.map((i,r)=>n.fromAffine(i.toAffine(e[r])))}function mh(n,t){if(!Number.isSafeInteger(n)||n<=0||n>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+n)}function ia(n,t){mh(n,t);const e=Math.ceil(t/n)+1,i=2**(n-1),r=2**n,o=Ug(n),s=BigInt(n);return{windows:e,windowSize:i,mask:o,maxNumber:r,shiftBy:s}}function yh(n,t,e){const{windowSize:i,mask:r,maxNumber:o,shiftBy:s}=e;let a=Number(n&r),l=n>>s;a>i&&(a-=o,l+=ea);const c=t*i,h=c+Math.abs(a)-1,f=a===0,u=a<0,d=t%2!==0;return{nextN:l,offset:h,isZero:f,isNeg:u,isNegF:d,offsetF:c}}const ra=new WeakMap,xh=new WeakMap;function oa(n){return xh.get(n)||1}function bh(n){if(n!==xo)throw new Error("invalid wNAF")}class i0{constructor(t,e){xt(this,"BASE");xt(this,"ZERO");xt(this,"Fn");xt(this,"bits");this.BASE=t.BASE,this.ZERO=t.ZERO,this.Fn=t.Fn,this.bits=e}_unsafeLadder(t,e,i=this.ZERO){let r=t;for(;e>xo;)e&ea&&(i=i.add(r)),r=r.double(),e>>=ea;return i}precomputeWindow(t,e){const{windows:i,windowSize:r}=ia(e,this.bits),o=[];let s=t,a=s;for(let l=0;l<i;l++){a=s,o.push(a);for(let c=1;c<r;c++)a=a.add(s),o.push(a);s=a.double()}return o}wNAF(t,e,i){if(!this.Fn.isValid(i))throw new Error("invalid scalar");let r=this.ZERO,o=this.BASE;const s=ia(t,this.bits);for(let a=0;a<s.windows;a++){const{nextN:l,offset:c,isZero:h,isNeg:f,isNegF:u,offsetF:d}=yh(i,a,s);i=l,h?o=o.add(gh(u,e[d])):r=r.add(gh(f,e[c]))}return bh(i),{p:r,f:o}}wNAFUnsafe(t,e,i,r=this.ZERO){const o=ia(t,this.bits);for(let s=0;s<o.windows&&i!==xo;s++){const{nextN:a,offset:l,isZero:c,isNeg:h}=yh(i,s,o);if(i=a,!c){const f=e[l];r=r.add(h?f.negate():f)}}return bh(i),r}getPrecomputes(t,e,i){let r=ra.get(e);return r||(r=this.precomputeWindow(e,t),t!==1&&(typeof i=="function"&&(r=i(r)),ra.set(e,r))),r}cached(t,e,i){const r=oa(t);return this.wNAF(r,this.getPrecomputes(r,t,i),e)}unsafe(t,e,i,r){const o=oa(t);return o===1?this._unsafeLadder(t,e,r):this.wNAFUnsafe(o,this.getPrecomputes(o,t,i),e,r)}createCache(t,e){mh(e,this.bits),xh.set(t,e),ra.delete(t)}hasCache(t){return oa(t)!==1}}function vh(n,t,e){if(t){if(t.ORDER!==n)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return t0(t),t}else return ta(n,{isLE:e})}function r0(n,t,e={},i){if(i===void 0&&(i=n==="edwards"),!t||typeof t!="object")throw new Error(`expected valid ${n} CURVE object`);for(const l of["p","n","h"]){const c=t[l];if(!(typeof c=="bigint"&&c>xo))throw new Error(`CURVE.${l} must be positive bigint`)}const r=vh(t.p,e.Fp,i),o=vh(t.n,e.Fn,i),a=["Gx","Gy","a","d"];for(const l of a)if(!r.isValid(t[l]))throw new Error(`CURVE.${l} must be valid field element of CURVE.Fp`);return t=Object.freeze(Object.assign({},t)),{CURVE:t,Fp:r,Fn:o}}function o0(n,t){return function(i){const r=n(i);return{secretKey:r,publicKey:t(r)}}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Un=BigInt(0),ue=BigInt(1),sa=BigInt(2),s0=BigInt(8);function a0(n,t,e,i){const r=n.sqr(e),o=n.sqr(i),s=n.add(n.mul(t.a,r),o),a=n.add(n.ONE,n.mul(t.d,n.mul(r,o)));return n.eql(s,a)}function c0(n,t={}){const e=t,i=r0("edwards",n,e,e.FpFnLE),{Fp:r,Fn:o}=i;let s=i.CURVE;const{h:a}=s;Js(e,{},{uvRatio:"function"});const l=sa<<BigInt(o.BYTES*8)-ue,c=g=>r.create(g),h=e.uvRatio===void 0?(g,m)=>{try{return{isValid:!0,value:r.sqrt(r.div(g,m))}}catch{return{isValid:!1,value:Un}}}:e.uvRatio;if(!a0(r,s,s.Gx,s.Gy))throw new Error("bad curve params: generator point");function f(g,m,x=!1){const v=x?ue:Un;return eh("coordinate "+g,m,v,l),m}function u(g){if(!(g instanceof d))throw new Error("EdwardsPoint expected")}const y=class y{constructor(m,x,v,b){xt(this,"X");xt(this,"Y");xt(this,"Z");xt(this,"T");this.X=f("x",m),this.Y=f("y",x),this.Z=f("z",v,!0),this.T=f("t",b),Object.freeze(this)}static CURVE(){return s}static fromAffine(m){if(m instanceof y)throw new Error("extended point not allowed");const{x,y:v}=m||{};return f("x",x),f("y",v),new y(x,v,ue,c(x*v))}static fromBytes(m,x=!1){const v=r.BYTES,{a:b,d:k}=s;m=Ks(Le(m,v,"point")),mo(x,"zip215");const M=Ks(m),C=m[v-1];M[v-1]=C&-129;const L=ar(M),_=x?l:r.ORDER;eh("point.y",L,Un,_);const T=c(L*L),I=c(T-ue),E=c(k*T-b);let{isValid:P,value:S}=h(I,E);if(!P)throw new Error("bad point: invalid y coordinate");const w=(S&ue)===ue,A=(C&128)!==0;if(!x&&S===Un&&A)throw new Error("bad point: x=0 and x_0=1");return A!==w&&(S=c(-S)),y.fromAffine({x:S,y:L})}static fromHex(m,x=!1){return y.fromBytes(Bg(m),x)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(m=8,x=!0){return p.createCache(this,m),x||this.multiply(sa),this}assertValidity(){const m=this,{a:x,d:v}=s;if(m.is0())throw new Error("bad point: ZERO");const{X:b,Y:k,Z:M,T:C}=m,L=c(b*b),_=c(k*k),T=c(M*M),I=c(T*T),E=c(L*x),P=c(T*c(E+_)),S=c(I+c(v*c(L*_)));if(P!==S)throw new Error("bad point: equation left != right (1)");const w=c(b*k),A=c(M*C);if(w!==A)throw new Error("bad point: equation left != right (2)")}equals(m){u(m);const{X:x,Y:v,Z:b}=this,{X:k,Y:M,Z:C}=m,L=c(x*C),_=c(k*b),T=c(v*C),I=c(M*b);return L===_&&T===I}is0(){return this.equals(y.ZERO)}negate(){return new y(c(-this.X),this.Y,this.Z,c(-this.T))}double(){const{a:m}=s,{X:x,Y:v,Z:b}=this,k=c(x*x),M=c(v*v),C=c(sa*c(b*b)),L=c(m*k),_=x+v,T=c(c(_*_)-k-M),I=L+M,E=I-C,P=L-M,S=c(T*E),w=c(I*P),A=c(T*P),$=c(E*I);return new y(S,w,$,A)}add(m){u(m);const{a:x,d:v}=s,{X:b,Y:k,Z:M,T:C}=this,{X:L,Y:_,Z:T,T:I}=m,E=c(b*L),P=c(k*_),S=c(C*v*I),w=c(M*T),A=c((b+k)*(L+_)-E-P),$=w-S,D=w+S,F=c(P-x*E),R=c(A*$),z=c(D*F),B=c(A*F),H=c($*D);return new y(R,z,H,B)}subtract(m){return u(m),this.add(m.negate())}multiply(m){if(!o.isValidNot0(m))throw new RangeError("invalid scalar: expected 1 <= sc < curve.n");const{p:x,f:v}=p.cached(this,m,b=>na(y,b));return na(y,[x,v])[0]}multiplyUnsafe(m){if(!o.isValid(m))throw new RangeError("invalid scalar: expected 0 <= sc < curve.n");return m===Un?y.ZERO:this.is0()||m===ue?this:p.unsafe(this,m,x=>na(y,x))}isSmallOrder(){return this.clearCofactor().is0()}isTorsionFree(){return p.unsafe(this,s.n).is0()}toAffine(m){const x=this;let v=m;const{X:b,Y:k,Z:M}=x,C=x.is0();v==null&&(v=C?s0:r.inv(M));const L=c(b*v),_=c(k*v),T=r.mul(M,v);if(C)return{x:Un,y:ue};if(T!==ue)throw new Error("invZ was invalid");return{x:L,y:_}}clearCofactor(){return a===ue?this:this.multiplyUnsafe(a)}toBytes(){const{x:m,y:x}=this.toAffine(),v=r.toBytes(x);return v[v.length-1]|=m&ue?128:0,v}toHex(){return Kl(this.toBytes())}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}};xt(y,"BASE",new y(s.Gx,s.Gy,ue,c(s.Gx*s.Gy))),xt(y,"ZERO",new y(Un,ue,ue,Un)),xt(y,"Fp",r),xt(y,"Fn",o);let d=y;const p=new i0(d,o.BITS);return o.BITS>=8&&d.BASE.precompute(8),Object.freeze(d.prototype),Object.freeze(d),d}class cr{constructor(t){xt(this,"ep");this.ep=t}static fromBytes(t){nh()}static fromHex(t){nh()}get x(){return this.toAffine().x}get y(){return this.toAffine().y}clearCofactor(){return this}assertValidity(){this.ep.assertValidity()}toAffine(t){return this.ep.toAffine(t)}toHex(){return Kl(this.toBytes())}toString(){return this.toHex()}isTorsionFree(){return!0}isSmallOrder(){return!1}add(t){return this.assertSame(t),this.init(this.ep.add(t.ep))}subtract(t){return this.assertSame(t),this.init(this.ep.subtract(t.ep))}multiply(t){return this.init(this.ep.multiply(t))}multiplyUnsafe(t){return this.init(this.ep.multiplyUnsafe(t))}double(){return this.init(this.ep.double())}negate(){return this.init(this.ep.negate())}precompute(t,e){return this.ep.precompute(t,e),this}}xt(cr,"BASE"),xt(cr,"ZERO"),xt(cr,"Fp"),xt(cr,"Fn");function l0(n,t,e={}){if(typeof t!="function")throw new Error('"hash" function param is required');const i=t,r=e;Js(r,{},{adjustScalarBytes:"function",randomBytes:"function",domain:"function",prehash:"function",zip215:"boolean",mapToCurve:"function"});const{prehash:o}=r,{BASE:s,Fp:a,Fn:l}=n,c=i.outputLen,h=2*a.BYTES;if(c!==void 0&&(Zs(c,"hash.outputLen"),c!==h))throw new Error(`hash.outputLen must be ${h}, got ${c}`);const f=r.randomBytes===void 0?Ng:r.randomBytes,u=r.adjustScalarBytes===void 0?E=>E:r.adjustScalarBytes,d=r.domain===void 0?(E,P,S)=>{if(mo(S,"phflag"),P.length||S)throw new Error("Contexts/pre-hash are not supported");return E}:r.domain;function p(E){return l.create(ar(E))}function y(E){const P=C.secretKey;Le(E,C.secretKey,"secretKey");const S=Le(i(E),2*P,"hashedSecretKey"),w=u(S.slice(0,P)),A=S.slice(P,2*P),$=p(w);return{head:w,prefix:A,scalar:$}}function g(E){const{head:P,prefix:S,scalar:w}=y(E),A=s.multiply(w),$=A.toBytes();return{head:P,prefix:S,scalar:w,point:A,pointBytes:$}}function m(E){return g(E).pointBytes}function x(E=Uint8Array.of(),...P){const S=Jl(...P);return p(i(d(S,Le(E,void 0,"context"),!!o)))}function v(E,P,S={}){E=Le(E,void 0,"message"),o&&(E=o(E));const{prefix:w,scalar:A,pointBytes:$}=g(P),D=x(S.context,w,E),F=s.multiply(D).toBytes(),R=x(S.context,F,$,E),z=l.create(D+R*A);if(!l.isValid(z))throw new Error("sign failed: invalid s");const B=Jl(F,l.toBytes(z));return Le(B,C.signature,"result")}const b={zip215:r.zip215};function k(E,P,S,w=b){const{context:A}=w,$=w.zip215===void 0?!!b.zip215:w.zip215,D=C.signature;E=Le(E,D,"signature"),P=Le(P,void 0,"message"),S=Le(S,C.publicKey,"publicKey"),$!==void 0&&mo($,"zip215"),o&&(P=o(P));const F=D/2,R=E.subarray(0,F),z=ar(E.subarray(F,D));let B,H,J;try{B=n.fromBytes(S,$),H=n.fromBytes(R,$),J=s.multiplyUnsafe(z)}catch{return!1}if(!$&&B.isSmallOrder())return!1;const X=x(A,R,S,P);return H.add(B.multiplyUnsafe(X)).subtract(J).clearCofactor().is0()}const M=a.BYTES,C={secretKey:M,publicKey:M,signature:2*M,seed:M};function L(E){return E=E===void 0?f(C.seed):E,Le(E,C.seed,"seed")}function _(E){return Og(E)&&E.length===C.secretKey}function T(E,P){try{return!!n.fromBytes(E,P===void 0?b.zip215:P)}catch{return!1}}const I={getExtendedPublicKey:g,randomSecretKey:L,isValidSecretKey:_,isValidPublicKey:T,toMontgomery(E){const{y:P}=n.fromBytes(E),S=C.publicKey,w=S===32;if(!w&&S!==57)throw new Error("only defined for 25519 and 448");const A=w?a.div(ue+P,ue-P):a.div(P-ue,P+ue);return a.toBytes(A)},toMontgomerySecret(E){const P=C.secretKey;Le(E,P);const S=i(E.subarray(0,P));return u(S).subarray(0,P)}};return Object.freeze(C),Object.freeze(I),Object.freeze({keygen:o0(L,m),getPublicKey:m,sign:v,verify:k,utils:I,Point:n,lengths:C})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const h0=BigInt(0),lr=BigInt(1),wh=BigInt(2),u0=BigInt(5),f0=BigInt(8),hr=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"),kh={p:hr,n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),h:f0,a:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),d:BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),Gx:BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),Gy:BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")};function d0(n){const t=BigInt(10),e=BigInt(20),i=BigInt(40),r=BigInt(80),o=hr,a=n*n%o*n%o,l=bn(a,wh,o)*a%o,c=bn(l,lr,o)*n%o,h=bn(c,u0,o)*c%o,f=bn(h,t,o)*h%o,u=bn(f,e,o)*f%o,d=bn(u,i,o)*u%o,p=bn(d,r,o)*d%o,y=bn(p,r,o)*d%o,g=bn(y,t,o)*h%o;return{pow_p_5_8:bn(g,wh,o)*n%o,b2:a}}function p0(n){return n[0]&=248,n[31]&=127,n[31]|=64,n}const aa=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");function Mh(n,t){const e=hr,i=ae(t*t*t,e),r=ae(i*i*t,e),o=d0(n*r).pow_p_5_8;let s=ae(n*i*o,e);const a=ae(t*s*s,e),l=s,c=ae(s*aa,e),h=a===n,f=a===ae(-n,e),u=a===ae(-n*aa,e);return h&&(s=l),(f||u)&&(s=c),hi(s,e)&&(s=ae(-s,e)),{isValid:h||f,value:s}}const ui=c0(kh,{uvRatio:Mh}),fi=ui.Fp,g0=ui.Fn;function m0(n){return l0(ui,zg,Object.assign({adjustScalarBytes:p0,zip215:!0},n))}const y0=m0({}),Ah=aa,x0=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),Sh=n=>Mh(lr,n),b0=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),v0=n=>fi.create(ar(n)&b0),He=class He extends cr{constructor(t){super(t)}static fromAffine(t){return new He(ui.fromAffine(t))}assertSame(t){if(!(t instanceof He))throw new Error("RistrettoPoint expected")}init(t){return new He(t)}static fromBytes(t){ci(t,32);const{a:e,d:i}=kh,r=hr,o=b=>fi.create(b),s=v0(t);if(!Gg(fi.toBytes(s),t)||hi(s,r))throw new Error("invalid ristretto255 encoding 1");const a=o(s*s),l=o(lr+e*a),c=o(lr-e*a),h=o(l*l),f=o(c*c),u=o(e*i*h-f),{isValid:d,value:p}=Sh(o(u*f)),y=o(p*c),g=o(p*y*u);let m=o((s+s)*y);hi(m,r)&&(m=o(-m));const x=o(l*g),v=o(m*x);if(!d||hi(v,r)||x===h0)throw new Error("invalid ristretto255 encoding 2");return new He(new ui(m,x,lr,v))}static fromHex(t){return He.fromBytes(js(t))}toBytes(){let{X:t,Y:e,Z:i,T:r}=this.ep;const o=hr,s=g=>fi.create(g),a=s(s(i+e)*s(i-e)),l=s(t*e),c=s(l*l),{value:h}=Sh(s(a*c)),f=s(h*a),u=s(h*l),d=s(f*u*r);let p;if(hi(r*d,o)){let g=s(e*Ah),m=s(t*Ah);t=g,e=m,p=s(f*x0)}else p=u;hi(t*d,o)&&(e=s(-e));let y=s((i-e)*p);return hi(y,o)&&(y=s(-y)),fi.toBytes(y)}equals(t){this.assertSame(t);const{X:e,Y:i}=this.ep,{X:r,Y:o}=t.ep,s=c=>fi.create(c),a=s(e*o)===s(i*r),l=s(i*o)===s(e*r);return a||l}is0(){return this.equals(He.ZERO)}};xt(He,"BASE",new He(ui.BASE)),xt(He,"ZERO",new He(ui.ZERO)),xt(He,"Fp",fi),xt(He,"Fn",g0);let Li=He;Object.freeze(Li.BASE),Object.freeze(Li.ZERO),Object.freeze(Li.prototype),Object.freeze(Li);const _h="katucharts_license",w0=7*24*60*60*1e3,k0=60*60*1e3,M0=8e3,jA="3ab57dfcba56a3c6b1949906ef075ff6536f2a40b328a77733e4d8d837cb6abe";class A0{constructor(){this.licenseKey=null,this.payload=null,this.offlineValid=!1,this.verifyUrl=null,this.mode="lenient",this.gracePeriodMs=w0,this.recheckIntervalMs=k0,this.cache=null,this.pending=!1,this.timer=null,this.listeners=new Set,this.lastEmitted=null}configure(t){t.verifyUrl!==void 0&&(this.verifyUrl=t.verifyUrl||null),t.mode&&(this.mode=t.mode),t.gracePeriodMs!==void 0&&(this.gracePeriodMs=t.gracePeriodMs),t.recheckIntervalMs!==void 0&&(this.recheckIntervalMs=t.recheckIntervalMs),this.offlineValid&&this.verifyUrl&&this.startOnlineChecks(),this.emit()}setKey(t){this.licenseKey=t,this.payload=null,this.offlineValid=!1,this.cache=null;const e=this.validate(t);return e&&(this.payload=e,this.offlineValid=!0,this.cache=this.loadCache(e.kid)),this.offlineValid&&this.verifyUrl&&this.startOnlineChecks(),this.emit(),this.isLicensed()}isLicensed(){var t;return this.offlineValid?this.verifyUrl?((t=this.cache)==null?void 0:t.lastResult)==="invalid"?!1:this.cache&&this.cache.lastValidAt>0&&ca()-this.cache.lastValidAt<this.gracePeriodMs||this.pending?!0:this.mode!=="strict":!0:!1}getPayload(){return this.payload}onChange(t){return this.listeners.add(t),()=>this.listeners.delete(t)}startOnlineChecks(){var t,e;this.verifyOnline(),this.timer==null&&typeof setInterval<"u"&&this.recheckIntervalMs>0&&(this.timer=setInterval(()=>void this.verifyOnline(),this.recheckIntervalMs),(e=(t=this.timer)==null?void 0:t.unref)==null||e.call(t))}async verifyOnline(){if(!this.verifyUrl||!this.licenseKey||!this.payload||typeof fetch>"u")return;this.pending=!0;const t=this.payload.kid??"",e=typeof window<"u"?window.location.hostname:"";let i="unreachable";try{const r=typeof AbortController<"u"?new AbortController:null,o=r?setTimeout(()=>r.abort(),M0):null,s=await fetch(this.verifyUrl,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({key:this.licenseKey,domain:e,kid:t}),signal:r==null?void 0:r.signal});o&&clearTimeout(o),s.ok?i=(await s.json()).valid?"valid":"invalid":s.status>=400&&s.status<500&&(i="invalid")}catch{i="unreachable"}this.pending=!1,this.applyResult(t,i)}applyResult(t,e){const i=this.cache,r={kid:t,lastResult:e,lastValidAt:e==="valid"?ca():(i==null?void 0:i.lastValidAt)??0,updatedAt:ca()};this.cache=r,this.saveCache(r),this.emit()}emit(){const t=this.isLicensed();t!==this.lastEmitted&&(this.lastEmitted=t,this.listeners.forEach(e=>{try{e(t)}catch{}}))}loadCache(t){if(!t||typeof localStorage>"u")return null;try{const e=localStorage.getItem(_h);if(!e)return null;const i=JSON.parse(e);return i.kid===t?i:null}catch{return null}}saveCache(t){if(!(typeof localStorage>"u"))try{localStorage.setItem(_h,JSON.stringify(t))}catch{}}validate(t){try{const e=t.indexOf(".");if(e===-1)return null;const i=t.substring(0,e),r=t.substring(e+1),o="3ab57dfcba56a3c6b1949906ef075ff6536f2a40b328a77733e4d8d837cb6abe",s=new TextEncoder().encode(i);if(!y0.verify(Ch(r),s,Ch(o)))return null;const a=atob(i),l=JSON.parse(a);return!l.customer||!this.checkExpiry(l.expiry)||!this.checkDomain(l.domains)?null:l}catch{return null}}checkExpiry(t){if(!t)return!0;try{return new Date(t).getTime()>=Date.now()}catch{return!1}}checkDomain(t){if(!t||t.length===0||typeof window>"u")return!0;const e=window.location.hostname;return t.some(i=>{if(i.startsWith("*.")){const r=i.substring(1);return e.endsWith(r)||e===i.substring(2)}return e===i})}}function ca(){return Date.now()}function Ch(n){if(n.length%2!==0)throw new Error("invalid hex length");const t=new Uint8Array(n.length/2);for(let e=0;e<t.length;e++)t[e]=parseInt(n.slice(e*2,e*2+2),16);return t}const Qe=new A0;class S0{constructor(){this.indicators=new Map}register(t){this.indicators.set(t.name.toLowerCase(),t)}get(t){return this.indicators.get(t.toLowerCase())}getAll(){return new Map(this.indicators)}}const Ph=globalThis,_0=Ph.__katuIndicatorRegistry||(Ph.__katuIndicatorRegistry=new S0),la={sma:"sma",ema:"ema",wma:"wma",rsi:"rsi",macd:"macd",stochastic:"stochastic",stoch:"stochastic",bb:"bollingerbands",bollinger:"bollingerbands",bollingerbands:"bollingerbands",atr:"atr",vwap:"vwap",obv:"obv",vbp:"vbp",ichimoku:"ichimoku",ikh:"ichimoku",cci:"cci",roc:"roc",momentum:"momentum",mom:"momentum",dema:"dema",tema:"tema",adx:"adx",psar:"psar"},C0=new Set(Object.keys(la));function ha(n){return!!n&&C0.has(n.toLowerCase())}const Eh="#7798BF",ua="#f15c80",P0="#90ed7d";function E0(n){return n.map((t,e)=>{const i=t.close??t.y??0;return{x:t.x??e,open:t.open??i,high:t.high??i,low:t.low??i,close:i,volume:t.volume??t.z}})}function T0(n,t){const e=n.linkedTo;if(typeof e=="string"){const i=t.find(r=>r.id===e);if(i)return i}return typeof e=="number"&&t[e]?t[e]:t.find(i=>i!==n&&!ha(i._internalType))??null}const $0={sma:"SMA",ema:"EMA",wma:"WMA",rsi:"RSI",macd:"MACD",stochastic:"Stochastic",bollingerbands:"Bollinger Bands",atr:"ATR",vwap:"VWAP",obv:"OBV",ichimoku:"Ichimoku",cci:"CCI",roc:"ROC",momentum:"Momentum",dema:"DEMA",tema:"TEMA",adx:"ADX",psar:"PSAR"};function L0(n,t){const e=$0[n]||n.toUpperCase(),i=t.period;return i?`${e} (${i})`:e}function tn(n,t,e,i){return{...n,type:t,_internalType:t,_processedData:e,data:e,params:void 0,linkedTo:void 0,...i}}function I0(n,t){return n.map((e,i)=>{var r;return{x:e.x,low:((r=t[i])==null?void 0:r.y)??null,high:e.y??null}})}function F0(n,t,e,i){const r=[],o=n.color||Eh,s=n.lineWidth??1.5,a=n.name||L0(t,i);if(e.bands){if(r.push(tn(n,"arearange",I0(e.bands.upper,e.bands.lower),{name:`${a} band`,color:n.color||Eh,fillOpacity:n.fillOpacity??.15,lineWidth:0,showInLegend:!1,enableMouseTracking:!1})),t==="ichimoku")r.push(tn(n,"line",e.values,{name:`${a} Tenkan`,color:o,lineWidth:s,marker:{enabled:!1}})),e.signal&&r.push(tn(n,"line",e.signal,{name:`${a} Kijun`,color:ua,lineWidth:s,marker:{enabled:!1}}));else{const l=e.bands.middle??e.values;r.push(tn(n,"line",l,{name:a,color:o,lineWidth:s,marker:{enabled:!1}}))}return r}return e.histogram?(r.push(tn(n,"column",e.histogram,{name:`${a} Histogram`,color:P0,showInLegend:!1,enableMouseTracking:!1})),r.push(tn(n,"line",e.values,{name:a,color:o,lineWidth:s,marker:{enabled:!1}})),e.signal&&r.push(tn(n,"line",e.signal,{name:`${a} Signal`,color:ua,lineWidth:s,marker:{enabled:!1}})),r):e.signal?(r.push(tn(n,"line",e.values,{name:`${a} %K`,color:o,lineWidth:s,marker:{enabled:!1}})),r.push(tn(n,"line",e.signal,{name:`${a} %D`,color:ua,lineWidth:s,marker:{enabled:!1}})),r):t==="vbp"?(r.push(tn(n,"vbp",e.values,{name:a,showInLegend:n.showInLegend??!1})),r):t==="psar"?(r.push(tn(n,"scatter",e.values,{name:a,color:o,marker:{enabled:!0,radius:2,symbol:"circle"}})),r):(r.push(tn(n,"line",e.values,{name:a,color:o,lineWidth:s,marker:{enabled:!1}})),r)}function D0(n){if(!n.some(e=>ha(e._internalType)))return n;const t=[];for(const e of n){const i=(e._internalType||"").toLowerCase();if(!ha(i)){t.push(e);continue}const r=_0.get(la[i]),o=T0(e,n);if(!r||!o){t.push({...e,type:"line",_internalType:"line",_processedData:[],data:[]});continue}const s=e.params||{},a=r.calculate(E0(o._processedData||[]),s);t.push(...F0(e,la[i],a,s))}return t.map((e,i)=>({...e,index:i}))}let bo={};function fa(n){bo=he(bo,n)}function Th(){return bo}const Qn=class Qn{parse(t){var o;(o=t.chart)!=null&&o.palette&&!t.colors&&(t={...t,colors:Tl(t.chart.palette)});const e=t.theme?Il(t.theme):void 0,i=this.mergeWithDefaults(t,e),r=this.normalize(i);return this.toInternal(r)}mergeWithDefaults(t,e){return he(he({},Hs),bo,e??{},t)}normalize(t){var c,h,f;const e={...t};e.xAxis&&!Array.isArray(e.xAxis)&&(e.xAxis=[e.xAxis]),e.yAxis&&!Array.isArray(e.yAxis)&&(e.yAxis=[e.yAxis]),e.colorAxis&&!Array.isArray(e.colorAxis)&&(e.colorAxis=[e.colorAxis]),(!e.xAxis||Array.isArray(e.xAxis)&&e.xAxis.length===0)&&(e.xAxis=[he({},Hs.xAxis)]),(!e.yAxis||Array.isArray(e.yAxis)&&e.yAxis.length===0)&&(e.yAxis=[he({},Hs.yAxis)]);for(const u of[e.xAxis,e.yAxis])if(Array.isArray(u))for(const d of u)d.categories&&d.categories.length>0&&(d.type="category");e.series&&!Array.isArray(e.series)&&(e.series=[e.series]);const i=((c=e.chart)==null?void 0:c.type)||"line",r=i==="bar"||Array.isArray(e.series)&&e.series.some(u=>u.type==="bar");if(e.chart&&(r?(e.chart.inverted=!0,e.chart._invertedFromBar=!0):e.chart._invertedFromBar&&(e.chart.inverted=!1,delete e.chart._invertedFromBar)),(i==="manhattan"||Array.isArray(e.series)&&e.series.some(u=>u.type==="manhattan"))&&Array.isArray(e.xAxis)&&(!Array.isArray(e.series)||e.series.some(d=>(d.type==="manhattan"||!d.type&&i==="manhattan")&&d.showChromosomeLabels!==!1)))for(const d of e.xAxis)d.labels={...d.labels,enabled:!1},d.tickLength=0;const s=!!((h=e.chart)!=null&&h.polar),a=(f=e.chart)==null?void 0:f.type;s&&Array.isArray(e.series)&&(e.series=e.series.map(u=>{const d=u.type||a||"line",p=!u.type||u.type==="line"||u.type==="spline",y=!u.type&&(a==="line"||a==="spline"),g={...u,type:p?"radar":u.type};return u.type==="line"||u.type==="spline"||y?g._polarSubType="line":(d==="column"||d==="bar")&&(g._polarSubType="column"),g}));const l=Array.isArray(e.colorAxis)?e.colorAxis[0]:e.colorAxis;return Array.isArray(e.series)&&(e.series=e.series.map(u=>{const d=this.normalizeSeries(u,s&&(!u.type||u.type==="line"||u.type==="spline")?"radar":i,e.plotOptions);return(d.type==="heatmap"||d.type==="treemap")&&l&&!d.colorAxis&&(d.colorAxis=l),(d.type==="map"||d.type==="mappoint"||d.type==="flowmap")&&this.applyMapTopLevelOptions(d,e,l),d})),this.applyAutoHeight(e),e}applyAutoHeight(t){var i;const e=t.chart;if(e){if(e._autoScrollMinHeight!=null){const r=e.scrollablePlotArea;if(r&&typeof r=="object"&&r.minHeight===e._autoScrollMinHeight){const o={...r};delete o.minHeight,e.scrollablePlotArea=Object.keys(o).length?o:void 0}delete e._autoScrollMinHeight}if(e.height==null&&e.inverted){const r=Array.isArray(t.xAxis)?t.xAxis:t.xAxis?[t.xAxis]:[];let o=0;for(const s of r){const a=((i=s==null?void 0:s.categories)==null?void 0:i.length)??0;a>o&&(o=a)}if(o>12){const s=Math.min(o*26+130,9e3),a=e.scrollablePlotArea&&typeof e.scrollablePlotArea=="object"?e.scrollablePlotArea:{};e.scrollablePlotArea={...a,minHeight:s},e._autoScrollMinHeight=s;return}}}}applyMapTopLevelOptions(t,e,i){var r,o;i&&(!t.colorAxis||typeof t.colorAxis!="object")&&(t.colorAxis=i),t.mapNavigation==null&&e.mapNavigation!=null&&(t.mapNavigation=e.mapNavigation),t.projection==null&&((r=e.mapView)==null?void 0:r.projection)!=null&&(t.projection=e.mapView.projection),t.mapData==null&&((o=e.chart)==null?void 0:o.map)!=null&&(t.mapData=e.chart.map)}static mergeDataLabels(t){let e;for(const i of t)i!==void 0&&(e=Qn.mergeTwoDataLabels(e,i));return e}static mergeTwoDataLabels(t,e){if(t===void 0)return e;if(e===void 0)return t;const i=Array.isArray(t)?t:[t],r=Array.isArray(e)?e:[e],o=Math.max(i.length,r.length),s=[];for(let a=0;a<o;a++){const l=i[a]??i[0]??{},c=r[a]??r[0]??{};s.push(he({},l,c))}return s.length===1&&!Array.isArray(t)&&!Array.isArray(e)?s[0]:s}normalizeSeries(t,e,i){let r={...t};if(r.type?delete r._typeFromChart:(r.type=e,r._typeFromChart=!0),i){const o=i.series||{},s=i[r.type]||{},a=r._polarSubType,l=a?i[a]||{}:{},c=Qn.mergeDataLabels([o,l,s,r].map(h=>h.dataLabels));r=he({},o,l,s,r),c!==void 0&&(r.dataLabels=c)}if(Array.isArray(r.data)){const o=r.turboThreshold??1e3;if(r.data.length>o){const s=r.data[0];if(s!==null&&typeof s=="object"&&!Array.isArray(s)&&console.warn(`KatuCharts: series data length (${r.data.length}) exceeds turboThreshold (${o}). Use array format (numbers or [x,y] pairs) for better performance.`),typeof s=="number"||Array.isArray(s)&&typeof s[0]=="number")return r.data=this.normalizeDataBulk(r.data,r),r}r.data=r.data.map((s,a)=>this.normalizeDataPoint(s,a,r))}else r.data!=null&&(r.data=[]);return r}defaultArrayKeys(t,e){return t?Qn.OHLC_TYPES.has(t)?e>=5?["x","open","high","low","close"]:["open","high","low","close"]:Qn.RANGE_TYPES.has(t)?e>=3?["x","low","high"]:["low","high"]:null:null}normalizeDataPoint(t,e,i){if(t===null)return{x:(i.pointStart??0)+e*(i.pointInterval??1),y:null};if(typeof t=="number")return{x:(i.pointStart??0)+e*(i.pointInterval??1),y:t};if(Array.isArray(t)&&t.length===5&&i.type==="boxplot"){const r=t;return{x:(i.pointStart??0)+e*(i.pointInterval??1),low:r[0],q1:r[1],median:r[2],q3:r[3],high:r[4]}}if(Array.isArray(t)&&i.type==="flowmap")return{from:t[0],to:t[1],weight:t[2]};if(Array.isArray(t)){if(i.keys&&i.keys.length>0){const o={};for(let s=0;s<i.keys.length&&s<t.length;s++)o[i.keys[s]]=t[s];return o.x===void 0&&(!Ei.has(i.type)||!o.name)&&(o.x=(i.pointStart??0)+e*(i.pointInterval??1)),o}const r=this.defaultArrayKeys(i.type,t.length);if(r){const o={};for(let s=0;s<r.length&&s<t.length;s++)o[r[s]]=t[s];return o.x===void 0&&(o.x=(i.pointStart??0)+e*(i.pointInterval??1)),o.close!==void 0&&o.y===void 0&&(o.y=o.close),o}if(typeof t[0]=="string"){const o={name:t[0],y:t[1]};return Ei.has(i.type)||(o.x=(i.pointStart??0)+e*(i.pointInterval??1)),o}return t.length>=3?{x:t[0],y:t[1],z:t[2]}:{x:t[0],y:t[1]}}if(typeof t=="object"){const r={...t},o=i.type==="map"||i.type==="mappoint"||i.type==="flowmap",s=!Ei.has(i.type);return!o&&r.x===void 0&&(s||!r.name)&&(r.x=(i.pointStart??0)+e*(i.pointInterval??1)),r}return{y:null}}normalizeDataBulk(t,e){const i=t.length,r=new Array(i),o=e.pointStart??0,s=e.pointInterval??1,a=t[0];if(typeof a=="number")for(let l=0;l<i;l++)r[l]={x:o+l*s,y:t[l]};else{const l=Array.isArray(a)?this.defaultArrayKeys(e.type,a.length):null;if(l)for(let c=0;c<i;c++){const h=t[c],f={};for(let u=0;u<l.length&&u<h.length;u++)f[l[u]]=h[u];f.x===void 0&&(f.x=o+c*s),f.close!==void 0&&f.y===void 0&&(f.y=f.close),r[c]=f}else for(let c=0;c<i;c++){const h=t[c];h.length>=3?r[c]={x:h[0],y:h[1],z:h[2]}:r[c]={x:h[0],y:h[1]}}}return r}enforceCredits(t){return Qe.isLicensed()?t:{...t,enabled:!0,text:!t.text||!t.text.trim()?"Powered by: KatuCharts":t.text}}toInternal(t){var l,c,h;const e=!!((l=t.chart)!=null&&l.inverted),i=(c=t.chart)==null?void 0:c.backgroundColor,r=t.xAxis.map((f,u)=>({...f,index:u,isX:!0,_inverted:e,_backgroundColor:i})),o=t.yAxis.map((f,u)=>({...f,index:u,isX:!1,_inverted:e,_backgroundColor:i})),s=(t.series||[]).map((f,u)=>{var m;const d=typeof f.xAxis=="number"?f.xAxis:0,p=typeof f.yAxis=="number"?f.yAxis:0,y=f.type||((m=t.chart)==null?void 0:m.type)||"line",g=y==="pie"||y==="donut"||y==="sankey";return{...f,index:u,_internalType:y,_xAxisIndex:d,_yAxisIndex:p,_xAxis:r[d]||r[0],_yAxis:o[p]||o[0],_processedData:f.data||[],...g&&f.showInLegend===void 0?{showInLegend:!1}:{}}}),a=D0(s);return{chart:{width:null,height:null,backgroundColor:"#ffffff",animation:!0,reflow:!0,...t.chart},title:t.title||{},subtitle:t.subtitle||{},xAxis:r,yAxis:o,colorAxis:t.colorAxis||[],series:a,tooltip:t.tooltip||{},legend:{...t.legend||{},_backgroundColor:(h=t.chart)==null?void 0:h.backgroundColor},plotOptions:t.plotOptions||{},credits:this.enforceCredits(t.credits||{}),exporting:t.exporting||{},loading:t.loading||{},navigator:t.navigator||{},rangeSelector:t.rangeSelector||{},drilldown:t.drilldown||{},responsive:t.responsive||{},accessibility:t.accessibility||{},colors:t.colors||[],time:t.time||{}}}};Qn.OHLC_TYPES=new Set(["candlestick","ohlc","heikinashi","hollowcandlestick"]),Qn.RANGE_TYPES=new Set(["arearange","areasplinerange","columnrange"]);let jn=Qn;var da="http://www.w3.org/1999/xhtml";const $h={svg:"http://www.w3.org/2000/svg",xhtml:da,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function vo(n){var t=n+="",e=t.indexOf(":");return e>=0&&(t=n.slice(0,e))!=="xmlns"&&(n=n.slice(e+1)),$h.hasOwnProperty(t)?{space:$h[t],local:n}:n}function R0(n){return function(){var t=this.ownerDocument,e=this.namespaceURI;return e===da&&t.documentElement.namespaceURI===da?t.createElement(n):t.createElementNS(e,n)}}function z0(n){return function(){return this.ownerDocument.createElementNS(n.space,n.local)}}function Lh(n){var t=vo(n);return(t.local?z0:R0)(t)}function B0(){}function pa(n){return n==null?B0:function(){return this.querySelector(n)}}function O0(n){typeof n!="function"&&(n=pa(n));for(var t=this._groups,e=t.length,i=new Array(e),r=0;r<e;++r)for(var o=t[r],s=o.length,a=i[r]=new Array(s),l,c,h=0;h<s;++h)(l=o[h])&&(c=n.call(l,l.__data__,h,o))&&("__data__"in l&&(c.__data__=l.__data__),a[h]=c);return new Xe(i,this._parents)}function N0(n){return n==null?[]:Array.isArray(n)?n:Array.from(n)}function W0(){return[]}function Ih(n){return n==null?W0:function(){return this.querySelectorAll(n)}}function H0(n){return function(){return N0(n.apply(this,arguments))}}function V0(n){typeof n=="function"?n=H0(n):n=Ih(n);for(var t=this._groups,e=t.length,i=[],r=[],o=0;o<e;++o)for(var s=t[o],a=s.length,l,c=0;c<a;++c)(l=s[c])&&(i.push(n.call(l,l.__data__,c,s)),r.push(l));return new Xe(i,r)}function Fh(n){return function(){return this.matches(n)}}function Dh(n){return function(t){return t.matches(n)}}var G0=Array.prototype.find;function Y0(n){return function(){return G0.call(this.children,n)}}function X0(){return this.firstElementChild}function U0(n){return this.select(n==null?X0:Y0(typeof n=="function"?n:Dh(n)))}var j0=Array.prototype.filter;function q0(){return Array.from(this.children)}function Z0(n){return function(){return j0.call(this.children,n)}}function K0(n){return this.selectAll(n==null?q0:Z0(typeof n=="function"?n:Dh(n)))}function J0(n){typeof n!="function"&&(n=Fh(n));for(var t=this._groups,e=t.length,i=new Array(e),r=0;r<e;++r)for(var o=t[r],s=o.length,a=i[r]=[],l,c=0;c<s;++c)(l=o[c])&&n.call(l,l.__data__,c,o)&&a.push(l);return new Xe(i,this._parents)}function Rh(n){return new Array(n.length)}function Q0(){return new Xe(this._enter||this._groups.map(Rh),this._parents)}function wo(n,t){this.ownerDocument=n.ownerDocument,this.namespaceURI=n.namespaceURI,this._next=null,this._parent=n,this.__data__=t}wo.prototype={constructor:wo,appendChild:function(n){return this._parent.insertBefore(n,this._next)},insertBefore:function(n,t){return this._parent.insertBefore(n,t)},querySelector:function(n){return this._parent.querySelector(n)},querySelectorAll:function(n){return this._parent.querySelectorAll(n)}};function tm(n){return function(){return n}}function em(n,t,e,i,r,o){for(var s=0,a,l=t.length,c=o.length;s<c;++s)(a=t[s])?(a.__data__=o[s],i[s]=a):e[s]=new wo(n,o[s]);for(;s<l;++s)(a=t[s])&&(r[s]=a)}function nm(n,t,e,i,r,o,s){var a,l,c=new Map,h=t.length,f=o.length,u=new Array(h),d;for(a=0;a<h;++a)(l=t[a])&&(u[a]=d=s.call(l,l.__data__,a,t)+"",c.has(d)?r[a]=l:c.set(d,l));for(a=0;a<f;++a)d=s.call(n,o[a],a,o)+"",(l=c.get(d))?(i[a]=l,l.__data__=o[a],c.delete(d)):e[a]=new wo(n,o[a]);for(a=0;a<h;++a)(l=t[a])&&c.get(u[a])===l&&(r[a]=l)}function im(n){return n.__data__}function rm(n,t){if(!arguments.length)return Array.from(this,im);var e=t?nm:em,i=this._parents,r=this._groups;typeof n!="function"&&(n=tm(n));for(var o=r.length,s=new Array(o),a=new Array(o),l=new Array(o),c=0;c<o;++c){var h=i[c],f=r[c],u=f.length,d=om(n.call(h,h&&h.__data__,c,i)),p=d.length,y=a[c]=new Array(p),g=s[c]=new Array(p),m=l[c]=new Array(u);e(h,f,y,g,m,d,t);for(var x=0,v=0,b,k;x<p;++x)if(b=y[x]){for(x>=v&&(v=x+1);!(k=g[v])&&++v<p;);b._next=k||null}}return s=new Xe(s,i),s._enter=a,s._exit=l,s}function om(n){return typeof n=="object"&&"length"in n?n:Array.from(n)}function sm(){return new Xe(this._exit||this._groups.map(Rh),this._parents)}function am(n,t,e){var i=this.enter(),r=this,o=this.exit();return typeof n=="function"?(i=n(i),i&&(i=i.selection())):i=i.append(n+""),t!=null&&(r=t(r),r&&(r=r.selection())),e==null?o.remove():e(o),i&&r?i.merge(r).order():r}function cm(n){for(var t=n.selection?n.selection():n,e=this._groups,i=t._groups,r=e.length,o=i.length,s=Math.min(r,o),a=new Array(r),l=0;l<s;++l)for(var c=e[l],h=i[l],f=c.length,u=a[l]=new Array(f),d,p=0;p<f;++p)(d=c[p]||h[p])&&(u[p]=d);for(;l<r;++l)a[l]=e[l];return new Xe(a,this._parents)}function lm(){for(var n=this._groups,t=-1,e=n.length;++t<e;)for(var i=n[t],r=i.length-1,o=i[r],s;--r>=0;)(s=i[r])&&(o&&s.compareDocumentPosition(o)^4&&o.parentNode.insertBefore(s,o),o=s);return this}function hm(n){n||(n=um);function t(f,u){return f&&u?n(f.__data__,u.__data__):!f-!u}for(var e=this._groups,i=e.length,r=new Array(i),o=0;o<i;++o){for(var s=e[o],a=s.length,l=r[o]=new Array(a),c,h=0;h<a;++h)(c=s[h])&&(l[h]=c);l.sort(t)}return new Xe(r,this._parents).order()}function um(n,t){return n<t?-1:n>t?1:n>=t?0:NaN}function fm(){var n=arguments[0];return arguments[0]=this,n.apply(null,arguments),this}function dm(){return Array.from(this)}function pm(){for(var n=this._groups,t=0,e=n.length;t<e;++t)for(var i=n[t],r=0,o=i.length;r<o;++r){var s=i[r];if(s)return s}return null}function gm(){let n=0;for(const t of this)++n;return n}function mm(){return!this.node()}function ym(n){for(var t=this._groups,e=0,i=t.length;e<i;++e)for(var r=t[e],o=0,s=r.length,a;o<s;++o)(a=r[o])&&n.call(a,a.__data__,o,r);return this}function xm(n){return function(){this.removeAttribute(n)}}function bm(n){return function(){this.removeAttributeNS(n.space,n.local)}}function vm(n,t){return function(){this.setAttribute(n,t)}}function wm(n,t){return function(){this.setAttributeNS(n.space,n.local,t)}}function km(n,t){return function(){var e=t.apply(this,arguments);e==null?this.removeAttribute(n):this.setAttribute(n,e)}}function Mm(n,t){return function(){var e=t.apply(this,arguments);e==null?this.removeAttributeNS(n.space,n.local):this.setAttributeNS(n.space,n.local,e)}}function Am(n,t){var e=vo(n);if(arguments.length<2){var i=this.node();return e.local?i.getAttributeNS(e.space,e.local):i.getAttribute(e)}return this.each((t==null?e.local?bm:xm:typeof t=="function"?e.local?Mm:km:e.local?wm:vm)(e,t))}function zh(n){return n.ownerDocument&&n.ownerDocument.defaultView||n.document&&n||n.defaultView}function Sm(n){return function(){this.style.removeProperty(n)}}function _m(n,t,e){return function(){this.style.setProperty(n,t,e)}}function Cm(n,t,e){return function(){var i=t.apply(this,arguments);i==null?this.style.removeProperty(n):this.style.setProperty(n,i,e)}}function Pm(n,t,e){return arguments.length>1?this.each((t==null?Sm:typeof t=="function"?Cm:_m)(n,t,e??"")):Ii(this.node(),n)}function Ii(n,t){return n.style.getPropertyValue(t)||zh(n).getComputedStyle(n,null).getPropertyValue(t)}function Em(n){return function(){delete this[n]}}function Tm(n,t){return function(){this[n]=t}}function $m(n,t){return function(){var e=t.apply(this,arguments);e==null?delete this[n]:this[n]=e}}function Lm(n,t){return arguments.length>1?this.each((t==null?Em:typeof t=="function"?$m:Tm)(n,t)):this.node()[n]}function Bh(n){return n.trim().split(/^|\s+/)}function ga(n){return n.classList||new Oh(n)}function Oh(n){this._node=n,this._names=Bh(n.getAttribute("class")||"")}Oh.prototype={add:function(n){var t=this._names.indexOf(n);t<0&&(this._names.push(n),this._node.setAttribute("class",this._names.join(" ")))},remove:function(n){var t=this._names.indexOf(n);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(n){return this._names.indexOf(n)>=0}};function Nh(n,t){for(var e=ga(n),i=-1,r=t.length;++i<r;)e.add(t[i])}function Wh(n,t){for(var e=ga(n),i=-1,r=t.length;++i<r;)e.remove(t[i])}function Im(n){return function(){Nh(this,n)}}function Fm(n){return function(){Wh(this,n)}}function Dm(n,t){return function(){(t.apply(this,arguments)?Nh:Wh)(this,n)}}function Rm(n,t){var e=Bh(n+"");if(arguments.length<2){for(var i=ga(this.node()),r=-1,o=e.length;++r<o;)if(!i.contains(e[r]))return!1;return!0}return this.each((typeof t=="function"?Dm:t?Im:Fm)(e,t))}function zm(){this.textContent=""}function Bm(n){return function(){this.textContent=n}}function Om(n){return function(){var t=n.apply(this,arguments);this.textContent=t??""}}function Nm(n){return arguments.length?this.each(n==null?zm:(typeof n=="function"?Om:Bm)(n)):this.node().textContent}function Wm(){this.innerHTML=""}function Hm(n){return function(){this.innerHTML=n}}function Vm(n){return function(){var t=n.apply(this,arguments);this.innerHTML=t??""}}function Gm(n){return arguments.length?this.each(n==null?Wm:(typeof n=="function"?Vm:Hm)(n)):this.node().innerHTML}function Ym(){this.nextSibling&&this.parentNode.appendChild(this)}function Xm(){return this.each(Ym)}function Um(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function jm(){return this.each(Um)}function qm(n){var t=typeof n=="function"?n:Lh(n);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Zm(){return null}function Km(n,t){var e=typeof n=="function"?n:Lh(n),i=t==null?Zm:typeof t=="function"?t:pa(t);return this.select(function(){return this.insertBefore(e.apply(this,arguments),i.apply(this,arguments)||null)})}function Jm(){var n=this.parentNode;n&&n.removeChild(this)}function Qm(){return this.each(Jm)}function ty(){var n=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(n,this.nextSibling):n}function ey(){var n=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(n,this.nextSibling):n}function ny(n){return this.select(n?ey:ty)}function iy(n){return arguments.length?this.property("__data__",n):this.node().__data__}function ry(n){return function(t){n.call(this,t,this.__data__)}}function oy(n){return n.trim().split(/^|\s+/).map(function(t){var e="",i=t.indexOf(".");return i>=0&&(e=t.slice(i+1),t=t.slice(0,i)),{type:t,name:e}})}function sy(n){return function(){var t=this.__on;if(t){for(var e=0,i=-1,r=t.length,o;e<r;++e)o=t[e],(!n.type||o.type===n.type)&&o.name===n.name?this.removeEventListener(o.type,o.listener,o.options):t[++i]=o;++i?t.length=i:delete this.__on}}}function ay(n,t,e){return function(){var i=this.__on,r,o=ry(t);if(i){for(var s=0,a=i.length;s<a;++s)if((r=i[s]).type===n.type&&r.name===n.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=o,r.options=e),r.value=t;return}}this.addEventListener(n.type,o,e),r={type:n.type,name:n.name,value:t,listener:o,options:e},i?i.push(r):this.__on=[r]}}function cy(n,t,e){var i=oy(n+""),r,o=i.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var l=0,c=a.length,h;l<c;++l)for(r=0,h=a[l];r<o;++r)if((s=i[r]).type===h.type&&s.name===h.name)return h.value}return}for(a=t?ay:sy,r=0;r<o;++r)this.each(a(i[r],t,e));return this}function Hh(n,t,e){var i=zh(n),r=i.CustomEvent;typeof r=="function"?r=new r(t,e):(r=i.document.createEvent("Event"),e?(r.initEvent(t,e.bubbles,e.cancelable),r.detail=e.detail):r.initEvent(t,!1,!1)),n.dispatchEvent(r)}function ly(n,t){return function(){return Hh(this,n,t)}}function hy(n,t){return function(){return Hh(this,n,t.apply(this,arguments))}}function uy(n,t){return this.each((typeof t=="function"?hy:ly)(n,t))}function*fy(){for(var n=this._groups,t=0,e=n.length;t<e;++t)for(var i=n[t],r=0,o=i.length,s;r<o;++r)(s=i[r])&&(yield s)}var Vh=[null];function Xe(n,t){this._groups=n,this._parents=t}function ur(){return new Xe([[document.documentElement]],Vh)}function dy(){return this}Xe.prototype=ur.prototype={constructor:Xe,select:O0,selectAll:V0,selectChild:U0,selectChildren:K0,filter:J0,data:rm,enter:Q0,exit:sm,join:am,merge:cm,selection:dy,order:lm,sort:hm,call:fm,nodes:dm,node:pm,size:gm,empty:mm,each:ym,attr:Am,style:Pm,property:Lm,classed:Rm,text:Nm,html:Gm,raise:Xm,lower:jm,append:qm,insert:Km,remove:Qm,clone:ny,datum:iy,on:cy,dispatch:uy,[Symbol.iterator]:fy};function rt(n){return typeof n=="string"?new Xe([[document.querySelector(n)]],[document.documentElement]):new Xe([[n]],Vh)}function py(n){let t;for(;t=n.sourceEvent;)n=t;return n}function pn(n,t){if(n=py(n),t===void 0&&(t=n.currentTarget),t){var e=t.ownerSVGElement||t;if(e.createSVGPoint){var i=e.createSVGPoint();return i.x=n.clientX,i.y=n.clientY,i=i.matrixTransform(t.getScreenCTM().inverse()),[i.x,i.y]}if(t.getBoundingClientRect){var r=t.getBoundingClientRect();return[n.clientX-r.left-t.clientLeft,n.clientY-r.top-t.clientTop]}}return[n.pageX,n.pageY]}class gy{constructor(t){this.el=t}attr(t){for(const[e,i]of Object.entries(t))e!=="zIndex"&&this.el.attr(e,i);return this}css(t){for(const[e,i]of Object.entries(t)){const r=e.replace(/[A-Z]/g,o=>"-"+o.toLowerCase());this.el.style(r,i),e==="color"&&this.el.attr("fill",i)}return this}add(){return this}getBBox(){const t=this.el.node();if(!t||typeof t.getBBox!="function")return{x:0,y:0,width:0,height:0};try{return t.getBBox()}catch{return{x:0,y:0,width:0,height:0}}}destroy(){this.el.remove()}}const nr=class nr{constructor(t,e,i){this.svg=rt(t).append("svg").attr("class","katucharts-root").attr("xmlns","http://www.w3.org/2000/svg").attr("width",e).attr("height",i).style("overflow","hidden").style("outline","none").style("display","block").style("max-width","100%"),this.defs=this.svg.append("defs")}setSize(t,e){this.svg.attr("width",t).attr("height",e)}createGroup(t,e){const r=(e||this.svg).append("g");return t&&r.attr("class",t),r}text(t,e,i){const r=this.svg.append("text").attr("x",e).attr("y",i).style("pointer-events","none").text(t);return new gy(r)}createClipPath(t,e,i,r){const o=`katucharts-clip-${++nr.clipPathCounter}`;return this.defs.append("clipPath").attr("id",o).append("rect").attr("x",t).attr("y",e).attr("width",i).attr("height",r),o}updateClipPath(t,e,i,r,o){this.defs.select(`#${t} rect`).attr("x",e).attr("y",i).attr("width",r).attr("height",o)}createLinearGradient(t,e,i,r,o,s){const a=t||`katucharts-grad-${++nr.gradientCounter}`,l=this.defs.append("linearGradient").attr("id",a).attr("x1",e).attr("y1",i).attr("x2",r).attr("y2",o);for(const c of s)l.append("stop").attr("offset",c.offset).attr("stop-color",c.color).attr("stop-opacity",c.opacity??1);return a}getSVGNode(){return this.svg.node()}destroy(){this.svg.remove()}getSerializedSVG(){const t=this.svg.node();return t?new XMLSerializer().serializeToString(t):""}};nr.clipPathCounter=0,nr.gradientCounter=0;let ko=nr;class Gh{constructor(){this.listeners=new Map}on(t,e){return this.listeners.has(t)||this.listeners.set(t,[]),this.listeners.get(t).push({callback:e,once:!1}),this}once(t,e){return this.listeners.has(t)||this.listeners.set(t,[]),this.listeners.get(t).push({callback:e,once:!0}),this}off(t,e){if(!e)return this.listeners.delete(t),this;const i=this.listeners.get(t);return i&&this.listeners.set(t,i.filter(r=>r.callback!==e)),this}emit(t,...e){const i=this.listeners.get(t);if(!i)return this;const r=[];for(const o of i)o.callback(...e),o.once&&r.push(o);return r.length&&this.listeners.set(t,i.filter(o=>!r.includes(o))),this}removeAllListeners(){this.listeners.clear()}static mapEvent(t,e){return`${t}:${e.toLowerCase()}`}}class my{constructor(t,e){this.config=t,this.events=e}getConfig(){return this.config}updateConfig(t){this.config=he(this.config,t),this.events.emit("state:configChanged",this.config)}getSeries(){return this.config.series}getSeriesById(t){return this.config.series.find(e=>e.id===t)}getSeriesByIndex(t){return this.config.series[t]}addSeries(t){this.config.series=[...this.config.series,t],this.events.emit("state:seriesAdded",t)}removeSeries(t){const e=this.config.series[t];return e&&(this.config.series=this.config.series.filter((i,r)=>r!==t),this.events.emit("state:seriesRemoved",e,t)),e}updateSeries(t,e){const i=this.config.series[t];i&&(this.config.series[t]=he(i,e),this.events.emit("state:seriesUpdated",this.config.series[t],t))}getXAxes(){return this.config.xAxis}getYAxes(){return this.config.yAxis}updateAxis(t,e,i){const r=t?this.config.xAxis:this.config.yAxis;r[e]&&(r[e]=he(r[e],i),this.events.emit("state:axisUpdated",{isX:t,index:e,config:r[e]}))}}class yy{constructor(){this.types=new Map}registerType(t,e){this.types.set(t,e)}getType(t){return this.types.get(t)}hasType(t){return this.types.has(t)}getRegisteredTypes(){return Array.from(this.types.keys())}}const Yh=globalThis,$t=Yh.__katuChartRegistry||(Yh.__katuChartRegistry=new yy);class xy{constructor(){this.modules=new Map}register(t){this.modules.set(t.name,t)}get(t){return this.modules.get(t)}getAll(){return Array.from(this.modules.values())}}const Xh=new xy;class by{compute(t,e,i){var F,R,z,B,H,J,X,q,W,U,G,N,Y,O,ct;const r=this.getSpacing(t);let o=r.top,s=r.bottom;const a=r.left,l=r.right,c=((F=t.title)==null?void 0:F.widthAdjust)??-44,h=e+c,f=(z=(R=t.title)==null?void 0:R.style)!=null&&z.fontSize?t.title.style:{...(B=t.title)==null?void 0:B.style,fontSize:"18px"},u=(H=t.title)!=null&&H.text?this.estimateWrappedTextHeight(t.title.text,f,h):0,d=((J=t.title)==null?void 0:J.margin)??8,p=(X=t.subtitle)!=null&&X.text?this.estimateWrappedTextHeight(t.subtitle.text,t.subtitle.style,h):0;u>0&&(o=r.top+u+(p>0?3:d)),p>0&&(o+=p+d);const y=t.series.some(it=>it._internalType==="heatmap"),g=((q=t.legend)==null?void 0:q.align)||"center",m=!y&&((W=t.legend)==null?void 0:W.enabled)!==!1&&((U=t.legend)==null?void 0:U.layout)==="vertical"&&(g==="left"||g==="right"),x=y||m?0:this.estimateLegendHeight(t,e),v=((G=t.legend)==null?void 0:G.verticalAlign)||"bottom";!m&&v==="bottom"?s=Math.max(s,r.bottom)+x:!m&&v==="top"&&(o+=x);const b=m?this.estimateLegendWidth(t):0,k=m&&g==="left"?b:0,M=m&&g==="right"?b:0;if((N=t.navigator)!=null&&N.enabled){const it=t.navigator;s+=(it.height??40)+(it.margin??20)}const C=this.isNonCartesian(t),_=!!t.chart.inverted?{...t,xAxis:t.yAxis,yAxis:t.xAxis}:t,T=C?0:this.estimateAxisWidth(_,!0,i,e),I=C?0:this.estimateAxisWidth(_,!1,i,e),E=C?0:this.estimateAxisHeight(_);let P=0;y&&((Y=t.colorAxis)==null?void 0:Y.length)>0&&((O=t.legend)==null?void 0:O.layout)==="vertical"&&(P=55);const S=a+T+k,w=o,A=Math.max(0,e-a-l-T-I-P-k-M),$=((ct=t.chart)==null?void 0:ct.marginBottom)!==void 0,D=Math.max(0,i-o-s-($?0:E));return{plotArea:{x:S,y:w,width:A,height:D},titleArea:{x:r.left,y:r.top,width:e-r.left-r.right,height:u+d},subtitleArea:{x:r.left,y:r.top+u+d,width:e-r.left-r.right,height:p},legendArea:m?{x:g==="right"?e-l-M:a,y:w,width:b,height:D}:{x:0,y:v==="top"?o-x:i-s,width:e,height:x}}}isNonCartesian(t){return t.series.length>0&&t.series.every(e=>Ei.has(e._internalType))}getSpacing(t){var s;const e=t.chart;if(e.margin!==void 0){const a=e.margin;if(typeof a=="number")return{top:a,right:a,bottom:a,left:a};if(Array.isArray(a))return{top:a[0]??10,right:a[1]??10,bottom:a[2]??15,left:a[3]??10}}const i=e.spacing||[10,10,15,10],o=((s=t.exporting)==null?void 0:s.enabled)!==!1&&!this.isNonCartesian(t)?40:i[1]??10;return{top:e.marginTop??e.spacingTop??i[0],right:e.marginRight??e.spacingRight??o,bottom:e.marginBottom??e.spacingBottom??i[2],left:e.marginLeft??e.spacingLeft??i[3]}}estimateTextHeight(t){return be(t==null?void 0:t.fontSize)*1.4}estimateWrappedTextHeight(t,e,i){const r=be(e==null?void 0:e.fontSize),o=r*1.4;if(!i||i<=0)return o;const s=r*.55,a=Math.floor(i/s);if(a<=0)return o;const l=Math.ceil(t.length/a);return o*Math.max(l,1)}computeAutoFontSize(t,e){return e||"12px"}estimateLegendHeight(t,e){var r,o;const i=this.estimateSeriesLegendHeight(t,e);if((r=t.legend)!=null&&r.enabled&&((o=t.legend.bubbleLegend)!=null&&o.enabled)){const s=t.series.find(a=>a._internalType==="bubble");if(s){const a=t.legend.margin??8,c=(t.legend.bubbleLegend.maxSize??(typeof s.maxSize=="number"?s.maxSize:30))*2+16+a;return(t.legend.layout||"horizontal")==="horizontal"&&t.legend.bubbleLegend.layout==="separate"?i+c:Math.max(i,c)}}return i}estimateLegendWidth(t){var u;const e=t.legend;if(!e)return 0;const i=t.series.filter(d=>d.showInLegend!==!1),r=e.itemStyle||{},o=be(r.fontSize||wt),s=e.symbolWidth??12,a=e.symbolPadding??5,l=e.padding??8;let c=0;i.forEach((d,p)=>{const y=Je(d.name||`Series ${p+1}`,o);y>c&&(c=y)});let h=s+a+c;if((u=e.bubbleLegend)!=null&&u.enabled){const d=t.series.find(p=>p._internalType==="bubble");if(d){const p=e.bubbleLegend.maxSize??(typeof d.maxSize=="number"?d.maxSize:30),y=e.bubbleLegend.connectorDistance??16;h=Math.max(h,p*2+y+30)}}const f=e.margin??12;return h+l*2+f}estimateSeriesLegendHeight(t,e){var p;if(!((p=t.legend)!=null&&p.enabled))return 0;const i=t.series.filter(y=>y.showInLegend!==!1),r=i.length;if(r===0)return 0;const o=t.legend.margin??8,s=t.legend.layout||"horizontal",l=(t.legend.itemStyle||{}).fontSize||wt,c=this.computeAutoFontSize(r,l),h=t.legend.lineHeight??16,f=t.legend.itemMarginBottom??2,u=t.legend.itemMarginTop??0,d=h+f+u;if(s==="horizontal"){const y=t.legend.padding??4,g=t.legend.symbolWidth??10,m=t.legend.symbolPadding??5,x=t.legend.itemDistance??20,v=this.getSpacing(t),b=t.legend.width||e-v.left-v.right-y*2,k=be(c),M=i.map((P,S)=>P.name||`Series ${S+1}`);let C=0;for(let P=0;P<M.length;P++){const S=t.legend.itemWidth||Je(M[P],k),w=g+m+S;C+=w+(P<M.length-1?x:0)}if(r>8&&C>b){let P=0;for(const F of M){const R=Je(F,k);R>P&&(P=R)}let S,w;if(t.legend.itemWidth)S=t.legend.itemWidth,w=Math.max(2,Math.floor(b/S));else{const F=g+m+P+8;w=Math.max(1,Math.floor(b/F)),S=b/w}const $=Math.ceil(r/w)*d+y*2,D=t.legend.maxHeight;return(D?Math.min($,D):$)+o}let _=y,T=1;for(let P=0;P<r;P++){const S=t.legend.itemWidth||Je(M[P],k),w=g+m+S;P>0&&_+w>b&&(T++,_=y),_+=w+x}const I=T*d+y*2,E=t.legend.maxHeight;return(E?Math.min(I,E):I)+o}return r*d+(t.legend.padding??8)*2+o}estimateAxisWidth(t,e,i,r){var a,l;const o=t.yAxis.filter(c=>e?!c.opposite:c.opposite);if(o.length===0)return 0;let s=0;for(const c of o){if(c.visible===!1)continue;const h=((a=c.labels)==null?void 0:a.enabled)!==!1,f=(l=c.title)==null?void 0:l.text,u=h?this.estimateLabelWidth(c,i,r):0;s+=u+(f?30:0)+(c.offset||0)}return s||30}estimateLabelWidth(t,e,i){var s,a,l,c;if(t.categories&&t.categories.length>0){const h=be(((a=(s=t.labels)==null?void 0:s.style)==null?void 0:a.fontSize)||wt);let f=h;if(e&&t.categories.length>1){const m=e*.8/t.categories.length*.7;h>m&&(f=Math.min(h,Math.max(5,Math.round(m*1.1))))}const u=((c=(l=t.labels)==null?void 0:l.style)==null?void 0:c.fontWeight)||"normal";let d=0;for(const y of t.categories){const g=Je(y,f,u);g>d&&(d=g)}const p=i?Math.max(120,i*.3):460;return Math.max(25,Math.min(d*1.3+16,p))}const r=t.min??null,o=t.max??null;if(r!=null&&o!=null){const f=String(Math.round(Math.max(Math.abs(r),Math.abs(o)))).length+(r<0?1:0);return Math.max(20,f*7+10)}return 25}estimateAxisHeight(t){var r,o,s,a,l,c,h;const e=t.xAxis.filter(f=>!f.opposite);if(e.length===0)return 0;let i=0;for(const f of e){if(f.visible===!1)continue;const u=((r=f.labels)==null?void 0:r.enabled)!==!1,d=(o=f.title)==null?void 0:o.text,p=!!((s=f.labels)!=null&&s.rotation);let y=30;if(u){if(p&&f.categories&&f.categories.length>0){let m=0;for(const k of f.categories)k.length>m&&(m=k.length);const x=be(((l=(a=f.labels)==null?void 0:a.style)==null?void 0:l.fontSize)||wt),v=Math.abs(f.labels.rotation)*(Math.PI/180),b=Math.min(m*x*.62*Math.sin(v),150);y=Math.max(30,b)}else if(p)y=45;else if(f.categories&&f.categories.length>0){let m=0;for(const b of f.categories)b.length>m&&(m=b.length);const x=be(((h=(c=f.labels)==null?void 0:c.style)==null?void 0:h.fontSize)||wt);if(f.categories.length>6||m>8){const b=Math.min(m*x*.4*Math.sin(Math.PI/4),120);y=Math.max(30,b)}}}else y=0;const g=u?f.tickLength||10:5;i+=y+(d?25:0)+g}return i||40}}function Mo(n,t){return n==null||t==null?NaN:n<t?-1:n>t?1:n>=t?0:NaN}function vy(n,t){return n==null||t==null?NaN:t<n?-1:t>n?1:t>=n?0:NaN}function ma(n){let t,e,i;n.length!==2?(t=Mo,e=(a,l)=>Mo(n(a),l),i=(a,l)=>n(a)-l):(t=n===Mo||n===vy?n:wy,e=n,i=n);function r(a,l,c=0,h=a.length){if(c<h){if(t(l,l)!==0)return h;do{const f=c+h>>>1;e(a[f],l)<0?c=f+1:h=f}while(c<h)}return c}function o(a,l,c=0,h=a.length){if(c<h){if(t(l,l)!==0)return h;do{const f=c+h>>>1;e(a[f],l)<=0?c=f+1:h=f}while(c<h)}return c}function s(a,l,c=0,h=a.length){const f=r(a,l,c,h-1);return f>c&&i(a[f-1],l)>-i(a[f],l)?f-1:f}return{left:r,center:s,right:o}}function wy(){return 0}function ky(n){return n===null?NaN:+n}const My=ma(Mo).right;ma(ky).center;class di{constructor(){this._partials=new Float64Array(32),this._n=0}add(t){const e=this._partials;let i=0;for(let r=0;r<this._n&&r<32;r++){const o=e[r],s=t+o,a=Math.abs(t)<Math.abs(o)?t-(s-o):o-(s-t);a&&(e[i++]=a),t=s}return e[i]=t,this._n=i+1,this}valueOf(){const t=this._partials;let e=this._n,i,r,o,s=0;if(e>0){for(s=t[--e];e>0&&(i=s,r=t[--e],s=i+r,o=r-(s-i),!o););e>0&&(o<0&&t[e-1]<0||o>0&&t[e-1]>0)&&(r=o*2,i=s+r,r==i-s&&(s=i))}return s}}class Uh extends Map{constructor(t,e=_y){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:e}}),t!=null)for(const[i,r]of t)this.set(i,r)}get(t){return super.get(jh(this,t))}has(t){return super.has(jh(this,t))}set(t,e){return super.set(Ay(this,t),e)}delete(t){return super.delete(Sy(this,t))}}function jh({_intern:n,_key:t},e){const i=t(e);return n.has(i)?n.get(i):e}function Ay({_intern:n,_key:t},e){const i=t(e);return n.has(i)?n.get(i):(n.set(i,e),e)}function Sy({_intern:n,_key:t},e){const i=t(e);return n.has(i)&&(e=n.get(i),n.delete(i)),e}function _y(n){return n!==null&&typeof n=="object"?n.valueOf():n}const Cy=Math.sqrt(50),Py=Math.sqrt(10),Ey=Math.sqrt(2);function Ao(n,t,e){const i=(t-n)/Math.max(0,e),r=Math.floor(Math.log10(i)),o=i/Math.pow(10,r),s=o>=Cy?10:o>=Py?5:o>=Ey?2:1;let a,l,c;return r<0?(c=Math.pow(10,-r)/s,a=Math.round(n*c),l=Math.round(t*c),a/c<n&&++a,l/c>t&&--l,c=-c):(c=Math.pow(10,r)*s,a=Math.round(n/c),l=Math.round(t/c),a*c<n&&++a,l*c>t&&--l),l<a&&.5<=e&&e<2?Ao(n,t,e*2):[a,l,c]}function ya(n,t,e){if(t=+t,n=+n,e=+e,!(e>0))return[];if(n===t)return[n];const i=t<n,[r,o,s]=i?Ao(t,n,e):Ao(n,t,e);if(!(o>=r))return[];const a=o-r+1,l=new Array(a);if(i)if(s<0)for(let c=0;c<a;++c)l[c]=(o-c)/-s;else for(let c=0;c<a;++c)l[c]=(o-c)*s;else if(s<0)for(let c=0;c<a;++c)l[c]=(r+c)/-s;else for(let c=0;c<a;++c)l[c]=(r+c)*s;return l}function xa(n,t,e){return t=+t,n=+n,e=+e,Ao(n,t,e)[2]}function ba(n,t,e){t=+t,n=+n,e=+e;const i=t<n,r=i?xa(t,n,e):xa(n,t,e);return(i?-1:1)*(r<0?1/-r:r)}function*Ty(n){for(const t of n)yield*t}function qh(n){return Array.from(Ty(n))}function pi(n,t,e){n=+n,t=+t,e=(r=arguments.length)<2?(t=n,n=0,1):r<3?1:+e;for(var i=-1,r=Math.max(0,Math.ceil((t-n)/e))|0,o=new Array(r);++i<r;)o[i]=n+i*e;return o}function gi(n,t){switch(arguments.length){case 0:break;case 1:this.range(n);break;default:this.range(t).domain(n);break}return this}function $y(n,t){switch(arguments.length){case 0:break;case 1:{typeof n=="function"?this.interpolator(n):this.range(n);break}default:{this.domain(n),typeof t=="function"?this.interpolator(t):this.range(t);break}}return this}const Zh=Symbol("implicit");function Kh(){var n=new Uh,t=[],e=[],i=Zh;function r(o){let s=n.get(o);if(s===void 0){if(i!==Zh)return i;n.set(o,s=t.push(o)-1)}return e[s%e.length]}return r.domain=function(o){if(!arguments.length)return t.slice();t=[],n=new Uh;for(const s of o)n.has(s)||n.set(s,t.push(s)-1);return r},r.range=function(o){return arguments.length?(e=Array.from(o),r):e.slice()},r.unknown=function(o){return arguments.length?(i=o,r):i},r.copy=function(){return Kh(t,e).unknown(i)},gi.apply(r,arguments),r}function Jh(){var n=Kh().unknown(void 0),t=n.domain,e=n.range,i=0,r=1,o,s,a=!1,l=0,c=0,h=.5;delete n.unknown;function f(){var u=t().length,d=r<i,p=d?r:i,y=d?i:r;o=(y-p)/Math.max(1,u-l+c*2),a&&(o=Math.floor(o)),p+=(y-p-o*(u-l))*h,s=o*(1-l),a&&(p=Math.round(p),s=Math.round(s));var g=pi(u).map(function(m){return p+o*m});return e(d?g.reverse():g)}return n.domain=function(u){return arguments.length?(t(u),f()):t()},n.range=function(u){return arguments.length?([i,r]=u,i=+i,r=+r,f()):[i,r]},n.rangeRound=function(u){return[i,r]=u,i=+i,r=+r,a=!0,f()},n.bandwidth=function(){return s},n.step=function(){return o},n.round=function(u){return arguments.length?(a=!!u,f()):a},n.padding=function(u){return arguments.length?(l=Math.min(1,c=+u),f()):l},n.paddingInner=function(u){return arguments.length?(l=Math.min(1,u),f()):l},n.paddingOuter=function(u){return arguments.length?(c=+u,f()):c},n.align=function(u){return arguments.length?(h=Math.max(0,Math.min(1,u)),f()):h},n.copy=function(){return Jh(t(),[i,r]).round(a).paddingInner(l).paddingOuter(c).align(h)},gi.apply(f(),arguments)}function Ly(n,t,e,i,r){var o=n*n,s=o*n;return((1-3*n+3*o-s)*t+(4-6*o+3*s)*e+(1+3*n+3*o-3*s)*i+s*r)/6}function Iy(n){var t=n.length-1;return function(e){var i=e<=0?e=0:e>=1?(e=1,t-1):Math.floor(e*t),r=n[i],o=n[i+1],s=i>0?n[i-1]:2*r-o,a=i<t-1?n[i+2]:2*o-r;return Ly((e-i/t)*t,s,r,o,a)}}const va=n=>()=>n;function Fy(n,t){return function(e){return n+e*t}}function Dy(n,t,e){return n=Math.pow(n,e),t=Math.pow(t,e)-n,e=1/e,function(i){return Math.pow(n+i*t,e)}}function Ry(n){return(n=+n)==1?Qh:function(t,e){return e-t?Dy(t,e,n):va(isNaN(t)?e:t)}}function Qh(n,t){var e=t-n;return e?Fy(n,e):va(isNaN(n)?t:n)}const mi=function n(t){var e=Ry(t);function i(r,o){var s=e((r=Ye(r)).r,(o=Ye(o)).r),a=e(r.g,o.g),l=e(r.b,o.b),c=Qh(r.opacity,o.opacity);return function(h){return r.r=s(h),r.g=a(h),r.b=l(h),r.opacity=c(h),r+""}}return i.gamma=n,i}(1);function zy(n){return function(t){var e=t.length,i=new Array(e),r=new Array(e),o=new Array(e),s,a;for(s=0;s<e;++s)a=Ye(t[s]),i[s]=a.r||0,r[s]=a.g||0,o[s]=a.b||0;return i=n(i),r=n(r),o=n(o),a.opacity=1,function(l){return a.r=i(l),a.g=r(l),a.b=o(l),a+""}}}var By=zy(Iy);function Oy(n,t){t||(t=[]);var e=n?Math.min(t.length,n.length):0,i=t.slice(),r;return function(o){for(r=0;r<e;++r)i[r]=n[r]*(1-o)+t[r]*o;return i}}function Ny(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}function Wy(n,t){var e=t?t.length:0,i=n?Math.min(e,n.length):0,r=new Array(i),o=new Array(e),s;for(s=0;s<i;++s)r[s]=ce(n[s],t[s]);for(;s<e;++s)o[s]=t[s];return function(a){for(s=0;s<i;++s)o[s]=r[s](a);return o}}function Hy(n,t){var e=new Date;return n=+n,t=+t,function(i){return e.setTime(n*(1-i)+t*i),e}}function gn(n,t){return n=+n,t=+t,function(e){return n*(1-e)+t*e}}function Vy(n,t){var e={},i={},r;(n===null||typeof n!="object")&&(n={}),(t===null||typeof t!="object")&&(t={});for(r in t)r in n?e[r]=ce(n[r],t[r]):i[r]=t[r];return function(o){for(r in e)i[r]=e[r](o);return i}}var wa=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ka=new RegExp(wa.source,"g");function Gy(n){return function(){return n}}function Yy(n){return function(t){return n(t)+""}}function tu(n,t){var e=wa.lastIndex=ka.lastIndex=0,i,r,o,s=-1,a=[],l=[];for(n=n+"",t=t+"";(i=wa.exec(n))&&(r=ka.exec(t));)(o=r.index)>e&&(o=t.slice(e,o),a[s]?a[s]+=o:a[++s]=o),(i=i[0])===(r=r[0])?a[s]?a[s]+=r:a[++s]=r:(a[++s]=null,l.push({i:s,x:gn(i,r)})),e=ka.lastIndex;return e<t.length&&(o=t.slice(e),a[s]?a[s]+=o:a[++s]=o),a.length<2?l[0]?Yy(l[0].x):Gy(t):(t=l.length,function(c){for(var h=0,f;h<t;++h)a[(f=l[h]).i]=f.x(c);return a.join("")})}function ce(n,t){var e=typeof t,i;return t==null||e==="boolean"?va(t):(e==="number"?gn:e==="string"?(i=se(t))?(t=i,mi):tu:t instanceof se?mi:t instanceof Date?Hy:Ny(t)?Oy:Array.isArray(t)?Wy:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?Vy:gn)(n,t)}function eu(n,t){return n=+n,t=+t,function(e){return Math.round(n*(1-e)+t*e)}}var nu=180/Math.PI,Ma={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function iu(n,t,e,i,r,o){var s,a,l;return(s=Math.sqrt(n*n+t*t))&&(n/=s,t/=s),(l=n*e+t*i)&&(e-=n*l,i-=t*l),(a=Math.sqrt(e*e+i*i))&&(e/=a,i/=a,l/=a),n*i<t*e&&(n=-n,t=-t,l=-l,s=-s),{translateX:r,translateY:o,rotate:Math.atan2(t,n)*nu,skewX:Math.atan(l)*nu,scaleX:s,scaleY:a}}var So;function Xy(n){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(n+"");return t.isIdentity?Ma:iu(t.a,t.b,t.c,t.d,t.e,t.f)}function Uy(n){return n==null||(So||(So=document.createElementNS("http://www.w3.org/2000/svg","g")),So.setAttribute("transform",n),!(n=So.transform.baseVal.consolidate()))?Ma:(n=n.matrix,iu(n.a,n.b,n.c,n.d,n.e,n.f))}function ru(n,t,e,i){function r(c){return c.length?c.pop()+" ":""}function o(c,h,f,u,d,p){if(c!==f||h!==u){var y=d.push("translate(",null,t,null,e);p.push({i:y-4,x:gn(c,f)},{i:y-2,x:gn(h,u)})}else(f||u)&&d.push("translate("+f+t+u+e)}function s(c,h,f,u){c!==h?(c-h>180?h+=360:h-c>180&&(c+=360),u.push({i:f.push(r(f)+"rotate(",null,i)-2,x:gn(c,h)})):h&&f.push(r(f)+"rotate("+h+i)}function a(c,h,f,u){c!==h?u.push({i:f.push(r(f)+"skewX(",null,i)-2,x:gn(c,h)}):h&&f.push(r(f)+"skewX("+h+i)}function l(c,h,f,u,d,p){if(c!==f||h!==u){var y=d.push(r(d)+"scale(",null,",",null,")");p.push({i:y-4,x:gn(c,f)},{i:y-2,x:gn(h,u)})}else(f!==1||u!==1)&&d.push(r(d)+"scale("+f+","+u+")")}return function(c,h){var f=[],u=[];return c=n(c),h=n(h),o(c.translateX,c.translateY,h.translateX,h.translateY,f,u),s(c.rotate,h.rotate,f,u),a(c.skewX,h.skewX,f,u),l(c.scaleX,c.scaleY,h.scaleX,h.scaleY,f,u),c=h=null,function(d){for(var p=-1,y=u.length,g;++p<y;)f[(g=u[p]).i]=g.x(d);return f.join("")}}}var jy=ru(Xy,"px, ","px)","deg)"),qy=ru(Uy,", ",")",")"),Zy=1e-12;function ou(n){return((n=Math.exp(n))+1/n)/2}function Ky(n){return((n=Math.exp(n))-1/n)/2}function Jy(n){return((n=Math.exp(2*n))-1)/(n+1)}const Qy=function n(t,e,i){function r(o,s){var a=o[0],l=o[1],c=o[2],h=s[0],f=s[1],u=s[2],d=h-a,p=f-l,y=d*d+p*p,g,m;if(y<Zy)m=Math.log(u/c)/t,g=function(C){return[a+C*d,l+C*p,c*Math.exp(t*C*m)]};else{var x=Math.sqrt(y),v=(u*u-c*c+i*y)/(2*c*e*x),b=(u*u-c*c-i*y)/(2*u*e*x),k=Math.log(Math.sqrt(v*v+1)-v),M=Math.log(Math.sqrt(b*b+1)-b);m=(M-k)/t,g=function(C){var L=C*m,_=ou(k),T=c/(e*x)*(_*Jy(t*L+k)-Ky(k));return[a+T*d,l+T*p,c*_/ou(t*L+k)]}}return g.duration=m*1e3*t/Math.SQRT2,g}return r.rho=function(o){var s=Math.max(.001,+o),a=s*s,l=a*a;return n(s,a,l)},r}(Math.SQRT2,2,4);function tx(n){return function(){return n}}function ex(n){return+n}var su=[0,1];function en(n){return n}function Aa(n,t){return(t-=n=+n)?function(e){return(e-n)/t}:tx(isNaN(t)?NaN:.5)}function nx(n,t){var e;return n>t&&(e=n,n=t,t=e),function(i){return Math.max(n,Math.min(t,i))}}function ix(n,t,e){var i=n[0],r=n[1],o=t[0],s=t[1];return r<i?(i=Aa(r,i),o=e(s,o)):(i=Aa(i,r),o=e(o,s)),function(a){return o(i(a))}}function rx(n,t,e){var i=Math.min(n.length,t.length)-1,r=new Array(i),o=new Array(i),s=-1;for(n[i]<n[0]&&(n=n.slice().reverse(),t=t.slice().reverse());++s<i;)r[s]=Aa(n[s],n[s+1]),o[s]=e(t[s],t[s+1]);return function(a){var l=My(n,a,1,i)-1;return o[l](r[l](a))}}function _o(n,t){return t.domain(n.domain()).range(n.range()).interpolate(n.interpolate()).clamp(n.clamp()).unknown(n.unknown())}function Sa(){var n=su,t=su,e=ce,i,r,o,s=en,a,l,c;function h(){var u=Math.min(n.length,t.length);return s!==en&&(s=nx(n[0],n[u-1])),a=u>2?rx:ix,l=c=null,f}function f(u){return u==null||isNaN(u=+u)?o:(l||(l=a(n.map(i),t,e)))(i(s(u)))}return f.invert=function(u){return s(r((c||(c=a(t,n.map(i),gn)))(u)))},f.domain=function(u){return arguments.length?(n=Array.from(u,ex),h()):n.slice()},f.range=function(u){return arguments.length?(t=Array.from(u),h()):t.slice()},f.rangeRound=function(u){return t=Array.from(u),e=eu,h()},f.clamp=function(u){return arguments.length?(s=u?!0:en,h()):s!==en},f.interpolate=function(u){return arguments.length?(e=u,h()):e},f.unknown=function(u){return arguments.length?(o=u,f):o},function(u,d){return i=u,r=d,h()}}function au(){return Sa()(en,en)}function ox(n){return Math.abs(n=Math.round(n))>=1e21?n.toLocaleString("en").replace(/,/g,""):n.toString(10)}function Co(n,t){if(!isFinite(n)||n===0)return null;var e=(n=t?n.toExponential(t-1):n.toExponential()).indexOf("e"),i=n.slice(0,e);return[i.length>1?i[0]+i.slice(2):i,+n.slice(e+1)]}function Fi(n){return n=Co(Math.abs(n)),n?n[1]:NaN}function sx(n,t){return function(e,i){for(var r=e.length,o=[],s=0,a=n[0],l=0;r>0&&a>0&&(l+a+1>i&&(a=Math.max(1,i-l)),o.push(e.substring(r-=a,r+a)),!((l+=a+1)>i));)a=n[s=(s+1)%n.length];return o.reverse().join(t)}}function ax(n){return function(t){return t.replace(/[0-9]/g,function(e){return n[+e]})}}var cx=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function fr(n){if(!(t=cx.exec(n)))throw new Error("invalid format: "+n);var t;return new _a({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}fr.prototype=_a.prototype;function _a(n){this.fill=n.fill===void 0?" ":n.fill+"",this.align=n.align===void 0?">":n.align+"",this.sign=n.sign===void 0?"-":n.sign+"",this.symbol=n.symbol===void 0?"":n.symbol+"",this.zero=!!n.zero,this.width=n.width===void 0?void 0:+n.width,this.comma=!!n.comma,this.precision=n.precision===void 0?void 0:+n.precision,this.trim=!!n.trim,this.type=n.type===void 0?"":n.type+""}_a.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function lx(n){t:for(var t=n.length,e=1,i=-1,r;e<t;++e)switch(n[e]){case".":i=r=e;break;case"0":i===0&&(i=e),r=e;break;default:if(!+n[e])break t;i>0&&(i=0);break}return i>0?n.slice(0,i)+n.slice(r+1):n}var Po;function hx(n,t){var e=Co(n,t);if(!e)return Po=void 0,n.toPrecision(t);var i=e[0],r=e[1],o=r-(Po=Math.max(-8,Math.min(8,Math.floor(r/3)))*3)+1,s=i.length;return o===s?i:o>s?i+new Array(o-s+1).join("0"):o>0?i.slice(0,o)+"."+i.slice(o):"0."+new Array(1-o).join("0")+Co(n,Math.max(0,t+o-1))[0]}function cu(n,t){var e=Co(n,t);if(!e)return n+"";var i=e[0],r=e[1];return r<0?"0."+new Array(-r).join("0")+i:i.length>r+1?i.slice(0,r+1)+"."+i.slice(r+1):i+new Array(r-i.length+2).join("0")}const lu={"%":(n,t)=>(n*100).toFixed(t),b:n=>Math.round(n).toString(2),c:n=>n+"",d:ox,e:(n,t)=>n.toExponential(t),f:(n,t)=>n.toFixed(t),g:(n,t)=>n.toPrecision(t),o:n=>Math.round(n).toString(8),p:(n,t)=>cu(n*100,t),r:cu,s:hx,X:n=>Math.round(n).toString(16).toUpperCase(),x:n=>Math.round(n).toString(16)};function hu(n){return n}var uu=Array.prototype.map,fu=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function ux(n){var t=n.grouping===void 0||n.thousands===void 0?hu:sx(uu.call(n.grouping,Number),n.thousands+""),e=n.currency===void 0?"":n.currency[0]+"",i=n.currency===void 0?"":n.currency[1]+"",r=n.decimal===void 0?".":n.decimal+"",o=n.numerals===void 0?hu:ax(uu.call(n.numerals,String)),s=n.percent===void 0?"%":n.percent+"",a=n.minus===void 0?"−":n.minus+"",l=n.nan===void 0?"NaN":n.nan+"";function c(f,u){f=fr(f);var d=f.fill,p=f.align,y=f.sign,g=f.symbol,m=f.zero,x=f.width,v=f.comma,b=f.precision,k=f.trim,M=f.type;M==="n"?(v=!0,M="g"):lu[M]||(b===void 0&&(b=12),k=!0,M="g"),(m||d==="0"&&p==="=")&&(m=!0,d="0",p="=");var C=(u&&u.prefix!==void 0?u.prefix:"")+(g==="$"?e:g==="#"&&/[boxX]/.test(M)?"0"+M.toLowerCase():""),L=(g==="$"?i:/[%p]/.test(M)?s:"")+(u&&u.suffix!==void 0?u.suffix:""),_=lu[M],T=/[defgprs%]/.test(M);b=b===void 0?6:/[gprs]/.test(M)?Math.max(1,Math.min(21,b)):Math.max(0,Math.min(20,b));function I(E){var P=C,S=L,w,A,$;if(M==="c")S=_(E)+S,E="";else{E=+E;var D=E<0||1/E<0;if(E=isNaN(E)?l:_(Math.abs(E),b),k&&(E=lx(E)),D&&+E==0&&y!=="+"&&(D=!1),P=(D?y==="("?y:a:y==="-"||y==="("?"":y)+P,S=(M==="s"&&!isNaN(E)&&Po!==void 0?fu[8+Po/3]:"")+S+(D&&y==="("?")":""),T){for(w=-1,A=E.length;++w<A;)if($=E.charCodeAt(w),48>$||$>57){S=($===46?r+E.slice(w+1):E.slice(w))+S,E=E.slice(0,w);break}}}v&&!m&&(E=t(E,1/0));var F=P.length+E.length+S.length,R=F<x?new Array(x-F+1).join(d):"";switch(v&&m&&(E=t(R+E,R.length?x-S.length:1/0),R=""),p){case"<":E=P+E+S+R;break;case"=":E=P+R+E+S;break;case"^":E=R.slice(0,F=R.length>>1)+P+E+S+R.slice(F);break;default:E=R+P+E+S;break}return o(E)}return I.toString=function(){return f+""},I}function h(f,u){var d=Math.max(-8,Math.min(8,Math.floor(Fi(u)/3)))*3,p=Math.pow(10,-d),y=c((f=fr(f),f.type="f",f),{suffix:fu[8+d/3]});return function(g){return y(p*g)}}return{format:c,formatPrefix:h}}var Eo,dr,du;fx({thousands:",",grouping:[3],currency:["$",""]});function fx(n){return Eo=ux(n),dr=Eo.format,du=Eo.formatPrefix,Eo}function dx(n){return Math.max(0,-Fi(Math.abs(n)))}function px(n,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Fi(t)/3)))*3-Fi(Math.abs(n)))}function gx(n,t){return n=Math.abs(n),t=Math.abs(t)-n,Math.max(0,Fi(t)-Fi(n))+1}function mx(n,t,e,i){var r=ba(n,t,e),o;switch(i=fr(i??",f"),i.type){case"s":{var s=Math.max(Math.abs(n),Math.abs(t));return i.precision==null&&!isNaN(o=px(r,s))&&(i.precision=o),du(i,s)}case"":case"e":case"g":case"p":case"r":{i.precision==null&&!isNaN(o=gx(r,Math.max(Math.abs(n),Math.abs(t))))&&(i.precision=o-(i.type==="e"));break}case"f":case"%":{i.precision==null&&!isNaN(o=dx(r))&&(i.precision=o-(i.type==="%")*2);break}}return dr(i)}function Ca(n){var t=n.domain;return n.ticks=function(e){var i=t();return ya(i[0],i[i.length-1],e??10)},n.tickFormat=function(e,i){var r=t();return mx(r[0],r[r.length-1],e??10,i)},n.nice=function(e){e==null&&(e=10);var i=t(),r=0,o=i.length-1,s=i[r],a=i[o],l,c,h=10;for(a<s&&(c=s,s=a,a=c,c=r,r=o,o=c);h-- >0;){if(c=xa(s,a,e),c===l)return i[r]=s,i[o]=a,t(i);if(c>0)s=Math.floor(s/c)*c,a=Math.ceil(a/c)*c;else if(c<0)s=Math.ceil(s*c)/c,a=Math.floor(a*c)/c;else break;l=c}return n},n}function ke(){var n=au();return n.copy=function(){return _o(n,ke())},gi.apply(n,arguments),Ca(n)}function pu(n,t){n=n.slice();var e=0,i=n.length-1,r=n[e],o=n[i],s;return o<r&&(s=e,e=i,i=s,s=r,r=o,o=s),n[e]=t.floor(r),n[i]=t.ceil(o),n}function gu(n){return Math.log(n)}function mu(n){return Math.exp(n)}function yx(n){return-Math.log(-n)}function xx(n){return-Math.exp(-n)}function bx(n){return isFinite(n)?+("1e"+n):n<0?0:n}function vx(n){return n===10?bx:n===Math.E?Math.exp:t=>Math.pow(n,t)}function wx(n){return n===Math.E?Math.log:n===10&&Math.log10||n===2&&Math.log2||(n=Math.log(n),t=>Math.log(t)/n)}function yu(n){return(t,e)=>-n(-t,e)}function kx(n){const t=n(gu,mu),e=t.domain;let i=10,r,o;function s(){return r=wx(i),o=vx(i),e()[0]<0?(r=yu(r),o=yu(o),n(yx,xx)):n(gu,mu),t}return t.base=function(a){return arguments.length?(i=+a,s()):i},t.domain=function(a){return arguments.length?(e(a),s()):e()},t.ticks=a=>{const l=e();let c=l[0],h=l[l.length-1];const f=h<c;f&&([c,h]=[h,c]);let u=r(c),d=r(h),p,y;const g=a==null?10:+a;let m=[];if(!(i%1)&&d-u<g){if(u=Math.floor(u),d=Math.ceil(d),c>0){for(;u<=d;++u)for(p=1;p<i;++p)if(y=u<0?p/o(-u):p*o(u),!(y<c)){if(y>h)break;m.push(y)}}else for(;u<=d;++u)for(p=i-1;p>=1;--p)if(y=u>0?p/o(-u):p*o(u),!(y<c)){if(y>h)break;m.push(y)}m.length*2<g&&(m=ya(c,h,g))}else m=ya(u,d,Math.min(d-u,g)).map(o);return f?m.reverse():m},t.tickFormat=(a,l)=>{if(a==null&&(a=10),l==null&&(l=i===10?"s":","),typeof l!="function"&&(!(i%1)&&(l=fr(l)).precision==null&&(l.trim=!0),l=dr(l)),a===1/0)return l;const c=Math.max(1,i*a/t.ticks().length);return h=>{let f=h/o(Math.round(r(h)));return f*i<i-.5&&(f*=i),f<=c?l(h):""}},t.nice=()=>e(pu(e(),{floor:a=>o(Math.floor(r(a))),ceil:a=>o(Math.ceil(r(a)))})),t}function To(){const n=kx(Sa()).domain([1,10]);return n.copy=()=>_o(n,To()).base(n.base()),gi.apply(n,arguments),n}function xu(n){return function(t){return t<0?-Math.pow(-t,n):Math.pow(t,n)}}function Mx(n){return n<0?-Math.sqrt(-n):Math.sqrt(n)}function Ax(n){return n<0?-n*n:n*n}function Sx(n){var t=n(en,en),e=1;function i(){return e===1?n(en,en):e===.5?n(Mx,Ax):n(xu(e),xu(1/e))}return t.exponent=function(r){return arguments.length?(e=+r,i()):e},Ca(t)}function bu(){var n=Sx(Sa());return n.copy=function(){return _o(n,bu()).exponent(n.exponent())},gi.apply(n,arguments),n}function _x(){return bu.apply(null,arguments).exponent(.5)}const Pa=new Date,Ea=new Date;function le(n,t,e,i){function r(o){return n(o=arguments.length===0?new Date:new Date(+o)),o}return r.floor=o=>(n(o=new Date(+o)),o),r.ceil=o=>(n(o=new Date(o-1)),t(o,1),n(o),o),r.round=o=>{const s=r(o),a=r.ceil(o);return o-s<a-o?s:a},r.offset=(o,s)=>(t(o=new Date(+o),s==null?1:Math.floor(s)),o),r.range=(o,s,a)=>{const l=[];if(o=r.ceil(o),a=a==null?1:Math.floor(a),!(o<s)||!(a>0))return l;let c;do l.push(c=new Date(+o)),t(o,a),n(o);while(c<o&&o<s);return l},r.filter=o=>le(s=>{if(s>=s)for(;n(s),!o(s);)s.setTime(s-1)},(s,a)=>{if(s>=s)if(a<0)for(;++a<=0;)for(;t(s,-1),!o(s););else for(;--a>=0;)for(;t(s,1),!o(s););}),e&&(r.count=(o,s)=>(Pa.setTime(+o),Ea.setTime(+s),n(Pa),n(Ea),Math.floor(e(Pa,Ea))),r.every=o=>(o=Math.floor(o),!isFinite(o)||!(o>0)?null:o>1?r.filter(i?s=>i(s)%o===0:s=>r.count(0,s)%o===0):r)),r}const $o=le(()=>{},(n,t)=>{n.setTime(+n+t)},(n,t)=>t-n);$o.every=n=>(n=Math.floor(n),!isFinite(n)||!(n>0)?null:n>1?le(t=>{t.setTime(Math.floor(t/n)*n)},(t,e)=>{t.setTime(+t+e*n)},(t,e)=>(e-t)/n):$o),$o.range;const $n=1e3,nn=$n*60,Ln=nn*60,In=Ln*24,Ta=In*7,vu=In*30,$a=In*365,yi=le(n=>{n.setTime(n-n.getMilliseconds())},(n,t)=>{n.setTime(+n+t*$n)},(n,t)=>(t-n)/$n,n=>n.getUTCSeconds());yi.range;const La=le(n=>{n.setTime(n-n.getMilliseconds()-n.getSeconds()*$n)},(n,t)=>{n.setTime(+n+t*nn)},(n,t)=>(t-n)/nn,n=>n.getMinutes());La.range;const Ia=le(n=>{n.setUTCSeconds(0,0)},(n,t)=>{n.setTime(+n+t*nn)},(n,t)=>(t-n)/nn,n=>n.getUTCMinutes());Ia.range;const Fa=le(n=>{n.setTime(n-n.getMilliseconds()-n.getSeconds()*$n-n.getMinutes()*nn)},(n,t)=>{n.setTime(+n+t*Ln)},(n,t)=>(t-n)/Ln,n=>n.getHours());Fa.range;const Da=le(n=>{n.setUTCMinutes(0,0,0)},(n,t)=>{n.setTime(+n+t*Ln)},(n,t)=>(t-n)/Ln,n=>n.getUTCHours());Da.range;const pr=le(n=>n.setHours(0,0,0,0),(n,t)=>n.setDate(n.getDate()+t),(n,t)=>(t-n-(t.getTimezoneOffset()-n.getTimezoneOffset())*nn)/In,n=>n.getDate()-1);pr.range;const Lo=le(n=>{n.setUTCHours(0,0,0,0)},(n,t)=>{n.setUTCDate(n.getUTCDate()+t)},(n,t)=>(t-n)/In,n=>n.getUTCDate()-1);Lo.range;const wu=le(n=>{n.setUTCHours(0,0,0,0)},(n,t)=>{n.setUTCDate(n.getUTCDate()+t)},(n,t)=>(t-n)/In,n=>Math.floor(n/In));wu.range;function xi(n){return le(t=>{t.setDate(t.getDate()-(t.getDay()+7-n)%7),t.setHours(0,0,0,0)},(t,e)=>{t.setDate(t.getDate()+e*7)},(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*nn)/Ta)}const Io=xi(0),Fo=xi(1),Cx=xi(2),Px=xi(3),Di=xi(4),Ex=xi(5),Tx=xi(6);Io.range,Fo.range,Cx.range,Px.range,Di.range,Ex.range,Tx.range;function bi(n){return le(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-n)%7),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e*7)},(t,e)=>(e-t)/Ta)}const Do=bi(0),Ro=bi(1),$x=bi(2),Lx=bi(3),Ri=bi(4),Ix=bi(5),Fx=bi(6);Do.range,Ro.range,$x.range,Lx.range,Ri.range,Ix.range,Fx.range;const Ra=le(n=>{n.setDate(1),n.setHours(0,0,0,0)},(n,t)=>{n.setMonth(n.getMonth()+t)},(n,t)=>t.getMonth()-n.getMonth()+(t.getFullYear()-n.getFullYear())*12,n=>n.getMonth());Ra.range;const za=le(n=>{n.setUTCDate(1),n.setUTCHours(0,0,0,0)},(n,t)=>{n.setUTCMonth(n.getUTCMonth()+t)},(n,t)=>t.getUTCMonth()-n.getUTCMonth()+(t.getUTCFullYear()-n.getUTCFullYear())*12,n=>n.getUTCMonth());za.range;const Fn=le(n=>{n.setMonth(0,1),n.setHours(0,0,0,0)},(n,t)=>{n.setFullYear(n.getFullYear()+t)},(n,t)=>t.getFullYear()-n.getFullYear(),n=>n.getFullYear());Fn.every=n=>!isFinite(n=Math.floor(n))||!(n>0)?null:le(t=>{t.setFullYear(Math.floor(t.getFullYear()/n)*n),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,e)=>{t.setFullYear(t.getFullYear()+e*n)}),Fn.range;const Dn=le(n=>{n.setUTCMonth(0,1),n.setUTCHours(0,0,0,0)},(n,t)=>{n.setUTCFullYear(n.getUTCFullYear()+t)},(n,t)=>t.getUTCFullYear()-n.getUTCFullYear(),n=>n.getUTCFullYear());Dn.every=n=>!isFinite(n=Math.floor(n))||!(n>0)?null:le(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/n)*n),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e*n)}),Dn.range;function ku(n,t,e,i,r,o){const s=[[yi,1,$n],[yi,5,5*$n],[yi,15,15*$n],[yi,30,30*$n],[o,1,nn],[o,5,5*nn],[o,15,15*nn],[o,30,30*nn],[r,1,Ln],[r,3,3*Ln],[r,6,6*Ln],[r,12,12*Ln],[i,1,In],[i,2,2*In],[e,1,Ta],[t,1,vu],[t,3,3*vu],[n,1,$a]];function a(c,h,f){const u=h<c;u&&([c,h]=[h,c]);const d=f&&typeof f.range=="function"?f:l(c,h,f),p=d?d.range(c,+h+1):[];return u?p.reverse():p}function l(c,h,f){const u=Math.abs(h-c)/f,d=ma(([,,g])=>g).right(s,u);if(d===s.length)return n.every(ba(c/$a,h/$a,f));if(d===0)return $o.every(Math.max(ba(c,h,f),1));const[p,y]=s[u/s[d-1][2]<s[d][2]/u?d-1:d];return p.every(y)}return[a,l]}const[Dx,Rx]=ku(Dn,za,Do,wu,Da,Ia),[zx,Bx]=ku(Fn,Ra,Io,pr,Fa,La);function Ba(n){if(0<=n.y&&n.y<100){var t=new Date(-1,n.m,n.d,n.H,n.M,n.S,n.L);return t.setFullYear(n.y),t}return new Date(n.y,n.m,n.d,n.H,n.M,n.S,n.L)}function Oa(n){if(0<=n.y&&n.y<100){var t=new Date(Date.UTC(-1,n.m,n.d,n.H,n.M,n.S,n.L));return t.setUTCFullYear(n.y),t}return new Date(Date.UTC(n.y,n.m,n.d,n.H,n.M,n.S,n.L))}function gr(n,t,e){return{y:n,m:t,d:e,H:0,M:0,S:0,L:0}}function Ox(n){var t=n.dateTime,e=n.date,i=n.time,r=n.periods,o=n.days,s=n.shortDays,a=n.months,l=n.shortMonths,c=mr(r),h=yr(r),f=mr(o),u=yr(o),d=mr(s),p=yr(s),y=mr(a),g=yr(a),m=mr(l),x=yr(l),v={a:$,A:D,b:F,B:R,c:null,d:Pu,e:Pu,f:c1,g:x1,G:v1,H:o1,I:s1,j:a1,L:Eu,m:l1,M:h1,p:z,q:B,Q:Du,s:Ru,S:u1,u:f1,U:d1,V:p1,w:g1,W:m1,x:null,X:null,y:y1,Y:b1,Z:w1,"%":Fu},b={a:H,A:J,b:X,B:q,c:null,d:$u,e:$u,f:S1,g:D1,G:z1,H:k1,I:M1,j:A1,L:Lu,m:_1,M:C1,p:W,q:U,Q:Du,s:Ru,S:P1,u:E1,U:T1,V:$1,w:L1,W:I1,x:null,X:null,y:F1,Y:R1,Z:B1,"%":Fu},k={a:T,A:I,b:E,B:P,c:S,d:_u,e:_u,f:e1,g:Su,G:Au,H:Cu,I:Cu,j:Kx,L:t1,m:Zx,M:Jx,p:_,q:qx,Q:i1,s:r1,S:Qx,u:Gx,U:Yx,V:Xx,w:Vx,W:Ux,x:w,X:A,y:Su,Y:Au,Z:jx,"%":n1};v.x=M(e,v),v.X=M(i,v),v.c=M(t,v),b.x=M(e,b),b.X=M(i,b),b.c=M(t,b);function M(G,N){return function(Y){var O=[],ct=-1,it=0,ft=G.length,dt,at,ot;for(Y instanceof Date||(Y=new Date(+Y));++ct<ft;)G.charCodeAt(ct)===37&&(O.push(G.slice(it,ct)),(at=Mu[dt=G.charAt(++ct)])!=null?dt=G.charAt(++ct):at=dt==="e"?" ":"0",(ot=N[dt])&&(dt=ot(Y,at)),O.push(dt),it=ct+1);return O.push(G.slice(it,ct)),O.join("")}}function C(G,N){return function(Y){var O=gr(1900,void 0,1),ct=L(O,G,Y+="",0),it,ft;if(ct!=Y.length)return null;if("Q"in O)return new Date(O.Q);if("s"in O)return new Date(O.s*1e3+("L"in O?O.L:0));if(N&&!("Z"in O)&&(O.Z=0),"p"in O&&(O.H=O.H%12+O.p*12),O.m===void 0&&(O.m="q"in O?O.q:0),"V"in O){if(O.V<1||O.V>53)return null;"w"in O||(O.w=1),"Z"in O?(it=Oa(gr(O.y,0,1)),ft=it.getUTCDay(),it=ft>4||ft===0?Ro.ceil(it):Ro(it),it=Lo.offset(it,(O.V-1)*7),O.y=it.getUTCFullYear(),O.m=it.getUTCMonth(),O.d=it.getUTCDate()+(O.w+6)%7):(it=Ba(gr(O.y,0,1)),ft=it.getDay(),it=ft>4||ft===0?Fo.ceil(it):Fo(it),it=pr.offset(it,(O.V-1)*7),O.y=it.getFullYear(),O.m=it.getMonth(),O.d=it.getDate()+(O.w+6)%7)}else("W"in O||"U"in O)&&("w"in O||(O.w="u"in O?O.u%7:"W"in O?1:0),ft="Z"in O?Oa(gr(O.y,0,1)).getUTCDay():Ba(gr(O.y,0,1)).getDay(),O.m=0,O.d="W"in O?(O.w+6)%7+O.W*7-(ft+5)%7:O.w+O.U*7-(ft+6)%7);return"Z"in O?(O.H+=O.Z/100|0,O.M+=O.Z%100,Oa(O)):Ba(O)}}function L(G,N,Y,O){for(var ct=0,it=N.length,ft=Y.length,dt,at;ct<it;){if(O>=ft)return-1;if(dt=N.charCodeAt(ct++),dt===37){if(dt=N.charAt(ct++),at=k[dt in Mu?N.charAt(ct++):dt],!at||(O=at(G,Y,O))<0)return-1}else if(dt!=Y.charCodeAt(O++))return-1}return O}function _(G,N,Y){var O=c.exec(N.slice(Y));return O?(G.p=h.get(O[0].toLowerCase()),Y+O[0].length):-1}function T(G,N,Y){var O=d.exec(N.slice(Y));return O?(G.w=p.get(O[0].toLowerCase()),Y+O[0].length):-1}function I(G,N,Y){var O=f.exec(N.slice(Y));return O?(G.w=u.get(O[0].toLowerCase()),Y+O[0].length):-1}function E(G,N,Y){var O=m.exec(N.slice(Y));return O?(G.m=x.get(O[0].toLowerCase()),Y+O[0].length):-1}function P(G,N,Y){var O=y.exec(N.slice(Y));return O?(G.m=g.get(O[0].toLowerCase()),Y+O[0].length):-1}function S(G,N,Y){return L(G,t,N,Y)}function w(G,N,Y){return L(G,e,N,Y)}function A(G,N,Y){return L(G,i,N,Y)}function $(G){return s[G.getDay()]}function D(G){return o[G.getDay()]}function F(G){return l[G.getMonth()]}function R(G){return a[G.getMonth()]}function z(G){return r[+(G.getHours()>=12)]}function B(G){return 1+~~(G.getMonth()/3)}function H(G){return s[G.getUTCDay()]}function J(G){return o[G.getUTCDay()]}function X(G){return l[G.getUTCMonth()]}function q(G){return a[G.getUTCMonth()]}function W(G){return r[+(G.getUTCHours()>=12)]}function U(G){return 1+~~(G.getUTCMonth()/3)}return{format:function(G){var N=M(G+="",v);return N.toString=function(){return G},N},parse:function(G){var N=C(G+="",!1);return N.toString=function(){return G},N},utcFormat:function(G){var N=M(G+="",b);return N.toString=function(){return G},N},utcParse:function(G){var N=C(G+="",!0);return N.toString=function(){return G},N}}}var Mu={"-":"",_:" ",0:"0"},fe=/^\s*\d+/,Nx=/^%/,Wx=/[\\^$*+?|[\]().{}]/g;function Yt(n,t,e){var i=n<0?"-":"",r=(i?-n:n)+"",o=r.length;return i+(o<e?new Array(e-o+1).join(t)+r:r)}function Hx(n){return n.replace(Wx,"\\$&")}function mr(n){return new RegExp("^(?:"+n.map(Hx).join("|")+")","i")}function yr(n){return new Map(n.map((t,e)=>[t.toLowerCase(),e]))}function Vx(n,t,e){var i=fe.exec(t.slice(e,e+1));return i?(n.w=+i[0],e+i[0].length):-1}function Gx(n,t,e){var i=fe.exec(t.slice(e,e+1));return i?(n.u=+i[0],e+i[0].length):-1}function Yx(n,t,e){var i=fe.exec(t.slice(e,e+2));return i?(n.U=+i[0],e+i[0].length):-1}function Xx(n,t,e){var i=fe.exec(t.slice(e,e+2));return i?(n.V=+i[0],e+i[0].length):-1}function Ux(n,t,e){var i=fe.exec(t.slice(e,e+2));return i?(n.W=+i[0],e+i[0].length):-1}function Au(n,t,e){var i=fe.exec(t.slice(e,e+4));return i?(n.y=+i[0],e+i[0].length):-1}function Su(n,t,e){var i=fe.exec(t.slice(e,e+2));return i?(n.y=+i[0]+(+i[0]>68?1900:2e3),e+i[0].length):-1}function jx(n,t,e){var i=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(e,e+6));return i?(n.Z=i[1]?0:-(i[2]+(i[3]||"00")),e+i[0].length):-1}function qx(n,t,e){var i=fe.exec(t.slice(e,e+1));return i?(n.q=i[0]*3-3,e+i[0].length):-1}function Zx(n,t,e){var i=fe.exec(t.slice(e,e+2));return i?(n.m=i[0]-1,e+i[0].length):-1}function _u(n,t,e){var i=fe.exec(t.slice(e,e+2));return i?(n.d=+i[0],e+i[0].length):-1}function Kx(n,t,e){var i=fe.exec(t.slice(e,e+3));return i?(n.m=0,n.d=+i[0],e+i[0].length):-1}function Cu(n,t,e){var i=fe.exec(t.slice(e,e+2));return i?(n.H=+i[0],e+i[0].length):-1}function Jx(n,t,e){var i=fe.exec(t.slice(e,e+2));return i?(n.M=+i[0],e+i[0].length):-1}function Qx(n,t,e){var i=fe.exec(t.slice(e,e+2));return i?(n.S=+i[0],e+i[0].length):-1}function t1(n,t,e){var i=fe.exec(t.slice(e,e+3));return i?(n.L=+i[0],e+i[0].length):-1}function e1(n,t,e){var i=fe.exec(t.slice(e,e+6));return i?(n.L=Math.floor(i[0]/1e3),e+i[0].length):-1}function n1(n,t,e){var i=Nx.exec(t.slice(e,e+1));return i?e+i[0].length:-1}function i1(n,t,e){var i=fe.exec(t.slice(e));return i?(n.Q=+i[0],e+i[0].length):-1}function r1(n,t,e){var i=fe.exec(t.slice(e));return i?(n.s=+i[0],e+i[0].length):-1}function Pu(n,t){return Yt(n.getDate(),t,2)}function o1(n,t){return Yt(n.getHours(),t,2)}function s1(n,t){return Yt(n.getHours()%12||12,t,2)}function a1(n,t){return Yt(1+pr.count(Fn(n),n),t,3)}function Eu(n,t){return Yt(n.getMilliseconds(),t,3)}function c1(n,t){return Eu(n,t)+"000"}function l1(n,t){return Yt(n.getMonth()+1,t,2)}function h1(n,t){return Yt(n.getMinutes(),t,2)}function u1(n,t){return Yt(n.getSeconds(),t,2)}function f1(n){var t=n.getDay();return t===0?7:t}function d1(n,t){return Yt(Io.count(Fn(n)-1,n),t,2)}function Tu(n){var t=n.getDay();return t>=4||t===0?Di(n):Di.ceil(n)}function p1(n,t){return n=Tu(n),Yt(Di.count(Fn(n),n)+(Fn(n).getDay()===4),t,2)}function g1(n){return n.getDay()}function m1(n,t){return Yt(Fo.count(Fn(n)-1,n),t,2)}function y1(n,t){return Yt(n.getFullYear()%100,t,2)}function x1(n,t){return n=Tu(n),Yt(n.getFullYear()%100,t,2)}function b1(n,t){return Yt(n.getFullYear()%1e4,t,4)}function v1(n,t){var e=n.getDay();return n=e>=4||e===0?Di(n):Di.ceil(n),Yt(n.getFullYear()%1e4,t,4)}function w1(n){var t=n.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+Yt(t/60|0,"0",2)+Yt(t%60,"0",2)}function $u(n,t){return Yt(n.getUTCDate(),t,2)}function k1(n,t){return Yt(n.getUTCHours(),t,2)}function M1(n,t){return Yt(n.getUTCHours()%12||12,t,2)}function A1(n,t){return Yt(1+Lo.count(Dn(n),n),t,3)}function Lu(n,t){return Yt(n.getUTCMilliseconds(),t,3)}function S1(n,t){return Lu(n,t)+"000"}function _1(n,t){return Yt(n.getUTCMonth()+1,t,2)}function C1(n,t){return Yt(n.getUTCMinutes(),t,2)}function P1(n,t){return Yt(n.getUTCSeconds(),t,2)}function E1(n){var t=n.getUTCDay();return t===0?7:t}function T1(n,t){return Yt(Do.count(Dn(n)-1,n),t,2)}function Iu(n){var t=n.getUTCDay();return t>=4||t===0?Ri(n):Ri.ceil(n)}function $1(n,t){return n=Iu(n),Yt(Ri.count(Dn(n),n)+(Dn(n).getUTCDay()===4),t,2)}function L1(n){return n.getUTCDay()}function I1(n,t){return Yt(Ro.count(Dn(n)-1,n),t,2)}function F1(n,t){return Yt(n.getUTCFullYear()%100,t,2)}function D1(n,t){return n=Iu(n),Yt(n.getUTCFullYear()%100,t,2)}function R1(n,t){return Yt(n.getUTCFullYear()%1e4,t,4)}function z1(n,t){var e=n.getUTCDay();return n=e>=4||e===0?Ri(n):Ri.ceil(n),Yt(n.getUTCFullYear()%1e4,t,4)}function B1(){return"+0000"}function Fu(){return"%"}function Du(n){return+n}function Ru(n){return Math.floor(+n/1e3)}var zi,zo,Bo;O1({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function O1(n){return zi=Ox(n),zo=zi.format,zi.parse,Bo=zi.utcFormat,zi.utcParse,zi}function N1(n){return new Date(n)}function W1(n){return n instanceof Date?+n:+new Date(+n)}function Na(n,t,e,i,r,o,s,a,l,c){var h=au(),f=h.invert,u=h.domain,d=c(".%L"),p=c(":%S"),y=c("%I:%M"),g=c("%I %p"),m=c("%a %d"),x=c("%b %d"),v=c("%B"),b=c("%Y");function k(M){return(l(M)<M?d:a(M)<M?p:s(M)<M?y:o(M)<M?g:i(M)<M?r(M)<M?m:x:e(M)<M?v:b)(M)}return h.invert=function(M){return new Date(f(M))},h.domain=function(M){return arguments.length?u(Array.from(M,W1)):u().map(N1)},h.ticks=function(M){var C=u();return n(C[0],C[C.length-1],M??10)},h.tickFormat=function(M,C){return C==null?k:c(C)},h.nice=function(M){var C=u();return(!M||typeof M.range!="function")&&(M=t(C[0],C[C.length-1],M??10)),M?u(pu(C,M)):h},h.copy=function(){return _o(h,Na(n,t,e,i,r,o,s,a,l,c))},h}function H1(){return gi.apply(Na(zx,Bx,Fn,Ra,Io,pr,Fa,La,yi,zo).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function V1(){return gi.apply(Na(Dx,Rx,Dn,za,Do,Lo,Da,Ia,yi,Bo).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function G1(){var n=0,t=1,e,i,r,o,s=en,a=!1,l;function c(f){return f==null||isNaN(f=+f)?l:s(r===0?.5:(f=(o(f)-e)*r,a?Math.max(0,Math.min(1,f)):f))}c.domain=function(f){return arguments.length?([n,t]=f,e=o(n=+n),i=o(t=+t),r=e===i?0:1/(i-e),c):[n,t]},c.clamp=function(f){return arguments.length?(a=!!f,c):a},c.interpolator=function(f){return arguments.length?(s=f,c):s};function h(f){return function(u){var d,p;return arguments.length?([d,p]=u,s=f(d,p),c):[s(0),s(1)]}}return c.range=h(ce),c.rangeRound=h(eu),c.unknown=function(f){return arguments.length?(l=f,c):l},function(f){return o=f,e=f(n),i=f(t),r=e===i?0:1/(i-e),c}}function Y1(n,t){return t.domain(n.domain()).interpolator(n.interpolator()).clamp(n.clamp()).unknown(n.unknown())}function zu(){var n=Ca(G1()(en));return n.copy=function(){return Y1(n,zu())},$y.apply(n,arguments)}function X1(n){return n}var Oo=1,No=2,Wa=3,xr=4,Bu=1e-6;function U1(n){return"translate("+n+",0)"}function j1(n){return"translate(0,"+n+")"}function q1(n){return t=>+n(t)}function Z1(n,t){return t=Math.max(0,n.bandwidth()-t*2)/2,n.round()&&(t=Math.round(t)),e=>+n(e)+t}function K1(){return!this.__axis}function Wo(n,t){var e=[],i=null,r=null,o=6,s=6,a=3,l=typeof window<"u"&&window.devicePixelRatio>1?0:.5,c=n===Oo||n===xr?-1:1,h=n===xr||n===No?"x":"y",f=n===Oo||n===Wa?U1:j1;function u(d){var p=i??(t.ticks?t.ticks.apply(t,e):t.domain()),y=r??(t.tickFormat?t.tickFormat.apply(t,e):X1),g=Math.max(o,0)+a,m=t.range(),x=+m[0]+l,v=+m[m.length-1]+l,b=(t.bandwidth?Z1:q1)(t.copy(),l),k=d.selection?d.selection():d,M=k.selectAll(".domain").data([null]),C=k.selectAll(".tick").data(p,t).order(),L=C.exit(),_=C.enter().append("g").attr("class","tick"),T=C.select("line"),I=C.select("text");M=M.merge(M.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),C=C.merge(_),T=T.merge(_.append("line").attr("stroke","currentColor").attr(h+"2",c*o)),I=I.merge(_.append("text").attr("fill","currentColor").attr(h,c*g).attr("dy",n===Oo?"0em":n===Wa?"0.71em":"0.32em")),d!==k&&(M=M.transition(d),C=C.transition(d),T=T.transition(d),I=I.transition(d),L=L.transition(d).attr("opacity",Bu).attr("transform",function(E){return isFinite(E=b(E))?f(E+l):this.getAttribute("transform")}),_.attr("opacity",Bu).attr("transform",function(E){var P=this.parentNode.__axis;return f((P&&isFinite(P=P(E))?P:b(E))+l)})),L.remove(),M.attr("d",n===xr||n===No?s?"M"+c*s+","+x+"H"+l+"V"+v+"H"+c*s:"M"+l+","+x+"V"+v:s?"M"+x+","+c*s+"V"+l+"H"+v+"V"+c*s:"M"+x+","+l+"H"+v),C.attr("opacity",1).attr("transform",function(E){return f(b(E)+l)}),T.attr(h+"2",c*o),I.attr(h,c*g).text(y),k.filter(K1).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",n===No?"start":n===xr?"end":"middle"),k.each(function(){this.__axis=b})}return u.scale=function(d){return arguments.length?(t=d,u):t},u.ticks=function(){return e=Array.from(arguments),u},u.tickArguments=function(d){return arguments.length?(e=d==null?[]:Array.from(d),u):e.slice()},u.tickValues=function(d){return arguments.length?(i=d==null?null:Array.from(d),u):i&&i.slice()},u.tickFormat=function(d){return arguments.length?(r=d,u):r},u.tickSize=function(d){return arguments.length?(o=s=+d,u):o},u.tickSizeInner=function(d){return arguments.length?(o=+d,u):o},u.tickSizeOuter=function(d){return arguments.length?(s=+d,u):s},u.tickPadding=function(d){return arguments.length?(a=+d,u):a},u.offset=function(d){return arguments.length?(l=+d,u):l},u}function Ha(n){return Wo(Oo,n)}function Ou(n){return Wo(No,n)}function Nu(n){return Wo(Wa,n)}function Wu(n){return Wo(xr,n)}var J1={value:()=>{}};function Bi(){for(var n=0,t=arguments.length,e={},i;n<t;++n){if(!(i=arguments[n]+"")||i in e||/[\s.]/.test(i))throw new Error("illegal type: "+i);e[i]=[]}return new Ho(e)}function Ho(n){this._=n}function Q1(n,t){return n.trim().split(/^|\s+/).map(function(e){var i="",r=e.indexOf(".");if(r>=0&&(i=e.slice(r+1),e=e.slice(0,r)),e&&!t.hasOwnProperty(e))throw new Error("unknown type: "+e);return{type:e,name:i}})}Ho.prototype=Bi.prototype={constructor:Ho,on:function(n,t){var e=this._,i=Q1(n+"",e),r,o=-1,s=i.length;if(arguments.length<2){for(;++o<s;)if((r=(n=i[o]).type)&&(r=tb(e[r],n.name)))return r;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++o<s;)if(r=(n=i[o]).type)e[r]=Hu(e[r],n.name,t);else if(t==null)for(r in e)e[r]=Hu(e[r],n.name,null);return this},copy:function(){var n={},t=this._;for(var e in t)n[e]=t[e].slice();return new Ho(n)},call:function(n,t){if((r=arguments.length-2)>0)for(var e=new Array(r),i=0,r,o;i<r;++i)e[i]=arguments[i+2];if(!this._.hasOwnProperty(n))throw new Error("unknown type: "+n);for(o=this._[n],i=0,r=o.length;i<r;++i)o[i].value.apply(t,e)},apply:function(n,t,e){if(!this._.hasOwnProperty(n))throw new Error("unknown type: "+n);for(var i=this._[n],r=0,o=i.length;r<o;++r)i[r].value.apply(t,e)}};function tb(n,t){for(var e=0,i=n.length,r;e<i;++e)if((r=n[e]).name===t)return r.value}function Hu(n,t,e){for(var i=0,r=n.length;i<r;++i)if(n[i].name===t){n[i]=J1,n=n.slice(0,i).concat(n.slice(i+1));break}return e!=null&&n.push({name:t,value:e}),n}var Oi=0,br=0,vr=0,Vu=1e3,Vo,wr,Go=0,vi=0,Yo=0,kr=typeof performance=="object"&&performance.now?performance:Date,Gu=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(n){setTimeout(n,17)};function Va(){return vi||(Gu(eb),vi=kr.now()+Yo)}function eb(){vi=0}function Xo(){this._call=this._time=this._next=null}Xo.prototype=Uo.prototype={constructor:Xo,restart:function(n,t,e){if(typeof n!="function")throw new TypeError("callback is not a function");e=(e==null?Va():+e)+(t==null?0:+t),!this._next&&wr!==this&&(wr?wr._next=this:Vo=this,wr=this),this._call=n,this._time=e,Ga()},stop:function(){this._call&&(this._call=null,this._time=1/0,Ga())}};function Uo(n,t,e){var i=new Xo;return i.restart(n,t,e),i}function nb(){Va(),++Oi;for(var n=Vo,t;n;)(t=vi-n._time)>=0&&n._call.call(void 0,t),n=n._next;--Oi}function Yu(){vi=(Go=kr.now())+Yo,Oi=br=0;try{nb()}finally{Oi=0,rb(),vi=0}}function ib(){var n=kr.now(),t=n-Go;t>Vu&&(Yo-=t,Go=n)}function rb(){for(var n,t=Vo,e,i=1/0;t;)t._call?(i>t._time&&(i=t._time),n=t,t=t._next):(e=t._next,t._next=null,t=n?n._next=e:Vo=e);wr=n,Ga(i)}function Ga(n){if(!Oi){br&&(br=clearTimeout(br));var t=n-vi;t>24?(n<1/0&&(br=setTimeout(Yu,n-kr.now()-Yo)),vr&&(vr=clearInterval(vr))):(vr||(Go=kr.now(),vr=setInterval(ib,Vu)),Oi=1,Gu(Yu))}}function Xu(n,t,e){var i=new Xo;return t=t==null?0:+t,i.restart(r=>{i.stop(),n(r+t)},t,e),i}var ob=Bi("start","end","cancel","interrupt"),sb=[],Uu=0,ju=1,Ya=2,jo=3,qu=4,Xa=5,qo=6;function Zo(n,t,e,i,r,o){var s=n.__transition;if(!s)n.__transition={};else if(e in s)return;ab(n,e,{name:t,index:i,group:r,on:ob,tween:sb,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:Uu})}function Ua(n,t){var e=mn(n,t);if(e.state>Uu)throw new Error("too late; already scheduled");return e}function vn(n,t){var e=mn(n,t);if(e.state>jo)throw new Error("too late; already running");return e}function mn(n,t){var e=n.__transition;if(!e||!(e=e[t]))throw new Error("transition not found");return e}function ab(n,t,e){var i=n.__transition,r;i[t]=e,e.timer=Uo(o,0,e.time);function o(c){e.state=ju,e.timer.restart(s,e.delay,e.time),e.delay<=c&&s(c-e.delay)}function s(c){var h,f,u,d;if(e.state!==ju)return l();for(h in i)if(d=i[h],d.name===e.name){if(d.state===jo)return Xu(s);d.state===qu?(d.state=qo,d.timer.stop(),d.on.call("interrupt",n,n.__data__,d.index,d.group),delete i[h]):+h<t&&(d.state=qo,d.timer.stop(),d.on.call("cancel",n,n.__data__,d.index,d.group),delete i[h])}if(Xu(function(){e.state===jo&&(e.state=qu,e.timer.restart(a,e.delay,e.time),a(c))}),e.state=Ya,e.on.call("start",n,n.__data__,e.index,e.group),e.state===Ya){for(e.state=jo,r=new Array(u=e.tween.length),h=0,f=-1;h<u;++h)(d=e.tween[h].value.call(n,n.__data__,e.index,e.group))&&(r[++f]=d);r.length=f+1}}function a(c){for(var h=c<e.duration?e.ease.call(null,c/e.duration):(e.timer.restart(l),e.state=Xa,1),f=-1,u=r.length;++f<u;)r[f].call(n,h);e.state===Xa&&(e.on.call("end",n,n.__data__,e.index,e.group),l())}function l(){e.state=qo,e.timer.stop(),delete i[t];for(var c in i)return;delete n.__transition}}function Ni(n,t){var e=n.__transition,i,r,o=!0,s;if(e){t=t==null?null:t+"";for(s in e){if((i=e[s]).name!==t){o=!1;continue}r=i.state>Ya&&i.state<Xa,i.state=qo,i.timer.stop(),i.on.call(r?"interrupt":"cancel",n,n.__data__,i.index,i.group),delete e[s]}o&&delete n.__transition}}function cb(n){return this.each(function(){Ni(this,n)})}function lb(n,t){var e,i;return function(){var r=vn(this,n),o=r.tween;if(o!==e){i=e=o;for(var s=0,a=i.length;s<a;++s)if(i[s].name===t){i=i.slice(),i.splice(s,1);break}}r.tween=i}}function hb(n,t,e){var i,r;if(typeof e!="function")throw new Error;return function(){var o=vn(this,n),s=o.tween;if(s!==i){r=(i=s).slice();for(var a={name:t,value:e},l=0,c=r.length;l<c;++l)if(r[l].name===t){r[l]=a;break}l===c&&r.push(a)}o.tween=r}}function ub(n,t){var e=this._id;if(n+="",arguments.length<2){for(var i=mn(this.node(),e).tween,r=0,o=i.length,s;r<o;++r)if((s=i[r]).name===n)return s.value;return null}return this.each((t==null?lb:hb)(e,n,t))}function ja(n,t,e){var i=n._id;return n.each(function(){var r=vn(this,i);(r.value||(r.value={}))[t]=e.apply(this,arguments)}),function(r){return mn(r,i).value[t]}}function Zu(n,t){var e;return(typeof t=="number"?gn:t instanceof se?mi:(e=se(t))?(t=e,mi):tu)(n,t)}function fb(n){return function(){this.removeAttribute(n)}}function db(n){return function(){this.removeAttributeNS(n.space,n.local)}}function pb(n,t,e){var i,r=e+"",o;return function(){var s=this.getAttribute(n);return s===r?null:s===i?o:o=t(i=s,e)}}function gb(n,t,e){var i,r=e+"",o;return function(){var s=this.getAttributeNS(n.space,n.local);return s===r?null:s===i?o:o=t(i=s,e)}}function mb(n,t,e){var i,r,o;return function(){var s,a=e(this),l;return a==null?void this.removeAttribute(n):(s=this.getAttribute(n),l=a+"",s===l?null:s===i&&l===r?o:(r=l,o=t(i=s,a)))}}function yb(n,t,e){var i,r,o;return function(){var s,a=e(this),l;return a==null?void this.removeAttributeNS(n.space,n.local):(s=this.getAttributeNS(n.space,n.local),l=a+"",s===l?null:s===i&&l===r?o:(r=l,o=t(i=s,a)))}}function xb(n,t){var e=vo(n),i=e==="transform"?qy:Zu;return this.attrTween(n,typeof t=="function"?(e.local?yb:mb)(e,i,ja(this,"attr."+n,t)):t==null?(e.local?db:fb)(e):(e.local?gb:pb)(e,i,t))}function bb(n,t){return function(e){this.setAttribute(n,t.call(this,e))}}function vb(n,t){return function(e){this.setAttributeNS(n.space,n.local,t.call(this,e))}}function wb(n,t){var e,i;function r(){var o=t.apply(this,arguments);return o!==i&&(e=(i=o)&&vb(n,o)),e}return r._value=t,r}function kb(n,t){var e,i;function r(){var o=t.apply(this,arguments);return o!==i&&(e=(i=o)&&bb(n,o)),e}return r._value=t,r}function Mb(n,t){var e="attr."+n;if(arguments.length<2)return(e=this.tween(e))&&e._value;if(t==null)return this.tween(e,null);if(typeof t!="function")throw new Error;var i=vo(n);return this.tween(e,(i.local?wb:kb)(i,t))}function Ab(n,t){return function(){Ua(this,n).delay=+t.apply(this,arguments)}}function Sb(n,t){return t=+t,function(){Ua(this,n).delay=t}}function _b(n){var t=this._id;return arguments.length?this.each((typeof n=="function"?Ab:Sb)(t,n)):mn(this.node(),t).delay}function Cb(n,t){return function(){vn(this,n).duration=+t.apply(this,arguments)}}function Pb(n,t){return t=+t,function(){vn(this,n).duration=t}}function Eb(n){var t=this._id;return arguments.length?this.each((typeof n=="function"?Cb:Pb)(t,n)):mn(this.node(),t).duration}function Tb(n,t){if(typeof t!="function")throw new Error;return function(){vn(this,n).ease=t}}function $b(n){var t=this._id;return arguments.length?this.each(Tb(t,n)):mn(this.node(),t).ease}function Lb(n,t){return function(){var e=t.apply(this,arguments);if(typeof e!="function")throw new Error;vn(this,n).ease=e}}function Ib(n){if(typeof n!="function")throw new Error;return this.each(Lb(this._id,n))}function Fb(n){typeof n!="function"&&(n=Fh(n));for(var t=this._groups,e=t.length,i=new Array(e),r=0;r<e;++r)for(var o=t[r],s=o.length,a=i[r]=[],l,c=0;c<s;++c)(l=o[c])&&n.call(l,l.__data__,c,o)&&a.push(l);return new Rn(i,this._parents,this._name,this._id)}function Db(n){if(n._id!==this._id)throw new Error;for(var t=this._groups,e=n._groups,i=t.length,r=e.length,o=Math.min(i,r),s=new Array(i),a=0;a<o;++a)for(var l=t[a],c=e[a],h=l.length,f=s[a]=new Array(h),u,d=0;d<h;++d)(u=l[d]||c[d])&&(f[d]=u);for(;a<i;++a)s[a]=t[a];return new Rn(s,this._parents,this._name,this._id)}function Rb(n){return(n+"").trim().split(/^|\s+/).every(function(t){var e=t.indexOf(".");return e>=0&&(t=t.slice(0,e)),!t||t==="start"})}function zb(n,t,e){var i,r,o=Rb(t)?Ua:vn;return function(){var s=o(this,n),a=s.on;a!==i&&(r=(i=a).copy()).on(t,e),s.on=r}}function Bb(n,t){var e=this._id;return arguments.length<2?mn(this.node(),e).on.on(n):this.each(zb(e,n,t))}function Ob(n){return function(){var t=this.parentNode;for(var e in this.__transition)if(+e!==n)return;t&&t.removeChild(this)}}function Nb(){return this.on("end.remove",Ob(this._id))}function Wb(n){var t=this._name,e=this._id;typeof n!="function"&&(n=pa(n));for(var i=this._groups,r=i.length,o=new Array(r),s=0;s<r;++s)for(var a=i[s],l=a.length,c=o[s]=new Array(l),h,f,u=0;u<l;++u)(h=a[u])&&(f=n.call(h,h.__data__,u,a))&&("__data__"in h&&(f.__data__=h.__data__),c[u]=f,Zo(c[u],t,e,u,c,mn(h,e)));return new Rn(o,this._parents,t,e)}function Hb(n){var t=this._name,e=this._id;typeof n!="function"&&(n=Ih(n));for(var i=this._groups,r=i.length,o=[],s=[],a=0;a<r;++a)for(var l=i[a],c=l.length,h,f=0;f<c;++f)if(h=l[f]){for(var u=n.call(h,h.__data__,f,l),d,p=mn(h,e),y=0,g=u.length;y<g;++y)(d=u[y])&&Zo(d,t,e,y,u,p);o.push(u),s.push(h)}return new Rn(o,s,t,e)}var Vb=ur.prototype.constructor;function Gb(){return new Vb(this._groups,this._parents)}function Yb(n,t){var e,i,r;return function(){var o=Ii(this,n),s=(this.style.removeProperty(n),Ii(this,n));return o===s?null:o===e&&s===i?r:r=t(e=o,i=s)}}function Ku(n){return function(){this.style.removeProperty(n)}}function Xb(n,t,e){var i,r=e+"",o;return function(){var s=Ii(this,n);return s===r?null:s===i?o:o=t(i=s,e)}}function Ub(n,t,e){var i,r,o;return function(){var s=Ii(this,n),a=e(this),l=a+"";return a==null&&(l=a=(this.style.removeProperty(n),Ii(this,n))),s===l?null:s===i&&l===r?o:(r=l,o=t(i=s,a))}}function jb(n,t){var e,i,r,o="style."+t,s="end."+o,a;return function(){var l=vn(this,n),c=l.on,h=l.value[o]==null?a||(a=Ku(t)):void 0;(c!==e||r!==h)&&(i=(e=c).copy()).on(s,r=h),l.on=i}}function qb(n,t,e){var i=(n+="")=="transform"?jy:Zu;return t==null?this.styleTween(n,Yb(n,i)).on("end.style."+n,Ku(n)):typeof t=="function"?this.styleTween(n,Ub(n,i,ja(this,"style."+n,t))).each(jb(this._id,n)):this.styleTween(n,Xb(n,i,t),e).on("end.style."+n,null)}function Zb(n,t,e){return function(i){this.style.setProperty(n,t.call(this,i),e)}}function Kb(n,t,e){var i,r;function o(){var s=t.apply(this,arguments);return s!==r&&(i=(r=s)&&Zb(n,s,e)),i}return o._value=t,o}function Jb(n,t,e){var i="style."+(n+="");if(arguments.length<2)return(i=this.tween(i))&&i._value;if(t==null)return this.tween(i,null);if(typeof t!="function")throw new Error;return this.tween(i,Kb(n,t,e??""))}function Qb(n){return function(){this.textContent=n}}function tv(n){return function(){var t=n(this);this.textContent=t??""}}function ev(n){return this.tween("text",typeof n=="function"?tv(ja(this,"text",n)):Qb(n==null?"":n+""))}function nv(n){return function(t){this.textContent=n.call(this,t)}}function iv(n){var t,e;function i(){var r=n.apply(this,arguments);return r!==e&&(t=(e=r)&&nv(r)),t}return i._value=n,i}function rv(n){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(n==null)return this.tween(t,null);if(typeof n!="function")throw new Error;return this.tween(t,iv(n))}function ov(){for(var n=this._name,t=this._id,e=Ju(),i=this._groups,r=i.length,o=0;o<r;++o)for(var s=i[o],a=s.length,l,c=0;c<a;++c)if(l=s[c]){var h=mn(l,t);Zo(l,n,e,c,s,{time:h.time+h.delay+h.duration,delay:0,duration:h.duration,ease:h.ease})}return new Rn(i,this._parents,n,e)}function sv(){var n,t,e=this,i=e._id,r=e.size();return new Promise(function(o,s){var a={value:s},l={value:function(){--r===0&&o()}};e.each(function(){var c=vn(this,i),h=c.on;h!==n&&(t=(n=h).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(l)),c.on=t}),r===0&&o()})}var av=0;function Rn(n,t,e,i){this._groups=n,this._parents=t,this._name=e,this._id=i}function Ju(){return++av}var zn=ur.prototype;Rn.prototype={constructor:Rn,select:Wb,selectAll:Hb,selectChild:zn.selectChild,selectChildren:zn.selectChildren,filter:Fb,merge:Db,selection:Gb,transition:ov,call:zn.call,nodes:zn.nodes,node:zn.node,size:zn.size,empty:zn.empty,each:zn.each,on:Bb,attr:xb,attrTween:Mb,style:qb,styleTween:Jb,text:ev,textTween:rv,remove:Nb,tween:ub,delay:_b,duration:Eb,ease:$b,easeVarying:Ib,end:sv,[Symbol.iterator]:zn[Symbol.iterator]};const Mr=n=>+n;function Qu(n){return--n*n*n+1}function cv(n){return((n*=2)<=1?n*n*n:(n-=2)*n*n+2)/2}var lv={time:null,delay:0,duration:250,ease:cv};function hv(n,t){for(var e;!(e=n.__transition)||!(e=e[t]);)if(!(n=n.parentNode))throw new Error(`transition ${t} not found`);return e}function uv(n){var t,e;n instanceof Rn?(t=n._id,n=n._name):(t=Ju(),(e=lv).time=Va(),n=n==null?null:n+"");for(var i=this._groups,r=i.length,o=0;o<r;++o)for(var s=i[o],a=s.length,l,c=0;c<a;++c)(l=s[c])&&Zo(l,n,t,c,s,e||hv(l,t));return new Rn(i,this._parents,n,t)}ur.prototype.interrupt=cb,ur.prototype.transition=uv;let qa=!0;function fv(n){qa=n}function Za(){return qa}const dv=Object.entries({"%A":"%A","%a":"%a","%d":"%d","%e":"%-d","%b":"%b","%B":"%B","%m":"%m","%y":"%y","%Y":"%Y","%H":"%H","%I":"%I","%k":"%-H","%l":"%-I","%M":"%M","%p":"%p","%P":"%p","%S":"%S","%L":"%L"}).map(([n,t])=>[new RegExp(n.replace("%","\\%"),"g"),t]),tf=new Map;function Ka(n,t){let e=tf.get(n);if(!e){e=n;for(const[r,o]of dv)e=e.replace(r,o);tf.set(n,e)}return(qa?Bo(e):zo(e))(new Date(t))}function Ko(n,t=-1,e=".",i=","){if(!Number.isFinite(n))return"0";if(t===-1){const l=n.toString(),c=l.indexOf(".");t=c===-1?0:l.length-c-1}const r=n.toFixed(t),[o,s]=r.split("."),a=o.replace(/\B(?=(\d{3})+(?!\d))/g,i);return s?`${a}${e}${s}`:a}const pv=[[1e12,"T"],[1e9,"G"],[1e6,"M"],[1e3,"k"]];function Ja(n){const t=Math.abs(n);if(t<1e3)return t===Math.floor(t)?Ko(n,0,".",","):n.toPrecision(4).replace(/\.?0+$/,"");for(const[e,i]of pv)if(t>=e){const r=n/e;return(r===Math.floor(r)?String(r):r.toPrecision(4).replace(/\.?0+$/,""))+i}return String(n)}const gv=/\{([^}]+)\}/g;function Kt(n,t,e=!1){return n.replace(gv,(i,r)=>{const o=r.indexOf(":");let s=r,a=null;o!==-1&&(s=r.slice(0,o),a=r.slice(o+1));const l=s.trim().split(".");let c=t;for(const f of l){if(c==null)return"";c=c[f]}if(c==null)return"";let h;if(a){const f=typeof c=="number"?c:parseFloat(String(c));if(isNaN(f))h=String(c);else try{h=dr(a)(f)}catch{h=String(c)}}else h=String(c);return e?qn(h):h})}const mv=/[&<>"']/g,yv={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function qn(n){return String(n).replace(mv,t=>yv[t])}const xv=/^[=+\-@\t\r]/,bv=/^-?\d+(?:[.,]\d+)?$/;function Jo(n,t=","){let e=n==null?"":String(n);return xv.test(e)&&!bv.test(e)&&(e="'"+e),(e.includes(t)||e.includes('"')||e.includes(`
2
2
  `)||e.includes("\r"))&&(e='"'+e.replace(/"/g,'""')+'"'),e}const vv=/^(#[0-9a-f]{3,8}|(rgb|rgba|hsl|hsla)\([\d.,%\s/]+\)|[a-z]+)$/i;function ef(n,t="#333"){const e=String(n).trim();return vv.test(e)?e:t}const wv=/<\/?[^>]+(>|$)/g,kv=/<br\s*\/?>/gi;function de(n){return n.replace(kv," ").replace(wv,"").trim()}function Qa(n,t){switch(n.type||"linear"){case"logarithmic":return new Av(n,t);case"datetime":return new Sv(n,t);case"category":return new nf(n,t);default:return new Mv(n,t)}}class Qo{constructor(t,e){this.config=t,this.plotArea=e}autoText(){return Pn(this.config._backgroundColor)}getRange(){const t=this.config._inverted;if(this.config.isX){if(t){const s=this.plotArea.height;return this.config.reversed?[s,0]:[0,s]}const o=this.plotArea.width;return this.config.reversed?[o,0]:[0,o]}if(t){const o=this.plotArea.width;return this.config.reversed?[o,0]:[0,o]}const e=this.getPaneBand(),i=e.top,r=e.top+e.height;return this.config.reversed?[i,r]:[r,i]}getPaneBand(){const t=this.plotArea.height,e=o=>{if(o==null)return null;if(typeof o=="number")return o;if(typeof o=="string"&&o.trim().endsWith("%"))return parseFloat(o)/100*t;const s=parseFloat(o);return Number.isFinite(s)?s:null},i=e(this.config.top)??0,r=e(this.config.height)??t-i;return{top:i,height:r}}createD3Axis(t){const e=this.config.isX,i=this.config.opposite,r=this.config._inverted;return e?r?i?Ou(t):Wu(t):i?Ha(t):Nu(t):r?i?Ha(t):Nu(t):i?Ou(t):Wu(t)}applyAxisStyles(t,e){var s,a,l,c,h,f,u,d,p;const i=this.config,r=i.tickLength??10,o=i.tickPosition||"outside";if(t.selectAll(".tick line").attr("stroke",i.tickColor||"#ccd6eb").attr("stroke-width",i.tickWidth??1),(r!==10||o==="inside")&&t.selectAll(".tick line").each(function(){const y=rt(this);if(i.isX){const g=i.opposite?-1:1;o==="inside"?y.attr("y1",0).attr("y2",-g*r):y.attr("y1",0).attr("y2",g*r)}else{const g=i.opposite?1:-1;o==="inside"?y.attr("x1",0).attr("x2",-g*r):y.attr("x1",0).attr("x2",g*r)}}),t.selectAll(".domain").attr("stroke",i.lineColor||"#ccd6eb").attr("stroke-width",i.lineWidth??1),((s=i.labels)==null?void 0:s.enabled)===!1)t.selectAll(".tick text").remove();else{const y=((a=i.labels)==null?void 0:a.style)||{};if(t.selectAll(".tick text").attr("fill",y.color||this.autoText()).style("font-size",y.fontSize||wt),((l=i.labels)==null?void 0:l.x)!==void 0||((c=i.labels)==null?void 0:c.y)!==void 0){const g=((h=i.labels)==null?void 0:h.x)??0,m=((f=i.labels)==null?void 0:f.y)??0;t.selectAll(".tick text").attr("dx",g).attr("dy",parseFloat(t.select(".tick text").attr("dy")||"0")+m)}if((u=i.labels)!=null&&u.step&&i.labels.step>1&&t.selectAll(".tick text").each(function(g,m){m%i.labels.step!==0&&rt(this).remove()}),i.showFirstLabel===!1){const g=t.selectAll(".tick text").nodes();g.length>0&&rt(g[0]).remove()}if(i.showLastLabel===!1){const g=t.selectAll(".tick text").nodes();g.length>0&&rt(g[g.length-1]).remove()}if((d=i.labels)!=null&&d.rotation)t.selectAll(".tick text").attr("transform",`rotate(${i.labels.rotation})`).style("text-anchor",i.labels.rotation<0?"end":"start");else if((i.isX?!i._inverted:i._inverted)&&((p=i.labels)!=null&&p.autoRotation))this.applyAutoRotation(t,i.labels.autoRotation,e);else if((i.isX?i._inverted:!i._inverted)&&!i.opposite&&Array.isArray(i.categories)&&i.categories.length>0){const g=i.tickLength??10;this.truncateSideLabels(t,e.x-g-4)}}i.visible===!1&&t.style("display","none")}truncateSideLabels(t,e){if(!(e>12))return;const i="…";t.selectAll(".tick text").each(function(){const r=this,o=r.textContent||"";if(!o)return;const s=r.getComputedTextLength();if(s<=e)return;let a=Math.max(1,Math.min(o.length,Math.ceil(o.length*e/s)));for(r.textContent=o.slice(0,a).replace(/\s+$/,"")+i;a>1&&r.getComputedTextLength()>e;)a--,r.textContent=o.slice(0,a).replace(/\s+$/,"")+i;const l=rt(r);l.select("title").remove(),l.append("title").text(o)})}applyAutoRotation(t,e,i){const r=t.selectAll(".tick text").nodes();if(r.length<2||!this.hasLabelOverlap(r))return;this.applyAutoStep(t,r);const o=r.filter(s=>s.style.display!=="none");if(this.hasLabelOverlap(o))for(const s of e.length>0?e:[-45]){r.forEach(a=>{a.style.display=""}),t.selectAll(".tick text").attr("transform",`rotate(${s})`).style("text-anchor",s<0?"end":"start");break}}hasLabelOverlap(t,e=!1){for(let i=1;i<t.length;i++)try{const r=t[i-1].getBoundingClientRect(),o=t[i].getBoundingClientRect(),s=e?-4:2;if(r.right+s>o.left&&r.left<o.right)if(e){if(r.bottom+s>o.top&&r.top<o.bottom)return!0}else return!0}catch{return!1}return!1}applyAutoStep(t,e){const i=e.length;for(let r=2;r<=i;r++){e.forEach((s,a)=>{rt(s).style("display",a%r===0?"":"none")});const o=e.filter((s,a)=>a%r===0);if(!this.hasLabelOverlap(o))return}}renderGridLines(t,e,i,r){const o=this.config.gridLineWidth;if(!o||o<=0)return;const s=r||(e.ticks?e.ticks():e.domain()),a=t.append("g").attr("class","katucharts-grid");this.config.alternateGridColor&&this.renderAlternateGridColor(a,s,e,i);const l=this.config.isX?!this.config._inverted:!!this.config._inverted;for(const c of s){const h=e(c);l?a.append("line").attr("x1",h).attr("x2",h).attr("y1",0).attr("y2",i.height).attr("stroke",this.config.gridLineColor||"#e6e6e6").attr("stroke-width",o).attr("stroke-dasharray",this.getDashArray(this.config.gridLineDashStyle)):a.append("line").attr("x1",0).attr("x2",i.width).attr("y1",h).attr("y2",h).attr("stroke",this.config.gridLineColor||"#e6e6e6").attr("stroke-width",o).attr("stroke-dasharray",this.getDashArray(this.config.gridLineDashStyle))}this.renderMinorGridLines(a,s,e,i)}renderAlternateGridColor(t,e,i,r){const o=this.config.alternateGridColor,s=this.config.isX?!this.config._inverted:!!this.config._inverted;for(let a=0;a<e.length-1;a+=2){const l=i(e[a]),c=i(e[a+1]);s?t.insert("rect",":first-child").attr("x",Math.min(l,c)).attr("y",0).attr("width",Math.abs(c-l)).attr("height",r.height).attr("fill",o):t.insert("rect",":first-child").attr("x",0).attr("y",Math.min(l,c)).attr("width",r.width).attr("height",Math.abs(c-l)).attr("fill",o)}}renderMinorGridLines(t,e,i,r){const o=this.config.minorTickInterval,s=this.config.minorGridLineWidth??1,a=this.config.minorGridLineColor||"#f2f2f2";if(!o||o==="auto"||s<=0||typeof o!="number"||e.length<2)return;const l=i.domain?i.domain():[0,1],c=typeof l[0]=="number"?l[0]:0,h=typeof l[l.length-1]=="number"?l[l.length-1]:1,f=new Set(e.map(d=>Number(d))),u=this.config.isX?!this.config._inverted:!!this.config._inverted;for(let d=c;d<=h;d+=o){if(f.has(d))continue;const p=i(d);u?t.append("line").attr("x1",p).attr("x2",p).attr("y1",0).attr("y2",r.height).attr("stroke",a).attr("stroke-width",s).attr("class","katucharts-minor-grid"):t.append("line").attr("x1",0).attr("x2",r.width).attr("y1",p).attr("y2",p).attr("stroke",a).attr("stroke-width",s).attr("class","katucharts-minor-grid")}}renderPlotBands(t,e,i){var r,o,s,a;if((r=this.config.plotBands)!=null&&r.length)for(const l of this.config.plotBands){const c=e(l.from??0),h=e(l.to??0);let f,u,d,p;(this.config.isX?!this.config._inverted:!!this.config._inverted)?(f=Math.min(c,h),u=0,d=Math.abs(h-c),p=i.height):(f=0,u=Math.min(c,h),d=i.width,p=Math.abs(h-c));const g=t.append("rect").attr("x",f).attr("y",u).attr("width",d).attr("height",p).attr("fill",l.color||"rgba(0,0,0,0.05)").attr("class",`katucharts-plot-band${l.className?" "+l.className:""}`);if(l.borderColor&&g.attr("stroke",l.borderColor).attr("stroke-width",l.borderWidth??0),l.borderRadius&&g.attr("rx",l.borderRadius),l.zIndex!==void 0&&g.style("z-index",l.zIndex),l.events&&(l.events.click&&g.on("click",m=>l.events.click.call(l,m)),l.events.mouseover&&g.on("mouseover",m=>l.events.mouseover.call(l,m)),l.events.mouseout&&g.on("mouseout",m=>l.events.mouseout.call(l,m)),l.events.mousemove&&g.on("mousemove",m=>l.events.mousemove.call(l,m)),g.style("cursor","pointer")),(o=l.label)!=null&&o.text){const m=l.label,x=m.align||"center",v=m.verticalAlign||"top";let b=x==="left"?f+4:x==="right"?f+d-4:f+d/2,k=v==="top"?u+12:v==="bottom"?u+p-4:u+p/2;b+=m.x??0,k+=m.y??0;const M=x==="left"?"start":x==="right"?"end":"middle";t.append("text").attr("x",b).attr("y",k).attr("text-anchor",M).attr("font-size",((s=m.style)==null?void 0:s.fontSize)||wt).attr("fill",((a=m.style)==null?void 0:a.color)||this.autoText()).attr("transform",m.rotation?`rotate(${m.rotation},${b},${k})`:"").style("pointer-events","none").attr("class","katucharts-plot-band-label").text(m.text||"")}}}renderPlotLines(t,e,i){var r,o,s,a;if((r=this.config.plotLines)!=null&&r.length)for(const l of this.config.plotLines){const c=e(l.value??0),h=this.config.isX?!this.config._inverted:!!this.config._inverted;let f;if(h?f=t.append("line").attr("x1",c).attr("x2",c).attr("y1",0).attr("y2",i.height).attr("stroke",l.color||"#999").attr("stroke-width",l.width||1).attr("stroke-dasharray",this.getDashArray(l.dashStyle)).attr("class",`katucharts-plot-line${l.className?" "+l.className:""}`):f=t.append("line").attr("x1",0).attr("x2",i.width).attr("y1",c).attr("y2",c).attr("stroke",l.color||"#999").attr("stroke-width",l.width||1).attr("stroke-dasharray",this.getDashArray(l.dashStyle)).attr("class",`katucharts-plot-line${l.className?" "+l.className:""}`),l.zIndex!==void 0&&f.style("z-index",l.zIndex),l.events&&(f.style("pointer-events","stroke"),l.events.click&&f.on("click",u=>l.events.click.call(l,u)),l.events.mouseover&&f.on("mouseover",u=>l.events.mouseover.call(l,u)),l.events.mouseout&&f.on("mouseout",u=>l.events.mouseout.call(l,u)),l.events.mousemove&&f.on("mousemove",u=>l.events.mousemove.call(l,u)),f.style("cursor","pointer")),(o=l.label)!=null&&o.text){const u=l.label,d=u.align||(this.config.isX?"left":"right"),p=u.verticalAlign||(this.config.isX?"top":"middle");let y,g;this.config.isX?(y=c+(u.x??4),g=p==="top"?u.y??12:p==="bottom"?i.height+(u.y??-4):i.height/2+(u.y??0)):(y=d==="left"?u.x??4:d==="right"?i.width+(u.x??-4):i.width/2+(u.x??0),g=c+(u.y??-6));const m=d==="left"?"start":d==="right"?"end":"middle";t.append("text").attr("x",y).attr("y",g).attr("text-anchor",m).attr("font-size",((s=u.style)==null?void 0:s.fontSize)||wt).attr("fill",((a=u.style)==null?void 0:a.color)||this.autoText()).attr("transform",u.rotation?`rotate(${u.rotation},${y},${g})`:"").style("pointer-events","none").attr("class","katucharts-plot-line-label").text(u.text||"")}}}applyAxisBreaks(t){var a;if(!((a=this.config.breaks)!=null&&a.length))return;const e=t.copy(),i=e.domain(),r=e.range(),o=Math.abs(i[1]-i[0]);let s=0;for(const l of this.config.breaks){const c=l.from??0,h=l.to??0;s+=Math.abs(h-c)}if(o>0&&s>0){const l=(o-s)/o,c=[r[0],r[0]+(r[1]-r[0])*l];t.range(c)}}renderTitle(t,e){var l,c,h,f,u,d,p;if(!((l=this.config.title)!=null&&l.text))return;const i=this.config.title,r=i.offset??0,o=i.margin??0,s=i.rotation;if(this.config.isX?!this.config._inverted:!!this.config._inverted){const y=((c=this.config.labels)==null?void 0:c.enabled)!==!1;let g=(y?45:33)+o+r;if(y&&t.selectAll(".tick text").nodes().length>0)try{const b=t.node().getBBox();g=Math.max(g,b.height+10+o+r)}catch{}const m=t.append("text").attr("class","katucharts-axis-title").attr("x",e.width/2).attr("y",g).attr("text-anchor","middle").attr("font-size",((h=i.style)==null?void 0:h.fontSize)||wt).attr("fill",((f=i.style)==null?void 0:f.color)||this.autoText()).text(i.text);s!==void 0&&m.attr("transform",`rotate(${s}, ${e.width/2}, ${g})`)}else{const y=((u=this.config.labels)==null?void 0:u.enabled)!==!1;let g=(this.config.opposite?e.width+45:-45)+r;if(y)try{const k=t.node().getBBox();this.config.opposite?g=Math.max(g,k.x+k.width+10+o+r):g=Math.min(g,k.x-10-o-r)}catch{}const m=this.getPaneBand(),x=m.top+m.height/2,v=s??-90;t.append("text").attr("class","katucharts-axis-title").attr("x",g).attr("y",x).attr("text-anchor","middle").attr("transform",`rotate(${v}, ${g}, ${x})`).attr("font-size",((d=i.style)==null?void 0:d.fontSize)||wt).attr("fill",((p=i.style)==null?void 0:p.color)||this.autoText()).text(i.text)}}animateAxis(t,e,i){var l;this.plotArea=e;const r=this.scale;if(!r)return;r.range(this.getRange()),this.applyAxisBreaks(r);const o=this.createD3Axis(r);if(this.config.tickPositions)o.tickValues(this.config.tickPositions);else if(this.config.tickInterval){const c=r.domain(),h=[];for(let f=c[0];f<=c[1];f+=this.config.tickInterval)h.push(f);o.tickValues(h)}else if(r.domain&&typeof r.ticks=="function"){const c=this.config._inverted,h=this.config.isX?c?e.height:e.width:c?e.width:e.height;this.config.isX;const f=this.config.tickPixelInterval??72,u=Math.min(20,Math.max(2,Math.round(h/f))),d=r.domain();if(this.computeNiceTicks){const p=this.computeNiceTicks(d[0],d[1],u);o.tickValues(p)}else if(this.computeLogTicks){const p=this.computeLogTicks(d,e);o.tickValues(p)}}if((l=this.config.labels)!=null&&l.formatter){const c=this.config.labels.formatter;o.tickFormat(h=>c.call({value:h,axis:this}))}else this.linearTickFormat?o.tickFormat(c=>this.linearTickFormat(c,o)):o.tickFormat(c=>Ja(c));const s=`katucharts-axis-${this.config.isX?"x":"y"}`,a=t.select(`.${s}`);a.empty()||(a.transition().duration(i).call(o),this.animateGridLines(t,r,e,i))}animateGridLines(t,e,i,r){const o=this.config.gridLineWidth;!o||o<=0||(t.selectAll(".katucharts-grid").remove(),this.renderGridLines(t,e,i))}getDashArray(t){return{Solid:"none",ShortDash:"6,2",ShortDot:"2,2",ShortDashDot:"6,2,2,2",Dot:"2,6",Dash:"8,6",LongDash:"16,6",DashDot:"8,6,2,6",LongDashDot:"16,6,2,6",LongDashDotDot:"16,6,2,6,2,6"}[t||"Solid"]||"none"}destroy(){}}class Mv extends Qo{constructor(t,e){super(t,e),this.scale=ke().range(this.getRange()).domain([0,1])}updateDomain(t){let{min:e,max:i}=t;const r=this.config.min!==void 0&&this.config.min!==null,o=this.config.max!==void 0&&this.config.max!==null;r&&(e=this.config.min),o&&(i=this.config.max),this.config.softMin!==void 0&&e>this.config.softMin&&(e=this.config.softMin),this.config.softMax!==void 0&&i<this.config.softMax&&(i=this.config.softMax),this.config.floor!==void 0&&(e=Math.max(e,this.config.floor)),this.config.ceiling!==void 0&&(i=Math.min(i,this.config.ceiling));const s=this.config.isX?this.config.maxPadding||.01:this.config.maxPadding||.05,a=i-e||1,l=e,c=(this.config.minPadding??s)+(t.extraMinPadding??0),h=s+(t.extraMaxPadding??0);r||(e-=a*c),o||(i+=a*h);const f=(t.extraMinPadding??0)>0;if(l>=0&&e<0&&!f&&(e=0),this.config.floor!==void 0&&(e=Math.max(e,this.config.floor)),this.config.ceiling!==void 0&&(i=Math.min(i,this.config.ceiling)),this.config.minRange!==void 0&&i-e<this.config.minRange){const p=(e+i)/2;e=p-this.config.minRange/2,i=p+this.config.minRange/2}if(this.config.maxRange!==void 0&&i-e>this.config.maxRange&&(i=e+this.config.maxRange),this.scale.domain([e,i]).range(this.getRange()),!(r&&o)&&(this.config.startOnTick||this.config.endOnTick||!this.config.isX&&this.config.startOnTick!==!1&&this.config.endOnTick!==!1)&&(this.scale.nice(),r||o)){const[p,y]=this.scale.domain();this.scale.domain([r?this.config.min:p,o?this.config.max:y])}}render(t,e){var o;this.plotArea=e,this.scale.range(this.getRange()),this.applyAxisBreaks(this.scale);const i=this.createD3Axis(this.scale);if(this.config.tickPositions)i.tickValues(this.config.tickPositions);else if(this.config.tickInterval){const s=this.scale.domain(),a=[];for(let l=s[0];l<=s[1];l+=this.config.tickInterval)a.push(l);i.tickValues(a)}else if(this.config.tickAmount)i.ticks(this.config.tickAmount);else{const s=this.config._inverted,a=this.config.isX?s?e.height:e.width:s?e.width:e.height;this.config.isX;const l=this.config.tickPixelInterval??72,c=Math.min(20,Math.max(2,Math.round(a/l))),h=this.scale.domain(),f=this.computeNiceTicks(h[0],h[1],c),u=this.config.max!==void 0&&this.config.max!==null,d=this.config.min!==void 0&&this.config.min!==null,p=!this.config.isX&&this.config.endOnTick!==!1;if(f.length>0&&p&&!u){const y=f.length>1?f[1]-f[0]:f[0]||1;let g=f[f.length-1];g<h[1]&&(f.push(g+y),g=f[f.length-1]);let m=f[0];m>h[0]&&(f.unshift(m-y),m=f[0]);const x=u?h[1]:Math.max(h[1],g),v=d?h[0]:Math.min(h[0],m);this.scale.domain([v,x])}i.tickValues(f)}if((o=this.config.labels)!=null&&o.formatter){const s=this.config.labels.formatter;i.tickFormat(a=>s.call({value:a,axis:this}))}else i.tickFormat(s=>this.linearTickFormat(s,i));const r=t.append("g").attr("class",`katucharts-axis katucharts-axis-${this.config.isX?"x":"y"}`).attr("transform",this.getTransform(e));this.renderGridLines(t,this.scale,e),this.renderPlotBands(t,this.scale,e),this.renderPlotLines(t,this.scale,e),r.call(i),this.applyAxisStyles(r,e),this.renderTitle(r,e),this.renderStackLabels(t,this.scale,e)}renderStackLabels(t,e,i){var r;!((r=this.config.stackLabels)!=null&&r.enabled)||this.config.isX}computeNiceTicks(t,e,i){const r=e-t;if(r<=0)return[t];const o=r/i,s=Math.pow(10,Math.floor(Math.log10(o))),a=o/s;let l;a<=Math.SQRT2?l=s:a<=Math.sqrt(2*2.5)?l=2*s:a<=Math.sqrt(2.5*5)?l=2.5*s:a<=Math.sqrt(5*10)?l=5*s:l=10*s;const c=l.toString(),h=c.includes(".")?c.split(".")[1].length:0,f=Math.pow(10,h),u=g=>Math.round(g*f)/f,d=u(Math.ceil(t/l)*l),p=[],y=l*1e-6;for(let g=0;g<i+3;g++){const m=u(d+g*l);if(m>e+y)break;p.push(m)}return p}getPixelForValue(t){return this.scale(t)}getValueForPixel(t){return this.scale.invert(t)}linearTickFormat(t,e){var r;const i=(r=e.tickValues)==null?void 0:r.call(e);if(i&&i.length>=2){const o=Math.abs(i[1]-i[0]),s=parseFloat(o.toPrecision(6));if(s<1e3){const a=s.toString(),l=a.includes(".")?a.split(".")[1].length:0,c=Ko(t,l);return l===0?c:c.replace(/(\.\d*?)0+$/,"$1").replace(/\.$/,"")}}return Ja(t)}getTransform(t){const e=this.config._inverted;return this.config.isX?e?this.config.opposite?`translate(${t.width},0)`:"":this.config.opposite?"":`translate(0,${t.height})`:e?this.config.opposite?"":`translate(0,${t.height})`:this.config.opposite?`translate(${t.width},0)`:""}}class Av extends Qo{constructor(t,e){super(t,e),this.scale=To().range(this.getRange()).domain([1,10])}updateDomain(t){let{min:e,max:i}=t;e=Math.max(e,.001),this.config.min!==void 0&&this.config.min!==null&&(e=Math.max(this.config.min,.001)),this.config.max!==void 0&&this.config.max!==null&&(i=this.config.max);const r=Math.log10(Math.max(e,1e-10)),o=Math.log10(Math.max(i,1e-10)),s=Math.abs(o-r)||1,a=this.config.isX?this.config.minPadding??.01:this.config.minPadding??.05;(this.config.min===void 0||this.config.min===null)&&(e=Math.pow(10,r-s*a)),(this.config.max===void 0||this.config.max===null)&&(i=Math.pow(10,o+s*a)),this.config.startOnTick&&(e=Math.pow(10,Math.floor(Math.log10(Math.max(e,1e-10))))),this.config.endOnTick&&(i=Math.pow(10,Math.ceil(Math.log10(Math.max(i,1e-10))))),this.scale.domain([e,i]).range(this.getRange())}computeLogTicks(){const t=this.scale.domain(),e=Math.log10(Math.max(t[0],1e-10)),i=Math.log10(Math.max(t[1],1e-10));if(this.config.tickPositions)return this.config.tickPositions;let r;if(this.config.tickInterval)r=this.config.tickInterval;else{r=1;const l=Math.abs(i-e);if(l>12){const c=this.config.isX?this.plotArea.width:this.plotArea.height,f=Math.max(2,Math.floor(c/20));r=Math.max(1,Math.ceil(l/f))}}const o=Math.floor(e),s=Math.ceil(i),a=[];for(let l=o;l<=s;l+=r){const c=Math.pow(10,l);c>=t[0]*.999&&c<=t[1]*1.001&&a.push(c)}return a.length===0?a.push(t[0],t[1]):a.length===1&&(a[0]>t[0]*1.5&&a.unshift(t[0]),a[0]<t[1]/1.5&&a.push(t[1])),a}render(t,e){var a;this.plotArea=e,this.scale.range(this.getRange());const i=this.createD3Axis(this.scale),r=this.computeLogTicks();if(i.tickValues(r),(a=this.config.labels)!=null&&a.formatter){const l=this.config.labels.formatter;i.tickFormat(c=>l.call({value:c,axis:this}))}else i.tickFormat(l=>Ja(l));const o=this.config.isX?!this.config._inverted:!!this.config._inverted,s=t.append("g").attr("class",`katucharts-axis katucharts-axis-${this.config.isX?"x":"y"}`).attr("transform",o?`translate(0,${e.height})`:"");this.renderGridLines(t,this.scale,e,r),s.call(i),this.applyAxisStyles(s,e),this.renderTitle(s,e)}getPixelForValue(t){return this.scale(Math.max(t,.001))}getValueForPixel(t){return this.scale.invert(t)}}class Sv extends Qo{constructor(t,e){super(t,e);const i=Za()?V1:H1;this.scale=i().range(this.getRange()).domain([new Date,new Date])}updateDomain(t){const e=this.config.min??t.min,i=this.config.max??t.max;this.scale.domain([new Date(e),new Date(i)]).range(this.getRange())}render(t,e){var s;this.plotArea=e,this.scale.range(this.getRange());const i=this.createD3Axis(this.scale);if((s=this.config.labels)!=null&&s.formatter){const a=this.config.labels.formatter;i.tickFormat(l=>a.call({value:l.getTime(),axis:this}))}else if(this.config.dateTimeLabelFormats){const a=this.config.dateTimeLabelFormats,l=Za()?Bo:zo;i.tickFormat(c=>{const h=c,f=this.pickDateFormat(h,a);return l(f)(h)})}const r=this.config.isX?!this.config._inverted:!!this.config._inverted,o=t.append("g").attr("class",`katucharts-axis katucharts-axis-${this.config.isX?"x":"y"}`).attr("transform",r?`translate(0,${e.height})`:"");this.renderGridLines(t,this.scale,e),o.call(i),this.applyAxisStyles(o,e),this.renderTitle(o,e)}pickDateFormat(t,e){const i=Za(),r=i?t.getUTCMilliseconds():t.getMilliseconds(),o=i?t.getUTCSeconds():t.getSeconds(),s=i?t.getUTCMinutes():t.getMinutes(),a=i?t.getUTCHours():t.getHours(),l=i?t.getUTCDate():t.getDate(),c=i?t.getUTCMonth():t.getMonth();return r!==0&&e.millisecond?e.millisecond:o!==0&&e.second?e.second:s!==0&&e.minute?e.minute:a!==0&&e.hour?e.hour:l!==1&&e.day?e.day:c!==0&&e.month?e.month:e.year?e.year:e.day||"%b %d"}getPixelForValue(t){return this.scale(new Date(t))}getValueForPixel(t){return this.scale.invert(t).getTime()}}class nf extends Qo{constructor(t,e){super(t,e),this.scale=Jh().range(this.getRange()).paddingInner(.3).paddingOuter(.05),t.categories&&this.scale.domain(t.categories)}updateDomain(t){Array.isArray(t)&&this.scale.domain(t).range(this.getRange())}render(t,e){this.plotArea=e;const i=this.getRange();if(isNaN(i[0])||isNaN(i[1])||i[0]===i[1])return;this.scale.range(i);const r=this.createD3Axis(this.scale),o=this.config.isX?!this.config._inverted:!!this.config._inverted,s=t.append("g").attr("class",`katucharts-axis katucharts-axis-${this.config.isX?"x":"y"}`).attr("transform",o?`translate(0,${e.height})`:"");this.renderGridLines(t,this.scale,e),s.call(r),this.applyAxisStyles(s,e),this.renderTitle(s,e),this.applyAutoStepIfNeeded(s)}applyAutoStepIfNeeded(t){var s,a,l;if(((s=this.config.labels)==null?void 0:s.enabled)===!1)return;const e=this.scale.bandwidth();if(e<=0)return;const i=be(((l=(a=this.config.labels)==null?void 0:a.style)==null?void 0:l.fontSize)||wt);if(i<=e)return;const o=Math.min(i,Math.max(5,Math.round(e*1.1)));t.selectAll(".tick text").style("font-size",`${o}px`)}getPixelForValue(t){const e=this.scale.domain();let i;if(typeof t=="number"){const r=Math.round(t);if(r>=0&&r<e.length){i=e[r];const o=(this.scale(i)??0)+this.scale.bandwidth()/2,s=(t-r)*this.scale.bandwidth();return o+s}i=String(t)}else i=String(t);return(this.scale(i)??0)+this.scale.bandwidth()/2}getBandwidth(){return this.scale.bandwidth()}getValueForPixel(t){const e=this.scale.domain(),i=this.scale.step(),r=Math.floor(t/i);return e[Math.min(r,e.length-1)]}}class ts{static render(t,e,i,r,o,s){if(!i.enabled)return;const a=t.append("g").attr("class","katucharts-data-labels");i.zIndex!==void 0&&a.style("z-index",i.zIndex),e.forEach((l,c)=>{var p,y,g,m,x,v;if(l.y===null||l.y===void 0)return;if(i.filter){const b=i.filter.property,k=i.filter.operator||">",M=i.filter.value??0,C=b?l[b]:l.y;if(!ts.matchesFilter(C,k,M))return}let h;i.formatter?h=i.formatter.call({point:{...l,index:c},series:{name:s},x:l.x,y:l.y,percentage:l.percentage}):i.format?h=de(Kt(i.format,{point:l,series:{name:s},x:l.x,y:l.y})):h=String(l.y);const f=r.getPixelForValue(l.x??c)+(i.x??0),u=o.getPixelForValue(l.y)+(i.y??-8),d=a.append("text").attr("x",f).attr("y",u).attr("text-anchor",i.align||"center").attr("dominant-baseline","auto").attr("font-size",((p=i.style)==null?void 0:p.fontSize)||wt).attr("fill",i.color||((y=i.style)==null?void 0:y.color)||xe).attr("font-weight",((g=i.style)==null?void 0:g.fontWeight)||"normal").text(h);if(i.className&&d.attr("class",i.className),i.rotation&&d.attr("transform",`rotate(${i.rotation},${f},${u})`),i.shadow&&d.attr("filter","drop-shadow(1px 1px 2px rgba(0,0,0,0.3))"),(m=i.textPath)!=null&&m.enabled){const b=i.textPath.attributes||{};d.selectAll("*").remove();const k=d.append("textPath");for(const[M,C]of Object.entries(b))k.attr(M,C);k.text(h)}if(i.backgroundColor){const b=(v=(x=d.node())==null?void 0:x.getBBox)==null?void 0:v.call(x);if(b){const k=i.padding??2,M=a.insert("rect","text").attr("x",b.x-k).attr("y",b.y-k).attr("width",b.width+k*2).attr("height",b.height+k*2).attr("fill",i.backgroundColor).attr("rx",i.borderRadius??0).attr("stroke",i.borderColor||"none").attr("stroke-width",i.borderWidth??0);i.shadow&&M.attr("filter","drop-shadow(1px 1px 2px rgba(0,0,0,0.3))")}}}),i.defer&&(a.style("opacity","0"),a.transition().delay(1e3).duration(200).style("opacity","1"))}static matchesFilter(t,e,i){const r=Number(t);if(isNaN(r))return!1;switch(e){case">":return r>i;case"<":return r<i;case">=":return r>=i;case"<=":return r<=i;case"==":return r===i;case"!=":return r!==i;default:return!0}}}function _v(n){if(typeof n=="string"){const t=document.getElementById(n);if(!t)throw new Error(`KatuCharts: container element "${n}" not found`);return t}return n}function rf(n,t=.5){const e=getComputedStyle(n),i=parseFloat(e.paddingLeft)||0,r=parseFloat(e.paddingRight)||0,o=parseFloat(e.paddingTop)||0,s=parseFloat(e.paddingBottom)||0,a=n.getBoundingClientRect(),l=a.width-i-r||n.clientWidth-i-r||600,c=a.height-o-s||n.clientHeight-o-s,h=c>0,f=h?c:Math.round(l*t);return{width:l,height:f,heightMeasured:h}}function tc(n,t){const e=document.createElement("div");return n&&(e.className=n),t&&t.appendChild(e),e}function of(n){n&&n.parentNode&&n.parentNode.removeChild(n)}function ec(n,t){let e=0,i=null;return function(...r){const o=Date.now(),s=t-(o-e);s<=0?(i&&(clearTimeout(i),i=null),e=o,n.apply(this,r)):i||(i=setTimeout(()=>{e=Date.now(),i=null,n.apply(this,r)},s))}}function Cv(n,t){let e=null;return function(...i){e&&clearTimeout(e),e=setTimeout(()=>{n.apply(this,i)},t)}}const Ur=class Ur{constructor(t,e,i,r){if(this.element=null,this.splitElements=[],this.hideTimeout=null,this.categories=null,this.isDatetime=!1,this.sharedPoints=[],this.sharedProvider=null,this.lastMouseEvent=null,this.boundHandlers=[],this.config=t,this.container=t.outside?document.body:e,this.plotArea=i,t.enabled!==!1){if(r.on("point:mouseover",o=>this.show(o)),r.on("point:mouseout",o=>{var s,a,l;if(this.config.shared&&(o!=null&&o.series)){const c=((a=(s=o.series)==null?void 0:s.config)==null?void 0:a.name)??((l=o.series)==null?void 0:l.name)??"";this.sharedPoints=this.sharedPoints.filter(h=>h.series.name!==c)}this.scheduleHide()}),t.followPointer){const o=ec(s=>{this.lastMouseEvent=s,this.element&&this.element.style.display!=="none"&&this.positionAtMouse(s)},16);e.addEventListener("mousemove",o),this.boundHandlers.push({el:e,type:"mousemove",fn:o})}if(t.stickOnContact){const o=ec(s=>{if(this.element&&this.element.style.display!=="none"){const a=this.element.getBoundingClientRect();s.clientX>=a.left&&s.clientX<=a.right&&s.clientY>=a.top&&s.clientY<=a.bottom&&this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null)}},16);e.addEventListener("mousemove",o),this.boundHandlers.push({el:e,type:"mousemove",fn:o})}if(t.followTouchMove!==!1){const o=ec(s=>{if(this.element&&this.element.style.display!=="none"&&s.touches.length===1){const a=s.touches[0],l=e.getBoundingClientRect(),c=this.config.distance??16;let h=a.clientX-l.left+c,f=a.clientY-l.top-10;const u=this.element.offsetWidth||120;h+u>l.width&&(h=a.clientX-l.left-u-c),f<0&&(f=5),this.element.style.left=`${h}px`,this.element.style.top=`${f}px`}},16);e.addEventListener("touchmove",o,{passive:!0}),this.boundHandlers.push({el:e,type:"touchmove",fn:o})}}}show(t){var r,o,s,a,l,c,h;if(this.config.enabled===!1)return;this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null);const i={point:t.index!==void 0?{...t.point,index:t.index}:t.point,plotX:t.plotX,plotY:t.plotY,series:{name:((o=(r=t.series)==null?void 0:r.config)==null?void 0:o.name)??((s=t.series)==null?void 0:s.name)??"",color:((l=(a=t.series)==null?void 0:a.getColor)==null?void 0:l.call(a))??((c=t.series)==null?void 0:c.color)??"#333",config:(h=t.series)==null?void 0:h.config}};if(this.config.shared){const f=i.point.x??i.plotX;if(this.sharedProvider){const u=this.sharedProvider(f);this.sharedPoints=u.length>0?u:[i]}else{this.sharedPoints.length>0&&(this.sharedPoints[0].point.x??this.sharedPoints[0].plotX)!==f&&(this.sharedPoints=[]);const d=this.sharedPoints.findIndex(p=>p.series.name===i.series.name);d>=0?this.sharedPoints[d]=i:this.sharedPoints.push(i)}}if(this.config.split){this.showSplit(i);return}if(this.element||(this.element=this.createElement()),this.config.stickOnContact&&(this.element.style.pointerEvents="auto"),this.config.borderColor===void 0){const f=i.point.color||i.series.color||"#333";this.element.style.borderColor=f}this.config.shared&&this.sharedPoints.length>0?this.element.innerHTML=this.formatSharedContent(this.sharedPoints):this.element.innerHTML=this.formatContent(i),this.config.followPointer&&this.lastMouseEvent?this.positionAtMouse(this.lastMouseEvent):this.position(i),this.element.style.display="block",this.config.animation!==!1?this.element.style.opacity="1":(this.element.style.transition="none",this.element.style.opacity="1")}hide(){this.element&&(this.element.style.opacity="0",this.element.style.display="none"),this.hideSplitElements(),this.sharedPoints=[]}scheduleHide(){const t=this.config.hideDelay??500;this.hideTimeout=setTimeout(()=>this.hide(),t)}showSplit(t){this.hideSplitElements();const e=this.formatContent(t);if(!e)return;const i=this.createSplitElement(t.series.color||"#333");i.innerHTML=e;const r=this.config.distance??16,o=this.plotArea,s=o.x+t.plotX+r,a=o.y+t.plotY;i.style.left=`${s}px`,i.style.top=`${a}px`,i.style.display="block",i.style.opacity="1",this.splitElements.push(i)}hideSplitElements(){for(const t of this.splitElements)of(t);this.splitElements=[]}createSplitElement(t){var s,a;const e=tc("katucharts-tooltip-split",this.container),i=this.config.backgroundColor||"rgba(247,247,247,0.85)",r=this.config.borderRadius??3,o=this.config.padding??8;return Object.assign(e.style,{position:"absolute",pointerEvents:"none",zIndex:String(this.config.zIndex??10),backgroundColor:i,border:`${this.config.borderWidth??1}px solid ${t}`,borderRadius:`${r}px`,padding:`${o}px`,fontSize:((s=this.config.style)==null?void 0:s.fontSize)||"12px",color:((a=this.config.style)==null?void 0:a.color)||"#333333",boxShadow:this.config.shadow!==!1?"2px 2px 6px rgba(0,0,0,0.15)":"none",transition:this.config.animation!==!1?"opacity 0.15s":"none",whiteSpace:"nowrap",display:"none"}),e}createElement(){var a,l;const t=tc(`katucharts-tooltip${this.config.className?" "+this.config.className:""}`,this.container),e=this.config.backgroundColor||"rgba(247,247,247,0.85)",i=this.config.borderRadius??3,r=this.config.padding??8,o=this.config.shape||"callout";let s=`${i}px`;return o==="circle"&&(s="50%"),Object.assign(t.style,{position:this.config.outside?"fixed":"absolute",pointerEvents:this.config.stickOnContact?"auto":"none",zIndex:String(this.config.zIndex??10),backgroundColor:e,border:`${this.config.borderWidth??1}px solid ${this.config.borderColor||"#ccc"}`,borderRadius:s,padding:`${r}px`,fontSize:((a=this.config.style)==null?void 0:a.fontSize)||"12px",color:((l=this.config.style)==null?void 0:l.color)||"#333333",boxShadow:this.config.shadow!==!1?"2px 2px 6px rgba(0,0,0,0.15)":"none",transition:this.config.animation!==!1?"opacity 0.15s":"none",whiteSpace:"nowrap",display:"none"}),t}formatValue(t){if(t==null)return"";let e;this.config.valueDecimals!==void 0?e=t.toFixed(this.config.valueDecimals):e=String(t);const i=this.config.valuePrefix||"",r=this.config.valueSuffix||"";return`${i}${e}${r}`}resolveKey(t){let e=t.point.name??t.point.x??"";return this.categories&&typeof t.point.x=="number"&&this.categories[t.point.x]&&(e=this.categories[t.point.x]),e}getPointCategory(t){return t.category!==void 0?t.category:this.categories&&typeof t.x=="number"&&this.categories[t.x]!==void 0?this.categories[t.x]:t.name}buildFormatterPoint(t,e={}){const i=this.resolveKey(t),r=this.getPointCategory(t.point);return{...t.point,...e,key:i,category:r,color:t.point.color||t.series.color||"#333",series:{name:t.series.name||"",color:t.series.color||"#333"}}}buildFormatterContext(t,e={}){const i=this.resolveKey(t);return{point:this.buildFormatterPoint(t),series:t.series,x:t.point.x,y:t.point.y,percentage:t.point.percentage,total:t.point.total,key:i,color:t.point.color||t.series.color,...e}}formatContent(t){var k;const e=(k=t.series.config)==null?void 0:k.tooltip;if(t.point.y===null||t.point.y===void 0){const M=(e==null?void 0:e.nullFormatter)??this.config.nullFormatter,C=(e==null?void 0:e.nullFormat)??this.config.nullFormat;if(M)return M.call({point:t.point,series:t.series});if(C)return C}if(this.config.formatter){const M=this.config.formatter.call(this.buildFormatterContext(t));return M===!1?"":M}const i=this.resolveKey(t),r=t.point.name??(this.categories&&typeof t.point.x=="number"?this.categories[t.point.x]:void 0)??i,o=(e==null?void 0:e.valueDecimals)??this.config.valueDecimals,s=(e==null?void 0:e.valuePrefix)??this.config.valuePrefix??"",a=(e==null?void 0:e.valueSuffix)??this.config.valueSuffix??"",l=this.formatValueWith(t.point.y,o,s,a);let c=r;const h=(e==null?void 0:e.xDateFormat)??this.config.xDateFormat??(this.isDatetime?Ur.DEFAULT_DATE_FORMAT:void 0);h&&typeof t.point.x=="number"&&t.point.name===void 0&&(c=Ka(h,t.point.x));const f={point:this.buildFormatterPoint(t,{name:r,key:c,y:l||t.point.y}),series:{...t.series,name:t.series.name||""}},u=(e==null?void 0:e.pointFormatter)??this.config.pointFormatter;if(u){const M=u.call(this.buildFormatterContext(t)),C=(e==null?void 0:e.headerFormat)??this.config.headerFormat??"",L=(e==null?void 0:e.footerFormat)??this.config.footerFormat??"";return Kt(C,f,!0)+M+Kt(L,f,!0)}if(this.config.format)return Kt(this.config.format,f,!0);const d=(e==null?void 0:e.headerFormat)??this.config.headerFormat??"",p=(e==null?void 0:e.pointFormat)??this.config.pointFormat??"",y=(e==null?void 0:e.footerFormat)??this.config.footerFormat??"",g=Kt(d,f,!0),m=Kt(p,f,!0),x=Kt(y,f,!0);let v="";const b=!!((e==null?void 0:e.pointFormat)??this.config.pointFormat);if(t.point.total!==void 0&&!y&&!b){const M=t.point.total,C=Math.round(M*1e6)/1e6;v=`<span style="font-size:10px">Total: <b>${this.formatValue(C)}</b></span><br/>`}return g+m+x+v}formatValueWith(t,e,i,r){if(t==null)return"";let o;return e!==void 0?o=t.toFixed(e):o=String(t),`${i||""}${o}${r||""}`}formatSharedContent(t){var r,o,s,a;if(this.config.formatter){const l=t[0],c=l?this.resolveKey(l):"",h=this.config.formatter.call({point:l?this.buildFormatterPoint(l):void 0,series:l==null?void 0:l.series,x:l==null?void 0:l.point.x,y:l==null?void 0:l.point.y,key:c,color:(l==null?void 0:l.point.color)||(l==null?void 0:l.series.color),points:t.map(f=>({point:this.buildFormatterPoint(f),series:f.series,x:f.point.x,y:f.point.y,percentage:f.point.percentage,total:f.point.total,key:this.resolveKey(f),color:f.point.color||f.series.color}))});return h===!1?"":h}const e=[],i=this.formatXKey((r=t[0])==null?void 0:r.point,(s=(o=t[0])==null?void 0:o.series.config)==null?void 0:s.tooltip);i!==""&&e.push(`<span style="font-size:10px">${qn(String(i))}</span><br/>`);for(const l of t){const c=(a=l.series.config)==null?void 0:a.tooltip,h=c==null?void 0:c.pointFormat;if(h){const p={point:this.buildFormatterPoint(l),series:{...l.series,name:l.series.name||""}};e.push(Kt(h,p,!0));continue}const f=ef(l.point.color||l.series.color||"#333"),u=qn(l.series.name||""),d=this.formatValue(l.point.y);e.push(`<span style="color:${f}">●</span> ${u}: <b>${d}</b><br/>`)}return e.join("")}position(t){var h,f;if(!this.element)return;if(this.config.positioner){const u=this.config.positioner(this.element.offsetWidth,this.element.offsetHeight,t);this.element.style.left=`${u.x}px`,this.element.style.top=`${u.y}px`;return}const e=this.config.distance??16,i=this.plotArea;let r=i.x+t.plotX+e,o=i.y+t.plotY-10;const s=this.element.offsetWidth||120,a=this.element.offsetHeight||50,l=this.config.outside?window.innerWidth:this.container.offsetWidth||((h=this.container.parentElement)==null?void 0:h.offsetWidth)||800,c=this.config.outside?window.innerHeight:this.container.offsetHeight||((f=this.container.parentElement)==null?void 0:f.offsetHeight)||600;r+s>l&&(r=i.x+t.plotX-s-e),o+a>c&&(o=c-a-5),o<0&&(o=5),r<0&&(r=5),this.element.style.left=`${r}px`,this.element.style.top=`${o}px`}positionAtMouse(t){if(!this.element)return;const e=this.config.distance??16;if(this.config.outside){let l=t.clientX+e,c=t.clientY-10;const h=this.element.offsetWidth||120,f=this.element.offsetHeight||50;l+h>window.innerWidth&&(l=t.clientX-h-e),c+f>window.innerHeight&&(c=window.innerHeight-f-5),c<0&&(c=5),l<0&&(l=5),this.element.style.left=`${l}px`,this.element.style.top=`${c}px`;return}const i=this.container.getBoundingClientRect();let r=t.clientX-i.left+e,o=t.clientY-i.top-10;const s=this.element.offsetWidth||120,a=this.element.offsetHeight||50;r+s>i.width&&(r=t.clientX-i.left-s-e),o+a>i.height&&(o=i.height-a-5),o<0&&(o=5),r<0&&(r=5),this.element.style.left=`${r}px`,this.element.style.top=`${o}px`}updatePlotArea(t){this.plotArea=t}setCategories(t){this.categories=t}setDatetimeAxis(t){this.isDatetime=t}setSharedPointsProvider(t){this.sharedProvider=t}formatXKey(t,e){if(!t)return"";if(this.categories&&typeof t.x=="number"&&this.categories[t.x]!==void 0)return this.categories[t.x];if(t.name!==void 0&&t.name!==null)return t.name;const i=t.x;if(typeof i=="number"){const r=(e==null?void 0:e.xDateFormat)??this.config.xDateFormat??(this.isDatetime?Ur.DEFAULT_DATE_FORMAT:void 0);if(r)return Ka(r,i)}return i??""}destroy(){this.hideTimeout&&clearTimeout(this.hideTimeout);for(const{el:t,type:e,fn:i}of this.boundHandlers)t.removeEventListener(e,i);this.boundHandlers=[],of(this.element),this.element=null,this.hideSplitElements()}};Ur.DEFAULT_DATE_FORMAT="%A, %b %e, %Y";let es=Ur;class ns{constructor(t,e,i){this.series=[],this.scrollOffset=0,this.contentHeight=0,this.visibleHeight=0,this.config=t,this.events=i,t.enabled!==!1&&(this.group=e.append("g").attr("class",`katucharts-legend${t.className?" "+t.className:""}`))}autoText(){return Pn(this.config._backgroundColor)}resolveLabel(t){var r;const e=t.getColor();let i;if(this.config.labelFormatter)i=this.config.labelFormatter.call({name:t.config.name||"",color:e,percentage:t.percentage,total:t.total,index:t.config.index,legendIndex:t.config.legendIndex,options:t.config});else if(this.config.labelFormat){const o={name:t.config.name||"",color:e,index:t.config.index,legendIndex:t.config.legendIndex};i=de(Kt(this.config.labelFormat,o))}else i=t.config.name||`Series ${t.config.index+1}`;if(this.config.valueSuffix&&(i+=` ${this.config.valueSuffix}`),this.config.valueDecimals!==void 0&&this.config.valueDecimals>=0){const o=t.data.length>0?(r=t.data[t.data.length-1])==null?void 0:r.y:void 0;typeof o=="number"&&(i+=`: ${o.toFixed(this.config.valueDecimals)}`)}return i}computeAutoFontSize(t,e){return e||wt}estimateTextWidth(t,e){const i=be(e);return t.length*i*.62}static computeGridLayout(t,e,i,r){if(r.itemWidth)return{columns:Math.max(2,Math.floor(i/r.itemWidth)),itemWidth:r.itemWidth};const o=be(r.fontSize);let s=0;for(const c of e){const h=c.length*o*.62;h>s&&(s=h)}const a=r.symbolWidth+r.symbolPadding+s+8;return{columns:Math.max(1,Math.floor(i/a)),itemWidth:a}}render(t,e){var it,ft,dt,at;if(this.config.enabled===!1||!this.group)return;this.series=t,this.group.selectAll("*").remove();let i=t.filter(ot=>ot.config.showInLegend!==!1);if(i.length===0)return;this.config.reversed&&(i=[...i].reverse());const r=this.config.layout||"horizontal",o=this.config.padding??8,s=this.config.symbolWidth??12,a=this.config.symbolHeight??12,l=this.config.symbolPadding??5,c=this.config.symbolRadius??2,h=this.config.squareSymbol!==!1,f=this.config.itemDistance??20,u=this.config.itemStyle||{},d=this.config.itemMarginTop??0,p=this.config.itemMarginBottom??4,y=this.config.lineHeight??16,g=this.config.maxHeight,m=this.config.width,x=u.fontSize||wt,v=this.computeAutoFontSize(i.length,x);let b=o,k=o,M=0;if((it=this.config.title)!=null&&it.text){const ot=this.config.title.style||{};this.group.append("text").attr("class","katucharts-legend-title").attr("x",o).attr("y",o+10).attr("font-size",ot.fontSize||wt).attr("font-weight",ot.fontWeight||"bold").attr("fill",ot.color||"#333").text(this.config.title.text),k+=20}const C=k,L=m||e.width-o*2,_=y+p+d,T=[];for(const ot of i){const j=ot.getMultiLegendItems(),st=["line","spline","area","areaspline","radar","polar"].includes(ot.config._internalType);if(j)for(const kt of j)T.push({label:kt.label,color:kt.color,series:ot,isLine:st});else T.push({label:this.resolveLabel(ot),color:ot.getColor(),series:ot,isLine:st})}const I=T.map(ot=>ot.label);let E=0;if(r==="horizontal")for(let ot=0;ot<I.length;ot++){const j=s+l+this.estimateTextWidth(I[ot],v);E+=j+(ot<I.length-1?f:0)}const P=r==="horizontal"&&T.length>8&&E>L;let S=0,w=0;const A=6;let $=0,D=0;if(P){const ot=ns.computeGridLayout(T.length,I,L,{symbolWidth:s,symbolPadding:l,fontSize:v,itemDistance:f,padding:o,itemWidth:this.config.itemWidth});S=ot.columns,w=ot.itemWidth,D=Math.ceil(T.length/S)}const F=[];T.forEach((ot,j)=>{var re;const st=ot.series,kt=ot.color,Tt=ot.isLine,Mt=ot.label;let Ct,Gt;if(P){const Lt=j%S,Qt=Math.floor(j/S),pe=S*w,qe=Math.max(0,(L-pe)/2);Ct=o+qe+Lt*w,Gt=C+Qt*_+d}else if(r==="horizontal"){const Lt=this.config.itemWidth||this.estimateTextWidth(Mt,v),Qt=s+l+Lt;j>0&&b+Qt>L&&(b=o,k+=_),Ct=b,Gt=k+d,M=Math.max(M,b+Qt),b+=Qt+f}else{const Lt=this.config.itemWidth||this.estimateTextWidth(Mt,v),Qt=s+l+Lt;Ct=b,Gt=k+d,M=Math.max(M,b+Qt),b=o,k+=_}const Ht=this.group.append("g").attr("class","katucharts-legend-item").attr("transform",`translate(${Ct},${Gt})`).style("cursor","pointer"),Nt=st.getLegendSymbolShape();if(Tt)Ht.append("line").attr("x1",0).attr("x2",s).attr("y1",6).attr("y2",6).attr("stroke",kt).attr("stroke-width",2),Ht.append("circle").attr("cx",s/2).attr("cy",6).attr("r",3).attr("fill",kt);else if(Nt){const Lt=s/2,Qt=a/2,pe=Math.min(s,a)/2;Nt==="circle"?Ht.append("circle").attr("cx",Lt).attr("cy",Qt).attr("r",pe).attr("fill",kt):Nt==="square"?Ht.append("rect").attr("x",0).attr("y",0).attr("width",s).attr("height",a).attr("fill",kt):Nt==="diamond"?Ht.append("path").attr("d",`M ${Lt} 0 L ${s} ${Qt} L ${Lt} ${a} L 0 ${Qt} Z`).attr("fill",kt):Nt==="triangle"?Ht.append("path").attr("d",`M ${Lt} 0 L ${s} ${a} L 0 ${a} Z`).attr("fill",kt):Nt==="triangle-down"?Ht.append("path").attr("d",`M 0 0 L ${s} 0 L ${Lt} ${a} Z`).attr("fill",kt):Nt==="cross"?Ht.append("path").attr("d",`M 0 ${Qt} L ${s} ${Qt} M ${Lt} 0 L ${Lt} ${a}`).attr("stroke",kt).attr("stroke-width",2):Ht.append("circle").attr("cx",Lt).attr("cy",Qt).attr("r",pe).attr("fill",kt)}else h?Ht.append("rect").attr("x",0).attr("y",0).attr("width",s).attr("height",a).attr("rx",c).attr("fill",kt):Ht.append("circle").attr("cx",s/2).attr("cy",a/2).attr("r",Math.min(s,a)/2).attr("fill",kt);const Jt=Ht.append("text").attr("x",s+l).attr("y",10).attr("fill",st.visible?u.color||this.autoText():((re=this.config.itemHiddenStyle)==null?void 0:re.color)||"#cccccc").attr("font-size",v).attr("font-weight",u.fontWeight||"normal").text(Mt);this.config.rtl&&(Jt.attr("text-anchor","end").attr("x",-l),Ht.select("rect, circle, line").attr("transform",`translate(${-(s+l)}, 0)`)),Ht.on("click",()=>{var pe,qe,ge;const Lt=this.config.events;if(Lt!=null&&Lt.itemClick&&Lt.itemClick.call(st,new Event("legendItemClick"))===!1)return;st.toggleVisible(),Jt.attr("fill",st.visible?u.color||this.autoText():((pe=this.config.itemHiddenStyle)==null?void 0:pe.color)||"#cccccc"),((ge=(qe=st.config.events)==null?void 0:qe.legendItemClick)==null?void 0:ge.call(st,new Event("legendItemClick")))!==!1&&this.events.emit("legend:itemClick",st,j)}),Ht.on("mouseover",()=>{var Lt;Jt.attr("fill",((Lt=this.config.itemHoverStyle)==null?void 0:Lt.color)||this.autoText()),this.events.emit("legend:itemHover",st)}),Ht.on("mouseout",()=>{var Lt;Jt.attr("fill",st.visible?u.color||this.autoText():((Lt=this.config.itemHiddenStyle)==null?void 0:Lt.color)||"#cccccc"),this.events.emit("legend:itemLeave")}),F.push(Ht)});let R=0,z=0,B=0,H=0;const J=(ft=this.config.bubbleLegend)!=null&&ft.enabled?t.map(ot=>ot.getBubbleLegendInfo()).find(ot=>!!ot):void 0;if(J)if(r==="horizontal"&&((dt=this.config.bubbleLegend)==null?void 0:dt.layout)==="separate"){H=T.length?k+_:C;const j=this.renderBubbleLegend(J,0,H);R=j.width,z=j.height;const st=T.length?Math.max(0,M-o):0,kt=Math.max(st,R);B=o+Math.max(0,(kt-R)/2),this.group.select(".katucharts-bubble-legend").attr("transform",`translate(${B},0)`);const Tt=Math.max(0,(kt-st)/2);if(Tt>0)for(const Mt of F){const Ct=/translate\(\s*([-\d.]+)\s*,\s*([-\d.]+)\s*\)/.exec(Mt.attr("transform")||"");Ct&&Mt.attr("transform",`translate(${parseFloat(Ct[1])+Tt},${Ct[2]})`)}}else{r==="horizontal"?(B=T.length?M+f:o,H=C):(B=o,H=T.length?k+6:C);const j=this.renderBubbleLegend(J,B,H);R=j.width,z=j.height}const X=(ot,j=!1)=>{const st=ot*A,kt=st+A;F.forEach((Tt,Mt)=>{const Ct=Math.floor(Mt/S);if(Ct>=st&&Ct<kt){const Ht=Mt%S,Nt=S*w,Jt=Math.max(0,(L-Nt)/2),re=o+Jt+Ht*w,Lt=C+(Ct-st)*_+(this.config.itemMarginTop??0);Tt.style("display","block"),j?Tt.style("opacity","0").attr("transform",`translate(${re},${Lt})`).transition().duration(250).style("opacity","1"):Tt.attr("transform",`translate(${re},${Lt})`).style("opacity","1")}else j?Tt.transition().duration(150).style("opacity","0").on("end",function(){Tt.style("display","none")}):Tt.style("display","none")})};let q,W;if(P){const ot=Math.min(D,A);if(q=L+o*2,W=C+ot*_+o,D>A){X(0);const j=Math.ceil(D/A),st=L-20,kt=C+Math.min(D,A)*_/2,Tt=this.group.append("g").attr("class","katucharts-legend-nav"),Mt=22,Ct=Tt.append("g").attr("transform",`translate(${st},${kt-Mt-2})`).style("cursor","pointer").style("opacity","0.3");Ct.append("rect").attr("x",0).attr("y",0).attr("width",Mt).attr("height",Mt).attr("rx",4).attr("fill","#f0f0f0").attr("stroke","#ccc").attr("stroke-width",1),Ct.append("path").attr("d",`M${Mt/2-5},${Mt/2+2} L${Mt/2},${Mt/2-4} L${Mt/2+5},${Mt/2+2}`).attr("fill","none").attr("stroke","#555").attr("stroke-width",2).attr("stroke-linecap","round"),Ct.on("mouseover",function(){Ct.select("rect").attr("fill","#e0e0e0")}),Ct.on("mouseout",function(){Ct.select("rect").attr("fill","#f0f0f0")});const Gt=Tt.append("g").attr("transform",`translate(${st},${kt+2})`).style("cursor","pointer");Gt.append("rect").attr("x",0).attr("y",0).attr("width",Mt).attr("height",Mt).attr("rx",4).attr("fill","#f0f0f0").attr("stroke","#ccc").attr("stroke-width",1),Gt.append("path").attr("d",`M${Mt/2-5},${Mt/2-2} L${Mt/2},${Mt/2+4} L${Mt/2+5},${Mt/2-2}`).attr("fill","none").attr("stroke","#555").attr("stroke-width",2).attr("stroke-linecap","round"),Gt.on("mouseover",function(){Gt.select("rect").attr("fill","#e0e0e0")}),Gt.on("mouseout",function(){Gt.select("rect").attr("fill","#f0f0f0")}),Ct.on("click",()=>{$>0&&($--,X($,!0),Ct.style("opacity",$===0?"0.3":"1"),Gt.style("opacity",$>=j-1?"0.3":"1"))}),Gt.on("click",()=>{$<j-1&&($++,X($,!0),Ct.style("opacity",$===0?"0.3":"1"),Gt.style("opacity",$>=j-1?"0.3":"1"))})}}else r==="horizontal"?(q=M+o,W=k+y+o):(q=m||M+o||150,W=k+y+o);if(J&&(q=Math.max(q,B+R+o),W=Math.max(W,H+z+o)),this.contentHeight=W,this.config.backgroundColor||this.config.borderWidth||this.config.shadow){const ot=this.group.insert("rect",":first-child").attr("class","katucharts-legend-bg").attr("x",0).attr("y",0).attr("width",q).attr("height",g?Math.min(W,g):W).attr("rx",this.config.borderRadius??0).attr("fill",this.config.backgroundColor||"none").attr("stroke",this.config.borderColor||"none").attr("stroke-width",this.config.borderWidth??0);this.config.shadow&&ot.attr("filter","drop-shadow(2px 2px 4px rgba(0,0,0,0.15))")}if(g&&W>g){this.visibleHeight=g;const ot=`katucharts-legend-clip-${Math.random().toString(36).slice(2,8)}`;this.group.append("defs").append("clipPath").attr("id",ot).append("rect").attr("width",q).attr("height",g),this.group.attr("clip-path",`url(#${ot})`),((at=this.config.navigation)==null?void 0:at.enabled)!==!1&&this.renderNavigationArrows(q,g)}const U=this.config.maxWidth?Math.min(q,this.config.maxWidth):q,G=this.config.align||"center",N=r==="vertical"&&(G==="left"||G==="right");let Y;N?Y=e.x+2:G==="center"?Y=e.x+(e.width-U)/2:G==="right"?Y=e.x+e.width-U:Y=e.x;let O=e.y+(this.config.y||0);(N||this.config.verticalAlign==="middle")&&(O=e.y+Math.max(0,(e.height-W)/2)+(this.config.y||0));const ct=Y+(this.config.x||0);this.group.attr("transform",`translate(${ct},${O})`),this.config.floating&&this.group.style("pointer-events","all")}renderNavigationArrows(t,e){const i=this.config.navigation||{},r=i.activeColor||"#003399",o=i.inactiveColor||"#cccccc",s=i.arrowSize??12,a=this.group.append("g").attr("class","katucharts-legend-nav-up").attr("transform",`translate(${t/2},2)`).style("cursor","pointer");a.append("path").attr("d",`M${-s/2},${s/2} L0,${-s/2} L${s/2},${s/2}`).attr("fill",this.scrollOffset>0?r:o).attr("stroke","none"),a.on("click",()=>{this.scrollOffset>0&&(this.scrollOffset=Math.max(0,this.scrollOffset-40),this.applyScroll())});const l=this.group.append("g").attr("class","katucharts-legend-nav-down").attr("transform",`translate(${t/2},${e-2})`).style("cursor","pointer");l.append("path").attr("d",`M${-s/2},${-s/2} L0,${s/2} L${s/2},${-s/2}`).attr("fill",this.contentHeight>e+this.scrollOffset?r:o).attr("stroke","none"),l.on("click",()=>{const c=this.contentHeight-this.visibleHeight;this.scrollOffset<c&&(this.scrollOffset=Math.min(c,this.scrollOffset+40),this.applyScroll())})}applyScroll(){const t=this.scrollOffset;this.group.selectAll(".katucharts-legend-item").each(function(){const e=this,r=(e.getAttribute("transform")||"").match(/translate\(([^,]+),([^)]+)\)/);if(r){const o=parseFloat(e.getAttribute("data-orig-y")||r[2]);e.hasAttribute("data-orig-y")||e.setAttribute("data-orig-y",r[2]),e.setAttribute("transform",`translate(${r[1]},${o-t})`)}})}renderBubbleLegend(t,e,i){var b,k,M,C,L,_;const r=this.config.bubbleLegend||{};if(r.layout==="separate")return this.renderBubbleLegendSeparate(t,e,i);const o=[...t.ranges].sort((T,I)=>I.radius-T.radius),s=o[0].radius;if(!(s>0))return{width:0,height:0};const a=((k=(b=r.labels)==null?void 0:b.style)==null?void 0:k.fontSize)||wt,l=r.borderColor||t.color,c=r.borderWidth??1.5,h=r.color||"rgba(0,0,0,0)",f=r.connectorColor||l,u=r.connectorWidth??1,d=r.connectorDistance??16,p=((C=(M=r.labels)==null?void 0:M.style)==null?void 0:C.color)||xe,y=this.group.append("g").attr("class","katucharts-bubble-legend"),g=e+s,m=i+2*s,x=e+2*s+d;let v=0;for(const T of o){const I=m-2*T.radius;y.append("circle").attr("cx",g).attr("cy",m-T.radius).attr("r",T.radius).attr("fill",h).attr("stroke",l).attr("stroke-width",c),y.append("line").attr("x1",g).attr("y1",I).attr("x2",x).attr("y2",I).attr("stroke",f).attr("stroke-width",u).attr("stroke-dasharray","2,2");let E;(L=r.labels)!=null&&L.formatter?E=r.labels.formatter.call({value:T.value}):(_=r.labels)!=null&&_.format?E=de(Kt(r.labels.format,{value:T.value})):E=String(T.value),y.append("text").attr("x",x+4).attr("y",I).attr("dominant-baseline","middle").attr("font-size",a).attr("fill",p).text(E),v=Math.max(v,this.estimateTextWidth(E,a))}return{width:2*s+d+v+8,height:2*s}}renderBubbleLegendSeparate(t,e,i){var M,C,L,_;const r=this.config.bubbleLegend||{},o=[...t.ranges].sort((T,I)=>T.radius-I.radius),s=o[o.length-1].radius;if(!(s>0))return{width:0,height:0};const a=((C=(M=r.labels)==null?void 0:M.style)==null?void 0:C.fontSize)||wt,l=parseFloat(a)||12,c=r.borderColor||t.color,h=r.borderWidth??1.5,f=r.color||"rgba(0,0,0,0)",u=((_=(L=r.labels)==null?void 0:L.style)==null?void 0:_.color)||xe,d=r.connectorDistance??8,p=T=>{var I,E;return(I=r.labels)!=null&&I.formatter?r.labels.formatter.call({value:T}):(E=r.labels)!=null&&E.format?de(Kt(r.labels.format,{value:T})):String(T)},y=this.group.append("g").attr("class","katucharts-bubble-legend"),g=(T,I,E)=>y.append("circle").attr("cx",T).attr("cy",I).attr("r",E).attr("fill",f).attr("stroke",c).attr("stroke-width",h);if(this.config.layout==="horizontal"){const T=l+6,I=i+T+2*s;let E=e;for(const P of o){const S=E+P.radius,w=I-2*P.radius;g(S,I-P.radius,P.radius);const A=p(P.value);y.append("text").attr("x",S).attr("y",w-4).attr("text-anchor","middle").attr("font-size",a).attr("fill",u).text(A);const $=Math.max(2*P.radius,this.estimateTextWidth(A,a));E+=$+d+6}return{width:Math.max(0,E-e-(d+6)),height:T+2*s}}const m=e+s,x=e+2*s+d;let v=i,b=0;const k=10;for(const T of o){const I=v+T.radius;g(m,I,T.radius);const E=p(T.value);y.append("text").attr("x",x).attr("y",I).attr("dominant-baseline","middle").attr("font-size",a).attr("fill",u).text(E),b=Math.max(b,this.estimateTextWidth(E,a)),v+=2*T.radius+k}return{width:2*s+d+b+8,height:Math.max(0,v-i-k)}}destroy(){this.group&&this.group.remove()}}class sf{constructor(t,e,i,r,o){var h,f;if(this.xLine=null,this.yLine=null,this.xLabel=null,this.yLabel=null,this.plotArea=r,t){const u=typeof t=="object"?t:{},d=this.getDashArray(u.dashStyle);this.xLine=i.append("line").attr("class",`katucharts-crosshair-x${u.className?" "+u.className:""}`).attr("y1",0).attr("y2",r.height).attr("stroke",u.color||"#ccc").attr("stroke-width",u.width||1).attr("stroke-dasharray",d).style("display","none"),u.zIndex!==void 0&&this.xLine.style("z-index",u.zIndex),(h=u.label)!=null&&h.enabled&&(this.xLabel=this.createLabel(i,u.label,"x"))}if(e){const u=typeof e=="object"?e:{},d=this.getDashArray(u.dashStyle);this.yLine=i.append("line").attr("class",`katucharts-crosshair-y${u.className?" "+u.className:""}`).attr("x1",0).attr("x2",r.width).attr("stroke",u.color||"#ccc").attr("stroke-width",u.width||1).attr("stroke-dasharray",d).style("display","none"),u.zIndex!==void 0&&this.yLine.style("z-index",u.zIndex),(f=u.label)!=null&&f.enabled&&(this.yLabel=this.createLabel(i,u.label,"y"))}const s=typeof t=="object"?t:{},a=typeof e=="object"?e:{},l=s.snap!==!1,c=a.snap!==!1;o.on("point:mouseover",u=>{var d,p,y,g;if(this.xLine){const m=l?u.plotX:((d=u.event)==null?void 0:d.offsetX)??u.plotX;this.xLine.attr("x1",m).attr("x2",m).style("display",null),this.xLabel&&this.updateLabel(this.xLabel,s.label,((p=u.point)==null?void 0:p.x)??u.plotX,m,r.height+2,"x")}if(this.yLine){const m=c?u.plotY:((y=u.event)==null?void 0:y.offsetY)??u.plotY;this.yLine.attr("y1",m).attr("y2",m).style("display",null),this.yLabel&&this.updateLabel(this.yLabel,a.label,((g=u.point)==null?void 0:g.y)??u.plotY,-2,m,"y")}}),o.on("point:mouseout",()=>{this.xLine&&this.xLine.style("display","none"),this.yLine&&this.yLine.style("display","none"),this.xLabel&&this.xLabel.style("display","none"),this.yLabel&&this.yLabel.style("display","none")})}getDashArray(t){return t&&{Solid:"none",ShortDash:"6,2",ShortDot:"2,2",ShortDashDot:"6,2,2,2",Dot:"2,6",Dash:"8,6",LongDash:"16,6",DashDot:"8,6,2,6",LongDashDot:"16,6,2,6",LongDashDotDot:"16,6,2,6,2,6"}[t]||"none"}createLabel(t,e,i){var o,s;const r=t.append("g").attr("class",`katucharts-crosshair-label-${i}`).style("display","none");return r.append("rect").attr("rx",e.borderRadius??3).attr("fill",e.backgroundColor||"rgba(0,0,0,0.75)").attr("stroke",e.borderColor||"none").attr("stroke-width",e.borderWidth??0),r.append("text").attr("fill",((o=e.style)==null?void 0:o.color)||"#fff").attr("font-size",((s=e.style)==null?void 0:s.fontSize)||"10px").attr("text-anchor","middle").attr("dominant-baseline","central"),r}updateLabel(t,e,i,r,o,s){var f;t.style("display",null);let a;e.formatter?a=e.formatter.call({value:i}):e.format?a=e.format.replace("{value}",String(i)):a=typeof i=="number"?i.toFixed(2):String(i);const l=e.padding??4,c=t.select("text");c.text(a).attr("x",r).attr("y",o);const h=(f=c.node())==null?void 0:f.getBBox();h&&t.select("rect").attr("x",h.x-l).attr("y",h.y-l).attr("width",h.width+l*2).attr("height",h.height+l*2)}destroy(){this.xLine&&this.xLine.remove(),this.yLine&&this.yLine.remove(),this.xLabel&&this.xLabel.remove(),this.yLabel&&this.yLabel.remove()}}const af="Powered by: KatuCharts",Pv="https://charts.katudv.com",cf="#707070",Ev="#b0b0b0";function Tv(n){return Pn(n)==="#ffffff"?Ev:cf}class $v{constructor(t,e,i,r){this.element=null,this.observer=null,this.intervalId=null,this.unsubscribe=null,this.svg=e,this.chartWidth=i,this.chartHeight=r,this.config=t,this.apply(),this.unsubscribe=Qe.onChange(()=>this.apply())}apply(){const t=Qe.isLicensed();if(this.config.enabled===!1&&t){this.stopProtection(),this.element&&(this.element.remove(),this.element=null);return}this.render(this.config),t?this.stopProtection():this.startProtection()}updatePosition(t,e){this.chartWidth=t,this.chartHeight=e,!(this.config.enabled===!1&&Qe.isLicensed())&&this.render(this.config)}render(t){var u,d;this.element&&(this.element.remove(),this.element=null);const i=!Qe.isLicensed()&&(!(t!=null&&t.text)||!t.text.trim())?af:(t==null?void 0:t.text)||af,r=(t==null?void 0:t.href)??Pv,o=(t==null?void 0:t.position)||{},s=o.align||"right",a=o.verticalAlign||"bottom";let l,c;s==="left"?(l=o.x??10,c="start"):s==="center"?(l=this.chartWidth/2+(o.x??0),c="middle"):(l=this.chartWidth+(o.x??-10),c="end");let h;a==="top"?h=o.y??15:a==="middle"?h=this.chartHeight/2+(o.y??0):h=this.chartHeight+(o.y??-5);const f=(u=t==null?void 0:t.style)==null?void 0:u.color;if(this.element=this.svg.append("text").attr("class","katucharts-credits").attr("x",l).attr("y",h).attr("text-anchor",c).attr("fill",f||cf).attr("font-size",((d=t==null?void 0:t.style)==null?void 0:d.fontSize)||"9px").style("cursor",r?"pointer":"default").text(i),t!=null&&t.style){const p=t.style;p.fontFamily&&this.element.attr("font-family",p.fontFamily),p.fontWeight&&this.element.attr("font-weight",p.fontWeight),p.textDecoration&&this.element.style("text-decoration",p.textDecoration)}if(!f){const p=this.resolveBehindColor()||this.resolvePageBackground();this.element.attr("fill",Tv(p))}r&&this.element.on("click",()=>{/^https?:\/\//i.test(r)&&window.open(r,"_blank","noopener,noreferrer")})}refresh(){this.config.enabled===!1&&Qe.isLicensed()||this.render(this.config)}resolveBehindColor(){var t;try{const e=(t=this.element)==null?void 0:t.node(),i=this.svg.node();if(!e||!i)return null;const r=e.getBoundingClientRect();if(!r.width||!r.height)return null;const o=r.left+r.width/2,s=r.top+r.height/2;let a=null;return i.querySelectorAll("rect, path, circle, polygon, ellipse").forEach(l=>{const c=l.getAttribute("class")||"";if(/katucharts-(credits|export|border)/.test(c))return;const h=this.elementFill(l);if(!h)return;const f=l.getBoundingClientRect();o>=f.left&&o<=f.right&&s>=f.top&&s<=f.bottom&&(a=h)}),a}catch{return null}}resolvePageBackground(){try{let t=this.svg.node();for(;t;){if(typeof getComputedStyle=="function"){const e=getComputedStyle(t).backgroundColor,i=e?se(e):null;if(i&&i.opacity>0)return e}t=t.parentElement}}catch{}return"#ffffff"}elementFill(t){var o;const e=t.tagName.toLowerCase();if(e==="text"||e==="tspan")return null;let i=t.getAttribute("fill");if(!i||i==="none"){const s=(o=t.style)==null?void 0:o.fill;i=s&&s!=="none"?s:null}if(!i||i==="none"||i.indexOf("url(")===0)return null;const r=se(i);return!r||r.opacity===0?null:i}startProtection(){if(Qe.isLicensed()||this.observer||this.intervalId!=null||typeof MutationObserver>"u")return;const t=this.svg.node();t&&(this.observer=new MutationObserver(()=>{t.querySelector(".katucharts-credits")||this.render()}),this.observer.observe(t,{childList:!0}),typeof window<"u"&&(this.intervalId=window.setInterval(()=>{t.querySelector(".katucharts-credits")||this.render()},3e3)))}stopProtection(){var t;(t=this.observer)==null||t.disconnect(),this.observer=null,this.intervalId!=null&&(clearInterval(this.intervalId),this.intervalId=null)}destroy(){var t;(t=this.unsubscribe)==null||t.call(this),this.unsubscribe=null,this.stopProtection(),this.element&&this.element.remove(),this.element=null}}const Wi=["M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z","M14 2v5a1 1 0 0 0 1 1h5"],Lv={downloadPNG:Wi,downloadJPEG:Wi,downloadSVG:Wi,downloadPDF:Wi,downloadCSV:Wi,downloadXLS:Wi,viewDataTable:["M3 3h18v18H3z","M12 3v18","M3 9h18","M3 15h18"],viewFullScreen:["M8 3H5a2 2 0 0 0-2 2v3","M21 8V5a2 2 0 0 0-2-2h-3","M3 16v3a2 2 0 0 0 2 2h3","M16 21h3a2 2 0 0 0 2-2v-3"],printChart:["M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2","M6 9V3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v6","M6 14h12v8H6z"]},Iv={downloadPNG:"PNG",downloadJPEG:"JPG",downloadSVG:"SVG",downloadPDF:"PDF",downloadCSV:"CSV",downloadXLS:"XLS"},Fv={downloadPNG:"Download PNG",downloadJPEG:"Download JPEG",downloadSVG:"Download SVG",downloadPDF:"Download PDF",downloadCSV:"Download CSV",downloadXLS:"Download XLS",viewDataTable:"Data table",viewFullScreen:"Fullscreen",printChart:"Print"};class lf{constructor(t,e,i,r,o,s){var b;this.group=null,this.gearGroup=null,this.radialContainer=null,this.isOpen=!1,this.outsideClickHandler=null,this.scrollHandler=null,this.btnCenterX=0,this.btnCenterY=0,this.config=t,this.container=i,this.chartWidth=r,this.chartHeight=o,this.onExport=s;const a=(b=t.buttons)==null?void 0:b.contextButton;if((a==null?void 0:a.enabled)===!1)return;const l=(a==null?void 0:a.theme)||{},c=l.width??28,h=l.height??22,f=r+((a==null?void 0:a.x)??-10)-c,u=(a==null?void 0:a.y)??10,d=(a==null?void 0:a.symbolStroke)??"#666666",p=(a==null?void 0:a.symbolStrokeWidth)??3,y=(a==null?void 0:a.symbolFill)??d,g=l.fill??"transparent",m=l.stroke??"none",x=l.r??3;l["states.hover.fill"],this.btnCenterX=f+c/2,this.btnCenterY=u+h/2,this.group=e.append("g").attr("class","katucharts-export-button-group").attr("transform",`translate(${f},${u})`).style("cursor","pointer"),this.group.append("rect").attr("class","katucharts-export-btn-bg").attr("width",c).attr("height",h).attr("rx",x).attr("fill",g).attr("stroke",m),l.padding!==void 0&&this.group.select(".katucharts-export-btn-bg").attr("x",-l.padding).attr("y",-l.padding).attr("width",c+l.padding*2).attr("height",h+l.padding*2);const v=a==null?void 0:a.symbol;if(this.gearGroup=this.group.append("g").attr("class","katucharts-gear-icon").style("transform-origin",`${c/2}px ${h/2}px`).style("transition","transform 0.4s cubic-bezier(0.4, 0, 0.2, 1)"),v==="circle")this.gearGroup.append("circle").attr("cx",c/2).attr("cy",h/2).attr("r",Math.min(c,h)/3).attr("fill",y).attr("stroke",d).attr("stroke-width",p);else if(v==="menu"){const k=Math.round(c*.21),M=Math.round(c*.79);for(let C=0;C<3;C++)this.gearGroup.append("line").attr("x1",k).attr("x2",M).attr("y1",Math.round(h*.27)+C*Math.round(h*.23)).attr("y2",Math.round(h*.27)+C*Math.round(h*.23)).attr("stroke",d).attr("stroke-width",p).attr("stroke-linecap","round")}else{const k=Math.min(c,h),M=c/2,C=h/2,L=8,_=k*.44,T=k*.3,I=k*.12,E=Math.PI/(L*1.6);let P="";for(let F=0;F<L;F++){const R=F/L*Math.PI*2-Math.PI/2,z=[[T,R-E*1.2],[_+I,R-E],[_+I,R+E],[T,R+E*1.2]];for(const[B,H]of z){const J=M+Math.cos(H)*B,X=C+Math.sin(H)*B;P+=(P===""?"M":"L")+J.toFixed(2)+","+X.toFixed(2)}}P+="Z";const S=e.select("defs").empty()?e.append("defs"):e.select("defs"),w=S.append("linearGradient").attr("id","katu-gear-glass").attr("x1","0").attr("y1","0").attr("x2","1").attr("y2","1");w.append("stop").attr("offset","0%").attr("stop-color","#aaa").attr("stop-opacity","0.7"),w.append("stop").attr("offset","45%").attr("stop-color","#999").attr("stop-opacity","0.45"),w.append("stop").attr("offset","100%").attr("stop-color","#888").attr("stop-opacity","0.35");const A=S.append("radialGradient").attr("id","katu-gear-highlight").attr("cx","0.35").attr("cy","0.3").attr("r","0.65");A.append("stop").attr("offset","0%").attr("stop-color","#fff").attr("stop-opacity","0.6"),A.append("stop").attr("offset","50%").attr("stop-color","#fff").attr("stop-opacity","0.1"),A.append("stop").attr("offset","100%").attr("stop-color","#fff").attr("stop-opacity","0"),this.gearGroup.append("path").attr("d",P).attr("fill","url(#katu-gear-glass)").attr("stroke","rgba(255,255,255,0.5)").attr("stroke-width",p*.4).attr("stroke-linejoin","round").style("filter","drop-shadow(0 2px 4px rgba(0,0,0,0.15))"),this.gearGroup.append("path").attr("d",P).attr("fill","url(#katu-gear-highlight)").attr("stroke","none").style("pointer-events","none"),this.gearGroup.append("circle").attr("cx",M).attr("cy",C).attr("r",k*.15).attr("fill","rgba(255,255,255,0.6)").attr("stroke","rgba(255,255,255,0.4)").attr("stroke-width","0.5");const $=S.append("radialGradient").attr("id","katu-gear-hover-bg").attr("cx","0.4").attr("cy","0.35").attr("r","0.65");$.append("stop").attr("offset","0%").attr("stop-color","#fff").attr("stop-opacity","0.35"),$.append("stop").attr("offset","50%").attr("stop-color","#eef2ff").attr("stop-opacity","0.15"),$.append("stop").attr("offset","100%").attr("stop-color","#dde6ff").attr("stop-opacity","0.08");const D=k*.85;this.group.insert("circle",".katucharts-gear-icon").attr("class","katucharts-gear-hover-bg").attr("cx",c/2).attr("cy",h/2).attr("r",D).attr("fill","url(#katu-gear-hover-bg)").attr("stroke","rgba(255,255,255,0.6)").attr("stroke-width","1.5").style("filter","drop-shadow(0 0 10px rgba(200,225,255,0.5)) drop-shadow(0 2px 6px rgba(0,0,0,0.08))").style("opacity","0").style("transition","opacity 0.25s ease"),this.group.insert("circle",".katucharts-gear-icon").attr("class","katucharts-gear-hover-highlight").attr("cx",c/2).attr("cy",h/2).attr("r",D).attr("fill","none").attr("stroke","rgba(255,255,255,0.8)").attr("stroke-width","1.5").style("filter","drop-shadow(0 0 4px rgba(255,255,255,0.4))").style("opacity","0").style("transition","opacity 0.25s ease")}this.group.on("mouseenter",()=>{this.group.select(".katucharts-gear-hover-bg").style("opacity","1"),this.group.select(".katucharts-gear-hover-highlight").style("opacity","1")}).on("mouseleave",()=>{this.group.select(".katucharts-gear-hover-bg").style("opacity","0"),this.group.select(".katucharts-gear-hover-highlight").style("opacity","0")}).on("click",k=>{k.stopPropagation(),this.toggle()})}toggle(){this.isOpen?this.closeMenu():this.openMenu()}repositionCenter(t,e){this.btnCenterX=t,this.btnCenterY=e}openMenu(){var I;this.isOpen=!0,this.gearGroup&&this.gearGroup.style("transform","rotate(90deg)");const t=(I=this.config.buttons)==null?void 0:I.contextButton,i=((t==null?void 0:t.menuItems)??["downloadPNG","downloadJPEG","downloadSVG","downloadPDF","separator","viewFullScreen","printChart"]).filter(E=>E!=="separator").map(E=>({key:E,label:Fv[E]||E,icon:Lv[E]||[]}));this.radialContainer=document.createElement("div"),Object.assign(this.radialContainer.style,{position:"fixed",top:"0",left:"0",width:"100vw",height:"100vh",pointerEvents:"none",zIndex:"1000"});const r=64,o=document.createElement("canvas");o.width=r,o.height=r;const s=o.getContext("2d"),a=s.createImageData(r,r),l=a.data;let c=0;const h=[];for(let E=0;E<l.length;E+=4){const P=E/4%r,S=Math.floor(E/4/r),w=P/r-.5,A=S/r-.5,$=Math.sqrt(w*w+A*A),D=Math.max(0,Math.min(1,(.48-$)/.15)),F=D*D*(3-2*D),R=w*F*r,z=A*F*r;c=Math.max(c,Math.abs(R),Math.abs(z)),h.push(R,z)}c*=.5;let f=0;for(let E=0;E<l.length;E+=4)l[E]=(h[f++]/c+.5)*255,l[E+1]=(h[f++]/c+.5)*255,l[E+2]=0,l[E+3]=255;s.putImageData(a,0,0);const u=o.toDataURL(),d="http://www.w3.org/2000/svg",p=document.createElementNS(d,"svg");p.setAttribute("width","0"),p.setAttribute("height","0"),p.style.position="absolute";const y=document.createElementNS(d,"defs"),g=document.createElementNS(d,"filter");g.setAttribute("id","katu-glass-lens"),g.setAttribute("filterUnits","userSpaceOnUse"),g.setAttribute("color-interpolation-filters","sRGB"),g.setAttribute("x","0"),g.setAttribute("y","0"),g.setAttribute("width","44"),g.setAttribute("height","44");const m=document.createElementNS(d,"feImage");m.setAttributeNS("http://www.w3.org/1999/xlink","href",u),m.setAttribute("width","44"),m.setAttribute("height","44"),m.setAttribute("result","lens_map");const x=document.createElementNS(d,"feDisplacementMap");x.setAttribute("in","SourceGraphic"),x.setAttribute("in2","lens_map"),x.setAttribute("scale",String(Math.round(c/1))),x.setAttribute("xChannelSelector","R"),x.setAttribute("yChannelSelector","G"),g.appendChild(m),g.appendChild(x),y.appendChild(g),p.appendChild(y),this.radialContainer.appendChild(p),document.body.appendChild(this.radialContainer);const v=this.container.getBoundingClientRect(),b=v.left+this.btnCenterX,k=v.top+this.btnCenterY,M=76,C=i.length,L=100*(Math.PI/180),_=280*(Math.PI/180),T=this.config.menuItemDefinitions||{};i.forEach((E,P)=>{const S=C>1?L+(_-L)*(P/(C-1)):Math.PI,w=b+Math.cos(S)*M,A=k+Math.sin(S)*M,$=w-b,D=A-k,F=document.createElement("div");F.className="katucharts-radial-btn",Object.assign(F.style,{position:"absolute",left:`${b}px`,top:`${k}px`,width:"44px",height:"44px",marginLeft:"-22px",marginTop:"-22px",borderRadius:"50%",background:"linear-gradient(160deg, rgba(255,255,255,0.92) 0%, rgba(240,240,255,0.82) 40%, rgba(255,255,255,0.75) 100%)",backdropFilter:"url(#katu-glass-lens) blur(0.5px) contrast(1.15) brightness(1.05) saturate(1.2)",WebkitBackdropFilter:"url(#katu-glass-lens) blur(0.5px) contrast(1.15) brightness(1.05) saturate(1.2)",border:"1.5px solid rgba(255, 255, 255, 0.4)",borderTopColor:"rgba(255, 255, 255, 0.8)",borderLeftColor:"rgba(255, 255, 255, 0.55)",borderBottomColor:"rgba(0, 0, 0, 0.04)",borderRightColor:"rgba(0, 0, 0, 0.02)",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",pointerEvents:"auto",transform:"translate(0px, 0px) scale(0.3)",opacity:"0",willChange:"transform, opacity",transition:`transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) ${P*40}ms, opacity 0.2s ease ${P*40}ms, background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease`,boxShadow:"0 4px 8px rgba(0,0,0,0.2), inset 0 -6px 12px rgba(0,0,0,0.1), inset 0 2px 4px rgba(255,255,255,0.4)"}),F.dataset.dx=String($),F.dataset.dy=String(D);const R=document.createElement("div");Object.assign(R.style,{position:"absolute",top:"0",left:"0",width:"100%",height:"100%",borderRadius:"50%",background:"radial-gradient(ellipse 70% 50% at 35% 25%, rgba(255,255,255,0.55) 0%, rgba(255,255,255,0) 70%), radial-gradient(ellipse 60% 40% at 70% 80%, rgba(255,255,255,0.12) 0%, rgba(255,255,255,0) 70%)",boxShadow:"inset 1.5px 1.5px 3px rgba(255,255,255,0.5), inset -0.5px -0.5px 2px rgba(0,0,0,0.06)",pointerEvents:"none",overflow:"hidden"}),F.appendChild(R);const z=document.createElementNS("http://www.w3.org/2000/svg","svg");z.setAttribute("viewBox","0 0 24 24"),z.setAttribute("width","30"),z.setAttribute("height","30"),z.style.overflow="visible",z.style.position="relative",z.style.zIndex="1";const B=[],H=[];for(const N of E.icon){const Y=document.createElementNS("http://www.w3.org/2000/svg","path");Y.setAttribute("d",N),Y.setAttribute("fill","none"),Y.setAttribute("stroke","#333333"),Y.setAttribute("stroke-width","2"),Y.setAttribute("stroke-linecap","round"),Y.setAttribute("stroke-linejoin","round"),z.appendChild(Y),B.push(Y)}const J=Iv[E.key];if(J){const N=document.createElementNS("http://www.w3.org/2000/svg","text");N.setAttribute("x","12"),N.setAttribute("y","16.5"),N.setAttribute("text-anchor","middle"),N.setAttribute("font-size","5.5"),N.setAttribute("font-family",'-apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif'),N.setAttribute("font-weight","700"),N.setAttribute("fill","#333333"),N.setAttribute("stroke","none"),N.textContent=J,z.appendChild(N),H.push(N)}F.appendChild(z);const X=document.createElement("div");X.textContent=E.label;const q=S*(180/Math.PI),W={position:"absolute",backgroundColor:"rgba(30, 30, 30, 0.45)",backdropFilter:"blur(20px) saturate(1.4)",WebkitBackdropFilter:"blur(20px) saturate(1.4)",color:"#ffffff",padding:"4px 10px",borderRadius:"8px",border:"1px solid rgba(255, 255, 255, 0.12)",fontSize:"11px",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',fontWeight:"500",letterSpacing:"0.2px",boxShadow:"0 2px 12px rgba(0,0,0,0.12), inset 0 0.5px 0 rgba(255,255,255,0.1)",whiteSpace:"nowrap",pointerEvents:"none",opacity:"0",transition:"opacity 0.15s ease, transform 0.15s ease"};q>60&&q<120?(W.top="calc(100% + 6px)",W.left="50%",W.transform="translateX(-50%) scale(0.8)"):q>=120&&q<=240?(W.right="calc(100% + 6px)",W.top="50%",W.transform="translateY(-50%) scale(0.8)"):q>240&&q<300?(W.bottom="calc(100% + 6px)",W.left="50%",W.transform="translateX(-50%) scale(0.8)"):(W.left="calc(100% + 6px)",W.top="50%",W.transform="translateY(-50%) scale(0.8)"),Object.assign(X.style,W),F.appendChild(X);const U=W.transform.replace("scale(0.8)","scale(1)"),G=W.transform;F.addEventListener("mouseenter",()=>{F.style.background="linear-gradient(160deg, rgba(210,230,255,0.9) 0%, rgba(200,225,255,0.8) 40%, rgba(195,220,255,0.72) 100%)",F.style.borderColor="rgba(210, 230, 255, 0.85)",F.style.boxShadow="0 0 20px rgba(200,225,255,0.7), 0 0 8px rgba(200,225,255,0.5), 0 4px 12px rgba(0,0,0,0.06), 0 0 0 1px rgba(210,230,255,0.35), inset 0 2px 4px rgba(255,255,255,0.6), inset 0 -1px 2px rgba(0,0,0,0.02)",B.forEach(N=>N.setAttribute("stroke","#1a4a8a")),H.forEach(N=>N.setAttribute("fill","#1a4a8a")),X.style.opacity="1",X.style.transform=U}),F.addEventListener("mouseleave",()=>{F.style.background="linear-gradient(160deg, rgba(255,255,255,0.72) 0%, rgba(240,240,255,0.45) 40%, rgba(255,255,255,0.35) 100%)",F.style.borderColor="rgba(255, 255, 255, 0.4)",F.style.boxShadow="0 4px 8px rgba(0,0,0,0.2), inset 0 -6px 12px rgba(0,0,0,0.1), inset 0 2px 4px rgba(255,255,255,0.4)",B.forEach(N=>N.setAttribute("stroke","#333333")),H.forEach(N=>N.setAttribute("fill","#333333")),X.style.opacity="0",X.style.transform=G}),F.addEventListener("click",N=>{N.stopPropagation(),this.closeMenu();const Y=T[E.key];Y!=null&&Y.onclick?Y.onclick():this.onExport(E.key)}),this.radialContainer.appendChild(F),requestAnimationFrame(()=>{requestAnimationFrame(()=>{F.style.transform=`translate(${$}px, ${D}px) scale(1)`,F.style.opacity="1"})})}),this.outsideClickHandler=E=>{this.radialContainer&&!this.radialContainer.contains(E.target)&&this.closeMenu()},setTimeout(()=>{document.addEventListener("click",this.outsideClickHandler)},0),this.scrollHandler=()=>this.closeMenu(),window.addEventListener("scroll",this.scrollHandler,{once:!0,capture:!0})}closeMenu(){if(this.isOpen=!1,this.gearGroup&&this.gearGroup.style("transform","rotate(0deg)"),this.radialContainer){this.btnCenterX,this.btnCenterY,this.radialContainer.querySelectorAll(".katucharts-radial-btn").forEach((i,r)=>{i.style.transition=`transform 0.25s cubic-bezier(0.4, 0, 1, 1) ${r*20}ms, opacity 0.2s ease ${r*20}ms`,i.style.transform="translate(0px, 0px) scale(0.3)",i.style.opacity="0"});const e=this.radialContainer;setTimeout(()=>{e.remove()},400),this.radialContainer=null}this.outsideClickHandler&&(document.removeEventListener("click",this.outsideClickHandler),this.outsideClickHandler=null),this.scrollHandler&&(window.removeEventListener("scroll",this.scrollHandler,!0),this.scrollHandler=null)}updatePosition(t,e){var c;if(this.chartWidth=t,this.chartHeight=e,!this.group)return;const i=(c=this.config.buttons)==null?void 0:c.contextButton,r=(i==null?void 0:i.theme)||{},o=r.width??28,s=r.height??22,a=t+((i==null?void 0:i.x)??-10)-o,l=(i==null?void 0:i.y)??10;this.group.attr("transform",`translate(${a},${l})`),this.btnCenterX=a+o/2,this.btnCenterY=l+s/2,this.isOpen&&this.closeMenu()}destroy(){this.closeMenu(),this.group&&(this.group.remove(),this.group=null)}}class hf{constructor(t){this.activeIndices=new Set,this.rules=t.rules||[]}evaluate(t,e){const i=new Set;for(let o=0;o<this.rules.length;o++)this.matchesCondition(this.rules[o].condition,t,e)&&i.add(o);const r=!this.setsEqual(i,this.activeIndices);return this.activeIndices=i,{changed:r,matchingIndices:Array.from(i)}}getRules(){return this.rules}getCurrentActiveIndices(){return Array.from(this.activeIndices)}reset(){this.activeIndices.clear()}setsEqual(t,e){if(t.size!==e.size)return!1;for(const i of t)if(!e.has(i))return!1;return!0}matchesCondition(t,e,i){return t.callback?t.callback():!(t.maxWidth!==void 0&&e>t.maxWidth||t.minWidth!==void 0&&e<t.minWidth||t.maxHeight!==void 0&&i>t.maxHeight||t.minHeight!==void 0&&i<t.minHeight)}}function is(n){return`${n._internalType}__${n.stack??"_default"}`}function Hi(n,t){for(const e of n){const i=e.x??0;t.set(i,(t.get(i)||0)+(e.y??0))}return t}function uf(n,t){return t==="left"?n.layout.titleArea.x:t==="right"?n.layout.titleArea.x+n.layout.titleArea.width:n.chartWidth/2}function ff(n){return n==="left"?"start":n==="right"?"end":"middle"}function df(n,t,e,i){const r=n.node();if(!r||t<=0)return;try{if(r.getComputedTextLength()<=t)return}catch{return}const s=n.text().split(/\s+/);if(s.length<=1)return;const a=i*1.3;n.text(null);let l=[],c=n.append("tspan").attr("x",e).attr("dy",0);for(const h of s){l.push(h),c.text(l.join(" "));try{c.node().getComputedTextLength()>t&&l.length>1&&(l.pop(),c.text(l.join(" ")),l=[h],c=n.append("tspan").attr("x",e).attr("dy",a).text(h))}catch{break}}}function Dv(n){var s,a,l,c,h,f,u,d,p,y;const{titleGroup:t,container:e,options:i,layout:r,chartWidth:o}=n;if(t.selectAll("*").remove(),e.querySelectorAll(".katucharts-title-html, .katucharts-subtitle-html").forEach(g=>g.remove()),(s=i.title)!=null&&s.text){const g=i.title,m=((a=g.style)==null?void 0:a.fontSize)||"18px";if(g.useHTML){const x=document.createElement("div");x.className="katucharts-title-html",x.innerHTML=g.text,x.style.cssText=`position:absolute;top:${r.titleArea.y+5}px;left:0;width:100%;text-align:${g.align||"center"};color:${((l=g.style)==null?void 0:l.color)||"#333333"};font-size:${m};font-weight:${((c=g.style)==null?void 0:c.fontWeight)||"bold"};pointer-events:none;box-sizing:border-box;padding:0 22px;`,e.appendChild(x)}else{const x=uf(n,g.align),v=o+(g.widthAdjust??-44),b=t.append("text").attr("class","katucharts-chart-title").attr("x",x).attr("y",r.titleArea.y+20).attr("text-anchor",ff(g.align)).attr("fill",((h=g.style)==null?void 0:h.color)||"#333333").attr("font-size",m).attr("font-weight",((f=g.style)==null?void 0:f.fontWeight)||"bold").text(g.text);df(b,v,x,be(m))}}if((u=i.subtitle)!=null&&u.text){const g=i.subtitle,m=((d=g.style)==null?void 0:d.fontSize)||"12px";if(g.useHTML){const x=document.createElement("div");x.className="katucharts-subtitle-html",x.innerHTML=g.text,x.style.cssText=`position:absolute;top:${r.subtitleArea.y+5}px;left:0;width:100%;text-align:${g.align||"center"};color:${((p=g.style)==null?void 0:p.color)||"#666666"};font-size:${m};pointer-events:none;box-sizing:border-box;padding:0 22px;`,e.appendChild(x)}else{const x=uf(n,g.align),v=o+(g.widthAdjust??-44),b=t.append("text").attr("class","katucharts-chart-subtitle").attr("x",x).attr("y",r.subtitleArea.y+15).attr("text-anchor",ff(g.align)).attr("fill",((y=g.style)==null?void 0:y.color)||"#666666").attr("font-size",m).text(g.text);df(b,v,x,be(m))}}}function Rv(n){const{container:t,renderer:e,options:i,plotGroup:r,layout:o,chartWidth:s,chartHeight:a,scrollableInner:l,scrollableOuterWidth:c,scrollableOuterHeight:h,useVerticalScroll:f,useHorizontalScroll:u,exportButton:d,previousOverlay:p}=n;if(!l)return null;const y=e.getSVGNode();if(!y)return null;const g=N=>{const Y=N==null?void 0:N.querySelector(".katucharts-export-button-group");Y&&y.appendChild(Y)};p&&p.parentElement&&(g(p),p.parentElement.removeChild(p)),t.querySelectorAll(":scope > svg[data-katu-fixed-overlay]").forEach(N=>{var Y;g(N),(Y=N.parentElement)==null||Y.removeChild(N)});const x="http://www.w3.org/2000/svg",v=l.offsetWidth-l.clientWidth,b=l.offsetHeight-l.clientHeight,k=c-v,M=h-b,C=document.createElementNS(x,"svg");C.setAttribute("data-katu-fixed-overlay","1"),C.setAttribute("width",k.toString()),C.setAttribute("height",M.toString()),C.style.position="absolute",C.style.top="0",C.style.left="0",C.style.pointerEvents="none",C.style.overflow="visible";const L=i.chart.backgroundColor||"#ffffff",T=(r.attr("transform")||"").match(/translate\(([^,]+),\s*([^)]+)\)/),I=T?parseFloat(T[1]):0,E=T?parseFloat(T[2]):0,P=!!i.chart.inverted,S=P?".katucharts-axis-y":".katucharts-axis-x",w=P?".katucharts-axis-x":".katucharts-axis-y",A=document.createElementNS(x,"defs"),$=`katucharts-fixed-grad-${Math.random().toString(36).slice(2,8)}`,D=(N,Y,O,ct,it,ft)=>{const dt=document.createElementNS(x,"linearGradient");dt.setAttribute("id",N),dt.setAttribute("x1",Y),dt.setAttribute("y1",O),dt.setAttribute("x2",ct),dt.setAttribute("y2",it),ft.forEach(([at,ot])=>{const j=document.createElementNS(x,"stop");j.setAttribute("offset",at),j.setAttribute("stop-color",L),j.setAttribute("stop-opacity",ot),dt.appendChild(j)}),A.appendChild(dt)},F=o.titleArea,R=o.subtitleArea,z=Math.max(((F==null?void 0:F.y)??0)+((F==null?void 0:F.height)??0),((R==null?void 0:R.y)??0)+((R==null?void 0:R.height)??0)),H=Math.max(0,Math.min(z+30,E)),J=H>0?Math.max(0,Math.min(100,z/H*100)):100;if(D(`${$}-top`,"0%","0%","0%","100%",[["0%","1"],[`${J}%`,"1"],["100%","0"]]),D(`${$}-bottom`,"0%","0%","0%","100%",[["0%","0"],["30%","1"],["100%","1"]]),D(`${$}-left`,"0%","0%","100%","0%",[["0%","1"],["70%","1"],["100%","0"]]),C.appendChild(A),f&&H>0){const N=document.createElementNS(x,"rect");N.setAttribute("x","0"),N.setAttribute("y","0"),N.setAttribute("width",k.toString()),N.setAttribute("height",H.toString()),N.setAttribute("fill",`url(#${$}-top)`),C.appendChild(N)}if(y.querySelectorAll(".katucharts-title-group").forEach(N=>{N.style.visibility="hidden";const Y=N.cloneNode(!0);Y.style.visibility="visible";const O=(s-k)/2;O!==0&&Y.setAttribute("transform",`translate(${-O}, 0)`),C.appendChild(Y)}),f){const N=E+o.plotArea.height,Y=a-N+10,O=document.createElementNS(x,"rect");O.setAttribute("x","0"),O.setAttribute("y",(M-Y).toString()),O.setAttribute("width",k.toString()),O.setAttribute("height",Y.toString()),O.setAttribute("fill",`url(#${$}-bottom)`),C.appendChild(O),y.querySelectorAll(S).forEach(it=>{it.style.visibility="hidden";const ft=document.createElementNS(x,"g"),dt=M-(a-N);ft.setAttribute("transform",`translate(${I}, ${dt})`);const at=it.cloneNode(!0);at.removeAttribute("transform"),at.style.visibility="visible",ft.appendChild(at),C.appendChild(ft)})}if(u){const N=I+5,Y=document.createElementNS(x,"rect");Y.setAttribute("x","0"),Y.setAttribute("y","0"),Y.setAttribute("width",N.toString()),Y.setAttribute("height",M.toString()),Y.setAttribute("fill",`url(#${$}-left)`),C.appendChild(Y),y.querySelectorAll(w).forEach(ct=>{ct.style.visibility="hidden";const it=document.createElementNS(x,"g");it.setAttribute("transform",`translate(${I}, ${E})`);const ft=ct.cloneNode(!0);ft.removeAttribute("transform"),ft.style.visibility="visible",it.appendChild(ft),C.appendChild(it)})}y.querySelectorAll(".katucharts-legend").forEach(N=>{const O=(N.getAttribute("transform")||"").match(/translate\(([^,]+),\s*([^)]+)\)/),ct=O?parseFloat(O[1]):0,it=O?parseFloat(O[2]):0,ft=(s-k)/2,dt=f?a-M:0,at=ct-ft,ot=it-dt;N.style.visibility="hidden";const j=N.cloneNode(!0);j.style.visibility="visible",j.setAttribute("transform",`translate(${at}, ${ot})`),C.appendChild(j)});const W=y.querySelector(".katucharts-export-button-group");if(W&&d){const Y=(W.getAttribute("transform")||"").match(/translate\(([^,]+),\s*([^)]+)\)/),O=Y?parseFloat(Y[1]):0,ct=Y?parseFloat(Y[2]):0,it=O-(s-k);W.setAttribute("transform",`translate(${it},${ct})`),W.style.pointerEvents="auto",C.appendChild(W),d.repositionCenter(it+28/2,ct+22/2)}y.querySelectorAll(".katucharts-color-axis").forEach(N=>{N.style.visibility="hidden";const Y=N.cloneNode(!0);Y.style.visibility="visible";const O=document.createElementNS(x,"g"),ct=k/2-o.plotArea.width/2;O.setAttribute("transform",`translate(${ct},${E})`),O.appendChild(Y),C.appendChild(O)});const G=y.querySelector(".katucharts-credits");if(G){const N=parseFloat(G.getAttribute("x")||"0"),Y=parseFloat(G.getAttribute("y")||"0");G.style.visibility="hidden";const O=G.cloneNode(!0);O.style.visibility="visible",O.setAttribute("x",String(k-(s-N))),O.setAttribute("y",String(M-(a-Y))),C.appendChild(O)}return t.appendChild(C),C}const Zt=class Zt{static inlineStyles(t){const e=t.cloneNode(!0),i=e.querySelectorAll("*"),r=t.querySelectorAll("*");for(let a=0;a<i.length&&a<r.length;a++){const l=i[a],c=r[a];try{const h=window.getComputedStyle(c);for(const f of Zt.INLINE_PROPS){const u=h.getPropertyValue(f);u&&u!==""&&u!=="none"&&u!=="normal"&&u!=="0"&&l.style.setProperty(f,u)}}catch{}}const o=e.querySelector(".katucharts-export-button-group");return o&&o.remove(),Qe.isLicensed()||Zt.stampWatermark(e),new XMLSerializer().serializeToString(e)}static stampWatermark(t){t.querySelectorAll(".katucharts-credits, .katucharts-export-watermark").forEach(s=>s.remove());const e=(t.getAttribute("viewBox")||"").split(/[\s,]+/).map(Number),i=parseFloat(t.getAttribute("width")||"")||e[2]||600,r=parseFloat(t.getAttribute("height")||"")||e[3]||400,o=document.createElementNS("http://www.w3.org/2000/svg","text");o.setAttribute("class","katucharts-export-watermark"),o.setAttribute("x",String(i-8)),o.setAttribute("y",String(r-8)),o.setAttribute("text-anchor","end"),o.setAttribute("font-family","Arial, Helvetica, sans-serif"),o.setAttribute("font-size","11px"),o.setAttribute("font-weight","normal"),o.setAttribute("fill","#8a8a8a"),o.style.setProperty("fill","#8a8a8a"),o.textContent="Powered by: KatuCharts",t.appendChild(o)}static svgToCanvas(t,e,i){return new Promise((r,o)=>{const s=new Image;s.onload=()=>{const a=document.createElement("canvas");a.width=s.width*e,a.height=s.height*e;const l=a.getContext("2d");if(!l){o(new Error("Canvas context unavailable"));return}l.scale(e,e),i&&(l.fillStyle=i,l.fillRect(0,0,s.width,s.height)),l.drawImage(s,0,0),r(a)},s.onerror=()=>o(new Error("Failed to load SVG into image")),s.src="data:image/svg+xml;base64,"+btoa(unescape(encodeURIComponent(t)))})}static exportSVG(t,e="chart"){const i=new Blob([t],{type:"image/svg+xml;charset=utf-8"});Zt.downloadBlob(i,`${e}.svg`)}static async exportPNG(t,e="chart",i=2){const r=await Zt.svgToCanvas(t,i);return new Promise((o,s)=>{r.toBlob(a=>{a?(Zt.downloadBlob(a,`${e}.png`),o()):s(new Error("Failed to generate PNG"))},"image/png")})}static async exportJPEG(t,e="chart",i=2,r=.95){const o=await Zt.svgToCanvas(t,i,"#ffffff");return new Promise((s,a)=>{o.toBlob(l=>{l?(Zt.downloadBlob(l,`${e}.jpeg`),s()):a(new Error("Failed to generate JPEG"))},"image/jpeg",r)})}static loadJsPDF(){return Zt.jsPDFLoader||(Zt.jsPDFLoader=(async()=>{var r;const t=()=>{var s;const o=((s=globalThis.jspdf)==null?void 0:s.jsPDF)??globalThis.jsPDF;return typeof o=="function"?o:null},e=t();if(e)return e;try{const o=await Promise.resolve().then(()=>WA),s=o.jsPDF??((r=o.default)==null?void 0:r.jsPDF)??o.default;if(typeof s=="function")return s}catch{}await Zt.injectScript(Zt.JSPDF_CDN_URL);const i=t();if(i)return i;throw new Error("jsPDF unavailable")})().catch(t=>{throw Zt.jsPDFLoader=null,t})),Zt.jsPDFLoader}static injectScript(t){return new Promise((e,i)=>{const r=document.createElement("script");r.src=t,r.async=!0,r.onload=()=>e(),r.onerror=()=>{r.remove(),i(new Error(`Failed to load ${t}`))},document.head.appendChild(r)})}static async exportPDF(t,e="chart",i=2){let r;try{r=await Zt.loadJsPDF()}catch{console.warn("KatuCharts: jspdf could not be loaded. Install it with `npm install jspdf`, expose it as a global, or allow the CDN fallback to enable PDF export.");return}const o=await Zt.svgToCanvas(t,i,"#ffffff"),s=o.toDataURL("image/jpeg",.95),a=o.width/i,l=o.height/i,c=a>l?"landscape":"portrait",h=new r({orientation:c,unit:"px",format:[a,l]});h.addImage(s,"JPEG",0,0,a,l),h.save(`${e}.pdf`)}static print(t,e){var l;const i=document.createElement("iframe");Object.assign(i.style,{position:"fixed",left:"-9999px",top:"-9999px",width:"0",height:"0",border:"none"}),document.body.appendChild(i);const r=i.contentDocument||((l=i.contentWindow)==null?void 0:l.document);if(!r){i.remove();return}const o=e??780;r.open(),r.write(`<!DOCTYPE html><html><head><style>
3
3
  body { margin: 0; padding: 20px; display: flex; justify-content: center; }
4
4
  svg { max-width: ${o}px; height: auto; }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "katucharts.js",
3
- "version": "0.2.12",
3
+ "version": "0.2.13",
4
4
  "description": "D3.js charting library with a simple declarative interface",
5
5
  "type": "module",
6
6
  "main": "./dist/katucharts.umd.js",