@skdx/web-components-charts 0.38.0

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.
Files changed (169) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +98 -0
  3. package/dist/area.cjs +109 -0
  4. package/dist/area.d.cts +2 -0
  5. package/dist/area.d.ts +2 -0
  6. package/dist/area.js +109 -0
  7. package/dist/bar.cjs +109 -0
  8. package/dist/bar.d.cts +2 -0
  9. package/dist/bar.d.ts +2 -0
  10. package/dist/bar.js +109 -0
  11. package/dist/boxplot.cjs +109 -0
  12. package/dist/boxplot.d.cts +2 -0
  13. package/dist/boxplot.d.ts +2 -0
  14. package/dist/boxplot.js +109 -0
  15. package/dist/bubble.cjs +109 -0
  16. package/dist/bubble.d.cts +2 -0
  17. package/dist/bubble.d.ts +2 -0
  18. package/dist/bubble.js +109 -0
  19. package/dist/bullet.cjs +109 -0
  20. package/dist/bullet.d.cts +2 -0
  21. package/dist/bullet.d.ts +2 -0
  22. package/dist/bullet.js +109 -0
  23. package/dist/bump.cjs +109 -0
  24. package/dist/bump.d.cts +2 -0
  25. package/dist/bump.d.ts +2 -0
  26. package/dist/bump.js +109 -0
  27. package/dist/candlestick.cjs +109 -0
  28. package/dist/candlestick.d.cts +2 -0
  29. package/dist/candlestick.d.ts +2 -0
  30. package/dist/candlestick.js +109 -0
  31. package/dist/chord.cjs +109 -0
  32. package/dist/chord.d.cts +2 -0
  33. package/dist/chord.d.ts +2 -0
  34. package/dist/chord.js +109 -0
  35. package/dist/circle-packing.cjs +109 -0
  36. package/dist/circle-packing.d.cts +2 -0
  37. package/dist/circle-packing.d.ts +2 -0
  38. package/dist/circle-packing.js +109 -0
  39. package/dist/combo.cjs +109 -0
  40. package/dist/combo.d.cts +2 -0
  41. package/dist/combo.d.ts +2 -0
  42. package/dist/combo.js +109 -0
  43. package/dist/dumbbell.cjs +109 -0
  44. package/dist/dumbbell.d.cts +2 -0
  45. package/dist/dumbbell.d.ts +2 -0
  46. package/dist/dumbbell.js +109 -0
  47. package/dist/funnel.cjs +109 -0
  48. package/dist/funnel.d.cts +2 -0
  49. package/dist/funnel.d.ts +2 -0
  50. package/dist/funnel.js +109 -0
  51. package/dist/gantt.cjs +109 -0
  52. package/dist/gantt.d.cts +2 -0
  53. package/dist/gantt.d.ts +2 -0
  54. package/dist/gantt.js +109 -0
  55. package/dist/gauge.cjs +109 -0
  56. package/dist/gauge.d.cts +2 -0
  57. package/dist/gauge.d.ts +2 -0
  58. package/dist/gauge.js +109 -0
  59. package/dist/heatmap.cjs +109 -0
  60. package/dist/heatmap.d.cts +2 -0
  61. package/dist/heatmap.d.ts +2 -0
  62. package/dist/heatmap.js +109 -0
  63. package/dist/histogram.cjs +109 -0
  64. package/dist/histogram.d.cts +2 -0
  65. package/dist/histogram.d.ts +2 -0
  66. package/dist/histogram.js +109 -0
  67. package/dist/icicle.cjs +109 -0
  68. package/dist/icicle.d.cts +2 -0
  69. package/dist/icicle.d.ts +2 -0
  70. package/dist/icicle.js +109 -0
  71. package/dist/index-oF5ss8v9.d.cts +2331 -0
  72. package/dist/index-oF5ss8v9.d.ts +2331 -0
  73. package/dist/index.cjs +109 -0
  74. package/dist/index.d.cts +29 -0
  75. package/dist/index.d.ts +29 -0
  76. package/dist/index.js +109 -0
  77. package/dist/line.cjs +109 -0
  78. package/dist/line.d.cts +2 -0
  79. package/dist/line.d.ts +2 -0
  80. package/dist/line.js +109 -0
  81. package/dist/linear-gauge.cjs +109 -0
  82. package/dist/linear-gauge.d.cts +2 -0
  83. package/dist/linear-gauge.d.ts +2 -0
  84. package/dist/linear-gauge.js +109 -0
  85. package/dist/map.cjs +109 -0
  86. package/dist/map.d.cts +2 -0
  87. package/dist/map.d.ts +2 -0
  88. package/dist/map.js +109 -0
  89. package/dist/marimekko.cjs +109 -0
  90. package/dist/marimekko.d.cts +2 -0
  91. package/dist/marimekko.d.ts +2 -0
  92. package/dist/marimekko.js +109 -0
  93. package/dist/network.cjs +109 -0
  94. package/dist/network.d.cts +2 -0
  95. package/dist/network.d.ts +2 -0
  96. package/dist/network.js +109 -0
  97. package/dist/organization.cjs +109 -0
  98. package/dist/organization.d.cts +2 -0
  99. package/dist/organization.d.ts +2 -0
  100. package/dist/organization.js +109 -0
  101. package/dist/parallel.cjs +109 -0
  102. package/dist/parallel.d.cts +2 -0
  103. package/dist/parallel.d.ts +2 -0
  104. package/dist/parallel.js +109 -0
  105. package/dist/pareto.cjs +109 -0
  106. package/dist/pareto.d.cts +2 -0
  107. package/dist/pareto.d.ts +2 -0
  108. package/dist/pareto.js +109 -0
  109. package/dist/pie.cjs +109 -0
  110. package/dist/pie.d.cts +2 -0
  111. package/dist/pie.d.ts +2 -0
  112. package/dist/pie.js +109 -0
  113. package/dist/polar-area.cjs +109 -0
  114. package/dist/polar-area.d.cts +2 -0
  115. package/dist/polar-area.d.ts +2 -0
  116. package/dist/polar-area.js +109 -0
  117. package/dist/radar.cjs +109 -0
  118. package/dist/radar.d.cts +2 -0
  119. package/dist/radar.d.ts +2 -0
  120. package/dist/radar.js +109 -0
  121. package/dist/radial.cjs +109 -0
  122. package/dist/radial.d.cts +2 -0
  123. package/dist/radial.d.ts +2 -0
  124. package/dist/radial.js +109 -0
  125. package/dist/range.cjs +109 -0
  126. package/dist/range.d.cts +2 -0
  127. package/dist/range.d.ts +2 -0
  128. package/dist/range.js +109 -0
  129. package/dist/sankey.cjs +109 -0
  130. package/dist/sankey.d.cts +2 -0
  131. package/dist/sankey.d.ts +2 -0
  132. package/dist/sankey.js +109 -0
  133. package/dist/scatter.cjs +109 -0
  134. package/dist/scatter.d.cts +2 -0
  135. package/dist/scatter.d.ts +2 -0
  136. package/dist/scatter.js +109 -0
  137. package/dist/sparkline.cjs +109 -0
  138. package/dist/sparkline.d.cts +2 -0
  139. package/dist/sparkline.d.ts +2 -0
  140. package/dist/sparkline.js +109 -0
  141. package/dist/sunburst.cjs +109 -0
  142. package/dist/sunburst.d.cts +2 -0
  143. package/dist/sunburst.d.ts +2 -0
  144. package/dist/sunburst.js +109 -0
  145. package/dist/swarm.cjs +109 -0
  146. package/dist/swarm.d.cts +2 -0
  147. package/dist/swarm.d.ts +2 -0
  148. package/dist/swarm.js +109 -0
  149. package/dist/timeline.cjs +109 -0
  150. package/dist/timeline.d.cts +2 -0
  151. package/dist/timeline.d.ts +2 -0
  152. package/dist/timeline.js +109 -0
  153. package/dist/tree.cjs +109 -0
  154. package/dist/tree.d.cts +2 -0
  155. package/dist/tree.d.ts +2 -0
  156. package/dist/tree.js +109 -0
  157. package/dist/treemap.cjs +109 -0
  158. package/dist/treemap.d.cts +2 -0
  159. package/dist/treemap.d.ts +2 -0
  160. package/dist/treemap.js +109 -0
  161. package/dist/waffle.cjs +109 -0
  162. package/dist/waffle.d.cts +2 -0
  163. package/dist/waffle.d.ts +2 -0
  164. package/dist/waffle.js +109 -0
  165. package/dist/waterfall.cjs +109 -0
  166. package/dist/waterfall.d.cts +2 -0
  167. package/dist/waterfall.d.ts +2 -0
  168. package/dist/waterfall.js +109 -0
  169. package/package.json +76 -0
@@ -0,0 +1,109 @@
1
+ var Er=Object.defineProperty;var Hr=Object.getOwnPropertyDescriptor;var g=(e,n,t,r)=>{for(var i=r>1?void 0:r?Hr(n,t):n,o=e.length-1,s;o>=0;o--)(s=e[o])&&(i=(r?s(n,t,i):s(i))||i);return r&&i&&Er(n,t,i),i};import{customElement as Li,property as te}from"lit/decorators.js";var Xn=e=>Number(e.toPrecision(12)),Ur,Qn=e=>(Ur??(Ur=new Intl.NumberFormat)).format(Xn(e)),Kr=e=>{let n=Math.round(Math.abs(e)),t=e<0?"-":"",r=Math.floor(n/3600),i=Math.floor(n%3600/60),o=s=>String(s).padStart(2,"0");return r>0?`${t}${r}h ${o(i)}m`:i>0?`${t}${i}m ${o(n%60)}s`:`${t}${n}s`};function ce(e){if(e===void 0)return Qn;if(typeof e=="function")return e;let{style:n,locale:t,digits:r,unit:i="",timeZone:o}=e,s=u=>i?h=>u(h)+i:u,l=u=>r===void 0?u===void 0?{}:{maximumFractionDigits:u}:{minimumFractionDigits:r,maximumFractionDigits:r},c=u=>{let h=new Intl.NumberFormat(t,u);return s(b=>h.format(Xn(b)))},d=u=>{let h=new Intl.DateTimeFormat(t,o?{...u,timeZone:o}:u);return b=>h.format(b)};switch(n){case"integer":return c({maximumFractionDigits:0});case"decimal":return c(l(2));case"percent":return c({style:"percent",...l(0)});case"currency":return c({style:"currency",currency:e.currency??"USD",...l()});case"compact":return c({notation:"compact",...l(1)});case"scientific":return c({notation:"scientific",...l(2)});case"date":return d({dateStyle:"medium"});case"time":return d({timeStyle:"short"});case"datetime":return d({dateStyle:"medium",timeStyle:"short"});case"duration":return s(Kr)}}function nt(e,n){if(typeof e=="string")return e;let t=e instanceof Date?e.getTime():e;return n?ce(n)(t):e instanceof Date?new Intl.DateTimeFormat().format(e):Qn(t)}var de=e=>{if(e instanceof Date)return e.getTime();if(typeof e=="number")return e;let n=Number(e);return Number.isFinite(n)&&e.trim()!==""?n:Date.parse(e)};function Ie([e,n],[t,r]){let i=n-e;return o=>i===0?t:t+(o-e)/i*(r-t)}function ve(e,n,t=5){if(e===n)return[e];let r=(n-e)/Math.max(1,t),i=10**Math.floor(Math.log10(r)),o=r/i,s=(o<1.5?1:o<3.5?2:o<7.5?5:10)*i,l=Math.floor(e/s)*s,c=Math.ceil(n/s)*s,d=[];for(let u=l;u<=c+s/2;u+=s)d.push(er(u));return d}function Jn(e,[n,t],r=.2){let i=e===0?0:(t-n)/e,o=i*(1-Math.max(0,Math.min(.9,r)));return{step:i,bandwidth:o,start:s=>n+s*i+(i-o)/2,center:s=>n+(s+.5)*i}}var er=e=>Number(e.toPrecision(12)),p=e=>Number(e.toFixed(2)),C=e=>typeof e=="number"&&Number.isFinite(e),ie=e=>e.filter(C);function ue(e){let n=1/0,t=-1/0;for(let r of e)C(r)&&(r<n&&(n=r),r>t&&(t=r));return n===1/0?[0,0]:[n,t]}function we(e,n="linear"){if(e.length===0)return"";let t=e[0];if(n==="step"||n==="stepBefore"||n==="stepAfter"){let d=`M${t.x} ${t.y}`;for(let u=1;u<e.length;u++){let h=e[u-1],b=e[u];n==="stepAfter"?d+=`H${b.x}V${b.y}`:n==="stepBefore"?d+=`V${b.y}H${b.x}`:d+=`H${p((h.x+b.x)/2)}V${b.y}H${b.x}`}return d}if(n==="linear"||e.length<3)return`M${e.map(d=>`${d.x} ${d.y}`).join("L")}`;let r=e.length,i=e.slice(1).map((d,u)=>d.x-e[u].x),o=e.slice(1).map((d,u)=>d.y-e[u].y),s=i.map((d,u)=>d===0?0:o[u]/d),l=[s[0]];for(let d=1;d<r-1;d++){let u=s[d-1],h=s[d];l.push(u*h<=0?0:(u+h)/2)}l.push(s[r-2]);for(let d=0;d<r-1;d++){let u=s[d];if(u===0){l[d]=0,l[d+1]=0;continue}let h=l[d]/u,b=l[d+1]/u,v=Math.hypot(h,b);v>3&&(l[d]=3*h*u/v,l[d+1]=3*b*u/v)}let c=`M${t.x} ${t.y}`;for(let d=0;d<r-1;d++){let u=e[d],h=e[d+1],b=i[d]/3;c+=`C${p(u.x+b)} ${p(u.y+b*l[d])} ${p(h.x-b)} ${p(h.y-b*l[d+1])} ${h.x} ${h.y}`}return c}var Fe=1e3,Ge=60*Fe,_e=60*Ge,je=24*_e,qr=[Fe,5*Fe,15*Fe,30*Fe,Ge,5*Ge,15*Ge,30*Ge,_e,3*_e,6*_e,12*_e,je,2*je,7*je,14*je];function tr(e,n,t=6){if(!(n>e))return[e];let r=n-e,i=qr.find(h=>r/h<=t),o=[];if(i!==void 0){for(let h=Math.ceil(e/i)*i;h<=n;h+=i)o.push(h);return o.length?o:[e,n]}let s=r/(30*je),l=[1,2,3,6,12,24,60,120].find(h=>s/h<=t)??240,c=new Date(e),d=c.getUTCFullYear(),u=Math.ceil((c.getUTCMonth()+(c.getUTCDate()>1?1:0))/l)*l;for(let h=Date.UTC(d,u,1);h<=n;)o.push(h),u+=l,u>=12&&(d+=Math.floor(u/12),u%=12),h=Date.UTC(d,u,1);return o.length?o:[e,n]}function nr(e,n){let t=Math.floor(Math.log10(e)),r=Math.ceil(Math.log10(n)),i=r-t<=1?[1,2,5]:[1],o=[];for(let s=t;s<=r;s++)for(let l of i)o.push(er(l*10**s));return o.filter(s=>s>=e/1.0001&&s<=n*1.0001)}function Te(e,n={}){if(n.thresholds&&n.thresholds.length>=2)return[...n.thresholds].filter(Number.isFinite).sort((c,d)=>c-d);let[t,r]=n.domain??ue(e),i=Math.max(1,e.length),o=Math.max(1,n.bins??Math.ceil(Math.log2(i)+1)),s=n.binWidth??(r>t?(r-t)/o:1),l=r>t?Math.max(1,Math.ceil((r-t)/s-1e-9)):1;return Array.from({length:l+1},(c,d)=>Number((t+d*s).toPrecision(12)))}function Ae(e,n){let t=[];for(let o=0;o+1<n.length;o++)t.push({x0:n[o],x1:n[o+1],count:0});if(t.length===0)return t;let r=n[0],i=n[n.length-1];for(let o of ie(e)){if(o<r||o>i)continue;let s=0,l=t.length-1;for(;s<l;){let c=s+l+1>>1;t[c].x0<=o?s=c:l=c-1}t[s].count++}return t}var Yr=/-?\d*\.?\d+(?:e[-+]?\d+)?/gi,Xr=/([MLTHVCSQAZmlthvcsqaz])([^MLTHVCSQAZmlthvcsqaz]*)/g,Qr={M:2,L:2,T:2,C:6,S:4,Q:4,A:7,H:-1,V:-2};function Jr(e,n,t){return e.replace(Xr,(r,i,o)=>{let s=Qr[i];if(s===void 0)return i+o;let c=(o.match(Yr)??[]).map((d,u)=>{let h=Number(d);if(s===-1)return String(h+n);if(s===-2)return String(h+t);let b=u%s;return s===7?b===5?String(h+n):b===6?String(h+t):d:String(b%2===0?h+n:h+t)});return i+c.join(" ")})}var rr=(e,n,t)=>e.map(r=>{switch(r.kind){case"rect":return{...r,x:r.x+n,y:r.y+t};case"circle":return{...r,cx:r.cx+n,cy:r.cy+t};case"line":return{...r,x1:r.x1+n,x2:r.x2+n,y1:r.y1+t,y2:r.y2+t};case"text":return{...r,x:r.x+n,y:r.y+t};case"path":return{...r,d:Jr(r.d,n,t)}}});var Lt=["primary","success","warning","danger","neutral"].flatMap(e=>[500,700].map(n=>`var(--skdx-color-${e}-${n})`)).sort((e,n)=>Number(e.endsWith("700)"))-Number(n.endsWith("700)"))),V={axis:"var(--skdx-color-border-strong)",grid:"var(--skdx-color-border-subtle)",label:"var(--skdx-color-text-muted)",focus:"var(--skdx-color-focus-ring)",positive:"var(--skdx-color-success-500)",negative:"var(--skdx-color-danger-500)",fontFamily:"var(--skdx-font-family)",fontSize:"var(--skdx-font-size-xs)"},rt=(e="neutral")=>e==="neutral"?V.axis:`var(--skdx-color-${e}-500)`,Rt=(e="neutral")=>e==="neutral"?V.label:e==="primary"?"var(--skdx-color-text-accent)":`var(--skdx-color-text-${e})`,ir=(e,n)=>n??Lt[e%Lt.length];var ne={top:16,right:16,bottom:32,left:48};function or(e,n,t=ne){return{x:t.left,y:t.top,width:Math.max(0,e-t.left-t.right),height:Math.max(0,n-t.top-t.bottom)}}function We(e){let n=e.legend;if(n)return n===!0?{}:n.enabled===!1?void 0:n}function Bt(e){let n=e.tooltip;return n===void 0||n===!0?{enabled:!0}:n===!1?{enabled:!1}:{...n,enabled:n.enabled??!0}}var sr=e=>e.crosshair===!0||Bt(e).trigger==="axis",it=20,ei=120,ar=e=>{let n=We(e);return n&&(n.position==="left"||n.position==="right")?n.width??ei:0},Pt=(e,n=600,t=300)=>({width:(e.width??n)-ar(e),height:(e.height??t)-(We(e)?.position==="bottom"?it:0)}),lr=e=>{let n=We(e);return n&&(n.position===void 0||n.position==="top")?it:0},he=6.5,cr=(e,n,t)=>t??(e.palette&&e.palette.length>0?e.palette[n%e.palette.length]:ir(n)),dr=(e,n)=>e.hiddenSeries?.includes(n)??!1;function Vt(e,n,t=[],r={},i=10,o=8,s=!1){let l=[],c=r.maxItems,d=c!==void 0&&c>=0&&e.length>c?e.slice(0,c):e,u=e.length-d.length,h=r.interactive??!0,b=o,v=i,x=(m,w,y,f)=>{let M=(w?18:4)+m.length*he;b>o&&(s||b+M>n-8)&&(b=o,v+=it),w&&l.push({kind:"rect",part:"legend-swatch",x:b,y:v-5,width:10,height:10,fill:w,opacity:f?.3:void 0,item:y}),l.push({kind:"text",part:"legend-label",x:b+(w?14:0),y:v,text:m,baseline:"middle",fill:f?V.grid:V.label,item:y}),b+=M+12};for(let m of d){let w=t.includes(m.name),y=h?{label:m.name,series:m.name,legend:!0}:void 0;x(r.formatter?.(m.name)??m.name,m.color,y,w)}return u>0&&x(`+${u} more`,void 0,void 0,!1),r.align==="end"?ti(l,n):l}function ti(e,n){let t=new Map;for(let i of e){let o=i.kind==="rect"?i.y+5:i.y;t.set(o,[...t.get(o)??[],i])}let r=[];for(let i of t.values()){let o=Math.max(...i.map(l=>l.kind==="rect"?l.x+l.width:l.x+l.text.length*he)),s=n-8-o;for(let l of i)r.push({...l,x:l.x+s})}return r}var ni=(e,n,t={})=>new Set(Vt(e,n,[],t).flatMap(r=>r.kind==="text"?[r.y]:[])).size;function Dt(e,n,t,r=[]){let i=We(e),o=i&&e.direction==="rtl"&&i.align===void 0?{...i,align:"end"}:i,s=Bt(e),l=o?.position==="bottom",c=ar(e),d=e.hiddenSeries??[],u=o?c?Vt(r,1/0,d,o,10,(o.position==="right"?n:0)+8,!0):Vt(r,n,d,o,l?t+10:10):[],h=l?ni(r,n,o):0;return{width:n+c,height:l?t+Math.max(1,h)*it:t,legendOffset:o?.position==="left"?c:void 0,tooltip:s.enabled,tooltipFormatter:s.formatter,axisTooltipFormatter:s.axisFormatter,tooltipPortal:s.portal,tooltipPlacement:s.placement,tooltipAnchored:s.followPointer===!1?!0:void 0,description:e.description,decorative:e.decorative,animate:e.animate===!0?300:e.animate||void 0,responsive:!!e.responsive,shapes:u}}function Nt(e){let n=e.legendOffset;if(!n)return e;let t=[...rr(e.shapes.filter(c=>!c.part.startsWith("legend-")),n,0),...e.shapes.filter(c=>c.part.startsWith("legend-"))],r=c=>({...c,x:c.x+n}),i=e.hit?{...e.hit,plot:r(e.hit.plot),xs:e.hit.xs.map(c=>c+n),brush:e.hit.brush?{box:r(e.hit.brush.box),window:r(e.hit.brush.window)}:void 0}:void 0,o=e.edit,s=o?{...o,scale:c=>o.scale(c)+n,invert:c=>o.invert(c-n),bars:o.bars.map(c=>({...c,x0:c.x0+n,x1:c.x1+n}))}:void 0,l=e.map?{...e.map,plot:r(e.map.plot)}:void 0;return{...e,shapes:t,hit:i,edit:s,map:l,legendOffset:void 0}}function ot(e,n,t,r,i,o="auto"){let s=Array.isArray(t)?t:[t],l=Math.max(...s.map(b=>b.length))*he+12,c=6+s.length*16,d=o==="top"?{x:e-l/2,y:n-c-8}:o==="bottom"?{x:e-l/2,y:n+8}:o==="left"?{x:e-l-8,y:n-c/2}:o==="right"?{x:e+8,y:n-c/2}:{x:e+12,y:n-c-6},u=Math.max(0,Math.min(r-l,d.x)),h=Math.max(0,Math.min(i-c,d.y));return[{kind:"rect",part:"tooltip",x:p(u),y:p(h),width:p(l),height:c,fill:"var(--skdx-color-surface-raised)",stroke:V.axis,rx:3},...s.map((b,v)=>({kind:"text",part:"tooltip-label",x:p(u+6),y:p(h+11+v*16),text:b,baseline:"middle",fill:"var(--skdx-color-text-default)",weight:s.length>1&&v===0?"bold":void 0}))]}function ur([e,n],t,r=!1,i){let o=typeof r=="boolean"?{scale:r?"log":"linear"}:r,s=ce(o.format??i),l=o.min??e,c=o.max??n;o.reversed&&(t=[t[1],t[0]]);let d={id:o.id,position:o.position,options:o};if(o.scale==="sqrt"){let m=O=>Math.sign(O)*Math.sqrt(Math.abs(O)),w=o.nice===!1?[l,c]:ve(l,c,o.ticks),y=o.min??w[0],f=o.max??w[w.length-1],M=Ie([m(y),m(f)],t),T=O=>M(m(O)),S=ve(y,f,o.ticks).filter(O=>O>=y-1e-9&&O<=f+1e-9);return{...d,scale:T,domain:[y,f],format:s,ticks:(S.length>=2?S:[y,f]).map(O=>({pos:p(T(O)),label:s(O)})),zero:p(T(Math.min(Math.max(0,y),f)))}}if(o.scale==="log"){let m=Math.max(l,Number.EPSILON),w=Math.max(c,m),y=nr(m,w),f=[Math.log10(m),Math.log10(w)],M=Ie(f,t),T=S=>M(Math.log10(Math.max(S,Number.EPSILON)));return{...d,scale:T,domain:f,format:s,ticks:y.map(S=>({pos:p(T(S)),label:s(S)})),zero:p(t[0])}}let u=ve(l,c,o.ticks),h=[o.min??(o.nice===!1?l:u[0]),o.max??(o.nice===!1?c:u[u.length-1])],b=Ie(h,t),v=u.filter(m=>m>=h[0]-1e-9&&m<=h[1]+1e-9),x=(v.length>=2?v:[h[0],h[1]]).map(m=>({pos:p(b(m)),label:s(m)}));return{...d,scale:b,domain:h,format:s,ticks:x,zero:p(b(Math.min(Math.max(0,h[0]),h[1])))}}var hr=e=>e?.grid!==!1;function st(e,n){if(e.length<2)return e;let t=e.reduce((i,o)=>Math.max(i,o.label.length),0)*he+8,r=Math.max(1,Math.ceil(e.length*t/Math.max(1,n)));return r===1?e:e.filter((i,o)=>o%r===0)}var Ft=(e,n,t,r)=>`${e}, ${n}: ${r(t)}`;function at(e,n,t,r){let i=e.error!==void 0?"error":e.loading?"loading":n?"empty":null;if(!i)return null;let{width:o,height:s}=Pt(e,t,r),l=i==="error"?e.error:i==="loading"?"Loading\u2026":e.emptyMessage??"No data available",c=[];return i==="loading"&&c.push({kind:"rect",part:"skeleton",x:0,y:0,width:o,height:s,fill:"var(--skdx-color-surface-sunken)",rx:4}),c.push({kind:"text",part:`state-${i}`,x:p(o/2),y:p(s/2),text:l,anchor:"middle",baseline:"middle",fill:i==="error"?"var(--skdx-color-text-danger)":V.label}),{...Dt(e,o,s),shapes:c,tooltip:!1}}function Gt(e,n={}){let{plot:t,xTicks:r,yTicks:i,baseline:o}=e,s=t.x+t.width,l=t.y+t.height,c=[],d=n.grid??!0,u=(x,m)=>m?{kind:"line",part:"grid",x1:x.pos,x2:x.pos,y1:t.y,y2:l,stroke:V.grid}:{kind:"line",part:"grid",x1:t.x,x2:s,y1:x.pos,y2:x.pos,stroke:V.grid},h=n.x?.tickRotation??0,b=(x,m,w,y)=>h?q(x,m,w,{part:y,anchor:h<0?"end":"start",baseline:"middle",rotate:h}):q(x,m,w,{part:y,anchor:"middle"}),v=(x,m,w,y,f)=>{for(let M of x)c.push(m==="x"?{kind:"line",part:"tick",x1:M.pos,x2:M.pos,y1:w,y2:p(w+y*f),stroke:V.axis}:{kind:"line",part:"tick",x1:w,x2:p(w+y*f),y1:M.pos,y2:M.pos,stroke:V.axis})};if(n.categoryGrid)for(let x of r)c.push(u(x,!n.horizontal));if(n.horizontal){let x=n.axes??[{ticks:i,position:"bottom",offset:0,label:n.yLabel,...n.y}];if(d)for(let m of i)c.push(u(m,!0));x[0]?.showLine!==!1&&c.push({kind:"line",part:"axis",x1:o,x2:o,y1:t.y,y2:l,stroke:V.axis});for(let m of x){let w=m.position==="top"||m.position==="right",y=p(w?t.y-m.offset:l+m.offset),f=w||m.offset>0;m.showLine&&f&&c.push({kind:"line",part:"axis",x1:t.x,x2:s,y1:y,y2:y,stroke:V.axis}),m.showTicks&&v(m.ticks,"x",y,w?-1:1,m.tickSize??4);let M=p(w?y-8:y+20);for(let T of m.ticks)c.push(w?q(T.pos,M,T.label,{part:"x-label-top",anchor:"middle"}):b(T.pos,M,T.label,"x-label"));m.label&&c.push(f?q(4,M,m.label,{part:"axis-title",anchor:"start",baseline:w?void 0:"middle"}):q(4,t.y-6,m.label,{part:"axis-title",anchor:"start"}))}n.x?.showLine&&c.push({kind:"line",part:"axis",x1:n.rtl?s:t.x,x2:n.rtl?s:t.x,y1:t.y,y2:l,stroke:V.axis}),n.x?.showTicks&&v(r,"y",n.rtl?s:t.x,n.rtl?1:-1,n.x.tickSize??4);for(let m of r)c.push(n.rtl?q(s+8,m.pos,m.label,{part:"y-label",anchor:"start",baseline:"middle"}):q(t.x-8,m.pos,m.label,{part:"y-label",anchor:"end",baseline:"middle"}))}else{if(d)for(let m of i)c.push(u(m,!1));n.y?.showLine!==!1&&c.push({kind:"line",part:"axis",x1:t.x,x2:s,y1:o,y2:o,stroke:V.axis});let x=n.axes??[{ticks:i,position:"left",offset:0,label:n.yLabel,...n.y},...n.rightTicks?[{ticks:n.rightTicks,position:"right",offset:0,label:n.rightLabel}]:[]];for(let m of x){let w=m.position==="left",y=w?t.x-m.offset:s+m.offset,f=w?"y-label":"y-label-right";m.showLine&&c.push({kind:"line",part:"axis",x1:p(y),x2:p(y),y1:t.y,y2:l,stroke:V.axis}),m.showTicks&&v(m.ticks,"y",p(y),w?-1:1,m.tickSize??4);for(let M of m.ticks)c.push(q(p(w?y-8:y+8),M.pos,M.label,{part:f,anchor:w?"end":"start",baseline:"middle"}));m.label&&c.push(q(p(w?m.offset===0?4:Math.max(4,y-40):m.offset===0?e.width-4:Math.min(e.width-4,y+40)),t.y-6,m.label,{part:"axis-title",anchor:w?"start":"end"}))}n.x?.showTicks&&v(r,"x",l,1,n.x.tickSize??4);for(let m of r)c.push(b(m.pos,l+(h?12:20),m.label,"x-label"))}return n.xLabel&&c.push(q(p(t.x+t.width/2),e.height-4,n.xLabel,{part:"axis-title",anchor:"middle"})),n.horizontal&&n.rightLabel&&c.push(q(e.width-4,t.y-6,n.rightLabel,{part:"axis-title",anchor:"end"})),c}var q=(e,n,t,r={})=>({kind:"text",part:"label",x:e,y:n,text:t,fill:V.label,...r}),Ze=(e,n,t,r,i,o)=>({kind:"circle",part:"point",cx:e,cy:n,r:t,fill:r,title:i,item:o});function _t(e,n){let t=[],{plot:r}=n,i=r.x+r.width,o=r.y+r.height,s=c=>Math.max(r.x,Math.min(i,c)),l=c=>Math.max(r.y,Math.min(o,c));for(let c of e??[]){let d=c.color??rt(c.variant),u=c.color??Rt(c.variant),h={part:"reference-label",fill:u},b=n.horizontal===!0;if("y"in c){let v=p(n.y(c.y,c.axis??"left"));if(b){let x=s(v);t.push(...mr(x,r.y,o,d,c.label,h))}else{let x=l(v);t.push(...fr(r.x,i,x,d,c.label,h))}}else if("x"in c){let v=n.x(c.x);if(v===void 0)continue;b?t.push(...fr(r.x,i,l(p(v)),d,c.label,h)):t.push(...mr(s(p(v)),r.y,o,d,c.label,h))}else if("y1"in c){let v=p(n.y(c.y1,c.axis??"left")),x=p(n.y(c.y2,c.axis??"left"));b?t.push(...br(s(Math.min(v,x)),s(Math.max(v,x)),r,d,c.label,u)):t.push(...pr(l(Math.min(v,x)),l(Math.max(v,x)),r,d,c.label,u))}else{let v=n.x(c.x1),x=n.x(c.x2);if(v===void 0||x===void 0)continue;let m=p(Math.min(v,x)),w=p(Math.max(v,x));b?t.push(...pr(l(m),l(w),r,d,c.label,u)):t.push(...br(s(m),s(w),r,d,c.label,u))}}return t}function fr(e,n,t,r,i,o){let s={kind:"line",part:"reference",x1:e,x2:n,y1:t,y2:t,stroke:r,dash:"6 4",strokeWidth:1.5,title:i};return i?[s,q(n-4,t-5,i,{...o,anchor:"end"})]:[s]}function mr(e,n,t,r,i,o){let s={kind:"line",part:"reference",x1:e,x2:e,y1:n,y2:t,stroke:r,dash:"6 4",strokeWidth:1.5,title:i};return i?[s,q(e+4,n+10,i,{...o,anchor:"start"})]:[s]}function pr(e,n,t,r,i,o){let s={kind:"rect",part:"reference-area",x:t.x,y:e,width:t.width,height:p(Math.max(0,n-e)),fill:r,opacity:.12,title:i};return i?[s,q(t.x+t.width-4,e+12,i,{part:"reference-label",fill:o,anchor:"end"})]:[s]}function br(e,n,t,r,i,o){let s={kind:"rect",part:"reference-area",x:e,y:t.y,width:p(Math.max(0,n-e)),height:t.height,fill:r,opacity:.12,title:i};return i?[s,q(e+4,t.y+12,i,{part:"reference-label",fill:o,anchor:"start"})]:[s]}function gr(e,n){let t=[],{plot:r}=n,i=r.x+r.width,o=r.y+r.height;for(let s of e??[]){let l=s.color??rt(s.variant),c=s.color??Rt(s.variant),d=(x,m,w)=>{let y=n.x(x);if(y===void 0)return;let f=n.y(m,w??"left");return n.horizontal?{x:p(f),y:p(y)}:{x:p(y),y:p(f)}},u=s.id??s.label,h=x=>({label:x,id:u,name:s.label});if(s.type==="line"||s.type==="band"){let{type:x,id:m,...w}=s;t.push(..._t([w],n));continue}if(s.type==="rect"){let x=d(s.x1,s.y1,s.axis),m=d(s.x2,s.y2,s.axis);if(!x||!m)continue;let w=Math.max(r.x,Math.min(x.x,m.x)),y=Math.max(r.y,Math.min(x.y,m.y)),f=s.label??"";t.push({kind:"rect",part:"annotation-rect",x:p(w),y:p(y),width:p(Math.max(0,Math.min(i,Math.max(x.x,m.x))-w)),height:p(Math.max(0,Math.min(o,Math.max(x.y,m.y))-y)),fill:l,opacity:.12,stroke:l,title:f||void 0,item:f?h(f):void 0}),s.label&&t.push(q(p(w+4),p(y+12),s.label,{part:"annotation-label",fill:c}));continue}let b=d(s.x,s.y,s.axis);if(!b)continue;if(s.type==="text"){t.push(q(b.x,b.y,s.text,{part:"annotation-text",fill:c,anchor:"middle",baseline:"middle",title:s.label}));continue}let v=s.label??`${String(s.x)}, ${s.y}`;if(t.push({kind:"circle",part:"annotation-point",cx:b.x,cy:b.y,r:5,fill:l,stroke:"var(--skdx-color-surface-default)",title:v,item:h(v)}),s.type==="callout"&&s.label){let[x,m]=s.offset??[16,-16],w=p(Math.max(r.x,Math.min(i,b.x+x))),y=p(Math.max(r.y,Math.min(o,b.y+m)));t.push({kind:"line",part:"annotation-leader",x1:b.x,y1:b.y,x2:w,y2:y,stroke:l},q(w,y,s.label,{part:"annotation-label",fill:c,anchor:x>=0?"start":"end",baseline:"middle"}))}}return t}var jt=2e3;function ri(e){if(e!=="none")return e===void 0||e==="auto"?{strategy:"lttb",threshold:jt}:typeof e=="string"?{strategy:e,threshold:jt}:{strategy:e.strategy,threshold:e.threshold??jt}}function ii(e,n){let t=e.length;if(n>=t||n<3)return e.map((l,c)=>c);let r=[0],i=[],o=(t-2)/(n-2),s=0;for(let l=0;l<n-2;l++){let c=Math.floor((l+1)*o)+1,d=Math.min(t-1,Math.floor((l+2)*o)+1),u=0,h=0,b=0;for(let M=c;M<d;M++){let T=e[M];C(T)&&(u+=M,h+=T,b++)}u=b?u/b:(c+d)/2,h=b?h/b:0;let v=Math.floor(l*o)+1,x=Math.min(t-1,Math.floor((l+1)*o)+1),m=e[s],w=C(m)?m:0,y=-1,f=-1;for(let M=v;M<x;M++){let T=e[M];if(!C(T)){i.push(M);continue}let S=Math.abs((s-u)*(T-w)-(s-M)*(h-w));S>f&&(f=S,y=M)}y<0&&(y=v),r.push(y),s=y}return r.push(t-1),i.length?[...new Set([...r,...i])].sort((l,c)=>l-c):r}function oi(e,n){let t=e.length,r=Math.max(1,Math.floor(n/2));if(r*2>=t)return e.map((s,l)=>l);let i=[],o=t/r;for(let s=0;s<r;s++){let l=Math.floor(s*o),c=s===r-1?t:Math.floor((s+1)*o),d=-1,u=-1;for(let h=l;h<c;h++){let b=e[h];if(!C(b)){i.push(h);continue}(d<0||b<e[d])&&(d=h),(u<0||b>e[u])&&(u=h)}d>=0&&i.push(Math.min(d,u)),u>=0&&u!==d&&i.push(Math.max(d,u))}return[...new Set(i)].sort((s,l)=>s-l)}function si(e,n){let t=e.length,r=Math.max(1,Math.floor(n/4));if(r*4>=t)return e.map((s,l)=>l);let i=[],o=t/r;for(let s=0;s<r;s++){let l=Math.floor(s*o),c=s===r-1?t:Math.floor((s+1)*o),d=-1,u=-1,h=-1,b=-1;for(let v=l;v<c;v++){let x=e[v];if(!C(x)){i.push(v);continue}h<0&&(h=v),b=v,(d<0||x<e[d])&&(d=v),(u<0||x>e[u])&&(u=v)}for(let v of[h,d,u,b])v>=0&&i.push(v)}return[...new Set(i)].sort((s,l)=>s-l)}function xr(e,n,t){let r=ri(t);if(!r||n<=r.threshold||e.length===0)return;let i=r.strategy==="minmax"?oi:r.strategy==="m4"?si:ii,o=new Set;for(let s of e)for(let l of i(s.slice(0,n),r.threshold))o.add(l);return[...o].sort((s,l)=>s-l)}function yr(e,n,t,r,i,o,s,l){if(r==="circle")return{...Ze(e,n,t,i,o,s),part:l};let c=r==="square"?`M${p(e-t)} ${p(n-t)}h${p(2*t)}v${p(2*t)}h${p(-2*t)}Z`:r==="diamond"?`M${p(e)} ${p(n-t*1.3)}L${p(e+t*1.3)} ${p(n)}L${p(e)} ${p(n+t*1.3)}L${p(e-t*1.3)} ${p(n)}Z`:`M${p(e)} ${p(n-t*1.2)}L${p(e+t*1.15)} ${p(n+t*.9)}L${p(e-t*1.15)} ${p(n+t*.9)}Z`;return{kind:"path",part:l,d:c,fill:i,title:o,item:s}}var ai=e=>{let n=0;return e.map(t=>C(t)?n+=t:null)},li=e=>e.map((n,t)=>{let r=e[t-1];return t>0&&C(n)&&C(r)?n-r:null}),ci=e=>e.map((n,t)=>{let r=e[t-1];return t>0&&C(n)&&C(r)&&r!==0?(n-r)/Math.abs(r):null});function di(e,n){let t=Math.max(1,Math.floor(n));return e.map((r,i)=>{if(i<t-1)return null;let o=0;for(let s=i-t+1;s<=i;s++){let l=e[s];if(!C(l))return null;o+=l}return o/t})}function ui(e,n="max"){let t=0;for(let r of e)C(r)&&(t=n==="sum"?t+r:Math.max(t,r));return e.map(r=>C(r)?t===0?0:r/t:null)}function hi(e,n="desc"){let t=e.filter(C).sort((r,i)=>n==="asc"?r-i:i-r);return e.map(r=>C(r)?t.indexOf(r)+1:null)}var fi=(e,n=-1/0,t=1/0)=>e.map(r=>C(r)&&r>=n&&r<=t?r:null),mi=(e,n="asc")=>[...e].sort((t,r)=>C(t)?C(r)?n==="asc"?t-r:r-t:-1:C(r)?1:0);function pi(e,n,t="sum"){let r=Math.max(1,Math.floor(n)),i=[];for(let o=0;o<e.length;o+=r){let s=e.slice(o,o+r).filter(C);if(s.length===0){i.push(null);continue}let l=s.reduce((c,d)=>c+d,0);i.push(t==="sum"?l:t==="mean"?l/s.length:t==="min"?Math.min(...s):Math.max(...s))}return i}function bi(e,n={}){let t=e.filter(C),r=Te(t,n);return{edges:r,counts:Ae(t,r).map(i=>i.count)}}function Wt(e,n){let t=[...e];for(let r of n??[])switch(r.type){case"cumulative":t=ai(t);break;case"difference":t=li(t);break;case"percentageChange":t=ci(t);break;case"movingAverage":t=di(t,r.window);break;case"normalize":t=ui(t,r.to);break;case"rank":t=hi(t,r.order);break;case"filter":t=fi(t,r.min,r.max);break;case"sort":t=mi(t,r.order);break;case"aggregate":t=pi(t,r.every,r.method);break;case"bin":t=bi(t,r).counts;break}return t}var gi=100,xi=2e3,kr=32,vr=28,ct=e=>e.position==="right"||e.position==="top";function yi(e){let t=(e.yAxis===void 0?[]:Array.isArray(e.yAxis)?e.yAxis:[e.yAxis]).map((i,o)=>({...i,id:i.id??(o===0?"left":o===1?"right":String(o)),position:i.position??(o===1?"right":"left")}));t.length===0&&t.push({id:"left",position:"left"});let r=t.some(i=>i.id==="right"||ct(i));return e.rightAxis?t.push({...e.rightAxis,id:"right",position:"right"}):!r&&e.series.some(i=>i.axis==="right")&&t.push({id:"right",position:"right"}),t}function Mr(e,n){let t=e[0]?.id;return n===void 0||n==="left"?t:n==="right"?(e.find(r=>r.id==="right")??e.find(ct))?.id:e.find(r=>r.id===n)?.id}var lt=e=>e.kind==="bar"||e.kind==="range"&&e.style==="bar";function Sr(e,n){let t=ce(e.format),{series:r,categories:i,issues:o,axes:s}=vi(e,n,t),l=e.direction==="rtl",c=e.baseline??0,d=Math.max(i.length,...r.map(a=>Math.max(a.data.length,a.low.length))),u=r.every(a=>ie(a.data).length===0&&ie(a.high).length===0),h=at(e,u);if(h)return{...h,issues:o};let b=e.xAxis?.type??"category",v=b!=="category"&&i.length>0&&i.every(a=>typeof a!="string"||b==="time"&&C(de(a))),x=v?i.map(de):[],[m,w]=ue(x),y=e.xAxis?.format??(b==="time"?{style:w-m<2*864e5?"time":"date"}:void 0),f=Array.from({length:d},(a,k)=>{let $=i[k];return $===void 0?String(k+1):nt($,y)}),M=ki(e.zoom,d),T=Array.from({length:M.end-M.start},(a,k)=>M.start+k),S=e.orientation==="horizontal",G=r.map(a=>({...a,hidden:a.hidden||S&&!lt(a)})).filter(a=>!a.hidden),j=G.some(a=>!lt(a))?xr(G.filter(a=>!lt(a)).map(a=>T.map(k=>(a.kind==="range"?a.high[k]:a.data[k])??null)),T.length,e.sampling):void 0,B=j?j.map(a=>T[a]):T,Y=e.stacked==="percent"||e.stackOffset==="expand",Q=e.stackOffset??"zero",se=new Map,pe=new Map,bt=new Map;for(let a of G)a.stack!==void 0&&a.kind!=="range"&&bt.set(a.stack,[...bt.get(a.stack)??[],a]);for(let a of bt.values()){let k=new Array(d).fill(c),$=new Array(d).fill(c),_=new Array(d).fill(0);if(Y)for(let P of a)P.data.forEach((z,N)=>{C(z)&&(_[N]=_[N]+Math.abs(z))});for(let P of a){let z=[],N=[];for(let D=0;D<d;D++){let F=P.data[D];if(!C(F)){z.push(null),N.push(null);continue}let L=_[D],I=Y?L>0?F/L:0:F,W=I>=0?k:$;z.push(W[D]),W[D]=W[D]+I,N.push(W[D])}se.set(P,z),pe.set(P,N)}if(Q==="silhouette"||Q==="wiggle"){let P=new Array(d).fill(0);if(Q==="silhouette")for(let z=0;z<d;z++)P[z]=-(k[z]-c)/2;else{let z=0;for(let N=0;N<d;N++){let D=a.length,F=0;for(let I=0;I<D;I++){let W=a[I],Z=W.data[N],K=W.data[N-1],ee=N>0&&C(Z)&&C(K)?Z-K:0;F+=(D-I-.5)*ee}let L=k[N]-c;z=N===0?-L/2:z-(L>0?F/Math.max(1,D):0),P[N]=z}}for(let z of a){let N=se.get(z),D=pe.get(z);for(let F=0;F<d;F++){let L=N[F],I=D[F];C(L)&&(N[F]=L+P[F]),C(I)&&(D[F]=I+P[F])}}}}let Cn=a=>a.kind==="range"?{from:a.low,to:a.high}:{from:se.get(a)??new Array(d).fill(c),to:pe.get(a)??a.data},In=a=>{let k=[],$=!1;for(let z of G){if(z.axis!==a)continue;let{from:N,to:D}=Cn(z);for(let F of B){let L=D[F];if(C(L)&&k.push(L),z.kind==="range"||z.stack!==void 0){let I=N[F];C(I)&&k.push(I)}}if(z.errors)for(let F of B){let L=wr(z.data[F],z.errors[F]);L&&k.push(L[0],L[1])}(z.kind==="bar"||z.kind==="area")&&Q==="zero"&&($=!0)}let[_,P]=ue(k);return $?[Math.min(c,_),Math.max(c,P)]:[_,P]},{width:Tn,height:An}=Pt(e),Pr=e.brush?kr+vr:0,On=B.reduce((a,k)=>Math.max(a,f[k].length),0)*he,zn=Y?{style:"percent"}:void 0,Dr=a=>{if(a.scale==="log")return ne.left;let[k,$]=In(a.id),_=ce(a.format??zn??e.format),P=ve(a.min??k,a.max??$).reduce((z,N)=>Math.max(z,_(N).length),0);return Math.max(ne.left,P*he+14)+(a.showTicks?a.tickSize??4:0)},gt=a=>S?ct(a)?"top":"bottom":ct(a)!==l?"right":"left",Ln=a=>S?24+(a.showTicks?a.tickSize??4:0):Dr(a),Nr=new Set(G.map(a=>a.axis)),xt=s.filter(a=>Nr.has(a.id)||s.length>1),Rn=new Map,Me={left:0,right:0,top:0,bottom:0};for(let a of xt){let k=gt(a);Rn.set(a.id,Me[k]),Me[k]+=Ln(a)}let Vn=xt.find(a=>gt(a)==="bottom"),Fr={top:ne.top+lr(e)+(s.some(a=>a.label)?12:0)+Me.top,right:S?l?Math.max(ne.left,On+16):ne.right:Math.max(ne.right,Me.right),bottom:ne.bottom+Pr+(e.xAxis?.label?14:0)+(e.xAxis?.tickRotation?24:0)+Me.bottom-(Vn?Ln(Vn):0),left:S?l?ne.right:Math.max(ne.left,On+16):Math.max(ne.left,Me.left)},U=or(Tn,An,Fr),Gr=S?l?[U.x+U.width,U.x]:[U.x,U.x+U.width]:[U.y+U.height,U.y],Bn=S?[U.y,U.y+U.height]:l?[U.x+U.width,U.x]:[U.x,U.x+U.width],yt=new Map(s.map(a=>[a.id,{...ur(In(a.id),Gr,{format:zn,...a},e.format),position:gt(a),offset:Rn.get(a.id)??0}])),Pn=s[0]?.id,Ke=yt.get(Pn),kt=a=>yt.get(Mr(s,a)??Pn)??Ke,ae=(a,k)=>kt(k).scale(a),Dn=a=>p(a.scale(Math.min(Math.max(c,Math.min(...a.domain)),Math.max(...a.domain)))),qe=Jn(B.length,Bn,e.barGap),vt=B.map(a=>x[a]),wt=[...vt].sort((a,k)=>a-k),Se=1/0;for(let a=1;a<wt.length;a++)Se=Math.min(Se,wt[a]-wt[a-1]);let[$e,Re]=ue(vt),le=Se===1/0?Math.max(1,Math.abs(Re)*.05||1):Se/2,Ve=Ie([$e-le,Re+le],Bn),Ye=a=>p(v?Ve(vt[a]):qe.center(a)),Nn=v?Math.abs(Ve($e+(Se===1/0?le:Se))-Ve($e))*.8:qe.bandwidth,Fn=a=>v?Ye(a)-Nn/2:qe.start(a),_r=v?(b==="time"?tr($e-le,Re+le):ve($e-le,Re+le)).filter(a=>a>=$e-le&&a<=Re+le).map(a=>({pos:p(Ve(a)),label:nt(a,y)})):st(B.map((a,k)=>({pos:Ye(k),label:f[a]})),S?1/0:U.width/Math.max(.2,Math.abs(Math.cos((e.xAxis?.tickRotation??0)*Math.PI/180)))),Mt={...Dt(e,Tn,An,r.map(a=>({name:a.name,color:a.color}))),plot:U,xTicks:_r,yTicks:S?st(Ke.ticks,U.width):Ke.ticks,baseline:Dn(Ke)},jr=s[0],Gn=Gt(Mt,{horizontal:S,rtl:l,axes:xt.map(a=>{let k=yt.get(a.id);return{ticks:S?st(k.ticks,U.width):k.ticks,position:k.position,offset:k.offset??0,label:a.label,showLine:a.showLine,showTicks:a.showTicks,tickSize:a.tickSize}}),xLabel:e.xAxis?.label,grid:hr(jr),categoryGrid:e.xAxis?.grid===!0,x:e.xAxis}),Wr=a=>{if(typeof a=="number"&&i.every($=>typeof $=="string"))return a;let k=typeof a=="string"?a:de(a);for(let $=0;$<d;$++){let _=i[$];if(_!==void 0&&(typeof k=="string"?_===k||f[$]===k:de(_)===k))return $}},_n={plot:U,horizontal:S,x:a=>{if(v&&(typeof a!="string"||C(de(a))))return Ve(de(a));let k=Wr(a),$=k===void 0?-1:B.indexOf(k);return $<0?void 0:qe.center($)},y:(a,k)=>ae(a,k)};Gn.push(..._t(e.references,_n));let St=[],$t=new Map;for(let a of G){if(!lt(a))continue;let k=a.stack??a,$=St.indexOf(k);$<0&&($=St.push(k)-1),$t.set(a,$)}let Xe=Nn/Math.max(1,St.length),be=Math.min(Xe,e.barWidth??1/0),jn=(Xe-be)/2,Ct=[],Qe=[],It=[],Tt=[],At=[],Wn=[],Je=[],et=a=>kt(a.axis).format,Ot=Math.max(0,e.minBarSize??0),Zr=(a,k,$)=>{let _=Math.abs(k-a);if(_>=Ot)return[Math.min(a,k),_];let z=a+(S?$?1:-1:$?-1:1)*Ot;return[Math.min(a,z),Ot]},Be=(a,k,$,_)=>({label:_,series:a.name,seriesId:a.id??a.name,category:f[k],index:k,value:$}),Zn=(a,k,$,_)=>{let P=wr(_,a.errors?.[k]);if(!P)return;let z=p(ae(P[0],a.axis)),N=p(ae(P[1],a.axis)),D=4,F="var(--skdx-color-text-default)",L=`${a.name}, ${f[k]}: ${et(a)(P[0])} \u2013 ${et(a)(P[1])}`;Wn.push(S?{kind:"line",part:"error-bar",x1:z,x2:N,y1:$,y2:$,stroke:F,title:L}:{kind:"line",part:"error-bar",x1:$,x2:$,y1:z,y2:N,stroke:F,title:L},S?{kind:"line",part:"error-cap",x1:z,x2:z,y1:p($-D),y2:p($+D),stroke:F}:{kind:"line",part:"error-cap",x1:p($-D),x2:p($+D),y1:z,y2:z,stroke:F},S?{kind:"line",part:"error-cap",x1:N,x2:N,y1:p($-D),y2:p($+D),stroke:F}:{kind:"line",part:"error-cap",x1:p($-D),x2:p($+D),y1:N,y2:N,stroke:F})};for(let a of G){let{from:k,to:$}=Cn(a),_=et(a),P=B.length<=xi;if(a.kind==="bar"){let L="";B.forEach((I,W)=>{let Z=a.data[I],K=k[I],ee=$[I];if(!C(Z)||!C(K)||!C(ee))return;let Ce=ae(K,a.axis),ke=ae(ee,a.axis),[Pe,De]=Zr(Ce,ke,ee>=K),Ne=Fn(W)+$t.get(a)*Xe+jn,Hn=p(S?Pe:Ne),Un=p(S?Ne:Pe),zt=p(S?De:be),Kn=p(S?be:De);if(!P){L+=`M${Hn} ${Un}h${zt}v${Kn}h${-zt}Z`;return}let qn=Ft(a.name,f[I],Y?ee-K:Z,_);if(Qe.push({kind:"rect",part:"bar",x:Hn,y:Un,width:zt,height:Kn,fill:a.color,rx:e.radius,title:qn,item:Be(a,I,Z,qn)}),Zn(a,I,p(Ne+be/2),Z),e.labels){let Yn=_(Y?ee-K:Z);At.push(S?q(p(Math.max(Ce,ke)+4),p(Ne+be/2),Yn,{baseline:"middle"}):q(p(Ne+be/2),p(Math.min(Ce,ke)-4),Yn,{anchor:"middle"}))}}),L&&Qe.push({kind:"path",part:"bars",d:L,fill:a.color,title:a.name});continue}if(a.kind==="range"&&a.style==="bar"){B.forEach((L,I)=>{let W=k[L],Z=$[L];if(!C(W)||!C(Z))return;let K=ae(Math.min(W,Z),a.axis),ee=ae(Math.max(W,Z),a.axis),Ce=Fn(I)+$t.get(a)*Xe+jn,ke=`${a.name}, ${f[L]}: ${_(Math.min(W,Z))} \u2013 ${_(Math.max(W,Z))}`,Pe=Be(a,L,Z,ke),De=Math.max(1,Math.abs(ee-K));Qe.push(S?{kind:"rect",part:"range",x:p(Math.min(K,ee)),y:p(Ce),width:p(De),height:p(be),fill:a.color,rx:e.radius,title:P?ke:void 0,item:Pe}:{kind:"rect",part:"range",x:p(Ce),y:p(Math.min(K,ee)),width:p(be),height:p(De),fill:a.color,rx:e.radius,title:P?ke:void 0,item:Pe})});continue}let z=e.nulls==="connect"||e.nulls===void 0&&e.connectNulls,N=[],D=[];B.forEach((L,I)=>{let W=k[L],Z=$[L];if(!C(Z)||!C(W)){!z&&D.length&&(N.push(D),D=[]);return}D.push({x:Ye(I),y:p(ae(Z,a.axis)),y0:p(ae(W,a.axis)),i:L})}),D.length&&N.push(D);let F=a.markers??B.length<=gi;for(let L of N){let I=we(L,a.curve);if(a.kind==="range"&&a.style==="line"){It.push({kind:"path",part:"range-high",d:I,stroke:a.color,strokeWidth:2,strokeLinejoin:"round"},{kind:"path",part:"range-low",d:we(L.map(W=>({x:W.x,y:W.y0})),a.curve),stroke:a.color,strokeWidth:2,strokeLinejoin:"round",dash:"4 3"});continue}if(a.kind==="range"){let W=we([...L].reverse().map(Z=>({x:Z.x,y:Z.y0})),a.curve);Ct.push({kind:"path",part:"range",d:`${I}L${W.slice(1)}Z`,fill:a.color,fillOpacity:.2,title:a.name});continue}if(a.kind==="area"){let W=Dn(kt(a.axis)),Z=a.stack!==void 0?we([...L].reverse().map(ee=>({x:ee.x,y:ee.y0})),a.curve).slice(1):`${L[L.length-1]?.x} ${W}L${L[0]?.x} ${W}`,K=`skdx-g-${a.index}`;a.gradient&&!Je.some(ee=>ee.id===K)&&Je.push({id:K,vertical:!0,stops:[{offset:0,color:a.color,opacity:a.fillOpacity},{offset:1,color:a.color,opacity:0}]}),Ct.push({kind:"path",part:"area",d:`${I}L${Z}Z`,fill:a.gradient?`url(#${K})`:a.color,fillOpacity:a.gradient?void 0:a.fillOpacity})}It.push({kind:"path",part:"line",d:I,stroke:a.color,strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",dash:a.dash})}if(a.kind==="range"&&P)for(let L of N)for(let I of L){let W=a.low[I.i],Z=a.high[I.i],K=`${a.name}, ${f[I.i]}: ${_(Math.min(W,Z))} \u2013 ${_(Math.max(W,Z))}`;Tt.push({...Ze(I.x,I.y,.01,a.color,K,Be(a,I.i,Z,K)),part:"anchor"})}if(a.kind!=="range")for(let L of N)for(let I of L){if(!F&&!P&&!e.labels&&!a.errors)continue;let W=a.data[I.i],Z=Y?$[I.i]-k[I.i]:W,K=Ft(a.name,f[I.i],Z,_);(F||P)&&Tt.push(F&&a.symbol!=="circle"?yr(I.x,I.y,a.markerSize,a.symbol,a.color,P?K:void 0,Be(a,I.i,W,K),"point"):{...Ze(I.x,I.y,F?a.markerSize:.01,a.color,P?K:void 0,Be(a,I.i,W,K)),part:F?"point":"anchor"}),P&&Zn(a,I.i,S?I.y:I.x,$[I.i]),e.labels&&At.push(q(I.x,I.y-8,_(Z),{anchor:"middle"}))}}let En={plot:U,xs:S?[]:B.map((a,k)=>Ye(k)),rows:B.map(a=>[f[a],...G.map(k=>{let $=et(k);if(k.kind==="range"){let P=k.low[a],z=k.high[a];return`${k.name}: ${C(P)&&C(z)?`${$(P)} \u2013 ${$(z)}`:"\u2014"}`}let _=k.data[a];return`${k.name}: ${C(_)?$(Y?(pe.get(k)?.[a]??0)-(se.get(k)?.[a]??0):_):"\u2014"}`})]),count:d,zoom:M,crosshair:sr(e)},tt=[];if(e.brush&&!S){let a={x:U.x,y:U.y+U.height+vr,width:U.width,height:kr},k=G.find(_=>_.kind!=="range"),$={x:p(a.x+M.start/Math.max(1,d)*a.width),y:a.y,width:p((M.end-M.start)/Math.max(1,d)*a.width),height:a.height};if(tt.push({kind:"rect",part:"brush",x:a.x,y:a.y,width:a.width,height:a.height,fill:"var(--skdx-color-surface-sunken)",stroke:V.grid}),k){let _=ie(k.data),[P,z]=ue(_),N=d>1?a.width/(d-1):0,D=k.data.flatMap((L,I)=>C(L)?[{x:p(a.x+I*N),y:p(a.y+a.height-(z===P?.5:(L-P)/(z-P))*(a.height-4)-2)}]:[]),F=we(D);D.length>1&&tt.push({kind:"path",part:"brush-series",d:`${F}L${D[D.length-1]?.x} ${a.y+a.height}L${D[0]?.x} ${a.y+a.height}Z`,fill:k.color,fillOpacity:.3})}tt.push({kind:"rect",part:"brush-window",...$,fill:"var(--skdx-color-primary-500)",opacity:.15,stroke:V.axis},{kind:"rect",part:"brush-handle",x:p($.x-3),y:a.y+8,width:6,height:a.height-16,fill:V.axis,rx:2},{kind:"rect",part:"brush-handle",x:p($.x+$.width-3),y:a.y+8,width:6,height:a.height-16,fill:V.axis,rx:2}),En.brush={box:a,window:$}}return{...Mt,shapes:[...Gn,...Ct,...Qe,...It,...Wn,...Tt,...At,...gr(e.annotations,_n),...tt,...Mt.shapes],hit:En,issues:o,defs:Je.length?Je:void 0}}function wr(e,n){if(!(!C(e)||n===null||n===void 0))return typeof n=="number"?C(n)?[e-Math.abs(n),e+Math.abs(n)]:void 0:C(n[0])&&C(n[1])?[Math.min(n[0],n[1]),Math.max(n[0],n[1])]:void 0}function ki(e,n){if(!e||n<2)return{start:0,end:n};let t=Math.max(0,Math.min(n-1,Math.floor(e.start))),r=Math.max(t+1,Math.min(n,Math.ceil(e.end)));return r-t<2&&n>=2?{start:Math.min(t,n-2),end:Math.min(t,n-2)+2}:{start:t,end:r}}function vi(e,n,t){let r=f=>f.type??n,i=[],o=yi(e),s=e.categories??[],l=(e.transforms??[]).filter(f=>f.type==="sort"||f.type==="bin"||f.type==="aggregate"),c=(e.transforms??[]).filter(f=>!l.includes(f)),d=e.stacked||e.stackOffset!==void 0&&e.stackOffset!=="zero",u=(f,M,T)=>{let S=T.filter(O=>O!==null&&!(typeof O=="number"&&Number.isFinite(O))).length;S&&i.push({code:"invalid-value",severity:"warning",message:`Series "${f}" has ${S} value${S===1?"":"s"} that ${S===1?"is":"are"} neither a number nor null; drawn as gaps.`,itemId:M??f}),s.length&&T.length!==s.length&&!e.transform&&i.push({code:"length-mismatch",severity:"warning",message:`Series "${f}" has ${T.length} values for ${s.length} categories.`,itemId:M??f})},h=e.series.map((f,M)=>{let T=r(f),S=d?!0:void 0,O=f.type==="range"?void 0:f.stack,G=O===!1?void 0:O===!0||O===void 0&&S?`${T}`:O;f.type==="range"?(u(f.name,f.id,f.low),u(f.name,f.id,f.high)):u(f.name,f.id,f.data);let j=Y=>e.nulls==="zero"?Y.map(Q=>C(Q)?Q:0):Y,B=Mr(o,f.axis);return B===void 0&&i.push({code:"unknown-axis",severity:"warning",message:`Series "${f.name}" names axis "${String(f.axis)}", which is not defined; drawn on the first axis.`,itemId:f.id??f.name}),{name:f.name,id:f.id,color:cr(e,M,f.color),axis:B??o[0]?.id,hidden:dr(e,f.name),index:M,kind:T,data:f.type==="range"?[]:j(Wt(Wt(f.data,c),f.transforms)),low:f.type==="range"?f.low:[],high:f.type==="range"?f.high:[],curve:f.curve??e.curve??"linear",dash:f.type==="range"?void 0:f.dash,markers:f.type==="range"?void 0:f.markers,symbol:f.type==="range"?"circle":f.symbol??"circle",markerSize:f.type==="range"?3:f.markerSize??3,errors:f.type==="range"?void 0:f.errors,stack:T==="range"||T==="line"?void 0:G,style:f.type==="range"?f.style??"area":"area",fillOpacity:(f.type==="range"?void 0:f.fillOpacity)??e.fillOpacity??.25,gradient:f.type!=="range"&&f.gradient===!0}}),b=()=>Math.max(s.length,...h.map(f=>Math.max(f.data.length,f.low.length))),v=f=>{let M=S=>S.length?f.map(O=>S[O]??null):S,T=Array.from({length:b()},(S,O)=>s[O]??String(O+1));s=f.map(S=>T[S]),h=h.map(S=>({...S,data:M(S.data),low:M(S.low),high:M(S.high)}))},x=(f,M)=>{let T=(M!==void 0?h.find(O=>O.name===M):void 0)??h.find(O=>!O.hidden&&O.kind!=="range")??h[0];M!==void 0&&!h.some(O=>O.name===M)&&i.push({code:"unknown-series",severity:"warning",message:`sort.by names "${M}", which is not a series; sorted by the first series.`});let S=Array.from({length:b()},(O,G)=>G).sort((O,G)=>{let j=T?.data[O]??T?.high[O],B=T?.data[G]??T?.high[G],Y=C(j)?j:-1/0,Q=C(B)?B:-1/0;return f==="asc"?Y-Q:Q-Y});v(S)},m=f=>{let M=h.flatMap(S=>ie(S.data)),T=Te(M,f);s=T.slice(1).map((S,O)=>`${t(T[O])}\u2013${t(S)}`),h=h.map(S=>{let O=ie(S.data),G=0,j=Ae(O,T).map(B=>e.binMode==="density"?O.length?B.count/(O.length*(B.x1-B.x0)):0:e.binMode==="cumulative"?G+=B.count:B.count);return{...S,data:j}})},w=(f,M)=>{let T=Math.max(1,Math.floor(f)),S=b(),O=j=>{if(!j.length)return j;let B=[];for(let Y=0;Y<S;Y+=T){let Q=ie(j.slice(Y,Y+T));B.push(Q.length===0?null:M==="sum"?Q.reduce((se,pe)=>se+pe,0):M==="mean"?Q.reduce((se,pe)=>se+pe,0)/Q.length:M==="min"?Math.min(...Q):Math.max(...Q))}return B};s=Array.from({length:S},(j,B)=>s[B]??String(B+1)).filter((j,B)=>B%T===0),h=h.map(j=>({...j,data:O(j.data),low:O(j.low),high:O(j.high)}))};e.transform==="histogram"?m({bins:e.bins,binWidth:e.binWidth,domain:e.binDomain}):e.transform==="cumulative"&&(h=h.map(f=>{let M=0;return{...f,data:f.data.map(T=>C(T)?M+=T:M)}}));for(let f of l)f.type==="sort"?x(f.order??"desc"):f.type==="bin"?m(f):f.type==="aggregate"&&w(f.every,f.method??"sum");typeof e.sort=="string"?x(e.sort):e.sort&&x(e.sort.order,e.sort.by);let y=e.xAxis?.domain;if(y){let f=b(),M=Array.from({length:f},(G,j)=>s[j]??String(j+1)),T=G=>{let j=typeof G=="string"?G:de(G);return M.findIndex(B=>typeof j=="string"?B===j||nt(B)===j:de(B)===j)},S=y.map(T),O=G=>G.length?S.map(j=>j<0?null:G[j]??null):G;s=[...y],h=h.map(G=>({...G,data:O(G.data),low:O(G.low),high:O(G.high)}))}return{series:h,categories:s,issues:i,axes:o}}function dt(e){return e==null?[]:(Array.isArray(e)?e:[e]).map(t=>typeof t=="object"?t:{id:t})}var Zt=e=>e.id??e.name??e.series,$r=e=>e.seriesId??e.series;function fe(e,n){let t=!1;return n.id!==void 0&&(t=!0,Zt(e)!==n.id&&e.id!==n.id&&e.name!==n.id)||n.series!==void 0&&(t=!0,$r(e)!==n.series&&e.series!==n.series)||n.index!==void 0&&(t=!0,e.index!==n.index)||n.category!==void 0&&(t=!0,e.category!==n.category)?!1:t}function ge(e){let n={},t=Zt(e);t!==void 0&&(n.id=t);let r=$r(e);return r!==void 0&&e.series!==void 0&&(n.series=r),e.index!==void 0&&(n.index=e.index),n}var Et=(e,n)=>e.id===n.id&&e.series===n.series&&e.index===n.index&&e.category===n.category;function Ht(e,n,t){let r=dt(e),i=ge(n),o=r.some(s=>fe(n,s));return t==="single"?o?[]:[i]:o?r.filter(s=>!fe(n,s)):[...r,i]}var wi=.2;function Mi(e){let n=V.focus;switch(e.kind){case"rect":return{kind:"rect",part:"selected",x:e.x-1.5,y:e.y-1.5,width:e.width+3,height:e.height+3,fill:"none",stroke:n,rx:e.rx};case"circle":return{kind:"circle",part:"selected",cx:e.cx,cy:e.cy,r:e.r+2.5,fill:"none",stroke:n};case"path":return{kind:"path",part:"selected",d:e.d,fill:"none",stroke:n,strokeWidth:2.5};case"line":return{...e,part:"selected",stroke:n,strokeWidth:(e.strokeWidth??1)+3,title:void 0,item:void 0};case"text":return}}var Si=(e,n)=>e.kind==="text"?{...e,fill:V.grid}:{...e,opacity:(e.opacity??1)*n};function Ut(e,n){let t=dt(n.selected),r=n.highlighted===void 0||n.highlighted===null?[]:dt(n.highlighted),i=r[0];if(t.length===0&&!i)return e;let o={highlighted:n.highlightScope?.highlighted??"item",faded:n.highlightScope?.faded??"global"},s=[],l=u=>!i||r.some(h=>fe(u,h))?!0:o.highlighted==="series"?r.some(h=>h.series!==void 0&&fe(u,{series:h.series})):!1,c=u=>{if(!i||o.faded==="none"||l(u))return!1;if(o.faded==="series"){let h=i.series;return h!==void 0&&fe(u,{series:h})}return!0},d=e.shapes.map(u=>{let h=u.item;if(!h||h.legend)return u;if(t.some(b=>fe(h,b))){let b=Mi(u);b&&s.push(b)}return c(h)?Si(u,wi):u});return s.length?{...e,shapes:[...d,...s]}:{...e,shapes:d}}function Kt(e){let n=ie(e.data),t=at(e,n.length===0);if(t)return t;let r=Te(n,{bins:e.bins,binWidth:e.binWidth,domain:e.domain,thresholds:e.thresholds}),i=Ae(n,r),o=i.reduce((m,w)=>m+w.count,0),s=e.mode??"count",l=ce(e.xAxis?.format??e.format),c=ce(s==="percent"?{style:"percent",digits:1}:s==="density"?{style:"decimal",digits:3}:e.format),d=e.name??(s==="density"?"Density":s==="percent"?"Share":"Count"),u=m=>s==="density"?o>0&&m.x1>m.x0?m.count/(o*(m.x1-m.x0)):0:s==="percent"?o>0?m.count/o:0:m.count,h=i.map(m=>`${l(m.x0)}\u2013${l(m.x1)}`),b=Sr({...e,format:c,series:[{name:d,data:i.map(u),color:e.color}],categories:h,xAxis:e.xAxis?.label?{label:e.xAxis.label}:void 0,barGap:e.barGap??.05,transform:void 0},"bar"),v=b.shapes.map((m,w)=>{if(m.part!=="bar"||!m.item||m.item.index===void 0)return m;let y=i[m.item.index];if(!y)return m;let f=o>0?` (${Math.round(y.count/o*1e3)/10}%)`:"",M=`${h[m.item.index]??String(w)}: ${y.count}${f}${s==="count"?"":` \xB7 ${d} ${c(u(y))}`}`;return{...m,title:m.title===void 0?void 0:M,item:{...m.item,label:M}}}),x=b.hit?.rows.map((m,w)=>{let y=i[w];return y?[m[0],`${d}: ${c(u(y))}`,`Observations: ${y.count}`]:m});return{...b,shapes:v,hit:b.hit&&x?{...b.hit,rows:x}:b.hit}}function Le(e,n,t,r,i){let o=e.getBoundingClientRect();return{x:o.width?(n-o.left)*r/o.width:n,y:o.height?(t-o.top)*i/o.height:t}}var qt=(e,n,t)=>n>=e.x&&n<=e.x+e.width&&t>=e.y&&t<=e.y+e.height;function Cr(e,n){let t=0,r=1/0;return e.xs.forEach((i,o)=>{let s=Math.abs(i-n);s<r&&(r=s,t=o)}),t}function Ee(e,n){let t=e.hit;if(!t||t.xs.length===0)return;let r=Cr(t,n),i=t.rows[r]??[];return{index:r,rows:e.axisTooltipFormatter?.(i,r)??i}}function Yt(e,n){let t=e.hit;if(!t||t.xs.length===0)return;let r=t.xs[Cr(t,n)];return{kind:"line",part:"crosshair",x1:r,x2:r,y1:t.plot.y,y2:t.plot.y+t.plot.height,stroke:V.axis,dash:"3 3"}}function Xt(e,n,t){let r=e.hit;if(!r||!r.crosshair||r.xs.length===0||!qt(r.plot,n,t))return[];let i=Yt(e,n),{rows:o}=Ee(e,n),s=e.tooltipAnchored?r.plot.y+8:t;return[i,...ot(i.x1,s,o,e.width,e.height,e.tooltipPlacement)]}function Qt(e,n){let t=e.hit;if(!t||t.xs.length===0)return[];let r=t.rows.findIndex(o=>o[0]===n);if(r<0)return[];let i=t.xs[r];return Xt(e,i,t.plot.y+8)}function Jt(e,n,t,r,i){if(!e.tooltip)return{lines:[],shapes:[]};if(e.hit?.crosshair){let{x:c,y:d}=Le(t,r,i,e.width,e.height);if(qt(e.hit.plot,c,d)){let u=Ee(e,c),h=Yt(e,c);if(u&&h)return{lines:u.rows,shapes:[h]}}}let o=n?.closest?.("[data-skdx-part]"),s=e.tooltipFormatter?xe(e,n)?.item:void 0,l=s&&e.tooltipFormatter?.(s)||o&&Array.from(o.children).find(c=>c.tagName.toLowerCase()==="title")?.textContent;return l?{lines:Array.isArray(l)?l:[l],shapes:[]}:{lines:[],shapes:[]}}function Ir(e,n,t,r,i,o,s){let l=e?.closest?.("[data-skdx-part]"),c=s&&s.tooltipFormatter?xe(s,e)?.item:void 0,d=c&&s?.tooltipFormatter?.(c)||l&&Array.from(l.children).find(x=>x.tagName.toLowerCase()==="title")?.textContent;if(!d)return[];let u=s?.tooltipAnchored?xe(s,e):void 0,h=u?s?.shapes[u.index]:void 0,{x:b,y:v}=h?He(h):Le(n,t,r,i,o);return ot(b,v,d,i,o,s?.tooltipPlacement)}function en(e,n,t,r,i){if(!e.tooltip)return[];if(e.hit?.crosshair){let{x:o,y:s}=Le(t,r,i,e.width,e.height),l=Xt(e,o,s);if(l.length>0)return l}return Ir(n,t,r,i,e.width,e.height,e)}function tn(e,n){let t=xe(e,n);return t&&!t.item.legend?ge(t.item):null}var $i=(e,n)=>{let{x:t,y:r}=He(e),i=e.kind==="circle"?e.cy:e.kind==="rect"?e.y+e.height/2:r;return t>=n.x&&t<=n.x+n.width&&i>=n.y&&i<=n.y+n.height};function nn(e,n){let t=new Set,r=[];for(let i of e.shapes){if(!i.item||i.item.legend||i.part==="anchor"||!$i(i,n))continue;let o=ge(i.item),s=JSON.stringify(o);t.has(s)||(t.add(s),r.push(o))}return r}var rn=e=>({kind:"rect",part:"selection-box",x:p(e.x),y:p(e.y),width:p(e.width),height:p(e.height),fill:V.focus,opacity:.12,stroke:V.focus}),ht=(e,n,t,r)=>({x:Math.min(e,t),y:Math.min(n,r),width:Math.abs(t-e),height:Math.abs(r-n)});function Tr(e,n,t){let r=!1;for(let i=0,o=e.length-1;i<e.length;o=i++){let s=e[i],l=e[o];s.y>t!=l.y>t&&n<(l.x-s.x)*(t-s.y)/(l.y-s.y)+s.x&&(r=!r)}return r}function on(e,n){if(n.length<3)return[];let t=new Set,r=[];for(let i of e.shapes){if(!i.item||i.item.legend||i.part==="anchor")continue;let{x:o,y:s}=He(i),l=i.kind==="circle"?i.cy:i.kind==="rect"?i.y+i.height/2:s;if(!Tr(n,o,l))continue;let c=ge(i.item),d=JSON.stringify(c);t.has(d)||(t.add(d),r.push(c))}return r}var sn=e=>({kind:"path",part:"selection-lasso",d:e.length?`M${e.map(n=>`${p(n.x)} ${p(n.y)}`).join("L")}`:"",fill:V.focus,fillOpacity:.12,stroke:V.focus,dash:"4 3"}),ut=6;function an(e,n,t){let r=e.edit;if(r){for(let i of r.bars)if(!(t<i.y||t>i.y+i.height||n<i.x0-ut||n>i.x1+ut))return Math.abs(n-i.x0)<=ut?{bar:i,mode:"start"}:Math.abs(n-i.x1)<=ut?{bar:i,mode:"end"}:{bar:i,mode:"move"}}}function ln(e,n,t){let r=e.edit;return Ar(r,n,r.invert(n.bar.x0+t)-r.invert(n.bar.x0))}function cn(e,n,t){let r=e.edit,i=t.key==="ArrowRight"?1:t.key==="ArrowLeft"?-1:0;if(!r||n===null||!i||!(t.shiftKey||t.altKey))return;let o=r.bars.find(c=>c.index===n);if(!o)return;let s=t.altKey?t.shiftKey?"start":"end":"move",l=r.snap??r.invert(o.x0+10)-r.invert(o.x0);return Ar(r,{bar:o,mode:s},i*l)}function Ar(e,{bar:n,mode:t},r){let i=l=>e.snap?Math.round(l/e.snap)*e.snap:l,o=n.start,s=n.end;return t==="move"?(o=i(n.start+r),s=o+(n.end-n.start)):t==="start"?o=Math.min(i(n.start+r),n.end):s=Math.max(i(n.end+r),n.start),{id:n.id,name:n.name,start:o,end:s}}function dn(e,n,t){let r=e.edit,i=r.scale(t.start),o=r.scale(t.end);return{kind:"rect",part:"edit-ghost",x:p(Math.min(i,o)),y:p(n.bar.y),width:p(Math.max(1,Math.abs(o-i))),height:p(n.bar.height),fill:V.focus,opacity:.25,stroke:V.focus,rx:2}}var Ci=64,Ii=e=>Math.max(1,Math.min(Ci,e));function un(e,n,t,r){let i=n>0?.8:1.25,o=Ii(e.view.zoom*i);if(o===e.view.zoom)return e.view;let{plot:s,scale:l}=e,[c,d]=e.view.center,u=(t-(s.x+s.width/2))/l,h=(r-(s.y+s.height/2))/l,b=e.view.zoom/o;return{center:[c+u*(1-b),e.fromY(e.toY(d)-h*(1-b))],zoom:o}}function hn(e,n,t,r){let{scale:i}=e;return{center:[n.center[0]-t/i,e.fromY(e.toY(n.center[1])+r/i)],zoom:n.zoom}}function xe(e,n){let t=n?.closest?.("[data-skdx-i]"),r=Number(t?.getAttribute("data-skdx-i")),i=Number.isInteger(r)?e.shapes[r]?.item:void 0;return i?{index:r,item:i}:void 0}var ft=e=>e.shapes.flatMap((n,t)=>n.item&&!n.item.legend?[t]:[]);function He(e){switch(e.kind){case"rect":return{x:e.x+e.width/2,y:e.y};case"circle":return{x:e.cx,y:e.cy-e.r};case"line":return{x:(e.x1+e.x2)/2,y:Math.min(e.y1,e.y2)};case"text":return{x:e.x,y:e.y};case"path":{let n=/M\s*(-?[\d.]+)[ ,](-?[\d.]+)/.exec(e.d);return n?{x:Number(n[1]),y:Number(n[2])}:{x:0,y:0}}}}function fn(e,n){let t=n===null?void 0:e.shapes[n];if(!t)return[];let r=V.focus,i;switch(t.kind){case"rect":i={kind:"rect",part:"focus",x:t.x-2,y:t.y-2,width:t.width+4,height:t.height+4,fill:"none",stroke:r,rx:2};break;case"circle":i={kind:"circle",part:"focus",cx:t.cx,cy:t.cy,r:t.r+3,fill:"none",stroke:r};break;case"line":i={kind:"line",part:"focus",x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:r,strokeWidth:4};break;case"text":i={kind:"rect",part:"focus",x:t.x-2,y:t.y-8,width:t.text.length*he+4,height:16,fill:"none",stroke:r,rx:2};break;case"path":i={kind:"path",part:"focus",d:t.d,stroke:r,strokeWidth:2,fill:"none"};break}let{x:o,y:s}=He(t),l=t.item&&e.tooltipFormatter?.(t.item)||(t.item?.label??t.title??"");return[i,...l?ot(p(o),p(s),l,e.width,e.height):[]]}function mn(e,n,t){let r=ft(e);if(r.length===0)return;let i=n===null?-1:r.indexOf(n);switch(t){case"ArrowRight":case"ArrowDown":return r[Math.min(r.length-1,i+1)];case"ArrowLeft":case"ArrowUp":return r[Math.max(0,i<=0?0:i-1)];case"Home":return r[0];case"End":return r[r.length-1];case"Escape":return null;default:return}}var Oe=2,ze=(e,n,t)=>{let r=Math.max(Oe,Math.min(t,Math.round(n))),i=Math.max(0,Math.min(t-r,Math.round(e)));return{start:i,end:i+r}},Or=(e,n)=>!e||e.start<=0&&e.end>=n;function pn(e,n,t){if(e.count<=Oe||!e.plot.width)return;let{start:r,end:i}=e.zoom,o=i-r,s=n>0?1.25:.8,l=Math.max(Oe,Math.min(e.count,Math.round(o*s)));if(l===o)return n>0&&!Or(e.zoom,e.count)?ze(r,l,e.count):void 0;let c=Math.max(0,Math.min(1,(t-e.plot.x)/e.plot.width)),d=r+c*o;return ze(d-c*l,l,e.count)}function bn(e,n,t,r){let i=n.end-n.start,o=Math.max(Oe,Math.min(e.count,Math.round(i/Math.max(.05,t)))),s=Math.max(0,Math.min(1,(r-e.plot.x)/Math.max(1,e.plot.width)));return ze(n.start+s*i-s*o,o,e.count)}function gn(e,n,t){let r=n.end-n.start,i=e.plot.width/Math.max(1,r);return ze(n.start-t/i,r,e.count)}function xn(e,n,t){let r=e.brush;if(!r||!qt(r.box,n,t))return;let i=r.window;if(Math.abs(n-i.x)<=6)return{grab:"left",zoom:e.zoom};if(Math.abs(n-(i.x+i.width))<=6)return{grab:"right",zoom:e.zoom};if(n>i.x&&n<i.x+i.width)return{grab:"move",zoom:e.zoom};let o=e.zoom.end-e.zoom.start,s=(n-r.box.x)/Math.max(1,r.box.width)*e.count;return{grab:"move",zoom:ze(s-o/2,o,e.count)}}function yn(e,n,t,r){let i=e.brush;if(!i)return t;let o=r/Math.max(1,i.box.width)*e.count;if(n==="move")return ze(t.start+o,t.end-t.start,e.count);if(n==="left")return{start:Math.max(0,Math.min(t.end-Oe,Math.round(t.start+o))),end:t.end};let s=Math.min(e.count,Math.max(t.start+Oe,Math.round(t.end+o)));return{start:t.start,end:s}}function vn(e,n){switch(n.type){case"svg":return Promise.resolve(kn(e,n.label,n.resolve));case"csv":return Promise.resolve(Vr(n.rows));case"png":{if(typeof document>"u"||typeof Image>"u")return Promise.reject(new Error("PNG export needs a browser"));let t=kn(e,n.label,n.resolve);return Rr(t,e.width,e.height,n.scale,n.background)}}}var me=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/"/g,"&quot;"),Ue=e=>e.filter(([,n])=>n!==void 0&&n!=="").map(([n,t])=>` ${n}="${me(String(t))}"`).join("");function zr(e){let n=e.title?`<title>${me(e.title)}</title>`:"",t=["data-skdx-part",e.part];switch(e.kind){case"path":return`<path${Ue([t,["d",e.d],["fill",e.fill??"none"],["stroke",e.stroke],["stroke-width",e.strokeWidth],["stroke-linecap",e.strokeLinecap],["stroke-linejoin",e.strokeLinejoin],["stroke-dasharray",e.dash],["opacity",e.opacity],["fill-opacity",e.fillOpacity]])}>${n}</path>`;case"rect":return`<rect${Ue([t,["x",e.x],["y",e.y],["width",e.width],["height",e.height],["rx",e.rx],["fill",e.fill],["stroke",e.stroke],["fill-opacity",e.opacity]])}>${n}</rect>`;case"line":return`<line${Ue([t,["x1",e.x1],["y1",e.y1],["x2",e.x2],["y2",e.y2],["stroke",e.stroke],["stroke-width",e.strokeWidth],["stroke-dasharray",e.dash],["opacity",e.opacity]])}>${n}</line>`;case"circle":return`<circle${Ue([t,["cx",e.cx],["cy",e.cy],["r",e.r],["fill",e.fill],["stroke",e.stroke]])}>${n}</circle>`;case"text":return`<text${Ue([t,["x",e.x],["y",e.y],["text-anchor",e.anchor],["dominant-baseline",e.baseline],["fill",e.fill],["font-weight",e.weight],["transform",e.rotate?`rotate(${e.rotate} ${e.x} ${e.y})`:void 0]])}>${me(e.text)}</text>`}}function Lr(e){let n=e.defs??[];return n.length===0?"":`<defs>${n.map(t=>`<linearGradient id="${me(t.id)}" x1="0" y1="0" x2="${t.vertical===!1?1:0}" y2="${t.vertical===!1?0:1}">${t.stops.map(r=>`<stop offset="${r.offset}" stop-color="${me(r.color)}"${r.opacity===void 0?"":` stop-opacity="${r.opacity}"`}/>`).join("")}</linearGradient>`).join("")}</defs>`}function kn(e,n,t){let r=Lr(e)+e.shapes.map(zr).join("");return t&&(r=r.replace(/var\((--[\w-]+)\)/g,(i,o)=>t(o).trim()||i)),`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${e.width} ${e.height}" width="${e.width}" height="${e.height}" role="img" aria-label="${me(n)}" font-family="${me(V.fontFamily)}" font-size="${me(V.fontSize)}"><title>${me(n)}</title>${r}</svg>`}function Rr(e,n,t,r=2,i){return new Promise((o,s)=>{let l=URL.createObjectURL(new Blob([e],{type:"image/svg+xml;charset=utf-8"})),c=new Image;c.onload=()=>{URL.revokeObjectURL(l);let d=document.createElement("canvas");d.width=Math.round(n*r),d.height=Math.round(t*r);let u=d.getContext("2d");if(!u)return s(new Error("canvas 2d context unavailable"));i&&(u.fillStyle=i,u.fillRect(0,0,d.width,d.height)),u.drawImage(c,0,0,d.width,d.height),d.toBlob(h=>h?o(h):s(new Error("toBlob failed")),"image/png")},c.onerror=()=>{URL.revokeObjectURL(l),s(new Error("svg could not be decoded"))},c.src=l})}function Vr(e){let n=t=>{let r=t==null?"":String(t);return/[",\n\r]/.test(r)?`"${r.replace(/"/g,'""')}"`:r};return e.map(t=>t.map(n).join(",")).join(`\r
2
+ `)}function wn(e,n){if(!n)return;let t=typeof n=="object"?n.maxRows??500:500,r=e.hit;if(r&&r.rows.length>0){let l=r.rows[0];if(r.rows.length>t)return;let c=["",...l.slice(1).map(u=>u.replace(/:\s[^:]*$/,""))],d=r.rows.map(u=>[u[0],...u.slice(1).map(h=>h.slice(h.lastIndexOf(": ")+2))]);return[c,...d]}let i=e.shapes.flatMap(l=>l.item&&!l.item.legend&&!(l.part==="anchor"&&!l.title)?[l.item]:[]);if(i.length===0||i.length>t)return;let o=["series","name","category","value"].filter(l=>i.some(c=>c[l]!==void 0)),s=(l,c)=>l[c]===void 0?"":String(l[c]);return[o.map(l=>l[0]?.toUpperCase()+l.slice(1)),...i.map(l=>o.map(c=>s(l,c)))]}var Mn=new Map;function mt(e){let n=Mn.get(e);if(n)return n.group;let t=new Set,r={},i={current:r,subscribe(o){return t.add(o),()=>{t.delete(o),t.size===0&&Mn.delete(e)}},publish(o,s){Object.assign(r,o);for(let l of t)l(o,s)}};return Mn.set(e,{group:i,listeners:t}),i}var Br='[data-skdx-part]:not([data-skdx-part^="tooltip"]):not([data-skdx-part="focus"]):not([data-skdx-part="crosshair"])',Sn=`@keyframes skdx-in{from{opacity:0}to{opacity:1}}${Br}{animation:skdx-in var(--skdx-chart-duration,0ms) ease-out;transition:${["x","y","width","height","cx","cy","r","opacity","fill-opacity","d"].map(e=>`${e} var(--skdx-chart-duration,0ms) ease-out`).join(",")}}@media (prefers-reduced-motion:reduce){${Br}{animation:none;transition:none}}`;function $n(e){let n=e.animate;return n&&e.shapes.length<=1500?`${n}ms`:void 0}import{css as Ti,html as ye,LitElement as Ai,nothing as X,svg as re}from"lit";import{property as A,state as oe}from"lit/decorators.js";import{ifDefined as H}from"lit/directives/if-defined.js";var Oi={fromAttribute:()=>!1},R=class extends Ai{constructor(){super(...arguments);this.legend=!1;this.tooltip=!0;this.selectionMode="none";this.loading=!1;this.decorative=!1;this.accessibleTable=!1;this.zoomable=!1;this.editable=!1;this.crossFilter=!1;this.animated=!1;this.responsive=!1;this.tip=[];this.overlay=[];this.portal=null;this.highlightState=null;this.crossState=null;this.lastCross=null;this.pointers=new Map;this.hover=null;this.token={};this.focused=null;this.hiddenState=[];this.drag=null;this.onPointerMove=t=>{let r=this.layout;if(!r)return;this.pointers.has(t.pointerId)&&this.pointers.set(t.pointerId,this.viewBox(t,r).x);let i=this.drag;if(i?.grab==="select"){let{x:o,y:s}=this.viewBox(t,r);this.overlay=[rn(ht(i.x,i.y,o,s))];return}if(i?.grab==="lasso"){let{x:o,y:s}=this.viewBox(t,r);i.points=[...i.points??[],{x:o,y:s}],this.overlay=[sn(i.points)];return}if(i?.grab==="edit"){if(!i.gantt)return;let{x:o}=this.viewBox(t,r);i.change=ln(r,i.gantt,o-i.x),this.overlay=[dn(r,i.gantt,i.change)];return}if(i?.grab==="map"){if(!r.map||!i.view)return;let{x:o,y:s}=this.viewBox(t,r);this.setView(hn(r.map,i.view,o-i.x,s-i.y));return}if(i&&r.hit){if(i.grab==="pinch"){let[s,l]=[...this.pointers.values()];if(s===void 0||l===void 0||!i.distance)return;this.setZoom(bn(r.hit,i.zoom,Math.abs(s-l)/i.distance,(s+l)/2));return}let{x:o}=this.viewBox(t,r);this.setZoom(i.grab==="pan"?gn(r.hit,i.zoom,o-i.x):yn(r.hit,i.grab,i.zoom,o-i.x));return}if(r.tooltipPortal){let{lines:o,shapes:s}=Jt(r,t.target,t.currentTarget,t.clientX,t.clientY);this.tip=s,this.portal=o.length?{x:t.clientX,y:t.clientY,lines:o}:null}else{let o=en(r,t.target,t.currentTarget,t.clientX,t.clientY);(o.length>0||this.tip.length>0)&&(this.tip=o)}if(this.highlight(tn(r,t.target)),this.syncId&&r.hit?.crosshair){let o=Ee(r,this.viewBox(t,r).x);this.shareCrosshair(o?r.hit.rows[o.index]?.[0]??null:null)}};this.onPointerDown=t=>{let r=this.layout;if(!r||t.button!==0)return;let{x:i,y:o}=this.viewBox(t,r),s=xe(r,t.target)?.item.legend,l=this.canEdit(r)?an(r,i,o):void 0;if(l){this.drag={x:i,y:o,zoom:{start:0,end:0},grab:"edit",gantt:l},t.currentTarget.setPointerCapture(t.pointerId),this.clearTip();return}if(this.brushing()&&!s){this.drag={x:i,y:o,zoom:{start:0,end:0},grab:this.selectionMode==="lasso"?"lasso":"select",points:[{x:i,y:o}]},t.currentTarget.setPointerCapture(t.pointerId),this.clearTip();return}if(this.canPan(r)&&r.map){let d=r.map.plot;if(i<d.x||i>d.x+d.width||o<d.y||o>d.y+d.height)return;this.drag={x:i,y:o,zoom:{start:0,end:0},grab:"map",view:r.map.view},t.currentTarget.setPointerCapture(t.pointerId),this.clearTip();return}let c=r.hit;if(!(!c||!this.canZoom(r))){if(this.pointers.set(t.pointerId,i),this.pointers.size===2){let[d,u]=[...this.pointers.values()];this.drag={x:(d+u)/2,y:o,zoom:c.zoom,grab:"pinch",distance:Math.abs(d-u)||1}}else{let d=xn(c,i,o);if(d)this.drag={x:i,y:o,zoom:d.zoom,grab:d.grab},d.zoom!==c.zoom&&this.setZoom(d.zoom);else if(this.zoomable&&i>=c.plot.x&&i<=c.plot.x+c.plot.width&&o>=c.plot.y&&o<=c.plot.y+c.plot.height)this.drag={x:i,y:o,zoom:c.zoom,grab:"pan"};else{this.pointers.delete(t.pointerId);return}}t.currentTarget.setPointerCapture(t.pointerId),this.clearTip()}};this.onPointerUp=t=>{this.pointers.delete(t.pointerId);let r=t.currentTarget;r.hasPointerCapture(t.pointerId)&&r.releasePointerCapture(t.pointerId);let i=this.drag,o=this.layout;if(o&&(i?.grab==="select"||i?.grab==="lasso"||i?.grab==="edit"||i?.grab==="map")){this.overlay=[];let{x:s,y:l}=this.viewBox(t,o);if(Math.abs(s-i.x)>2||Math.abs(l-i.y)>2){i.grab==="select"?this.setSelected(nn(o,ht(i.x,i.y,s,l))):i.grab==="lasso"?this.setSelected(on(o,i.points??[])):i.grab==="edit"&&i.change&&this.emit("skdx-task-change",i.change),this.drag={...i,distance:-1};return}this.drag=null;return}(this.pointers.size===0||this.drag?.grab==="pinch")&&(this.drag=null)};this.onWheel=t=>{let r=this.layout;if(!r)return;let{x:i,y:o}=this.viewBox(t,r);if(r.map&&this.canPan(r)){let c=r.map.plot;if(i<c.x||i>c.x+c.width||o<c.y||o>c.y+c.height)return;t.preventDefault(),this.setView(un(r.map,t.deltaY,i,o));return}let s=r.hit;if(!s||!this.canZoom(r)||o<s.plot.y||o>s.plot.y+s.plot.height)return;let l=pn(s,t.deltaY,i);l&&(t.preventDefault(),this.setZoom(l))};this.onClick=t=>{if(!this.layout)return;if(this.drag?.distance===-1){this.drag=null;return}let r=xe(this.layout,t.target);r&&(r.item.range?this.setZoom(r.item.range):r.item.legend&&r.item.series!==void 0?this.toggle(r.item.series):(this.select(r.item),this.emit("skdx-item-click",r.item)))};this.onKeyDown=t=>{let r=this.layout;if(!r)return;if((t.key==="Enter"||t.key===" ")&&this.focused!==null){let l=r.shapes[this.focused]?.item;l&&(t.preventDefault(),this.select(l),this.emit("skdx-item-click",l));return}let i=this.canEdit(r)?cn(r,this.focused,t):void 0;if(i){t.preventDefault(),this.emit("skdx-task-change",i);return}let o=mn(r,this.focused,t.key);if(o===void 0)return;t.preventDefault(),this.focused=o;let s=o===null?void 0:r.shapes[o]?.item;this.highlight(s?ge(s):null)}}connectedCallback(){super.connectedCallback(),!(typeof ResizeObserver>"u")&&(this.observer=new ResizeObserver(([t])=>{let r=Math.floor(t?.contentRect.width??0);r>0&&(this.measured=r)}),this.observer.observe(this))}disconnectedCallback(){this.observer?.disconnect(),this.leave?.(),this.leave=void 0,this.joined=void 0,super.disconnectedCallback()}sized(){let{width:t,height:r,legend:i,tooltip:o,format:s,palette:l,loading:c,error:d,emptyMessage:u,description:h,decorative:b,animated:v,responsive:x,highlighted:m,highlightScope:w,accessibleTable:y}=this;return{...typeof x=="object"&&this.measured!==void 0&&this.measured<(x.breakpoint??480)?x.compact:void 0,width:x&&this.measured?this.measured:t,height:r,animate:v,responsive:x,legend:i,tooltip:o,format:s,palette:l,loading:c,error:d,emptyMessage:u,description:h,decorative:b,highlighted:m===void 0?this.highlightState:m,highlightScope:w,accessibleTable:y,hiddenSeries:this.hiddenSeries??this.hiddenState,zoom:this.zoom??this.zoomState,selected:this.selected??this.selectedState,view:this.view??this.viewState}}emit(t,r){this.dispatchEvent(new CustomEvent(t,{detail:r,bubbles:!0,composed:!0}))}publish(t){this.syncId&&mt(this.syncId).publish(t,this.token)}join(){if(this.joined===this.syncId||(this.leave?.(),this.leave=void 0,this.joined=this.syncId,!this.syncId))return;let t=mt(this.syncId),r=i=>{"highlighted"in i&&(this.highlightState=i.highlighted??null),i.selected&&(this.selectedState=i.selected,this.crossFilter&&(this.highlightState=i.selected.length?i.selected:null)),"zoom"in i&&(this.zoomState=i.zoom),i.hiddenSeries&&(this.hiddenState=i.hiddenSeries),"crosshair"in i&&(this.crossState=i.crosshair??null)};r(t.current),this.leave=t.subscribe((i,o)=>{o!==this.token&&r(i)})}setZoom(t){this.zoomState=t,this.emit("skdx-zoom-change",t),this.publish({zoom:t})}setView(t){this.viewState=t,this.emit("skdx-view-change",t)}setSelected(t){this.selectedState=t,this.emit("skdx-selected-change",t),this.publish({selected:t})}toggle(t){let r=this.hiddenSeries??this.hiddenState,i=r.includes(t)?r.filter(o=>o!==t):[...r,t];this.hiddenState=i,this.emit("skdx-hidden-series-change",i),this.publish({hiddenSeries:i})}highlight(t){let r=this.hover;r===t||r&&t&&Et(r,t)||(this.hover=t,this.emit("skdx-highlighted-change",t),this.syncId&&(this.highlightState=t,this.publish({highlighted:t})))}select(t){let r=this.selectionMode;r!=="none"&&this.setSelected(Ht(this.selected??this.selectedState,t,r==="single"?"single":"multiple"))}shareCrosshair(t){!this.syncId||this.lastCross===t||(this.lastCross=t,this.publish({crosshair:t}))}clearTip(){this.tip=[],this.portal=null,this.shareCrosshair(null)}canZoom(t){return!!(t.hit&&(this.zoomable||t.hit.brush))}canPan(t){return!!(t.map&&this.zoomable)}canEdit(t){return!!(this.editable&&t.edit)}brushing(){return this.selectionMode==="brush"||this.selectionMode==="lasso"}viewBox(t,r){return Le(t.currentTarget,t.clientX,t.clientY,r.width,r.height)}getSvgElement(){return this.renderRoot.querySelector("svg")}getLayout(){return this.layout}resetZoom(){this.setZoom(void 0)}zoomTo(t){this.setZoom(t)}focusItem(t){let r=this.layout;if(!r)return!1;let i=r.shapes.findIndex(o=>o.item&&!o.item.legend&&fe(o.item,t));return i<0?!1:(this.getSvgElement()?.focus(),this.focused=i,!0)}export(t){let r=this.layout;return r?vn(r,{...t,label:t.label??this.label??this.localName}):Promise.reject(new Error("not rendered yet"))}root(t,r,i){this.join();let o=Ut(Nt(t),this.sized());if(this.layout=o,o.issues!==this.reported){this.reported=o.issues;for(let y of o.issues??[])this.emit("skdx-data-issue",y)}let s=this.canZoom(o),l=this.canPan(o),c=this.canEdit(o),d=this.brushing(),u=s||l||c||d,h=!o.decorative&&ft(o).length>0,b=o.description?`${r}-desc`:void 0,v=$n(o),x=wn(o,this.accessibleTable),m=typeof this.accessibleTable=="object"&&this.accessibleTable.caption||i,w=this.portal;return ye`<svg
3
+ xmlns="http://www.w3.org/2000/svg"
4
+ viewBox="0 0 ${o.width} ${o.height}"
5
+ width=${o.width}
6
+ height=${o.height}
7
+ role=${o.decorative?"presentation":"img"}
8
+ aria-hidden=${o.decorative?"true":X}
9
+ aria-label=${o.decorative?X:i}
10
+ aria-describedby=${H(b)}
11
+ tabindex=${h?0:X}
12
+ data-skdx-chart=${r}
13
+ data-zoomable=${s||l?"":X}
14
+ data-brushing=${d&&!(s||l)?"":X}
15
+ data-editable=${c?"":X}
16
+ style=${v?`--skdx-chart-duration:${v}`:X}
17
+ font-family=${V.fontFamily}
18
+ font-size=${V.fontSize}
19
+ @pointermove=${o.tooltip||u?this.onPointerMove:X}
20
+ @pointerleave=${()=>{this.clearTip(),this.highlight(null)}}
21
+ @pointerdown=${u?this.onPointerDown:X}
22
+ @pointerup=${u?this.onPointerUp:X}
23
+ @pointercancel=${u?this.onPointerUp:X}
24
+ @wheel=${s||l?this.onWheel:X}
25
+ @dblclick=${s||l?()=>l?this.setView(void 0):this.setZoom(void 0):X}
26
+ @click=${this.onClick}
27
+ @keydown=${h?this.onKeyDown:X}
28
+ @blur=${()=>{this.focused=null,this.highlight(null)}}
29
+ >
30
+ <title>${i}</title>
31
+ ${o.description?re`<desc id=${H(b)}>${o.description}</desc>`:X}
32
+ ${v?re`<style>${Sn}</style>`:X} ${zi(o)}
33
+ ${pt(o.shapes)}
34
+ ${pt(this.tip.length||!this.crossState?this.tip:Qt(o,this.crossState))}
35
+ ${pt(fn(o,this.focused))} ${pt(this.overlay)}
36
+ </svg>
37
+ ${w?ye`<div
38
+ role="tooltip"
39
+ data-skdx-tooltip=${r}
40
+ style="left:${w.x+12}px;top:${w.y+12}px"
41
+ >
42
+ ${w.lines.map(y=>ye`<div>${y}</div>`)}
43
+ </div>`:X}
44
+ ${x?ye`<table data-skdx-table=${r}>
45
+ <caption>
46
+ ${m}
47
+ </caption>
48
+ <thead>
49
+ <tr>
50
+ ${(x[0]??[]).map(y=>ye`<th scope="col">${y}</th>`)}
51
+ </tr>
52
+ </thead>
53
+ <tbody>
54
+ ${x.slice(1).map(y=>ye`<tr>
55
+ ${y.map((f,M)=>M===0?ye`<th scope="row">${f}</th>`:ye`<td>${f}</td>`)}
56
+ </tr>`)}
57
+ </tbody>
58
+ </table>`:X}`}};R.styles=Ti`
59
+ :host {
60
+ display: inline-block;
61
+ }
62
+ svg {
63
+ display: block;
64
+ max-width: 100%;
65
+ height: auto;
66
+ outline: none;
67
+ }
68
+ svg[data-zoomable] {
69
+ cursor: grab;
70
+ touch-action: none;
71
+ }
72
+ svg[data-brushing] {
73
+ cursor: crosshair;
74
+ touch-action: none;
75
+ }
76
+ svg[data-editable] {
77
+ touch-action: none;
78
+ }
79
+ :host([responsive]) {
80
+ display: block;
81
+ }
82
+ table {
83
+ position: absolute;
84
+ width: 1px;
85
+ height: 1px;
86
+ margin: -1px;
87
+ padding: 0;
88
+ overflow: hidden;
89
+ clip: rect(0 0 0 0);
90
+ white-space: nowrap;
91
+ border: 0;
92
+ }
93
+ [role='tooltip'] {
94
+ position: fixed;
95
+ pointer-events: none;
96
+ z-index: 1000;
97
+ background: var(--skdx-color-surface-raised);
98
+ color: var(--skdx-color-text-default);
99
+ border: 1px solid var(--skdx-color-border-strong);
100
+ border-radius: 3px;
101
+ padding: 4px 8px;
102
+ font-family: var(--skdx-font-family);
103
+ font-size: var(--skdx-font-size-xs);
104
+ white-space: nowrap;
105
+ }
106
+ [role='tooltip'] > :first-child:not(:only-child) {
107
+ font-weight: bold;
108
+ }
109
+ `,g([A({type:Number})],R.prototype,"width",2),g([A({type:Number})],R.prototype,"height",2),g([A()],R.prototype,"label",2),g([A({type:Boolean,reflect:!0})],R.prototype,"legend",2),g([A({type:Boolean,attribute:"no-tooltip",converter:Oi})],R.prototype,"tooltip",2),g([A({attribute:!1})],R.prototype,"format",2),g([A({attribute:!1})],R.prototype,"palette",2),g([A({attribute:!1})],R.prototype,"hiddenSeries",2),g([A({attribute:!1})],R.prototype,"selected",2),g([A({attribute:"selection-mode"})],R.prototype,"selectionMode",2),g([A({attribute:!1})],R.prototype,"highlighted",2),g([A({attribute:!1})],R.prototype,"highlightScope",2),g([A({type:Boolean,reflect:!0})],R.prototype,"loading",2),g([A()],R.prototype,"error",2),g([A({attribute:"empty-message"})],R.prototype,"emptyMessage",2),g([A()],R.prototype,"description",2),g([A({type:Boolean,reflect:!0})],R.prototype,"decorative",2),g([A({type:Boolean,attribute:"accessible-table"})],R.prototype,"accessibleTable",2),g([A({attribute:!1})],R.prototype,"zoom",2),g([A({attribute:!1})],R.prototype,"view",2),g([A({type:Boolean,reflect:!0})],R.prototype,"zoomable",2),g([A({type:Boolean,reflect:!0})],R.prototype,"editable",2),g([A({attribute:"sync-id"})],R.prototype,"syncId",2),g([A({type:Boolean,attribute:"cross-filter"})],R.prototype,"crossFilter",2),g([A({converter:{fromAttribute:t=>t===null?!1:t===""?!0:Number(t)}})],R.prototype,"animated",2),g([A({type:Boolean,reflect:!0})],R.prototype,"responsive",2),g([oe()],R.prototype,"tip",2),g([oe()],R.prototype,"overlay",2),g([oe()],R.prototype,"portal",2),g([oe()],R.prototype,"measured",2),g([oe()],R.prototype,"viewState",2),g([oe()],R.prototype,"highlightState",2),g([oe()],R.prototype,"crossState",2),g([oe()],R.prototype,"focused",2),g([oe()],R.prototype,"hiddenState",2),g([oe()],R.prototype,"zoomState",2),g([oe()],R.prototype,"selectedState",2);var E=class extends R{constructor(){super(...arguments);this.series=[];this.labels=!1;this.connectNulls=!1;this.stacked=!1;this.brush=!1;this.crosshair=!1}input(){let{series:t,categories:r,xAxis:i,yAxis:o,rightAxis:s,references:l,annotations:c,labels:d,curve:u,connectNulls:h,nulls:b,stacked:v,stackOffset:x,orientation:m,radius:w,barGap:y,barWidth:f,sort:M,transform:T,transforms:S,bins:O,binWidth:G,binDomain:j,binMode:B,sampling:Y,brush:Q,crosshair:se}=this;return{...this.sized(),series:t,categories:r,xAxis:i,yAxis:o,rightAxis:s,references:l,annotations:c,labels:d,curve:u,connectNulls:h,nulls:b,stacked:v,stackOffset:x,orientation:m,radius:w,barGap:y,barWidth:f,sort:M,transform:T,transforms:S,bins:O,binWidth:G,binDomain:j,binMode:B,sampling:Y,brush:Q,crosshair:se}}};g([A({attribute:!1})],E.prototype,"series",2),g([A({attribute:!1})],E.prototype,"categories",2),g([A({attribute:!1})],E.prototype,"xAxis",2),g([A({attribute:!1})],E.prototype,"yAxis",2),g([A({attribute:!1})],E.prototype,"rightAxis",2),g([A({attribute:!1})],E.prototype,"references",2),g([A({attribute:!1})],E.prototype,"annotations",2),g([A({type:Boolean,reflect:!0})],E.prototype,"labels",2),g([A()],E.prototype,"curve",2),g([A({type:Boolean,attribute:"connect-nulls"})],E.prototype,"connectNulls",2),g([A()],E.prototype,"nulls",2),g([A({reflect:!0,converter:{fromAttribute:t=>t==="percent"?"percent":t!==null}})],E.prototype,"stacked",2),g([A({attribute:"stack-offset"})],E.prototype,"stackOffset",2),g([A()],E.prototype,"orientation",2),g([A({type:Number})],E.prototype,"radius",2),g([A({type:Number,attribute:"bar-gap"})],E.prototype,"barGap",2),g([A({type:Number,attribute:"bar-width"})],E.prototype,"barWidth",2),g([A()],E.prototype,"sort",2),g([A()],E.prototype,"transform",2),g([A({attribute:!1})],E.prototype,"transforms",2),g([A({type:Number})],E.prototype,"bins",2),g([A({type:Number,attribute:"bin-width"})],E.prototype,"binWidth",2),g([A({attribute:!1})],E.prototype,"binDomain",2),g([A({attribute:"bin-mode"})],E.prototype,"binMode",2),g([A({attribute:!1})],E.prototype,"sampling",2),g([A({type:Boolean,reflect:!0})],E.prototype,"brush",2),g([A({type:Boolean,reflect:!0})],E.prototype,"crosshair",2);var zi=e=>e.defs&&e.defs.length?re`<defs>${e.defs.map(n=>re`<linearGradient id=${n.id} x1="0" y1="0" x2=${n.vertical===!1?1:0} y2=${n.vertical===!1?0:1}>${n.stops.map(t=>re`<stop offset=${t.offset} stop-color=${t.color} stop-opacity=${H(t.opacity)}></stop>`)}</linearGradient>`)}</defs>`:X,pt=e=>re`${e.map((n,t)=>{let r=n.title?re`<title>${n.title}</title>`:X,i=n.item?t:void 0;switch(n.kind){case"path":return re`<path data-skdx-part=${n.part} data-skdx-i=${H(i)} d=${n.d} fill=${n.fill??"none"} stroke=${H(n.stroke)} stroke-width=${H(n.strokeWidth)} stroke-linecap=${H(n.strokeLinecap)} stroke-linejoin=${H(n.strokeLinejoin)} stroke-dasharray=${H(n.dash)} opacity=${H(n.opacity)} fill-opacity=${H(n.fillOpacity)}>${r}</path>`;case"rect":return re`<rect data-skdx-part=${n.part} data-skdx-i=${H(i)} x=${n.x} y=${n.y} width=${n.width} height=${n.height} rx=${H(n.rx)} fill=${n.fill} stroke=${H(n.stroke)} fill-opacity=${H(n.opacity)}>${r}</rect>`;case"line":return re`<line data-skdx-part=${n.part} data-skdx-i=${H(i)} x1=${n.x1} y1=${n.y1} x2=${n.x2} y2=${n.y2} stroke=${n.stroke} stroke-width=${H(n.strokeWidth)} stroke-dasharray=${H(n.dash)} opacity=${H(n.opacity)}>${r}</line>`;case"circle":return re`<circle data-skdx-part=${n.part} data-skdx-i=${H(i)} cx=${n.cx} cy=${n.cy} r=${n.r} fill=${n.fill} stroke=${H(n.stroke)} opacity=${H(n.opacity)}>${r}</circle>`;case"text":return re`<text data-skdx-part=${n.part} data-skdx-i=${H(i)} x=${n.x} y=${n.y} text-anchor=${H(n.anchor)} dominant-baseline=${H(n.baseline)} fill=${H(n.fill)} font-weight=${H(n.weight)} pointer-events=${H(i===void 0?"none":void 0)} transform=${H(n.rotate?`rotate(${n.rotate} ${n.x} ${n.y})`:void 0)}>${n.text}</text>`}})}`;var J=class extends R{constructor(){super(...arguments);this.data=[];this.labels=!1}render(){let{data:t,name:r,color:i,bins:o,binWidth:s,thresholds:l,domain:c,mode:d,xAxis:u,yAxis:h,references:b,annotations:v,labels:x,barGap:m}=this;return this.root(Kt({...this.sized(),data:t,name:r,color:i,bins:o,binWidth:s,thresholds:l,domain:c,mode:d,xAxis:u,yAxis:h,references:b,annotations:v,labels:x,barGap:m}),"histogram",this.label??"Histogram")}};g([te({attribute:!1})],J.prototype,"data",2),g([te()],J.prototype,"name",2),g([te()],J.prototype,"color",2),g([te({type:Number})],J.prototype,"bins",2),g([te({type:Number,attribute:"bin-width"})],J.prototype,"binWidth",2),g([te({attribute:!1})],J.prototype,"thresholds",2),g([te({attribute:!1})],J.prototype,"domain",2),g([te()],J.prototype,"mode",2),g([te({attribute:!1})],J.prototype,"xAxis",2),g([te({attribute:!1})],J.prototype,"yAxis",2),g([te({attribute:!1})],J.prototype,"references",2),g([te({attribute:!1})],J.prototype,"annotations",2),g([te({type:Boolean,reflect:!0})],J.prototype,"labels",2),g([te({type:Number,attribute:"bar-gap"})],J.prototype,"barGap",2),J=g([Li("skdx-histogram")],J);export{J as SkdxHistogram};
@@ -0,0 +1,109 @@
1
+ "use strict";var ue=Object.defineProperty;var St=Object.getOwnPropertyDescriptor;var Kt=Object.getOwnPropertyNames;var Yt=Object.prototype.hasOwnProperty;var Xt=(e,n)=>{for(var t in n)ue(e,t,{get:n[t],enumerable:!0})},Qt=(e,n,t,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of Kt(n))!Yt.call(e,i)&&i!==t&&ue(e,i,{get:()=>n[i],enumerable:!(r=St(n,i))||r.enumerable});return e};var Jt=e=>Qt(ue({},"__esModule",{value:!0}),e),d=(e,n,t,r)=>{for(var i=r>1?void 0:r?St(n,t):n,o=e.length-1,s;o>=0;o--)(s=e[o])&&(i=(r?s(n,t,i):s(i))||i);return r&&i&&ue(n,t,i),i};var yn={};Xt(yn,{SkdxIcicleChart:()=>A});module.exports=Jt(yn);var P=require("lit/decorators.js");var Ct=e=>Number(e.toPrecision(12)),en,tn=e=>(en??(en=new Intl.NumberFormat)).format(Ct(e)),nn=e=>{let n=Math.round(Math.abs(e)),t=e<0?"-":"",r=Math.floor(n/3600),i=Math.floor(n%3600/60),o=s=>String(s).padStart(2,"0");return r>0?`${t}${r}h ${o(i)}m`:i>0?`${t}${i}m ${o(n%60)}s`:`${t}${n}s`};function $t(e){if(e===void 0)return tn;if(typeof e=="function")return e;let{style:n,locale:t,digits:r,unit:i="",timeZone:o}=e,s=u=>i?p=>u(p)+i:u,a=u=>r===void 0?u===void 0?{}:{maximumFractionDigits:u}:{minimumFractionDigits:r,maximumFractionDigits:r},l=u=>{let p=new Intl.NumberFormat(t,u);return s(f=>p.format(Ct(f)))},c=u=>{let p=new Intl.DateTimeFormat(t,o?{...u,timeZone:o}:u);return f=>p.format(f)};switch(n){case"integer":return l({maximumFractionDigits:0});case"decimal":return l(a(2));case"percent":return l({style:"percent",...a(0)});case"currency":return l({style:"currency",currency:e.currency??"USD",...a()});case"compact":return l({notation:"compact",...a(1)});case"scientific":return l({notation:"scientific",...a(2)});case"date":return c({dateStyle:"medium"});case"time":return c({timeStyle:"short"});case"datetime":return c({dateStyle:"medium",timeStyle:"short"});case"duration":return s(nn)}}var y=e=>Number(e.toFixed(2)),$e=e=>typeof e=="number"&&Number.isFinite(e);function Ie(e){let n=1/0,t=-1/0;for(let r of e)$e(r)&&(r<n&&(n=r),r>t&&(t=r));return n===1/0?[0,0]:[n,t]}var Q=1e3,J=60*Q,ee=60*J,he=24*ee,Mn=[Q,5*Q,15*Q,30*Q,J,5*J,15*J,30*J,ee,3*ee,6*ee,12*ee,he,2*he,7*he,14*he];var rn=/-?\d*\.?\d+(?:e[-+]?\d+)?/gi,on=/([MLTHVCSQAZmlthvcsqaz])([^MLTHVCSQAZmlthvcsqaz]*)/g,sn={M:2,L:2,T:2,C:6,S:4,Q:4,A:7,H:-1,V:-2};function an(e,n,t){return e.replace(on,(r,i,o)=>{let s=sn[i];if(s===void 0)return i+o;let l=(o.match(rn)??[]).map((c,u)=>{let p=Number(c);if(s===-1)return String(p+n);if(s===-2)return String(p+t);let f=u%s;return s===7?f===5?String(p+n):f===6?String(p+t):c:String(f%2===0?p+n:p+t)});return i+l.join(" ")})}var It=(e,n,t)=>e.map(r=>{switch(r.kind){case"rect":return{...r,x:r.x+n,y:r.y+t};case"circle":return{...r,cx:r.cx+n,cy:r.cy+t};case"line":return{...r,x1:r.x1+n,x2:r.x2+n,y1:r.y1+t,y2:r.y2+t};case"text":return{...r,x:r.x+n,y:r.y+t};case"path":return{...r,d:an(r.d,n,t)}}});var Te=["primary","success","warning","danger","neutral"].flatMap(e=>[500,700].map(n=>`var(--skdx-color-${e}-${n})`)).sort((e,n)=>Number(e.endsWith("700)"))-Number(n.endsWith("700)"))),w={axis:"var(--skdx-color-border-strong)",grid:"var(--skdx-color-border-subtle)",label:"var(--skdx-color-text-muted)",focus:"var(--skdx-color-focus-ring)",positive:"var(--skdx-color-success-500)",negative:"var(--skdx-color-danger-500)",fontFamily:"var(--skdx-font-family)",fontSize:"var(--skdx-font-size-xs)"};var Tt=(e,n)=>n??Te[e%Te.length];var ln={top:16,right:16,bottom:32,left:48};function Ot(e,n,t=ln){return{x:t.left,y:t.top,width:Math.max(0,e-t.left-t.right),height:Math.max(0,n-t.top-t.bottom)}}function te(e){let n=e.legend;if(n)return n===!0?{}:n.enabled===!1?void 0:n}function zt(e){let n=e.tooltip;return n===void 0||n===!0?{enabled:!0}:n===!1?{enabled:!1}:{...n,enabled:n.enabled??!0}}var pe=20,cn=120,Lt=e=>{let n=te(e);return n&&(n.position==="left"||n.position==="right")?n.width??cn:0},fe=(e,n=600,t=300)=>({width:(e.width??n)-Lt(e),height:(e.height??t)-(te(e)?.position==="bottom"?pe:0)}),me=e=>{let n=te(e);return n&&(n.position===void 0||n.position==="top")?pe:0},D=6.5,ne=(e,n,t)=>t??(e.palette&&e.palette.length>0?e.palette[n%e.palette.length]:Tt(n)),ze=(e,n)=>e.hiddenSeries?.includes(n)??!1;function Oe(e,n,t=[],r={},i=10,o=8,s=!1){let a=[],l=r.maxItems,c=l!==void 0&&l>=0&&e.length>l?e.slice(0,l):e,u=e.length-c.length,p=r.interactive??!0,f=o,k=i,C=($,m,x,S)=>{let O=(m?18:4)+$.length*D;f>o&&(s||f+O>n-8)&&(f=o,k+=pe),m&&a.push({kind:"rect",part:"legend-swatch",x:f,y:k-5,width:10,height:10,fill:m,opacity:S?.3:void 0,item:x}),a.push({kind:"text",part:"legend-label",x:f+(m?14:0),y:k,text:$,baseline:"middle",fill:S?w.grid:w.label,item:x}),f+=O+12};for(let $ of c){let m=t.includes($.name),x=p?{label:$.name,series:$.name,legend:!0}:void 0;C(r.formatter?.($.name)??$.name,$.color,x,m)}return u>0&&C(`+${u} more`,void 0,void 0,!1),r.align==="end"?dn(a,n):a}function dn(e,n){let t=new Map;for(let i of e){let o=i.kind==="rect"?i.y+5:i.y;t.set(o,[...t.get(o)??[],i])}let r=[];for(let i of t.values()){let o=Math.max(...i.map(a=>a.kind==="rect"?a.x+a.width:a.x+a.text.length*D)),s=n-8-o;for(let a of i)r.push({...a,x:a.x+s})}return r}var un=(e,n,t={})=>new Set(Oe(e,n,[],t).flatMap(r=>r.kind==="text"?[r.y]:[])).size;function be(e,n,t,r=[]){let i=te(e),o=i&&e.direction==="rtl"&&i.align===void 0?{...i,align:"end"}:i,s=zt(e),a=o?.position==="bottom",l=Lt(e),c=e.hiddenSeries??[],u=o?l?Oe(r,1/0,c,o,10,(o.position==="right"?n:0)+8,!0):Oe(r,n,c,o,a?t+10:10):[],p=a?un(r,n,o):0;return{width:n+l,height:a?t+Math.max(1,p)*pe:t,legendOffset:o?.position==="left"?l:void 0,tooltip:s.enabled,tooltipFormatter:s.formatter,axisTooltipFormatter:s.axisFormatter,tooltipPortal:s.portal,tooltipPlacement:s.placement,tooltipAnchored:s.followPointer===!1?!0:void 0,description:e.description,decorative:e.decorative,animate:e.animate===!0?300:e.animate||void 0,responsive:!!e.responsive,shapes:u}}function Le(e){let n=e.legendOffset;if(!n)return e;let t=[...It(e.shapes.filter(l=>!l.part.startsWith("legend-")),n,0),...e.shapes.filter(l=>l.part.startsWith("legend-"))],r=l=>({...l,x:l.x+n}),i=e.hit?{...e.hit,plot:r(e.hit.plot),xs:e.hit.xs.map(l=>l+n),brush:e.hit.brush?{box:r(e.hit.brush.box),window:r(e.hit.brush.window)}:void 0}:void 0,o=e.edit,s=o?{...o,scale:l=>o.scale(l)+n,invert:l=>o.invert(l-n),bars:o.bars.map(l=>({...l,x0:l.x0+n,x1:l.x1+n}))}:void 0,a=e.map?{...e.map,plot:r(e.map.plot)}:void 0;return{...e,shapes:t,hit:i,edit:s,map:a,legendOffset:void 0}}function ge(e,n,t,r,i,o="auto"){let s=Array.isArray(t)?t:[t],a=Math.max(...s.map(f=>f.length))*D+12,l=6+s.length*16,c=o==="top"?{x:e-a/2,y:n-l-8}:o==="bottom"?{x:e-a/2,y:n+8}:o==="left"?{x:e-a-8,y:n-l/2}:o==="right"?{x:e+8,y:n-l/2}:{x:e+12,y:n-l-6},u=Math.max(0,Math.min(r-a,c.x)),p=Math.max(0,Math.min(i-l,c.y));return[{kind:"rect",part:"tooltip",x:y(u),y:y(p),width:y(a),height:l,fill:"var(--skdx-color-surface-raised)",stroke:w.axis,rx:3},...s.map((f,k)=>({kind:"text",part:"tooltip-label",x:y(u+6),y:y(p+11+k*16),text:f,baseline:"middle",fill:"var(--skdx-color-text-default)",weight:s.length>1&&k===0?"bold":void 0}))]}function Ae(e,n,t,r){let i=e.error!==void 0?"error":e.loading?"loading":n?"empty":null;if(!i)return null;let{width:o,height:s}=fe(e,t,r),a=i==="error"?e.error:i==="loading"?"Loading\u2026":e.emptyMessage??"No data available",l=[];return i==="loading"&&l.push({kind:"rect",part:"skeleton",x:0,y:0,width:o,height:s,fill:"var(--skdx-color-surface-sunken)",rx:4}),l.push({kind:"text",part:`state-${i}`,x:y(o/2),y:y(s/2),text:a,anchor:"middle",baseline:"middle",fill:i==="error"?"var(--skdx-color-text-danger)":w.label}),{...be(e,o,s),shapes:l,tooltip:!1}}var re=(e,n,t,r={})=>({kind:"text",part:"label",x:e,y:n,text:t,fill:w.label,...r});var ie=e=>Math.max(0,Math.min(1,e));function At(e){let n=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());if(n){let r=n[1],i=r.length===3?r.split("").map(o=>o+o).join(""):r;return[0,2,4].map(o=>parseInt(i.slice(o,o+2),16))}let t=/^rgba?\(\s*(\d+)[\s,]+(\d+)[\s,]+(\d+)/i.exec(e.trim());return t?[Number(t[1]),Number(t[2]),Number(t[3])]:void 0}function Nt(e,n){if(e.length===0)return w.axis;if(e.length===1)return e[0];let t=ie(n)*(e.length-1),r=Math.min(e.length-2,Math.floor(t)),i=t-r,o=At(e[r]),s=At(e[r+1]);if(!o||!s)return e[Math.round(t)];let a=l=>Math.round(o[l]+(s[l]-o[l])*i);return`rgb(${a(0)}, ${a(1)}, ${a(2)})`}var Bt=(e,n)=>n!==void 0&&n>=2?Math.min(n-1,Math.floor(ie(e)*n))/(n-1):ie(e);function Pt(e,n,t,r=w.negative,i=String){let[o,s]=Ie(n),a=e??{type:"sequential"},l=m=>y(.15+.85*m);if(a.type==="threshold"){let{thresholds:m,colors:x,labels:S}=a,O=N=>{if(typeof N!="number"||!Number.isFinite(N))return;let I=0;for(;I<m.length&&N>=m[I];)I++;return{fill:x[Math.min(I,x.length-1)]??t,opacity:1}},F=x.map((N,I)=>({fill:N,opacity:1,label:S?.[I]??(I===0?`< ${i(m[0]??0)}`:I===m.length?`\u2265 ${i(m[I-1])}`:`${i(m[I-1])} \u2013 ${i(m[I])}`)}));return{color:O,domain:[o,s],swatches:F,kind:"threshold"}}if(a.type==="ordinal"){let m=a.colors?.length?a.colors:[t];return{color:S=>typeof S=="number"&&Number.isFinite(S)?{fill:m[Math.abs(Math.round(S))%m.length],opacity:1}:void 0,domain:[o,s],swatches:m.map((S,O)=>({fill:S,opacity:1,label:String(O)})),kind:"ordinal"}}if(a.type==="diverging"){let[m,x,S]=a.domain??[-Math.max(Math.abs(o),Math.abs(s)),0,Math.max(Math.abs(o),Math.abs(s))],O=a.colors,F=T=>T<x?.5*(T-m)/Math.max(1e-12,x-m):.5+.5*(T-x)/Math.max(1e-12,S-x),N=T=>{let G=Bt(a.reversed?1-ie(T):T,a.steps);if(O&&O.length>=2)return{fill:Nt(O,G),opacity:1};let R=G<.5?r:t,W=Math.abs(G-.5)*2;return{fill:R,opacity:l(W)}},I=T=>typeof T=="number"&&Number.isFinite(T)?N(F(T)):void 0,_=a.steps??5,z=Array.from({length:_},(T,G)=>{let R=_===1?.5:G/(_-1),W=R<.5?m+(x-m)*(R*2):x+(S-x)*((R-.5)*2);return{...N(R),label:i(W)}});return{color:I,domain:[m,S],swatches:z,kind:"diverging"}}let[c,u]=a.domain??[o,s],p=a.colors,f=m=>{let x=Bt(a.reversed?1-ie(m):m,a.steps);return p&&p.length>=2?{fill:Nt(p,x),opacity:1}:{fill:p?.[0]??t,opacity:l(x)}},k=m=>typeof m!="number"||!Number.isFinite(m)?void 0:f(u===c?1:(m-c)/(u-c)),C=a.steps??5,$=Array.from({length:C},(m,x)=>{let S=C===1?1:x/(C-1);return{...f(S),label:i(c+(u-c)*S)}});return{color:k,domain:[c,u],swatches:$,kind:"sequential"}}function xe(e){return e==null?[]:(Array.isArray(e)?e:[e]).map(t=>typeof t=="object"?t:{id:t})}var Ne=e=>e.id??e.name??e.series,Rt=e=>e.seriesId??e.series;function H(e,n){let t=!1;return n.id!==void 0&&(t=!0,Ne(e)!==n.id&&e.id!==n.id&&e.name!==n.id)||n.series!==void 0&&(t=!0,Rt(e)!==n.series&&e.series!==n.series)||n.index!==void 0&&(t=!0,e.index!==n.index)||n.category!==void 0&&(t=!0,e.category!==n.category)?!1:t}function E(e){let n={},t=Ne(e);t!==void 0&&(n.id=t);let r=Rt(e);return r!==void 0&&e.series!==void 0&&(n.series=r),e.index!==void 0&&(n.index=e.index),n}var Be=(e,n)=>e.id===n.id&&e.series===n.series&&e.index===n.index&&e.category===n.category;function Pe(e,n,t){let r=xe(e),i=E(n),o=r.some(s=>H(n,s));return t==="single"?o?[]:[i]:o?r.filter(s=>!H(n,s)):[...r,i]}var hn=.2;function pn(e){let n=w.focus;switch(e.kind){case"rect":return{kind:"rect",part:"selected",x:e.x-1.5,y:e.y-1.5,width:e.width+3,height:e.height+3,fill:"none",stroke:n,rx:e.rx};case"circle":return{kind:"circle",part:"selected",cx:e.cx,cy:e.cy,r:e.r+2.5,fill:"none",stroke:n};case"path":return{kind:"path",part:"selected",d:e.d,fill:"none",stroke:n,strokeWidth:2.5};case"line":return{...e,part:"selected",stroke:n,strokeWidth:(e.strokeWidth??1)+3,title:void 0,item:void 0};case"text":return}}var fn=(e,n)=>e.kind==="text"?{...e,fill:w.grid}:{...e,opacity:(e.opacity??1)*n};function Re(e,n){let t=xe(n.selected),r=n.highlighted===void 0||n.highlighted===null?[]:xe(n.highlighted),i=r[0];if(t.length===0&&!i)return e;let o={highlighted:n.highlightScope?.highlighted??"item",faded:n.highlightScope?.faded??"global"},s=[],a=u=>!i||r.some(p=>H(u,p))?!0:o.highlighted==="series"?r.some(p=>p.series!==void 0&&H(u,{series:p.series})):!1,l=u=>{if(!i||o.faded==="none"||a(u))return!1;if(o.faded==="series"){let p=i.series;return p!==void 0&&H(u,{series:p})}return!0},c=e.shapes.map(u=>{let p=u.item;if(!p||p.legend)return u;if(t.some(f=>H(p,f))){let f=pn(u);f&&s.push(f)}return l(p)?fn(u,hn):u});return s.length?{...e,shapes:[...c,...s]}:{...e,shapes:c}}function Y(e,n,t,r,i){let o=e.getBoundingClientRect();return{x:o.width?(n-o.left)*r/o.width:n,y:o.height?(t-o.top)*i/o.height:t}}var De=(e,n,t)=>n>=e.x&&n<=e.x+e.width&&t>=e.y&&t<=e.y+e.height;function Dt(e,n){let t=0,r=1/0;return e.xs.forEach((i,o)=>{let s=Math.abs(i-n);s<r&&(r=s,t=o)}),t}function oe(e,n){let t=e.hit;if(!t||t.xs.length===0)return;let r=Dt(t,n),i=t.rows[r]??[];return{index:r,rows:e.axisTooltipFormatter?.(i,r)??i}}function Fe(e,n){let t=e.hit;if(!t||t.xs.length===0)return;let r=t.xs[Dt(t,n)];return{kind:"line",part:"crosshair",x1:r,x2:r,y1:t.plot.y,y2:t.plot.y+t.plot.height,stroke:w.axis,dash:"3 3"}}function Ge(e,n,t){let r=e.hit;if(!r||!r.crosshair||r.xs.length===0||!De(r.plot,n,t))return[];let i=Fe(e,n),{rows:o}=oe(e,n),s=e.tooltipAnchored?r.plot.y+8:t;return[i,...ge(i.x1,s,o,e.width,e.height,e.tooltipPlacement)]}function je(e,n){let t=e.hit;if(!t||t.xs.length===0)return[];let r=t.rows.findIndex(o=>o[0]===n);if(r<0)return[];let i=t.xs[r];return Ge(e,i,t.plot.y+8)}function He(e,n,t,r,i){if(!e.tooltip)return{lines:[],shapes:[]};if(e.hit?.crosshair){let{x:l,y:c}=Y(t,r,i,e.width,e.height);if(De(e.hit.plot,l,c)){let u=oe(e,l),p=Fe(e,l);if(u&&p)return{lines:u.rows,shapes:[p]}}}let o=n?.closest?.("[data-skdx-part]"),s=e.tooltipFormatter?Z(e,n)?.item:void 0,a=s&&e.tooltipFormatter?.(s)||o&&Array.from(o.children).find(l=>l.tagName.toLowerCase()==="title")?.textContent;return a?{lines:Array.isArray(a)?a:[a],shapes:[]}:{lines:[],shapes:[]}}function Ft(e,n,t,r,i,o,s){let a=e?.closest?.("[data-skdx-part]"),l=s&&s.tooltipFormatter?Z(s,e)?.item:void 0,c=l&&s?.tooltipFormatter?.(l)||a&&Array.from(a.children).find(C=>C.tagName.toLowerCase()==="title")?.textContent;if(!c)return[];let u=s?.tooltipAnchored?Z(s,e):void 0,p=u?s?.shapes[u.index]:void 0,{x:f,y:k}=p?se(p):Y(n,t,r,i,o);return ge(f,k,c,i,o,s?.tooltipPlacement)}function Ve(e,n,t,r,i){if(!e.tooltip)return[];if(e.hit?.crosshair){let{x:o,y:s}=Y(t,r,i,e.width,e.height),a=Ge(e,o,s);if(a.length>0)return a}return Ft(n,t,r,i,e.width,e.height,e)}function _e(e,n){let t=Z(e,n);return t&&!t.item.legend?E(t.item):null}var mn=(e,n)=>{let{x:t,y:r}=se(e),i=e.kind==="circle"?e.cy:e.kind==="rect"?e.y+e.height/2:r;return t>=n.x&&t<=n.x+n.width&&i>=n.y&&i<=n.y+n.height};function Ee(e,n){let t=new Set,r=[];for(let i of e.shapes){if(!i.item||i.item.legend||i.part==="anchor"||!mn(i,n))continue;let o=E(i.item),s=JSON.stringify(o);t.has(s)||(t.add(s),r.push(o))}return r}var Ze=e=>({kind:"rect",part:"selection-box",x:y(e.x),y:y(e.y),width:y(e.width),height:y(e.height),fill:w.focus,opacity:.12,stroke:w.focus}),ve=(e,n,t,r)=>({x:Math.min(e,t),y:Math.min(n,r),width:Math.abs(t-e),height:Math.abs(r-n)});function Gt(e,n,t){let r=!1;for(let i=0,o=e.length-1;i<e.length;o=i++){let s=e[i],a=e[o];s.y>t!=a.y>t&&n<(a.x-s.x)*(t-s.y)/(a.y-s.y)+s.x&&(r=!r)}return r}function We(e,n){if(n.length<3)return[];let t=new Set,r=[];for(let i of e.shapes){if(!i.item||i.item.legend||i.part==="anchor")continue;let{x:o,y:s}=se(i),a=i.kind==="circle"?i.cy:i.kind==="rect"?i.y+i.height/2:s;if(!Gt(n,o,a))continue;let l=E(i.item),c=JSON.stringify(l);t.has(c)||(t.add(c),r.push(l))}return r}var Ue=e=>({kind:"path",part:"selection-lasso",d:e.length?`M${e.map(n=>`${y(n.x)} ${y(n.y)}`).join("L")}`:"",fill:w.focus,fillOpacity:.12,stroke:w.focus,dash:"4 3"}),ye=6;function qe(e,n,t){let r=e.edit;if(r){for(let i of r.bars)if(!(t<i.y||t>i.y+i.height||n<i.x0-ye||n>i.x1+ye))return Math.abs(n-i.x0)<=ye?{bar:i,mode:"start"}:Math.abs(n-i.x1)<=ye?{bar:i,mode:"end"}:{bar:i,mode:"move"}}}function Ke(e,n,t){let r=e.edit;return jt(r,n,r.invert(n.bar.x0+t)-r.invert(n.bar.x0))}function Ye(e,n,t){let r=e.edit,i=t.key==="ArrowRight"?1:t.key==="ArrowLeft"?-1:0;if(!r||n===null||!i||!(t.shiftKey||t.altKey))return;let o=r.bars.find(l=>l.index===n);if(!o)return;let s=t.altKey?t.shiftKey?"start":"end":"move",a=r.snap??r.invert(o.x0+10)-r.invert(o.x0);return jt(r,{bar:o,mode:s},i*a)}function jt(e,{bar:n,mode:t},r){let i=a=>e.snap?Math.round(a/e.snap)*e.snap:a,o=n.start,s=n.end;return t==="move"?(o=i(n.start+r),s=o+(n.end-n.start)):t==="start"?o=Math.min(i(n.start+r),n.end):s=Math.max(i(n.end+r),n.start),{id:n.id,name:n.name,start:o,end:s}}function Xe(e,n,t){let r=e.edit,i=r.scale(t.start),o=r.scale(t.end);return{kind:"rect",part:"edit-ghost",x:y(Math.min(i,o)),y:y(n.bar.y),width:y(Math.max(1,Math.abs(o-i))),height:y(n.bar.height),fill:w.focus,opacity:.25,stroke:w.focus,rx:2}}var bn=64,gn=e=>Math.max(1,Math.min(bn,e));function Qe(e,n,t,r){let i=n>0?.8:1.25,o=gn(e.view.zoom*i);if(o===e.view.zoom)return e.view;let{plot:s,scale:a}=e,[l,c]=e.view.center,u=(t-(s.x+s.width/2))/a,p=(r-(s.y+s.height/2))/a,f=e.view.zoom/o;return{center:[l+u*(1-f),e.fromY(e.toY(c)-p*(1-f))],zoom:o}}function Je(e,n,t,r){let{scale:i}=e;return{center:[n.center[0]-t/i,e.fromY(e.toY(n.center[1])+r/i)],zoom:n.zoom}}function Z(e,n){let t=n?.closest?.("[data-skdx-i]"),r=Number(t?.getAttribute("data-skdx-i")),i=Number.isInteger(r)?e.shapes[r]?.item:void 0;return i?{index:r,item:i}:void 0}var we=e=>e.shapes.flatMap((n,t)=>n.item&&!n.item.legend?[t]:[]);function se(e){switch(e.kind){case"rect":return{x:e.x+e.width/2,y:e.y};case"circle":return{x:e.cx,y:e.cy-e.r};case"line":return{x:(e.x1+e.x2)/2,y:Math.min(e.y1,e.y2)};case"text":return{x:e.x,y:e.y};case"path":{let n=/M\s*(-?[\d.]+)[ ,](-?[\d.]+)/.exec(e.d);return n?{x:Number(n[1]),y:Number(n[2])}:{x:0,y:0}}}}function et(e,n){let t=n===null?void 0:e.shapes[n];if(!t)return[];let r=w.focus,i;switch(t.kind){case"rect":i={kind:"rect",part:"focus",x:t.x-2,y:t.y-2,width:t.width+4,height:t.height+4,fill:"none",stroke:r,rx:2};break;case"circle":i={kind:"circle",part:"focus",cx:t.cx,cy:t.cy,r:t.r+3,fill:"none",stroke:r};break;case"line":i={kind:"line",part:"focus",x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:r,strokeWidth:4};break;case"text":i={kind:"rect",part:"focus",x:t.x-2,y:t.y-8,width:t.text.length*D+4,height:16,fill:"none",stroke:r,rx:2};break;case"path":i={kind:"path",part:"focus",d:t.d,stroke:r,strokeWidth:2,fill:"none"};break}let{x:o,y:s}=se(t),a=t.item&&e.tooltipFormatter?.(t.item)||(t.item?.label??t.title??"");return[i,...a?ge(y(o),y(s),a,e.width,e.height):[]]}function tt(e,n,t){let r=we(e);if(r.length===0)return;let i=n===null?-1:r.indexOf(n);switch(t){case"ArrowRight":case"ArrowDown":return r[Math.min(r.length-1,i+1)];case"ArrowLeft":case"ArrowUp":return r[Math.max(0,i<=0?0:i-1)];case"Home":return r[0];case"End":return r[r.length-1];case"Escape":return null;default:return}}var q=2,K=(e,n,t)=>{let r=Math.max(q,Math.min(t,Math.round(n))),i=Math.max(0,Math.min(t-r,Math.round(e)));return{start:i,end:i+r}},Ht=(e,n)=>!e||e.start<=0&&e.end>=n;function nt(e,n,t){if(e.count<=q||!e.plot.width)return;let{start:r,end:i}=e.zoom,o=i-r,s=n>0?1.25:.8,a=Math.max(q,Math.min(e.count,Math.round(o*s)));if(a===o)return n>0&&!Ht(e.zoom,e.count)?K(r,a,e.count):void 0;let l=Math.max(0,Math.min(1,(t-e.plot.x)/e.plot.width)),c=r+l*o;return K(c-l*a,a,e.count)}function rt(e,n,t,r){let i=n.end-n.start,o=Math.max(q,Math.min(e.count,Math.round(i/Math.max(.05,t)))),s=Math.max(0,Math.min(1,(r-e.plot.x)/Math.max(1,e.plot.width)));return K(n.start+s*i-s*o,o,e.count)}function it(e,n,t){let r=n.end-n.start,i=e.plot.width/Math.max(1,r);return K(n.start-t/i,r,e.count)}function ot(e,n,t){let r=e.brush;if(!r||!De(r.box,n,t))return;let i=r.window;if(Math.abs(n-i.x)<=6)return{grab:"left",zoom:e.zoom};if(Math.abs(n-(i.x+i.width))<=6)return{grab:"right",zoom:e.zoom};if(n>i.x&&n<i.x+i.width)return{grab:"move",zoom:e.zoom};let o=e.zoom.end-e.zoom.start,s=(n-r.box.x)/Math.max(1,r.box.width)*e.count;return{grab:"move",zoom:K(s-o/2,o,e.count)}}function st(e,n,t,r){let i=e.brush;if(!i)return t;let o=r/Math.max(1,i.box.width)*e.count;if(n==="move")return K(t.start+o,t.end-t.start,e.count);if(n==="left")return{start:Math.max(0,Math.min(t.end-q,Math.round(t.start+o))),end:t.end};let s=Math.min(e.count,Math.max(t.start+q,Math.round(t.end+o)));return{start:t.start,end:s}}function lt(e,n){switch(n.type){case"svg":return Promise.resolve(at(e,n.label,n.resolve));case"csv":return Promise.resolve(Zt(n.rows));case"png":{if(typeof document>"u"||typeof Image>"u")return Promise.reject(new Error("PNG export needs a browser"));let t=at(e,n.label,n.resolve);return Et(t,e.width,e.height,n.scale,n.background)}}}var V=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/"/g,"&quot;"),ae=e=>e.filter(([,n])=>n!==void 0&&n!=="").map(([n,t])=>` ${n}="${V(String(t))}"`).join("");function Vt(e){let n=e.title?`<title>${V(e.title)}</title>`:"",t=["data-skdx-part",e.part];switch(e.kind){case"path":return`<path${ae([t,["d",e.d],["fill",e.fill??"none"],["stroke",e.stroke],["stroke-width",e.strokeWidth],["stroke-linecap",e.strokeLinecap],["stroke-linejoin",e.strokeLinejoin],["stroke-dasharray",e.dash],["opacity",e.opacity],["fill-opacity",e.fillOpacity]])}>${n}</path>`;case"rect":return`<rect${ae([t,["x",e.x],["y",e.y],["width",e.width],["height",e.height],["rx",e.rx],["fill",e.fill],["stroke",e.stroke],["fill-opacity",e.opacity]])}>${n}</rect>`;case"line":return`<line${ae([t,["x1",e.x1],["y1",e.y1],["x2",e.x2],["y2",e.y2],["stroke",e.stroke],["stroke-width",e.strokeWidth],["stroke-dasharray",e.dash],["opacity",e.opacity]])}>${n}</line>`;case"circle":return`<circle${ae([t,["cx",e.cx],["cy",e.cy],["r",e.r],["fill",e.fill],["stroke",e.stroke]])}>${n}</circle>`;case"text":return`<text${ae([t,["x",e.x],["y",e.y],["text-anchor",e.anchor],["dominant-baseline",e.baseline],["fill",e.fill],["font-weight",e.weight],["transform",e.rotate?`rotate(${e.rotate} ${e.x} ${e.y})`:void 0]])}>${V(e.text)}</text>`}}function _t(e){let n=e.defs??[];return n.length===0?"":`<defs>${n.map(t=>`<linearGradient id="${V(t.id)}" x1="0" y1="0" x2="${t.vertical===!1?1:0}" y2="${t.vertical===!1?0:1}">${t.stops.map(r=>`<stop offset="${r.offset}" stop-color="${V(r.color)}"${r.opacity===void 0?"":` stop-opacity="${r.opacity}"`}/>`).join("")}</linearGradient>`).join("")}</defs>`}function at(e,n,t){let r=_t(e)+e.shapes.map(Vt).join("");return t&&(r=r.replace(/var\((--[\w-]+)\)/g,(i,o)=>t(o).trim()||i)),`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${e.width} ${e.height}" width="${e.width}" height="${e.height}" role="img" aria-label="${V(n)}" font-family="${V(w.fontFamily)}" font-size="${V(w.fontSize)}"><title>${V(n)}</title>${r}</svg>`}function Et(e,n,t,r=2,i){return new Promise((o,s)=>{let a=URL.createObjectURL(new Blob([e],{type:"image/svg+xml;charset=utf-8"})),l=new Image;l.onload=()=>{URL.revokeObjectURL(a);let c=document.createElement("canvas");c.width=Math.round(n*r),c.height=Math.round(t*r);let u=c.getContext("2d");if(!u)return s(new Error("canvas 2d context unavailable"));i&&(u.fillStyle=i,u.fillRect(0,0,c.width,c.height)),u.drawImage(l,0,0,c.width,c.height),c.toBlob(p=>p?o(p):s(new Error("toBlob failed")),"image/png")},l.onerror=()=>{URL.revokeObjectURL(a),s(new Error("svg could not be decoded"))},l.src=a})}function Zt(e){let n=t=>{let r=t==null?"":String(t);return/[",\n\r]/.test(r)?`"${r.replace(/"/g,'""')}"`:r};return e.map(t=>t.map(n).join(",")).join(`\r
2
+ `)}var B=e=>$e(e.value)?e.value:(e.children??[]).reduce((n,t)=>n+B(t),0),ct=e=>e.length===0?0:1+Math.max(...e.map(n=>ct(n.children??[]))),X=e=>e.id??e.name;function Wt(e,n){for(let t of e){if(X(t)===n||t.name===n)return[t];let r=Wt(t.children??[],n);if(r)return[t,...r]}}var dt=(e,n)=>n==="asc"||n==="desc"?[...e].sort((t,r)=>n==="asc"?B(t)-B(r):B(r)-B(t)):[...e];function Me(e,n,t=1){return n===void 0?[...e]:e.map(r=>t>=n?{...r,value:B(r),children:void 0}:{...r,children:r.children?Me(r.children,n,t+1):void 0})}function ut(e,n){if(n===void 0)return{nodes:[...e],path:[]};let t=Wt(e,n);if(!t)return{nodes:[...e],path:[]};let r=t[t.length-1];return{nodes:r.children?.length?r.children:[r],path:t}}function ht(e,n){if(!n)return;let t=typeof n=="object"?n.maxRows??500:500,r=e.hit;if(r&&r.rows.length>0){let a=r.rows[0];if(r.rows.length>t)return;let l=["",...a.slice(1).map(u=>u.replace(/:\s[^:]*$/,""))],c=r.rows.map(u=>[u[0],...u.slice(1).map(p=>p.slice(p.lastIndexOf(": ")+2))]);return[l,...c]}let i=e.shapes.flatMap(a=>a.item&&!a.item.legend&&!(a.part==="anchor"&&!a.title)?[a.item]:[]);if(i.length===0||i.length>t)return;let o=["series","name","category","value"].filter(a=>i.some(l=>l[a]!==void 0)),s=(a,l)=>a[l]===void 0?"":String(a[l]);return[o.map(a=>a[0]?.toUpperCase()+a.slice(1)),...i.map(a=>o.map(l=>s(a,l)))]}var pt=new Map;function ke(e){let n=pt.get(e);if(n)return n.group;let t=new Set,r={},i={current:r,subscribe(o){return t.add(o),()=>{t.delete(o),t.size===0&&pt.delete(e)}},publish(o,s){Object.assign(r,o);for(let a of t)a(o,s)}};return pt.set(e,{group:i,listeners:t}),i}var Ut='[data-skdx-part]:not([data-skdx-part^="tooltip"]):not([data-skdx-part="focus"]):not([data-skdx-part="crosshair"])',ft=`@keyframes skdx-in{from{opacity:0}to{opacity:1}}${Ut}{animation:skdx-in var(--skdx-chart-duration,0ms) ease-out;transition:${["x","y","width","height","cx","cy","r","opacity","fill-opacity","d"].map(e=>`${e} var(--skdx-chart-duration,0ms) ease-out`).join(",")}}@media (prefers-reduced-motion:reduce){${Ut}{animation:none;transition:none}}`;function mt(e){let n=e.animate;return n&&e.shapes.length<=1500?`${n}ms`:void 0}function qt(e,n,t){let r=[],i=n;return e.forEach((o,s)=>{s>0&&(r.push(re(y(i),t,"\u203A",{part:"breadcrumb-separator",baseline:"middle"})),i+=D+6),r.push(re(y(i),t,o.name,{part:"breadcrumb",baseline:"middle",fill:"var(--skdx-color-text-default)",title:o.name,item:{label:o.name,id:X(o),name:o.name}})),i+=o.name.length*D+6}),r}function bt(e){let n=[],{nodes:t,path:r}=ut(e.data,e.rootId),i=Me(t,e.maxDepth).filter(z=>!ze(e,z.name)),o=Ae(e,!i.some(z=>B(z)>0));if(o)return{...o,issues:n};let s=$t(e.format),{width:a,height:l}=fe(e),c=e.orientation==="horizontal",u=e.breadcrumbs&&r.length>0,p=me(e)+(u?20:0),f=Ot(a,l,{top:p,right:0,bottom:0,left:0}),k=e.padding??1,C=e.labels??!0,$=Math.max(1,ct(i)),m=(c?f.width:f.height)/$,x=[],S=z=>{z.children?.length?z.children.forEach(S):x.push(B(z))};i.forEach(S);let O=Pt(e.colorScale,x,ne(e,0),void 0,s),F=[],N=[],I=(z,T,G,R,W)=>{let xt=dt(z,e.sort).filter(L=>{let U=B(L)>0;return U||n.push({code:"invalid-value",severity:"warning",message:`"${L.name}" has no positive value and was dropped.`,itemId:X(L)}),U}),yt=xt.reduce((L,U)=>L+B(U),0),le=G;xt.forEach((L,U)=>{let ce=B(L),de=yt>0?ce/yt*R:0,Ce=(L.children?.length??0)>0,vt=L.color??W??ne(e,U),wt=!Ce&&e.colorScale?O.color(ce):void 0,Mt=T*m,j=c?{x:f.x+Mt+k/2,y:le+k/2,width:m-k,height:de-k}:{x:le+k/2,y:f.y+Mt+k/2,width:de-k,height:m-k},kt=`${L.name}: ${s(ce)}`;F.push({kind:"rect",part:"cell",x:y(j.x),y:y(j.y),width:y(Math.max(0,j.width)),height:y(Math.max(0,j.height)),fill:wt?.fill??vt,opacity:wt?.opacity??(Ce?.7:void 0),title:kt,item:{label:kt,id:X(L),name:L.name,value:ce}}),C&&j.width>L.name.length*D+6&&j.height>12&&N.push(re(y(j.x+4),y(j.y+j.height/2),L.name,{part:"cell-label",baseline:"middle",fill:"var(--skdx-color-text-on-accent)"})),Ce&&I(L.children,T+1,le,de,vt),le+=de})};I(i,0,c?f.y:f.x,c?f.height:f.width,void 0),u&&F.push(...qt(r,8,me(e)+10));let _=be(e,a,l,i.map((z,T)=>({name:z.name,color:ne(e,T,z.color)})));return{..._,shapes:[...F,...N,..._.shapes],issues:n}}var b=require("lit"),h=require("lit/decorators.js"),v=require("lit/directives/if-defined.js");var gt={fromAttribute:()=>!1},g=class extends b.LitElement{constructor(){super(...arguments);this.legend=!1;this.tooltip=!0;this.selectionMode="none";this.loading=!1;this.decorative=!1;this.accessibleTable=!1;this.zoomable=!1;this.editable=!1;this.crossFilter=!1;this.animated=!1;this.responsive=!1;this.tip=[];this.overlay=[];this.portal=null;this.highlightState=null;this.crossState=null;this.lastCross=null;this.pointers=new Map;this.hover=null;this.token={};this.focused=null;this.hiddenState=[];this.drag=null;this.onPointerMove=t=>{let r=this.layout;if(!r)return;this.pointers.has(t.pointerId)&&this.pointers.set(t.pointerId,this.viewBox(t,r).x);let i=this.drag;if(i?.grab==="select"){let{x:o,y:s}=this.viewBox(t,r);this.overlay=[Ze(ve(i.x,i.y,o,s))];return}if(i?.grab==="lasso"){let{x:o,y:s}=this.viewBox(t,r);i.points=[...i.points??[],{x:o,y:s}],this.overlay=[Ue(i.points)];return}if(i?.grab==="edit"){if(!i.gantt)return;let{x:o}=this.viewBox(t,r);i.change=Ke(r,i.gantt,o-i.x),this.overlay=[Xe(r,i.gantt,i.change)];return}if(i?.grab==="map"){if(!r.map||!i.view)return;let{x:o,y:s}=this.viewBox(t,r);this.setView(Je(r.map,i.view,o-i.x,s-i.y));return}if(i&&r.hit){if(i.grab==="pinch"){let[s,a]=[...this.pointers.values()];if(s===void 0||a===void 0||!i.distance)return;this.setZoom(rt(r.hit,i.zoom,Math.abs(s-a)/i.distance,(s+a)/2));return}let{x:o}=this.viewBox(t,r);this.setZoom(i.grab==="pan"?it(r.hit,i.zoom,o-i.x):st(r.hit,i.grab,i.zoom,o-i.x));return}if(r.tooltipPortal){let{lines:o,shapes:s}=He(r,t.target,t.currentTarget,t.clientX,t.clientY);this.tip=s,this.portal=o.length?{x:t.clientX,y:t.clientY,lines:o}:null}else{let o=Ve(r,t.target,t.currentTarget,t.clientX,t.clientY);(o.length>0||this.tip.length>0)&&(this.tip=o)}if(this.highlight(_e(r,t.target)),this.syncId&&r.hit?.crosshair){let o=oe(r,this.viewBox(t,r).x);this.shareCrosshair(o?r.hit.rows[o.index]?.[0]??null:null)}};this.onPointerDown=t=>{let r=this.layout;if(!r||t.button!==0)return;let{x:i,y:o}=this.viewBox(t,r),s=Z(r,t.target)?.item.legend,a=this.canEdit(r)?qe(r,i,o):void 0;if(a){this.drag={x:i,y:o,zoom:{start:0,end:0},grab:"edit",gantt:a},t.currentTarget.setPointerCapture(t.pointerId),this.clearTip();return}if(this.brushing()&&!s){this.drag={x:i,y:o,zoom:{start:0,end:0},grab:this.selectionMode==="lasso"?"lasso":"select",points:[{x:i,y:o}]},t.currentTarget.setPointerCapture(t.pointerId),this.clearTip();return}if(this.canPan(r)&&r.map){let c=r.map.plot;if(i<c.x||i>c.x+c.width||o<c.y||o>c.y+c.height)return;this.drag={x:i,y:o,zoom:{start:0,end:0},grab:"map",view:r.map.view},t.currentTarget.setPointerCapture(t.pointerId),this.clearTip();return}let l=r.hit;if(!(!l||!this.canZoom(r))){if(this.pointers.set(t.pointerId,i),this.pointers.size===2){let[c,u]=[...this.pointers.values()];this.drag={x:(c+u)/2,y:o,zoom:l.zoom,grab:"pinch",distance:Math.abs(c-u)||1}}else{let c=ot(l,i,o);if(c)this.drag={x:i,y:o,zoom:c.zoom,grab:c.grab},c.zoom!==l.zoom&&this.setZoom(c.zoom);else if(this.zoomable&&i>=l.plot.x&&i<=l.plot.x+l.plot.width&&o>=l.plot.y&&o<=l.plot.y+l.plot.height)this.drag={x:i,y:o,zoom:l.zoom,grab:"pan"};else{this.pointers.delete(t.pointerId);return}}t.currentTarget.setPointerCapture(t.pointerId),this.clearTip()}};this.onPointerUp=t=>{this.pointers.delete(t.pointerId);let r=t.currentTarget;r.hasPointerCapture(t.pointerId)&&r.releasePointerCapture(t.pointerId);let i=this.drag,o=this.layout;if(o&&(i?.grab==="select"||i?.grab==="lasso"||i?.grab==="edit"||i?.grab==="map")){this.overlay=[];let{x:s,y:a}=this.viewBox(t,o);if(Math.abs(s-i.x)>2||Math.abs(a-i.y)>2){i.grab==="select"?this.setSelected(Ee(o,ve(i.x,i.y,s,a))):i.grab==="lasso"?this.setSelected(We(o,i.points??[])):i.grab==="edit"&&i.change&&this.emit("skdx-task-change",i.change),this.drag={...i,distance:-1};return}this.drag=null;return}(this.pointers.size===0||this.drag?.grab==="pinch")&&(this.drag=null)};this.onWheel=t=>{let r=this.layout;if(!r)return;let{x:i,y:o}=this.viewBox(t,r);if(r.map&&this.canPan(r)){let l=r.map.plot;if(i<l.x||i>l.x+l.width||o<l.y||o>l.y+l.height)return;t.preventDefault(),this.setView(Qe(r.map,t.deltaY,i,o));return}let s=r.hit;if(!s||!this.canZoom(r)||o<s.plot.y||o>s.plot.y+s.plot.height)return;let a=nt(s,t.deltaY,i);a&&(t.preventDefault(),this.setZoom(a))};this.onClick=t=>{if(!this.layout)return;if(this.drag?.distance===-1){this.drag=null;return}let r=Z(this.layout,t.target);r&&(r.item.range?this.setZoom(r.item.range):r.item.legend&&r.item.series!==void 0?this.toggle(r.item.series):(this.select(r.item),this.emit("skdx-item-click",r.item)))};this.onKeyDown=t=>{let r=this.layout;if(!r)return;if((t.key==="Enter"||t.key===" ")&&this.focused!==null){let a=r.shapes[this.focused]?.item;a&&(t.preventDefault(),this.select(a),this.emit("skdx-item-click",a));return}let i=this.canEdit(r)?Ye(r,this.focused,t):void 0;if(i){t.preventDefault(),this.emit("skdx-task-change",i);return}let o=tt(r,this.focused,t.key);if(o===void 0)return;t.preventDefault(),this.focused=o;let s=o===null?void 0:r.shapes[o]?.item;this.highlight(s?E(s):null)}}connectedCallback(){super.connectedCallback(),!(typeof ResizeObserver>"u")&&(this.observer=new ResizeObserver(([t])=>{let r=Math.floor(t?.contentRect.width??0);r>0&&(this.measured=r)}),this.observer.observe(this))}disconnectedCallback(){this.observer?.disconnect(),this.leave?.(),this.leave=void 0,this.joined=void 0,super.disconnectedCallback()}sized(){let{width:t,height:r,legend:i,tooltip:o,format:s,palette:a,loading:l,error:c,emptyMessage:u,description:p,decorative:f,animated:k,responsive:C,highlighted:$,highlightScope:m,accessibleTable:x}=this;return{...typeof C=="object"&&this.measured!==void 0&&this.measured<(C.breakpoint??480)?C.compact:void 0,width:C&&this.measured?this.measured:t,height:r,animate:k,responsive:C,legend:i,tooltip:o,format:s,palette:a,loading:l,error:c,emptyMessage:u,description:p,decorative:f,highlighted:$===void 0?this.highlightState:$,highlightScope:m,accessibleTable:x,hiddenSeries:this.hiddenSeries??this.hiddenState,zoom:this.zoom??this.zoomState,selected:this.selected??this.selectedState,view:this.view??this.viewState}}emit(t,r){this.dispatchEvent(new CustomEvent(t,{detail:r,bubbles:!0,composed:!0}))}publish(t){this.syncId&&ke(this.syncId).publish(t,this.token)}join(){if(this.joined===this.syncId||(this.leave?.(),this.leave=void 0,this.joined=this.syncId,!this.syncId))return;let t=ke(this.syncId),r=i=>{"highlighted"in i&&(this.highlightState=i.highlighted??null),i.selected&&(this.selectedState=i.selected,this.crossFilter&&(this.highlightState=i.selected.length?i.selected:null)),"zoom"in i&&(this.zoomState=i.zoom),i.hiddenSeries&&(this.hiddenState=i.hiddenSeries),"crosshair"in i&&(this.crossState=i.crosshair??null)};r(t.current),this.leave=t.subscribe((i,o)=>{o!==this.token&&r(i)})}setZoom(t){this.zoomState=t,this.emit("skdx-zoom-change",t),this.publish({zoom:t})}setView(t){this.viewState=t,this.emit("skdx-view-change",t)}setSelected(t){this.selectedState=t,this.emit("skdx-selected-change",t),this.publish({selected:t})}toggle(t){let r=this.hiddenSeries??this.hiddenState,i=r.includes(t)?r.filter(o=>o!==t):[...r,t];this.hiddenState=i,this.emit("skdx-hidden-series-change",i),this.publish({hiddenSeries:i})}highlight(t){let r=this.hover;r===t||r&&t&&Be(r,t)||(this.hover=t,this.emit("skdx-highlighted-change",t),this.syncId&&(this.highlightState=t,this.publish({highlighted:t})))}select(t){let r=this.selectionMode;r!=="none"&&this.setSelected(Pe(this.selected??this.selectedState,t,r==="single"?"single":"multiple"))}shareCrosshair(t){!this.syncId||this.lastCross===t||(this.lastCross=t,this.publish({crosshair:t}))}clearTip(){this.tip=[],this.portal=null,this.shareCrosshair(null)}canZoom(t){return!!(t.hit&&(this.zoomable||t.hit.brush))}canPan(t){return!!(t.map&&this.zoomable)}canEdit(t){return!!(this.editable&&t.edit)}brushing(){return this.selectionMode==="brush"||this.selectionMode==="lasso"}viewBox(t,r){return Y(t.currentTarget,t.clientX,t.clientY,r.width,r.height)}getSvgElement(){return this.renderRoot.querySelector("svg")}getLayout(){return this.layout}resetZoom(){this.setZoom(void 0)}zoomTo(t){this.setZoom(t)}focusItem(t){let r=this.layout;if(!r)return!1;let i=r.shapes.findIndex(o=>o.item&&!o.item.legend&&H(o.item,t));return i<0?!1:(this.getSvgElement()?.focus(),this.focused=i,!0)}export(t){let r=this.layout;return r?lt(r,{...t,label:t.label??this.label??this.localName}):Promise.reject(new Error("not rendered yet"))}root(t,r,i){this.join();let o=Re(Le(t),this.sized());if(this.layout=o,o.issues!==this.reported){this.reported=o.issues;for(let x of o.issues??[])this.emit("skdx-data-issue",x)}let s=this.canZoom(o),a=this.canPan(o),l=this.canEdit(o),c=this.brushing(),u=s||a||l||c,p=!o.decorative&&we(o).length>0,f=o.description?`${r}-desc`:void 0,k=mt(o),C=ht(o,this.accessibleTable),$=typeof this.accessibleTable=="object"&&this.accessibleTable.caption||i,m=this.portal;return b.html`<svg
3
+ xmlns="http://www.w3.org/2000/svg"
4
+ viewBox="0 0 ${o.width} ${o.height}"
5
+ width=${o.width}
6
+ height=${o.height}
7
+ role=${o.decorative?"presentation":"img"}
8
+ aria-hidden=${o.decorative?"true":b.nothing}
9
+ aria-label=${o.decorative?b.nothing:i}
10
+ aria-describedby=${(0,v.ifDefined)(f)}
11
+ tabindex=${p?0:b.nothing}
12
+ data-skdx-chart=${r}
13
+ data-zoomable=${s||a?"":b.nothing}
14
+ data-brushing=${c&&!(s||a)?"":b.nothing}
15
+ data-editable=${l?"":b.nothing}
16
+ style=${k?`--skdx-chart-duration:${k}`:b.nothing}
17
+ font-family=${w.fontFamily}
18
+ font-size=${w.fontSize}
19
+ @pointermove=${o.tooltip||u?this.onPointerMove:b.nothing}
20
+ @pointerleave=${()=>{this.clearTip(),this.highlight(null)}}
21
+ @pointerdown=${u?this.onPointerDown:b.nothing}
22
+ @pointerup=${u?this.onPointerUp:b.nothing}
23
+ @pointercancel=${u?this.onPointerUp:b.nothing}
24
+ @wheel=${s||a?this.onWheel:b.nothing}
25
+ @dblclick=${s||a?()=>a?this.setView(void 0):this.setZoom(void 0):b.nothing}
26
+ @click=${this.onClick}
27
+ @keydown=${p?this.onKeyDown:b.nothing}
28
+ @blur=${()=>{this.focused=null,this.highlight(null)}}
29
+ >
30
+ <title>${i}</title>
31
+ ${o.description?b.svg`<desc id=${(0,v.ifDefined)(f)}>${o.description}</desc>`:b.nothing}
32
+ ${k?b.svg`<style>${ft}</style>`:b.nothing} ${xn(o)}
33
+ ${Se(o.shapes)}
34
+ ${Se(this.tip.length||!this.crossState?this.tip:je(o,this.crossState))}
35
+ ${Se(et(o,this.focused))} ${Se(this.overlay)}
36
+ </svg>
37
+ ${m?b.html`<div
38
+ role="tooltip"
39
+ data-skdx-tooltip=${r}
40
+ style="left:${m.x+12}px;top:${m.y+12}px"
41
+ >
42
+ ${m.lines.map(x=>b.html`<div>${x}</div>`)}
43
+ </div>`:b.nothing}
44
+ ${C?b.html`<table data-skdx-table=${r}>
45
+ <caption>
46
+ ${$}
47
+ </caption>
48
+ <thead>
49
+ <tr>
50
+ ${(C[0]??[]).map(x=>b.html`<th scope="col">${x}</th>`)}
51
+ </tr>
52
+ </thead>
53
+ <tbody>
54
+ ${C.slice(1).map(x=>b.html`<tr>
55
+ ${x.map((S,O)=>O===0?b.html`<th scope="row">${S}</th>`:b.html`<td>${S}</td>`)}
56
+ </tr>`)}
57
+ </tbody>
58
+ </table>`:b.nothing}`}};g.styles=b.css`
59
+ :host {
60
+ display: inline-block;
61
+ }
62
+ svg {
63
+ display: block;
64
+ max-width: 100%;
65
+ height: auto;
66
+ outline: none;
67
+ }
68
+ svg[data-zoomable] {
69
+ cursor: grab;
70
+ touch-action: none;
71
+ }
72
+ svg[data-brushing] {
73
+ cursor: crosshair;
74
+ touch-action: none;
75
+ }
76
+ svg[data-editable] {
77
+ touch-action: none;
78
+ }
79
+ :host([responsive]) {
80
+ display: block;
81
+ }
82
+ table {
83
+ position: absolute;
84
+ width: 1px;
85
+ height: 1px;
86
+ margin: -1px;
87
+ padding: 0;
88
+ overflow: hidden;
89
+ clip: rect(0 0 0 0);
90
+ white-space: nowrap;
91
+ border: 0;
92
+ }
93
+ [role='tooltip'] {
94
+ position: fixed;
95
+ pointer-events: none;
96
+ z-index: 1000;
97
+ background: var(--skdx-color-surface-raised);
98
+ color: var(--skdx-color-text-default);
99
+ border: 1px solid var(--skdx-color-border-strong);
100
+ border-radius: 3px;
101
+ padding: 4px 8px;
102
+ font-family: var(--skdx-font-family);
103
+ font-size: var(--skdx-font-size-xs);
104
+ white-space: nowrap;
105
+ }
106
+ [role='tooltip'] > :first-child:not(:only-child) {
107
+ font-weight: bold;
108
+ }
109
+ `,d([(0,h.property)({type:Number})],g.prototype,"width",2),d([(0,h.property)({type:Number})],g.prototype,"height",2),d([(0,h.property)()],g.prototype,"label",2),d([(0,h.property)({type:Boolean,reflect:!0})],g.prototype,"legend",2),d([(0,h.property)({type:Boolean,attribute:"no-tooltip",converter:gt})],g.prototype,"tooltip",2),d([(0,h.property)({attribute:!1})],g.prototype,"format",2),d([(0,h.property)({attribute:!1})],g.prototype,"palette",2),d([(0,h.property)({attribute:!1})],g.prototype,"hiddenSeries",2),d([(0,h.property)({attribute:!1})],g.prototype,"selected",2),d([(0,h.property)({attribute:"selection-mode"})],g.prototype,"selectionMode",2),d([(0,h.property)({attribute:!1})],g.prototype,"highlighted",2),d([(0,h.property)({attribute:!1})],g.prototype,"highlightScope",2),d([(0,h.property)({type:Boolean,reflect:!0})],g.prototype,"loading",2),d([(0,h.property)()],g.prototype,"error",2),d([(0,h.property)({attribute:"empty-message"})],g.prototype,"emptyMessage",2),d([(0,h.property)()],g.prototype,"description",2),d([(0,h.property)({type:Boolean,reflect:!0})],g.prototype,"decorative",2),d([(0,h.property)({type:Boolean,attribute:"accessible-table"})],g.prototype,"accessibleTable",2),d([(0,h.property)({attribute:!1})],g.prototype,"zoom",2),d([(0,h.property)({attribute:!1})],g.prototype,"view",2),d([(0,h.property)({type:Boolean,reflect:!0})],g.prototype,"zoomable",2),d([(0,h.property)({type:Boolean,reflect:!0})],g.prototype,"editable",2),d([(0,h.property)({attribute:"sync-id"})],g.prototype,"syncId",2),d([(0,h.property)({type:Boolean,attribute:"cross-filter"})],g.prototype,"crossFilter",2),d([(0,h.property)({converter:{fromAttribute:t=>t===null?!1:t===""?!0:Number(t)}})],g.prototype,"animated",2),d([(0,h.property)({type:Boolean,reflect:!0})],g.prototype,"responsive",2),d([(0,h.state)()],g.prototype,"tip",2),d([(0,h.state)()],g.prototype,"overlay",2),d([(0,h.state)()],g.prototype,"portal",2),d([(0,h.state)()],g.prototype,"measured",2),d([(0,h.state)()],g.prototype,"viewState",2),d([(0,h.state)()],g.prototype,"highlightState",2),d([(0,h.state)()],g.prototype,"crossState",2),d([(0,h.state)()],g.prototype,"focused",2),d([(0,h.state)()],g.prototype,"hiddenState",2),d([(0,h.state)()],g.prototype,"zoomState",2),d([(0,h.state)()],g.prototype,"selectedState",2);var M=class extends g{constructor(){super(...arguments);this.series=[];this.labels=!1;this.connectNulls=!1;this.stacked=!1;this.brush=!1;this.crosshair=!1}input(){let{series:t,categories:r,xAxis:i,yAxis:o,rightAxis:s,references:a,annotations:l,labels:c,curve:u,connectNulls:p,nulls:f,stacked:k,stackOffset:C,orientation:$,radius:m,barGap:x,barWidth:S,sort:O,transform:F,transforms:N,bins:I,binWidth:_,binDomain:z,binMode:T,sampling:G,brush:R,crosshair:W}=this;return{...this.sized(),series:t,categories:r,xAxis:i,yAxis:o,rightAxis:s,references:a,annotations:l,labels:c,curve:u,connectNulls:p,nulls:f,stacked:k,stackOffset:C,orientation:$,radius:m,barGap:x,barWidth:S,sort:O,transform:F,transforms:N,bins:I,binWidth:_,binDomain:z,binMode:T,sampling:G,brush:R,crosshair:W}}};d([(0,h.property)({attribute:!1})],M.prototype,"series",2),d([(0,h.property)({attribute:!1})],M.prototype,"categories",2),d([(0,h.property)({attribute:!1})],M.prototype,"xAxis",2),d([(0,h.property)({attribute:!1})],M.prototype,"yAxis",2),d([(0,h.property)({attribute:!1})],M.prototype,"rightAxis",2),d([(0,h.property)({attribute:!1})],M.prototype,"references",2),d([(0,h.property)({attribute:!1})],M.prototype,"annotations",2),d([(0,h.property)({type:Boolean,reflect:!0})],M.prototype,"labels",2),d([(0,h.property)()],M.prototype,"curve",2),d([(0,h.property)({type:Boolean,attribute:"connect-nulls"})],M.prototype,"connectNulls",2),d([(0,h.property)()],M.prototype,"nulls",2),d([(0,h.property)({reflect:!0,converter:{fromAttribute:t=>t==="percent"?"percent":t!==null}})],M.prototype,"stacked",2),d([(0,h.property)({attribute:"stack-offset"})],M.prototype,"stackOffset",2),d([(0,h.property)()],M.prototype,"orientation",2),d([(0,h.property)({type:Number})],M.prototype,"radius",2),d([(0,h.property)({type:Number,attribute:"bar-gap"})],M.prototype,"barGap",2),d([(0,h.property)({type:Number,attribute:"bar-width"})],M.prototype,"barWidth",2),d([(0,h.property)()],M.prototype,"sort",2),d([(0,h.property)()],M.prototype,"transform",2),d([(0,h.property)({attribute:!1})],M.prototype,"transforms",2),d([(0,h.property)({type:Number})],M.prototype,"bins",2),d([(0,h.property)({type:Number,attribute:"bin-width"})],M.prototype,"binWidth",2),d([(0,h.property)({attribute:!1})],M.prototype,"binDomain",2),d([(0,h.property)({attribute:"bin-mode"})],M.prototype,"binMode",2),d([(0,h.property)({attribute:!1})],M.prototype,"sampling",2),d([(0,h.property)({type:Boolean,reflect:!0})],M.prototype,"brush",2),d([(0,h.property)({type:Boolean,reflect:!0})],M.prototype,"crosshair",2);var xn=e=>e.defs&&e.defs.length?b.svg`<defs>${e.defs.map(n=>b.svg`<linearGradient id=${n.id} x1="0" y1="0" x2=${n.vertical===!1?1:0} y2=${n.vertical===!1?0:1}>${n.stops.map(t=>b.svg`<stop offset=${t.offset} stop-color=${t.color} stop-opacity=${(0,v.ifDefined)(t.opacity)}></stop>`)}</linearGradient>`)}</defs>`:b.nothing,Se=e=>b.svg`${e.map((n,t)=>{let r=n.title?b.svg`<title>${n.title}</title>`:b.nothing,i=n.item?t:void 0;switch(n.kind){case"path":return b.svg`<path data-skdx-part=${n.part} data-skdx-i=${(0,v.ifDefined)(i)} d=${n.d} fill=${n.fill??"none"} stroke=${(0,v.ifDefined)(n.stroke)} stroke-width=${(0,v.ifDefined)(n.strokeWidth)} stroke-linecap=${(0,v.ifDefined)(n.strokeLinecap)} stroke-linejoin=${(0,v.ifDefined)(n.strokeLinejoin)} stroke-dasharray=${(0,v.ifDefined)(n.dash)} opacity=${(0,v.ifDefined)(n.opacity)} fill-opacity=${(0,v.ifDefined)(n.fillOpacity)}>${r}</path>`;case"rect":return b.svg`<rect data-skdx-part=${n.part} data-skdx-i=${(0,v.ifDefined)(i)} x=${n.x} y=${n.y} width=${n.width} height=${n.height} rx=${(0,v.ifDefined)(n.rx)} fill=${n.fill} stroke=${(0,v.ifDefined)(n.stroke)} fill-opacity=${(0,v.ifDefined)(n.opacity)}>${r}</rect>`;case"line":return b.svg`<line data-skdx-part=${n.part} data-skdx-i=${(0,v.ifDefined)(i)} x1=${n.x1} y1=${n.y1} x2=${n.x2} y2=${n.y2} stroke=${n.stroke} stroke-width=${(0,v.ifDefined)(n.strokeWidth)} stroke-dasharray=${(0,v.ifDefined)(n.dash)} opacity=${(0,v.ifDefined)(n.opacity)}>${r}</line>`;case"circle":return b.svg`<circle data-skdx-part=${n.part} data-skdx-i=${(0,v.ifDefined)(i)} cx=${n.cx} cy=${n.cy} r=${n.r} fill=${n.fill} stroke=${(0,v.ifDefined)(n.stroke)} opacity=${(0,v.ifDefined)(n.opacity)}>${r}</circle>`;case"text":return b.svg`<text data-skdx-part=${n.part} data-skdx-i=${(0,v.ifDefined)(i)} x=${n.x} y=${n.y} text-anchor=${(0,v.ifDefined)(n.anchor)} dominant-baseline=${(0,v.ifDefined)(n.baseline)} fill=${(0,v.ifDefined)(n.fill)} font-weight=${(0,v.ifDefined)(n.weight)} pointer-events=${(0,v.ifDefined)(i===void 0?"none":void 0)} transform=${(0,v.ifDefined)(n.rotate?`rotate(${n.rotate} ${n.x} ${n.y})`:void 0)}>${n.text}</text>`}})}`;var A=class extends g{constructor(){super(...arguments);this.data=[];this.breadcrumbs=!1;this.labels=!0}render(){let{data:t,orientation:r,rootId:i,breadcrumbs:o,maxDepth:s,sort:a,labels:l,padding:c,colorScale:u}=this;return this.root(bt({...this.sized(),data:t,orientation:r,rootId:i,breadcrumbs:o,maxDepth:s,sort:a,labels:l,padding:c,colorScale:u}),"icicle",this.label??"Icicle chart")}};d([(0,P.property)({attribute:!1})],A.prototype,"data",2),d([(0,P.property)()],A.prototype,"orientation",2),d([(0,P.property)({attribute:!1})],A.prototype,"rootId",2),d([(0,P.property)({type:Boolean,reflect:!0})],A.prototype,"breadcrumbs",2),d([(0,P.property)({type:Number,attribute:"max-depth"})],A.prototype,"maxDepth",2),d([(0,P.property)()],A.prototype,"sort",2),d([(0,P.property)({type:Boolean,attribute:"no-labels",converter:gt})],A.prototype,"labels",2),d([(0,P.property)({type:Number})],A.prototype,"padding",2),d([(0,P.property)({attribute:!1})],A.prototype,"colorScale",2),A=d([(0,P.customElement)("skdx-icicle-chart")],A);0&&(module.exports={SkdxIcicleChart});
@@ -0,0 +1,2 @@
1
+ import 'lit';
2
+ export { ar as SkdxIcicleChart } from './index-oF5ss8v9.cjs';
@@ -0,0 +1,2 @@
1
+ import 'lit';
2
+ export { ar as SkdxIcicleChart } from './index-oF5ss8v9.js';