@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/histogram.js CHANGED
@@ -1,62 +1,62 @@
1
- var ti=Object.defineProperty;var ni=Object.getOwnPropertyDescriptor;var g=(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 Ei,property as ne}from"lit/decorators.js";var nr=e=>Number(e.toPrecision(12)),ri,rr=e=>(ri??(ri=new Intl.NumberFormat)).format(nr(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 ue(e){if(e===void 0)return rr;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(nr(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 nt(e,n){if(typeof e=="string")return e;let t=e instanceof Date?e.getTime():e;return n?ue(n)(t):e instanceof Date?new Intl.DateTimeFormat().format(e):rr(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 Ie([e,n],[t,r]){let i=n-e;return o=>i===0?t:t+(o-e)/i*(r-t)}function ve(e,n,t=5){if(e===n)return[e];let r=(n-e)/Math.max(1,t),i=10**Math.floor(Math.log10(r)),o=r/i,s=(o<1.5?1:o<3.5?2:o<7.5?5:10)*i,l=Math.floor(e/s)*s,c=Math.ceil(n/s)*s,d=[];for(let u=l;u<=c+s/2;u+=s)d.push(or(u));return d}function ir(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 or=e=>Number(e.toPrecision(12)),p=e=>Number(e.toFixed(2)),C=e=>typeof e=="number"&&Number.isFinite(e),oe=e=>e.filter(C);function fe(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 Me(e,n="linear"){if(e.length===0)return"";let t=e[0];if(n==="step"||n==="stepBefore"||n==="stepAfter"){let d=`M${t.x} ${t.y}`;for(let u=1;u<e.length;u++){let h=e[u-1],b=e[u];n==="stepAfter"?d+=`H${b.x}V${b.y}`:n==="stepBefore"?d+=`V${b.y}H${b.x}`:d+=`H${p((h.x+b.x)/2)}V${b.y}H${b.x}`}return d}if(n==="linear"||e.length<3)return`M${e.map(d=>`${d.x} ${d.y}`).join("L")}`;let r=e.length,i=e.slice(1).map((d,u)=>d.x-e[u].x),o=e.slice(1).map((d,u)=>d.y-e[u].y),s=i.map((d,u)=>d===0?0:o[u]/d),l=[s[0]];for(let d=1;d<r-1;d++){let u=s[d-1],h=s[d];l.push(u*h<=0?0:(u+h)/2)}l.push(s[r-2]);for(let d=0;d<r-1;d++){let u=s[d];if(u===0){l[d]=0,l[d+1]=0;continue}let h=l[d]/u,b=l[d+1]/u,M=Math.hypot(h,b);M>3&&(l[d]=3*h*u/M,l[d+1]=3*b*u/M)}let c=`M${t.x} ${t.y}`;for(let d=0;d<r-1;d++){let u=e[d],h=e[d+1],b=i[d]/3;c+=`C${p(u.x+b)} ${p(u.y+b*l[d])} ${p(h.x-b)} ${p(h.y-b*l[d+1])} ${h.x} ${h.y}`}return c}var Fe=1e3,Ge=60*Fe,_e=60*Ge,Ee=24*_e,oi=[Fe,5*Fe,15*Fe,30*Fe,Ge,5*Ge,15*Ge,30*Ge,_e,3*_e,6*_e,12*_e,Ee,2*Ee,7*Ee,14*Ee];function sr(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*Ee),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 ar(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(or(l*10**s));return o.filter(s=>s>=e/1.0001&&s<=n*1.0001)}function Ae(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??fe(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 Te(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 oe(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 lr=(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 Bt=["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)`,Pt=(e="neutral")=>e==="neutral"?R.label:e==="primary"?"var(--skdx-color-text-accent)":`var(--skdx-color-text-${e})`,cr=(e,n)=>n??Bt[e%Bt.length];var re={top:16,right:16,bottom:32,left:48};function dr(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 je(e){let n=e.legend;if(n)return n===!0?{}:n.enabled===!1?void 0:n}function Nt(e){let n=e.tooltip;return n===void 0||n===!0?{enabled:!0}:n===!1?{enabled:!1}:{...n,enabled:n.enabled??!0}}var ur=e=>e.crosshair===!0||Nt(e).trigger==="axis",it=20,di=120,hr=e=>{let n=je(e);return n&&(n.position==="left"||n.position==="right")?n.width??di:0},ot=(e,n=600,t=300)=>({width:(e.width??n)-hr(e),height:(e.height??t)-(je(e)?.position==="bottom"?it:0)}),fr=(e,n,t)=>{let r=je(e);return!r||!(r.position===void 0||r.position==="top")?0:(n?Math.max(1,br(n,t??ot(e).width,r)):1)*it},te=6.5;function Ft(e,n){let t=Array.from(e),r=Math.max(0,Math.floor(n/te));return t.length<=r?e:r===0?"":`${t.slice(0,r-1).join("")}\u2026`}var mr=(e,n,t)=>t??(e.palette&&e.palette.length>0?e.palette[n%e.palette.length]:cr(n)),pr=(e,n)=>e.hiddenSeries?.includes(n)??!1;function Dt(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,M=i,k=(m,x,y,f)=>{let w=(x?18:4)+m.length*te;b>o&&(s||b+w>n-8)&&(b=o,M+=it),x&&l.push({kind:"rect",part:"legend-swatch",x:b,y:M-5,width:10,height:10,fill:x,opacity:f?.3:void 0,item:y}),l.push({kind:"text",part:"legend-label",x:b+(x?14:0),y:M,text:m,baseline:"middle",fill:f?R.grid:R.label,item:y}),b+=w+12};for(let m of d){let x=t.includes(m.name),y=h?{label:m.name,series:m.name,legend:!0}:void 0;k(r.formatter?.(m.name)??m.name,m.color,y,x)}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*te)),s=n-8-o;for(let l of i)r.push({...l,x:l.x+s})}return r}var br=(e,n,t={})=>new Set(Dt(e,n,[],t).flatMap(r=>r.kind==="text"?[r.y]:[])).size;function Gt(e,n,t,r=[]){let i=je(e),o=i&&e.direction==="rtl"&&i.align===void 0?{...i,align:"end"}:i,s=Nt(e),l=o?.position==="bottom",c=hr(e),d=e.hiddenSeries??[],u=o?c?Dt(r,1/0,d,o,10,(o.position==="right"?n:0)+8,!0):Dt(r,n,d,o,l?t+10:10):[],h=l?br(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 _t(e){let n=e.legendOffset;if(!n)return e;let t=[...lr(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)/te)),c=s.flatMap(x=>{let y=[],f=Array.from(x);for(;f.length>l;){let w=f.slice(0,l+1).lastIndexOf(" ");w<1&&(w=l),y.push(f.slice(0,w).join("")),f=f.slice(w),f[0]===" "&&f.shift()}return y.push(f.join("")),y}),d=Math.max(1,Math.floor((i-6)/16)),u=c.slice(0,d);c.length>d&&(u[d-1]=Ft(`${u[d-1]}\u2026`,r-12));let h=Math.min(r,Math.max(0,...u.map(x=>Array.from(x).length))*te+12),b=Math.min(i,6+u.length*16),M=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,M.x)),m=Math.max(0,Math.min(i-b,M.y));return[{kind:"rect",part:"tooltip",title:s.join(`
2
- `),x:p(k),y:p(m),width:p(h),height:b,fill:"var(--skdx-color-surface-raised)",stroke:R.axis,rx:8},...u.map((x,y)=>({kind:"text",part:"tooltip-label",x:p(k+6),y:p(m+11+y*16),text:x,baseline:"middle",fill:"var(--skdx-color-text-default)",weight:u.length>1&&y===0?"bold":void 0}))]}function xr([e,n],t,r=!1,i){let o=typeof r=="boolean"?{scale:r?"log":"linear"}:r,s=ue(o.format??i),l=o.min??e,c=o.max??n;o.reversed&&(t=[t[1],t[0]]);let d={id:o.id,position:o.position,options:o};if(o.scale==="sqrt"){let m=O=>Math.sign(O)*Math.sqrt(Math.abs(O)),x=o.nice===!1?[l,c]:ve(l,c,o.ticks),y=o.min??x[0],f=o.max??x[x.length-1],w=Ie([m(y),m(f)],t),I=O=>w(m(O)),S=ve(y,f,o.ticks).filter(O=>O>=y-1e-9&&O<=f+1e-9);return{...d,scale:I,domain:[y,f],format:s,ticks:(S.length>=2?S:[y,f]).map(O=>({pos:p(I(O)),label:s(O)})),zero:p(I(Math.min(Math.max(0,y),f)))}}if(o.scale==="log"){let m=Math.max(l,Number.EPSILON),x=Math.max(c,m),y=ar(m,x),f=[Math.log10(m),Math.log10(x)],w=Ie(f,t),I=S=>w(Math.log10(Math.max(S,Number.EPSILON)));return{...d,scale:I,domain:f,format:s,ticks:y.map(S=>({pos:p(I(S)),label:s(S)})),zero:p(t[0])}}let u=ve(l,c,o.ticks),h=[o.min??(o.nice===!1?l:u[0]),o.max??(o.nice===!1?c:u[u.length-1])],b=Ie(h,t),M=u.filter(m=>m>=h[0]-1e-9&&m<=h[1]+1e-9),k=(M.length>=2?M:[h[0],h[1]]).map(m=>({pos:p(b(m)),label:s(m)}));return{...d,scale:b,domain:h,format:s,ticks:k,zero:p(b(Math.min(Math.max(0,h[0]),h[1])))}}var gr=([e,n],t)=>Math.max(re.left,ve(e,n).reduce((r,i)=>Math.max(r,t(i).length),0)*te+14),yr=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)*te+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 Et=(e,n,t,r)=>`${e}, ${n}: ${r(t)}`;function lt(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:p(o/2),y:p(s/2),text:l,anchor:"middle",baseline:"middle",fill:i==="error"?"var(--skdx-color-text-danger)":R.label}),{...Gt(e,o,s),shapes:c,tooltip:!1}}var jt=(e,n,t)=>{let r=n.length*te/2;return e+r>t?"end":e-r<0?"start":"middle"};function Wt(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,m)=>m?{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,m,x,y)=>h?q(k,m,x,{part:y,anchor:h<0?"end":"start",baseline:"middle",rotate:h}):hi(k,m,x,e.width,{part:y,anchor:jt(k,x,e.width)}),M=(k,m,x,y,f)=>{for(let w of k)c.push(m==="x"?{kind:"line",part:"tick",x1:w.pos,x2:w.pos,y1:x,y2:p(x+y*f),stroke:R.axis}:{kind:"line",part:"tick",x1:x,x2:p(x+y*f),y1:w.pos,y2:w.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 m of i)c.push(u(m,!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 m of k){let x=m.position==="top"||m.position==="right",y=p(x?t.y-m.offset:l+m.offset),f=x||m.offset>0;m.showLine&&f&&c.push({kind:"line",part:"axis",x1:t.x,x2:s,y1:y,y2:y,stroke:R.axis}),m.showTicks&&M(m.ticks,"x",y,x?-1:1,m.tickSize??4);let w=p(x?y-8:y+20);for(let I of m.ticks)c.push(x?q(I.pos,w,I.label,{part:"x-label-top",anchor:jt(I.pos,I.label,e.width)}):b(I.pos,w,I.label,"x-label"));m.label&&c.push(f?q(4,w,m.label,{part:"axis-title",anchor:"start",baseline:x?void 0:"middle"}):q(4,t.y-6,m.label,{part:"axis-title",anchor:"start"}))}n.x?.showLine&&c.push({kind:"line",part:"axis",x1:n.rtl?s:t.x,x2:n.rtl?s:t.x,y1:t.y,y2:l,stroke:R.axis}),n.x?.showTicks&&M(r,"y",n.rtl?s:t.x,n.rtl?1:-1,n.x.tickSize??4);for(let m of r)c.push(n.rtl?q(s+8,m.pos,m.label,{part:"y-label",anchor:"start",baseline:"middle"}):q(t.x-8,m.pos,m.label,{part:"y-label",anchor:"end",baseline:"middle"}))}else{if(d)for(let m of i)c.push(u(m,!1));n.y?.showLine!==!1&&c.push({kind:"line",part:"axis",x1:t.x,x2:s,y1:o,y2:o,stroke: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 m of k){let x=m.position==="left",y=x?t.x-m.offset:s+m.offset,f=x?"y-label":"y-label-right";m.showLine&&c.push({kind:"line",part:"axis",x1:p(y),x2:p(y),y1:t.y,y2:l,stroke:R.axis}),m.showTicks&&M(m.ticks,"y",p(y),x?-1:1,m.tickSize??4);for(let w of m.ticks)c.push(q(p(x?y-8:y+8),w.pos,w.label,{part:f,anchor:x?"end":"start",baseline:"middle"}));m.label&&c.push(q(p(x?m.offset===0?4:Math.max(4,y-40):m.offset===0?e.width-4:Math.min(e.width-4,y+40)),t.y-6,m.label,{part:"axis-title",anchor:x?"start":"end"}))}n.x?.showTicks&&M(r,"x",l,1,n.x.tickSize??4);for(let m of r)c.push(b(m.pos,l+(h?12:20),m.label,"x-label"))}return n.xLabel&&c.push(q(p(t.x+t.width/2),e.height-4,n.xLabel,{part:"axis-title",anchor:"middle"})),n.horizontal&&n.rightLabel&&c.push(q(e.width-4,t.y-6,n.rightLabel,{part:"axis-title",anchor:"end"})),c}var q=(e,n,t,r={})=>({kind:"text",part:"label",x:e,y:n,text:t,fill: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=Ft(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*te+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 We=(e,n,t,r,i,o)=>({kind:"circle",part:"point",cx:e,cy:n,r:t,fill:r,title:i,item:o});function Zt(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??Pt(c.variant),h={part:"reference-label",fill:u},b=n.horizontal===!0;if("y"in c){let M=p(n.y(c.y,c.axis??"left"));if(b){let k=s(M);t.push(...Mr(k,r.y,o,d,c.label,h))}else{let k=l(M);t.push(...vr(r.x,i,k,d,c.label,h))}}else if("x"in c){let M=n.x(c.x);if(M===void 0)continue;b?t.push(...vr(r.x,i,l(p(M)),d,c.label,h)):t.push(...Mr(s(p(M)),r.y,o,d,c.label,h))}else if("y1"in c){let M=p(n.y(c.y1,c.axis??"left")),k=p(n.y(c.y2,c.axis??"left"));b?t.push(...Sr(s(Math.min(M,k)),s(Math.max(M,k)),r,d,c.label,u)):t.push(...wr(l(Math.min(M,k)),l(Math.max(M,k)),r,d,c.label,u))}else{let M=n.x(c.x1),k=n.x(c.x2);if(M===void 0||k===void 0)continue;let m=p(Math.min(M,k)),x=p(Math.max(M,k));b?t.push(...wr(l(m),l(x),r,d,c.label,u)):t.push(...Sr(s(m),s(x),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 Mr(e,n,t,r,i,o){let s={kind:"line",part:"reference",x1:e,x2:e,y1:n,y2:t,stroke:r,dash:"6 4",strokeWidth:1.5,title:i};return i?[s,q(e+4,n+10,i,{...o,anchor:"start"})]:[s]}function wr(e,n,t,r,i,o){let s={kind:"rect",part:"reference-area",x:t.x,y:e,width:t.width,height:p(Math.max(0,n-e)),fill:r,opacity:.12,title:i};return i?[s,q(t.x+t.width-4,e+12,i,{part:"reference-label",fill:o,anchor:"end"})]:[s]}function Sr(e,n,t,r,i,o){let s={kind:"rect",part:"reference-area",x:e,y:t.y,width:p(Math.max(0,n-e)),height:t.height,fill:r,opacity:.12,title:i};return i?[s,q(e+4,t.y+12,i,{part:"reference-label",fill:o,anchor:"start"})]:[s]}function $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??Pt(s.variant),d=(k,m,x)=>{let y=n.x(k);if(y===void 0)return;let f=n.y(m,x??"left");return n.horizontal?{x:p(f),y:p(y)}:{x:p(y),y:p(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:m,...x}=s;t.push(...Zt([x],n));continue}if(s.type==="rect"){let k=d(s.x1,s.y1,s.axis),m=d(s.x2,s.y2,s.axis);if(!k||!m)continue;let x=Math.max(r.x,Math.min(k.x,m.x)),y=Math.max(r.y,Math.min(k.y,m.y)),f=s.label??"";t.push({kind:"rect",part:"annotation-rect",x:p(x),y:p(y),width:p(Math.max(0,Math.min(i,Math.max(k.x,m.x))-x)),height:p(Math.max(0,Math.min(o,Math.max(k.y,m.y))-y)),fill:l,opacity:.12,stroke:l,title:f||void 0,item:f?h(f):void 0}),s.label&&t.push(q(p(x+4),p(y+12),s.label,{part:"annotation-label",fill:c}));continue}let b=d(s.x,s.y,s.axis);if(!b)continue;if(s.type==="text"){t.push(q(b.x,b.y,s.text,{part:"annotation-text",fill:c,anchor:"middle",baseline:"middle",title:s.label}));continue}let M=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:M,item:h(M)}),s.type==="callout"&&s.label){let[k,m]=s.offset??[16,-16],x=p(Math.max(r.x,Math.min(i,b.x+k))),y=p(Math.max(r.y,Math.min(o,b.y+m)));t.push({kind:"line",part:"annotation-leader",x1:b.x,y1:b.y,x2:x,y2:y,stroke:l},q(x,y,s.label,{part:"annotation-label",fill:c,anchor:k>=0?"start":"end",baseline:"middle"}))}}return t}var Ht=2e3;function fi(e){if(e!=="none")return e===void 0||e==="auto"?{strategy:"lttb",threshold:Ht}:typeof e=="string"?{strategy:e,threshold:Ht}:{strategy:e.strategy,threshold:e.threshold??Ht}}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 w=c;w<d;w++){let I=e[w];C(I)&&(u+=w,h+=I,b++)}u=b?u/b:(c+d)/2,h=b?h/b:0;let M=Math.floor(l*o)+1,k=Math.min(t-1,Math.floor((l+1)*o)+1),m=e[s],x=C(m)?m:0,y=-1,f=-1;for(let w=M;w<k;w++){let I=e[w];if(!C(I)){i.push(w);continue}let S=Math.abs((s-u)*(I-x)-(s-w)*(h-x));S>f&&(f=S,y=w)}y<0&&(y=M),r.push(y),s=y}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 M=l;M<c;M++){let k=e[M];if(!C(k)){i.push(M);continue}h<0&&(h=M),b=M,(d<0||k<e[d])&&(d=M),(u<0||k>e[u])&&(u=M)}for(let M of[h,d,u,b])M>=0&&i.push(M)}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{...We(e,n,t,i,o,s),part:l};let c=r==="square"?`M${p(e-t)} ${p(n-t)}h${p(2*t)}v${p(2*t)}h${p(-2*t)}Z`:r==="diamond"?`M${p(e)} ${p(n-t*1.3)}L${p(e+t*1.3)} ${p(n)}L${p(e)} ${p(n+t*1.3)}L${p(e-t*1.3)} ${p(n)}Z`:`M${p(e)} ${p(n-t*1.2)}L${p(e+t*1.15)} ${p(n+t*.9)}L${p(e-t*1.15)} ${p(n+t*.9)}Z`;return{kind:"path",part:l,d:c,fill:i,title:o,item:s}}var 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 Mi(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 wi=(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=Ae(t,n);return{edges:r,counts:Te(t,r).map(i=>i.count)}}function Ut(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=Mi(t,r.order);break;case"filter":t=wi(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,dt=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"||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 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(dt))?.id:e.find(r=>r.id===n)?.id}var ct=e=>e.kind==="bar"||e.kind==="range"&&e.style==="bar";function Lr(e,n){let t=ue(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=>oe(a.data).length===0&&oe(a.high).length===0),h=lt(e,u);if(h)return{...h,issues:o};let b=e.xAxis?.type??"category",M=b!=="category"&&i.length>0&&i.every(a=>typeof a!="string"||b==="time"&&C(he(a))),k=M?i.map(he):[],[m,x]=fe(k),y=e.xAxis?.format??(b==="time"?{style:x-m<2*864e5?"time":"date"}:void 0),f=Array.from({length:d},(a,v)=>{let $=i[v];return $===void 0?String(v+1):nt($,y)}),w=Oi(e.zoom,d),I=Array.from({length:w.end-w.start},(a,v)=>w.start+v),S=e.orientation==="horizontal",F=r.map(a=>({...a,hidden:a.hidden||S&&!ct(a)})).filter(a=>!a.hidden),E=F.some(a=>!ct(a))?Cr(F.filter(a=>!ct(a)).map(a=>I.map(v=>(a.kind==="range"?a.high[v]:a.data[v])??null)),I.length,e.sampling):void 0,B=E?E.map(a=>I[a]):I,Y=e.stacked==="percent"||e.stackOffset==="expand",J=e.stackOffset??"zero",ae=new Map,pe=new Map,gt=new Map;for(let a of F)a.stack!==void 0&&a.kind!=="range"&&gt.set(a.stack,[...gt.get(a.stack)??[],a]);for(let a of gt.values()){let v=new Array(d).fill(c),$=new Array(d).fill(c),G=new Array(d).fill(0);if(Y)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=Y?z>0?N/z:0:N,j=A>=0?v:$;L.push(j[P]),j[P]=j[P]+A,_.push(j[P])}ae.set(D,L),pe.set(D,_)}if(J==="silhouette"||J==="wiggle"){let D=new Array(d).fill(0);if(J==="silhouette")for(let L=0;L<d;L++)D[L]=-(v[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 j=a[A],Z=j.data[_],K=j.data[_-1],ee=_>0&&C(Z)&&C(K)?Z-K:0;N+=(P-A-.5)*ee}let z=v[_]-c;L=_===0?-z/2:L-(z>0?N/Math.max(1,P):0),D[_]=L}}for(let L of a){let _=ae.get(L),P=pe.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 On=a=>a.kind==="range"?{from:a.low,to:a.high}:{from:ae.get(a)??new Array(d).fill(c),to:pe.get(a)??a.data},zn=a=>{let v=[],$=!1;for(let L of F){if(L.axis!==a)continue;let{from:_,to:P}=On(L);for(let N of B){let z=P[N];if(C(z)&&v.push(z),L.kind==="range"||L.stack!==void 0){let A=_[N];C(A)&&v.push(A)}}if(L.errors)for(let N of B){let z=Or(L.data[N],L.errors[N]);z&&v.push(z[0],z[1])}(L.kind==="bar"||L.kind==="area")&&J==="zero"&&($=!0)}let[G,D]=fe(v);return $?[Math.min(c,G),Math.max(c,D)]:[G,D]},{width:yt,height:Ln}=ot(e),Zr=e.brush?Ar+Tr:0,Rn=B.reduce((a,v)=>Math.max(a,f[v].length),0)*te,Vn=Y?{style:"percent"}:void 0,Hr=a=>{if(a.scale==="log")return re.left;let[v,$]=zn(a.id),G=ue(a.format??Vn??e.format);return gr([a.min??v,a.max??$],G)+(a.showTicks?a.tickSize??4:0)},kt=a=>S?dt(a)?"top":"bottom":dt(a)!==l?"right":"left",Bn=a=>S?24+(a.showTicks?a.tickSize??4:0):Hr(a),Ur=new Set(F.map(a=>a.axis)),vt=s.filter(a=>Ur.has(a.id)||s.length>1),Pn=new Map,we={left:0,right:0,top:0,bottom:0};for(let a of vt){let v=kt(a);Pn.set(a.id,we[v]),we[v]+=Bn(a)}let Dn=vt.find(a=>kt(a)==="bottom"),Nn=r.map(a=>({name:a.name,color:a.color})),Kr={top:re.top+fr(e,Nn,yt)+(s.some(a=>a.label)?12:0)+we.top,right:S?l?Math.max(re.left,Rn+16):re.right:Math.max(re.right,we.right),bottom:re.bottom+Zr+(e.xAxis?.label?14:0)+(e.xAxis?.tickRotation?24:0)+we.bottom-(Dn?Bn(Dn):0),left:S?l?re.right:Math.max(re.left,Rn+16):Math.max(re.left,we.left)},U=dr(yt,Ln,Kr),qr=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],Mt=new Map(s.map(a=>[a.id,{...xr(zn(a.id),qr,{format:Vn,...a},e.format),position:kt(a),offset:Pn.get(a.id)??0}])),Gn=s[0]?.id,Ke=Mt.get(Gn),wt=a=>Mt.get(zr(s,a)??Gn)??Ke,ce=(a,v)=>wt(v).scale(a),_n=a=>p(a.scale(Math.min(Math.max(c,Math.min(...a.domain)),Math.max(...a.domain)))),qe=ir(B.length,Fn,e.barGap),St=B.map(a=>k[a]),$t=[...St].sort((a,v)=>a-v),Se=1/0;for(let a=1;a<$t.length;a++)Se=Math.min(Se,$t[a]-$t[a-1]);let[$e,Re]=fe(St),de=Se===1/0?Math.max(1,Math.abs(Re)*.05||1):Se/2,Ve=Ie([$e-de,Re+de],Fn),Ye=a=>p(M?Ve(St[a]):qe.center(a)),En=M?Math.abs(Ve($e+(Se===1/0?de:Se))-Ve($e))*.8:qe.bandwidth,jn=a=>M?Ye(a)-En/2:qe.start(a),Yr=M?(b==="time"?sr($e-de,Re+de):ve($e-de,Re+de)).filter(a=>a>=$e-de&&a<=Re+de).map(a=>({pos:p(Ve(a)),label:nt(a,y)})):at(B.map((a,v)=>({pos:Ye(v),label:f[a]})),S?1/0:U.width/Math.max(.2,Math.abs(Math.cos((e.xAxis?.tickRotation??0)*Math.PI/180)))),Ct={...Gt(e,yt,Ln,Nn),plot:U,xTicks:Yr,yTicks:S?at(Ke.ticks,U.width):Ke.ticks,baseline:_n(Ke)},Xr=s[0],Wn=Wt(Ct,{horizontal:S,rtl:l,axes:vt.map(a=>{let v=Mt.get(a.id);return{ticks:S?at(v.ticks,U.width):v.ticks,position:v.position,offset:v.offset??0,label:a.label,showLine:a.showLine,showTicks:a.showTicks,tickSize:a.tickSize}}),xLabel:e.xAxis?.label,grid:yr(Xr),categoryGrid:e.xAxis?.grid===!0,x:e.xAxis}),Jr=a=>{if(typeof a=="number"&&i.every($=>typeof $=="string"))return a;let v=typeof a=="string"?a:he(a);for(let $=0;$<d;$++){let G=i[$];if(G!==void 0&&(typeof v=="string"?G===v||f[$]===v:he(G)===v))return $}},Zn={plot:U,horizontal:S,x:a=>{if(M&&(typeof a!="string"||C(he(a))))return Ve(he(a));let v=Jr(a),$=v===void 0?-1:B.indexOf(v);return $<0?void 0:qe.center($)},y:(a,v)=>ce(a,v)},Hn=Zt(e.references,Zn);Wn.push(...Hn.filter(a=>a.part!=="reference-label"));let Qr=kr(Hn.filter(a=>a.part==="reference-label")),It=[],At=new Map;for(let a of F){if(!ct(a))continue;let v=a.stack??a,$=It.indexOf(v);$<0&&($=It.push(v)-1),At.set(a,$)}let Xe=En/Math.max(1,It.length),be=Math.min(Xe,e.barWidth??1/0),Un=(Xe-be)/2,Tt=[],Je=[],Ot=[],zt=[],Lt=[],Kn=[],Qe=[],et=a=>wt(a.axis).format,Rt=Math.max(0,e.minBarSize??0),ei=(a,v,$)=>{let G=Math.abs(v-a);if(G>=Rt)return[Math.min(a,v),G];let L=a+(S?$?1:-1:$?-1:1)*Rt;return[Math.min(a,L),Rt]},Be=(a,v,$,G)=>({label:G,series:a.name,seriesId:a.id??a.name,category:f[v],index:v,value:$}),qn=(a,v,$,G)=>{let D=Or(G,a.errors?.[v]);if(!D)return;let L=p(ce(D[0],a.axis)),_=p(ce(D[1],a.axis)),P=4,N="var(--skdx-color-text-default)",z=`${a.name}, ${f[v]}: ${et(a)(D[0])} \u2013 ${et(a)(D[1])}`;Kn.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:p($-P),y2:p($+P),stroke:N}:{kind:"line",part:"error-cap",x1:p($-P),x2:p($+P),y1:L,y2:L,stroke:N},S?{kind:"line",part:"error-cap",x1:_,x2:_,y1:p($-P),y2:p($+P),stroke:N}:{kind:"line",part:"error-cap",x1:p($-P),x2:p($+P),y1:_,y2:_,stroke:N})};for(let a of F){let{from:v,to:$}=On(a),G=et(a),D=B.length<=Ai;if(a.kind==="bar"){let z="";B.forEach((A,j)=>{let Z=a.data[A],K=v[A],ee=$[A];if(!C(Z)||!C(K)||!C(ee))return;let Ce=ce(K,a.axis),ke=ce(ee,a.axis),[Pe,De]=ei(Ce,ke,ee>=K),Ne=jn(j)+At.get(a)*Xe+Un,Xn=p(S?Pe:Ne),Jn=p(S?Ne:Pe),Vt=p(S?De:be),Qn=p(S?be:De);if(!D){z+=`M${Xn} ${Jn}h${Vt}v${Qn}h${-Vt}Z`;return}let er=Et(a.name,f[A],Y?ee-K:Z,G);if(Je.push({kind:"rect",part:"bar",x:Xn,y:Jn,width:Vt,height:Qn,fill:a.color,rx:e.radius,title:er,item:Be(a,A,Z,er)}),qn(a,A,p(Ne+be/2),Z),e.labels){let tr=G(Y?ee-K:Z);Lt.push(S?q(p(Math.max(Ce,ke)+4),p(Ne+be/2),tr,{baseline:"middle"}):q(p(Ne+be/2),p(Math.min(Ce,ke)-4),tr,{anchor:"middle"}))}}),z&&Je.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 j=v[z],Z=$[z];if(!C(j)||!C(Z))return;let K=ce(Math.min(j,Z),a.axis),ee=ce(Math.max(j,Z),a.axis),Ce=jn(A)+At.get(a)*Xe+Un,ke=`${a.name}, ${f[z]}: ${G(Math.min(j,Z))} \u2013 ${G(Math.max(j,Z))}`,Pe=Be(a,z,Z,ke),De=Math.max(1,Math.abs(ee-K));Je.push(S?{kind:"rect",part:"range",x:p(Math.min(K,ee)),y:p(Ce),width:p(De),height:p(be),fill:a.color,rx:e.radius,title:D?ke:void 0,item:Pe}:{kind:"rect",part:"range",x:p(Ce),y:p(Math.min(K,ee)),width:p(be),height:p(De),fill:a.color,rx:e.radius,title:D?ke:void 0,item:Pe})});continue}let L=e.nulls==="connect"||e.nulls===void 0&&e.connectNulls,_=[],P=[];B.forEach((z,A)=>{let j=v[z],Z=$[z];if(!C(Z)||!C(j)){!L&&P.length&&(_.push(P),P=[]);return}P.push({x:Ye(A),y:p(ce(Z,a.axis)),y0:p(ce(j,a.axis)),i:z})}),P.length&&_.push(P);let N=a.markers??B.length<=Ii;for(let z of _){let A=Me(z,a.curve);if(a.kind==="range"&&a.style==="line"){Ot.push({kind:"path",part:"range-high",d:A,stroke:a.color,strokeWidth:2,strokeLinejoin:"round"},{kind:"path",part:"range-low",d:Me(z.map(j=>({x:j.x,y:j.y0})),a.curve),stroke:a.color,strokeWidth:2,strokeLinejoin:"round",dash:"4 3"});continue}if(a.kind==="range"){let j=Me([...z].reverse().map(Z=>({x:Z.x,y:Z.y0})),a.curve);Tt.push({kind:"path",part:"range",d:`${A}L${j.slice(1)}Z`,fill:a.color,fillOpacity:.2,title:a.name});continue}if(a.kind==="area"){let j=_n(wt(a.axis)),Z=a.stack!==void 0?Me([...z].reverse().map(ee=>({x:ee.x,y:ee.y0})),a.curve).slice(1):`${z[z.length-1]?.x} ${j}L${z[0]?.x} ${j}`,K=`skdx-g-${a.index}`;a.gradient&&!Qe.some(ee=>ee.id===K)&&Qe.push({id:K,vertical:!0,stops:[{offset:0,color:a.color,opacity:a.fillOpacity},{offset:1,color:a.color,opacity:0}]}),Tt.push({kind:"path",part:"area",d:`${A}L${Z}Z`,fill:a.gradient?`url(#${K})`:a.color,fillOpacity:a.gradient?void 0:a.fillOpacity})}Ot.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 j=a.low[A.i],Z=a.high[A.i],K=`${a.name}, ${f[A.i]}: ${G(Math.min(j,Z))} \u2013 ${G(Math.max(j,Z))}`;zt.push({...We(A.x,A.y,.01,a.color,K,Be(a,A.i,Z,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 j=a.data[A.i],Z=Y?$[A.i]-v[A.i]:j,K=Et(a.name,f[A.i],Z,G);(N||D)&&zt.push(N&&a.symbol!=="circle"?Ir(A.x,A.y,a.markerSize,a.symbol,a.color,D?K:void 0,Be(a,A.i,j,K),"point"):{...We(A.x,A.y,N?a.markerSize:.01,a.color,D?K:void 0,Be(a,A.i,j,K)),part:N?"point":"anchor"}),D&&qn(a,A.i,S?A.y:A.x,$[A.i]),e.labels&&Lt.push(q(A.x,A.y-8,G(Z),{anchor:"middle"}))}}let Yn={plot:U,xs:S?[]:B.map((a,v)=>Ye(v)),rows:B.map(a=>[f[a],...F.map(v=>{let $=et(v);if(v.kind==="range"){let D=v.low[a],L=v.high[a];return`${v.name}: ${C(D)&&C(L)?`${$(D)} \u2013 ${$(L)}`:"\u2014"}`}let G=v.data[a];return`${v.name}: ${C(G)?$(Y?(pe.get(v)?.[a]??0)-(ae.get(v)?.[a]??0):G):"\u2014"}`})]),count:d,zoom:w,crosshair:ur(e)},tt=[];if(e.brush&&!S){let a={x:U.x,y:U.y+U.height+Tr,width:U.width,height:Ar},v=F.find(G=>G.kind!=="range"),$={x:p(a.x+w.start/Math.max(1,d)*a.width),y:a.y,width:p((w.end-w.start)/Math.max(1,d)*a.width),height:a.height};if(tt.push({kind:"rect",part:"brush",x:a.x,y:a.y,width:a.width,height:a.height,fill:"var(--skdx-color-surface-sunken)",stroke:R.grid}),v){let G=oe(v.data),[D,L]=fe(G),_=d>1?a.width/(d-1):0,P=v.data.flatMap((z,A)=>C(z)?[{x:p(a.x+A*_),y:p(a.y+a.height-(L===D?.5:(z-D)/(L-D))*(a.height-4)-2)}]:[]),N=Me(P);P.length>1&&tt.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:v.color,fillOpacity:.3})}tt.push({kind:"rect",part:"brush-window",...$,fill:"var(--skdx-color-primary-500)",opacity:.15,stroke:R.axis},{kind:"rect",part:"brush-handle",x:p($.x-3),y:a.y+8,width:6,height:a.height-16,fill:R.axis,rx:8},{kind:"rect",part:"brush-handle",x:p($.x+$.width-3),y:a.y+8,width:6,height:a.height-16,fill:R.axis,rx:8}),Yn.brush={box:a,window:$}}return{...Ct,shapes:[...Wn,...Tt,...Je,...Ot,...Kn,...zt,...Lt,...Qr,...$r(e.annotations,Zn),...tt,...Ct.shapes],hit:Yn,issues:o,defs:Qe.length?Qe: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,w,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:w??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:w??f})},h=e.series.map((f,w)=>{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 E=Y=>e.nulls==="zero"?Y.map(J=>C(J)?J:0):Y,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:mr(e,w,f.color),axis:B??o[0]?.id,hidden:pr(e,f.name),index:w,kind:I,data:f.type==="range"?[]:E(Ut(Ut(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))),M=f=>{let w=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:w(S.data),low:w(S.low),high:w(S.high)}))},k=(f,w)=>{let I=(w!==void 0?h.find(O=>O.name===w):void 0)??h.find(O=>!O.hidden&&O.kind!=="range")??h[0];w!==void 0&&!h.some(O=>O.name===w)&&i.push({code:"unknown-series",severity:"warning",message:`sort.by names "${w}", which is not a series; sorted by the first series.`});let S=Array.from({length:b()},(O,F)=>F).sort((O,F)=>{let E=I?.data[O]??I?.high[O],B=I?.data[F]??I?.high[F],Y=C(E)?E:-1/0,J=C(B)?B:-1/0;return f==="asc"?Y-J:J-Y});M(S)},m=f=>{let w=h.flatMap(S=>oe(S.data)),I=Ae(w,f);s=I.slice(1).map((S,O)=>`${t(I[O])}\u2013${t(S)}`),h=h.map(S=>{let O=oe(S.data),F=0,E=Te(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:E}})},x=(f,w)=>{let I=Math.max(1,Math.floor(f)),S=b(),O=E=>{if(!E.length)return E;let B=[];for(let Y=0;Y<S;Y+=I){let J=oe(E.slice(Y,Y+I));B.push(J.length===0?null:w==="sum"?J.reduce((ae,pe)=>ae+pe,0):w==="mean"?J.reduce((ae,pe)=>ae+pe,0)/J.length:w==="min"?Math.min(...J):Math.max(...J))}return B};s=Array.from({length:S},(E,B)=>s[B]??String(B+1)).filter((E,B)=>B%I===0),h=h.map(E=>({...E,data:O(E.data),low:O(E.low),high:O(E.high)}))};e.transform==="histogram"?m({bins:e.bins,binWidth:e.binWidth,domain:e.binDomain}):e.transform==="cumulative"&&(h=h.map(f=>{let w=0;return{...f,data:f.data.map(I=>C(I)?w+=I:w)}}));for(let f of l)f.type==="sort"?k(f.order??"desc"):f.type==="bin"?m(f):f.type==="aggregate"&&x(f.every,f.method??"sum");typeof e.sort=="string"?k(e.sort):e.sort&&k(e.sort.order,e.sort.by);let y=e.xAxis?.domain;if(y){let f=b(),w=Array.from({length:f},(F,E)=>s[E]??String(E+1)),I=F=>{let E=typeof F=="string"?F:he(F);return w.findIndex(B=>typeof E=="string"?B===E||nt(B)===E:he(B)===E)},S=y.map(I),O=F=>F.length?S.map(E=>E<0?null:F[E]??null):F;s=[...y],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 ut(e){return e==null?[]:(Array.isArray(e)?e:[e]).map(t=>typeof t=="object"?t:{id:t})}var Kt=e=>e.id??e.name??e.series,Rr=e=>e.seriesId??e.series;function me(e,n){let t=!1;return n.id!==void 0&&(t=!0,Kt(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 xe(e){let n={},t=Kt(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 qt=(e,n)=>e.id===n.id&&e.series===n.series&&e.index===n.index&&e.category===n.category;function Yt(e,n,t){let r=ut(e),i=xe(n),o=r.some(s=>me(n,s));return t==="single"?o?[]:[i]:o?r.filter(s=>!me(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=ut(n.selected),r=n.highlighted===void 0||n.highlighted===null?[]:ut(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=>me(u,h))?!0:o.highlighted==="series"?r.some(h=>h.series!==void 0&&me(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&&me(u,{series:h})}return!0},d=e.shapes.map(u=>{let h=u.item;if(!h||h.legend)return u;if(t.some(b=>me(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 Jt(e){let n=oe(e.data),t=lt(e,n.length===0);if(t)return t;let r=Ae(n,{bins:e.bins,binWidth:e.binWidth,domain:e.domain,thresholds:e.thresholds}),i=Te(n,r),o=i.reduce((m,x)=>m+x.count,0),s=e.mode??"count",l=ue(e.xAxis?.format??e.format),c=ue(s==="percent"?{style:"percent",digits:1}:s==="density"?{style:"decimal",digits:3}:e.format),d=e.name??(s==="density"?"Density":s==="percent"?"Share":"Count"),u=m=>s==="density"?o>0&&m.x1>m.x0?m.count/(o*(m.x1-m.x0)):0:s==="percent"?o>0?m.count/o:0:m.count,h=i.map(m=>`${l(m.x0)}\u2013${l(m.x1)}`),b=Lr({...e,format:c,series:[{name:d,data:i.map(u),color:e.color}],categories:h,xAxis:e.xAxis?.label?{label:e.xAxis.label}:void 0,barGap:e.barGap??.05,transform:void 0},"bar"),M=b.shapes.map((m,x)=>{if(m.part!=="bar"||!m.item||m.item.index===void 0)return m;let y=i[m.item.index];if(!y)return m;let f=o>0?` (${Math.round(y.count/o*1e3)/10}%)`:"",w=`${h[m.item.index]??String(x)}: ${y.count}${f}${s==="count"?"":` \xB7 ${d} ${c(u(y))}`}`;return{...m,title:m.title===void 0?void 0:w,item:{...m.item,label:w}}}),k=b.hit?.rows.map((m,x)=>{let y=i[x];return y?[m[0],`${d}: ${c(u(y))}`,`Observations: ${y.count}`]:m});return{...b,shapes:M,hit:b.hit&&k?{...b.hit,rows:k}:b.hit}}var Vr="var(--skdx-radius-default, var(--skdx-radius-md, 0.5rem))";function ht(e){return["tooltip","skeleton","label-background","stage-label-background","brush-handle"].includes(e)?Vr:void 0}function Le(e,n,t,r,i){let o=e.getBoundingClientRect();return{x:o.width?(n-o.left)*r/o.width:n,y:o.height?(t-o.top)*i/o.height:t}}var Qt=(e,n,t)=>n>=e.x&&n<=e.x+e.width&&t>=e.y&&t<=e.y+e.height;function 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 Ze(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 en(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 tn(e,n,t){let r=e.hit;if(!r||!r.crosshair||r.xs.length===0||!Qt(r.plot,n,t))return[];let i=en(e,n),{rows:o}=Ze(e,n),s=e.tooltipAnchored?r.plot.y+8:t;return[i,...st(i.x1,s,o,e.width,e.height,e.tooltipPlacement)]}function nn(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 tn(e,i,t.plot.y+8)}function rn(e,n,t,r,i){if(!e.tooltip)return{lines:[],shapes:[]};if(e.hit?.crosshair){let{x:c,y:d}=Le(t,r,i,e.width,e.height);if(Qt(e.hit.plot,c,d)){let u=Ze(e,c),h=en(e,c);if(u&&h)return{lines:u.rows,shapes:[h]}}}let o=n?.closest?.("[data-skdx-part]"),s=e.tooltipFormatter?ge(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?ge(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?ge(s,e):void 0,h=u?s?.shapes[u.index]:void 0,{x:b,y:M}=h?He(h):Le(n,t,r,i,o);return st(b,M,d,i,o,s?.tooltipPlacement)}function on(e,n,t,r,i){if(!e.tooltip)return[];if(e.hit?.crosshair){let{x:o,y:s}=Le(t,r,i,e.width,e.height),l=tn(e,o,s);if(l.length>0)return l}return Pr(n,t,r,i,e.width,e.height,e)}function sn(e,n){let t=ge(e,n);return t&&!t.item.legend?xe(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 an(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=xe(i.item),s=JSON.stringify(o);t.has(s)||(t.add(s),r.push(o))}return r}var ln=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}),mt=(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 cn(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=xe(i.item),d=JSON.stringify(c);t.has(d)||(t.add(d),r.push(c))}return r}var dn=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 un(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 hn(e,n,t){let r=e.edit;return Nr(r,n,r.invert(n.bar.x0+t)-r.invert(n.bar.x0))}function fn(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 mn(e,n,t){let r=e.edit,i=r.scale(t.start),o=r.scale(t.end);return{kind:"rect",part:"edit-ghost",x:p(Math.min(i,o)),y:p(n.bar.y),width:p(Math.max(1,Math.abs(o-i))),height:p(n.bar.height),fill:R.focus,opacity:.25,stroke:R.focus,rx:2}}var Pi=64,Di=e=>Math.max(1,Math.min(Pi,e));function pn(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 bn(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 ge(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 pt=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 xn(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*te+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(p(o),p(s),l,e.width,e.height):[]]}function gn(e,n,t){let r=pt(e);if(r.length===0)return;let i=n===null?-1:r.indexOf(n);switch(t){case"ArrowRight":case"ArrowDown":return r[Math.min(r.length-1,i+1)];case"ArrowLeft":case"ArrowUp":return r[Math.max(0,i<=0?0:i-1)];case"Home":return r[0];case"End":return r[r.length-1];case"Escape":return null;default:return}}var Oe=2,ze=(e,n,t)=>{let r=Math.max(Oe,Math.min(t,Math.round(n))),i=Math.max(0,Math.min(t-r,Math.round(e)));return{start:i,end:i+r}},Fr=(e,n)=>!e||e.start<=0&&e.end>=n;function yn(e,n,t){if(e.count<=Oe||!e.plot.width)return;let{start:r,end:i}=e.zoom,o=i-r,s=n>0?1.25:.8,l=Math.max(Oe,Math.min(e.count,Math.round(o*s)));if(l===o)return n>0&&!Fr(e.zoom,e.count)?ze(r,l,e.count):void 0;let c=Math.max(0,Math.min(1,(t-e.plot.x)/e.plot.width)),d=r+c*o;return ze(d-c*l,l,e.count)}function kn(e,n,t,r){let i=n.end-n.start,o=Math.max(Oe,Math.min(e.count,Math.round(i/Math.max(.05,t)))),s=Math.max(0,Math.min(1,(r-e.plot.x)/Math.max(1,e.plot.width)));return ze(n.start+s*i-s*o,o,e.count)}function vn(e,n,t){let r=n.end-n.start,i=e.plot.width/Math.max(1,r);return ze(n.start-t/i,r,e.count)}function Mn(e,n,t){let r=e.brush;if(!r||!Qt(r.box,n,t))return;let i=r.window;if(Math.abs(n-i.x)<=6)return{grab:"left",zoom:e.zoom};if(Math.abs(n-(i.x+i.width))<=6)return{grab:"right",zoom:e.zoom};if(n>i.x&&n<i.x+i.width)return{grab:"move",zoom:e.zoom};let o=e.zoom.end-e.zoom.start,s=(n-r.box.x)/Math.max(1,r.box.width)*e.count;return{grab:"move",zoom:ze(s-o/2,o,e.count)}}function 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 ze(t.start+o,t.end-t.start,e.count);if(n==="left")return{start:Math.max(0,Math.min(t.end-Oe,Math.round(t.start+o))),end:t.end};let s=Math.min(e.count,Math.max(t.start+Oe,Math.round(t.end+o)));return{start:t.start,end:s}}function $n(e,n){switch(n.type){case"svg":return Promise.resolve(Sn(e,n.label,n.resolve));case"csv":return Promise.resolve(jr(n.rows));case"png":{if(typeof document>"u"||typeof Image>"u")return Promise.reject(new Error("PNG export needs a browser"));let t=Sn(e,n.label,n.resolve);return Er(t,e.width,e.height,n.scale,n.background)}}}var le=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/"/g,"&quot;"),Ue=e=>e.filter(([,n])=>n!==void 0&&n!=="").map(([n,t])=>` ${n}="${le(String(t))}"`).join("");function Gr(e){let n=e.title?`<title>${le(e.title)}</title>`:"",t=["data-skdx-part",e.part];switch(e.kind){case"path":return`<path${Ue([t,["d",e.d],["fill",e.fill??"none"],["stroke",e.stroke],["stroke-width",e.strokeWidth],["stroke-linecap",e.strokeLinecap],["stroke-linejoin",e.strokeLinejoin],["stroke-dasharray",e.dash],["opacity",e.opacity],["fill-opacity",e.fillOpacity]])}>${n}</path>`;case"rect":return`<rect${Ue([t,["x",e.x],["y",e.y],["width",e.width],["height",e.height],["rx",e.rx],["fill",e.fill],["stroke",e.stroke],["fill-opacity",e.opacity]])}>${n}</rect>`;case"line":return`<line${Ue([t,["x1",e.x1],["y1",e.y1],["x2",e.x2],["y2",e.y2],["stroke",e.stroke],["stroke-width",e.strokeWidth],["stroke-dasharray",e.dash],["opacity",e.opacity]])}>${n}</line>`;case"circle":return`<circle${Ue([t,["cx",e.cx],["cy",e.cy],["r",e.r],["fill",e.fill],["stroke",e.stroke]])}>${n}</circle>`;case"text":return`<text${Ue([t,["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]])}>${le(e.text)}</text>`}}function _r(e){let n=e.defs??[];return n.length===0?"":`<defs>${n.map(t=>`<linearGradient id="${le(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="${le(r.color)}"${r.opacity===void 0?"":` stop-opacity="${r.opacity}"`}/>`).join("")}</linearGradient>`).join("")}</defs>`}function Sn(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="${le(n)}"`,o=e.description?`<desc>${le(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="${le(R.fontFamily)}" font-size="${le(R.fontSize)}"><title>${le(n)}</title>${o}${r}</svg>`}function Er(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 jr(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 Cn(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 In=new Map;function bt(e){let n=In.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&&In.delete(e)}},publish(o,s){Object.assign(r,o);for(let l of t)l(o,s)}};return In.set(e,{group:i,listeners:t}),i}var Wr='[data-skdx-part]:not([data-skdx-part^="tooltip"]):not([data-skdx-part="focus"]):not([data-skdx-part="crosshair"])',An=`@keyframes skdx-in{from{opacity:0}to{opacity:1}}${Wr}{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){${Wr}{animation:none;transition:none}}`;function Tn(e){let n=e.animate;return n&&e.shapes.length<=1500?`${n}ms`:void 0}import{css as Ni,html as ye,LitElement as Fi,nothing as X,svg as ie}from"lit";import{property as T,state as se}from"lit/decorators.js";import{ifDefined as W}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=[ln(mt(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=[dn(i.points)];return}if(i?.grab==="edit"){if(!i.gantt)return;let{x:o}=this.viewBox(t,r);i.change=hn(r,i.gantt,o-i.x),this.overlay=[mn(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(bn(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(kn(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"?vn(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}=rn(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=on(r,t.target,t.currentTarget,t.clientX,t.clientY);(o.length>0||this.tip.length>0)&&(this.tip=o)}if(this.highlight(sn(r,t.target)),this.syncId&&r.hit?.crosshair){let o=Ze(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=ge(r,t.target)?.item.legend,l=this.canEdit(r)?un(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=Mn(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(an(o,mt(i.x,i.y,s,l))):i.grab==="lasso"?this.setSelected(cn(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(pn(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=yn(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=ge(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)?fn(r,this.focused,t):void 0;if(i){t.preventDefault(),this.emit("skdx-task-change",i);return}let o=gn(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?xe(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:M,responsive:k,highlighted:m,highlightScope:x,accessibleTable:y}=this;return{width:k&&this.measured?this.measured:t,height:r,animate:M,responsive:k,legend:i,tooltip:o,format:s,palette:l,loading:c,error:d,emptyMessage:u,description:h,decorative:b,highlighted:m===void 0?this.highlightState:m,highlightScope:x,accessibleTable:y,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&&bt(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=bt(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&&qt(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(Yt(this.selected??this.selectedState,t,r==="single"?"single":"multiple"))}shareCrosshair(t){!this.syncId||this.lastCross===t||(this.lastCross=t,this.publish({crosshair:t}))}clearTip(){this.tip=[],this.portal=null,this.shareCrosshair(null)}canZoom(t){return!!(t.hit&&(this.zoomable||t.hit.brush))}canPan(t){return!!(t.map&&this.zoomable)}canEdit(t){return!!(this.editable&&t.edit)}brushing(){return this.selectionMode==="brush"||this.selectionMode==="lasso"}viewBox(t,r){return Le(t.currentTarget,t.clientX,t.clientY,r.width,r.height)}getSvgElement(){return this.renderRoot.querySelector("svg")}getLayout(){return this.layout}resetZoom(){this.setZoom(void 0)}zoomTo(t){this.setZoom(t)}focusItem(t){let r=this.layout;if(!r)return!1;let i=r.shapes.findIndex(o=>o.item&&!o.item.legend&&me(o.item,t));return i<0?!1:(this.getSvgElement()?.focus(),this.focused=i,!0)}export(t){let r=this.layout;return r?$n(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(_t(t),this.sized());if(this.layout=o,o.issues!==this.reported){this.reported=o.issues;for(let x of o.issues??[])this.emit("skdx-data-issue",x)}let s=this.canZoom(o),l=this.canPan(o),c=this.canEdit(o),d=this.brushing(),u=s||l||c||d,h=!o.decorative&&pt(o).length>0,b=Tn(o),M=Cn(o,this.accessibleTable),k=typeof this.accessibleTable=="object"&&this.accessibleTable.caption||i,m=this.portal;return ye`<svg
1
+ var ai=Object.defineProperty;var ci=Object.getOwnPropertyDescriptor;var k=(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 ne}from"lit/decorators.js";var sr=new Set(["__proto__","constructor","prototype"]),Bt="skdx-chart-snapshot-request-v1";function Pt(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(Bt,t),()=>e.removeEventListener(Bt,t)}function he(e){return!!e&&typeof e=="object"&&!Array.isArray(e)&&(Object.getPrototypeOf(e)===Object.prototype||Object.getPrototypeOf(e)===null)}function Nt(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)&&!he(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((g,w)=>o(g,`${d}[${w}]`,u+1)??null);else{let g=[];for(let[w,x]of Object.entries(a)){if(sr.has(w))throw new Error("Unsafe chart snapshot key");let m=o(x,`${d}.${w}`,u+1);m!==void 0&&g.push([w,m])}h=Object.fromEntries(g)}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 ar({schemaVersion:"1.0.0",kind:e,configuration:o(n,"input"),canvas:o(l,"canvas"),diagnostics:r})}function ar(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(!he(a))throw new Error("Chart snapshot must contain plain JSON only");for(let[u,h]of Object.entries(a)){if(sr.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(!he(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)||!he(e.configuration)||!he(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(!he(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(!he(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(!he(h)||Object.keys(h).some(g=>!["offset","color","opacity"].includes(g))||!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(!he(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 cr=e=>Number(e.toPrecision(12)),li,lr=e=>(li??(li=new Intl.NumberFormat)).format(cr(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 ue(e){if(e===void 0)return lr;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(g=>h.format(cr(g)))},d=u=>{let h=new Intl.DateTimeFormat(t,s?{...u,timeZone:s}:u);return g=>h.format(g)};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 rt(e,n){if(typeof e=="string")return e;let t=e instanceof Date?e.getTime():e;return n?ue(n)(t):e instanceof Date?new Intl.DateTimeFormat().format(e):lr(t)}var fe=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 ve(e,n,t=5){if(e===n)return[e];let r=(n-e)/Math.max(1,t),i=10**Math.floor(Math.log10(r)),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(hr(u));return d}function dr(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 hr=e=>Number(e.toPrecision(12)),p=e=>Number(e.toFixed(2)),$=e=>typeof e=="number"&&Number.isFinite(e),oe=e=>e.filter($);function me(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 Me(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],g=e[u];n==="stepAfter"?d+=`H${g.x}V${g.y}`:n==="stepBefore"?d+=`V${g.y}H${g.x}`:d+=`H${p((h.x+g.x)/2)}V${g.y}H${g.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,g=l[d+1]/u,w=Math.hypot(h,g);w>3&&(l[d]=3*h*u/w,l[d+1]=3*g*u/w)}let a=`M${t.x} ${t.y}`;for(let d=0;d<r-1;d++){let u=e[d],h=e[d+1],g=i[d]/3;a+=`C${p(u.x+g)} ${p(u.y+g*l[d])} ${p(h.x-g)} ${p(h.y-g*l[d+1])} ${h.x} ${h.y}`}return a}var _e=1e3,je=60*_e,Fe=60*je,Ge=24*Fe,hi=[_e,5*_e,15*_e,30*_e,je,5*je,15*je,30*je,Fe,3*Fe,6*Fe,12*Fe,Ge,2*Ge,7*Ge,14*Ge];function ur(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*Ge),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 fr(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(hr(l*10**o));return s.filter(o=>o>=e/1.0001&&o<=n*1.0001)}function Te(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??me(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 Oe(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 oe(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,mi={M:2,L:2,T:2,C:6,S:4,Q:4,A:7,H:-1,V:-2};function pi(e,n,t){return e.replace(fi,(r,i,s)=>{let o=mi[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 g=u%o;return o===7?g===5?String(h+n):g===6?String(h+t):d:String(g%2===0?h+n:h+t)});return i+a.join(" ")})}var mr=(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:pi(r.d,n,t)}}});var Dt=["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)"))),L={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"?L.axis:`var(--skdx-color-${e}-500)`,_t=(e="neutral")=>e==="neutral"?L.label:e==="primary"?"var(--skdx-color-text-accent)":`var(--skdx-color-text-${e})`,pr=(e,n)=>n??Dt[e%Dt.length];var re={top:16,right:16,bottom:32,left:48};function gr(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 We(e){let n=e.legend;if(n)return n===!0?{}:n.enabled===!1?void 0:n}function Ft(e){let n=e.tooltip;return n===void 0||n===!0?{enabled:!0}:n===!1?{enabled:!1}:{...n,enabled:n.enabled??!0}}var br=e=>e.crosshair===!0||Ft(e).trigger==="axis",ot=20,gi=120,xr=e=>{let n=We(e);return n&&(n.position==="left"||n.position==="right")?n.width??gi:0},st=(e,n=600,t=300)=>({width:(e.width??n)-xr(e),height:(e.height??t)-(We(e)?.position==="bottom"?ot:0)}),yr=(e,n,t)=>{let r=We(e);return!r||!(r.position===void 0||r.position==="top")?0:(n?Math.max(1,vr(n,t??st(e).width,r)):1)*ot},te=6.5;function Gt(e,n){let t=Array.from(e),r=Math.max(0,Math.floor(n/te));return t.length<=r?e:r===0?"":`${t.slice(0,r-1).join("")}\u2026`}var wr=(e,n,t)=>t??(e.palette&&e.palette.length>0?e.palette[n%e.palette.length]:pr(n)),kr=(e,n)=>e.hiddenSeries?.includes(n)??!1;function jt(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,g=s,w=i,x=(m,y,b,f)=>{let M=(y?18:4)+m.length*te;g>s&&(o||g+M>n-8)&&(g=s,w+=ot),y&&l.push({kind:"rect",part:"legend-swatch",x:g,y:w-5,width:10,height:10,fill:y,opacity:f?.3:void 0,item:b}),l.push({kind:"text",part:"legend-label",x:g+(y?14:0),y:w,text:m,baseline:"middle",fill:f?L.grid:L.label,item:b}),g+=M+12};for(let m of d){let y=t.includes(m.name),b=h?{label:m.name,series:m.name,legend:!0}:void 0;x(r.formatter?.(m.name)??m.name,m.color,b,y)}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*te)),o=n-8-s;for(let l of i)r.push({...l,x:l.x+o})}return r}var vr=(e,n,t={})=>new Set(jt(e,n,[],t).flatMap(r=>r.kind==="text"?[r.y]:[])).size;function Wt(e,n,t,r=[]){let i=We(e),s=i&&e.direction==="rtl"&&i.align===void 0?{...i,align:"end"}:i,o=Ft(e),l=s?.position==="bottom",a=xr(e),d=e.hiddenSeries??[],u=s?a?jt(r,1/0,d,s,10,(s.position==="right"?n:0)+8,!0):jt(r,n,d,s,l?t+10:10):[],h=l?vr(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=[...mr(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)/te)),a=o.flatMap(y=>{let b=[],f=Array.from(y);for(;f.length>l;){let M=f.slice(0,l+1).lastIndexOf(" ");M<1&&(M=l),b.push(f.slice(0,M).join("")),f=f.slice(M),f[0]===" "&&f.shift()}return b.push(f.join("")),b}),d=Math.max(1,Math.floor((i-6)/16)),u=a.slice(0,d);a.length>d&&(u[d-1]=Gt(`${u[d-1]}\u2026`,r-12));let h=Math.min(r,Math.max(0,...u.map(y=>Array.from(y).length))*te+12),g=Math.min(i,6+u.length*16),w=s==="top"?{x:e-h/2,y:n-g-8}:s==="bottom"?{x:e-h/2,y:n+8}:s==="left"?{x:e-h-8,y:n-g/2}:s==="right"?{x:e+8,y:n-g/2}:{x:e+12,y:n-g-6},x=Math.max(0,Math.min(r-h,w.x)),m=Math.max(0,Math.min(i-g,w.y));return[{kind:"rect",part:"tooltip",title:o.join(`
2
+ `),x:p(x),y:p(m),width:p(h),height:g,fill:"var(--skdx-color-surface-raised)",stroke:L.axis,rx:8},...u.map((y,b)=>({kind:"text",part:"tooltip-label",x:p(x+6),y:p(m+11+b*16),text:y,baseline:"middle",fill:"var(--skdx-color-text-default)",weight:u.length>1&&b===0?"bold":void 0}))]}function Mr([e,n],t,r=!1,i){let s=typeof r=="boolean"?{scale:r?"log":"linear"}:r,o=ue(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 m=O=>Math.sign(O)*Math.sqrt(Math.abs(O)),y=s.nice===!1?[l,a]:ve(l,a,s.ticks),b=s.min??y[0],f=s.max??y[y.length-1],M=Ae([m(b),m(f)],t),I=O=>M(m(O)),S=ve(b,f,s.ticks).filter(O=>O>=b-1e-9&&O<=f+1e-9);return{...d,scale:I,domain:[b,f],format:o,ticks:(S.length>=2?S:[b,f]).map(O=>({pos:p(I(O)),label:o(O)})),zero:p(I(Math.min(Math.max(0,b),f)))}}if(s.scale==="log"){let m=Math.max(l,Number.EPSILON),y=Math.max(a,m),b=fr(m,y),f=[Math.log10(m),Math.log10(y)],M=Ae(f,t),I=S=>M(Math.log10(Math.max(S,Number.EPSILON)));return{...d,scale:I,domain:f,format:o,ticks:b.map(S=>({pos:p(I(S)),label:o(S)})),zero:p(t[0])}}let u=ve(l,a,s.ticks),h=[s.min??(s.nice===!1?l:u[0]),s.max??(s.nice===!1?a:u[u.length-1])],g=Ae(h,t),w=u.filter(m=>m>=h[0]-1e-9&&m<=h[1]+1e-9),x=(w.length>=2?w:[h[0],h[1]]).map(m=>({pos:p(g(m)),label:o(m)}));return{...d,scale:g,domain:h,format:o,ticks:x,zero:p(g(Math.min(Math.max(0,h[0]),h[1])))}}var Sr=([e,n],t)=>Math.max(re.left,ve(e,n).reduce((r,i)=>Math.max(r,t(i).length),0)*te+14),Cr=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)*te+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 Zt=(e,n,t,r)=>`${e}, ${n}: ${r(t)}`;function lt(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)":L.label}),{...Wt(e,s,o),shapes:a,tooltip:!1}}var Ut=(e,n,t)=>{let r=n.length*te/2;return e+r>t?"end":e-r<0?"start":"middle"};function Kt(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,m)=>m?{kind:"line",part:"grid",x1:x.pos,x2:x.pos,y1:t.y,y2:l,stroke:L.grid}:{kind:"line",part:"grid",x1:t.x,x2:o,y1:x.pos,y2:x.pos,stroke:L.grid},h=n.x?.tickRotation??0,g=(x,m,y,b)=>h?q(x,m,y,{part:b,anchor:h<0?"end":"start",baseline:"middle",rotate:h}):xi(x,m,y,e.width,{part:b,anchor:Ut(x,y,e.width)}),w=(x,m,y,b,f)=>{for(let M of x)a.push(m==="x"?{kind:"line",part:"tick",x1:M.pos,x2:M.pos,y1:y,y2:p(y+b*f),stroke:L.axis}:{kind:"line",part:"tick",x1:y,x2:p(y+b*f),y1:M.pos,y2:M.pos,stroke:L.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 m of i)a.push(u(m,!0));x[0]?.showLine!==!1&&a.push({kind:"line",part:"axis",x1:s,x2:s,y1:t.y,y2:l,stroke:L.axis});for(let m of x){let y=m.position==="top"||m.position==="right",b=p(y?t.y-m.offset:l+m.offset),f=y||m.offset>0;m.showLine&&f&&a.push({kind:"line",part:"axis",x1:t.x,x2:o,y1:b,y2:b,stroke:L.axis}),m.showTicks&&w(m.ticks,"x",b,y?-1:1,m.tickSize??4);let M=p(y?b-8:b+20);for(let I of m.ticks)a.push(y?q(I.pos,M,I.label,{part:"x-label-top",anchor:Ut(I.pos,I.label,e.width)}):g(I.pos,M,I.label,"x-label"));m.label&&a.push(f?q(4,M,m.label,{part:"axis-title",anchor:"start",baseline:y?void 0:"middle"}):q(4,t.y-6,m.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:L.axis}),n.x?.showTicks&&w(r,"y",n.rtl?o:t.x,n.rtl?1:-1,n.x.tickSize??4);for(let m of r)a.push(n.rtl?q(o+8,m.pos,m.label,{part:"y-label",anchor:"start",baseline:"middle"}):q(t.x-8,m.pos,m.label,{part:"y-label",anchor:"end",baseline:"middle"}))}else{if(d)for(let m of i)a.push(u(m,!1));n.y?.showLine!==!1&&a.push({kind:"line",part:"axis",x1:t.x,x2:o,y1:s,y2:s,stroke:L.axis});let x=n.axes??[{ticks:i,position:"left",offset:0,label:n.yLabel,...n.y},...n.rightTicks?[{ticks:n.rightTicks,position:"right",offset:0,label:n.rightLabel}]:[]];for(let m of x){let y=m.position==="left",b=y?t.x-m.offset:o+m.offset,f=y?"y-label":"y-label-right";m.showLine&&a.push({kind:"line",part:"axis",x1:p(b),x2:p(b),y1:t.y,y2:l,stroke:L.axis}),m.showTicks&&w(m.ticks,"y",p(b),y?-1:1,m.tickSize??4);for(let M of m.ticks)a.push(q(p(y?b-8:b+8),M.pos,M.label,{part:f,anchor:y?"end":"start",baseline:"middle"}));m.label&&a.push(q(p(y?m.offset===0?4:Math.max(4,b-40):m.offset===0?e.width-4:Math.min(e.width-4,b+40)),t.y-6,m.label,{part:"axis-title",anchor:y?"start":"end"}))}n.x?.showTicks&&w(r,"x",l,1,n.x.tickSize??4);for(let m of r)a.push(g(m.pos,l+(h?12:20),m.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:L.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=Gt(t,l);return{kind:"text",part:"label",x:s,y:n,fill:L.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*te+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 He=(e,n,t,r,i,s)=>({kind:"circle",part:"point",cx:e,cy:n,r:t,fill:r,title:i,item:s});function qt(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??_t(a.variant),h={part:"reference-label",fill:u},g=n.horizontal===!0;if("y"in a){let w=p(n.y(a.y,a.axis??"left"));if(g){let x=o(w);t.push(...Ar(x,r.y,s,d,a.label,h))}else{let x=l(w);t.push(...Ir(r.x,i,x,d,a.label,h))}}else if("x"in a){let w=n.x(a.x);if(w===void 0)continue;g?t.push(...Ir(r.x,i,l(p(w)),d,a.label,h)):t.push(...Ar(o(p(w)),r.y,s,d,a.label,h))}else if("y1"in a){let w=p(n.y(a.y1,a.axis??"left")),x=p(n.y(a.y2,a.axis??"left"));g?t.push(...Or(o(Math.min(w,x)),o(Math.max(w,x)),r,d,a.label,u)):t.push(...Tr(l(Math.min(w,x)),l(Math.max(w,x)),r,d,a.label,u))}else{let w=n.x(a.x1),x=n.x(a.x2);if(w===void 0||x===void 0)continue;let m=p(Math.min(w,x)),y=p(Math.max(w,x));g?t.push(...Tr(l(m),l(y),r,d,a.label,u)):t.push(...Or(o(m),o(y),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??_t(o.variant),d=(x,m,y)=>{let b=n.x(x);if(b===void 0)return;let f=n.y(m,y??"left");return n.horizontal?{x:p(f),y:p(b)}:{x:p(b),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:m,...y}=o;t.push(...qt([y],n));continue}if(o.type==="rect"){let x=d(o.x1,o.y1,o.axis),m=d(o.x2,o.y2,o.axis);if(!x||!m)continue;let y=Math.max(r.x,Math.min(x.x,m.x)),b=Math.max(r.y,Math.min(x.y,m.y)),f=o.label??"";t.push({kind:"rect",part:"annotation-rect",x:p(y),y:p(b),width:p(Math.max(0,Math.min(i,Math.max(x.x,m.x))-y)),height:p(Math.max(0,Math.min(s,Math.max(x.y,m.y))-b)),fill:l,opacity:.12,stroke:l,title:f||void 0,item:f?h(f):void 0}),o.label&&t.push(q(p(y+4),p(b+12),o.label,{part:"annotation-label",fill:a}));continue}let g=d(o.x,o.y,o.axis);if(!g)continue;if(o.type==="text"){t.push(q(g.x,g.y,o.text,{part:"annotation-text",fill:a,anchor:"middle",baseline:"middle",title:o.label}));continue}let w=o.label??`${String(o.x)}, ${o.y}`;if(t.push({kind:"circle",part:"annotation-point",cx:g.x,cy:g.y,r:5,fill:l,stroke:"var(--skdx-color-surface-default)",title:w,item:h(w)}),o.type==="callout"&&o.label){let[x,m]=o.offset??[16,-16],y=p(Math.max(r.x,Math.min(i,g.x+x))),b=p(Math.max(r.y,Math.min(s,g.y+m)));t.push({kind:"line",part:"annotation-leader",x1:g.x,y1:g.y,x2:y,y2:b,stroke:l},q(y,b,o.label,{part:"annotation-label",fill:a,anchor:x>=0?"start":"end",baseline:"middle"}))}}return t}var Xt=2e3;function yi(e){if(e!=="none")return e===void 0||e==="auto"?{strategy:"lttb",threshold:Xt}:typeof e=="string"?{strategy:e,threshold:Xt}:{strategy:e.strategy,threshold:e.threshold??Xt}}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,g=0;for(let M=a;M<d;M++){let I=e[M];$(I)&&(u+=M,h+=I,g++)}u=g?u/g:(a+d)/2,h=g?h/g:0;let w=Math.floor(l*s)+1,x=Math.min(t-1,Math.floor((l+1)*s)+1),m=e[o],y=$(m)?m:0,b=-1,f=-1;for(let M=w;M<x;M++){let I=e[M];if(!$(I)){i.push(M);continue}let S=Math.abs((o-u)*(I-y)-(o-M)*(h-y));S>f&&(f=S,b=M)}b<0&&(b=w),r.push(b),o=b}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 g=e[h];if(!$(g)){i.push(h);continue}(d<0||g<e[d])&&(d=h),(u<0||g>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,g=-1;for(let w=l;w<a;w++){let x=e[w];if(!$(x)){i.push(w);continue}h<0&&(h=w),g=w,(d<0||x<e[d])&&(d=w),(u<0||x>e[u])&&(u=w)}for(let w of[h,d,u,g])w>=0&&i.push(w)}return[...new Set(i)].sort((o,l)=>o-l)}function Rr(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 Lr(e,n,t,r,i,s,o,l){if(r==="circle")return{...He(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 Ri(e,n={}){let t=e.filter($),r=Te(t,n);return{edges:r,counts:Oe(t,r).map(i=>i.count)}}function Yt(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=Ri(t,r).counts;break}return t}var Li=100,Vi=2e3,Vr=32,Er=28,ht=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"||ht(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(ht))?.id:e.find(r=>r.id===n)?.id}var dt=e=>e.kind==="bar"||e.kind==="range"&&e.style==="bar";function Nr(e,n){let t=ue(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=>oe(c.data).length===0&&oe(c.high).length===0),h=lt(e,u);if(h)return{...h,issues:s};let g=e.xAxis?.type??"category",w=g!=="category"&&i.length>0&&i.every(c=>typeof c!="string"||g==="time"&&$(fe(c))),x=w?i.map(fe):[],[m,y]=me(x),b=e.xAxis?.format??(g==="time"?{style:y-m<2*864e5?"time":"date"}:void 0),f=Array.from({length:d},(c,v)=>{let C=i[v];return C===void 0?String(v+1):rt(C,b)}),M=Bi(e.zoom,d),I=Array.from({length:M.end-M.start},(c,v)=>M.start+v),S=e.orientation==="horizontal",D=r.map(c=>({...c,hidden:c.hidden||S&&!dt(c)})).filter(c=>!c.hidden),F=D.some(c=>!dt(c))?Rr(D.filter(c=>!dt(c)).map(c=>I.map(v=>(c.kind==="range"?c.high[v]:c.data[v])??null)),I.length,e.sampling):void 0,E=F?F.map(c=>I[c]):I,X=e.stacked==="percent"||e.stackOffset==="expand",J=e.stackOffset??"zero",ae=new Map,ge=new Map,yt=new Map;for(let c of D)c.stack!==void 0&&c.kind!=="range"&&yt.set(c.stack,[...yt.get(c.stack)??[],c]);for(let c of yt.values()){let v=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((R,j)=>{$(R)&&(_[j]=_[j]+Math.abs(R))});for(let P of c){let R=[],j=[];for(let B=0;B<d;B++){let N=P.data[B];if(!$(N)){R.push(null),j.push(null);continue}let z=_[B],A=X?z>0?N/z:0:N,G=A>=0?v:C;R.push(G[B]),G[B]=G[B]+A,j.push(G[B])}ae.set(P,R),ge.set(P,j)}if(J==="silhouette"||J==="wiggle"){let P=new Array(d).fill(0);if(J==="silhouette")for(let R=0;R<d;R++)P[R]=-(v[R]-a)/2;else{let R=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],H=G.data[j],K=G.data[j-1],ee=j>0&&$(H)&&$(K)?H-K:0;N+=(B-A-.5)*ee}let z=v[j]-a;R=j===0?-z/2:R-(z>0?N/Math.max(1,B):0),P[j]=R}}for(let R of c){let j=ae.get(R),B=ge.get(R);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 Vn=c=>c.kind==="range"?{from:c.low,to:c.high}:{from:ae.get(c)??new Array(d).fill(a),to:ge.get(c)??c.data},En=c=>{let v=[],C=!1;for(let R of D){if(R.axis!==c)continue;let{from:j,to:B}=Vn(R);for(let N of E){let z=B[N];if($(z)&&v.push(z),R.kind==="range"||R.stack!==void 0){let A=j[N];$(A)&&v.push(A)}}if(R.errors)for(let N of E){let z=Br(R.data[N],R.errors[N]);z&&v.push(z[0],z[1])}(R.kind==="bar"||R.kind==="area")&&J==="zero"&&(C=!0)}let[_,P]=me(v);return C?[Math.min(a,_),Math.max(a,P)]:[_,P]},{width:wt,height:Bn}=st(e),Yr=e.brush?Vr+Er:0,Pn=E.reduce((c,v)=>Math.max(c,f[v].length),0)*te,Nn=X?{style:"percent"}:void 0,Jr=c=>{if(c.scale==="log")return re.left;let[v,C]=En(c.id),_=ue(c.format??Nn??e.format);return Sr([c.min??v,c.max??C],_)+(c.showTicks?c.tickSize??4:0)},kt=c=>S?ht(c)?"top":"bottom":ht(c)!==l?"right":"left",Dn=c=>S?24+(c.showTicks?c.tickSize??4:0):Jr(c),Qr=new Set(D.map(c=>c.axis)),vt=o.filter(c=>Qr.has(c.id)||o.length>1),_n=new Map,Se={left:0,right:0,top:0,bottom:0};for(let c of vt){let v=kt(c);_n.set(c.id,Se[v]),Se[v]+=Dn(c)}let jn=vt.find(c=>kt(c)==="bottom"),Fn=r.map(c=>({name:c.name,color:c.color})),ei={top:re.top+yr(e,Fn,wt)+(o.some(c=>c.label)?12:0)+Se.top,right:S?l?Math.max(re.left,Pn+16):re.right:Math.max(re.right,Se.right),bottom:re.bottom+Yr+(e.xAxis?.label?14:0)+(e.xAxis?.tickRotation?24:0)+Se.bottom-(jn?Dn(jn):0),left:S?l?re.right:Math.max(re.left,Pn+16):Math.max(re.left,Se.left)},U=gr(wt,Bn,ei),ti=S?l?[U.x+U.width,U.x]:[U.x,U.x+U.width]:[U.y+U.height,U.y],Gn=S?[U.y,U.y+U.height]:l?[U.x+U.width,U.x]:[U.x,U.x+U.width],Mt=new Map(o.map(c=>[c.id,{...Mr(En(c.id),ti,{format:Nn,...c},e.format),position:kt(c),offset:_n.get(c.id)??0}])),Wn=o[0]?.id,qe=Mt.get(Wn),St=c=>Mt.get(Pr(o,c)??Wn)??qe,le=(c,v)=>St(v).scale(c),Hn=c=>p(c.scale(Math.min(Math.max(a,Math.min(...c.domain)),Math.max(...c.domain)))),Xe=dr(E.length,Gn,e.barGap),Ct=E.map(c=>x[c]),$t=[...Ct].sort((c,v)=>c-v),Ce=1/0;for(let c=1;c<$t.length;c++)Ce=Math.min(Ce,$t[c]-$t[c-1]);let[$e,Ve]=me(Ct),de=Ce===1/0?Math.max(1,Math.abs(Ve)*.05||1):Ce/2,Ee=Ae([$e-de,Ve+de],Gn),Ye=c=>p(w?Ee(Ct[c]):Xe.center(c)),Zn=w?Math.abs(Ee($e+(Ce===1/0?de:Ce))-Ee($e))*.8:Xe.bandwidth,Un=c=>w?Ye(c)-Zn/2:Xe.start(c),ni=w?(g==="time"?ur($e-de,Ve+de):ve($e-de,Ve+de)).filter(c=>c>=$e-de&&c<=Ve+de).map(c=>({pos:p(Ee(c)),label:rt(c,b)})):ct(E.map((c,v)=>({pos:Ye(v),label:f[c]})),S?1/0:U.width/Math.max(.2,Math.abs(Math.cos((e.xAxis?.tickRotation??0)*Math.PI/180)))),It={...Wt(e,wt,Bn,Fn),plot:U,xTicks:ni,yTicks:S?ct(qe.ticks,U.width):qe.ticks,baseline:Hn(qe)},ri=o[0],Kn=Kt(It,{horizontal:S,rtl:l,axes:vt.map(c=>{let v=Mt.get(c.id);return{ticks:S?ct(v.ticks,U.width):v.ticks,position:v.position,offset:v.offset??0,label:c.label,showLine:c.showLine,showTicks:c.showTicks,tickSize:c.tickSize}}),xLabel:e.xAxis?.label,grid:Cr(ri),categoryGrid:e.xAxis?.grid===!0,x:e.xAxis}),ii=c=>{if(typeof c=="number"&&i.every(C=>typeof C=="string"))return c;let v=typeof c=="string"?c:fe(c);for(let C=0;C<d;C++){let _=i[C];if(_!==void 0&&(typeof v=="string"?_===v||f[C]===v:fe(_)===v))return C}},qn={plot:U,horizontal:S,x:c=>{if(w&&(typeof c!="string"||$(fe(c))))return Ee(fe(c));let v=ii(c),C=v===void 0?-1:E.indexOf(v);return C<0?void 0:Xe.center(C)},y:(c,v)=>le(c,v)},Xn=qt(e.references,qn);Kn.push(...Xn.filter(c=>c.part!=="reference-label"));let oi=$r(Xn.filter(c=>c.part==="reference-label")),At=[],Tt=new Map;for(let c of D){if(!dt(c))continue;let v=c.stack??c,C=At.indexOf(v);C<0&&(C=At.push(v)-1),Tt.set(c,C)}let Je=Zn/Math.max(1,At.length),be=Math.min(Je,e.barWidth??1/0),Yn=(Je-be)/2,Ot=[],Qe=[],zt=[],Rt=[],Lt=[],Jn=[],et=[],tt=c=>St(c.axis).format,Vt=Math.max(0,e.minBarSize??0),si=(c,v,C)=>{let _=Math.abs(v-c);if(_>=Vt)return[Math.min(c,v),_];let R=c+(S?C?1:-1:C?-1:1)*Vt;return[Math.min(c,R),Vt]},Be=(c,v,C,_)=>({label:_,series:c.name,seriesId:c.id??c.name,category:f[v],index:v,value:C}),Qn=(c,v,C,_)=>{let P=Br(_,c.errors?.[v]);if(!P)return;let R=p(le(P[0],c.axis)),j=p(le(P[1],c.axis)),B=4,N="var(--skdx-color-text-default)",z=`${c.name}, ${f[v]}: ${tt(c)(P[0])} \u2013 ${tt(c)(P[1])}`;Jn.push(S?{kind:"line",part:"error-bar",x1:R,x2:j,y1:C,y2:C,stroke:N,title:z}:{kind:"line",part:"error-bar",x1:C,x2:C,y1:R,y2:j,stroke:N,title:z},S?{kind:"line",part:"error-cap",x1:R,x2:R,y1:p(C-B),y2:p(C+B),stroke:N}:{kind:"line",part:"error-cap",x1:p(C-B),x2:p(C+B),y1:R,y2:R,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:v,to:C}=Vn(c),_=tt(c),P=E.length<=Vi;if(c.kind==="bar"){let z="";E.forEach((A,G)=>{let H=c.data[A],K=v[A],ee=C[A];if(!$(H)||!$(K)||!$(ee))return;let Ie=le(K,c.axis),ke=le(ee,c.axis),[Pe,Ne]=si(Ie,ke,ee>=K),De=Un(G)+Tt.get(c)*Je+Yn,tr=p(S?Pe:De),nr=p(S?De:Pe),Et=p(S?Ne:be),rr=p(S?be:Ne);if(!P){z+=`M${tr} ${nr}h${Et}v${rr}h${-Et}Z`;return}let ir=Zt(c.name,f[A],X?ee-K:H,_);if(Qe.push({kind:"rect",part:"bar",x:tr,y:nr,width:Et,height:rr,fill:c.color,rx:e.radius,title:ir,item:Be(c,A,H,ir)}),Qn(c,A,p(De+be/2),H),e.labels){let or=_(X?ee-K:H);Lt.push(S?q(p(Math.max(Ie,ke)+4),p(De+be/2),or,{baseline:"middle"}):q(p(De+be/2),p(Math.min(Ie,ke)-4),or,{anchor:"middle"}))}}),z&&Qe.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=v[z],H=C[z];if(!$(G)||!$(H))return;let K=le(Math.min(G,H),c.axis),ee=le(Math.max(G,H),c.axis),Ie=Un(A)+Tt.get(c)*Je+Yn,ke=`${c.name}, ${f[z]}: ${_(Math.min(G,H))} \u2013 ${_(Math.max(G,H))}`,Pe=Be(c,z,H,ke),Ne=Math.max(1,Math.abs(ee-K));Qe.push(S?{kind:"rect",part:"range",x:p(Math.min(K,ee)),y:p(Ie),width:p(Ne),height:p(be),fill:c.color,rx:e.radius,title:P?ke:void 0,item:Pe}:{kind:"rect",part:"range",x:p(Ie),y:p(Math.min(K,ee)),width:p(be),height:p(Ne),fill:c.color,rx:e.radius,title:P?ke:void 0,item:Pe})});continue}let R=e.nulls==="connect"||e.nulls===void 0&&e.connectNulls,j=[],B=[];E.forEach((z,A)=>{let G=v[z],H=C[z];if(!$(H)||!$(G)){!R&&B.length&&(j.push(B),B=[]);return}B.push({x:Ye(A),y:p(le(H,c.axis)),y0:p(le(G,c.axis)),i:z})}),B.length&&j.push(B);let N=c.markers??E.length<=Li;for(let z of j){let A=Me(z,c.curve);if(c.kind==="range"&&c.style==="line"){zt.push({kind:"path",part:"range-high",d:A,stroke:c.color,strokeWidth:2,strokeLinejoin:"round"},{kind:"path",part:"range-low",d:Me(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=Me([...z].reverse().map(H=>({x:H.x,y:H.y0})),c.curve);Ot.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(St(c.axis)),H=c.stack!==void 0?Me([...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&&!et.some(ee=>ee.id===K)&&et.push({id:K,vertical:!0,stops:[{offset:0,color:c.color,opacity:c.fillOpacity},{offset:1,color:c.color,opacity:0}]}),Ot.push({kind:"path",part:"area",d:`${A}L${H}Z`,fill:c.gradient?`url(#${K})`:c.color,fillOpacity:c.gradient?void 0:c.fillOpacity})}zt.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],H=c.high[A.i],K=`${c.name}, ${f[A.i]}: ${_(Math.min(G,H))} \u2013 ${_(Math.max(G,H))}`;Rt.push({...He(A.x,A.y,.01,c.color,K,Be(c,A.i,H,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],H=X?C[A.i]-v[A.i]:G,K=Zt(c.name,f[A.i],H,_);(N||P)&&Rt.push(N&&c.symbol!=="circle"?Lr(A.x,A.y,c.markerSize,c.symbol,c.color,P?K:void 0,Be(c,A.i,G,K),"point"):{...He(A.x,A.y,N?c.markerSize:.01,c.color,P?K:void 0,Be(c,A.i,G,K)),part:N?"point":"anchor"}),P&&Qn(c,A.i,S?A.y:A.x,C[A.i]),e.labels&&Lt.push(q(A.x,A.y-8,_(H),{anchor:"middle"}))}}let er={plot:U,xs:S?[]:E.map((c,v)=>Ye(v)),rows:E.map(c=>[f[c],...D.map(v=>{let C=tt(v);if(v.kind==="range"){let P=v.low[c],R=v.high[c];return`${v.name}: ${$(P)&&$(R)?`${C(P)} \u2013 ${C(R)}`:"\u2014"}`}let _=v.data[c];return`${v.name}: ${$(_)?C(X?(ge.get(v)?.[c]??0)-(ae.get(v)?.[c]??0):_):"\u2014"}`})]),count:d,zoom:M,crosshair:br(e)},nt=[];if(e.brush&&!S){let c={x:U.x,y:U.y+U.height+Er,width:U.width,height:Vr},v=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(nt.push({kind:"rect",part:"brush",x:c.x,y:c.y,width:c.width,height:c.height,fill:"var(--skdx-color-surface-sunken)",stroke:L.grid}),v){let _=oe(v.data),[P,R]=me(_),j=d>1?c.width/(d-1):0,B=v.data.flatMap((z,A)=>$(z)?[{x:p(c.x+A*j),y:p(c.y+c.height-(R===P?.5:(z-P)/(R-P))*(c.height-4)-2)}]:[]),N=Me(B);B.length>1&&nt.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:v.color,fillOpacity:.3})}nt.push({kind:"rect",part:"brush-window",...C,fill:"var(--skdx-color-primary-500)",opacity:.15,stroke:L.axis},{kind:"rect",part:"brush-handle",x:p(C.x-3),y:c.y+8,width:6,height:c.height-16,fill:L.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:L.axis,rx:8}),er.brush={box:c,window:C}}return{...It,shapes:[...Kn,...Ot,...Qe,...zt,...Jn,...Rt,...Lt,...oi,...zr(e.annotations,qn),...nt,...It.shapes],hit:er,issues:s,defs:et.length?et: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(J=>$(J)?J: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:wr(e,M,f.color),axis:E??s[0]?.id,hidden:kr(e,f.name),index:M,kind:I,data:f.type==="range"?[]:F(Yt(Yt(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}}),g=()=>Math.max(o.length,...h.map(f=>Math.max(f.data.length,f.low.length))),w=f=>{let M=S=>S.length?f.map(O=>S[O]??null):S,I=Array.from({length:g()},(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:g()},(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,J=$(E)?E:-1/0;return f==="asc"?X-J:J-X});w(S)},m=f=>{let M=h.flatMap(S=>oe(S.data)),I=Te(M,f);o=I.slice(1).map((S,O)=>`${t(I[O])}\u2013${t(S)}`),h=h.map(S=>{let O=oe(S.data),D=0,F=Oe(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}})},y=(f,M)=>{let I=Math.max(1,Math.floor(f)),S=g(),O=F=>{if(!F.length)return F;let E=[];for(let X=0;X<S;X+=I){let J=oe(F.slice(X,X+I));E.push(J.length===0?null:M==="sum"?J.reduce((ae,ge)=>ae+ge,0):M==="mean"?J.reduce((ae,ge)=>ae+ge,0)/J.length:M==="min"?Math.min(...J):Math.max(...J))}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"?m({bins:e.bins,binWidth:e.binWidth,domain:e.binDomain}):e.transform==="cumulative"&&(h=h.map(f=>{let M=0;return{...f,data:f.data.map(I=>$(I)?M+=I:M)}}));for(let f of l)f.type==="sort"?x(f.order??"desc"):f.type==="bin"?m(f):f.type==="aggregate"&&y(f.every,f.method??"sum");typeof e.sort=="string"?x(e.sort):e.sort&&x(e.sort.order,e.sort.by);let b=e.xAxis?.domain;if(b){let f=g(),M=Array.from({length:f},(D,F)=>o[F]??String(F+1)),I=D=>{let F=typeof D=="string"?D:fe(D);return M.findIndex(E=>typeof F=="string"?E===F||rt(E)===F:fe(E)===F)},S=b.map(I),O=D=>D.length?S.map(F=>F<0?null:D[F]??null):D;o=[...b],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 ut(e){return e==null?[]:(Array.isArray(e)?e:[e]).map(t=>typeof t=="object"?t:{id:t})}var Jt=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,Jt(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 xe(e){let n={},t=Jt(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 Qt=(e,n)=>e.id===n.id&&e.series===n.series&&e.index===n.index&&e.category===n.category;function en(e,n,t){let r=ut(e),i=xe(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=L.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:L.grid}:{...e,opacity:(e.opacity??1)*n};function tn(e,n){let t=ut(n.selected),r=n.highlighted===void 0||n.highlighted===null?[]:ut(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(g=>pe(h,g))){let g=Di(u);g&&o.push(g)}return a(h)?_i(u,Ni):u});return o.length?{...e,shapes:[...d,...o]}:{...e,shapes:d}}function nn(e){let n=oe(e.data),t=lt(e,n.length===0);if(t)return t;let r=Te(n,{bins:e.bins,binWidth:e.binWidth,domain:e.domain,thresholds:e.thresholds}),i=Oe(n,r),s=i.reduce((m,y)=>m+y.count,0),o=e.mode??"count",l=ue(e.xAxis?.format??e.format),a=ue(o==="percent"?{style:"percent",digits:1}:o==="density"?{style:"decimal",digits:3}:e.format),d=e.name??(o==="density"?"Density":o==="percent"?"Share":"Count"),u=m=>o==="density"?s>0&&m.x1>m.x0?m.count/(s*(m.x1-m.x0)):0:o==="percent"?s>0?m.count/s:0:m.count,h=i.map(m=>`${l(m.x0)}\u2013${l(m.x1)}`),g=Nr({...e,format:a,series:[{name:d,data:i.map(u),color:e.color}],categories:h,xAxis:e.xAxis?.label?{label:e.xAxis.label}:void 0,barGap:e.barGap??.05,transform:void 0},"bar"),w=g.shapes.map((m,y)=>{if(m.part!=="bar"||!m.item||m.item.index===void 0)return m;let b=i[m.item.index];if(!b)return m;let f=s>0?` (${Math.round(b.count/s*1e3)/10}%)`:"",M=`${h[m.item.index]??String(y)}: ${b.count}${f}${o==="count"?"":` \xB7 ${d} ${a(u(b))}`}`;return{...m,title:m.title===void 0?void 0:M,item:{...m.item,label:M}}}),x=g.hit?.rows.map((m,y)=>{let b=i[y];return b?[m[0],`${d}: ${a(u(b))}`,`Observations: ${b.count}`]:m});return{...g,shapes:w,hit:g.hit&&x?{...g.hit,rows:x}:g.hit}}var _r="var(--skdx-radius-default, var(--skdx-radius-md, 0.5rem))";function ft(e){return["tooltip","skeleton","label-background","stage-label-background","brush-handle"].includes(e)?_r:void 0}function Le(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 rn=(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 Ze(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 on(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:L.axis,dash:"3 3"}}function sn(e,n,t){let r=e.hit;if(!r||!r.crosshair||r.xs.length===0||!rn(r.plot,n,t))return[];let i=on(e,n),{rows:s}=Ze(e,n),o=e.tooltipAnchored?r.plot.y+8:t;return[i,...at(i.x1,o,s,e.width,e.height,e.tooltipPlacement)]}function an(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 sn(e,i,t.plot.y+8)}function cn(e,n,t,r,i){if(!e.tooltip)return{lines:[],shapes:[]};if(e.hit?.crosshair){let{x:a,y:d}=Le(t,r,i,e.width,e.height);if(rn(e.hit.plot,a,d)){let u=Ze(e,a),h=on(e,a);if(u&&h)return{lines:u.rows,shapes:[h]}}}let s=n?.closest?.("[data-skdx-part]"),o=e.tooltipFormatter?ye(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?ye(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?ye(o,e):void 0,h=u?o?.shapes[u.index]:void 0,{x:g,y:w}=h?Ue(h):Le(n,t,r,i,s);return at(g,w,d,i,s,o?.tooltipPlacement)}function ln(e,n,t,r,i){if(!e.tooltip)return[];if(e.hit?.crosshair){let{x:s,y:o}=Le(t,r,i,e.width,e.height),l=sn(e,s,o);if(l.length>0)return l}return Fr(n,t,r,i,e.width,e.height,e)}function dn(e,n){let t=ye(e,n);return t&&!t.item.legend?xe(t.item):null}var ji=(e,n)=>{let{x:t,y:r}=Ue(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 hn(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=xe(i.item),o=JSON.stringify(s);t.has(o)||(t.add(o),r.push(s))}return r}var un=e=>({kind:"rect",part:"selection-box",x:p(e.x),y:p(e.y),width:p(e.width),height:p(e.height),fill:L.focus,opacity:.12,stroke:L.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 fn(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}=Ue(i),l=i.kind==="circle"?i.cy:i.kind==="rect"?i.y+i.height/2:o;if(!Gr(n,s,l))continue;let a=xe(i.item),d=JSON.stringify(a);t.has(d)||(t.add(d),r.push(a))}return r}var mn=e=>({kind:"path",part:"selection-lasso",d:e.length?`M${e.map(n=>`${p(n.x)} ${p(n.y)}`).join("L")}`:"",fill:L.focus,fillOpacity:.12,stroke:L.focus,dash:"4 3"}),mt=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-mt||n>i.x1+mt))return Math.abs(n-i.x0)<=mt?{bar:i,mode:"start"}:Math.abs(n-i.x1)<=mt?{bar:i,mode:"end"}:{bar:i,mode:"move"}}}function gn(e,n,t){let r=e.edit;return Wr(r,n,r.invert(n.bar.x0+t)-r.invert(n.bar.x0))}function bn(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 Wr(r,{bar:s,mode:o},i*l)}function Wr(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 xn(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:L.focus,opacity:.25,stroke:L.focus,rx:2}}var Fi=64,Gi=e=>Math.max(1,Math.min(Fi,e));function yn(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,g=e.view.zoom/s;return{center:[a+u*(1-g),e.fromY(e.toY(d)-h*(1-g))],zoom:s}}function wn(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 ye(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 gt=e=>e.shapes.flatMap((n,t)=>n.item&&!n.item.legend?[t]:[]);function Ue(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 kn(e,n){let t=n===null?void 0:e.shapes[n];if(!t)return[];let r=L.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*te+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}=Ue(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 vn(e,n,t){let r=gt(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 ze=2,Re=(e,n,t)=>{let r=Math.max(ze,Math.min(t,Math.round(n))),i=Math.max(0,Math.min(t-r,Math.round(e)));return{start:i,end:i+r}},Hr=(e,n)=>!e||e.start<=0&&e.end>=n;function Mn(e,n,t){if(e.count<=ze||!e.plot.width)return;let{start:r,end:i}=e.zoom,s=i-r,o=n>0?1.25:.8,l=Math.max(ze,Math.min(e.count,Math.round(s*o)));if(l===s)return n>0&&!Hr(e.zoom,e.count)?Re(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 Re(d-a*l,l,e.count)}function Sn(e,n,t,r){let i=n.end-n.start,s=Math.max(ze,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 Re(n.start+o*i-o*s,s,e.count)}function Cn(e,n,t){let r=n.end-n.start,i=e.plot.width/Math.max(1,r);return Re(n.start-t/i,r,e.count)}function $n(e,n,t){let r=e.brush;if(!r||!rn(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:Re(o-s/2,s,e.count)}}function In(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 Re(t.start+s,t.end-t.start,e.count);if(n==="left")return{start:Math.max(0,Math.min(t.end-ze,Math.round(t.start+s))),end:t.end};let o=Math.min(e.count,Math.max(t.start+ze,Math.round(t.end+s)));return{start:t.start,end:o}}function Tn(e,n){switch(n.type){case"svg":return Promise.resolve(An(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=An(e,n.label,n.resolve);return Kr(t,e.width,e.height,n.scale,n.background)}}}var ce=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/"/g,"&quot;"),Ke=e=>e.filter(([,n])=>n!==void 0&&n!=="").map(([n,t])=>` ${n}="${ce(String(t))}"`).join("");function Zr(e){let n=e.title?`<title>${ce(e.title)}</title>`:"",t=["data-skdx-part",e.part];switch(e.kind){case"path":return`<path${Ke([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${Ke([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${Ke([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${Ke([t,["cx",e.cx],["cy",e.cy],["r",e.r],["fill",e.fill],["stroke",e.stroke]])}>${n}</circle>`;case"text":return`<text${Ke([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]])}>${ce(e.text)}</text>`}}function Ur(e){let n=e.defs??[];return n.length===0?"":`<defs>${n.map(t=>`<linearGradient id="${ce(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="${ce(r.color)}"${r.opacity===void 0?"":` stop-opacity="${r.opacity}"`}/>`).join("")}</linearGradient>`).join("")}</defs>`}function An(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="${ce(n)}"`,s=e.description?`<desc>${ce(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="${ce(L.fontFamily)}" font-size="${ce(L.fontSize)}"><title>${ce(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 On(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 zn=new Map;function bt(e){let n=zn.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&&zn.delete(e)}},publish(s,o){Object.assign(r,s);for(let l of t)l(s,o)}};return zn.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"])',Rn=`@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 Wi,html as we,LitElement as Hi,nothing as Y,svg as ie}from"lit";import{property as T,state as se}from"lit/decorators.js";import{ifDefined as W}from"lit/directives/if-defined.js";var Zi={fromAttribute:()=>!1},V=class extends Hi{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=[un(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=[mn(i.points)];return}if(i?.grab==="edit"){if(!i.gantt)return;let{x:s}=this.viewBox(t,r);i.change=gn(r,i.gantt,s-i.x),this.overlay=[xn(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(wn(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(Sn(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"?Cn(r.hit,i.zoom,s-i.x):In(r.hit,i.grab,i.zoom,s-i.x));return}if(r.tooltipPortal){let{lines:s,shapes:o}=cn(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=ln(r,t.target,t.currentTarget,t.clientX,t.clientY);(s.length>0||this.tip.length>0)&&(this.tip=s)}if(this.highlight(dn(r,t.target)),this.syncId&&r.hit?.crosshair){let s=Ze(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=ye(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=$n(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(hn(s,pt(i.x,i.y,o,l))):i.grab==="lasso"?this.setSelected(fn(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(yn(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=Mn(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=ye(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)?bn(r,this.focused,t):void 0;if(i){t.preventDefault(),this.emit("skdx-task-change",i);return}let s=vn(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?xe(o):null)}}updated(){let t=this.renderRoot.querySelector("svg")??void 0;t===this.snapshotSvg&&this.removeSnapshot||(this.removeSnapshot?.(),this.snapshotSvg=t,this.removeSnapshot=t?Pt(t,()=>{if(!this.snapshotConfiguration||!this.layout)throw new Error("Actual owner chart configuration unavailable");return Nt(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:g,animated:w,responsive:x,highlighted:m,highlightScope:y,accessibleTable:b}=this;return{width:x&&this.measured?this.measured:t,height:r,animate:w,responsive:x,legend:i,tooltip:s,format:o,palette:l,loading:a,error:d,emptyMessage:u,description:h,decorative:g,highlighted:m===void 0?this.highlightState:m,highlightScope:y,accessibleTable:b,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&&bt(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=bt(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&&Qt(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(en(this.selected??this.selectedState,t,r==="single"?"single":"multiple"))}shareCrosshair(t){!this.syncId||this.lastCross===t||(this.lastCross=t,this.publish({crosshair:t}))}clearTip(){this.tip=[],this.portal=null,this.shareCrosshair(null)}canZoom(t){return!!(t.hit&&(this.zoomable||t.hit.brush))}canPan(t){return!!(t.map&&this.zoomable)}canEdit(t){return!!(this.editable&&t.edit)}brushing(){return this.selectionMode==="brush"||this.selectionMode==="lasso"}viewBox(t,r){return Le(t.currentTarget,t.clientX,t.clientY,r.width,r.height)}getSvgElement(){return this.renderRoot.querySelector("svg")}getLayout(){return this.layout}resetZoom(){this.setZoom(void 0)}zoomTo(t){this.setZoom(t)}focusItem(t){let r=this.layout;if(!r)return!1;let i=r.shapes.findIndex(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?Tn(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=tn(Ht(t),this.sized());if(this.layout=o,this.snapshotKind=r,this.snapshotConfiguration=s,o.issues!==this.reported){this.reported=o.issues;for(let b of o.issues??[])this.emit("skdx-data-issue",b)}let l=this.canZoom(o),a=this.canPan(o),d=this.canEdit(o),u=this.brushing(),h=l||a||d||u,g=!o.decorative&&gt(o).length>0,w=Ln(o),x=On(o,this.accessibleTable),m=typeof this.accessibleTable=="object"&&this.accessibleTable.caption||i,y=this.portal;return we`<svg
4
4
  xmlns="http://www.w3.org/2000/svg"
5
5
  viewBox="0 0 ${o.width} ${o.height}"
6
6
  width=${o.width}
7
7
  height=${o.height}
8
8
  role=${o.decorative?"presentation":"img"}
9
- aria-hidden=${o.decorative?"true":X}
10
- aria-label=${o.decorative?X:i}
9
+ aria-hidden=${o.decorative?"true":Y}
10
+ aria-label=${o.decorative?Y:i}
11
11
  aria-description=${W(o.description)}
12
- tabindex=${h?0:X}
12
+ tabindex=${g?0:Y}
13
13
  data-skdx-chart=${r}
14
- data-zoomable=${s||l?"":X}
15
- data-brushing=${d&&!(s||l)?"":X}
16
- data-editable=${c?"":X}
17
- style=${b?`--skdx-chart-duration:${b}`:X}
18
- font-family=${R.fontFamily}
19
- font-size=${R.fontSize}
20
- @pointermove=${o.tooltip||u?this.onPointerMove:X}
14
+ data-zoomable=${l||a?"":Y}
15
+ data-brushing=${u&&!(l||a)?"":Y}
16
+ data-editable=${d?"":Y}
17
+ style=${w?`--skdx-chart-duration:${w}`:Y}
18
+ font-family=${L.fontFamily}
19
+ font-size=${L.fontSize}
20
+ @pointermove=${o.tooltip||h?this.onPointerMove:Y}
21
21
  @pointerleave=${()=>{this.clearTip(),this.highlight(null)}}
22
- @pointerdown=${u?this.onPointerDown:X}
23
- @pointerup=${u?this.onPointerUp:X}
24
- @pointercancel=${u?this.onPointerUp:X}
25
- @wheel=${s||l?this.onWheel:X}
26
- @dblclick=${s||l?()=>l?this.setView(void 0):this.setZoom(void 0):X}
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:X}
28
+ @keydown=${g?this.onKeyDown:Y}
29
29
  @blur=${()=>{this.focused=null,this.highlight(null)}}
30
30
  >
31
31
  <title>${i}</title>
32
- ${o.description?ie`<desc>${o.description}</desc>`:X}
33
- ${b?ie`<style>${An}</style>`:X} ${_i(o)}
32
+ ${o.description?ie`<desc>${o.description}</desc>`:Y}
33
+ ${w?ie`<style>${Rn}</style>`:Y} ${Ui(o)}
34
34
  ${xt(o.shapes)}
35
- ${xt(this.tip.length||!this.crossState?this.tip:nn(o,this.crossState))}
36
- ${xt(xn(o,this.focused))} ${xt(this.overlay)}
35
+ ${xt(this.tip.length||!this.crossState?this.tip:an(o,this.crossState))}
36
+ ${xt(kn(o,this.focused))} ${xt(this.overlay)}
37
37
  </svg>
38
- ${m?ye`<div
38
+ ${y?we`<div
39
39
  role="tooltip"
40
40
  data-skdx-tooltip=${r}
41
- style="left:${m.x+12}px;top:${m.y+12}px"
41
+ style="left:${y.x+12}px;top:${y.y+12}px"
42
42
  >
43
- ${m.lines.map(x=>ye`<div>${x}</div>`)}
44
- </div>`:X}
45
- ${M?ye`<table data-skdx-table=${r}>
43
+ ${y.lines.map(b=>we`<div>${b}</div>`)}
44
+ </div>`:Y}
45
+ ${x?we`<table data-skdx-table=${r}>
46
46
  <caption>
47
- ${k}
47
+ ${m}
48
48
  </caption>
49
49
  <thead>
50
50
  <tr>
51
- ${(M[0]??[]).map(x=>ye`<th scope="col">${x}</th>`)}
51
+ ${(x[0]??[]).map(b=>we`<th scope="col">${b}</th>`)}
52
52
  </tr>
53
53
  </thead>
54
54
  <tbody>
55
- ${M.slice(1).map(x=>ye`<tr>
56
- ${x.map((y,f)=>f===0?ye`<th scope="row">${y}</th>`:ye`<td>${y}</td>`)}
55
+ ${x.slice(1).map(b=>we`<tr>
56
+ ${b.map((f,M)=>M===0?we`<th scope="row">${f}</th>`:we`<td>${f}</td>`)}
57
57
  </tr>`)}
58
58
  </tbody>
59
- </table>`:X}`}};V.styles=Ni`
59
+ </table>`:Y}`}};V.styles=Wi`
60
60
  :host {
61
61
  display: inline-block;
62
62
  }
@@ -109,4 +109,4 @@ var ti=Object.defineProperty;var ni=Object.getOwnPropertyDescriptor;var g=(e,n,t
109
109
  [role='tooltip'] > :first-child:not(:only-child) {
110
110
  font-weight: bold;
111
111
  }
112
- `,g([T({type:Number})],V.prototype,"width",2),g([T({type:Number})],V.prototype,"height",2),g([T()],V.prototype,"label",2),g([T({type:Boolean,reflect:!0})],V.prototype,"legend",2),g([T({type:Boolean,attribute:"no-tooltip",converter:Gi})],V.prototype,"tooltip",2),g([T({attribute:!1})],V.prototype,"format",2),g([T({attribute:!1})],V.prototype,"palette",2),g([T({attribute:!1})],V.prototype,"hiddenSeries",2),g([T({attribute:!1})],V.prototype,"selected",2),g([T({attribute:"selection-mode"})],V.prototype,"selectionMode",2),g([T({attribute:!1})],V.prototype,"highlighted",2),g([T({attribute:!1})],V.prototype,"highlightScope",2),g([T({type:Boolean,reflect:!0})],V.prototype,"loading",2),g([T()],V.prototype,"error",2),g([T({attribute:"empty-message"})],V.prototype,"emptyMessage",2),g([T()],V.prototype,"description",2),g([T({type:Boolean,reflect:!0})],V.prototype,"decorative",2),g([T({type:Boolean,attribute:"accessible-table"})],V.prototype,"accessibleTable",2),g([T({attribute:!1})],V.prototype,"zoom",2),g([T({attribute:!1})],V.prototype,"view",2),g([T({type:Boolean,reflect:!0})],V.prototype,"zoomable",2),g([T({type:Boolean,reflect:!0})],V.prototype,"editable",2),g([T({attribute:"sync-id"})],V.prototype,"syncId",2),g([T({type:Boolean,attribute:"cross-filter"})],V.prototype,"crossFilter",2),g([T({converter:{fromAttribute:t=>t===null?!1:t===""?!0:Number(t)}})],V.prototype,"animated",2),g([T({type:Boolean,reflect:!0})],V.prototype,"responsive",2),g([se()],V.prototype,"tip",2),g([se()],V.prototype,"overlay",2),g([se()],V.prototype,"portal",2),g([se()],V.prototype,"measured",2),g([se()],V.prototype,"viewState",2),g([se()],V.prototype,"highlightState",2),g([se()],V.prototype,"crossState",2),g([se()],V.prototype,"focused",2),g([se()],V.prototype,"hiddenState",2),g([se()],V.prototype,"zoomState",2),g([se()],V.prototype,"selectedState",2);var H=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:M,stackOffset:k,orientation:m,radius:x,barGap:y,barWidth:f,sort:w,transform:I,transforms:S,bins:O,binWidth:F,binDomain:E,binMode:B,sampling:Y,brush:J,crosshair:ae}=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:M,stackOffset:k,orientation:m,radius:x,barGap:y,barWidth:f,sort:w,transform:I,transforms:S,bins:O,binWidth:F,binDomain:E,binMode:B,sampling:Y,brush:J,crosshair:ae,...this.compactOverrides()}}};g([T({attribute:!1})],H.prototype,"series",2),g([T({attribute:!1})],H.prototype,"categories",2),g([T({attribute:!1})],H.prototype,"xAxis",2),g([T({attribute:!1})],H.prototype,"yAxis",2),g([T({attribute:!1})],H.prototype,"rightAxis",2),g([T({attribute:!1})],H.prototype,"references",2),g([T({attribute:!1})],H.prototype,"annotations",2),g([T({type:Boolean,reflect:!0})],H.prototype,"labels",2),g([T()],H.prototype,"curve",2),g([T({type:Boolean,attribute:"connect-nulls"})],H.prototype,"connectNulls",2),g([T()],H.prototype,"nulls",2),g([T({reflect:!0,converter:{fromAttribute:t=>t==="percent"?"percent":t!==null}})],H.prototype,"stacked",2),g([T({attribute:"stack-offset"})],H.prototype,"stackOffset",2),g([T()],H.prototype,"orientation",2),g([T({type:Number})],H.prototype,"radius",2),g([T({type:Number,attribute:"bar-gap"})],H.prototype,"barGap",2),g([T({type:Number,attribute:"bar-width"})],H.prototype,"barWidth",2),g([T()],H.prototype,"sort",2),g([T()],H.prototype,"transform",2),g([T({attribute:!1})],H.prototype,"transforms",2),g([T({type:Number})],H.prototype,"bins",2),g([T({type:Number,attribute:"bin-width"})],H.prototype,"binWidth",2),g([T({attribute:!1})],H.prototype,"binDomain",2),g([T({attribute:"bin-mode"})],H.prototype,"binMode",2),g([T({attribute:!1})],H.prototype,"sampling",2),g([T({type:Boolean,reflect:!0})],H.prototype,"brush",2),g([T({type:Boolean,reflect:!0})],H.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=${W(t.opacity)}></stop>`)}</linearGradient>`)}</defs>`:X,xt=e=>ie`${e.map((n,t)=>{let r=n.title?ie`<title>${n.title}</title>`:X,i=n.item?t:void 0;switch(n.kind){case"path":return ie`<path data-skdx-part=${n.part} data-skdx-i=${W(i)} d=${n.d} fill=${n.fill??"none"} stroke=${W(n.stroke)} stroke-width=${W(n.strokeWidth)} stroke-linecap=${W(n.strokeLinecap)} stroke-linejoin=${W(n.strokeLinejoin)} stroke-dasharray=${W(n.dash)} opacity=${W(n.opacity)} fill-opacity=${W(n.fillOpacity)}>${r}</path>`;case"rect":return ie`<rect data-skdx-part=${n.part} data-skdx-i=${W(i)} x=${n.x} y=${n.y} width=${n.width} height=${n.height} rx=${W(n.rx)} style=${W(ht(n.part)?`rx:${ht(n.part)}`:void 0)} fill=${n.fill} stroke=${W(n.stroke)} fill-opacity=${W(n.opacity)} pointer-events=${W(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=${W(i)} x1=${n.x1} y1=${n.y1} x2=${n.x2} y2=${n.y2} stroke=${n.stroke} stroke-width=${W(n.strokeWidth)} stroke-dasharray=${W(n.dash)} opacity=${W(n.opacity)}>${r}</line>`;case"circle":return ie`<circle data-skdx-part=${n.part} data-skdx-i=${W(i)} cx=${n.cx} cy=${n.cy} r=${n.r} fill=${n.fill} stroke=${W(n.stroke)} opacity=${W(n.opacity)}>${r}</circle>`;case"text":return ie`<text aria-label=${W(n.title)} data-skdx-part=${n.part} data-skdx-i=${W(i)} x=${n.x} y=${n.y} text-anchor=${W(n.anchor)} dominant-baseline=${W(n.baseline)} fill=${W(n.fill)} font-weight=${W(n.weight)} pointer-events=${W(i===void 0?"none":void 0)} transform=${W(n.rotate?`rotate(${n.rotate} ${n.x} ${n.y})`:void 0)}>${n.text}</text>`}})}`;var Q=class extends V{constructor(){super(...arguments);this.data=[];this.labels=!1}render(){let{data:t,name:r,color:i,bins:o,binWidth:s,thresholds:l,domain:c,mode:d,xAxis:u,yAxis:h,references:b,annotations:M,labels:k,barGap:m}=this;return this.root(Jt({...this.sized(),data:t,name:r,color:i,bins:o,binWidth:s,thresholds:l,domain:c,mode:d,xAxis:u,yAxis:h,references:b,annotations:M,labels:k,barGap:m,...this.compactOverrides()}),"histogram",this.label??"Histogram")}};g([ne({attribute:!1})],Q.prototype,"data",2),g([ne()],Q.prototype,"name",2),g([ne()],Q.prototype,"color",2),g([ne({type:Number})],Q.prototype,"bins",2),g([ne({type:Number,attribute:"bin-width"})],Q.prototype,"binWidth",2),g([ne({attribute:!1})],Q.prototype,"thresholds",2),g([ne({attribute:!1})],Q.prototype,"domain",2),g([ne()],Q.prototype,"mode",2),g([ne({attribute:!1})],Q.prototype,"xAxis",2),g([ne({attribute:!1})],Q.prototype,"yAxis",2),g([ne({attribute:!1})],Q.prototype,"references",2),g([ne({attribute:!1})],Q.prototype,"annotations",2),g([ne({type:Boolean,reflect:!0})],Q.prototype,"labels",2),g([ne({type:Number,attribute:"bar-gap"})],Q.prototype,"barGap",2),Q=g([Ei("skdx-histogram")],Q);export{Q as SkdxHistogram};
112
+ `,k([T({type:Number})],V.prototype,"width",2),k([T({type:Number})],V.prototype,"height",2),k([T()],V.prototype,"label",2),k([T({type:Boolean,reflect:!0})],V.prototype,"legend",2),k([T({type:Boolean,attribute:"no-tooltip",converter:Zi})],V.prototype,"tooltip",2),k([T({attribute:!1})],V.prototype,"format",2),k([T({attribute:!1})],V.prototype,"palette",2),k([T({attribute:!1})],V.prototype,"hiddenSeries",2),k([T({attribute:!1})],V.prototype,"selected",2),k([T({attribute:"selection-mode"})],V.prototype,"selectionMode",2),k([T({attribute:!1})],V.prototype,"highlighted",2),k([T({attribute:!1})],V.prototype,"highlightScope",2),k([T({type:Boolean,reflect:!0})],V.prototype,"loading",2),k([T()],V.prototype,"error",2),k([T({attribute:"empty-message"})],V.prototype,"emptyMessage",2),k([T()],V.prototype,"description",2),k([T({type:Boolean,reflect:!0})],V.prototype,"decorative",2),k([T({type:Boolean,attribute:"accessible-table"})],V.prototype,"accessibleTable",2),k([T({attribute:!1})],V.prototype,"zoom",2),k([T({attribute:!1})],V.prototype,"view",2),k([T({type:Boolean,reflect:!0})],V.prototype,"zoomable",2),k([T({type:Boolean,reflect:!0})],V.prototype,"editable",2),k([T({attribute:"sync-id"})],V.prototype,"syncId",2),k([T({type:Boolean,attribute:"cross-filter"})],V.prototype,"crossFilter",2),k([T({converter:{fromAttribute:t=>t===null?!1:t===""?!0:Number(t)}})],V.prototype,"animated",2),k([T({type:Boolean,reflect:!0})],V.prototype,"responsive",2),k([se()],V.prototype,"tip",2),k([se()],V.prototype,"overlay",2),k([se()],V.prototype,"portal",2),k([se()],V.prototype,"measured",2),k([se()],V.prototype,"viewState",2),k([se()],V.prototype,"highlightState",2),k([se()],V.prototype,"crossState",2),k([se()],V.prototype,"focused",2),k([se()],V.prototype,"hiddenState",2),k([se()],V.prototype,"zoomState",2),k([se()],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:g,stacked:w,stackOffset:x,orientation:m,radius:y,barGap:b,barWidth:f,sort:M,transform:I,transforms:S,bins:O,binWidth:D,binDomain:F,binMode:E,sampling:X,brush:J,crosshair:ae}=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:g,stacked:w,stackOffset:x,orientation:m,radius:y,barGap:b,barWidth:f,sort:M,transform:I,transforms:S,bins:O,binWidth:D,binDomain:F,binMode:E,sampling:X,brush:J,crosshair:ae,...this.compactOverrides()}}};k([T({attribute:!1})],Z.prototype,"series",2),k([T({attribute:!1})],Z.prototype,"categories",2),k([T({attribute:!1})],Z.prototype,"xAxis",2),k([T({attribute:!1})],Z.prototype,"yAxis",2),k([T({attribute:!1})],Z.prototype,"rightAxis",2),k([T({attribute:!1})],Z.prototype,"references",2),k([T({attribute:!1})],Z.prototype,"annotations",2),k([T({type:Boolean,reflect:!0})],Z.prototype,"labels",2),k([T()],Z.prototype,"curve",2),k([T({type:Boolean,attribute:"connect-nulls"})],Z.prototype,"connectNulls",2),k([T()],Z.prototype,"nulls",2),k([T({reflect:!0,converter:{fromAttribute:t=>t==="percent"?"percent":t!==null}})],Z.prototype,"stacked",2),k([T({attribute:"stack-offset"})],Z.prototype,"stackOffset",2),k([T()],Z.prototype,"orientation",2),k([T({type:Number})],Z.prototype,"radius",2),k([T({type:Number,attribute:"bar-gap"})],Z.prototype,"barGap",2),k([T({type:Number,attribute:"bar-width"})],Z.prototype,"barWidth",2),k([T()],Z.prototype,"sort",2),k([T()],Z.prototype,"transform",2),k([T({attribute:!1})],Z.prototype,"transforms",2),k([T({type:Number})],Z.prototype,"bins",2),k([T({type:Number,attribute:"bin-width"})],Z.prototype,"binWidth",2),k([T({attribute:!1})],Z.prototype,"binDomain",2),k([T({attribute:"bin-mode"})],Z.prototype,"binMode",2),k([T({attribute:!1})],Z.prototype,"sampling",2),k([T({type:Boolean,reflect:!0})],Z.prototype,"brush",2),k([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=${W(t.opacity)}></stop>`)}</linearGradient>`)}</defs>`:Y,xt=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=${W(i)} d=${n.d} fill=${n.fill??"none"} stroke=${W(n.stroke)} stroke-width=${W(n.strokeWidth)} stroke-linecap=${W(n.strokeLinecap)} stroke-linejoin=${W(n.strokeLinejoin)} stroke-dasharray=${W(n.dash)} opacity=${W(n.opacity)} fill-opacity=${W(n.fillOpacity)}>${r}</path>`;case"rect":return ie`<rect data-skdx-part=${n.part} data-skdx-i=${W(i)} x=${n.x} y=${n.y} width=${n.width} height=${n.height} rx=${W(n.rx)} style=${W(ft(n.part)?`rx:${ft(n.part)}`:void 0)} fill=${n.fill} stroke=${W(n.stroke)} fill-opacity=${W(n.opacity)} pointer-events=${W(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=${W(i)} x1=${n.x1} y1=${n.y1} x2=${n.x2} y2=${n.y2} stroke=${n.stroke} stroke-width=${W(n.strokeWidth)} stroke-dasharray=${W(n.dash)} opacity=${W(n.opacity)}>${r}</line>`;case"circle":return ie`<circle data-skdx-part=${n.part} data-skdx-i=${W(i)} cx=${n.cx} cy=${n.cy} r=${n.r} fill=${n.fill} stroke=${W(n.stroke)} opacity=${W(n.opacity)}>${r}</circle>`;case"text":return ie`<text aria-label=${W(n.title)} data-skdx-part=${n.part} data-skdx-i=${W(i)} x=${n.x} y=${n.y} text-anchor=${W(n.anchor)} dominant-baseline=${W(n.baseline)} fill=${W(n.fill)} font-weight=${W(n.weight)} pointer-events=${W(i===void 0?"none":void 0)} transform=${W(n.rotate?`rotate(${n.rotate} ${n.x} ${n.y})`:void 0)}>${n.text}</text>`}})}`;var Q=class extends V{constructor(){super(...arguments);this.data=[];this.labels=!1}render(){let{data:t,name:r,color:i,bins:s,binWidth:o,thresholds:l,domain:a,mode:d,xAxis:u,yAxis:h,references:g,annotations:w,labels:x,barGap:m}=this,y={...this.sized(),data:t,name:r,color:i,bins:s,binWidth:o,thresholds:l,domain:a,mode:d,xAxis:u,yAxis:h,references:g,annotations:w,labels:x,barGap:m,...this.compactOverrides()};return this.root(nn(y),"histogram",this.label??"Histogram",y)}};k([ne({attribute:!1})],Q.prototype,"data",2),k([ne()],Q.prototype,"name",2),k([ne()],Q.prototype,"color",2),k([ne({type:Number})],Q.prototype,"bins",2),k([ne({type:Number,attribute:"bin-width"})],Q.prototype,"binWidth",2),k([ne({attribute:!1})],Q.prototype,"thresholds",2),k([ne({attribute:!1})],Q.prototype,"domain",2),k([ne()],Q.prototype,"mode",2),k([ne({attribute:!1})],Q.prototype,"xAxis",2),k([ne({attribute:!1})],Q.prototype,"yAxis",2),k([ne({attribute:!1})],Q.prototype,"references",2),k([ne({attribute:!1})],Q.prototype,"annotations",2),k([ne({type:Boolean,reflect:!0})],Q.prototype,"labels",2),k([ne({type:Number,attribute:"bar-gap"})],Q.prototype,"barGap",2),Q=k([Ki("skdx-histogram")],Q);export{Q as SkdxHistogram};