@skdx/web-components-charts 0.38.0 → 0.40.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 (167) hide show
  1. package/dist/area.cjs +38 -35
  2. package/dist/area.d.cts +1 -1
  3. package/dist/area.d.ts +1 -1
  4. package/dist/area.js +28 -25
  5. package/dist/bar.cjs +38 -35
  6. package/dist/bar.d.cts +1 -1
  7. package/dist/bar.d.ts +1 -1
  8. package/dist/bar.js +28 -25
  9. package/dist/boxplot.cjs +33 -30
  10. package/dist/boxplot.d.cts +1 -1
  11. package/dist/boxplot.d.ts +1 -1
  12. package/dist/boxplot.js +40 -37
  13. package/dist/bubble.cjs +37 -34
  14. package/dist/bubble.d.cts +1 -1
  15. package/dist/bubble.d.ts +1 -1
  16. package/dist/bubble.js +25 -22
  17. package/dist/bullet.cjs +40 -37
  18. package/dist/bullet.d.cts +1 -1
  19. package/dist/bullet.d.ts +1 -1
  20. package/dist/bullet.js +40 -37
  21. package/dist/bump.cjs +38 -35
  22. package/dist/bump.d.cts +1 -1
  23. package/dist/bump.d.ts +1 -1
  24. package/dist/bump.js +38 -35
  25. package/dist/candlestick.cjs +38 -35
  26. package/dist/candlestick.d.cts +1 -1
  27. package/dist/candlestick.d.ts +1 -1
  28. package/dist/candlestick.js +40 -37
  29. package/dist/chord.cjs +40 -37
  30. package/dist/chord.d.cts +1 -1
  31. package/dist/chord.d.ts +1 -1
  32. package/dist/chord.js +38 -35
  33. package/dist/circle-packing.cjs +31 -28
  34. package/dist/circle-packing.d.cts +1 -1
  35. package/dist/circle-packing.d.ts +1 -1
  36. package/dist/circle-packing.js +30 -27
  37. package/dist/combo.cjs +38 -35
  38. package/dist/combo.d.cts +1 -1
  39. package/dist/combo.d.ts +1 -1
  40. package/dist/combo.js +28 -25
  41. package/dist/dumbbell.cjs +37 -34
  42. package/dist/dumbbell.d.cts +1 -1
  43. package/dist/dumbbell.d.ts +1 -1
  44. package/dist/dumbbell.js +40 -37
  45. package/dist/funnel.cjs +30 -27
  46. package/dist/funnel.d.cts +1 -1
  47. package/dist/funnel.d.ts +1 -1
  48. package/dist/funnel.js +40 -37
  49. package/dist/gantt.cjs +40 -37
  50. package/dist/gantt.d.cts +1 -1
  51. package/dist/gantt.d.ts +1 -1
  52. package/dist/gantt.js +30 -27
  53. package/dist/gauge.cjs +35 -32
  54. package/dist/gauge.d.cts +1 -1
  55. package/dist/gauge.d.ts +1 -1
  56. package/dist/gauge.js +39 -36
  57. package/dist/heatmap.cjs +38 -35
  58. package/dist/heatmap.d.cts +1 -1
  59. package/dist/heatmap.d.ts +1 -1
  60. package/dist/heatmap.js +30 -27
  61. package/dist/histogram.cjs +40 -37
  62. package/dist/histogram.d.cts +1 -1
  63. package/dist/histogram.d.ts +1 -1
  64. package/dist/histogram.js +30 -27
  65. package/dist/icicle.cjs +40 -37
  66. package/dist/icicle.d.cts +1 -1
  67. package/dist/icicle.d.ts +1 -1
  68. package/dist/icicle.js +40 -37
  69. package/dist/{index-oF5ss8v9.d.cts → index-D44-61v7.d.cts} +11 -5
  70. package/dist/{index-oF5ss8v9.d.ts → index-D44-61v7.d.ts} +11 -5
  71. package/dist/index.cjs +40 -37
  72. package/dist/index.d.cts +2 -2
  73. package/dist/index.d.ts +2 -2
  74. package/dist/index.js +40 -37
  75. package/dist/line.cjs +38 -35
  76. package/dist/line.d.cts +1 -1
  77. package/dist/line.d.ts +1 -1
  78. package/dist/line.js +28 -25
  79. package/dist/linear-gauge.cjs +40 -37
  80. package/dist/linear-gauge.d.cts +1 -1
  81. package/dist/linear-gauge.d.ts +1 -1
  82. package/dist/linear-gauge.js +40 -37
  83. package/dist/map.cjs +40 -37
  84. package/dist/map.d.cts +1 -1
  85. package/dist/map.d.ts +1 -1
  86. package/dist/map.js +40 -37
  87. package/dist/marimekko.cjs +32 -29
  88. package/dist/marimekko.d.cts +1 -1
  89. package/dist/marimekko.d.ts +1 -1
  90. package/dist/marimekko.js +33 -30
  91. package/dist/network.cjs +26 -23
  92. package/dist/network.d.cts +1 -1
  93. package/dist/network.d.ts +1 -1
  94. package/dist/network.js +40 -37
  95. package/dist/organization.cjs +29 -26
  96. package/dist/organization.d.cts +1 -1
  97. package/dist/organization.d.ts +1 -1
  98. package/dist/organization.js +40 -37
  99. package/dist/parallel.cjs +25 -22
  100. package/dist/parallel.d.cts +1 -1
  101. package/dist/parallel.d.ts +1 -1
  102. package/dist/parallel.js +37 -34
  103. package/dist/pareto.cjs +40 -37
  104. package/dist/pareto.d.cts +1 -1
  105. package/dist/pareto.d.ts +1 -1
  106. package/dist/pareto.js +26 -23
  107. package/dist/pie.cjs +40 -37
  108. package/dist/pie.d.cts +1 -1
  109. package/dist/pie.d.ts +1 -1
  110. package/dist/pie.js +39 -36
  111. package/dist/polar-area.cjs +40 -37
  112. package/dist/polar-area.d.cts +1 -1
  113. package/dist/polar-area.d.ts +1 -1
  114. package/dist/polar-area.js +40 -37
  115. package/dist/radar.cjs +27 -24
  116. package/dist/radar.d.cts +1 -1
  117. package/dist/radar.d.ts +1 -1
  118. package/dist/radar.js +40 -37
  119. package/dist/radial.cjs +39 -36
  120. package/dist/radial.d.cts +1 -1
  121. package/dist/radial.d.ts +1 -1
  122. package/dist/radial.js +39 -36
  123. package/dist/range.cjs +40 -37
  124. package/dist/range.d.cts +1 -1
  125. package/dist/range.d.ts +1 -1
  126. package/dist/range.js +30 -27
  127. package/dist/sankey.cjs +29 -26
  128. package/dist/sankey.d.cts +1 -1
  129. package/dist/sankey.d.ts +1 -1
  130. package/dist/sankey.js +40 -37
  131. package/dist/scatter.cjs +38 -35
  132. package/dist/scatter.d.cts +1 -1
  133. package/dist/scatter.d.ts +1 -1
  134. package/dist/scatter.js +31 -28
  135. package/dist/sparkline.cjs +23 -20
  136. package/dist/sparkline.d.cts +1 -1
  137. package/dist/sparkline.d.ts +1 -1
  138. package/dist/sparkline.js +38 -35
  139. package/dist/sunburst.cjs +40 -37
  140. package/dist/sunburst.d.cts +1 -1
  141. package/dist/sunburst.d.ts +1 -1
  142. package/dist/sunburst.js +40 -37
  143. package/dist/swarm.cjs +36 -33
  144. package/dist/swarm.d.cts +1 -1
  145. package/dist/swarm.d.ts +1 -1
  146. package/dist/swarm.js +37 -34
  147. package/dist/timeline.cjs +24 -21
  148. package/dist/timeline.d.cts +1 -1
  149. package/dist/timeline.d.ts +1 -1
  150. package/dist/timeline.js +40 -37
  151. package/dist/tree.cjs +24 -21
  152. package/dist/tree.d.cts +1 -1
  153. package/dist/tree.d.ts +1 -1
  154. package/dist/tree.js +38 -35
  155. package/dist/treemap.cjs +27 -24
  156. package/dist/treemap.d.cts +1 -1
  157. package/dist/treemap.d.ts +1 -1
  158. package/dist/treemap.js +40 -37
  159. package/dist/waffle.cjs +21 -18
  160. package/dist/waffle.d.cts +1 -1
  161. package/dist/waffle.d.ts +1 -1
  162. package/dist/waffle.js +37 -34
  163. package/dist/waterfall.cjs +33 -30
  164. package/dist/waterfall.d.cts +1 -1
  165. package/dist/waterfall.d.ts +1 -1
  166. package/dist/waterfall.js +34 -31
  167. package/package.json +3 -3
package/dist/scatter.cjs CHANGED
@@ -1,61 +1,62 @@
1
- "use strict";var ve=Object.defineProperty;var It=Object.getOwnPropertyDescriptor;var fn=Object.getOwnPropertyNames;var mn=Object.prototype.hasOwnProperty;var bn=(e,n)=>{for(var t in n)ve(e,t,{get:n[t],enumerable:!0})},xn=(e,n,t,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of fn(n))!mn.call(e,i)&&i!==t&&ve(e,i,{get:()=>n[i],enumerable:!(r=It(n,i))||r.enumerable});return e};var gn=e=>xn(ve({},"__esModule",{value:!0}),e),g=(e,n,t,r)=>{for(var i=r>1?void 0:r?It(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&&ve(n,t,i),i};var Vn={};bn(Vn,{SkdxScatterChart:()=>P});module.exports=gn(Vn);var N=require("lit/decorators.js");var Tt=e=>Number(e.toPrecision(12)),yn,vn=e=>(yn??(yn=new Intl.NumberFormat)).format(Tt(e)),wn=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 we(e){if(e===void 0)return vn;if(typeof e=="function")return e;let{style:n,locale:t,digits:r,unit:i="",timeZone:o}=e,s=d=>i?u=>d(u)+i:d,l=d=>r===void 0?d===void 0?{}:{maximumFractionDigits:d}:{minimumFractionDigits:r,maximumFractionDigits:r},a=d=>{let u=new Intl.NumberFormat(t,d);return s(m=>u.format(Tt(m)))},c=d=>{let u=new Intl.DateTimeFormat(t,o?{...d,timeZone:o}:d);return m=>u.format(m)};switch(n){case"integer":return a({maximumFractionDigits:0});case"decimal":return a(l(2));case"percent":return a({style:"percent",...l(0)});case"currency":return a({style:"currency",currency:e.currency??"USD",...l()});case"compact":return a({notation:"compact",...l(1)});case"scientific":return a({notation:"scientific",...l(2)});case"date":return c({dateStyle:"medium"});case"time":return c({timeStyle:"short"});case"datetime":return c({dateStyle:"medium",timeStyle:"short"});case"duration":return s(wn)}}var zt=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 Se([e,n],[t,r]){let i=n-e;return o=>i===0?t:t+(o-e)/i*(r-t)}function ke(e,n,t=5){if(e===n)return[e];let r=(n-e)/Math.max(1,t),i=10**Math.floor(Math.log10(r)),o=r/i,s=(o<1.5?1:o<3.5?2:o<7.5?5:10)*i,l=Math.floor(e/s)*s,a=Math.ceil(n/s)*s,c=[];for(let d=l;d<=a+s/2;d+=s)c.push(At(d));return c}var At=e=>Number(e.toPrecision(12)),h=e=>Number(e.toFixed(2)),ie=e=>typeof e=="number"&&Number.isFinite(e);function oe(e){let n=1/0,t=-1/0;for(let r of e)ie(r)&&(r<n&&(n=r),r>t&&(t=r));return n===1/0?[0,0]:[n,t]}function Ot(e,n="linear"){if(e.length===0)return"";let t=e[0];if(n==="step"||n==="stepBefore"||n==="stepAfter"){let c=`M${t.x} ${t.y}`;for(let d=1;d<e.length;d++){let u=e[d-1],m=e[d];n==="stepAfter"?c+=`H${m.x}V${m.y}`:n==="stepBefore"?c+=`V${m.y}H${m.x}`:c+=`H${h((u.x+m.x)/2)}V${m.y}H${m.x}`}return c}if(n==="linear"||e.length<3)return`M${e.map(c=>`${c.x} ${c.y}`).join("L")}`;let r=e.length,i=e.slice(1).map((c,d)=>c.x-e[d].x),o=e.slice(1).map((c,d)=>c.y-e[d].y),s=i.map((c,d)=>c===0?0:o[d]/c),l=[s[0]];for(let c=1;c<r-1;c++){let d=s[c-1],u=s[c];l.push(d*u<=0?0:(d+u)/2)}l.push(s[r-2]);for(let c=0;c<r-1;c++){let d=s[c];if(d===0){l[c]=0,l[c+1]=0;continue}let u=l[c]/d,m=l[c+1]/d,b=Math.hypot(u,m);b>3&&(l[c]=3*u*d/b,l[c+1]=3*m*d/b)}let a=`M${t.x} ${t.y}`;for(let c=0;c<r-1;c++){let d=e[c],u=e[c+1],m=i[c]/3;a+=`C${h(d.x+m)} ${h(d.y+m*l[c])} ${h(u.x-m)} ${h(u.y-m*l[c+1])} ${u.x} ${u.y}`}return a}var de=1e3,ue=60*de,he=60*ue,Me=24*he,qn=[de,5*de,15*de,30*de,ue,5*ue,15*ue,30*ue,he,3*he,6*he,12*he,Me,2*Me,7*Me,14*Me];function Lt(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(At(l*10**s));return o.filter(s=>s>=e/1.0001&&s<=n*1.0001)}var Mn=/-?\d*\.?\d+(?:e[-+]?\d+)?/gi,Sn=/([MLTHVCSQAZmlthvcsqaz])([^MLTHVCSQAZmlthvcsqaz]*)/g,kn={M:2,L:2,T:2,C:6,S:4,Q:4,A:7,H:-1,V:-2};function $n(e,n,t){return e.replace(Sn,(r,i,o)=>{let s=kn[i];if(s===void 0)return i+o;let a=(o.match(Mn)??[]).map((c,d)=>{let u=Number(c);if(s===-1)return String(u+n);if(s===-2)return String(u+t);let m=d%s;return s===7?m===5?String(u+n):m===6?String(u+t):c:String(m%2===0?u+n:u+t)});return i+a.join(" ")})}var Rt=(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:$n(r.d,n,t)}}});var Be=["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)"))),$={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)"},$e=(e="neutral")=>e==="neutral"?$.axis:`var(--skdx-color-${e}-500)`,Ne=(e="neutral")=>e==="neutral"?$.label:e==="primary"?"var(--skdx-color-text-accent)":`var(--skdx-color-text-${e})`,Pt=(e,n)=>n??Be[e%Be.length];var se={top:16,right:16,bottom:32,left:48};function Bt(e,n,t=se){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 pe(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 Ce=20,Cn=120,Dt=e=>{let n=pe(e);return n&&(n.position==="left"||n.position==="right")?n.width??Cn:0},Fe=(e,n=600,t=300)=>({width:(e.width??n)-Dt(e),height:(e.height??t)-(pe(e)?.position==="bottom"?Ce:0)}),Ft=e=>{let n=pe(e);return n&&(n.position===void 0||n.position==="top")?Ce:0},U=6.5,Ie=(e,n,t)=>t??(e.palette&&e.palette.length>0?e.palette[n%e.palette.length]:Pt(n)),Gt=(e,n)=>e.hiddenSeries?.includes(n)??!1;function De(e,n,t=[],r={},i=10,o=8,s=!1){let l=[],a=r.maxItems,c=a!==void 0&&a>=0&&e.length>a?e.slice(0,a):e,d=e.length-c.length,u=r.interactive??!0,m=o,b=i,x=(p,f,y,w)=>{let I=(f?18:4)+p.length*U;m>o&&(s||m+I>n-8)&&(m=o,b+=Ce),f&&l.push({kind:"rect",part:"legend-swatch",x:m,y:b-5,width:10,height:10,fill:f,opacity:w?.3:void 0,item:y}),l.push({kind:"text",part:"legend-label",x:m+(f?14:0),y:b,text:p,baseline:"middle",fill:w?$.grid:$.label,item:y}),m+=I+12};for(let p of c){let f=t.includes(p.name),y=u?{label:p.name,series:p.name,legend:!0}:void 0;x(r.formatter?.(p.name)??p.name,p.color,y,f)}return d>0&&x(`+${d} more`,void 0,void 0,!1),r.align==="end"?In(l,n):l}function In(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*U)),s=n-8-o;for(let l of i)r.push({...l,x:l.x+s})}return r}var Tn=(e,n,t={})=>new Set(De(e,n,[],t).flatMap(r=>r.kind==="text"?[r.y]:[])).size;function Ge(e,n,t,r=[]){let i=pe(e),o=i&&e.direction==="rtl"&&i.align===void 0?{...i,align:"end"}:i,s=Nt(e),l=o?.position==="bottom",a=Dt(e),c=e.hiddenSeries??[],d=o?a?De(r,1/0,c,o,10,(o.position==="right"?n:0)+8,!0):De(r,n,c,o,l?t+10:10):[],u=l?Tn(r,n,o):0;return{width:n+a,height:l?t+Math.max(1,u)*Ce:t,legendOffset:o?.position==="left"?a: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:d}}function je(e){let n=e.legendOffset;if(!n)return e;let t=[...Rt(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,o=e.edit,s=o?{...o,scale:a=>o.scale(a)+n,invert:a=>o.invert(a-n),bars:o.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:s,map:l,legendOffset:void 0}}function Te(e,n,t,r,i,o="auto"){let s=Array.isArray(t)?t:[t],l=Math.max(...s.map(m=>m.length))*U+12,a=6+s.length*16,c=o==="top"?{x:e-l/2,y:n-a-8}:o==="bottom"?{x:e-l/2,y:n+8}:o==="left"?{x:e-l-8,y:n-a/2}:o==="right"?{x:e+8,y:n-a/2}:{x:e+12,y:n-a-6},d=Math.max(0,Math.min(r-l,c.x)),u=Math.max(0,Math.min(i-a,c.y));return[{kind:"rect",part:"tooltip",x:h(d),y:h(u),width:h(l),height:a,fill:"var(--skdx-color-surface-raised)",stroke:$.axis,rx:3},...s.map((m,b)=>({kind:"text",part:"tooltip-label",x:h(d+6),y:h(u+11+b*16),text:m,baseline:"middle",fill:"var(--skdx-color-text-default)",weight:s.length>1&&b===0?"bold":void 0}))]}function _e(e,n){let[t,r]=oe(e);return n?[Math.min(0,t),Math.max(0,r)]:[t,r]}function He([e,n],t,r=!1,i){let o=typeof r=="boolean"?{scale:r?"log":"linear"}:r,s=we(o.format??i),l=o.min??e,a=o.max??n;o.reversed&&(t=[t[1],t[0]]);let c={id:o.id,position:o.position,options:o};if(o.scale==="sqrt"){let p=M=>Math.sign(M)*Math.sqrt(Math.abs(M)),f=o.nice===!1?[l,a]:ke(l,a,o.ticks),y=o.min??f[0],w=o.max??f[f.length-1],I=Se([p(y),p(w)],t),A=M=>I(p(M)),L=ke(y,w,o.ticks).filter(M=>M>=y-1e-9&&M<=w+1e-9);return{...c,scale:A,domain:[y,w],format:s,ticks:(L.length>=2?L:[y,w]).map(M=>({pos:h(A(M)),label:s(M)})),zero:h(A(Math.min(Math.max(0,y),w)))}}if(o.scale==="log"){let p=Math.max(l,Number.EPSILON),f=Math.max(a,p),y=Lt(p,f),w=[Math.log10(p),Math.log10(f)],I=Se(w,t),A=L=>I(Math.log10(Math.max(L,Number.EPSILON)));return{...c,scale:A,domain:w,format:s,ticks:y.map(L=>({pos:h(A(L)),label:s(L)})),zero:h(t[0])}}let d=ke(l,a,o.ticks),u=[o.min??(o.nice===!1?l:d[0]),o.max??(o.nice===!1?a:d[d.length-1])],m=Se(u,t),b=d.filter(p=>p>=u[0]-1e-9&&p<=u[1]+1e-9),x=(b.length>=2?b:[u[0],u[1]]).map(p=>({pos:h(m(p)),label:s(p)}));return{...c,scale:m,domain:u,format:s,ticks:x,zero:h(m(Math.min(Math.max(0,u[0]),u[1])))}}function jt(e,n,t,r){let i=e.error!==void 0?"error":e.loading?"loading":n?"empty":null;if(!i)return null;let{width:o,height:s}=Fe(e,t,r),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:o,height:s,fill:"var(--skdx-color-surface-sunken)",rx:4}),a.push({kind:"text",part:`state-${i}`,x:h(o/2),y:h(s/2),text:l,anchor:"middle",baseline:"middle",fill:i==="error"?"var(--skdx-color-text-danger)":$.label}),{...Ge(e,o,s),shapes:a,tooltip:!1}}function _t(e,n={}){let{plot:t,xTicks:r,yTicks:i,baseline:o}=e,s=t.x+t.width,l=t.y+t.height,a=[],c=n.grid??!0,d=(x,p)=>p?{kind:"line",part:"grid",x1:x.pos,x2:x.pos,y1:t.y,y2:l,stroke:$.grid}:{kind:"line",part:"grid",x1:t.x,x2:s,y1:x.pos,y2:x.pos,stroke:$.grid},u=n.x?.tickRotation??0,m=(x,p,f,y)=>u?R(x,p,f,{part:y,anchor:u<0?"end":"start",baseline:"middle",rotate:u}):R(x,p,f,{part:y,anchor:"middle"}),b=(x,p,f,y,w)=>{for(let I of x)a.push(p==="x"?{kind:"line",part:"tick",x1:I.pos,x2:I.pos,y1:f,y2:h(f+y*w),stroke:$.axis}:{kind:"line",part:"tick",x1:f,x2:h(f+y*w),y1:I.pos,y2:I.pos,stroke:$.axis})};if(n.categoryGrid)for(let x of r)a.push(d(x,!n.horizontal));if(n.horizontal){let x=n.axes??[{ticks:i,position:"bottom",offset:0,label:n.yLabel,...n.y}];if(c)for(let p of i)a.push(d(p,!0));x[0]?.showLine!==!1&&a.push({kind:"line",part:"axis",x1:o,x2:o,y1:t.y,y2:l,stroke:$.axis});for(let p of x){let f=p.position==="top"||p.position==="right",y=h(f?t.y-p.offset:l+p.offset),w=f||p.offset>0;p.showLine&&w&&a.push({kind:"line",part:"axis",x1:t.x,x2:s,y1:y,y2:y,stroke:$.axis}),p.showTicks&&b(p.ticks,"x",y,f?-1:1,p.tickSize??4);let I=h(f?y-8:y+20);for(let A of p.ticks)a.push(f?R(A.pos,I,A.label,{part:"x-label-top",anchor:"middle"}):m(A.pos,I,A.label,"x-label"));p.label&&a.push(w?R(4,I,p.label,{part:"axis-title",anchor:"start",baseline:f?void 0:"middle"}):R(4,t.y-6,p.label,{part:"axis-title",anchor:"start"}))}n.x?.showLine&&a.push({kind:"line",part:"axis",x1:n.rtl?s:t.x,x2:n.rtl?s:t.x,y1:t.y,y2:l,stroke:$.axis}),n.x?.showTicks&&b(r,"y",n.rtl?s:t.x,n.rtl?1:-1,n.x.tickSize??4);for(let p of r)a.push(n.rtl?R(s+8,p.pos,p.label,{part:"y-label",anchor:"start",baseline:"middle"}):R(t.x-8,p.pos,p.label,{part:"y-label",anchor:"end",baseline:"middle"}))}else{if(c)for(let p of i)a.push(d(p,!1));n.y?.showLine!==!1&&a.push({kind:"line",part:"axis",x1:t.x,x2:s,y1:o,y2:o,stroke:$.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 p of x){let f=p.position==="left",y=f?t.x-p.offset:s+p.offset,w=f?"y-label":"y-label-right";p.showLine&&a.push({kind:"line",part:"axis",x1:h(y),x2:h(y),y1:t.y,y2:l,stroke:$.axis}),p.showTicks&&b(p.ticks,"y",h(y),f?-1:1,p.tickSize??4);for(let I of p.ticks)a.push(R(h(f?y-8:y+8),I.pos,I.label,{part:w,anchor:f?"end":"start",baseline:"middle"}));p.label&&a.push(R(h(f?p.offset===0?4:Math.max(4,y-40):p.offset===0?e.width-4:Math.min(e.width-4,y+40)),t.y-6,p.label,{part:"axis-title",anchor:f?"start":"end"}))}n.x?.showTicks&&b(r,"x",l,1,n.x.tickSize??4);for(let p of r)a.push(m(p.pos,l+(u?12:20),p.label,"x-label"))}return n.xLabel&&a.push(R(h(t.x+t.width/2),e.height-4,n.xLabel,{part:"axis-title",anchor:"middle"})),n.horizontal&&n.rightLabel&&a.push(R(e.width-4,t.y-6,n.rightLabel,{part:"axis-title",anchor:"end"})),a}var R=(e,n,t,r={})=>({kind:"text",part:"label",x:e,y:n,text:t,fill:$.label,...r}),Ht=(e,n,t,r,i,o)=>({kind:"circle",part:"point",cx:e,cy:n,r:t,fill:r,title:i,item:o});function Ze(e,n){let t=[],{plot:r}=n,i=r.x+r.width,o=r.y+r.height,s=a=>Math.max(r.x,Math.min(i,a)),l=a=>Math.max(r.y,Math.min(o,a));for(let a of e??[]){let c=a.color??$e(a.variant),d=a.color??Ne(a.variant),u={part:"reference-label",fill:d},m=n.horizontal===!0;if("y"in a){let b=h(n.y(a.y,a.axis??"left"));if(m){let x=s(b);t.push(...Et(x,r.y,o,c,a.label,u))}else{let x=l(b);t.push(...Zt(r.x,i,x,c,a.label,u))}}else if("x"in a){let b=n.x(a.x);if(b===void 0)continue;m?t.push(...Zt(r.x,i,l(h(b)),c,a.label,u)):t.push(...Et(s(h(b)),r.y,o,c,a.label,u))}else if("y1"in a){let b=h(n.y(a.y1,a.axis??"left")),x=h(n.y(a.y2,a.axis??"left"));m?t.push(...Wt(s(Math.min(b,x)),s(Math.max(b,x)),r,c,a.label,d)):t.push(...Vt(l(Math.min(b,x)),l(Math.max(b,x)),r,c,a.label,d))}else{let b=n.x(a.x1),x=n.x(a.x2);if(b===void 0||x===void 0)continue;let p=h(Math.min(b,x)),f=h(Math.max(b,x));m?t.push(...Vt(l(p),l(f),r,c,a.label,d)):t.push(...Wt(s(p),s(f),r,c,a.label,d))}}return t}function Zt(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,R(n-4,t-5,i,{...o,anchor:"end"})]:[s]}function Et(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,R(e+4,n+10,i,{...o,anchor:"start"})]:[s]}function Vt(e,n,t,r,i,o){let s={kind:"rect",part:"reference-area",x:t.x,y:e,width:t.width,height:h(Math.max(0,n-e)),fill:r,opacity:.12,title:i};return i?[s,R(t.x+t.width-4,e+12,i,{part:"reference-label",fill:o,anchor:"end"})]:[s]}function Wt(e,n,t,r,i,o){let s={kind:"rect",part:"reference-area",x:e,y:t.y,width:h(Math.max(0,n-e)),height:t.height,fill:r,opacity:.12,title:i};return i?[s,R(e+4,t.y+12,i,{part:"reference-label",fill:o,anchor:"start"})]:[s]}function Ut(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??$e(s.variant),a=s.color??Ne(s.variant),c=(x,p,f)=>{let y=n.x(x);if(y===void 0)return;let w=n.y(p,f??"left");return n.horizontal?{x:h(w),y:h(y)}:{x:h(y),y:h(w)}},d=s.id??s.label,u=x=>({label:x,id:d,name:s.label});if(s.type==="line"||s.type==="band"){let{type:x,id:p,...f}=s;t.push(...Ze([f],n));continue}if(s.type==="rect"){let x=c(s.x1,s.y1,s.axis),p=c(s.x2,s.y2,s.axis);if(!x||!p)continue;let f=Math.max(r.x,Math.min(x.x,p.x)),y=Math.max(r.y,Math.min(x.y,p.y)),w=s.label??"";t.push({kind:"rect",part:"annotation-rect",x:h(f),y:h(y),width:h(Math.max(0,Math.min(i,Math.max(x.x,p.x))-f)),height:h(Math.max(0,Math.min(o,Math.max(x.y,p.y))-y)),fill:l,opacity:.12,stroke:l,title:w||void 0,item:w?u(w):void 0}),s.label&&t.push(R(h(f+4),h(y+12),s.label,{part:"annotation-label",fill:a}));continue}let m=c(s.x,s.y,s.axis);if(!m)continue;if(s.type==="text"){t.push(R(m.x,m.y,s.text,{part:"annotation-text",fill:a,anchor:"middle",baseline:"middle",title:s.label}));continue}let b=s.label??`${String(s.x)}, ${s.y}`;if(t.push({kind:"circle",part:"annotation-point",cx:m.x,cy:m.y,r:5,fill:l,stroke:"var(--skdx-color-surface-default)",title:b,item:u(b)}),s.type==="callout"&&s.label){let[x,p]=s.offset??[16,-16],f=h(Math.max(r.x,Math.min(i,m.x+x))),y=h(Math.max(r.y,Math.min(o,m.y+p)));t.push({kind:"line",part:"annotation-leader",x1:m.x,y1:m.y,x2:f,y2:y,stroke:l},R(f,y,s.label,{part:"annotation-label",fill:a,anchor:x>=0?"start":"end",baseline:"middle"}))}}return t}var fe=e=>Math.max(0,Math.min(1,e));function qt(e){let n=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());if(n){let r=n[1],i=r.length===3?r.split("").map(o=>o+o).join(""):r;return[0,2,4].map(o=>parseInt(i.slice(o,o+2),16))}let t=/^rgba?\(\s*(\d+)[\s,]+(\d+)[\s,]+(\d+)/i.exec(e.trim());return t?[Number(t[1]),Number(t[2]),Number(t[3])]:void 0}function Kt(e,n){if(e.length===0)return $.axis;if(e.length===1)return e[0];let t=fe(n)*(e.length-1),r=Math.min(e.length-2,Math.floor(t)),i=t-r,o=qt(e[r]),s=qt(e[r+1]);if(!o||!s)return e[Math.round(t)];let l=a=>Math.round(o[a]+(s[a]-o[a])*i);return`rgb(${l(0)}, ${l(1)}, ${l(2)})`}var Yt=(e,n)=>n!==void 0&&n>=2?Math.min(n-1,Math.floor(fe(e)*n))/(n-1):fe(e);function Xt(e,n,t,r=$.negative,i=String){let[o,s]=oe(n),l=e??{type:"sequential"},a=f=>h(.15+.85*f);if(l.type==="threshold"){let{thresholds:f,colors:y,labels:w}=l,I=L=>{if(typeof L!="number"||!Number.isFinite(L))return;let M=0;for(;M<f.length&&L>=f[M];)M++;return{fill:y[Math.min(M,y.length-1)]??t,opacity:1}},A=y.map((L,M)=>({fill:L,opacity:1,label:w?.[M]??(M===0?`< ${i(f[0]??0)}`:M===f.length?`\u2265 ${i(f[M-1])}`:`${i(f[M-1])} \u2013 ${i(f[M])}`)}));return{color:I,domain:[o,s],swatches:A,kind:"threshold"}}if(l.type==="ordinal"){let f=l.colors?.length?l.colors:[t];return{color:w=>typeof w=="number"&&Number.isFinite(w)?{fill:f[Math.abs(Math.round(w))%f.length],opacity:1}:void 0,domain:[o,s],swatches:f.map((w,I)=>({fill:w,opacity:1,label:String(I)})),kind:"ordinal"}}if(l.type==="diverging"){let[f,y,w]=l.domain??[-Math.max(Math.abs(o),Math.abs(s)),0,Math.max(Math.abs(o),Math.abs(s))],I=l.colors,A=B=>B<y?.5*(B-f)/Math.max(1e-12,y-f):.5+.5*(B-y)/Math.max(1e-12,w-y),L=B=>{let G=Yt(l.reversed?1-fe(B):B,l.steps);if(I&&I.length>=2)return{fill:Kt(I,G),opacity:1};let j=G<.5?r:t,Q=Math.abs(G-.5)*2;return{fill:j,opacity:a(Q)}},M=B=>typeof B=="number"&&Number.isFinite(B)?L(A(B)):void 0,F=l.steps??5,Z=Array.from({length:F},(B,G)=>{let j=F===1?.5:G/(F-1),Q=j<.5?f+(y-f)*(j*2):y+(w-y)*((j-.5)*2);return{...L(j),label:i(Q)}});return{color:M,domain:[f,w],swatches:Z,kind:"diverging"}}let[c,d]=l.domain??[o,s],u=l.colors,m=f=>{let y=Yt(l.reversed?1-fe(f):f,l.steps);return u&&u.length>=2?{fill:Kt(u,y),opacity:1}:{fill:u?.[0]??t,opacity:a(y)}},b=f=>typeof f!="number"||!Number.isFinite(f)?void 0:m(d===c?1:(f-c)/(d-c)),x=l.steps??5,p=Array.from({length:x},(f,y)=>{let w=x===1?1:y/(x-1);return{...m(w),label:i(c+(d-c)*w)}});return{color:b,domain:[c,d],swatches:p,kind:"sequential"}}var zn=34,An=72;function Qt(e){if(!e)return{bottom:0,right:0,options:{}};let n=e===!0?{}:e;return n.orientation==="vertical"?{bottom:0,right:An,options:n}:{bottom:zn,right:0,options:n}}function Jt(e,n,t){let r=typeof t=="string"?{title:t}:t??{},i=r.title,o=e.swatches;if(o.length===0||n.width<=0)return[];if(r.orientation==="vertical"){let d=Math.max(0,n.height-(i?16:0)),u=Math.min(16,d/o.length),m=n.y+(i?16:0),b=o.map((p,f)=>({kind:"rect",part:"color-legend-swatch",x:h(n.x),y:h(m+f*u),width:10,height:h(u),fill:p.fill,opacity:p.opacity,title:p.label})),x=u>=12?1:2;return o.forEach((p,f)=>{f%x!==0&&f!==o.length-1||b.push({kind:"text",part:"color-legend-label",x:h(n.x+14),y:h(m+(f+.5)*u),text:p.label,baseline:"middle",fill:$.label})}),i&&b.push({kind:"text",part:"color-legend-title",x:h(n.x),y:h(n.y+6),text:i,baseline:"middle",fill:$.label}),b}let s=Math.min(n.width/o.length,96),l=n.x+(n.width-s*o.length)/2,a=o.map((d,u)=>({kind:"rect",part:"color-legend-swatch",x:h(l+u*s),y:h(n.y),width:h(s),height:10,fill:d.fill,opacity:d.opacity,title:d.label})),c=e.kind==="threshold"?1:Math.max(1,Math.ceil(o.length*7*U/Math.max(1,s*o.length)));return o.forEach((d,u)=>{u%c!==0&&u!==o.length-1||a.push({kind:"text",part:"color-legend-label",x:h(l+(u+.5)*s),y:h(n.y+22),text:d.label,anchor:"middle",fill:$.label})}),i&&a.push({kind:"text",part:"color-legend-title",x:h(l-6),y:h(n.y+5),text:i,anchor:"end",baseline:"middle",fill:$.label}),a}var On=1e4,Ln=e=>Array.isArray(e)?{x:e[0],y:e[1],size:e[2],label:void 0,id:void 0,color:void 0,value:void 0}:{x:e.x,y:e.y,size:e.size,label:e.label,id:e.id,color:e.color,value:e.value};function Rn(e,n,t,r,i,o,s,l){if(r==="circle")return{...Ht(e,n,t,i,o,s),part:l};let a=r==="square"?`M${h(e-t)} ${h(n-t)}h${h(2*t)}v${h(2*t)}h${h(-2*t)}Z`:r==="diamond"?`M${h(e)} ${h(n-t*1.3)}L${h(e+t*1.3)} ${h(n)}L${h(e)} ${h(n+t*1.3)}L${h(e-t*1.3)} ${h(n)}Z`:`M${h(e)} ${h(n-t*1.2)}L${h(e+t*1.15)} ${h(n+t*.9)}L${h(e-t*1.15)} ${h(n+t*.9)}Z`;return{kind:"path",part:l,d:a,fill:i,title:o,item:s}}function Pn(e,n){let t=[],r=e.series.map((S,E)=>({name:S.name,id:S.id,symbol:S.symbol??"circle",color:Ie(e,E,S.color),data:Gt(e,S.name)?[]:S.data.flatMap((O,V)=>{let D=Ln(O);return ie(D.x)&&ie(D.y)?[{...D,index:V}]:[]})})),i=e.sampling==="auto"?On:typeof e.sampling=="object"?e.sampling.threshold:1/0,o=r.reduce((S,E)=>S+E.data.length,0),s=o>i?Math.ceil(o/i):1;s>1&&t.push({code:"sampled",severity:"warning",message:`${o} points exceed the sampling threshold of ${i}; every ${s}th point is drawn.`});let l=s>1?r.map(S=>({...S,data:S.data.filter((E,O)=>O%s===0)})):r,a=l.flatMap(S=>S.data),c=jt(e,a.length===0);if(c)return{...c,issues:t};let{width:d,height:u}=Fe(e),m=e.colorScale?Qt(e.colorLegend):{bottom:0,right:0,options:{}},b=Bt(d,u,{...se,top:se.top+Ft(e)+(e.yAxis?.label?12:0),right:se.right+m.right,bottom:se.bottom+(e.xAxis?.label?14:0)+m.bottom}),x=e.markerSize??3,p=Math.max(0,e.hitRadius??0),f=Math.max(0,e.jitter??0),y=new Map,w=e.colorScale?Xt(e.colorScale,a.map(S=>S.value),Ie(e,0),void 0,we(e.format)):void 0,I=He(_e(a.map(S=>S.x),!1),[b.x,b.x+b.width],e.xAxis??{},e.format),A=He(_e(a.map(S=>S.y),!1),[b.y+b.height,b.y],e.yAxis??{},e.format),L=oe(a.map(S=>S.size)),M=e.series.map((S,E)=>({name:S.name,color:Ie(e,E,S.color)})),F=Ge(e,d,u,M),Z=[],B=[],G=[],j=[];for(let S of l){let E=S.data.some(O=>O.size!==void 0);for(let O of S.data){let V=O.index,D=n.describe(S.name,O,I,A),J=E?n.radius(O.size,L):x,_=h(I.scale(O.x)),W=h(A.scale(O.y));if(f>0){let ne=`${Math.round(_)},${Math.round(W)}`,ee=y.get(ne)??0;if(y.set(ne,ee+1),ee>0){let re=ee*2.399963;_=h(_+f*Math.cos(re)),W=h(W+f*Math.sin(re))}}let ge=w?.color(O.value),H={label:D,id:O.id,series:S.name,seriesId:S.id??S.name,name:O.label,index:V,value:O.y},te=O.color??ge?.fill??S.color;if(Z.push(Rn(_,W,h(J),S.symbol,te,D,H,E?n.part:"point")),p>0&&Z.push({kind:"circle",part:"hit",cx:_,cy:W,r:h(J+p),fill:te,opacity:0,title:D,item:H}),e.labels&&O.label){let ne=O.label.length*U,ee=_-ne/2,re=W-J-4;j.some(ye=>Math.abs(ye.y-re)<12&&ee<ye.x+ye.w+4&&ee+ne+4>ye.x)||(j.push({x:ee,y:re,w:ne}),B.push(R(_,h(re),O.label,{part:"point-label",anchor:"middle",fill:"var(--skdx-color-text-default)"})))}}if(e.trendline&&S.data.length>=2){let O=e.trendline===!0?"linear":e.trendline,V=Bn(S.data.map(D=>[D.x,D.y]),O);if(V){let[D,J]=I.domain,_=`${S.name} trend${O==="linear"?"":` (${O})`}: r\xB2 ${V.r2.toFixed(2)}`,W=S.color;if(O==="linear")G.push({kind:"line",part:"trendline",x1:h(I.scale(D)),y1:h(A.scale(V.predict(D))),x2:h(I.scale(J)),y2:h(A.scale(V.predict(J))),stroke:W,dash:"5 4",strokeWidth:1.5,title:_});else{let ge=Array.from({length:40},(H,te)=>D+(J-D)*te/39).map(H=>({v:H,p:V.predict(H)})).filter(({p:H})=>Number.isFinite(H)).map(({v:H,p:te})=>({x:h(I.scale(H)),y:h(A.scale(te))}));ge.length>1&&G.push({kind:"path",part:"trendline",d:Ot(ge),stroke:W,dash:"5 4",strokeWidth:1.5,title:_})}}}}let Q={...F,plot:b,xTicks:I.ticks,yTicks:A.ticks,baseline:A.zero},$t={plot:b,x:S=>I.scale(zt(S)),y:S=>A.scale(S)},hn=Ze(e.references,$t),pn=w&&(m.bottom||m.right)?Jt(w,m.right?{x:b.x+b.width+12,y:b.y,width:m.right,height:b.height}:{x:b.x,y:u-m.bottom+8,width:b.width,height:m.bottom},m.options):[],Ct=n.opacity;return{...F,shapes:[..._t(Q,{xLabel:e.xAxis?.label,yLabel:e.yAxis?.label}),...hn,...Ct!==void 0&&Z.some(S=>S.part===n.part)?Z.map(S=>(S.kind==="circle"||S.kind==="path")&&S.part!=="hit"?{...S,opacity:Ct}:S):Z,...G,...B,...Ut(e.annotations,$t),...pn,...F.shapes],issues:t}}function Bn(e,n="linear"){let t;if(n==="polynomial"){let a=0,c=0,d=0,u=0,m=0,b=0,x=0,p=0;for(let[M,F]of e)a+=1,c+=M,d+=M*M,u+=M**3,m+=M**4,b+=F,x+=M*F,p+=M*M*F;let f=M=>M[0]*(M[4]*M[8]-M[5]*M[7])-M[1]*(M[3]*M[8]-M[5]*M[6])+M[2]*(M[3]*M[7]-M[4]*M[6]),w=f([m,u,d,u,d,c,d,c,a]);if(Math.abs(w)<1e-12)return;let I=f([p,u,d,x,d,c,b,c,a])/w,A=f([m,p,d,u,x,c,d,b,a])/w,L=f([m,u,p,u,d,x,d,c,b])/w;t=M=>I*M*M+A*M+L}else{let a=n==="logarithmic"||n==="power"?Math.log:b=>b,c=n==="exponential"||n==="power"?Math.log:b=>b,d=e.filter(([b,x])=>Number.isFinite(a(b))&&Number.isFinite(c(x))),u=Nn(d.map(([b,x])=>[a(b),c(x)]));if(!u)return;let m=n==="exponential"||n==="power"?Math.exp:b=>b;t=b=>m(u.intercept+u.slope*a(b))}let r=t,i=e.filter(([a])=>Number.isFinite(r(a)));if(i.length===0)return;let o=i.reduce((a,[,c])=>a+c,0)/i.length,s=0,l=0;for(let[a,c]of i)s+=(c-r(a))**2,l+=(c-o)**2;return{predict:r,r2:l===0?1:Math.max(0,1-s/l)}}function Ee(e){let[n,t]=e.sizeRange??[3,18];return Pn(e,{part:"bubble",opacity:.7,radius:(r,[i,o])=>ie(r)?o===i?(n+t)/2:n+Math.sqrt((r-i)/(o-i))*(t-n):3,describe:(r,i,o,s)=>`${r}${i.label?` ${i.label}`:""}: ${o.format(i.x)}, ${s.format(i.y)}${ie(i.size)?` (${s.format(i.size)})`:""}`})}function Nn(e){let n=e.length,t=e.reduce((c,d)=>c+d[0],0)/n,r=e.reduce((c,d)=>c+d[1],0)/n,i=0,o=0,s=0;for(let[c,d]of e)i+=(c-t)**2,o+=(c-t)*(d-r),s+=(d-r)**2;if(i===0)return;let l=o/i,a=s===0?1:o*o/(i*s);return{slope:l,intercept:r-l*t,r2:a}}function ze(e){return e==null?[]:(Array.isArray(e)?e:[e]).map(t=>typeof t=="object"?t:{id:t})}var Ve=e=>e.id??e.name??e.series,en=e=>e.seriesId??e.series;function q(e,n){let t=!1;return n.id!==void 0&&(t=!0,Ve(e)!==n.id&&e.id!==n.id&&e.name!==n.id)||n.series!==void 0&&(t=!0,en(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 Y(e){let n={},t=Ve(e);t!==void 0&&(n.id=t);let r=en(e);return r!==void 0&&e.series!==void 0&&(n.series=r),e.index!==void 0&&(n.index=e.index),n}var We=(e,n)=>e.id===n.id&&e.series===n.series&&e.index===n.index&&e.category===n.category;function Ue(e,n,t){let r=ze(e),i=Y(n),o=r.some(s=>q(n,s));return t==="single"?o?[]:[i]:o?r.filter(s=>!q(n,s)):[...r,i]}var Dn=.2;function Fn(e){let n=$.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 Gn=(e,n)=>e.kind==="text"?{...e,fill:$.grid}:{...e,opacity:(e.opacity??1)*n};function qe(e,n){let t=ze(n.selected),r=n.highlighted===void 0||n.highlighted===null?[]:ze(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=d=>!i||r.some(u=>q(d,u))?!0:o.highlighted==="series"?r.some(u=>u.series!==void 0&&q(d,{series:u.series})):!1,a=d=>{if(!i||o.faded==="none"||l(d))return!1;if(o.faded==="series"){let u=i.series;return u!==void 0&&q(d,{series:u})}return!0},c=e.shapes.map(d=>{let u=d.item;if(!u||u.legend)return d;if(t.some(m=>q(u,m))){let m=Fn(d);m&&s.push(m)}return a(u)?Gn(d,Dn):d});return s.length?{...e,shapes:[...c,...s]}:{...e,shapes:c}}function ce(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 Ke=(e,n,t)=>n>=e.x&&n<=e.x+e.width&&t>=e.y&&t<=e.y+e.height;function tn(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 me(e,n){let t=e.hit;if(!t||t.xs.length===0)return;let r=tn(t,n),i=t.rows[r]??[];return{index:r,rows:e.axisTooltipFormatter?.(i,r)??i}}function Ye(e,n){let t=e.hit;if(!t||t.xs.length===0)return;let r=t.xs[tn(t,n)];return{kind:"line",part:"crosshair",x1:r,x2:r,y1:t.plot.y,y2:t.plot.y+t.plot.height,stroke:$.axis,dash:"3 3"}}function Xe(e,n,t){let r=e.hit;if(!r||!r.crosshair||r.xs.length===0||!Ke(r.plot,n,t))return[];let i=Ye(e,n),{rows:o}=me(e,n),s=e.tooltipAnchored?r.plot.y+8:t;return[i,...Te(i.x1,s,o,e.width,e.height,e.tooltipPlacement)]}function Qe(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 Xe(e,i,t.plot.y+8)}function Je(e,n,t,r,i){if(!e.tooltip)return{lines:[],shapes:[]};if(e.hit?.crosshair){let{x:a,y:c}=ce(t,r,i,e.width,e.height);if(Ke(e.hit.plot,a,c)){let d=me(e,a),u=Ye(e,a);if(d&&u)return{lines:d.rows,shapes:[u]}}}let o=n?.closest?.("[data-skdx-part]"),s=e.tooltipFormatter?X(e,n)?.item:void 0,l=s&&e.tooltipFormatter?.(s)||o&&Array.from(o.children).find(a=>a.tagName.toLowerCase()==="title")?.textContent;return l?{lines:Array.isArray(l)?l:[l],shapes:[]}:{lines:[],shapes:[]}}function nn(e,n,t,r,i,o,s){let l=e?.closest?.("[data-skdx-part]"),a=s&&s.tooltipFormatter?X(s,e)?.item:void 0,c=a&&s?.tooltipFormatter?.(a)||l&&Array.from(l.children).find(x=>x.tagName.toLowerCase()==="title")?.textContent;if(!c)return[];let d=s?.tooltipAnchored?X(s,e):void 0,u=d?s?.shapes[d.index]:void 0,{x:m,y:b}=u?be(u):ce(n,t,r,i,o);return Te(m,b,c,i,o,s?.tooltipPlacement)}function et(e,n,t,r,i){if(!e.tooltip)return[];if(e.hit?.crosshair){let{x:o,y:s}=ce(t,r,i,e.width,e.height),l=Xe(e,o,s);if(l.length>0)return l}return nn(n,t,r,i,e.width,e.height,e)}function tt(e,n){let t=X(e,n);return t&&!t.item.legend?Y(t.item):null}var jn=(e,n)=>{let{x:t,y:r}=be(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 nt(e,n){let t=new Set,r=[];for(let i of e.shapes){if(!i.item||i.item.legend||i.part==="anchor"||!jn(i,n))continue;let o=Y(i.item),s=JSON.stringify(o);t.has(s)||(t.add(s),r.push(o))}return r}var rt=e=>({kind:"rect",part:"selection-box",x:h(e.x),y:h(e.y),width:h(e.width),height:h(e.height),fill:$.focus,opacity:.12,stroke:$.focus}),Oe=(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 rn(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 it(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}=be(i),l=i.kind==="circle"?i.cy:i.kind==="rect"?i.y+i.height/2:s;if(!rn(n,o,l))continue;let a=Y(i.item),c=JSON.stringify(a);t.has(c)||(t.add(c),r.push(a))}return r}var ot=e=>({kind:"path",part:"selection-lasso",d:e.length?`M${e.map(n=>`${h(n.x)} ${h(n.y)}`).join("L")}`:"",fill:$.focus,fillOpacity:.12,stroke:$.focus,dash:"4 3"}),Ae=6;function st(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-Ae||n>i.x1+Ae))return Math.abs(n-i.x0)<=Ae?{bar:i,mode:"start"}:Math.abs(n-i.x1)<=Ae?{bar:i,mode:"end"}:{bar:i,mode:"move"}}}function at(e,n,t){let r=e.edit;return on(r,n,r.invert(n.bar.x0+t)-r.invert(n.bar.x0))}function lt(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(a=>a.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 on(r,{bar:o,mode:s},i*l)}function on(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 ct(e,n,t){let r=e.edit,i=r.scale(t.start),o=r.scale(t.end);return{kind:"rect",part:"edit-ghost",x:h(Math.min(i,o)),y:h(n.bar.y),width:h(Math.max(1,Math.abs(o-i))),height:h(n.bar.height),fill:$.focus,opacity:.25,stroke:$.focus,rx:2}}var _n=64,Hn=e=>Math.max(1,Math.min(_n,e));function dt(e,n,t,r){let i=n>0?.8:1.25,o=Hn(e.view.zoom*i);if(o===e.view.zoom)return e.view;let{plot:s,scale:l}=e,[a,c]=e.view.center,d=(t-(s.x+s.width/2))/l,u=(r-(s.y+s.height/2))/l,m=e.view.zoom/o;return{center:[a+d*(1-m),e.fromY(e.toY(c)-u*(1-m))],zoom:o}}function ut(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 X(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 Le=e=>e.shapes.flatMap((n,t)=>n.item&&!n.item.legend?[t]:[]);function be(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 ht(e,n){let t=n===null?void 0:e.shapes[n];if(!t)return[];let 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*U+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}=be(t),l=t.item&&e.tooltipFormatter?.(t.item)||(t.item?.label??t.title??"");return[i,...l?Te(h(o),h(s),l,e.width,e.height):[]]}function pt(e,n,t){let r=Le(e);if(r.length===0)return;let i=n===null?-1:r.indexOf(n);switch(t){case"ArrowRight":case"ArrowDown":return r[Math.min(r.length-1,i+1)];case"ArrowLeft":case"ArrowUp":return r[Math.max(0,i<=0?0:i-1)];case"Home":return r[0];case"End":return r[r.length-1];case"Escape":return null;default:return}}var ae=2,le=(e,n,t)=>{let r=Math.max(ae,Math.min(t,Math.round(n))),i=Math.max(0,Math.min(t-r,Math.round(e)));return{start:i,end:i+r}},sn=(e,n)=>!e||e.start<=0&&e.end>=n;function ft(e,n,t){if(e.count<=ae||!e.plot.width)return;let{start:r,end:i}=e.zoom,o=i-r,s=n>0?1.25:.8,l=Math.max(ae,Math.min(e.count,Math.round(o*s)));if(l===o)return n>0&&!sn(e.zoom,e.count)?le(r,l,e.count):void 0;let a=Math.max(0,Math.min(1,(t-e.plot.x)/e.plot.width)),c=r+a*o;return le(c-a*l,l,e.count)}function mt(e,n,t,r){let i=n.end-n.start,o=Math.max(ae,Math.min(e.count,Math.round(i/Math.max(.05,t)))),s=Math.max(0,Math.min(1,(r-e.plot.x)/Math.max(1,e.plot.width)));return le(n.start+s*i-s*o,o,e.count)}function bt(e,n,t){let r=n.end-n.start,i=e.plot.width/Math.max(1,r);return le(n.start-t/i,r,e.count)}function xt(e,n,t){let r=e.brush;if(!r||!Ke(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:le(s-o/2,o,e.count)}}function gt(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 le(t.start+o,t.end-t.start,e.count);if(n==="left")return{start:Math.max(0,Math.min(t.end-ae,Math.round(t.start+o))),end:t.end};let s=Math.min(e.count,Math.max(t.start+ae,Math.round(t.end+o)));return{start:t.start,end:s}}function vt(e,n){switch(n.type){case"svg":return Promise.resolve(yt(e,n.label,n.resolve));case"csv":return Promise.resolve(dn(n.rows));case"png":{if(typeof document>"u"||typeof Image>"u")return Promise.reject(new Error("PNG export needs a browser"));let t=yt(e,n.label,n.resolve);return cn(t,e.width,e.height,n.scale,n.background)}}}var K=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/"/g,"&quot;"),xe=e=>e.filter(([,n])=>n!==void 0&&n!=="").map(([n,t])=>` ${n}="${K(String(t))}"`).join("");function an(e){let n=e.title?`<title>${K(e.title)}</title>`:"",t=["data-skdx-part",e.part];switch(e.kind){case"path":return`<path${xe([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${xe([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${xe([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${xe([t,["cx",e.cx],["cy",e.cy],["r",e.r],["fill",e.fill],["stroke",e.stroke]])}>${n}</circle>`;case"text":return`<text${xe([t,["x",e.x],["y",e.y],["text-anchor",e.anchor],["dominant-baseline",e.baseline],["fill",e.fill],["font-weight",e.weight],["transform",e.rotate?`rotate(${e.rotate} ${e.x} ${e.y})`:void 0]])}>${K(e.text)}</text>`}}function ln(e){let n=e.defs??[];return n.length===0?"":`<defs>${n.map(t=>`<linearGradient id="${K(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="${K(r.color)}"${r.opacity===void 0?"":` stop-opacity="${r.opacity}"`}/>`).join("")}</linearGradient>`).join("")}</defs>`}function yt(e,n,t){let r=ln(e)+e.shapes.map(an).join("");return t&&(r=r.replace(/var\((--[\w-]+)\)/g,(i,o)=>t(o).trim()||i)),`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${e.width} ${e.height}" width="${e.width}" height="${e.height}" role="img" aria-label="${K(n)}" font-family="${K($.fontFamily)}" font-size="${K($.fontSize)}"><title>${K(n)}</title>${r}</svg>`}function cn(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"})),a=new Image;a.onload=()=>{URL.revokeObjectURL(l);let c=document.createElement("canvas");c.width=Math.round(n*r),c.height=Math.round(t*r);let d=c.getContext("2d");if(!d)return s(new Error("canvas 2d context unavailable"));i&&(d.fillStyle=i,d.fillRect(0,0,c.width,c.height)),d.drawImage(a,0,0,c.width,c.height),c.toBlob(u=>u?o(u):s(new Error("toBlob failed")),"image/png")},a.onerror=()=>{URL.revokeObjectURL(l),s(new Error("svg could not be decoded"))},a.src=l})}function dn(e){let n=t=>{let r=t==null?"":String(t);return/[",\n\r]/.test(r)?`"${r.replace(/"/g,'""')}"`:r};return e.map(t=>t.map(n).join(",")).join(`\r
2
- `)}function wt(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(d=>d.replace(/:\s[^:]*$/,""))],c=r.rows.map(d=>[d[0],...d.slice(1).map(u=>u.slice(u.lastIndexOf(": ")+2))]);return[a,...c]}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(a=>a[l]!==void 0)),s=(l,a)=>l[a]===void 0?"":String(l[a]);return[o.map(l=>l[0]?.toUpperCase()+l.slice(1)),...i.map(l=>o.map(a=>s(l,a)))]}var Mt=new Map;function Re(e){let n=Mt.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&&Mt.delete(e)}},publish(o,s){Object.assign(r,o);for(let l of t)l(o,s)}};return Mt.set(e,{group:i,listeners:t}),i}var un='[data-skdx-part]:not([data-skdx-part^="tooltip"]):not([data-skdx-part="focus"]):not([data-skdx-part="crosshair"])',St=`@keyframes skdx-in{from{opacity:0}to{opacity:1}}${un}{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){${un}{animation:none;transition:none}}`;function kt(e){let n=e.animate;return n&&e.shapes.length<=1500?`${n}ms`:void 0}var k=require("lit"),v=require("lit/decorators.js"),T=require("lit/directives/if-defined.js");var Zn={fromAttribute:()=>!1},C=class extends k.LitElement{constructor(){super(...arguments);this.legend=!1;this.tooltip=!0;this.selectionMode="none";this.loading=!1;this.decorative=!1;this.accessibleTable=!1;this.zoomable=!1;this.editable=!1;this.crossFilter=!1;this.animated=!1;this.responsive=!1;this.tip=[];this.overlay=[];this.portal=null;this.highlightState=null;this.crossState=null;this.lastCross=null;this.pointers=new Map;this.hover=null;this.token={};this.focused=null;this.hiddenState=[];this.drag=null;this.onPointerMove=t=>{let r=this.layout;if(!r)return;this.pointers.has(t.pointerId)&&this.pointers.set(t.pointerId,this.viewBox(t,r).x);let i=this.drag;if(i?.grab==="select"){let{x:o,y:s}=this.viewBox(t,r);this.overlay=[rt(Oe(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=[ot(i.points)];return}if(i?.grab==="edit"){if(!i.gantt)return;let{x:o}=this.viewBox(t,r);i.change=at(r,i.gantt,o-i.x),this.overlay=[ct(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(ut(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(mt(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"?bt(r.hit,i.zoom,o-i.x):gt(r.hit,i.grab,i.zoom,o-i.x));return}if(r.tooltipPortal){let{lines:o,shapes:s}=Je(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=et(r,t.target,t.currentTarget,t.clientX,t.clientY);(o.length>0||this.tip.length>0)&&(this.tip=o)}if(this.highlight(tt(r,t.target)),this.syncId&&r.hit?.crosshair){let o=me(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=X(r,t.target)?.item.legend,l=this.canEdit(r)?st(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 c=r.map.plot;if(i<c.x||i>c.x+c.width||o<c.y||o>c.y+c.height)return;this.drag={x:i,y:o,zoom:{start:0,end:0},grab:"map",view:r.map.view},t.currentTarget.setPointerCapture(t.pointerId),this.clearTip();return}let a=r.hit;if(!(!a||!this.canZoom(r))){if(this.pointers.set(t.pointerId,i),this.pointers.size===2){let[c,d]=[...this.pointers.values()];this.drag={x:(c+d)/2,y:o,zoom:a.zoom,grab:"pinch",distance:Math.abs(c-d)||1}}else{let c=xt(a,i,o);if(c)this.drag={x:i,y:o,zoom:c.zoom,grab:c.grab},c.zoom!==a.zoom&&this.setZoom(c.zoom);else if(this.zoomable&&i>=a.plot.x&&i<=a.plot.x+a.plot.width&&o>=a.plot.y&&o<=a.plot.y+a.plot.height)this.drag={x:i,y:o,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,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(nt(o,Oe(i.x,i.y,s,l))):i.grab==="lasso"?this.setSelected(it(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 a=r.map.plot;if(i<a.x||i>a.x+a.width||o<a.y||o>a.y+a.height)return;t.preventDefault(),this.setView(dt(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=ft(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=X(this.layout,t.target);r&&(r.item.range?this.setZoom(r.item.range):r.item.legend&&r.item.series!==void 0?this.toggle(r.item.series):(this.select(r.item),this.emit("skdx-item-click",r.item)))};this.onKeyDown=t=>{let r=this.layout;if(!r)return;if((t.key==="Enter"||t.key===" ")&&this.focused!==null){let l=r.shapes[this.focused]?.item;l&&(t.preventDefault(),this.select(l),this.emit("skdx-item-click",l));return}let i=this.canEdit(r)?lt(r,this.focused,t):void 0;if(i){t.preventDefault(),this.emit("skdx-task-change",i);return}let o=pt(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?Y(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:a,error:c,emptyMessage:d,description:u,decorative:m,animated:b,responsive:x,highlighted:p,highlightScope:f,accessibleTable:y}=this;return{...typeof x=="object"&&this.measured!==void 0&&this.measured<(x.breakpoint??480)?x.compact:void 0,width:x&&this.measured?this.measured:t,height:r,animate:b,responsive:x,legend:i,tooltip:o,format:s,palette:l,loading:a,error:c,emptyMessage:d,description:u,decorative:m,highlighted:p===void 0?this.highlightState:p,highlightScope:f,accessibleTable:y,hiddenSeries:this.hiddenSeries??this.hiddenState,zoom:this.zoom??this.zoomState,selected:this.selected??this.selectedState,view:this.view??this.viewState}}emit(t,r){this.dispatchEvent(new CustomEvent(t,{detail:r,bubbles:!0,composed:!0}))}publish(t){this.syncId&&Re(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=Re(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&&We(r,t)||(this.hover=t,this.emit("skdx-highlighted-change",t),this.syncId&&(this.highlightState=t,this.publish({highlighted:t})))}select(t){let r=this.selectionMode;r!=="none"&&this.setSelected(Ue(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 ce(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&&q(o.item,t));return i<0?!1:(this.getSvgElement()?.focus(),this.focused=i,!0)}export(t){let r=this.layout;return r?vt(r,{...t,label:t.label??this.label??this.localName}):Promise.reject(new Error("not rendered yet"))}root(t,r,i){this.join();let o=qe(je(t),this.sized());if(this.layout=o,o.issues!==this.reported){this.reported=o.issues;for(let y of o.issues??[])this.emit("skdx-data-issue",y)}let s=this.canZoom(o),l=this.canPan(o),a=this.canEdit(o),c=this.brushing(),d=s||l||a||c,u=!o.decorative&&Le(o).length>0,m=o.description?`${r}-desc`:void 0,b=kt(o),x=wt(o,this.accessibleTable),p=typeof this.accessibleTable=="object"&&this.accessibleTable.caption||i,f=this.portal;return k.html`<svg
1
+ "use strict";var we=Object.defineProperty;var Gt=Object.getOwnPropertyDescriptor;var zn=Object.getOwnPropertyNames;var On=Object.prototype.hasOwnProperty;var Ln=(e,n)=>{for(var t in n)we(e,t,{get:n[t],enumerable:!0})},Rn=(e,n,t,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of zn(n))!On.call(e,i)&&i!==t&&we(e,i,{get:()=>n[i],enumerable:!(r=Gt(n,i))||r.enumerable});return e};var Pn=e=>Rn(we({},"__esModule",{value:!0}),e),g=(e,n,t,r)=>{for(var i=r>1?void 0:r?Gt(n,t):n,o=e.length-1,a;o>=0;o--)(a=e[o])&&(i=(r?a(n,t,i):a(i))||i);return r&&i&&we(n,t,i),i};var sr={};Ln(sr,{SkdxScatterChart:()=>N});module.exports=Pn(sr);var j=require("lit/decorators.js");var jt=e=>Number(e.toPrecision(12)),Bn,Nn=e=>(Bn??(Bn=new Intl.NumberFormat)).format(jt(e)),Dn=e=>{let n=Math.round(Math.abs(e)),t=e<0?"-":"",r=Math.floor(n/3600),i=Math.floor(n%3600/60),o=a=>String(a).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 Me(e){if(e===void 0)return Nn;if(typeof e=="function")return e;let{style:n,locale:t,digits:r,unit:i="",timeZone:o}=e,a=d=>i?u=>d(u)+i:d,l=d=>r===void 0?d===void 0?{}:{maximumFractionDigits:d}:{minimumFractionDigits:r,maximumFractionDigits:r},s=d=>{let u=new Intl.NumberFormat(t,d);return a(m=>u.format(jt(m)))},c=d=>{let u=new Intl.DateTimeFormat(t,o?{...d,timeZone:o}:d);return m=>u.format(m)};switch(n){case"integer":return s({maximumFractionDigits:0});case"decimal":return s(l(2));case"percent":return s({style:"percent",...l(0)});case"currency":return s({style:"currency",currency:e.currency??"USD",...l()});case"compact":return s({notation:"compact",...l(1)});case"scientific":return s({notation:"scientific",...l(2)});case"date":return c({dateStyle:"medium"});case"time":return c({timeStyle:"short"});case"datetime":return c({dateStyle:"medium",timeStyle:"short"});case"duration":return a(Dn)}}var _t=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 Se([e,n],[t,r]){let i=n-e;return o=>i===0?t:t+(o-e)/i*(r-t)}function $e(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,a=(o<1.5?1:o<3.5?2:o<7.5?5:10)*i,l=Math.floor(e/a)*a,s=Math.ceil(n/a)*a,c=[];for(let d=l;d<=s+a/2;d+=a)c.push(Et(d));return c}var Et=e=>Number(e.toPrecision(12)),h=e=>Number(e.toFixed(2)),oe=e=>typeof e=="number"&&Number.isFinite(e);function ae(e){let n=1/0,t=-1/0;for(let r of e)oe(r)&&(r<n&&(n=r),r>t&&(t=r));return n===1/0?[0,0]:[n,t]}function Ht(e,n="linear"){if(e.length===0)return"";let t=e[0];if(n==="step"||n==="stepBefore"||n==="stepAfter"){let c=`M${t.x} ${t.y}`;for(let d=1;d<e.length;d++){let u=e[d-1],m=e[d];n==="stepAfter"?c+=`H${m.x}V${m.y}`:n==="stepBefore"?c+=`V${m.y}H${m.x}`:c+=`H${h((u.x+m.x)/2)}V${m.y}H${m.x}`}return c}if(n==="linear"||e.length<3)return`M${e.map(c=>`${c.x} ${c.y}`).join("L")}`;let r=e.length,i=e.slice(1).map((c,d)=>c.x-e[d].x),o=e.slice(1).map((c,d)=>c.y-e[d].y),a=i.map((c,d)=>c===0?0:o[d]/c),l=[a[0]];for(let c=1;c<r-1;c++){let d=a[c-1],u=a[c];l.push(d*u<=0?0:(d+u)/2)}l.push(a[r-2]);for(let c=0;c<r-1;c++){let d=a[c];if(d===0){l[c]=0,l[c+1]=0;continue}let u=l[c]/d,m=l[c+1]/d,y=Math.hypot(u,m);y>3&&(l[c]=3*u*d/y,l[c+1]=3*m*d/y)}let s=`M${t.x} ${t.y}`;for(let c=0;c<r-1;c++){let d=e[c],u=e[c+1],m=i[c]/3;s+=`C${h(d.x+m)} ${h(d.y+m*l[c])} ${h(u.x-m)} ${h(u.y-m*l[c+1])} ${u.x} ${u.y}`}return s}var he=1e3,pe=60*he,fe=60*pe,ke=24*fe,dr=[he,5*he,15*he,30*he,pe,5*pe,15*pe,30*pe,fe,3*fe,6*fe,12*fe,ke,2*ke,7*ke,14*ke];function Vt(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 a=t;a<=r;a++)for(let l of i)o.push(Et(l*10**a));return o.filter(a=>a>=e/1.0001&&a<=n*1.0001)}var Fn=/-?\d*\.?\d+(?:e[-+]?\d+)?/gi,Gn=/([MLTHVCSQAZmlthvcsqaz])([^MLTHVCSQAZmlthvcsqaz]*)/g,jn={M:2,L:2,T:2,C:6,S:4,Q:4,A:7,H:-1,V:-2};function _n(e,n,t){return e.replace(Gn,(r,i,o)=>{let a=jn[i];if(a===void 0)return i+o;let s=(o.match(Fn)??[]).map((c,d)=>{let u=Number(c);if(a===-1)return String(u+n);if(a===-2)return String(u+t);let m=d%a;return a===7?m===5?String(u+n):m===6?String(u+t):c:String(m%2===0?u+n:u+t)});return i+s.join(" ")})}var Zt=(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:_n(r.d,n,t)}}});var _e=["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)"))),$={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)"},Ce=(e="neutral")=>e==="neutral"?$.axis:`var(--skdx-color-${e}-500)`,Ee=(e="neutral")=>e==="neutral"?$.label:e==="primary"?"var(--skdx-color-text-accent)":`var(--skdx-color-text-${e})`,Wt=(e,n)=>n??_e[e%_e.length];var se={top:16,right:16,bottom:32,left:48};function Ut(e,n,t=se){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 me(e){let n=e.legend;if(n)return n===!0?{}:n.enabled===!1?void 0:n}function qt(e){let n=e.tooltip;return n===void 0||n===!0?{enabled:!0}:n===!1?{enabled:!1}:{...n,enabled:n.enabled??!0}}var Ie=20,En=120,Kt=e=>{let n=me(e);return n&&(n.position==="left"||n.position==="right")?n.width??En:0},Te=(e,n=600,t=300)=>({width:(e.width??n)-Kt(e),height:(e.height??t)-(me(e)?.position==="bottom"?Ie:0)}),Yt=(e,n,t)=>{let r=me(e);return!r||!(r.position===void 0||r.position==="top")?0:(n?Math.max(1,Jt(n,t??Te(e).width,r)):1)*Ie},_=6.5;function Ve(e,n){let t=Array.from(e),r=Math.max(0,Math.floor(n/_));return t.length<=r?e:r===0?"":`${t.slice(0,r-1).join("")}\u2026`}var Ae=(e,n,t)=>t??(e.palette&&e.palette.length>0?e.palette[n%e.palette.length]:Wt(n)),Xt=(e,n)=>e.hiddenSeries?.includes(n)??!1;function He(e,n,t=[],r={},i=10,o=8,a=!1){let l=[],s=r.maxItems,c=s!==void 0&&s>=0&&e.length>s?e.slice(0,s):e,d=e.length-c.length,u=r.interactive??!0,m=o,y=i,b=(p,f,x,M)=>{let I=(f?18:4)+p.length*_;m>o&&(a||m+I>n-8)&&(m=o,y+=Ie),f&&l.push({kind:"rect",part:"legend-swatch",x:m,y:y-5,width:10,height:10,fill:f,opacity:M?.3:void 0,item:x}),l.push({kind:"text",part:"legend-label",x:m+(f?14:0),y,text:p,baseline:"middle",fill:M?$.grid:$.label,item:x}),m+=I+12};for(let p of c){let f=t.includes(p.name),x=u?{label:p.name,series:p.name,legend:!0}:void 0;b(r.formatter?.(p.name)??p.name,p.color,x,f)}return d>0&&b(`+${d} more`,void 0,void 0,!1),r.align==="end"?Hn(l,n):l}function Hn(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*_)),a=n-8-o;for(let l of i)r.push({...l,x:l.x+a})}return r}var Jt=(e,n,t={})=>new Set(He(e,n,[],t).flatMap(r=>r.kind==="text"?[r.y]:[])).size;function Ze(e,n,t,r=[]){let i=me(e),o=i&&e.direction==="rtl"&&i.align===void 0?{...i,align:"end"}:i,a=qt(e),l=o?.position==="bottom",s=Kt(e),c=e.hiddenSeries??[],d=o?s?He(r,1/0,c,o,10,(o.position==="right"?n:0)+8,!0):He(r,n,c,o,l?t+10:10):[],u=l?Jt(r,n,o):0;return{width:n+s,height:l?t+Math.max(1,u)*Ie:t,legendOffset:o?.position==="left"?s:void 0,tooltip:a.enabled,tooltipFormatter:a.formatter,axisTooltipFormatter:a.axisFormatter,tooltipPortal:a.portal,tooltipPlacement:a.placement,tooltipAnchored:a.followPointer===!1?!0:void 0,description:e.description,decorative:e.decorative,animate:e.animate===!0?300:e.animate||void 0,responsive:!!e.responsive,shapes:d}}function We(e){let n=e.legendOffset;if(!n)return e;let t=[...Zt(e.shapes.filter(s=>!s.part.startsWith("legend-")),n,0),...e.shapes.filter(s=>s.part.startsWith("legend-"))],r=s=>({...s,x:s.x+n}),i=e.hit?{...e.hit,plot:r(e.hit.plot),xs:e.hit.xs.map(s=>s+n),brush:e.hit.brush?{box:r(e.hit.brush.box),window:r(e.hit.brush.window)}:void 0}:void 0,o=e.edit,a=o?{...o,scale:s=>o.scale(s)+n,invert:s=>o.invert(s-n),bars:o.bars.map(s=>({...s,x0:s.x0+n,x1:s.x1+n}))}:void 0,l=e.map?{...e.map,plot:r(e.map.plot)}:void 0;return{...e,shapes:t,hit:i,edit:a,map:l,legendOffset:void 0}}function ze(e,n,t,r,i,o="auto"){let a=Array.isArray(t)?t:[t],l=Math.max(1,Math.floor((r-12)/_)),s=a.flatMap(f=>{let x=[],M=Array.from(f);for(;M.length>l;){let I=M.slice(0,l+1).lastIndexOf(" ");I<1&&(I=l),x.push(M.slice(0,I).join("")),M=M.slice(I),M[0]===" "&&M.shift()}return x.push(M.join("")),x}),c=Math.max(1,Math.floor((i-6)/16)),d=s.slice(0,c);s.length>c&&(d[c-1]=Ve(`${d[c-1]}\u2026`,r-12));let u=Math.min(r,Math.max(0,...d.map(f=>Array.from(f).length))*_+12),m=Math.min(i,6+d.length*16),y=o==="top"?{x:e-u/2,y:n-m-8}:o==="bottom"?{x:e-u/2,y:n+8}:o==="left"?{x:e-u-8,y:n-m/2}:o==="right"?{x:e+8,y:n-m/2}:{x:e+12,y:n-m-6},b=Math.max(0,Math.min(r-u,y.x)),p=Math.max(0,Math.min(i-m,y.y));return[{kind:"rect",part:"tooltip",title:a.join(`
2
+ `),x:h(b),y:h(p),width:h(u),height:m,fill:"var(--skdx-color-surface-raised)",stroke:$.axis,rx:8},...d.map((f,x)=>({kind:"text",part:"tooltip-label",x:h(b+6),y:h(p+11+x*16),text:f,baseline:"middle",fill:"var(--skdx-color-text-default)",weight:d.length>1&&x===0?"bold":void 0}))]}function Ue(e,n){let[t,r]=ae(e);return n?[Math.min(0,t),Math.max(0,r)]:[t,r]}function qe([e,n],t,r=!1,i){let o=typeof r=="boolean"?{scale:r?"log":"linear"}:r,a=Me(o.format??i),l=o.min??e,s=o.max??n;o.reversed&&(t=[t[1],t[0]]);let c={id:o.id,position:o.position,options:o};if(o.scale==="sqrt"){let p=k=>Math.sign(k)*Math.sqrt(Math.abs(k)),f=o.nice===!1?[l,s]:$e(l,s,o.ticks),x=o.min??f[0],M=o.max??f[f.length-1],I=Se([p(x),p(M)],t),L=k=>I(p(k)),O=$e(x,M,o.ticks).filter(k=>k>=x-1e-9&&k<=M+1e-9);return{...c,scale:L,domain:[x,M],format:a,ticks:(O.length>=2?O:[x,M]).map(k=>({pos:h(L(k)),label:a(k)})),zero:h(L(Math.min(Math.max(0,x),M)))}}if(o.scale==="log"){let p=Math.max(l,Number.EPSILON),f=Math.max(s,p),x=Vt(p,f),M=[Math.log10(p),Math.log10(f)],I=Se(M,t),L=O=>I(Math.log10(Math.max(O,Number.EPSILON)));return{...c,scale:L,domain:M,format:a,ticks:x.map(O=>({pos:h(L(O)),label:a(O)})),zero:h(t[0])}}let d=$e(l,s,o.ticks),u=[o.min??(o.nice===!1?l:d[0]),o.max??(o.nice===!1?s:d[d.length-1])],m=Se(u,t),y=d.filter(p=>p>=u[0]-1e-9&&p<=u[1]+1e-9),b=(y.length>=2?y:[u[0],u[1]]).map(p=>({pos:h(m(p)),label:a(p)}));return{...c,scale:m,domain:u,format:a,ticks:b,zero:h(m(Math.min(Math.max(0,u[0]),u[1])))}}function Qt(e,n){if(e.length<2)return e;let t=e.reduce((i,o)=>Math.max(i,o.label.length),0)*_+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)}function en(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:a}=Te(e,t,r),l=i==="error"?e.error:i==="loading"?"Loading\u2026":e.emptyMessage??"No data available",s=[];return i==="loading"&&s.push({kind:"rect",part:"skeleton",x:0,y:0,width:o,height:a,fill:"var(--skdx-color-surface-sunken)",rx:8}),s.push({kind:"text",part:`state-${i}`,x:h(o/2),y:h(a/2),text:l,anchor:"middle",baseline:"middle",fill:i==="error"?"var(--skdx-color-text-danger)":$.label}),{...Ze(e,o,a),shapes:s,tooltip:!1}}var Oe=(e,n,t)=>{let r=n.length*_/2;return e+r>t?"end":e-r<0?"start":"middle"};function tn(e,n={}){let{plot:t,xTicks:r,yTicks:i,baseline:o}=e,a=t.x+t.width,l=t.y+t.height,s=[],c=n.grid??!0,d=(b,p)=>p?{kind:"line",part:"grid",x1:b.pos,x2:b.pos,y1:t.y,y2:l,stroke:$.grid}:{kind:"line",part:"grid",x1:t.x,x2:a,y1:b.pos,y2:b.pos,stroke:$.grid},u=n.x?.tickRotation??0,m=(b,p,f,x)=>u?R(b,p,f,{part:x,anchor:u<0?"end":"start",baseline:"middle",rotate:u}):Vn(b,p,f,e.width,{part:x,anchor:Oe(b,f,e.width)}),y=(b,p,f,x,M)=>{for(let I of b)s.push(p==="x"?{kind:"line",part:"tick",x1:I.pos,x2:I.pos,y1:f,y2:h(f+x*M),stroke:$.axis}:{kind:"line",part:"tick",x1:f,x2:h(f+x*M),y1:I.pos,y2:I.pos,stroke:$.axis})};if(n.categoryGrid)for(let b of r)s.push(d(b,!n.horizontal));if(n.horizontal){let b=n.axes??[{ticks:i,position:"bottom",offset:0,label:n.yLabel,...n.y}];if(c)for(let p of i)s.push(d(p,!0));b[0]?.showLine!==!1&&s.push({kind:"line",part:"axis",x1:o,x2:o,y1:t.y,y2:l,stroke:$.axis});for(let p of b){let f=p.position==="top"||p.position==="right",x=h(f?t.y-p.offset:l+p.offset),M=f||p.offset>0;p.showLine&&M&&s.push({kind:"line",part:"axis",x1:t.x,x2:a,y1:x,y2:x,stroke:$.axis}),p.showTicks&&y(p.ticks,"x",x,f?-1:1,p.tickSize??4);let I=h(f?x-8:x+20);for(let L of p.ticks)s.push(f?R(L.pos,I,L.label,{part:"x-label-top",anchor:Oe(L.pos,L.label,e.width)}):m(L.pos,I,L.label,"x-label"));p.label&&s.push(M?R(4,I,p.label,{part:"axis-title",anchor:"start",baseline:f?void 0:"middle"}):R(4,t.y-6,p.label,{part:"axis-title",anchor:"start"}))}n.x?.showLine&&s.push({kind:"line",part:"axis",x1:n.rtl?a:t.x,x2:n.rtl?a:t.x,y1:t.y,y2:l,stroke:$.axis}),n.x?.showTicks&&y(r,"y",n.rtl?a:t.x,n.rtl?1:-1,n.x.tickSize??4);for(let p of r)s.push(n.rtl?R(a+8,p.pos,p.label,{part:"y-label",anchor:"start",baseline:"middle"}):R(t.x-8,p.pos,p.label,{part:"y-label",anchor:"end",baseline:"middle"}))}else{if(c)for(let p of i)s.push(d(p,!1));n.y?.showLine!==!1&&s.push({kind:"line",part:"axis",x1:t.x,x2:a,y1:o,y2:o,stroke:$.axis});let b=n.axes??[{ticks:i,position:"left",offset:0,label:n.yLabel,...n.y},...n.rightTicks?[{ticks:n.rightTicks,position:"right",offset:0,label:n.rightLabel}]:[]];for(let p of b){let f=p.position==="left",x=f?t.x-p.offset:a+p.offset,M=f?"y-label":"y-label-right";p.showLine&&s.push({kind:"line",part:"axis",x1:h(x),x2:h(x),y1:t.y,y2:l,stroke:$.axis}),p.showTicks&&y(p.ticks,"y",h(x),f?-1:1,p.tickSize??4);for(let I of p.ticks)s.push(R(h(f?x-8:x+8),I.pos,I.label,{part:M,anchor:f?"end":"start",baseline:"middle"}));p.label&&s.push(R(h(f?p.offset===0?4:Math.max(4,x-40):p.offset===0?e.width-4:Math.min(e.width-4,x+40)),t.y-6,p.label,{part:"axis-title",anchor:f?"start":"end"}))}n.x?.showTicks&&y(r,"x",l,1,n.x.tickSize??4);for(let p of r)s.push(m(p.pos,l+(u?12:20),p.label,"x-label"))}return n.xLabel&&s.push(R(h(t.x+t.width/2),e.height-4,n.xLabel,{part:"axis-title",anchor:"middle"})),n.horizontal&&n.rightLabel&&s.push(R(e.width-4,t.y-6,n.rightLabel,{part:"axis-title",anchor:"end"})),s}var R=(e,n,t,r={})=>({kind:"text",part:"label",x:e,y:n,text:t,fill:$.label,...r});function Vn(e,n,t,r,i={}){let o=Math.max(4,Math.min(r-4,e)),a=i.anchor??"start",l=a==="middle"?2*Math.min(o-4,r-o-4):a==="end"?o-4:r-o-4,s=Ve(t,l);return{kind:"text",part:"label",x:o,y:n,fill:$.label,...i,text:s,title:s===t?i.title:t}}var nn=(e,n,t,r,i,o)=>({kind:"circle",part:"point",cx:e,cy:n,r:t,fill:r,title:i,item:o});function Ke(e,n){let t=[],{plot:r}=n,i=r.x+r.width,o=r.y+r.height,a=s=>Math.max(r.x,Math.min(i,s)),l=s=>Math.max(r.y,Math.min(o,s));for(let s of e??[]){let c=s.color??Ce(s.variant),d=s.color??Ee(s.variant),u={part:"reference-label",fill:d},m=n.horizontal===!0;if("y"in s){let y=h(n.y(s.y,s.axis??"left"));if(m){let b=a(y);t.push(...on(b,r.y,o,c,s.label,u))}else{let b=l(y);t.push(...rn(r.x,i,b,c,s.label,u))}}else if("x"in s){let y=n.x(s.x);if(y===void 0)continue;m?t.push(...rn(r.x,i,l(h(y)),c,s.label,u)):t.push(...on(a(h(y)),r.y,o,c,s.label,u))}else if("y1"in s){let y=h(n.y(s.y1,s.axis??"left")),b=h(n.y(s.y2,s.axis??"left"));m?t.push(...sn(a(Math.min(y,b)),a(Math.max(y,b)),r,c,s.label,d)):t.push(...an(l(Math.min(y,b)),l(Math.max(y,b)),r,c,s.label,d))}else{let y=n.x(s.x1),b=n.x(s.x2);if(y===void 0||b===void 0)continue;let p=h(Math.min(y,b)),f=h(Math.max(y,b));m?t.push(...an(l(p),l(f),r,c,s.label,d)):t.push(...sn(a(p),a(f),r,c,s.label,d))}}return t}function rn(e,n,t,r,i,o){let a={kind:"line",part:"reference",x1:e,x2:n,y1:t,y2:t,stroke:r,dash:"6 4",strokeWidth:1.5,title:i};return i?[a,R(n-4,t-5,i,{...o,anchor:"end"})]:[a]}function on(e,n,t,r,i,o){let a={kind:"line",part:"reference",x1:e,x2:e,y1:n,y2:t,stroke:r,dash:"6 4",strokeWidth:1.5,title:i};return i?[a,R(e+4,n+10,i,{...o,anchor:"start"})]:[a]}function an(e,n,t,r,i,o){let a={kind:"rect",part:"reference-area",x:t.x,y:e,width:t.width,height:h(Math.max(0,n-e)),fill:r,opacity:.12,title:i};return i?[a,R(t.x+t.width-4,e+12,i,{part:"reference-label",fill:o,anchor:"end"})]:[a]}function sn(e,n,t,r,i,o){let a={kind:"rect",part:"reference-area",x:e,y:t.y,width:h(Math.max(0,n-e)),height:t.height,fill:r,opacity:.12,title:i};return i?[a,R(e+4,t.y+12,i,{part:"reference-label",fill:o,anchor:"start"})]:[a]}function ln(e,n){let t=[],{plot:r}=n,i=r.x+r.width,o=r.y+r.height;for(let a of e??[]){let l=a.color??Ce(a.variant),s=a.color??Ee(a.variant),c=(b,p,f)=>{let x=n.x(b);if(x===void 0)return;let M=n.y(p,f??"left");return n.horizontal?{x:h(M),y:h(x)}:{x:h(x),y:h(M)}},d=a.id??a.label,u=b=>({label:b,id:d,name:a.label});if(a.type==="line"||a.type==="band"){let{type:b,id:p,...f}=a;t.push(...Ke([f],n));continue}if(a.type==="rect"){let b=c(a.x1,a.y1,a.axis),p=c(a.x2,a.y2,a.axis);if(!b||!p)continue;let f=Math.max(r.x,Math.min(b.x,p.x)),x=Math.max(r.y,Math.min(b.y,p.y)),M=a.label??"";t.push({kind:"rect",part:"annotation-rect",x:h(f),y:h(x),width:h(Math.max(0,Math.min(i,Math.max(b.x,p.x))-f)),height:h(Math.max(0,Math.min(o,Math.max(b.y,p.y))-x)),fill:l,opacity:.12,stroke:l,title:M||void 0,item:M?u(M):void 0}),a.label&&t.push(R(h(f+4),h(x+12),a.label,{part:"annotation-label",fill:s}));continue}let m=c(a.x,a.y,a.axis);if(!m)continue;if(a.type==="text"){t.push(R(m.x,m.y,a.text,{part:"annotation-text",fill:s,anchor:"middle",baseline:"middle",title:a.label}));continue}let y=a.label??`${String(a.x)}, ${a.y}`;if(t.push({kind:"circle",part:"annotation-point",cx:m.x,cy:m.y,r:5,fill:l,stroke:"var(--skdx-color-surface-default)",title:y,item:u(y)}),a.type==="callout"&&a.label){let[b,p]=a.offset??[16,-16],f=h(Math.max(r.x,Math.min(i,m.x+b))),x=h(Math.max(r.y,Math.min(o,m.y+p)));t.push({kind:"line",part:"annotation-leader",x1:m.x,y1:m.y,x2:f,y2:x,stroke:l},R(f,x,a.label,{part:"annotation-label",fill:s,anchor:b>=0?"start":"end",baseline:"middle"}))}}return t}var be=e=>Math.max(0,Math.min(1,e));function cn(e){let n=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());if(n){let r=n[1],i=r.length===3?r.split("").map(o=>o+o).join(""):r;return[0,2,4].map(o=>parseInt(i.slice(o,o+2),16))}let t=/^rgba?\(\s*(\d+)[\s,]+(\d+)[\s,]+(\d+)/i.exec(e.trim());return t?[Number(t[1]),Number(t[2]),Number(t[3])]:void 0}function dn(e,n){if(e.length===0)return $.axis;if(e.length===1)return e[0];let t=be(n)*(e.length-1),r=Math.min(e.length-2,Math.floor(t)),i=t-r,o=cn(e[r]),a=cn(e[r+1]);if(!o||!a)return e[Math.round(t)];let l=s=>Math.round(o[s]+(a[s]-o[s])*i);return`rgb(${l(0)}, ${l(1)}, ${l(2)})`}var un=(e,n)=>n!==void 0&&n>=2?Math.min(n-1,Math.floor(be(e)*n))/(n-1):be(e);function hn(e,n,t,r=$.negative,i=String){let[o,a]=ae(n),l=e??{type:"sequential"},s=f=>h(.15+.85*f);if(l.type==="threshold"){let{thresholds:f,colors:x,labels:M}=l,I=O=>{if(typeof O!="number"||!Number.isFinite(O))return;let k=0;for(;k<f.length&&O>=f[k];)k++;return{fill:x[Math.min(k,x.length-1)]??t,opacity:1}},L=x.map((O,k)=>({fill:O,opacity:1,label:M?.[k]??(k===0?`< ${i(f[0]??0)}`:k===f.length?`\u2265 ${i(f[k-1])}`:`${i(f[k-1])} \u2013 ${i(f[k])}`)}));return{color:I,domain:[o,a],swatches:L,kind:"threshold"}}if(l.type==="ordinal"){let f=l.colors?.length?l.colors:[t];return{color:M=>typeof M=="number"&&Number.isFinite(M)?{fill:f[Math.abs(Math.round(M))%f.length],opacity:1}:void 0,domain:[o,a],swatches:f.map((M,I)=>({fill:M,opacity:1,label:String(I)})),kind:"ordinal"}}if(l.type==="diverging"){let[f,x,M]=l.domain??[-Math.max(Math.abs(o),Math.abs(a)),0,Math.max(Math.abs(o),Math.abs(a))],I=l.colors,L=F=>F<x?.5*(F-f)/Math.max(1e-12,x-f):.5+.5*(F-x)/Math.max(1e-12,M-x),O=F=>{let W=un(l.reversed?1-be(F):F,l.steps);if(I&&I.length>=2)return{fill:dn(I,W),opacity:1};let D=W<.5?r:t,H=Math.abs(W-.5)*2;return{fill:D,opacity:s(H)}},k=F=>typeof F=="number"&&Number.isFinite(F)?O(L(F)):void 0,E=l.steps??5,K=Array.from({length:E},(F,W)=>{let D=E===1?.5:W/(E-1),H=D<.5?f+(x-f)*(D*2):x+(M-x)*((D-.5)*2);return{...O(D),label:i(H)}});return{color:k,domain:[f,M],swatches:K,kind:"diverging"}}let[c,d]=l.domain??[o,a],u=l.colors,m=f=>{let x=un(l.reversed?1-be(f):f,l.steps);return u&&u.length>=2?{fill:dn(u,x),opacity:1}:{fill:u?.[0]??t,opacity:s(x)}},y=f=>typeof f!="number"||!Number.isFinite(f)?void 0:m(d===c?1:(f-c)/(d-c)),b=l.steps??5,p=Array.from({length:b},(f,x)=>{let M=b===1?1:x/(b-1);return{...m(M),label:i(c+(d-c)*M)}});return{color:y,domain:[c,d],swatches:p,kind:"sequential"}}var Zn=34,Wn=72;function pn(e){if(!e)return{bottom:0,right:0,options:{}};let n=e===!0?{}:e;return n.orientation==="vertical"?{bottom:0,right:Wn,options:n}:{bottom:Zn,right:0,options:n}}function fn(e,n,t){let r=typeof t=="string"?{title:t}:t??{},i=r.title,o=e.swatches;if(o.length===0||n.width<=0)return[];if(r.orientation==="vertical"){let d=Math.max(0,n.height-(i?16:0)),u=Math.min(16,d/o.length),m=n.y+(i?16:0),y=o.map((p,f)=>({kind:"rect",part:"color-legend-swatch",x:h(n.x),y:h(m+f*u),width:10,height:h(u),fill:p.fill,opacity:p.opacity,title:p.label})),b=u>=12?1:2;return o.forEach((p,f)=>{f%b!==0&&f!==o.length-1||y.push({kind:"text",part:"color-legend-label",x:h(n.x+14),y:h(m+(f+.5)*u),text:p.label,baseline:"middle",fill:$.label})}),i&&y.push({kind:"text",part:"color-legend-title",x:h(n.x),y:h(n.y+6),text:i,baseline:"middle",fill:$.label}),y}let a=Math.min(n.width/o.length,96),l=n.x+(n.width-a*o.length)/2,s=o.map((d,u)=>({kind:"rect",part:"color-legend-swatch",x:h(l+u*a),y:h(n.y),width:h(a),height:10,fill:d.fill,opacity:d.opacity,title:d.label})),c=e.kind==="threshold"?1:Math.max(1,Math.ceil(o.length*7*_/Math.max(1,a*o.length)));return o.forEach((d,u)=>{u%c!==0&&u!==o.length-1||s.push({kind:"text",part:"color-legend-label",x:h(l+(u+.5)*a),y:h(n.y+22),text:d.label,anchor:"middle",fill:$.label})}),i&&s.push({kind:"text",part:"color-legend-title",x:h(l-6),y:h(n.y+5),text:i,anchor:"end",baseline:"middle",fill:$.label}),s}var Un=1e4,qn=e=>Array.isArray(e)?{x:e[0],y:e[1],size:e[2],label:void 0,id:void 0,color:void 0,value:void 0}:{x:e.x,y:e.y,size:e.size,label:e.label,id:e.id,color:e.color,value:e.value};function Kn(e,n,t,r,i,o,a,l){if(r==="circle")return{...nn(e,n,t,i,o,a),part:l};let s=r==="square"?`M${h(e-t)} ${h(n-t)}h${h(2*t)}v${h(2*t)}h${h(-2*t)}Z`:r==="diamond"?`M${h(e)} ${h(n-t*1.3)}L${h(e+t*1.3)} ${h(n)}L${h(e)} ${h(n+t*1.3)}L${h(e-t*1.3)} ${h(n)}Z`:`M${h(e)} ${h(n-t*1.2)}L${h(e+t*1.15)} ${h(n+t*.9)}L${h(e-t*1.15)} ${h(n+t*.9)}Z`;return{kind:"path",part:l,d:s,fill:i,title:o,item:a}}function Yn(e,n){let t=[],r=e.series.map((v,P)=>({name:v.name,id:v.id,symbol:v.symbol??"circle",color:Ae(e,P,v.color),data:Xt(e,v.name)?[]:v.data.flatMap((T,G)=>{let B=qn(T);return oe(B.x)&&oe(B.y)?[{...B,index:G}]:[]})})),i=e.sampling==="auto"?Un:typeof e.sampling=="object"?e.sampling.threshold:1/0,o=r.reduce((v,P)=>v+P.data.length,0),a=o>i?Math.ceil(o/i):1;a>1&&t.push({code:"sampled",severity:"warning",message:`${o} points exceed the sampling threshold of ${i}; every ${a}th point is drawn.`});let l=a>1?r.map(v=>({...v,data:v.data.filter((P,T)=>T%a===0)})):r,s=l.flatMap(v=>v.data),c=en(e,s.length===0);if(c)return{...c,issues:t};let{width:d,height:u}=Te(e),m=e.colorScale?pn(e.colorLegend):{bottom:0,right:0,options:{}},y=e.series.map((v,P)=>({name:v.name,color:Ae(e,P,v.color)})),b=Ut(d,u,{...se,top:se.top+Yt(e,y,d)+(e.yAxis?.label?12:0),right:se.right+m.right,bottom:se.bottom+(e.xAxis?.label?14:0)+m.bottom}),p=e.markerSize??3,f=Math.max(0,e.hitRadius??0),x=Math.max(0,e.jitter??0),M=ae(s.map(v=>v.size)),I=v=>v==="diamond"?1.3:v==="triangle"?1.2:1,L=(v,P)=>Math.max(0,P?n.radius(v.size,M):p),O=0;for(let v of l){let P=v.data.some(G=>G.size!==void 0),T=I(v.symbol);for(let G of v.data)O=Math.max(O,L(G,P)*T)}let k=Math.min(1,Math.min(b.width,b.height)*.45/Math.max(1,O+x)),E=x*k,K=O*k+E,F=new Map,W=e.colorScale?hn(e.colorScale,s.map(v=>v.value),Ae(e,0),void 0,Me(e.format)):void 0,D=qe(Ue(s.map(v=>v.x),!1),[b.x+K,b.x+b.width-K],e.xAxis??{},e.format),H=qe(Ue(s.map(v=>v.y),!1),[b.y+b.height-K,b.y+K],e.yAxis??{},e.format),Ge=Ze(e,d,u,y),ue=[],Ot=[],je=[],Lt=[];for(let v of l){let P=v.data.some(T=>T.size!==void 0);for(let T of v.data){let G=T.index,B=n.describe(v.name,T,D,H),q=L(T,P)*k,V=h(D.scale(T.x)),U=h(H.scale(T.y));if(E>0){let re=`${Math.round(V)},${Math.round(U)}`,te=F.get(re)??0;if(F.set(re,te+1),te>0){let ie=te*2.399963;V=h(V+E*Math.cos(ie)),U=h(U+E*Math.sin(ie))}}let ne=W?.color(T.value),Z={label:B,id:T.id,series:v.name,seriesId:v.id??v.name,name:T.label,index:G,value:T.y},J=T.color??ne?.fill??v.color;if(ue.push(Kn(V,U,h(q),v.symbol,J,B,Z,P?n.part:"point")),f>0&&ue.push({kind:"circle",part:"hit",cx:V,cy:U,r:h(q+f),fill:J,opacity:0,title:B,item:Z}),e.labels&&T.label){let re=T.label.length*_,te=V-re/2,ie=U-q-4;Lt.some(ve=>Math.abs(ve.y-ie)<12&&te<ve.x+ve.w+4&&te+re+4>ve.x)||(Lt.push({x:te,y:ie,w:re}),Ot.push(R(V,h(ie),T.label,{part:"point-label",anchor:"middle",fill:"var(--skdx-color-text-default)"})))}}if(e.trendline&&v.data.length>=2){let T=e.trendline===!0?"linear":e.trendline,G=Xn(v.data.map(B=>[B.x,B.y]),T);if(G){let[B,q]=D.domain,V=`${v.name} trend${T==="linear"?"":` (${T})`}: r\xB2 ${G.r2.toFixed(2)}`,U=v.color;if(T==="linear")je.push({kind:"line",part:"trendline",x1:h(D.scale(B)),y1:h(H.scale(G.predict(B))),x2:h(D.scale(q)),y2:h(H.scale(G.predict(q))),stroke:U,dash:"5 4",strokeWidth:1.5,title:V});else{let ne=Array.from({length:40},(Z,J)=>B+(q-B)*J/39).map(Z=>({v:Z,p:G.predict(Z)})).filter(({p:Z})=>Number.isFinite(Z)).map(({v:Z,p:J})=>({x:h(D.scale(Z)),y:h(H.scale(J))}));ne.length>1&&je.push({kind:"path",part:"trendline",d:Ht(ne),stroke:U,dash:"5 4",strokeWidth:1.5,title:V})}}}}let Rt=-1/0,Pt=Qt(D.ticks,Math.max(1,b.width-2*K)),Bt=new Set;for(let v of[...Pt].sort((P,T)=>P.pos-T.pos)){let P=v.label.length*_,T=e.xAxis?.tickRotation??0,G=T?T<0?"end":"start":Oe(v.pos,v.label,d),B=-(G==="end"?P:G==="middle"?P/2:0),q=T*Math.PI/180,V=[B,B+P].flatMap(Z=>[-7,7].map(J=>v.pos+Z*Math.cos(q)-J*Math.sin(q))),U=Math.min(...V),ne=Math.max(...V);U<Rt+4||(Rt=ne,Bt.add(v))}let In=Pt.filter(v=>Bt.has(v)),Nt={...Ge,plot:b,xTicks:In,yTicks:H.ticks,baseline:H.zero},Dt={plot:b,x:v=>D.scale(_t(v)),y:v=>H.scale(v)},Tn=Ke(e.references,Dt),An=W&&(m.bottom||m.right)?fn(W,m.right?{x:b.x+b.width+12,y:b.y,width:m.right,height:b.height}:{x:b.x,y:u-m.bottom+8,width:b.width,height:m.bottom},m.options):[],Ft=n.opacity;return{...Ge,shapes:[...tn({...Nt,height:Nt.height-m.bottom},{xLabel:e.xAxis?.label,x:e.xAxis,y:{showLine:e.yAxis?.showLine,showTicks:e.yAxis?.showTicks,tickSize:e.yAxis?.tickSize,tickRotation:e.yAxis?.tickRotation}}),...e.yAxis?.label?[R(4,b.y-14,e.yAxis.label,{part:"axis-title",anchor:"start"})]:[],...Tn,...Ft!==void 0&&ue.some(v=>v.part===n.part)?ue.map(v=>(v.kind==="circle"||v.kind==="path")&&v.part!=="hit"?{...v,opacity:Ft}:v):ue,...je,...Ot,...ln(e.annotations,Dt),...An,...Ge.shapes],issues:t}}function Xn(e,n="linear"){let t;if(n==="polynomial"){let s=0,c=0,d=0,u=0,m=0,y=0,b=0,p=0;for(let[k,E]of e)s+=1,c+=k,d+=k*k,u+=k**3,m+=k**4,y+=E,b+=k*E,p+=k*k*E;let f=k=>k[0]*(k[4]*k[8]-k[5]*k[7])-k[1]*(k[3]*k[8]-k[5]*k[6])+k[2]*(k[3]*k[7]-k[4]*k[6]),M=f([m,u,d,u,d,c,d,c,s]);if(Math.abs(M)<1e-12)return;let I=f([p,u,d,b,d,c,y,c,s])/M,L=f([m,p,d,u,b,c,d,y,s])/M,O=f([m,u,p,u,d,b,d,c,y])/M;t=k=>I*k*k+L*k+O}else{let s=n==="logarithmic"||n==="power"?Math.log:y=>y,c=n==="exponential"||n==="power"?Math.log:y=>y,d=e.filter(([y,b])=>Number.isFinite(s(y))&&Number.isFinite(c(b))),u=Jn(d.map(([y,b])=>[s(y),c(b)]));if(!u)return;let m=n==="exponential"||n==="power"?Math.exp:y=>y;t=y=>m(u.intercept+u.slope*s(y))}let r=t,i=e.filter(([s])=>Number.isFinite(r(s)));if(i.length===0)return;let o=i.reduce((s,[,c])=>s+c,0)/i.length,a=0,l=0;for(let[s,c]of i)a+=(c-r(s))**2,l+=(c-o)**2;return{predict:r,r2:l===0?1:Math.max(0,1-a/l)}}function Ye(e){let[n,t]=e.sizeRange??[3,18];return Yn(e,{part:"bubble",opacity:.7,radius:(r,[i,o])=>oe(r)?o===i?(n+t)/2:n+Math.sqrt((r-i)/(o-i))*(t-n):3,describe:(r,i,o,a)=>`${r}${i.label?` ${i.label}`:""}: ${o.format(i.x)}, ${a.format(i.y)}${oe(i.size)?` (${a.format(i.size)})`:""}`})}function Jn(e){let n=e.length,t=e.reduce((c,d)=>c+d[0],0)/n,r=e.reduce((c,d)=>c+d[1],0)/n,i=0,o=0,a=0;for(let[c,d]of e)i+=(c-t)**2,o+=(c-t)*(d-r),a+=(d-r)**2;if(i===0)return;let l=o/i,s=a===0?1:o*o/(i*a);return{slope:l,intercept:r-l*t,r2:s}}function Le(e){return e==null?[]:(Array.isArray(e)?e:[e]).map(t=>typeof t=="object"?t:{id:t})}var Xe=e=>e.id??e.name??e.series,mn=e=>e.seriesId??e.series;function Y(e,n){let t=!1;return n.id!==void 0&&(t=!0,Xe(e)!==n.id&&e.id!==n.id&&e.name!==n.id)||n.series!==void 0&&(t=!0,mn(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 Q(e){let n={},t=Xe(e);t!==void 0&&(n.id=t);let r=mn(e);return r!==void 0&&e.series!==void 0&&(n.series=r),e.index!==void 0&&(n.index=e.index),n}var Je=(e,n)=>e.id===n.id&&e.series===n.series&&e.index===n.index&&e.category===n.category;function Qe(e,n,t){let r=Le(e),i=Q(n),o=r.some(a=>Y(n,a));return t==="single"?o?[]:[i]:o?r.filter(a=>!Y(n,a)):[...r,i]}var Qn=.2;function er(e){let n=$.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 tr=(e,n)=>e.kind==="text"?{...e,fill:$.grid}:{...e,opacity:(e.opacity??1)*n};function et(e,n){let t=Le(n.selected),r=n.highlighted===void 0||n.highlighted===null?[]:Le(n.highlighted),i=r[0];if(t.length===0&&!i)return e;let o={highlighted:n.highlightScope?.highlighted??"item",faded:n.highlightScope?.faded??"global"},a=[],l=d=>!i||r.some(u=>Y(d,u))?!0:o.highlighted==="series"?r.some(u=>u.series!==void 0&&Y(d,{series:u.series})):!1,s=d=>{if(!i||o.faded==="none"||l(d))return!1;if(o.faded==="series"){let u=i.series;return u!==void 0&&Y(d,{series:u})}return!0},c=e.shapes.map(d=>{let u=d.item;if(!u||u.legend)return d;if(t.some(m=>Y(u,m))){let m=er(d);m&&a.push(m)}return s(u)?tr(d,Qn):d});return a.length?{...e,shapes:[...c,...a]}:{...e,shapes:c}}var bn="var(--skdx-radius-default, var(--skdx-radius-md, 0.5rem))";function Re(e){return["tooltip","skeleton","label-background","stage-label-background","brush-handle"].includes(e)?bn:void 0}function de(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 tt=(e,n,t)=>n>=e.x&&n<=e.x+e.width&&t>=e.y&&t<=e.y+e.height;function xn(e,n){let t=0,r=1/0;return e.xs.forEach((i,o)=>{let a=Math.abs(i-n);a<r&&(r=a,t=o)}),t}function xe(e,n){let t=e.hit;if(!t||t.xs.length===0)return;let r=xn(t,n),i=t.rows[r]??[];return{index:r,rows:e.axisTooltipFormatter?.(i,r)??i}}function nt(e,n){let t=e.hit;if(!t||t.xs.length===0)return;let r=t.xs[xn(t,n)];return{kind:"line",part:"crosshair",x1:r,x2:r,y1:t.plot.y,y2:t.plot.y+t.plot.height,stroke:$.axis,dash:"3 3"}}function rt(e,n,t){let r=e.hit;if(!r||!r.crosshair||r.xs.length===0||!tt(r.plot,n,t))return[];let i=nt(e,n),{rows:o}=xe(e,n),a=e.tooltipAnchored?r.plot.y+8:t;return[i,...ze(i.x1,a,o,e.width,e.height,e.tooltipPlacement)]}function it(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 rt(e,i,t.plot.y+8)}function ot(e,n,t,r,i){if(!e.tooltip)return{lines:[],shapes:[]};if(e.hit?.crosshair){let{x:s,y:c}=de(t,r,i,e.width,e.height);if(tt(e.hit.plot,s,c)){let d=xe(e,s),u=nt(e,s);if(d&&u)return{lines:d.rows,shapes:[u]}}}let o=n?.closest?.("[data-skdx-part]"),a=e.tooltipFormatter?ee(e,n)?.item:void 0,l=a&&e.tooltipFormatter?.(a)||o&&Array.from(o.children).find(s=>s.tagName.toLowerCase()==="title")?.textContent;return l?{lines:Array.isArray(l)?l:[l],shapes:[]}:{lines:[],shapes:[]}}function gn(e,n,t,r,i,o,a){let l=e?.closest?.("[data-skdx-part]"),s=a&&a.tooltipFormatter?ee(a,e)?.item:void 0,c=s&&a?.tooltipFormatter?.(s)||l&&Array.from(l.children).find(b=>b.tagName.toLowerCase()==="title")?.textContent;if(!c)return[];let d=a?.tooltipAnchored?ee(a,e):void 0,u=d?a?.shapes[d.index]:void 0,{x:m,y}=u?ge(u):de(n,t,r,i,o);return ze(m,y,c,i,o,a?.tooltipPlacement)}function at(e,n,t,r,i){if(!e.tooltip)return[];if(e.hit?.crosshair){let{x:o,y:a}=de(t,r,i,e.width,e.height),l=rt(e,o,a);if(l.length>0)return l}return gn(n,t,r,i,e.width,e.height,e)}function st(e,n){let t=ee(e,n);return t&&!t.item.legend?Q(t.item):null}var nr=(e,n)=>{let{x:t,y:r}=ge(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 lt(e,n){let t=new Set,r=[];for(let i of e.shapes){if(!i.item||i.item.legend||i.part==="anchor"||!nr(i,n))continue;let o=Q(i.item),a=JSON.stringify(o);t.has(a)||(t.add(a),r.push(o))}return r}var ct=e=>({kind:"rect",part:"selection-box",x:h(e.x),y:h(e.y),width:h(e.width),height:h(e.height),fill:$.focus,opacity:.12,stroke:$.focus}),Be=(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 yn(e,n,t){let r=!1;for(let i=0,o=e.length-1;i<e.length;o=i++){let a=e[i],l=e[o];a.y>t!=l.y>t&&n<(l.x-a.x)*(t-a.y)/(l.y-a.y)+a.x&&(r=!r)}return r}function dt(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:a}=ge(i),l=i.kind==="circle"?i.cy:i.kind==="rect"?i.y+i.height/2:a;if(!yn(n,o,l))continue;let s=Q(i.item),c=JSON.stringify(s);t.has(c)||(t.add(c),r.push(s))}return r}var ut=e=>({kind:"path",part:"selection-lasso",d:e.length?`M${e.map(n=>`${h(n.x)} ${h(n.y)}`).join("L")}`:"",fill:$.focus,fillOpacity:.12,stroke:$.focus,dash:"4 3"}),Pe=6;function ht(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-Pe||n>i.x1+Pe))return Math.abs(n-i.x0)<=Pe?{bar:i,mode:"start"}:Math.abs(n-i.x1)<=Pe?{bar:i,mode:"end"}:{bar:i,mode:"move"}}}function pt(e,n,t){let r=e.edit;return vn(r,n,r.invert(n.bar.x0+t)-r.invert(n.bar.x0))}function ft(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(s=>s.index===n);if(!o)return;let a=t.altKey?t.shiftKey?"start":"end":"move",l=r.snap??r.invert(o.x0+10)-r.invert(o.x0);return vn(r,{bar:o,mode:a},i*l)}function vn(e,{bar:n,mode:t},r){let i=l=>e.snap?Math.round(l/e.snap)*e.snap:l,o=n.start,a=n.end;return t==="move"?(o=i(n.start+r),a=o+(n.end-n.start)):t==="start"?o=Math.min(i(n.start+r),n.end):a=Math.max(i(n.end+r),n.start),{id:n.id,name:n.name,start:o,end:a}}function mt(e,n,t){let r=e.edit,i=r.scale(t.start),o=r.scale(t.end);return{kind:"rect",part:"edit-ghost",x:h(Math.min(i,o)),y:h(n.bar.y),width:h(Math.max(1,Math.abs(o-i))),height:h(n.bar.height),fill:$.focus,opacity:.25,stroke:$.focus,rx:2}}var rr=64,ir=e=>Math.max(1,Math.min(rr,e));function bt(e,n,t,r){let i=n>0?.8:1.25,o=ir(e.view.zoom*i);if(o===e.view.zoom)return e.view;let{plot:a,scale:l}=e,[s,c]=e.view.center,d=(t-(a.x+a.width/2))/l,u=(r-(a.y+a.height/2))/l,m=e.view.zoom/o;return{center:[s+d*(1-m),e.fromY(e.toY(c)-u*(1-m))],zoom:o}}function xt(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 ee(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 Ne=e=>e.shapes.flatMap((n,t)=>n.item&&!n.item.legend?[t]:[]);function ge(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 gt(e,n){let t=n===null?void 0:e.shapes[n];if(!t)return[];let 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*_+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:a}=ge(t),l=t.item&&e.tooltipFormatter?.(t.item)||(t.item?.label??t.title??"");return[i,...l?ze(h(o),h(a),l,e.width,e.height):[]]}function yt(e,n,t){let r=Ne(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 le=2,ce=(e,n,t)=>{let r=Math.max(le,Math.min(t,Math.round(n))),i=Math.max(0,Math.min(t-r,Math.round(e)));return{start:i,end:i+r}},wn=(e,n)=>!e||e.start<=0&&e.end>=n;function vt(e,n,t){if(e.count<=le||!e.plot.width)return;let{start:r,end:i}=e.zoom,o=i-r,a=n>0?1.25:.8,l=Math.max(le,Math.min(e.count,Math.round(o*a)));if(l===o)return n>0&&!wn(e.zoom,e.count)?ce(r,l,e.count):void 0;let s=Math.max(0,Math.min(1,(t-e.plot.x)/e.plot.width)),c=r+s*o;return ce(c-s*l,l,e.count)}function wt(e,n,t,r){let i=n.end-n.start,o=Math.max(le,Math.min(e.count,Math.round(i/Math.max(.05,t)))),a=Math.max(0,Math.min(1,(r-e.plot.x)/Math.max(1,e.plot.width)));return ce(n.start+a*i-a*o,o,e.count)}function Mt(e,n,t){let r=n.end-n.start,i=e.plot.width/Math.max(1,r);return ce(n.start-t/i,r,e.count)}function kt(e,n,t){let r=e.brush;if(!r||!tt(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,a=(n-r.box.x)/Math.max(1,r.box.width)*e.count;return{grab:"move",zoom:ce(a-o/2,o,e.count)}}function St(e,n,t,r){let i=e.brush;if(!i)return t;let o=r/Math.max(1,i.box.width)*e.count;if(n==="move")return ce(t.start+o,t.end-t.start,e.count);if(n==="left")return{start:Math.max(0,Math.min(t.end-le,Math.round(t.start+o))),end:t.end};let a=Math.min(e.count,Math.max(t.start+le,Math.round(t.end+o)));return{start:t.start,end:a}}function Ct(e,n){switch(n.type){case"svg":return Promise.resolve($t(e,n.label,n.resolve));case"csv":return Promise.resolve($n(n.rows));case"png":{if(typeof document>"u"||typeof Image>"u")return Promise.reject(new Error("PNG export needs a browser"));let t=$t(e,n.label,n.resolve);return Sn(t,e.width,e.height,n.scale,n.background)}}}var X=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/"/g,"&quot;"),ye=e=>e.filter(([,n])=>n!==void 0&&n!=="").map(([n,t])=>` ${n}="${X(String(t))}"`).join("");function Mn(e){let n=e.title?`<title>${X(e.title)}</title>`:"",t=["data-skdx-part",e.part];switch(e.kind){case"path":return`<path${ye([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${ye([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${ye([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${ye([t,["cx",e.cx],["cy",e.cy],["r",e.r],["fill",e.fill],["stroke",e.stroke]])}>${n}</circle>`;case"text":return`<text${ye([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]])}>${X(e.text)}</text>`}}function kn(e){let n=e.defs??[];return n.length===0?"":`<defs>${n.map(t=>`<linearGradient id="${X(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="${X(r.color)}"${r.opacity===void 0?"":` stop-opacity="${r.opacity}"`}/>`).join("")}</linearGradient>`).join("")}</defs>`}function $t(e,n,t){let r=kn(e)+e.shapes.map(Mn).join("");return t&&(r=r.replace(/var\((--[\w-]+)\)/g,(i,o)=>t(o).trim()||i)),`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${e.width} ${e.height}" width="${e.width}" height="${e.height}" role="img" aria-label="${X(n)}" font-family="${X($.fontFamily)}" font-size="${X($.fontSize)}"><title>${X(n)}</title>${r}</svg>`}function Sn(e,n,t,r=2,i){return new Promise((o,a)=>{let l=URL.createObjectURL(new Blob([e],{type:"image/svg+xml;charset=utf-8"})),s=new Image;s.onload=()=>{URL.revokeObjectURL(l);let c=document.createElement("canvas");c.width=Math.round(n*r),c.height=Math.round(t*r);let d=c.getContext("2d");if(!d)return a(new Error("canvas 2d context unavailable"));i&&(d.fillStyle=i,d.fillRect(0,0,c.width,c.height)),d.drawImage(s,0,0,c.width,c.height),c.toBlob(u=>u?o(u):a(new Error("toBlob failed")),"image/png")},s.onerror=()=>{URL.revokeObjectURL(l),a(new Error("svg could not be decoded"))},s.src=l})}function $n(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 It(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 s=["",...l.slice(1).map(d=>d.replace(/:\s[^:]*$/,""))],c=r.rows.map(d=>[d[0],...d.slice(1).map(u=>u.slice(u.lastIndexOf(": ")+2))]);return[s,...c]}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(s=>s[l]!==void 0)),a=(l,s)=>l[s]===void 0?"":String(l[s]);return[o.map(l=>l[0]?.toUpperCase()+l.slice(1)),...i.map(l=>o.map(s=>a(l,s)))]}var Tt=new Map;function De(e){let n=Tt.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&&Tt.delete(e)}},publish(o,a){Object.assign(r,o);for(let l of t)l(o,a)}};return Tt.set(e,{group:i,listeners:t}),i}var Cn='[data-skdx-part]:not([data-skdx-part^="tooltip"]):not([data-skdx-part="focus"]):not([data-skdx-part="crosshair"])',At=`@keyframes skdx-in{from{opacity:0}to{opacity:1}}${Cn}{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){${Cn}{animation:none;transition:none}}`;function zt(e){let n=e.animate;return n&&e.shapes.length<=1500?`${n}ms`:void 0}var S=require("lit"),w=require("lit/decorators.js"),A=require("lit/directives/if-defined.js");var or={fromAttribute:()=>!1},C=class extends S.LitElement{constructor(){super(...arguments);this.legend=!1;this.tooltip=!0;this.selectionMode="none";this.loading=!1;this.decorative=!1;this.accessibleTable=!1;this.zoomable=!1;this.editable=!1;this.crossFilter=!1;this.animated=!1;this.responsive=!1;this.tip=[];this.overlay=[];this.portal=null;this.highlightState=null;this.crossState=null;this.lastCross=null;this.pointers=new Map;this.hover=null;this.token={};this.focused=null;this.hiddenState=[];this.drag=null;this.onPointerMove=t=>{let r=this.layout;if(!r)return;this.pointers.has(t.pointerId)&&this.pointers.set(t.pointerId,this.viewBox(t,r).x);let i=this.drag;if(i?.grab==="select"){let{x:o,y:a}=this.viewBox(t,r);this.overlay=[ct(Be(i.x,i.y,o,a))];return}if(i?.grab==="lasso"){let{x:o,y:a}=this.viewBox(t,r);i.points=[...i.points??[],{x:o,y:a}],this.overlay=[ut(i.points)];return}if(i?.grab==="edit"){if(!i.gantt)return;let{x:o}=this.viewBox(t,r);i.change=pt(r,i.gantt,o-i.x),this.overlay=[mt(r,i.gantt,i.change)];return}if(i?.grab==="map"){if(!r.map||!i.view)return;let{x:o,y:a}=this.viewBox(t,r);this.setView(xt(r.map,i.view,o-i.x,a-i.y));return}if(i&&r.hit){if(i.grab==="pinch"){let[a,l]=[...this.pointers.values()];if(a===void 0||l===void 0||!i.distance)return;this.setZoom(wt(r.hit,i.zoom,Math.abs(a-l)/i.distance,(a+l)/2));return}let{x:o}=this.viewBox(t,r);this.setZoom(i.grab==="pan"?Mt(r.hit,i.zoom,o-i.x):St(r.hit,i.grab,i.zoom,o-i.x));return}if(r.tooltipPortal){let{lines:o,shapes:a}=ot(r,t.target,t.currentTarget,t.clientX,t.clientY);this.tip=a,this.portal=o.length?{x:t.clientX,y:t.clientY,lines:o}:null}else{let o=at(r,t.target,t.currentTarget,t.clientX,t.clientY);(o.length>0||this.tip.length>0)&&(this.tip=o)}if(this.highlight(st(r,t.target)),this.syncId&&r.hit?.crosshair){let o=xe(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),a=ee(r,t.target)?.item.legend,l=this.canEdit(r)?ht(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()&&!a){this.drag={x:i,y:o,zoom:{start:0,end:0},grab:this.selectionMode==="lasso"?"lasso":"select",points:[{x:i,y:o}]},t.currentTarget.setPointerCapture(t.pointerId),this.clearTip();return}if(this.canPan(r)&&r.map){let c=r.map.plot;if(i<c.x||i>c.x+c.width||o<c.y||o>c.y+c.height)return;this.drag={x:i,y:o,zoom:{start:0,end:0},grab:"map",view:r.map.view},t.currentTarget.setPointerCapture(t.pointerId),this.clearTip();return}let s=r.hit;if(!(!s||!this.canZoom(r))){if(this.pointers.set(t.pointerId,i),this.pointers.size===2){let[c,d]=[...this.pointers.values()];this.drag={x:(c+d)/2,y:o,zoom:s.zoom,grab:"pinch",distance:Math.abs(c-d)||1}}else{let c=kt(s,i,o);if(c)this.drag={x:i,y:o,zoom:c.zoom,grab:c.grab},c.zoom!==s.zoom&&this.setZoom(c.zoom);else if(this.zoomable&&i>=s.plot.x&&i<=s.plot.x+s.plot.width&&o>=s.plot.y&&o<=s.plot.y+s.plot.height)this.drag={x:i,y:o,zoom:s.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:a,y:l}=this.viewBox(t,o);if(Math.abs(a-i.x)>2||Math.abs(l-i.y)>2){i.grab==="select"?this.setSelected(lt(o,Be(i.x,i.y,a,l))):i.grab==="lasso"?this.setSelected(dt(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 s=r.map.plot;if(i<s.x||i>s.x+s.width||o<s.y||o>s.y+s.height)return;t.preventDefault(),this.setView(bt(r.map,t.deltaY,i,o));return}let a=r.hit;if(!a||!this.canZoom(r)||o<a.plot.y||o>a.plot.y+a.plot.height)return;let l=vt(a,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=ee(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)?ft(r,this.focused,t):void 0;if(i){t.preventDefault(),this.emit("skdx-task-change",i);return}let o=yt(r,this.focused,t.key);if(o===void 0)return;t.preventDefault(),this.focused=o;let a=o===null?void 0:r.shapes[o]?.item;this.highlight(a?Q(a):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:a,palette:l,loading:s,error:c,emptyMessage:d,description:u,decorative:m,animated:y,responsive:b,highlighted:p,highlightScope:f,accessibleTable:x}=this;return{...typeof b=="object"&&this.measured!==void 0&&this.measured<(b.breakpoint??480)?b.compact:void 0,width:b&&this.measured?this.measured:t,height:r,animate:y,responsive:b,legend:i,tooltip:o,format:a,palette:l,loading:s,error:c,emptyMessage:d,description:u,decorative:m,highlighted:p===void 0?this.highlightState:p,highlightScope:f,accessibleTable:x,hiddenSeries:this.hiddenSeries??this.hiddenState,zoom:this.zoom??this.zoomState,selected:this.selected??this.selectedState,view:this.view??this.viewState}}emit(t,r){this.dispatchEvent(new CustomEvent(t,{detail:r,bubbles:!0,composed:!0}))}publish(t){this.syncId&&De(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=De(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&&Je(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(Qe(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 de(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&&Y(o.item,t));return i<0?!1:(this.getSvgElement()?.focus(),this.focused=i,!0)}export(t){let r=this.layout;return r?Ct(r,{...t,label:t.label??this.label??this.localName}):Promise.reject(new Error("not rendered yet"))}root(t,r,i){this.join();let o=et(We(t),this.sized());if(this.layout=o,o.issues!==this.reported){this.reported=o.issues;for(let f of o.issues??[])this.emit("skdx-data-issue",f)}let a=this.canZoom(o),l=this.canPan(o),s=this.canEdit(o),c=this.brushing(),d=a||l||s||c,u=!o.decorative&&Ne(o).length>0,m=zt(o),y=It(o,this.accessibleTable),b=typeof this.accessibleTable=="object"&&this.accessibleTable.caption||i,p=this.portal;return S.html`<svg
3
4
  xmlns="http://www.w3.org/2000/svg"
4
5
  viewBox="0 0 ${o.width} ${o.height}"
5
6
  width=${o.width}
6
7
  height=${o.height}
7
8
  role=${o.decorative?"presentation":"img"}
8
- aria-hidden=${o.decorative?"true":k.nothing}
9
- aria-label=${o.decorative?k.nothing:i}
10
- aria-describedby=${(0,T.ifDefined)(m)}
11
- tabindex=${u?0:k.nothing}
9
+ aria-hidden=${o.decorative?"true":S.nothing}
10
+ aria-label=${o.decorative?S.nothing:i}
11
+ aria-description=${(0,A.ifDefined)(o.description)}
12
+ tabindex=${u?0:S.nothing}
12
13
  data-skdx-chart=${r}
13
- data-zoomable=${s||l?"":k.nothing}
14
- data-brushing=${c&&!(s||l)?"":k.nothing}
15
- data-editable=${a?"":k.nothing}
16
- style=${b?`--skdx-chart-duration:${b}`:k.nothing}
14
+ data-zoomable=${a||l?"":S.nothing}
15
+ data-brushing=${c&&!(a||l)?"":S.nothing}
16
+ data-editable=${s?"":S.nothing}
17
+ style=${m?`--skdx-chart-duration:${m}`:S.nothing}
17
18
  font-family=${$.fontFamily}
18
19
  font-size=${$.fontSize}
19
- @pointermove=${o.tooltip||d?this.onPointerMove:k.nothing}
20
+ @pointermove=${o.tooltip||d?this.onPointerMove:S.nothing}
20
21
  @pointerleave=${()=>{this.clearTip(),this.highlight(null)}}
21
- @pointerdown=${d?this.onPointerDown:k.nothing}
22
- @pointerup=${d?this.onPointerUp:k.nothing}
23
- @pointercancel=${d?this.onPointerUp:k.nothing}
24
- @wheel=${s||l?this.onWheel:k.nothing}
25
- @dblclick=${s||l?()=>l?this.setView(void 0):this.setZoom(void 0):k.nothing}
22
+ @pointerdown=${d?this.onPointerDown:S.nothing}
23
+ @pointerup=${d?this.onPointerUp:S.nothing}
24
+ @pointercancel=${d?this.onPointerUp:S.nothing}
25
+ @wheel=${a||l?this.onWheel:S.nothing}
26
+ @dblclick=${a||l?()=>l?this.setView(void 0):this.setZoom(void 0):S.nothing}
26
27
  @click=${this.onClick}
27
- @keydown=${u?this.onKeyDown:k.nothing}
28
+ @keydown=${u?this.onKeyDown:S.nothing}
28
29
  @blur=${()=>{this.focused=null,this.highlight(null)}}
29
30
  >
30
31
  <title>${i}</title>
31
- ${o.description?k.svg`<desc id=${(0,T.ifDefined)(m)}>${o.description}</desc>`:k.nothing}
32
- ${b?k.svg`<style>${St}</style>`:k.nothing} ${En(o)}
33
- ${Pe(o.shapes)}
34
- ${Pe(this.tip.length||!this.crossState?this.tip:Qe(o,this.crossState))}
35
- ${Pe(ht(o,this.focused))} ${Pe(this.overlay)}
32
+ ${o.description?S.svg`<desc>${o.description}</desc>`:S.nothing}
33
+ ${m?S.svg`<style>${At}</style>`:S.nothing} ${ar(o)}
34
+ ${Fe(o.shapes)}
35
+ ${Fe(this.tip.length||!this.crossState?this.tip:it(o,this.crossState))}
36
+ ${Fe(gt(o,this.focused))} ${Fe(this.overlay)}
36
37
  </svg>
37
- ${f?k.html`<div
38
+ ${p?S.html`<div
38
39
  role="tooltip"
39
40
  data-skdx-tooltip=${r}
40
- style="left:${f.x+12}px;top:${f.y+12}px"
41
+ style="left:${p.x+12}px;top:${p.y+12}px"
41
42
  >
42
- ${f.lines.map(y=>k.html`<div>${y}</div>`)}
43
- </div>`:k.nothing}
44
- ${x?k.html`<table data-skdx-table=${r}>
43
+ ${p.lines.map(f=>S.html`<div>${f}</div>`)}
44
+ </div>`:S.nothing}
45
+ ${y?S.html`<table data-skdx-table=${r}>
45
46
  <caption>
46
- ${p}
47
+ ${b}
47
48
  </caption>
48
49
  <thead>
49
50
  <tr>
50
- ${(x[0]??[]).map(y=>k.html`<th scope="col">${y}</th>`)}
51
+ ${(y[0]??[]).map(f=>S.html`<th scope="col">${f}</th>`)}
51
52
  </tr>
52
53
  </thead>
53
54
  <tbody>
54
- ${x.slice(1).map(y=>k.html`<tr>
55
- ${y.map((w,I)=>I===0?k.html`<th scope="row">${w}</th>`:k.html`<td>${w}</td>`)}
55
+ ${y.slice(1).map(f=>S.html`<tr>
56
+ ${f.map((x,M)=>M===0?S.html`<th scope="row">${x}</th>`:S.html`<td>${x}</td>`)}
56
57
  </tr>`)}
57
58
  </tbody>
58
- </table>`:k.nothing}`}};C.styles=k.css`
59
+ </table>`:S.nothing}`}};C.styles=S.css`
59
60
  :host {
60
61
  display: inline-block;
61
62
  }
@@ -63,7 +64,6 @@
63
64
  display: block;
64
65
  max-width: 100%;
65
66
  height: auto;
66
- outline: none;
67
67
  }
68
68
  svg[data-zoomable] {
69
69
  cursor: grab;
@@ -78,6 +78,9 @@
78
78
  }
79
79
  :host([responsive]) {
80
80
  display: block;
81
+ /* Keep centered flex/grid hosts independent of the previous SVG's intrinsic width. */
82
+ width: 100%;
83
+ min-width: 0;
81
84
  }
82
85
  table {
83
86
  position: absolute;
@@ -97,7 +100,7 @@
97
100
  background: var(--skdx-color-surface-raised);
98
101
  color: var(--skdx-color-text-default);
99
102
  border: 1px solid var(--skdx-color-border-strong);
100
- border-radius: 3px;
103
+ border-radius: var(--skdx-radius-default, var(--skdx-radius-md, 0.5rem));
101
104
  padding: 4px 8px;
102
105
  font-family: var(--skdx-font-family);
103
106
  font-size: var(--skdx-font-size-xs);
@@ -106,4 +109,4 @@
106
109
  [role='tooltip'] > :first-child:not(:only-child) {
107
110
  font-weight: bold;
108
111
  }
109
- `,g([(0,v.property)({type:Number})],C.prototype,"width",2),g([(0,v.property)({type:Number})],C.prototype,"height",2),g([(0,v.property)()],C.prototype,"label",2),g([(0,v.property)({type:Boolean,reflect:!0})],C.prototype,"legend",2),g([(0,v.property)({type:Boolean,attribute:"no-tooltip",converter:Zn})],C.prototype,"tooltip",2),g([(0,v.property)({attribute:!1})],C.prototype,"format",2),g([(0,v.property)({attribute:!1})],C.prototype,"palette",2),g([(0,v.property)({attribute:!1})],C.prototype,"hiddenSeries",2),g([(0,v.property)({attribute:!1})],C.prototype,"selected",2),g([(0,v.property)({attribute:"selection-mode"})],C.prototype,"selectionMode",2),g([(0,v.property)({attribute:!1})],C.prototype,"highlighted",2),g([(0,v.property)({attribute:!1})],C.prototype,"highlightScope",2),g([(0,v.property)({type:Boolean,reflect:!0})],C.prototype,"loading",2),g([(0,v.property)()],C.prototype,"error",2),g([(0,v.property)({attribute:"empty-message"})],C.prototype,"emptyMessage",2),g([(0,v.property)()],C.prototype,"description",2),g([(0,v.property)({type:Boolean,reflect:!0})],C.prototype,"decorative",2),g([(0,v.property)({type:Boolean,attribute:"accessible-table"})],C.prototype,"accessibleTable",2),g([(0,v.property)({attribute:!1})],C.prototype,"zoom",2),g([(0,v.property)({attribute:!1})],C.prototype,"view",2),g([(0,v.property)({type:Boolean,reflect:!0})],C.prototype,"zoomable",2),g([(0,v.property)({type:Boolean,reflect:!0})],C.prototype,"editable",2),g([(0,v.property)({attribute:"sync-id"})],C.prototype,"syncId",2),g([(0,v.property)({type:Boolean,attribute:"cross-filter"})],C.prototype,"crossFilter",2),g([(0,v.property)({converter:{fromAttribute:t=>t===null?!1:t===""?!0:Number(t)}})],C.prototype,"animated",2),g([(0,v.property)({type:Boolean,reflect:!0})],C.prototype,"responsive",2),g([(0,v.state)()],C.prototype,"tip",2),g([(0,v.state)()],C.prototype,"overlay",2),g([(0,v.state)()],C.prototype,"portal",2),g([(0,v.state)()],C.prototype,"measured",2),g([(0,v.state)()],C.prototype,"viewState",2),g([(0,v.state)()],C.prototype,"highlightState",2),g([(0,v.state)()],C.prototype,"crossState",2),g([(0,v.state)()],C.prototype,"focused",2),g([(0,v.state)()],C.prototype,"hiddenState",2),g([(0,v.state)()],C.prototype,"zoomState",2),g([(0,v.state)()],C.prototype,"selectedState",2);var z=class extends C{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:a,labels:c,curve:d,connectNulls:u,nulls:m,stacked:b,stackOffset:x,orientation:p,radius:f,barGap:y,barWidth:w,sort:I,transform:A,transforms:L,bins:M,binWidth:F,binDomain:Z,binMode:B,sampling:G,brush:j,crosshair:Q}=this;return{...this.sized(),series:t,categories:r,xAxis:i,yAxis:o,rightAxis:s,references:l,annotations:a,labels:c,curve:d,connectNulls:u,nulls:m,stacked:b,stackOffset:x,orientation:p,radius:f,barGap:y,barWidth:w,sort:I,transform:A,transforms:L,bins:M,binWidth:F,binDomain:Z,binMode:B,sampling:G,brush:j,crosshair:Q}}};g([(0,v.property)({attribute:!1})],z.prototype,"series",2),g([(0,v.property)({attribute:!1})],z.prototype,"categories",2),g([(0,v.property)({attribute:!1})],z.prototype,"xAxis",2),g([(0,v.property)({attribute:!1})],z.prototype,"yAxis",2),g([(0,v.property)({attribute:!1})],z.prototype,"rightAxis",2),g([(0,v.property)({attribute:!1})],z.prototype,"references",2),g([(0,v.property)({attribute:!1})],z.prototype,"annotations",2),g([(0,v.property)({type:Boolean,reflect:!0})],z.prototype,"labels",2),g([(0,v.property)()],z.prototype,"curve",2),g([(0,v.property)({type:Boolean,attribute:"connect-nulls"})],z.prototype,"connectNulls",2),g([(0,v.property)()],z.prototype,"nulls",2),g([(0,v.property)({reflect:!0,converter:{fromAttribute:t=>t==="percent"?"percent":t!==null}})],z.prototype,"stacked",2),g([(0,v.property)({attribute:"stack-offset"})],z.prototype,"stackOffset",2),g([(0,v.property)()],z.prototype,"orientation",2),g([(0,v.property)({type:Number})],z.prototype,"radius",2),g([(0,v.property)({type:Number,attribute:"bar-gap"})],z.prototype,"barGap",2),g([(0,v.property)({type:Number,attribute:"bar-width"})],z.prototype,"barWidth",2),g([(0,v.property)()],z.prototype,"sort",2),g([(0,v.property)()],z.prototype,"transform",2),g([(0,v.property)({attribute:!1})],z.prototype,"transforms",2),g([(0,v.property)({type:Number})],z.prototype,"bins",2),g([(0,v.property)({type:Number,attribute:"bin-width"})],z.prototype,"binWidth",2),g([(0,v.property)({attribute:!1})],z.prototype,"binDomain",2),g([(0,v.property)({attribute:"bin-mode"})],z.prototype,"binMode",2),g([(0,v.property)({attribute:!1})],z.prototype,"sampling",2),g([(0,v.property)({type:Boolean,reflect:!0})],z.prototype,"brush",2),g([(0,v.property)({type:Boolean,reflect:!0})],z.prototype,"crosshair",2);var En=e=>e.defs&&e.defs.length?k.svg`<defs>${e.defs.map(n=>k.svg`<linearGradient id=${n.id} x1="0" y1="0" x2=${n.vertical===!1?1:0} y2=${n.vertical===!1?0:1}>${n.stops.map(t=>k.svg`<stop offset=${t.offset} stop-color=${t.color} stop-opacity=${(0,T.ifDefined)(t.opacity)}></stop>`)}</linearGradient>`)}</defs>`:k.nothing,Pe=e=>k.svg`${e.map((n,t)=>{let r=n.title?k.svg`<title>${n.title}</title>`:k.nothing,i=n.item?t:void 0;switch(n.kind){case"path":return k.svg`<path data-skdx-part=${n.part} data-skdx-i=${(0,T.ifDefined)(i)} d=${n.d} fill=${n.fill??"none"} stroke=${(0,T.ifDefined)(n.stroke)} stroke-width=${(0,T.ifDefined)(n.strokeWidth)} stroke-linecap=${(0,T.ifDefined)(n.strokeLinecap)} stroke-linejoin=${(0,T.ifDefined)(n.strokeLinejoin)} stroke-dasharray=${(0,T.ifDefined)(n.dash)} opacity=${(0,T.ifDefined)(n.opacity)} fill-opacity=${(0,T.ifDefined)(n.fillOpacity)}>${r}</path>`;case"rect":return k.svg`<rect data-skdx-part=${n.part} data-skdx-i=${(0,T.ifDefined)(i)} x=${n.x} y=${n.y} width=${n.width} height=${n.height} rx=${(0,T.ifDefined)(n.rx)} fill=${n.fill} stroke=${(0,T.ifDefined)(n.stroke)} fill-opacity=${(0,T.ifDefined)(n.opacity)}>${r}</rect>`;case"line":return k.svg`<line data-skdx-part=${n.part} data-skdx-i=${(0,T.ifDefined)(i)} x1=${n.x1} y1=${n.y1} x2=${n.x2} y2=${n.y2} stroke=${n.stroke} stroke-width=${(0,T.ifDefined)(n.strokeWidth)} stroke-dasharray=${(0,T.ifDefined)(n.dash)} opacity=${(0,T.ifDefined)(n.opacity)}>${r}</line>`;case"circle":return k.svg`<circle data-skdx-part=${n.part} data-skdx-i=${(0,T.ifDefined)(i)} cx=${n.cx} cy=${n.cy} r=${n.r} fill=${n.fill} stroke=${(0,T.ifDefined)(n.stroke)} opacity=${(0,T.ifDefined)(n.opacity)}>${r}</circle>`;case"text":return k.svg`<text data-skdx-part=${n.part} data-skdx-i=${(0,T.ifDefined)(i)} x=${n.x} y=${n.y} text-anchor=${(0,T.ifDefined)(n.anchor)} dominant-baseline=${(0,T.ifDefined)(n.baseline)} fill=${(0,T.ifDefined)(n.fill)} font-weight=${(0,T.ifDefined)(n.weight)} pointer-events=${(0,T.ifDefined)(i===void 0?"none":void 0)} transform=${(0,T.ifDefined)(n.rotate?`rotate(${n.rotate} ${n.x} ${n.y})`:void 0)}>${n.text}</text>`}})}`;var P=class extends C{constructor(){super(...arguments);this.series=[];this.labels=!1}render(){let{series:t,sizeRange:r,labels:i,xAxis:o,yAxis:s,references:l,annotations:a,colorScale:c,colorLegend:d,hitRadius:u,jitter:m,trendline:b,sampling:x}=this;return this.root(Ee({...this.sized(),series:t,sizeRange:r,labels:i,xAxis:o,yAxis:s,references:l,annotations:a,colorScale:c,colorLegend:d,hitRadius:u,jitter:m,trendline:b,sampling:x}),"scatter",this.label??"Scatter chart")}};g([(0,N.property)({attribute:!1})],P.prototype,"series",2),g([(0,N.property)({attribute:!1})],P.prototype,"sizeRange",2),g([(0,N.property)({type:Boolean,reflect:!0})],P.prototype,"labels",2),g([(0,N.property)({attribute:!1})],P.prototype,"xAxis",2),g([(0,N.property)({attribute:!1})],P.prototype,"yAxis",2),g([(0,N.property)({attribute:!1})],P.prototype,"references",2),g([(0,N.property)({attribute:!1})],P.prototype,"annotations",2),g([(0,N.property)({attribute:!1})],P.prototype,"colorScale",2),g([(0,N.property)({attribute:!1})],P.prototype,"colorLegend",2),g([(0,N.property)({type:Number,attribute:"hit-radius"})],P.prototype,"hitRadius",2),g([(0,N.property)({type:Number})],P.prototype,"jitter",2),g([(0,N.property)({attribute:!1})],P.prototype,"trendline",2),g([(0,N.property)({attribute:!1})],P.prototype,"sampling",2),P=g([(0,N.customElement)("skdx-scatter-chart")],P);0&&(module.exports={SkdxScatterChart});
112
+ `,g([(0,w.property)({type:Number})],C.prototype,"width",2),g([(0,w.property)({type:Number})],C.prototype,"height",2),g([(0,w.property)()],C.prototype,"label",2),g([(0,w.property)({type:Boolean,reflect:!0})],C.prototype,"legend",2),g([(0,w.property)({type:Boolean,attribute:"no-tooltip",converter:or})],C.prototype,"tooltip",2),g([(0,w.property)({attribute:!1})],C.prototype,"format",2),g([(0,w.property)({attribute:!1})],C.prototype,"palette",2),g([(0,w.property)({attribute:!1})],C.prototype,"hiddenSeries",2),g([(0,w.property)({attribute:!1})],C.prototype,"selected",2),g([(0,w.property)({attribute:"selection-mode"})],C.prototype,"selectionMode",2),g([(0,w.property)({attribute:!1})],C.prototype,"highlighted",2),g([(0,w.property)({attribute:!1})],C.prototype,"highlightScope",2),g([(0,w.property)({type:Boolean,reflect:!0})],C.prototype,"loading",2),g([(0,w.property)()],C.prototype,"error",2),g([(0,w.property)({attribute:"empty-message"})],C.prototype,"emptyMessage",2),g([(0,w.property)()],C.prototype,"description",2),g([(0,w.property)({type:Boolean,reflect:!0})],C.prototype,"decorative",2),g([(0,w.property)({type:Boolean,attribute:"accessible-table"})],C.prototype,"accessibleTable",2),g([(0,w.property)({attribute:!1})],C.prototype,"zoom",2),g([(0,w.property)({attribute:!1})],C.prototype,"view",2),g([(0,w.property)({type:Boolean,reflect:!0})],C.prototype,"zoomable",2),g([(0,w.property)({type:Boolean,reflect:!0})],C.prototype,"editable",2),g([(0,w.property)({attribute:"sync-id"})],C.prototype,"syncId",2),g([(0,w.property)({type:Boolean,attribute:"cross-filter"})],C.prototype,"crossFilter",2),g([(0,w.property)({converter:{fromAttribute:t=>t===null?!1:t===""?!0:Number(t)}})],C.prototype,"animated",2),g([(0,w.property)({type:Boolean,reflect:!0})],C.prototype,"responsive",2),g([(0,w.state)()],C.prototype,"tip",2),g([(0,w.state)()],C.prototype,"overlay",2),g([(0,w.state)()],C.prototype,"portal",2),g([(0,w.state)()],C.prototype,"measured",2),g([(0,w.state)()],C.prototype,"viewState",2),g([(0,w.state)()],C.prototype,"highlightState",2),g([(0,w.state)()],C.prototype,"crossState",2),g([(0,w.state)()],C.prototype,"focused",2),g([(0,w.state)()],C.prototype,"hiddenState",2),g([(0,w.state)()],C.prototype,"zoomState",2),g([(0,w.state)()],C.prototype,"selectedState",2);var z=class extends C{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:a,references:l,annotations:s,labels:c,curve:d,connectNulls:u,nulls:m,stacked:y,stackOffset:b,orientation:p,radius:f,barGap:x,barWidth:M,sort:I,transform:L,transforms:O,bins:k,binWidth:E,binDomain:K,binMode:F,sampling:W,brush:D,crosshair:H}=this;return{...this.sized(),series:t,categories:r,xAxis:i,yAxis:o,rightAxis:a,references:l,annotations:s,labels:c,curve:d,connectNulls:u,nulls:m,stacked:y,stackOffset:b,orientation:p,radius:f,barGap:x,barWidth:M,sort:I,transform:L,transforms:O,bins:k,binWidth:E,binDomain:K,binMode:F,sampling:W,brush:D,crosshair:H}}};g([(0,w.property)({attribute:!1})],z.prototype,"series",2),g([(0,w.property)({attribute:!1})],z.prototype,"categories",2),g([(0,w.property)({attribute:!1})],z.prototype,"xAxis",2),g([(0,w.property)({attribute:!1})],z.prototype,"yAxis",2),g([(0,w.property)({attribute:!1})],z.prototype,"rightAxis",2),g([(0,w.property)({attribute:!1})],z.prototype,"references",2),g([(0,w.property)({attribute:!1})],z.prototype,"annotations",2),g([(0,w.property)({type:Boolean,reflect:!0})],z.prototype,"labels",2),g([(0,w.property)()],z.prototype,"curve",2),g([(0,w.property)({type:Boolean,attribute:"connect-nulls"})],z.prototype,"connectNulls",2),g([(0,w.property)()],z.prototype,"nulls",2),g([(0,w.property)({reflect:!0,converter:{fromAttribute:t=>t==="percent"?"percent":t!==null}})],z.prototype,"stacked",2),g([(0,w.property)({attribute:"stack-offset"})],z.prototype,"stackOffset",2),g([(0,w.property)()],z.prototype,"orientation",2),g([(0,w.property)({type:Number})],z.prototype,"radius",2),g([(0,w.property)({type:Number,attribute:"bar-gap"})],z.prototype,"barGap",2),g([(0,w.property)({type:Number,attribute:"bar-width"})],z.prototype,"barWidth",2),g([(0,w.property)()],z.prototype,"sort",2),g([(0,w.property)()],z.prototype,"transform",2),g([(0,w.property)({attribute:!1})],z.prototype,"transforms",2),g([(0,w.property)({type:Number})],z.prototype,"bins",2),g([(0,w.property)({type:Number,attribute:"bin-width"})],z.prototype,"binWidth",2),g([(0,w.property)({attribute:!1})],z.prototype,"binDomain",2),g([(0,w.property)({attribute:"bin-mode"})],z.prototype,"binMode",2),g([(0,w.property)({attribute:!1})],z.prototype,"sampling",2),g([(0,w.property)({type:Boolean,reflect:!0})],z.prototype,"brush",2),g([(0,w.property)({type:Boolean,reflect:!0})],z.prototype,"crosshair",2);var ar=e=>e.defs&&e.defs.length?S.svg`<defs>${e.defs.map(n=>S.svg`<linearGradient id=${n.id} x1="0" y1="0" x2=${n.vertical===!1?1:0} y2=${n.vertical===!1?0:1}>${n.stops.map(t=>S.svg`<stop offset=${t.offset} stop-color=${t.color} stop-opacity=${(0,A.ifDefined)(t.opacity)}></stop>`)}</linearGradient>`)}</defs>`:S.nothing,Fe=e=>S.svg`${e.map((n,t)=>{let r=n.title?S.svg`<title>${n.title}</title>`:S.nothing,i=n.item?t:void 0;switch(n.kind){case"path":return S.svg`<path data-skdx-part=${n.part} data-skdx-i=${(0,A.ifDefined)(i)} d=${n.d} fill=${n.fill??"none"} stroke=${(0,A.ifDefined)(n.stroke)} stroke-width=${(0,A.ifDefined)(n.strokeWidth)} stroke-linecap=${(0,A.ifDefined)(n.strokeLinecap)} stroke-linejoin=${(0,A.ifDefined)(n.strokeLinejoin)} stroke-dasharray=${(0,A.ifDefined)(n.dash)} opacity=${(0,A.ifDefined)(n.opacity)} fill-opacity=${(0,A.ifDefined)(n.fillOpacity)}>${r}</path>`;case"rect":return S.svg`<rect data-skdx-part=${n.part} data-skdx-i=${(0,A.ifDefined)(i)} x=${n.x} y=${n.y} width=${n.width} height=${n.height} rx=${(0,A.ifDefined)(n.rx)} style=${(0,A.ifDefined)(Re(n.part)?`rx:${Re(n.part)}`:void 0)} fill=${n.fill} stroke=${(0,A.ifDefined)(n.stroke)} fill-opacity=${(0,A.ifDefined)(n.opacity)} pointer-events=${(0,A.ifDefined)(n.part==="stage-label-background"||n.part==="label-background"?"none":void 0)}>${r}</rect>`;case"line":return S.svg`<line data-skdx-part=${n.part} data-skdx-i=${(0,A.ifDefined)(i)} x1=${n.x1} y1=${n.y1} x2=${n.x2} y2=${n.y2} stroke=${n.stroke} stroke-width=${(0,A.ifDefined)(n.strokeWidth)} stroke-dasharray=${(0,A.ifDefined)(n.dash)} opacity=${(0,A.ifDefined)(n.opacity)}>${r}</line>`;case"circle":return S.svg`<circle data-skdx-part=${n.part} data-skdx-i=${(0,A.ifDefined)(i)} cx=${n.cx} cy=${n.cy} r=${n.r} fill=${n.fill} stroke=${(0,A.ifDefined)(n.stroke)} opacity=${(0,A.ifDefined)(n.opacity)}>${r}</circle>`;case"text":return S.svg`<text aria-label=${(0,A.ifDefined)(n.title)} data-skdx-part=${n.part} data-skdx-i=${(0,A.ifDefined)(i)} x=${n.x} y=${n.y} text-anchor=${(0,A.ifDefined)(n.anchor)} dominant-baseline=${(0,A.ifDefined)(n.baseline)} fill=${(0,A.ifDefined)(n.fill)} font-weight=${(0,A.ifDefined)(n.weight)} pointer-events=${(0,A.ifDefined)(i===void 0?"none":void 0)} transform=${(0,A.ifDefined)(n.rotate?`rotate(${n.rotate} ${n.x} ${n.y})`:void 0)}>${n.text}</text>`}})}`;var N=class extends C{constructor(){super(...arguments);this.series=[];this.labels=!1}render(){let{series:t,sizeRange:r,labels:i,xAxis:o,yAxis:a,references:l,annotations:s,colorScale:c,colorLegend:d,hitRadius:u,jitter:m,trendline:y,sampling:b}=this;return this.root(Ye({...this.sized(),series:t,sizeRange:r,labels:i,xAxis:o,yAxis:a,references:l,annotations:s,colorScale:c,colorLegend:d,hitRadius:u,jitter:m,trendline:y,sampling:b}),"scatter",this.label??"Scatter chart")}};g([(0,j.property)({attribute:!1})],N.prototype,"series",2),g([(0,j.property)({attribute:!1})],N.prototype,"sizeRange",2),g([(0,j.property)({type:Boolean,reflect:!0})],N.prototype,"labels",2),g([(0,j.property)({attribute:!1})],N.prototype,"xAxis",2),g([(0,j.property)({attribute:!1})],N.prototype,"yAxis",2),g([(0,j.property)({attribute:!1})],N.prototype,"references",2),g([(0,j.property)({attribute:!1})],N.prototype,"annotations",2),g([(0,j.property)({attribute:!1})],N.prototype,"colorScale",2),g([(0,j.property)({attribute:!1})],N.prototype,"colorLegend",2),g([(0,j.property)({type:Number,attribute:"hit-radius"})],N.prototype,"hitRadius",2),g([(0,j.property)({type:Number})],N.prototype,"jitter",2),g([(0,j.property)({attribute:!1})],N.prototype,"trendline",2),g([(0,j.property)({attribute:!1})],N.prototype,"sampling",2),N=g([(0,j.customElement)("skdx-scatter-chart")],N);0&&(module.exports={SkdxScatterChart});
@@ -1,2 +1,2 @@
1
1
  import 'lit';
2
- export { aG as SkdxScatterChart } from './index-oF5ss8v9.cjs';
2
+ export { aH as SkdxScatterChart } from './index-D44-61v7.cjs';
package/dist/scatter.d.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  import 'lit';
2
- export { aG as SkdxScatterChart } from './index-oF5ss8v9.js';
2
+ export { aH as SkdxScatterChart } from './index-D44-61v7.js';