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