@skdx/web-components-charts 0.45.0 → 0.49.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (176) hide show
  1. package/dist/area.cjs +29 -29
  2. package/dist/area.d.cts +2 -1
  3. package/dist/area.d.ts +2 -1
  4. package/dist/area.js +31 -31
  5. package/dist/bar.cjs +29 -29
  6. package/dist/bar.d.cts +2 -1
  7. package/dist/bar.d.ts +2 -1
  8. package/dist/bar.js +33 -33
  9. package/dist/boxplot.cjs +35 -35
  10. package/dist/boxplot.d.cts +2 -1
  11. package/dist/boxplot.d.ts +2 -1
  12. package/dist/boxplot.js +38 -38
  13. package/dist/bubble.cjs +39 -39
  14. package/dist/bubble.d.cts +2 -1
  15. package/dist/bubble.d.ts +2 -1
  16. package/dist/bubble.js +38 -38
  17. package/dist/bullet.cjs +38 -38
  18. package/dist/bullet.d.cts +2 -1
  19. package/dist/bullet.d.ts +2 -1
  20. package/dist/bullet.js +40 -40
  21. package/dist/bump.cjs +37 -37
  22. package/dist/bump.d.cts +2 -1
  23. package/dist/bump.d.ts +2 -1
  24. package/dist/bump.js +37 -37
  25. package/dist/candlestick.cjs +34 -34
  26. package/dist/candlestick.d.cts +2 -1
  27. package/dist/candlestick.d.ts +2 -1
  28. package/dist/candlestick.js +35 -35
  29. package/dist/chord.cjs +37 -37
  30. package/dist/chord.d.cts +2 -1
  31. package/dist/chord.d.ts +2 -1
  32. package/dist/chord.js +39 -39
  33. package/dist/circle-packing.cjs +37 -37
  34. package/dist/circle-packing.d.cts +2 -1
  35. package/dist/circle-packing.d.ts +2 -1
  36. package/dist/circle-packing.js +37 -37
  37. package/dist/combo.cjs +29 -29
  38. package/dist/combo.d.cts +2 -1
  39. package/dist/combo.d.ts +2 -1
  40. package/dist/combo.js +33 -33
  41. package/dist/contracts.json +17886 -0
  42. package/dist/dumbbell.cjs +40 -40
  43. package/dist/dumbbell.d.cts +2 -1
  44. package/dist/dumbbell.d.ts +2 -1
  45. package/dist/dumbbell.js +39 -39
  46. package/dist/funnel.cjs +38 -38
  47. package/dist/funnel.d.cts +2 -1
  48. package/dist/funnel.d.ts +2 -1
  49. package/dist/funnel.js +38 -38
  50. package/dist/gantt.cjs +37 -37
  51. package/dist/gantt.d.cts +2 -1
  52. package/dist/gantt.d.ts +2 -1
  53. package/dist/gantt.js +40 -40
  54. package/dist/gauge.cjs +36 -36
  55. package/dist/gauge.d.cts +2 -1
  56. package/dist/gauge.d.ts +2 -1
  57. package/dist/gauge.js +35 -35
  58. package/dist/heatmap.cjs +38 -38
  59. package/dist/heatmap.d.cts +2 -1
  60. package/dist/heatmap.d.ts +2 -1
  61. package/dist/heatmap.js +39 -39
  62. package/dist/histogram.cjs +30 -30
  63. package/dist/histogram.d.cts +2 -1
  64. package/dist/histogram.d.ts +2 -1
  65. package/dist/histogram.js +34 -34
  66. package/dist/icicle.cjs +40 -40
  67. package/dist/icicle.d.cts +2 -1
  68. package/dist/icicle.d.ts +2 -1
  69. package/dist/icicle.js +40 -40
  70. package/dist/{index-H-_fLjtt.d.cts → index-BkR4iVqI.d.ts} +11 -1071
  71. package/dist/{index-H-_fLjtt.d.ts → index-DjnBT-5R.d.cts} +11 -1071
  72. package/dist/index.cjs +37 -37
  73. package/dist/index.d.cts +24 -3
  74. package/dist/index.d.ts +24 -3
  75. package/dist/index.js +38 -38
  76. package/dist/line.cjs +29 -29
  77. package/dist/line.d.cts +2 -1
  78. package/dist/line.d.ts +2 -1
  79. package/dist/line.js +31 -31
  80. package/dist/linear-gauge.cjs +33 -33
  81. package/dist/linear-gauge.d.cts +2 -1
  82. package/dist/linear-gauge.d.ts +2 -1
  83. package/dist/linear-gauge.js +40 -40
  84. package/dist/map.cjs +39 -39
  85. package/dist/map.d.cts +2 -1
  86. package/dist/map.d.ts +2 -1
  87. package/dist/map.js +37 -37
  88. package/dist/marimekko.cjs +40 -40
  89. package/dist/marimekko.d.cts +2 -1
  90. package/dist/marimekko.d.ts +2 -1
  91. package/dist/marimekko.js +38 -38
  92. package/dist/network.cjs +38 -38
  93. package/dist/network.d.cts +2 -1
  94. package/dist/network.d.ts +2 -1
  95. package/dist/network.js +39 -39
  96. package/dist/organization.cjs +38 -38
  97. package/dist/organization.d.cts +2 -1
  98. package/dist/organization.d.ts +2 -1
  99. package/dist/organization.js +38 -38
  100. package/dist/parallel.cjs +38 -38
  101. package/dist/parallel.d.cts +2 -1
  102. package/dist/parallel.d.ts +2 -1
  103. package/dist/parallel.js +40 -40
  104. package/dist/pareto.cjs +25 -25
  105. package/dist/pareto.d.cts +2 -1
  106. package/dist/pareto.d.ts +2 -1
  107. package/dist/pareto.js +24 -24
  108. package/dist/pie.cjs +38 -38
  109. package/dist/pie.d.cts +2 -1
  110. package/dist/pie.d.ts +2 -1
  111. package/dist/pie.js +38 -38
  112. package/dist/polar-area.cjs +38 -38
  113. package/dist/polar-area.d.cts +2 -1
  114. package/dist/polar-area.d.ts +2 -1
  115. package/dist/polar-area.js +40 -40
  116. package/dist/portable-runtime.js +1 -0
  117. package/dist/portable.cjs +1 -0
  118. package/dist/portable.d.cts +25 -0
  119. package/dist/portable.d.ts +25 -0
  120. package/dist/portable.js +1 -0
  121. package/dist/radar.cjs +39 -39
  122. package/dist/radar.d.cts +2 -1
  123. package/dist/radar.d.ts +2 -1
  124. package/dist/radar.js +37 -37
  125. package/dist/radial.cjs +36 -36
  126. package/dist/radial.d.cts +2 -1
  127. package/dist/radial.d.ts +2 -1
  128. package/dist/radial.js +37 -37
  129. package/dist/range.cjs +27 -27
  130. package/dist/range.d.cts +2 -1
  131. package/dist/range.d.ts +2 -1
  132. package/dist/range.js +27 -27
  133. package/dist/sankey.cjs +38 -38
  134. package/dist/sankey.d.cts +2 -1
  135. package/dist/sankey.d.ts +2 -1
  136. package/dist/sankey.js +36 -36
  137. package/dist/scatter.cjs +40 -40
  138. package/dist/scatter.d.cts +2 -1
  139. package/dist/scatter.d.ts +2 -1
  140. package/dist/scatter.js +39 -39
  141. package/dist/sparkline.cjs +36 -36
  142. package/dist/sparkline.d.cts +2 -1
  143. package/dist/sparkline.d.ts +2 -1
  144. package/dist/sparkline.js +37 -37
  145. package/dist/sunburst.cjs +37 -37
  146. package/dist/sunburst.d.cts +2 -1
  147. package/dist/sunburst.d.ts +2 -1
  148. package/dist/sunburst.js +40 -40
  149. package/dist/swarm.cjs +40 -40
  150. package/dist/swarm.d.cts +2 -1
  151. package/dist/swarm.d.ts +2 -1
  152. package/dist/swarm.js +39 -39
  153. package/dist/timeline.cjs +38 -38
  154. package/dist/timeline.d.cts +2 -1
  155. package/dist/timeline.d.ts +2 -1
  156. package/dist/timeline.js +40 -40
  157. package/dist/tree.cjs +38 -38
  158. package/dist/tree.d.cts +2 -1
  159. package/dist/tree.d.ts +2 -1
  160. package/dist/tree.js +38 -38
  161. package/dist/treemap.cjs +40 -40
  162. package/dist/treemap.d.cts +2 -1
  163. package/dist/treemap.d.ts +2 -1
  164. package/dist/treemap.js +38 -38
  165. package/dist/types-5xXhTghj.d.cts +1168 -0
  166. package/dist/types-5xXhTghj.d.ts +1168 -0
  167. package/dist/waffle.cjs +40 -40
  168. package/dist/waffle.d.cts +2 -1
  169. package/dist/waffle.d.ts +2 -1
  170. package/dist/waffle.js +39 -39
  171. package/dist/waterfall.cjs +37 -37
  172. package/dist/waterfall.d.cts +2 -1
  173. package/dist/waterfall.d.ts +2 -1
  174. package/dist/waterfall.js +38 -38
  175. package/dist/wrapper-api.json +1849 -0
  176. package/package.json +9 -5
package/dist/chord.js CHANGED
@@ -1,62 +1,62 @@
1
- var Yt=Object.defineProperty;var Qt=Object.getOwnPropertyDescriptor;var h=(e,n,t,r)=>{for(var i=r>1?void 0:r?Qt(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&&Yt(n,t,i),i};import{customElement as wn,property as me}from"lit/decorators.js";var It=e=>Number(e.toPrecision(12)),Xt,Jt=e=>(Xt??(Xt=new Intl.NumberFormat)).format(It(e)),en=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 Tt(e){if(e===void 0)return Jt;if(typeof e=="function")return e;let{style:n,locale:t,digits:r,unit:i="",timeZone:o}=e,s=u=>i?d=>u(d)+i:u,a=u=>r===void 0?u===void 0?{}:{maximumFractionDigits:u}:{minimumFractionDigits:r,maximumFractionDigits:r},c=u=>{let d=new Intl.NumberFormat(t,u);return s(b=>d.format(It(b)))},l=u=>{let d=new Intl.DateTimeFormat(t,o?{...u,timeZone:o}:u);return b=>d.format(b)};switch(n){case"integer":return c({maximumFractionDigits:0});case"decimal":return c(a(2));case"percent":return c({style:"percent",...a(0)});case"currency":return c({style:"currency",currency:e.currency??"USD",...a()});case"compact":return c({notation:"compact",...a(1)});case"scientific":return c({notation:"scientific",...a(2)});case"date":return l({dateStyle:"medium"});case"time":return l({timeStyle:"short"});case"datetime":return l({dateStyle:"medium",timeStyle:"short"});case"duration":return s(en)}}function Be(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,a=Math.floor(e/s)*s,c=Math.ceil(n/s)*s,l=[];for(let u=a;u<=c+s/2;u+=s)l.push(tn(u));return l}var tn=e=>Number(e.toPrecision(12)),g=e=>Number(e.toFixed(2)),ae=e=>typeof e=="number"&&Number.isFinite(e);var ie=1e3,oe=60*ie,se=60*oe,$e=24*se,Cn=[ie,5*ie,15*ie,30*ie,oe,5*oe,15*oe,30*oe,se,3*se,6*se,12*se,$e,2*$e,7*$e,14*$e];var nn=/-?\d*\.?\d+(?:e[-+]?\d+)?/gi,rn=/([MLTHVCSQAZmlthvcsqaz])([^MLTHVCSQAZmlthvcsqaz]*)/g,on={M:2,L:2,T:2,C:6,S:4,Q:4,A:7,H:-1,V:-2};function sn(e,n,t){return e.replace(rn,(r,i,o)=>{let s=on[i];if(s===void 0)return i+o;let c=(o.match(nn)??[]).map((l,u)=>{let d=Number(l);if(s===-1)return String(d+n);if(s===-2)return String(d+t);let b=u%s;return s===7?b===5?String(d+n):b===6?String(d+t):l:String(b%2===0?d+n:d+t)});return i+c.join(" ")})}var At=(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:sn(r.d,n,t)}}});var De=["primary","success","warning","danger","neutral"].flatMap(e=>[500,700].map(n=>`var(--skdx-color-${e}-${n})`)).sort((e,n)=>Number(e.endsWith("700)"))-Number(n.endsWith("700)"))),w={axis:"var(--skdx-color-border-strong)",grid:"var(--skdx-color-border-subtle)",label:"var(--skdx-color-text-muted)",focus:"var(--skdx-color-focus-ring)",positive:"var(--skdx-color-success-500)",negative:"var(--skdx-color-danger-500)",fontFamily:"var(--skdx-font-family)",fontSize:"var(--skdx-font-size-xs)"};var Ot=(e,n)=>n??De[e%De.length];function ce(e){let n=e.legend;if(n)return n===!0?{}:n.enabled===!1?void 0:n}function Lt(e){let n=e.tooltip;return n===void 0||n===!0?{enabled:!0}:n===!1?{enabled:!1}:{...n,enabled:n.enabled??!0}}var Me=20,an=120,zt=e=>{let n=ce(e);return n&&(n.position==="left"||n.position==="right")?n.width??an:0},we=(e,n=600,t=300)=>({width:(e.width??n)-zt(e),height:(e.height??t)-(ce(e)?.position==="bottom"?Me:0)}),Pt=(e,n,t)=>{let r=ce(e);return!r||!(r.position===void 0||r.position==="top")?0:(n?Math.max(1,Bt(n,t??we(e).width,r)):1)*Me},N=6.5;function cn(e,n){let t=Array.from(e),r=Math.max(0,Math.floor(n/N));return t.length<=r?e:r===0?"":`${t.slice(0,r-1).join("")}\u2026`}var Rt=(e,n,t)=>t??(e.palette&&e.palette.length>0?e.palette[n%e.palette.length]:Ot(n)),Fe=(e,n)=>e.hiddenSeries?.includes(n)??!1;function Ne(e,n,t=[],r={},i=10,o=8,s=!1){let a=[],c=r.maxItems,l=c!==void 0&&c>=0&&e.length>c?e.slice(0,c):e,u=e.length-l.length,d=r.interactive??!0,b=o,I=i,k=(v,y,S,A)=>{let T=(y?18:4)+v.length*N;b>o&&(s||b+T>n-8)&&(b=o,I+=Me),y&&a.push({kind:"rect",part:"legend-swatch",x:b,y:I-5,width:10,height:10,fill:y,opacity:A?.3:void 0,item:S}),a.push({kind:"text",part:"legend-label",x:b+(y?14:0),y:I,text:v,baseline:"middle",fill:A?w.grid:w.label,item:S}),b+=T+12};for(let v of l){let y=t.includes(v.name),S=d?{label:v.name,series:v.name,legend:!0}:void 0;k(r.formatter?.(v.name)??v.name,v.color,S,y)}return u>0&&k(`+${u} more`,void 0,void 0,!1),r.align==="end"?ln(a,n):a}function ln(e,n){let t=new Map;for(let i of e){let o=i.kind==="rect"?i.y+5:i.y;t.set(o,[...t.get(o)??[],i])}let r=[];for(let i of t.values()){let o=Math.max(...i.map(a=>a.kind==="rect"?a.x+a.width:a.x+a.text.length*N)),s=n-8-o;for(let a of i)r.push({...a,x:a.x+s})}return r}var Bt=(e,n,t={})=>new Set(Ne(e,n,[],t).flatMap(r=>r.kind==="text"?[r.y]:[])).size;function Ge(e,n,t,r=[]){let i=ce(e),o=i&&e.direction==="rtl"&&i.align===void 0?{...i,align:"end"}:i,s=Lt(e),a=o?.position==="bottom",c=zt(e),l=e.hiddenSeries??[],u=o?c?Ne(r,1/0,l,o,10,(o.position==="right"?n:0)+8,!0):Ne(r,n,l,o,a?t+10:10):[],d=a?Bt(r,n,o):0;return{width:n+c,height:a?t+Math.max(1,d)*Me:t,legendOffset:o?.position==="left"?c:void 0,tooltip:s.enabled,tooltipFormatter:s.formatter,axisTooltipFormatter:s.axisFormatter,tooltipPortal:s.portal,tooltipPlacement:s.placement,tooltipAnchored:s.followPointer===!1?!0:void 0,description:e.description,decorative:e.decorative,animate:e.animate===!0?300:e.animate||void 0,responsive:!!e.responsive,shapes:u}}function je(e){let n=e.legendOffset;if(!n)return e;let t=[...At(e.shapes.filter(c=>!c.part.startsWith("legend-")),n,0),...e.shapes.filter(c=>c.part.startsWith("legend-"))],r=c=>({...c,x:c.x+n}),i=e.hit?{...e.hit,plot:r(e.hit.plot),xs:e.hit.xs.map(c=>c+n),brush:e.hit.brush?{box:r(e.hit.brush.box),window:r(e.hit.brush.window)}:void 0}:void 0,o=e.edit,s=o?{...o,scale:c=>o.scale(c)+n,invert:c=>o.invert(c-n),bars:o.bars.map(c=>({...c,x0:c.x0+n,x1:c.x1+n}))}:void 0,a=e.map?{...e.map,plot:r(e.map.plot)}:void 0;return{...e,shapes:t,hit:i,edit:s,map:a,legendOffset:void 0}}function ke(e,n,t,r,i,o="auto"){let s=Array.isArray(t)?t:[t],a=Math.max(1,Math.floor((r-12)/N)),c=s.flatMap(y=>{let S=[],A=Array.from(y);for(;A.length>a;){let T=A.slice(0,a+1).lastIndexOf(" ");T<1&&(T=a),S.push(A.slice(0,T).join("")),A=A.slice(T),A[0]===" "&&A.shift()}return S.push(A.join("")),S}),l=Math.max(1,Math.floor((i-6)/16)),u=c.slice(0,l);c.length>l&&(u[l-1]=cn(`${u[l-1]}\u2026`,r-12));let d=Math.min(r,Math.max(0,...u.map(y=>Array.from(y).length))*N+12),b=Math.min(i,6+u.length*16),I=o==="top"?{x:e-d/2,y:n-b-8}:o==="bottom"?{x:e-d/2,y:n+8}:o==="left"?{x:e-d-8,y:n-b/2}:o==="right"?{x:e+8,y:n-b/2}:{x:e+12,y:n-b-6},k=Math.max(0,Math.min(r-d,I.x)),v=Math.max(0,Math.min(i-b,I.y));return[{kind:"rect",part:"tooltip",title:s.join(`
2
- `),x:g(k),y:g(v),width:g(d),height:b,fill:"var(--skdx-color-surface-raised)",stroke:w.axis,rx:8},...u.map((y,S)=>({kind:"text",part:"tooltip-label",x:g(k+6),y:g(v+11+S*16),text:y,baseline:"middle",fill:"var(--skdx-color-text-default)",weight:u.length>1&&S===0?"bold":void 0}))]}function Dt(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}=we(e,t,r),a=i==="error"?e.error:i==="loading"?"Loading\u2026":e.emptyMessage??"No data available",c=[];return i==="loading"&&c.push({kind:"rect",part:"skeleton",x:0,y:0,width:o,height:s,fill:"var(--skdx-color-surface-sunken)",rx:8}),c.push({kind:"text",part:`state-${i}`,x:g(o/2),y:g(s/2),text:a,anchor:"middle",baseline:"middle",fill:i==="error"?"var(--skdx-color-text-danger)":w.label}),{...Ge(e,o,s),shapes:c,tooltip:!1}}var _e=(e,n,t,r={})=>({kind:"text",part:"label",x:e,y:n,text:t,fill:w.label,...r});function le(e){return e==null?[]:(Array.isArray(e)?e:[e]).map(t=>typeof t=="object"?t:{id:t})}var He=e=>e.id??e.name??e.series,Nt=e=>e.seriesId??e.series;function F(e,n){let t=!1;return n.id!==void 0&&(t=!0,He(e)!==n.id&&e.id!==n.id&&e.name!==n.id)||n.series!==void 0&&(t=!0,Nt(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}var Ze=e=>le(e).flatMap(n=>n.id!==void 0?[n.id]:[]);function V(e){let n={},t=He(e);t!==void 0&&(n.id=t);let r=Nt(e);return r!==void 0&&e.series!==void 0&&(n.series=r),e.index!==void 0&&(n.index=e.index),n}var Ee=(e,n)=>e.id===n.id&&e.series===n.series&&e.index===n.index&&e.category===n.category;function Ve(e,n,t){let r=le(e),i=V(n),o=r.some(s=>F(n,s));return t==="single"?o?[]:[i]:o?r.filter(s=>!F(n,s)):[...r,i]}var un=.2;function dn(e){let n=w.focus;switch(e.kind){case"rect":return{kind:"rect",part:"selected",x:e.x-1.5,y:e.y-1.5,width:e.width+3,height:e.height+3,fill:"none",stroke:n,rx:e.rx};case"circle":return{kind:"circle",part:"selected",cx:e.cx,cy:e.cy,r:e.r+2.5,fill:"none",stroke:n};case"path":return{kind:"path",part:"selected",d:e.d,fill:"none",stroke:n,strokeWidth:2.5};case"line":return{...e,part:"selected",stroke:n,strokeWidth:(e.strokeWidth??1)+3,title:void 0,item:void 0};case"text":return}}var hn=(e,n)=>e.kind==="text"?{...e,fill:w.grid}:{...e,opacity:(e.opacity??1)*n};function We(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"},s=[],a=u=>!i||r.some(d=>F(u,d))?!0:o.highlighted==="series"?r.some(d=>d.series!==void 0&&F(u,{series:d.series})):!1,c=u=>{if(!i||o.faded==="none"||a(u))return!1;if(o.faded==="series"){let d=i.series;return d!==void 0&&F(u,{series:d})}return!0},l=e.shapes.map(u=>{let d=u.item;if(!d||d.legend)return u;if(t.some(b=>F(d,b))){let b=dn(u);b&&s.push(b)}return c(d)?hn(u,un):u});return s.length?{...e,shapes:[...l,...s]}:{...e,shapes:l}}var Ft=2*Math.PI;function Se(e,n,t,r,i,o){let s=(l,u)=>`${g(e+l*Math.sin(u))} ${g(n-l*Math.cos(u))}`;if(o-i>=Ft-1e-9){let l=i+Ft/2;return`${Se(e,n,t,r,i,l)}${Se(e,n,t,r,l,o)}`}let a=o-i>Math.PI?1:0,c=`M${s(t,i)}A${t} ${t} 0 ${a} 1 ${s(t,o)}`;return r>0?`${c}L${s(r,o)}A${r} ${r} 0 ${a} 0 ${s(r,i)}Z`:`${c}L${g(e)} ${g(n)}Z`}var Gt="var(--skdx-radius-default, var(--skdx-radius-md, 0.5rem))";function Ce(e){return["tooltip","skeleton","label-background","stage-label-background","brush-handle"].includes(e)?Gt:void 0}function re(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 Ue=(e,n,t)=>n>=e.x&&n<=e.x+e.width&&t>=e.y&&t<=e.y+e.height;function jt(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 ue(e,n){let t=e.hit;if(!t||t.xs.length===0)return;let r=jt(t,n),i=t.rows[r]??[];return{index:r,rows:e.axisTooltipFormatter?.(i,r)??i}}function Ke(e,n){let t=e.hit;if(!t||t.xs.length===0)return;let r=t.xs[jt(t,n)];return{kind:"line",part:"crosshair",x1:r,x2:r,y1:t.plot.y,y2:t.plot.y+t.plot.height,stroke:w.axis,dash:"3 3"}}function qe(e,n,t){let r=e.hit;if(!r||!r.crosshair||r.xs.length===0||!Ue(r.plot,n,t))return[];let i=Ke(e,n),{rows:o}=ue(e,n),s=e.tooltipAnchored?r.plot.y+8:t;return[i,...ke(i.x1,s,o,e.width,e.height,e.tooltipPlacement)]}function Ye(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 qe(e,i,t.plot.y+8)}function Qe(e,n,t,r,i){if(!e.tooltip)return{lines:[],shapes:[]};if(e.hit?.crosshair){let{x:c,y:l}=re(t,r,i,e.width,e.height);if(Ue(e.hit.plot,c,l)){let u=ue(e,c),d=Ke(e,c);if(u&&d)return{lines:u.rows,shapes:[d]}}}let o=n?.closest?.("[data-skdx-part]"),s=e.tooltipFormatter?W(e,n)?.item:void 0,a=s&&e.tooltipFormatter?.(s)||o&&Array.from(o.children).find(c=>c.tagName.toLowerCase()==="title")?.textContent;return a?{lines:Array.isArray(a)?a:[a],shapes:[]}:{lines:[],shapes:[]}}function _t(e,n,t,r,i,o,s){let a=e?.closest?.("[data-skdx-part]"),c=s&&s.tooltipFormatter?W(s,e)?.item:void 0,l=c&&s?.tooltipFormatter?.(c)||a&&Array.from(a.children).find(k=>k.tagName.toLowerCase()==="title")?.textContent;if(!l)return[];let u=s?.tooltipAnchored?W(s,e):void 0,d=u?s?.shapes[u.index]:void 0,{x:b,y:I}=d?de(d):re(n,t,r,i,o);return ke(b,I,l,i,o,s?.tooltipPlacement)}function Xe(e,n,t,r,i){if(!e.tooltip)return[];if(e.hit?.crosshair){let{x:o,y:s}=re(t,r,i,e.width,e.height),a=qe(e,o,s);if(a.length>0)return a}return _t(n,t,r,i,e.width,e.height,e)}function Je(e,n){let t=W(e,n);return t&&!t.item.legend?V(t.item):null}var pn=(e,n)=>{let{x:t,y:r}=de(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 et(e,n){let t=new Set,r=[];for(let i of e.shapes){if(!i.item||i.item.legend||i.part==="anchor"||!pn(i,n))continue;let o=V(i.item),s=JSON.stringify(o);t.has(s)||(t.add(s),r.push(o))}return r}var tt=e=>({kind:"rect",part:"selection-box",x:g(e.x),y:g(e.y),width:g(e.width),height:g(e.height),fill:w.focus,opacity:.12,stroke:w.focus}),Te=(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 Ht(e,n,t){let r=!1;for(let i=0,o=e.length-1;i<e.length;o=i++){let s=e[i],a=e[o];s.y>t!=a.y>t&&n<(a.x-s.x)*(t-s.y)/(a.y-s.y)+s.x&&(r=!r)}return r}function nt(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}=de(i),a=i.kind==="circle"?i.cy:i.kind==="rect"?i.y+i.height/2:s;if(!Ht(n,o,a))continue;let c=V(i.item),l=JSON.stringify(c);t.has(l)||(t.add(l),r.push(c))}return r}var rt=e=>({kind:"path",part:"selection-lasso",d:e.length?`M${e.map(n=>`${g(n.x)} ${g(n.y)}`).join("L")}`:"",fill:w.focus,fillOpacity:.12,stroke:w.focus,dash:"4 3"}),Ie=6;function it(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-Ie||n>i.x1+Ie))return Math.abs(n-i.x0)<=Ie?{bar:i,mode:"start"}:Math.abs(n-i.x1)<=Ie?{bar:i,mode:"end"}:{bar:i,mode:"move"}}}function ot(e,n,t){let r=e.edit;return Zt(r,n,r.invert(n.bar.x0+t)-r.invert(n.bar.x0))}function st(e,n,t){let r=e.edit,i=t.key==="ArrowRight"?1:t.key==="ArrowLeft"?-1:0;if(!r||n===null||!i||!(t.shiftKey||t.altKey))return;let o=r.bars.find(c=>c.index===n);if(!o)return;let s=t.altKey?t.shiftKey?"start":"end":"move",a=r.snap??r.invert(o.x0+10)-r.invert(o.x0);return Zt(r,{bar:o,mode:s},i*a)}function Zt(e,{bar:n,mode:t},r){let i=a=>e.snap?Math.round(a/e.snap)*e.snap:a,o=n.start,s=n.end;return t==="move"?(o=i(n.start+r),s=o+(n.end-n.start)):t==="start"?o=Math.min(i(n.start+r),n.end):s=Math.max(i(n.end+r),n.start),{id:n.id,name:n.name,start:o,end:s}}function at(e,n,t){let r=e.edit,i=r.scale(t.start),o=r.scale(t.end);return{kind:"rect",part:"edit-ghost",x:g(Math.min(i,o)),y:g(n.bar.y),width:g(Math.max(1,Math.abs(o-i))),height:g(n.bar.height),fill:w.focus,opacity:.25,stroke:w.focus,rx:2}}var mn=64,fn=e=>Math.max(1,Math.min(mn,e));function ct(e,n,t,r){let i=n>0?.8:1.25,o=fn(e.view.zoom*i);if(o===e.view.zoom)return e.view;let{plot:s,scale:a}=e,[c,l]=e.view.center,u=(t-(s.x+s.width/2))/a,d=(r-(s.y+s.height/2))/a,b=e.view.zoom/o;return{center:[c+u*(1-b),e.fromY(e.toY(l)-d*(1-b))],zoom:o}}function lt(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 W(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 Ae=e=>e.shapes.flatMap((n,t)=>n.item&&!n.item.legend?[t]:[]);function de(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 ut(e,n){let t=n===null?void 0:e.shapes[n];if(!t)return[];let r=w.focus,i;switch(t.kind){case"rect":i={kind:"rect",part:"focus",x:t.x-2,y:t.y-2,width:t.width+4,height:t.height+4,fill:"none",stroke:r,rx:2};break;case"circle":i={kind:"circle",part:"focus",cx:t.cx,cy:t.cy,r:t.r+3,fill:"none",stroke:r};break;case"line":i={kind:"line",part:"focus",x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:r,strokeWidth:4};break;case"text":i={kind:"rect",part:"focus",x:t.x-2,y:t.y-8,width:t.text.length*N+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}=de(t),a=t.item&&e.tooltipFormatter?.(t.item)||(t.item?.label??t.title??"");return[i,...a?ke(g(o),g(s),a,e.width,e.height):[]]}function dt(e,n,t){let r=Ae(e);if(r.length===0)return;let i=n===null?-1:r.indexOf(n);switch(t){case"ArrowRight":case"ArrowDown":return r[Math.min(r.length-1,i+1)];case"ArrowLeft":case"ArrowUp":return r[Math.max(0,i<=0?0:i-1)];case"Home":return r[0];case"End":return r[r.length-1];case"Escape":return null;default:return}}var te=2,ne=(e,n,t)=>{let r=Math.max(te,Math.min(t,Math.round(n))),i=Math.max(0,Math.min(t-r,Math.round(e)));return{start:i,end:i+r}},Et=(e,n)=>!e||e.start<=0&&e.end>=n;function ht(e,n,t){if(e.count<=te||!e.plot.width)return;let{start:r,end:i}=e.zoom,o=i-r,s=n>0?1.25:.8,a=Math.max(te,Math.min(e.count,Math.round(o*s)));if(a===o)return n>0&&!Et(e.zoom,e.count)?ne(r,a,e.count):void 0;let c=Math.max(0,Math.min(1,(t-e.plot.x)/e.plot.width)),l=r+c*o;return ne(l-c*a,a,e.count)}function pt(e,n,t,r){let i=n.end-n.start,o=Math.max(te,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 ne(n.start+s*i-s*o,o,e.count)}function mt(e,n,t){let r=n.end-n.start,i=e.plot.width/Math.max(1,r);return ne(n.start-t/i,r,e.count)}function ft(e,n,t){let r=e.brush;if(!r||!Ue(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:ne(s-o/2,o,e.count)}}function bt(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 ne(t.start+o,t.end-t.start,e.count);if(n==="left")return{start:Math.max(0,Math.min(t.end-te,Math.round(t.start+o))),end:t.end};let s=Math.min(e.count,Math.max(t.start+te,Math.round(t.end+o)));return{start:t.start,end:s}}function xt(e,n){switch(n.type){case"svg":return Promise.resolve(gt(e,n.label,n.resolve));case"csv":return Promise.resolve(Kt(n.rows));case"png":{if(typeof document>"u"||typeof Image>"u")return Promise.reject(new Error("PNG export needs a browser"));let t=gt(e,n.label,n.resolve);return Ut(t,e.width,e.height,n.scale,n.background)}}}var G=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/"/g,"&quot;"),he=e=>e.filter(([,n])=>n!==void 0&&n!=="").map(([n,t])=>` ${n}="${G(String(t))}"`).join("");function Vt(e){let n=e.title?`<title>${G(e.title)}</title>`:"",t=["data-skdx-part",e.part];switch(e.kind){case"path":return`<path${he([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${he([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${he([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${he([t,["cx",e.cx],["cy",e.cy],["r",e.r],["fill",e.fill],["stroke",e.stroke]])}>${n}</circle>`;case"text":return`<text${he([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]])}>${G(e.text)}</text>`}}function Wt(e){let n=e.defs??[];return n.length===0?"":`<defs>${n.map(t=>`<linearGradient id="${G(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="${G(r.color)}"${r.opacity===void 0?"":` stop-opacity="${r.opacity}"`}/>`).join("")}</linearGradient>`).join("")}</defs>`}function gt(e,n,t){let r=Wt(e)+e.shapes.map(Vt).join("");return t&&(r=r.replace(/var\((--[\w-]+)\)/g,(i,o)=>t(o).trim()||i)),`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${e.width} ${e.height}" width="${e.width}" height="${e.height}" role="img" aria-label="${G(n)}" font-family="${G(w.fontFamily)}" font-size="${G(w.fontSize)}"><title>${G(n)}</title>${r}</svg>`}function Ut(e,n,t,r=2,i){return new Promise((o,s)=>{let a=URL.createObjectURL(new Blob([e],{type:"image/svg+xml;charset=utf-8"})),c=new Image;c.onload=()=>{URL.revokeObjectURL(a);let l=document.createElement("canvas");l.width=Math.round(n*r),l.height=Math.round(t*r);let u=l.getContext("2d");if(!u)return s(new Error("canvas 2d context unavailable"));i&&(u.fillStyle=i,u.fillRect(0,0,l.width,l.height)),u.drawImage(c,0,0,l.width,l.height),l.toBlob(d=>d?o(d):s(new Error("toBlob failed")),"image/png")},c.onerror=()=>{URL.revokeObjectURL(a),s(new Error("svg could not be decoded"))},c.src=a})}function Kt(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 yt(e,n){if(!n)return;let t=typeof n=="object"?n.maxRows??500:500,r=e.hit;if(r&&r.rows.length>0){let a=r.rows[0];if(r.rows.length>t)return;let c=["",...a.slice(1).map(u=>u.replace(/:\s[^:]*$/,""))],l=r.rows.map(u=>[u[0],...u.slice(1).map(d=>d.slice(d.lastIndexOf(": ")+2))]);return[c,...l]}let i=e.shapes.flatMap(a=>a.item&&!a.item.legend&&!(a.part==="anchor"&&!a.title)?[a.item]:[]);if(i.length===0||i.length>t)return;let o=["series","name","category","value"].filter(a=>i.some(c=>c[a]!==void 0)),s=(a,c)=>a[c]===void 0?"":String(a[c]);return[o.map(a=>a[0]?.toUpperCase()+a.slice(1)),...i.map(a=>o.map(c=>s(a,c)))]}var vt=new Map;function Oe(e){let n=vt.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&&vt.delete(e)}},publish(o,s){Object.assign(r,o);for(let a of t)a(o,s)}};return vt.set(e,{group:i,listeners:t}),i}var qt='[data-skdx-part]:not([data-skdx-part^="tooltip"]):not([data-skdx-part="focus"]):not([data-skdx-part="crosshair"])',$t=`@keyframes skdx-in{from{opacity:0}to{opacity:1}}${qt}{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){${qt}{animation:none;transition:none}}`;function Mt(e){let n=e.animate;return n&&e.shapes.length<=1500?`${n}ms`:void 0}var bn=2*Math.PI,gn=12,pe=5;function xn(e){let n=[];if(e.links){let i=[...e.names??[]],o=new Set(i);for(let c of e.links)for(let l of[c.source,c.target])o.has(l)||(e.names&&n.push({code:"unknown-node",severity:"warning",message:`Link ${c.source} \u2192 ${c.target} names "${l}", which is not in \`names\`; it was added.`,itemId:c.id}),o.add(l),i.push(l));let s=new Map(i.map((c,l)=>[c,l])),a=i.map(()=>i.map(()=>0));for(let c of e.links){if(!ae(c.value)||c.value<0){n.push({code:"invalid-value",severity:"warning",message:`Link ${c.source} \u2192 ${c.target} has no valid value and was dropped.`,itemId:c.id});continue}let l=a[s.get(c.source)];l[s.get(c.target)]=l[s.get(c.target)]+c.value}return{names:i,matrix:a,issues:n}}let t=e.names??[],r=e.matrix??[];return(r.length!==t.length||r.some(i=>i.length!==t.length))&&n.push({code:"ragged-matrix",severity:"warning",message:`The matrix is ${r.length} \xD7 ${r[0]?.length??0} but there are ${t.length} names; missing cells count as zero.`}),{names:t,matrix:r,issues:n}}function wt(e){let{names:n,matrix:t,issues:r}=xn(e),i=Dt(e,n.length===0||!t.some(p=>p.some(m=>ae(m)&&m>0)),300,300);if(i)return{...i,issues:r};let o=Tt(e.format),{width:s,height:a}=we(e,300,300),c=(p,m)=>{let L=t[p]?.[m];return ae(L)?Math.max(0,L):0},l=p=>n.reduce((m,L,P)=>m+c(p,P)+c(P,p),0),u=n.map((p,m)=>m);e.sort&&u.sort((p,m)=>e.sort==="asc"?l(p)-l(m):l(m)-l(p));let d=u.map(p=>n[p]),b=p=>Rt(e,u[p]),I=d.map((p,m)=>({name:p,color:b(m)})),k=Pt(e,I,s),v=s/2,y=k+(a-k)/2,S=e.ticks?8+pe+14:8,A=S+Math.max(0,...n.map(p=>p.length))*N+4,T=Math.max(0,Math.min(s/2-A,(a-k)/2-36)),O=Math.max(0,T-gn),fe=(e.padding??2.3)*Math.PI/180,K=d.length,be=Ze(e.selected)[0],D=be===void 0?-1:d.indexOf(String(be)),_=(p,m)=>Fe(e,d[p])||Fe(e,d[m])?0:c(u[p],u[m]),q=d.map((p,m)=>d.reduce((L,P,z)=>L+_(m,z),0)),ge=q.reduce((p,m)=>p+m,0),xe=ge>0?(bn-fe*K)/ge:0,H=(p,m)=>`${g(v+m*Math.sin(p))} ${g(y-m*Math.cos(p))}`,ye=[],Y=0;for(let p=0;p<K;p++){let m=Y,L=d.map((P,z)=>{let Z=Y;return Y+=_(p,z)*xe,{a0:Z,a1:Y}});ye.push({a0:m,a1:Y,sub:L}),Y+=fe}let Q=[],kt=[];for(let p=0;p<K;p++)for(let m=p;m<K;m++){let L=_(p,m),P=_(m,p);if(L+P===0)continue;let z=ye[p].sub[m],Z=ye[m].sub[p],X=ee=>ee.a1-ee.a0>Math.PI?1:0,J=p===m?`M${H(z.a0,O)}A${O} ${O} 0 ${X(z)} 1 ${H(z.a1,O)}Q${g(v)} ${g(y)} ${H(z.a0,O)}Z`:`M${H(z.a0,O)}A${O} ${O} 0 ${X(z)} 1 ${H(z.a1,O)}Q${g(v)} ${g(y)} ${H(Z.a0,O)}A${O} ${O} 0 ${X(Z)} 1 ${H(Z.a1,O)}Q${g(v)} ${g(y)} ${H(z.a0,O)}Z`,ze=L>=P?p:m,ve=D<0||p===D||m===D,E=p===m?`${d[p]}: ${o(L)}`:`${d[p]} \u2192 ${d[m]}: ${o(L)} \xB7 ${d[m]} \u2192 ${d[p]}: ${o(P)}`;Q.push({kind:"path",part:"chord",d:J,fill:b(ze),opacity:ve?.5:.08,title:E,item:{label:E,id:`${d[p]}\u2192${d[m]}`,name:d[p],category:d[m],value:L+P}})}ye.forEach((p,m)=>{if(p.a1<=p.a0)return;let L=`${d[m]}: ${o(q[m])}`;Q.push({kind:"path",part:"group",d:Se(v,y,T,O,p.a0,p.a1),fill:b(m),opacity:D<0||m===D||_(m,D)+_(D,m)>0?void 0:.3,title:L,item:{label:L,id:d[m],name:d[m],index:m,value:q[m]}});let P=(p.a0+p.a1)/2,z=Math.sin(P),Z=T+S;if(Q.push(_e(g(v+Z*z),g(y-Z*Math.cos(P)),d[m],{anchor:z>.1?"start":z<-.1?"end":"middle",baseline:"middle"})),!e.ticks)return;let X=q[m];Be(0,X,4).filter(J=>J<=X).forEach((J,ze)=>{let ve=p.a0+J*xe,E=Math.sin(ve),ee=Math.cos(ve);if(Q.push({kind:"line",part:"tick",x1:g(v+T*E),y1:g(y-T*ee),x2:g(v+(T+pe)*E),y2:g(y-(T+pe)*ee),stroke:w.axis}),ze%2)return;let Pe=g(v+(T+pe+3)*E),Re=g(y-(T+pe+3)*ee);kt.some(Ct=>Math.abs(Ct.x-Pe)<12&&Math.abs(Ct.y-Re)<12)||(kt.push({x:Pe,y:Re}),Q.push(_e(Pe,Re,o(J),{part:"tick-label",anchor:E>.1?"start":E<-.1?"end":"middle",baseline:"middle"})))})});let St=Ge(e,s,a,I);return{...St,shapes:[...Q,...St.shapes],issues:r}}import{css as yn,html as U,LitElement as vn,nothing as C,svg as R}from"lit";import{property as f,state as B}from"lit/decorators.js";import{ifDefined as $}from"lit/directives/if-defined.js";var $n={fromAttribute:()=>!1},x=class extends vn{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=[tt(Te(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=[rt(i.points)];return}if(i?.grab==="edit"){if(!i.gantt)return;let{x:o}=this.viewBox(t,r);i.change=ot(r,i.gantt,o-i.x),this.overlay=[at(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(lt(r.map,i.view,o-i.x,s-i.y));return}if(i&&r.hit){if(i.grab==="pinch"){let[s,a]=[...this.pointers.values()];if(s===void 0||a===void 0||!i.distance)return;this.setZoom(pt(r.hit,i.zoom,Math.abs(s-a)/i.distance,(s+a)/2));return}let{x:o}=this.viewBox(t,r);this.setZoom(i.grab==="pan"?mt(r.hit,i.zoom,o-i.x):bt(r.hit,i.grab,i.zoom,o-i.x));return}if(r.tooltipPortal){let{lines:o,shapes:s}=Qe(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=Xe(r,t.target,t.currentTarget,t.clientX,t.clientY);(o.length>0||this.tip.length>0)&&(this.tip=o)}if(this.highlight(Je(r,t.target)),this.syncId&&r.hit?.crosshair){let o=ue(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=W(r,t.target)?.item.legend,a=this.canEdit(r)?it(r,i,o):void 0;if(a){this.drag={x:i,y:o,zoom:{start:0,end:0},grab:"edit",gantt:a},t.currentTarget.setPointerCapture(t.pointerId),this.clearTip();return}if(this.brushing()&&!s){this.drag={x:i,y:o,zoom:{start:0,end:0},grab:this.selectionMode==="lasso"?"lasso":"select",points:[{x:i,y:o}]},t.currentTarget.setPointerCapture(t.pointerId),this.clearTip();return}if(this.canPan(r)&&r.map){let l=r.map.plot;if(i<l.x||i>l.x+l.width||o<l.y||o>l.y+l.height)return;this.drag={x:i,y:o,zoom:{start:0,end:0},grab:"map",view:r.map.view},t.currentTarget.setPointerCapture(t.pointerId),this.clearTip();return}let c=r.hit;if(!(!c||!this.canZoom(r))){if(this.pointers.set(t.pointerId,i),this.pointers.size===2){let[l,u]=[...this.pointers.values()];this.drag={x:(l+u)/2,y:o,zoom:c.zoom,grab:"pinch",distance:Math.abs(l-u)||1}}else{let l=ft(c,i,o);if(l)this.drag={x:i,y:o,zoom:l.zoom,grab:l.grab},l.zoom!==c.zoom&&this.setZoom(l.zoom);else if(this.zoomable&&i>=c.plot.x&&i<=c.plot.x+c.plot.width&&o>=c.plot.y&&o<=c.plot.y+c.plot.height)this.drag={x:i,y:o,zoom:c.zoom,grab:"pan"};else{this.pointers.delete(t.pointerId);return}}t.currentTarget.setPointerCapture(t.pointerId),this.clearTip()}};this.onPointerUp=t=>{this.pointers.delete(t.pointerId);let r=t.currentTarget;r.hasPointerCapture(t.pointerId)&&r.releasePointerCapture(t.pointerId);let i=this.drag,o=this.layout;if(o&&(i?.grab==="select"||i?.grab==="lasso"||i?.grab==="edit"||i?.grab==="map")){this.overlay=[];let{x:s,y:a}=this.viewBox(t,o);if(Math.abs(s-i.x)>2||Math.abs(a-i.y)>2){i.grab==="select"?this.setSelected(et(o,Te(i.x,i.y,s,a))):i.grab==="lasso"?this.setSelected(nt(o,i.points??[])):i.grab==="edit"&&i.change&&this.emit("skdx-task-change",i.change),this.drag={...i,distance:-1};return}this.drag=null;return}(this.pointers.size===0||this.drag?.grab==="pinch")&&(this.drag=null)};this.onWheel=t=>{let r=this.layout;if(!r)return;let{x:i,y:o}=this.viewBox(t,r);if(r.map&&this.canPan(r)){let c=r.map.plot;if(i<c.x||i>c.x+c.width||o<c.y||o>c.y+c.height)return;t.preventDefault(),this.setView(ct(r.map,t.deltaY,i,o));return}let s=r.hit;if(!s||!this.canZoom(r)||o<s.plot.y||o>s.plot.y+s.plot.height)return;let a=ht(s,t.deltaY,i);a&&(t.preventDefault(),this.setZoom(a))};this.onClick=t=>{if(!this.layout)return;if(this.drag?.distance===-1){this.drag=null;return}let r=W(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 a=r.shapes[this.focused]?.item;a&&(t.preventDefault(),this.select(a),this.emit("skdx-item-click",a));return}let i=this.canEdit(r)?st(r,this.focused,t):void 0;if(i){t.preventDefault(),this.emit("skdx-task-change",i);return}let o=dt(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?V(s):null)}}connectedCallback(){super.connectedCallback(),!(typeof ResizeObserver>"u")&&(this.observer=new ResizeObserver(([t])=>{let r=Math.floor(t?.contentRect.width??0);r>0&&(this.measured=r)}),this.observer.observe(this))}disconnectedCallback(){this.observer?.disconnect(),this.leave?.(),this.leave=void 0,this.joined=void 0,super.disconnectedCallback()}sized(){let{width:t,height:r,legend:i,tooltip:o,format:s,palette:a,loading:c,error:l,emptyMessage:u,description:d,decorative:b,animated:I,responsive:k,highlighted:v,highlightScope:y,accessibleTable:S}=this;return{...typeof k=="object"&&this.measured!==void 0&&this.measured<(k.breakpoint??480)?k.compact:void 0,width:k&&this.measured?this.measured:t,height:r,animate:I,responsive:k,legend:i,tooltip:o,format:s,palette:a,loading:c,error:l,emptyMessage:u,description:d,decorative:b,highlighted:v===void 0?this.highlightState:v,highlightScope:y,accessibleTable:S,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&&Oe(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=Oe(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&&Ee(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(Ve(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 re(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&&F(o.item,t));return i<0?!1:(this.getSvgElement()?.focus(),this.focused=i,!0)}export(t){let r=this.layout;return r?xt(r,{...t,label:t.label??this.label??this.localName}):Promise.reject(new Error("not rendered yet"))}root(t,r,i){this.join();let o=We(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),a=this.canPan(o),c=this.canEdit(o),l=this.brushing(),u=s||a||c||l,d=!o.decorative&&Ae(o).length>0,b=Mt(o),I=yt(o,this.accessibleTable),k=typeof this.accessibleTable=="object"&&this.accessibleTable.caption||i,v=this.portal;return U`<svg
1
+ var nn=Object.defineProperty;var rn=Object.getOwnPropertyDescriptor;var u=(e,n,t,r)=>{for(var i=r>1?void 0:r?rn(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&&nn(n,t,i),i};import{customElement as An,property as me}from"lit/decorators.js";var Lt=new Set(["__proto__","constructor","prototype"]),Be="skdx-chart-snapshot-request-v1";function Ne(e,n){let t=r=>{if(r.target!==e)return;let i=r.detail;if(!(!i||typeof i.receive!="function"))try{i.receive(n())}catch(o){i.receive(void 0,o instanceof Error?o.message:String(o))}};return e.addEventListener(Be,t),()=>e.removeEventListener(Be,t)}function D(e){return!!e&&typeof e=="object"&&!Array.isArray(e)&&(Object.getPrototypeOf(e)===Object.prototype||Object.getPrototypeOf(e)===null)}function De(e,n,t){let r=[],i=0,o=new Set,a=(s,l,h=0)=>{if(++i>1e5||h>64)throw new Error("Chart snapshot exceeds bounded input size/depth");if(s===null||typeof s=="boolean"||typeof s=="string")return s;if(typeof s=="number")return Number.isFinite(s)?s:{$number:String(s)};if(s===void 0)return;if(typeof s=="function"){r.push({code:"unserializable-chart-callback",path:l,message:"Callback omitted; captured geometry retains its actual output. Do not reconstruct this configuration as a literal renderer input."});return}if(s instanceof Date)return Number.isFinite(s.getTime())?{$date:s.toISOString()}:{$date:"Invalid Date"};if(!Array.isArray(s)&&!D(s))throw new Error(`Unsupported chart snapshot value at ${l}`);if(o.has(s))throw new Error(`Cyclic chart input at ${l}`);o.add(s);let d;if(Array.isArray(s))d=s.map((g,S)=>a(g,`${l}[${S}]`,h+1)??null);else{let g=[];for(let[S,C]of Object.entries(s)){if(Lt.has(S))throw new Error("Unsafe chart snapshot key");let y=a(C,`${l}.${S}`,h+1);y!==void 0&&g.push([S,y])}d=Object.fromEntries(g)}return o.delete(s),d},c={width:t.width,height:t.height,shapes:t.shapes,...t.defs?{defs:t.defs}:{},...t.issues?{issues:t.issues}:{},...t.table?{table:t.table}:{}};return zt({schemaVersion:"1.0.0",kind:e,configuration:a(n,"input"),canvas:a(c,"canvas"),diagnostics:r})}function zt(e){let n=0,t=(s,l=0)=>{if(++n>1e5||l>64)throw new Error("Chart snapshot exceeds bounded input size/depth");if(!(s===null||typeof s=="boolean"||typeof s=="string")&&!(typeof s=="number"&&Number.isFinite(s))){if(Array.isArray(s)){s.forEach(h=>t(h,l+1));return}if(!D(s))throw new Error("Chart snapshot must contain plain JSON only");for(let[h,d]of Object.entries(s)){if(Lt.has(h))throw new Error("Unsafe chart snapshot key");t(d,l+1)}}};if(t(e),new TextEncoder().encode(JSON.stringify(e)).byteLength>8388608)throw new Error("Chart snapshot exceeds 8MB");if(!D(e)||Object.keys(e).some(s=>!["schemaVersion","kind","configuration","canvas","diagnostics"].includes(s))||e.schemaVersion!=="1.0.0"||typeof e.kind!="string"||!/^[a-z][a-z0-9-]*$/.test(e.kind)||!D(e.configuration)||!D(e.canvas)||!Array.isArray(e.diagnostics))throw new Error("Unsupported chart snapshot envelope");let r=e.canvas;if(Object.keys(r).some(s=>!["width","height","shapes","defs","issues","table"].includes(s)))throw new Error("Unsupported runtime geometry field");let i=(s,l=-1e5)=>typeof s=="number"&&Number.isFinite(s)&&s>=l&&s<=1e5;if(!i(r.width,.01)||!i(r.height,.01)||!Array.isArray(r.shapes)||!r.shapes.length||r.shapes.length>2e4)throw new Error("Invalid chart snapshot viewport/geometry");let o={path:["d","fill","stroke","strokeWidth","strokeLinecap","strokeLinejoin","opacity","fillOpacity","dash"],rect:["x","y","width","height","fill","stroke","opacity","rx"],line:["x1","y1","x2","y2","stroke","dash","strokeWidth","opacity"],circle:["cx","cy","r","fill","stroke","opacity"],text:["x","y","text","anchor","baseline","fill","weight","rotate"]},a={path:["d"],rect:["x","y","width","height","fill"],line:["x1","y1","x2","y2","stroke"],circle:["cx","cy","r","fill"],text:["x","y","text"]},c=new Set(["x","y","x1","y1","x2","y2","width","height","cx","cy","r","strokeWidth","opacity","fillOpacity","rx","rotate"]);for(let s of r.shapes){if(!D(s)||typeof s.kind!="string"||!Object.hasOwn(o,s.kind)||typeof s.part!="string"||!s.part||Object.keys(s).some(l=>!["kind","part","title","item",...o[s.kind]??[]].includes(l)))throw new Error("Unsupported owner shape");for(let l of a[s.kind]??[])if(!(l in s))throw new Error("Missing owner geometry field");for(let[l,h]of Object.entries(s)){if(c.has(l)&&!i(h,["width","height","r","strokeWidth","rx","opacity","fillOpacity"].includes(l)?0:-1e5))throw new Error("Invalid owner geometry number");if(["opacity","fillOpacity"].includes(l)&&Number(h)>1)throw new Error("Invalid owner paint opacity");if(!c.has(l)&&l!=="item"&&typeof h!="string")throw new Error("Invalid owner shape field")}if(s.kind==="path"&&(typeof s.d!="string"||!/^\s*[Mm][MmLlHhVvCcSsQqTtAaZz0-9eE+.,\s-]*$/.test(s.d)||(s.d.match(/[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?/g)??[]).some(l=>!i(Number(l)))))throw new Error("Invalid owner path geometry");for(let[l,h]of Object.entries({anchor:["start","middle","end"],baseline:["middle","hanging"],weight:["bold"],strokeLinecap:["round"],strokeLinejoin:["round"]}))if(s[l]!==void 0&&(typeof s[l]!="string"||!h.includes(s[l])))throw new Error("Invalid owner shape enum")}if(r.defs!==void 0){if(!Array.isArray(r.defs)||r.defs.length>1e3)throw new Error("Invalid owner gradient list");let s=new Set;for(let l of r.defs){if(!D(l)||typeof l.id!="string"||!/^[A-Za-z][\w-]*$/.test(l.id)||s.has(l.id)||Object.keys(l).some(d=>!["id","vertical","stops"].includes(d))||l.vertical!==void 0&&typeof l.vertical!="boolean"||!Array.isArray(l.stops)||l.stops.length<2||l.stops.length>64)throw new Error("Invalid owner gradient");s.add(l.id);let h=-1;for(let d of l.stops){if(!D(d)||Object.keys(d).some(g=>!["offset","color","opacity"].includes(g))||!i(d.offset,0)||d.offset>1||d.offset<h||typeof d.color!="string"||d.opacity!==void 0&&(!i(d.opacity,0)||d.opacity>1))throw new Error("Invalid owner gradient stop");h=d.offset}}}for(let s of e.diagnostics)if(!D(s)||Object.keys(s).some(l=>!["code","path","message"].includes(l))||[s.code,s.path,s.message].some(l=>typeof l!="string"||!l))throw new Error("Invalid snapshot diagnostic");return e}var Rt=e=>Number(e.toPrecision(12)),on,sn=e=>(on??(on=new Intl.NumberFormat)).format(Rt(e)),an=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 Pt(e){if(e===void 0)return sn;if(typeof e=="function")return e;let{style:n,locale:t,digits:r,unit:i="",timeZone:o}=e,a=h=>i?d=>h(d)+i:h,c=h=>r===void 0?h===void 0?{}:{maximumFractionDigits:h}:{minimumFractionDigits:r,maximumFractionDigits:r},s=h=>{let d=new Intl.NumberFormat(t,h);return a(g=>d.format(Rt(g)))},l=h=>{let d=new Intl.DateTimeFormat(t,o?{...h,timeZone:o}:h);return g=>d.format(g)};switch(n){case"integer":return s({maximumFractionDigits:0});case"decimal":return s(c(2));case"percent":return s({style:"percent",...c(0)});case"currency":return s({style:"currency",currency:e.currency??"USD",...c()});case"compact":return s({notation:"compact",...c(1)});case"scientific":return s({notation:"scientific",...c(2)});case"date":return l({dateStyle:"medium"});case"time":return l({timeStyle:"short"});case"datetime":return l({dateStyle:"medium",timeStyle:"short"});case"duration":return a(an)}}function je(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,c=Math.floor(e/a)*a,s=Math.ceil(n/a)*a,l=[];for(let h=c;h<=s+a/2;h+=a)l.push(cn(h));return l}var cn=e=>Number(e.toPrecision(12)),b=e=>Number(e.toFixed(2)),ce=e=>typeof e=="number"&&Number.isFinite(e);var oe=1e3,se=60*oe,ae=60*se,ke=24*ae,Rn=[oe,5*oe,15*oe,30*oe,se,5*se,15*se,30*se,ae,3*ae,6*ae,12*ae,ke,2*ke,7*ke,14*ke];var ln=/-?\d*\.?\d+(?:e[-+]?\d+)?/gi,dn=/([MLTHVCSQAZmlthvcsqaz])([^MLTHVCSQAZmlthvcsqaz]*)/g,hn={M:2,L:2,T:2,C:6,S:4,Q:4,A:7,H:-1,V:-2};function un(e,n,t){return e.replace(dn,(r,i,o)=>{let a=hn[i];if(a===void 0)return i+o;let s=(o.match(ln)??[]).map((l,h)=>{let d=Number(l);if(a===-1)return String(d+n);if(a===-2)return String(d+t);let g=h%a;return a===7?g===5?String(d+n):g===6?String(d+t):l:String(g%2===0?d+n:d+t)});return i+s.join(" ")})}var Et=(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:un(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)"};var Bt=(e,n)=>n??_e[e%_e.length];function le(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 $e=20,pn=120,Dt=e=>{let n=le(e);return n&&(n.position==="left"||n.position==="right")?n.width??pn:0},Me=(e,n=600,t=300)=>({width:(e.width??n)-Dt(e),height:(e.height??t)-(le(e)?.position==="bottom"?$e:0)}),jt=(e,n,t)=>{let r=le(e);return!r||!(r.position===void 0||r.position==="top")?0:(n?Math.max(1,Ft(n,t??Me(e).width,r)):1)*$e},j=6.5;function fn(e,n){let t=Array.from(e),r=Math.max(0,Math.floor(n/j));return t.length<=r?e:r===0?"":`${t.slice(0,r-1).join("")}\u2026`}var _t=(e,n,t)=>t??(e.palette&&e.palette.length>0?e.palette[n%e.palette.length]:Bt(n)),Ge=(e,n)=>e.hiddenSeries?.includes(n)??!1;function Fe(e,n,t=[],r={},i=10,o=8,a=!1){let c=[],s=r.maxItems,l=s!==void 0&&s>=0&&e.length>s?e.slice(0,s):e,h=e.length-l.length,d=r.interactive??!0,g=o,S=i,C=(y,v,M,A)=>{let I=(v?18:4)+y.length*j;g>o&&(a||g+I>n-8)&&(g=o,S+=$e),v&&c.push({kind:"rect",part:"legend-swatch",x:g,y:S-5,width:10,height:10,fill:v,opacity:A?.3:void 0,item:M}),c.push({kind:"text",part:"legend-label",x:g+(v?14:0),y:S,text:y,baseline:"middle",fill:A?$.grid:$.label,item:M}),g+=I+12};for(let y of l){let v=t.includes(y.name),M=d?{label:y.name,series:y.name,legend:!0}:void 0;C(r.formatter?.(y.name)??y.name,y.color,M,v)}return h>0&&C(`+${h} more`,void 0,void 0,!1),r.align==="end"?mn(c,n):c}function mn(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(c=>c.kind==="rect"?c.x+c.width:c.x+c.text.length*j)),a=n-8-o;for(let c of i)r.push({...c,x:c.x+a})}return r}var Ft=(e,n,t={})=>new Set(Fe(e,n,[],t).flatMap(r=>r.kind==="text"?[r.y]:[])).size;function Ve(e,n,t,r=[]){let i=le(e),o=i&&e.direction==="rtl"&&i.align===void 0?{...i,align:"end"}:i,a=Nt(e),c=o?.position==="bottom",s=Dt(e),l=e.hiddenSeries??[],h=o?s?Fe(r,1/0,l,o,10,(o.position==="right"?n:0)+8,!0):Fe(r,n,l,o,c?t+10:10):[],d=c?Ft(r,n,o):0;return{width:n+s,height:c?t+Math.max(1,d)*$e: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:h}}function He(e){let n=e.legendOffset;if(!n)return e;let t=[...Et(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,c=e.map?{...e.map,plot:r(e.map.plot)}:void 0;return{...e,shapes:t,hit:i,edit:a,map:c,legendOffset:void 0}}function Se(e,n,t,r,i,o="auto"){let a=Array.isArray(t)?t:[t],c=Math.max(1,Math.floor((r-12)/j)),s=a.flatMap(v=>{let M=[],A=Array.from(v);for(;A.length>c;){let I=A.slice(0,c+1).lastIndexOf(" ");I<1&&(I=c),M.push(A.slice(0,I).join("")),A=A.slice(I),A[0]===" "&&A.shift()}return M.push(A.join("")),M}),l=Math.max(1,Math.floor((i-6)/16)),h=s.slice(0,l);s.length>l&&(h[l-1]=fn(`${h[l-1]}\u2026`,r-12));let d=Math.min(r,Math.max(0,...h.map(v=>Array.from(v).length))*j+12),g=Math.min(i,6+h.length*16),S=o==="top"?{x:e-d/2,y:n-g-8}:o==="bottom"?{x:e-d/2,y:n+8}:o==="left"?{x:e-d-8,y:n-g/2}:o==="right"?{x:e+8,y:n-g/2}:{x:e+12,y:n-g-6},C=Math.max(0,Math.min(r-d,S.x)),y=Math.max(0,Math.min(i-g,S.y));return[{kind:"rect",part:"tooltip",title:a.join(`
2
+ `),x:b(C),y:b(y),width:b(d),height:g,fill:"var(--skdx-color-surface-raised)",stroke:$.axis,rx:8},...h.map((v,M)=>({kind:"text",part:"tooltip-label",x:b(C+6),y:b(y+11+M*16),text:v,baseline:"middle",fill:"var(--skdx-color-text-default)",weight:h.length>1&&M===0?"bold":void 0}))]}function Gt(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}=Me(e,t,r),c=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:b(o/2),y:b(a/2),text:c,anchor:"middle",baseline:"middle",fill:i==="error"?"var(--skdx-color-text-danger)":$.label}),{...Ve(e,o,a),shapes:s,tooltip:!1}}var Ze=(e,n,t,r={})=>({kind:"text",part:"label",x:e,y:n,text:t,fill:$.label,...r});function de(e){return e==null?[]:(Array.isArray(e)?e:[e]).map(t=>typeof t=="object"?t:{id:t})}var We=e=>e.id??e.name??e.series,Vt=e=>e.seriesId??e.series;function _(e,n){let t=!1;return n.id!==void 0&&(t=!0,We(e)!==n.id&&e.id!==n.id&&e.name!==n.id)||n.series!==void 0&&(t=!0,Vt(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}var Ue=e=>de(e).flatMap(n=>n.id!==void 0?[n.id]:[]);function W(e){let n={},t=We(e);t!==void 0&&(n.id=t);let r=Vt(e);return r!==void 0&&e.series!==void 0&&(n.series=r),e.index!==void 0&&(n.index=e.index),n}var Ke=(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=de(e),i=W(n),o=r.some(a=>_(n,a));return t==="single"?o?[]:[i]:o?r.filter(a=>!_(n,a)):[...r,i]}var gn=.2;function bn(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 xn=(e,n)=>e.kind==="text"?{...e,fill:$.grid}:{...e,opacity:(e.opacity??1)*n};function Xe(e,n){let t=de(n.selected),r=n.highlighted===void 0||n.highlighted===null?[]:de(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=[],c=h=>!i||r.some(d=>_(h,d))?!0:o.highlighted==="series"?r.some(d=>d.series!==void 0&&_(h,{series:d.series})):!1,s=h=>{if(!i||o.faded==="none"||c(h))return!1;if(o.faded==="series"){let d=i.series;return d!==void 0&&_(h,{series:d})}return!0},l=e.shapes.map(h=>{let d=h.item;if(!d||d.legend)return h;if(t.some(g=>_(d,g))){let g=bn(h);g&&a.push(g)}return s(d)?xn(h,gn):h});return a.length?{...e,shapes:[...l,...a]}:{...e,shapes:l}}var Ht=2*Math.PI;function Ce(e,n,t,r,i,o){let a=(l,h)=>`${b(e+l*Math.sin(h))} ${b(n-l*Math.cos(h))}`;if(o-i>=Ht-1e-9){let l=i+Ht/2;return`${Ce(e,n,t,r,i,l)}${Ce(e,n,t,r,l,o)}`}let c=o-i>Math.PI?1:0,s=`M${a(t,i)}A${t} ${t} 0 ${c} 1 ${a(t,o)}`;return r>0?`${s}L${a(r,o)}A${r} ${r} 0 ${c} 0 ${a(r,i)}Z`:`${s}L${b(e)} ${b(n)}Z`}var Zt="var(--skdx-radius-default, var(--skdx-radius-md, 0.5rem))";function Ie(e){return["tooltip","skeleton","label-background","stage-label-background","brush-handle"].includes(e)?Zt:void 0}function ie(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 Ye=(e,n,t)=>n>=e.x&&n<=e.x+e.width&&t>=e.y&&t<=e.y+e.height;function Wt(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 he(e,n){let t=e.hit;if(!t||t.xs.length===0)return;let r=Wt(t,n),i=t.rows[r]??[];return{index:r,rows:e.axisTooltipFormatter?.(i,r)??i}}function Qe(e,n){let t=e.hit;if(!t||t.xs.length===0)return;let r=t.xs[Wt(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 Je(e,n,t){let r=e.hit;if(!r||!r.crosshair||r.xs.length===0||!Ye(r.plot,n,t))return[];let i=Qe(e,n),{rows:o}=he(e,n),a=e.tooltipAnchored?r.plot.y+8:t;return[i,...Se(i.x1,a,o,e.width,e.height,e.tooltipPlacement)]}function et(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 Je(e,i,t.plot.y+8)}function tt(e,n,t,r,i){if(!e.tooltip)return{lines:[],shapes:[]};if(e.hit?.crosshair){let{x:s,y:l}=ie(t,r,i,e.width,e.height);if(Ye(e.hit.plot,s,l)){let h=he(e,s),d=Qe(e,s);if(h&&d)return{lines:h.rows,shapes:[d]}}}let o=n?.closest?.("[data-skdx-part]"),a=e.tooltipFormatter?U(e,n)?.item:void 0,c=a&&e.tooltipFormatter?.(a)||o&&Array.from(o.children).find(s=>s.tagName.toLowerCase()==="title")?.textContent;return c?{lines:Array.isArray(c)?c:[c],shapes:[]}:{lines:[],shapes:[]}}function Ut(e,n,t,r,i,o,a){let c=e?.closest?.("[data-skdx-part]"),s=a&&a.tooltipFormatter?U(a,e)?.item:void 0,l=s&&a?.tooltipFormatter?.(s)||c&&Array.from(c.children).find(C=>C.tagName.toLowerCase()==="title")?.textContent;if(!l)return[];let h=a?.tooltipAnchored?U(a,e):void 0,d=h?a?.shapes[h.index]:void 0,{x:g,y:S}=d?ue(d):ie(n,t,r,i,o);return Se(g,S,l,i,o,a?.tooltipPlacement)}function nt(e,n,t,r,i){if(!e.tooltip)return[];if(e.hit?.crosshair){let{x:o,y:a}=ie(t,r,i,e.width,e.height),c=Je(e,o,a);if(c.length>0)return c}return Ut(n,t,r,i,e.width,e.height,e)}function rt(e,n){let t=U(e,n);return t&&!t.item.legend?W(t.item):null}var yn=(e,n)=>{let{x:t,y:r}=ue(e),i=e.kind==="circle"?e.cy:e.kind==="rect"?e.y+e.height/2:r;return t>=n.x&&t<=n.x+n.width&&i>=n.y&&i<=n.y+n.height};function it(e,n){let t=new Set,r=[];for(let i of e.shapes){if(!i.item||i.item.legend||i.part==="anchor"||!yn(i,n))continue;let o=W(i.item),a=JSON.stringify(o);t.has(a)||(t.add(a),r.push(o))}return r}var ot=e=>({kind:"rect",part:"selection-box",x:b(e.x),y:b(e.y),width:b(e.width),height:b(e.height),fill:$.focus,opacity:.12,stroke:$.focus}),Ae=(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 Kt(e,n,t){let r=!1;for(let i=0,o=e.length-1;i<e.length;o=i++){let a=e[i],c=e[o];a.y>t!=c.y>t&&n<(c.x-a.x)*(t-a.y)/(c.y-a.y)+a.x&&(r=!r)}return r}function st(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}=ue(i),c=i.kind==="circle"?i.cy:i.kind==="rect"?i.y+i.height/2:a;if(!Kt(n,o,c))continue;let s=W(i.item),l=JSON.stringify(s);t.has(l)||(t.add(l),r.push(s))}return r}var at=e=>({kind:"path",part:"selection-lasso",d:e.length?`M${e.map(n=>`${b(n.x)} ${b(n.y)}`).join("L")}`:"",fill:$.focus,fillOpacity:.12,stroke:$.focus,dash:"4 3"}),Te=6;function ct(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-Te||n>i.x1+Te))return Math.abs(n-i.x0)<=Te?{bar:i,mode:"start"}:Math.abs(n-i.x1)<=Te?{bar:i,mode:"end"}:{bar:i,mode:"move"}}}function lt(e,n,t){let r=e.edit;return qt(r,n,r.invert(n.bar.x0+t)-r.invert(n.bar.x0))}function dt(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",c=r.snap??r.invert(o.x0+10)-r.invert(o.x0);return qt(r,{bar:o,mode:a},i*c)}function qt(e,{bar:n,mode:t},r){let i=c=>e.snap?Math.round(c/e.snap)*e.snap:c,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 ht(e,n,t){let r=e.edit,i=r.scale(t.start),o=r.scale(t.end);return{kind:"rect",part:"edit-ghost",x:b(Math.min(i,o)),y:b(n.bar.y),width:b(Math.max(1,Math.abs(o-i))),height:b(n.bar.height),fill:$.focus,opacity:.25,stroke:$.focus,rx:2}}var vn=64,wn=e=>Math.max(1,Math.min(vn,e));function ut(e,n,t,r){let i=n>0?.8:1.25,o=wn(e.view.zoom*i);if(o===e.view.zoom)return e.view;let{plot:a,scale:c}=e,[s,l]=e.view.center,h=(t-(a.x+a.width/2))/c,d=(r-(a.y+a.height/2))/c,g=e.view.zoom/o;return{center:[s+h*(1-g),e.fromY(e.toY(l)-d*(1-g))],zoom:o}}function pt(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 U(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 Oe=e=>e.shapes.flatMap((n,t)=>n.item&&!n.item.legend?[t]:[]);function ue(e){switch(e.kind){case"rect":return{x:e.x+e.width/2,y:e.y};case"circle":return{x:e.cx,y:e.cy-e.r};case"line":return{x:(e.x1+e.x2)/2,y:Math.min(e.y1,e.y2)};case"text":return{x:e.x,y:e.y};case"path":{let n=/M\s*(-?[\d.]+)[ ,](-?[\d.]+)/.exec(e.d);return n?{x:Number(n[1]),y:Number(n[2])}:{x:0,y:0}}}}function ft(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*j+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}=ue(t),c=t.item&&e.tooltipFormatter?.(t.item)||(t.item?.label??t.title??"");return[i,...c?Se(b(o),b(a),c,e.width,e.height):[]]}function mt(e,n,t){let r=Oe(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 ne=2,re=(e,n,t)=>{let r=Math.max(ne,Math.min(t,Math.round(n))),i=Math.max(0,Math.min(t-r,Math.round(e)));return{start:i,end:i+r}},Xt=(e,n)=>!e||e.start<=0&&e.end>=n;function gt(e,n,t){if(e.count<=ne||!e.plot.width)return;let{start:r,end:i}=e.zoom,o=i-r,a=n>0?1.25:.8,c=Math.max(ne,Math.min(e.count,Math.round(o*a)));if(c===o)return n>0&&!Xt(e.zoom,e.count)?re(r,c,e.count):void 0;let s=Math.max(0,Math.min(1,(t-e.plot.x)/e.plot.width)),l=r+s*o;return re(l-s*c,c,e.count)}function bt(e,n,t,r){let i=n.end-n.start,o=Math.max(ne,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 re(n.start+a*i-a*o,o,e.count)}function xt(e,n,t){let r=n.end-n.start,i=e.plot.width/Math.max(1,r);return re(n.start-t/i,r,e.count)}function yt(e,n,t){let r=e.brush;if(!r||!Ye(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:re(a-o/2,o,e.count)}}function vt(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 re(t.start+o,t.end-t.start,e.count);if(n==="left")return{start:Math.max(0,Math.min(t.end-ne,Math.round(t.start+o))),end:t.end};let a=Math.min(e.count,Math.max(t.start+ne,Math.round(t.end+o)));return{start:t.start,end:a}}function kt(e,n){switch(n.type){case"svg":return Promise.resolve(wt(e,n.label,n.resolve));case"csv":return Promise.resolve(en(n.rows));case"png":{if(typeof document>"u"||typeof Image>"u")return Promise.reject(new Error("PNG export needs a browser"));let t=wt(e,n.label,n.resolve);return Jt(t,e.width,e.height,n.scale,n.background)}}}var B=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/"/g,"&quot;"),pe=e=>e.filter(([,n])=>n!==void 0&&n!=="").map(([n,t])=>` ${n}="${B(String(t))}"`).join("");function Yt(e){let n=e.title?`<title>${B(e.title)}</title>`:"",t=["data-skdx-part",e.part];switch(e.kind){case"path":return`<path${pe([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${pe([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${pe([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${pe([t,["cx",e.cx],["cy",e.cy],["r",e.r],["fill",e.fill],["stroke",e.stroke]])}>${n}</circle>`;case"text":return`<text${pe([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]])}>${B(e.text)}</text>`}}function Qt(e){let n=e.defs??[];return n.length===0?"":`<defs>${n.map(t=>`<linearGradient id="${B(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="${B(r.color)}"${r.opacity===void 0?"":` stop-opacity="${r.opacity}"`}/>`).join("")}</linearGradient>`).join("")}</defs>`}function wt(e,n,t){let r=Qt(e)+e.shapes.map(Yt).join("");t&&(r=r.replace(/var\((--[\w-]+)\)/g,(a,c)=>t(c).trim()||a));let i=e.decorative?'aria-hidden="true"':`role="img" aria-label="${B(n)}"`,o=e.description?`<desc>${B(e.description)}</desc>`:"";return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${e.width} ${e.height}" width="${e.width}" height="${e.height}" ${i} font-family="${B($.fontFamily)}" font-size="${B($.fontSize)}"><title>${B(n)}</title>${o}${r}</svg>`}function Jt(e,n,t,r=2,i){return new Promise((o,a)=>{let c=URL.createObjectURL(new Blob([e],{type:"image/svg+xml;charset=utf-8"})),s=new Image;s.onload=()=>{URL.revokeObjectURL(c);let l=document.createElement("canvas");l.width=Math.round(n*r),l.height=Math.round(t*r);let h=l.getContext("2d");if(!h)return a(new Error("canvas 2d context unavailable"));i&&(h.fillStyle=i,h.fillRect(0,0,l.width,l.height)),h.drawImage(s,0,0,l.width,l.height),l.toBlob(d=>d?o(d):a(new Error("toBlob failed")),"image/png")},s.onerror=()=>{URL.revokeObjectURL(c),a(new Error("svg could not be decoded"))},s.src=c})}function en(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 $t(e,n){if(!n)return;let t=typeof n=="object"?n.maxRows??500:500,r=e.hit;if(r&&r.rows.length>0){let c=r.rows[0];if(r.rows.length>t)return;let s=["",...c.slice(1).map(h=>h.replace(/:\s[^:]*$/,""))],l=r.rows.map(h=>[h[0],...h.slice(1).map(d=>d.slice(d.lastIndexOf(": ")+2))]);return[s,...l]}let i=e.shapes.flatMap(c=>c.item&&!c.item.legend&&!(c.part==="anchor"&&!c.title)?[c.item]:[]);if(i.length===0||i.length>t)return;let o=["series","name","category","value"].filter(c=>i.some(s=>s[c]!==void 0)),a=(c,s)=>c[s]===void 0?"":String(c[s]);return[o.map(c=>c[0]?.toUpperCase()+c.slice(1)),...i.map(c=>o.map(s=>a(c,s)))]}var Mt=new Map;function Le(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,a){Object.assign(r,o);for(let c of t)c(o,a)}};return Mt.set(e,{group:i,listeners:t}),i}var tn='[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}}${tn}{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){${tn}{animation:none;transition:none}}`;function Ct(e){let n=e.animate;return n&&e.shapes.length<=1500?`${n}ms`:void 0}var kn=2*Math.PI,$n=12,fe=5;function Mn(e){let n=[];if(e.links){let i=[...e.names??[]],o=new Set(i);for(let s of e.links)for(let l of[s.source,s.target])o.has(l)||(e.names&&n.push({code:"unknown-node",severity:"warning",message:`Link ${s.source} \u2192 ${s.target} names "${l}", which is not in \`names\`; it was added.`,itemId:s.id}),o.add(l),i.push(l));let a=new Map(i.map((s,l)=>[s,l])),c=i.map(()=>i.map(()=>0));for(let s of e.links){if(!ce(s.value)||s.value<0){n.push({code:"invalid-value",severity:"warning",message:`Link ${s.source} \u2192 ${s.target} has no valid value and was dropped.`,itemId:s.id});continue}let l=c[a.get(s.source)];l[a.get(s.target)]=l[a.get(s.target)]+s.value}return{names:i,matrix:c,issues:n}}let t=e.names??[],r=e.matrix??[];return(r.length!==t.length||r.some(i=>i.length!==t.length))&&n.push({code:"ragged-matrix",severity:"warning",message:`The matrix is ${r.length} \xD7 ${r[0]?.length??0} but there are ${t.length} names; missing cells count as zero.`}),{names:t,matrix:r,issues:n}}function It(e){let{names:n,matrix:t,issues:r}=Mn(e),i=Gt(e,n.length===0||!t.some(p=>p.some(f=>ce(f)&&f>0)),300,300);if(i)return{...i,issues:r};let o=Pt(e.format),{width:a,height:c}=Me(e,300,300),s=(p,f)=>{let L=t[p]?.[f];return ce(L)?Math.max(0,L):0},l=p=>n.reduce((f,L,R)=>f+s(p,R)+s(R,p),0),h=n.map((p,f)=>f);e.sort&&h.sort((p,f)=>e.sort==="asc"?l(p)-l(f):l(f)-l(p));let d=h.map(p=>n[p]),g=p=>_t(e,h[p]),S=d.map((p,f)=>({name:p,color:g(f)})),C=jt(e,S,a),y=a/2,v=C+(c-C)/2,M=e.ticks?8+fe+14:8,A=M+Math.max(0,...n.map(p=>p.length))*j+4,I=Math.max(0,Math.min(a/2-A,(c-C)/2-36)),O=Math.max(0,I-$n),ge=(e.padding??2.3)*Math.PI/180,q=d.length,be=Ue(e.selected)[0],N=be===void 0?-1:d.indexOf(String(be)),G=(p,f)=>Ge(e,d[p])||Ge(e,d[f])?0:s(h[p],h[f]),X=d.map((p,f)=>d.reduce((L,R,z)=>L+G(f,z),0)),xe=X.reduce((p,f)=>p+f,0),ye=xe>0?(kn-ge*q)/xe:0,V=(p,f)=>`${b(y+f*Math.sin(p))} ${b(v-f*Math.cos(p))}`,ve=[],Y=0;for(let p=0;p<q;p++){let f=Y,L=d.map((R,z)=>{let H=Y;return Y+=G(p,z)*ye,{a0:H,a1:Y}});ve.push({a0:f,a1:Y,sub:L}),Y+=ge}let Q=[],Tt=[];for(let p=0;p<q;p++)for(let f=p;f<q;f++){let L=G(p,f),R=G(f,p);if(L+R===0)continue;let z=ve[p].sub[f],H=ve[f].sub[p],J=te=>te.a1-te.a0>Math.PI?1:0,ee=p===f?`M${V(z.a0,O)}A${O} ${O} 0 ${J(z)} 1 ${V(z.a1,O)}Q${b(y)} ${b(v)} ${V(z.a0,O)}Z`:`M${V(z.a0,O)}A${O} ${O} 0 ${J(z)} 1 ${V(z.a1,O)}Q${b(y)} ${b(v)} ${V(H.a0,O)}A${O} ${O} 0 ${J(H)} 1 ${V(H.a1,O)}Q${b(y)} ${b(v)} ${V(z.a0,O)}Z`,Re=L>=R?p:f,we=N<0||p===N||f===N,Z=p===f?`${d[p]}: ${o(L)}`:`${d[p]} \u2192 ${d[f]}: ${o(L)} \xB7 ${d[f]} \u2192 ${d[p]}: ${o(R)}`;Q.push({kind:"path",part:"chord",d:ee,fill:g(Re),opacity:we?.5:.08,title:Z,item:{label:Z,id:`${d[p]}\u2192${d[f]}`,name:d[p],category:d[f],value:L+R}})}ve.forEach((p,f)=>{if(p.a1<=p.a0)return;let L=`${d[f]}: ${o(X[f])}`;Q.push({kind:"path",part:"group",d:Ce(y,v,I,O,p.a0,p.a1),fill:g(f),opacity:N<0||f===N||G(f,N)+G(N,f)>0?void 0:.3,title:L,item:{label:L,id:d[f],name:d[f],index:f,value:X[f]}});let R=(p.a0+p.a1)/2,z=Math.sin(R),H=I+M;if(Q.push(Ze(b(y+H*z),b(v-H*Math.cos(R)),d[f],{anchor:z>.1?"start":z<-.1?"end":"middle",baseline:"middle"})),!e.ticks)return;let J=X[f];je(0,J,4).filter(ee=>ee<=J).forEach((ee,Re)=>{let we=p.a0+ee*ye,Z=Math.sin(we),te=Math.cos(we);if(Q.push({kind:"line",part:"tick",x1:b(y+I*Z),y1:b(v-I*te),x2:b(y+(I+fe)*Z),y2:b(v-(I+fe)*te),stroke:$.axis}),Re%2)return;let Pe=b(y+(I+fe+3)*Z),Ee=b(v-(I+fe+3)*te);Tt.some(Ot=>Math.abs(Ot.x-Pe)<12&&Math.abs(Ot.y-Ee)<12)||(Tt.push({x:Pe,y:Ee}),Q.push(Ze(Pe,Ee,o(ee),{part:"tick-label",anchor:Z>.1?"start":Z<-.1?"end":"middle",baseline:"middle"})))})});let At=Ve(e,a,c,S);return{...At,shapes:[...Q,...At.shapes],issues:r}}import{css as Sn,html as K,LitElement as Cn,nothing as T,svg as P}from"lit";import{property as m,state as E}from"lit/decorators.js";import{ifDefined as w}from"lit/directives/if-defined.js";var In={fromAttribute:()=>!1},x=class extends Cn{constructor(){super(...arguments);this.legend=!1;this.tooltip=!0;this.selectionMode="none";this.loading=!1;this.decorative=!1;this.accessibleTable=!1;this.zoomable=!1;this.editable=!1;this.crossFilter=!1;this.animated=!1;this.responsive=!1;this.tip=[];this.overlay=[];this.portal=null;this.highlightState=null;this.crossState=null;this.lastCross=null;this.pointers=new Map;this.hover=null;this.token={};this.snapshotKind="";this.focused=null;this.hiddenState=[];this.drag=null;this.onPointerMove=t=>{let r=this.layout;if(!r)return;this.pointers.has(t.pointerId)&&this.pointers.set(t.pointerId,this.viewBox(t,r).x);let i=this.drag;if(i?.grab==="select"){let{x:o,y:a}=this.viewBox(t,r);this.overlay=[ot(Ae(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=[at(i.points)];return}if(i?.grab==="edit"){if(!i.gantt)return;let{x:o}=this.viewBox(t,r);i.change=lt(r,i.gantt,o-i.x),this.overlay=[ht(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(pt(r.map,i.view,o-i.x,a-i.y));return}if(i&&r.hit){if(i.grab==="pinch"){let[a,c]=[...this.pointers.values()];if(a===void 0||c===void 0||!i.distance)return;this.setZoom(bt(r.hit,i.zoom,Math.abs(a-c)/i.distance,(a+c)/2));return}let{x:o}=this.viewBox(t,r);this.setZoom(i.grab==="pan"?xt(r.hit,i.zoom,o-i.x):vt(r.hit,i.grab,i.zoom,o-i.x));return}if(r.tooltipPortal){let{lines:o,shapes:a}=tt(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=nt(r,t.target,t.currentTarget,t.clientX,t.clientY);(o.length>0||this.tip.length>0)&&(this.tip=o)}if(this.highlight(rt(r,t.target)),this.syncId&&r.hit?.crosshair){let o=he(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=U(r,t.target)?.item.legend,c=this.canEdit(r)?ct(r,i,o):void 0;if(c){this.drag={x:i,y:o,zoom:{start:0,end:0},grab:"edit",gantt:c},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 l=r.map.plot;if(i<l.x||i>l.x+l.width||o<l.y||o>l.y+l.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[l,h]=[...this.pointers.values()];this.drag={x:(l+h)/2,y:o,zoom:s.zoom,grab:"pinch",distance:Math.abs(l-h)||1}}else{let l=yt(s,i,o);if(l)this.drag={x:i,y:o,zoom:l.zoom,grab:l.grab},l.zoom!==s.zoom&&this.setZoom(l.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:c}=this.viewBox(t,o);if(Math.abs(a-i.x)>2||Math.abs(c-i.y)>2){i.grab==="select"?this.setSelected(it(o,Ae(i.x,i.y,a,c))):i.grab==="lasso"?this.setSelected(st(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(ut(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 c=gt(a,t.deltaY,i);c&&(t.preventDefault(),this.setZoom(c))};this.onClick=t=>{if(!this.layout)return;if(this.drag?.distance===-1){this.drag=null;return}let r=U(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 c=r.shapes[this.focused]?.item;c&&(t.preventDefault(),this.select(c),this.emit("skdx-item-click",c));return}let i=this.canEdit(r)?dt(r,this.focused,t):void 0;if(i){t.preventDefault(),this.emit("skdx-task-change",i);return}let o=mt(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?W(a):null)}}updated(){let t=this.renderRoot.querySelector("svg")??void 0;t===this.snapshotSvg&&this.removeSnapshot||(this.removeSnapshot?.(),this.snapshotSvg=t,this.removeSnapshot=t?Ne(t,()=>{if(!this.snapshotConfiguration||!this.layout)throw new Error("Actual owner chart configuration unavailable");return De(this.snapshotKind,this.snapshotConfiguration,this.layout)}):void 0)}connectedCallback(){super.connectedCallback(),this.requestUpdate(),!(typeof ResizeObserver>"u")&&(this.observer=new ResizeObserver(([t])=>{let r=Math.floor(t?.contentRect.width??0);r>0&&(this.measured=r)}),this.observer.observe(this))}disconnectedCallback(){this.removeSnapshot?.(),this.removeSnapshot=void 0,this.snapshotSvg=void 0,this.observer?.disconnect(),this.leave?.(),this.leave=void 0,this.joined=void 0,super.disconnectedCallback()}sized(){let{width:t,height:r,legend:i,tooltip:o,format:a,palette:c,loading:s,error:l,emptyMessage:h,description:d,decorative:g,animated:S,responsive:C,highlighted:y,highlightScope:v,accessibleTable:M}=this;return{width:C&&this.measured?this.measured:t,height:r,animate:S,responsive:C,legend:i,tooltip:o,format:a,palette:c,loading:s,error:l,emptyMessage:h,description:d,decorative:g,highlighted:y===void 0?this.highlightState:y,highlightScope:v,accessibleTable:M,hiddenSeries:this.hiddenSeries??this.hiddenState,zoom:this.zoom??this.zoomState,selected:this.selected??this.selectedState,view:this.view??this.viewState}}compactOverrides(){let t=this.responsive;return typeof t=="object"&&this.measured!==void 0&&this.measured<(t.breakpoint??480)?{...t.compact,width:this.measured}:void 0}emit(t,r){this.dispatchEvent(new CustomEvent(t,{detail:r,bubbles:!0,composed:!0}))}publish(t){this.syncId&&Le(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=Le(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&&Ke(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 ie(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&&_(o.item,t));return i<0?!1:(this.getSvgElement()?.focus(),this.focused=i,!0)}export(t){let r=this.layout;return r?kt(r,{...t,label:t.label??this.label??this.localName}):Promise.reject(new Error("not rendered yet"))}root(t,r,i,o){this.join();let a=Xe(He(t),this.sized());if(this.layout=a,this.snapshotKind=r,this.snapshotConfiguration=o,a.issues!==this.reported){this.reported=a.issues;for(let M of a.issues??[])this.emit("skdx-data-issue",M)}let c=this.canZoom(a),s=this.canPan(a),l=this.canEdit(a),h=this.brushing(),d=c||s||l||h,g=!a.decorative&&Oe(a).length>0,S=Ct(a),C=$t(a,this.accessibleTable),y=typeof this.accessibleTable=="object"&&this.accessibleTable.caption||i,v=this.portal;return K`<svg
4
4
  xmlns="http://www.w3.org/2000/svg"
5
- viewBox="0 0 ${o.width} ${o.height}"
6
- width=${o.width}
7
- height=${o.height}
8
- role=${o.decorative?"presentation":"img"}
9
- aria-hidden=${o.decorative?"true":C}
10
- aria-label=${o.decorative?C:i}
11
- aria-description=${$(o.description)}
12
- tabindex=${d?0:C}
5
+ viewBox="0 0 ${a.width} ${a.height}"
6
+ width=${a.width}
7
+ height=${a.height}
8
+ role=${a.decorative?"presentation":"img"}
9
+ aria-hidden=${a.decorative?"true":T}
10
+ aria-label=${a.decorative?T:i}
11
+ aria-description=${w(a.description)}
12
+ tabindex=${g?0:T}
13
13
  data-skdx-chart=${r}
14
- data-zoomable=${s||a?"":C}
15
- data-brushing=${l&&!(s||a)?"":C}
16
- data-editable=${c?"":C}
17
- style=${b?`--skdx-chart-duration:${b}`:C}
18
- font-family=${w.fontFamily}
19
- font-size=${w.fontSize}
20
- @pointermove=${o.tooltip||u?this.onPointerMove:C}
14
+ data-zoomable=${c||s?"":T}
15
+ data-brushing=${h&&!(c||s)?"":T}
16
+ data-editable=${l?"":T}
17
+ style=${S?`--skdx-chart-duration:${S}`:T}
18
+ font-family=${$.fontFamily}
19
+ font-size=${$.fontSize}
20
+ @pointermove=${a.tooltip||d?this.onPointerMove:T}
21
21
  @pointerleave=${()=>{this.clearTip(),this.highlight(null)}}
22
- @pointerdown=${u?this.onPointerDown:C}
23
- @pointerup=${u?this.onPointerUp:C}
24
- @pointercancel=${u?this.onPointerUp:C}
25
- @wheel=${s||a?this.onWheel:C}
26
- @dblclick=${s||a?()=>a?this.setView(void 0):this.setZoom(void 0):C}
22
+ @pointerdown=${d?this.onPointerDown:T}
23
+ @pointerup=${d?this.onPointerUp:T}
24
+ @pointercancel=${d?this.onPointerUp:T}
25
+ @wheel=${c||s?this.onWheel:T}
26
+ @dblclick=${c||s?()=>s?this.setView(void 0):this.setZoom(void 0):T}
27
27
  @click=${this.onClick}
28
- @keydown=${d?this.onKeyDown:C}
28
+ @keydown=${g?this.onKeyDown:T}
29
29
  @blur=${()=>{this.focused=null,this.highlight(null)}}
30
30
  >
31
31
  <title>${i}</title>
32
- ${o.description?R`<desc>${o.description}</desc>`:C}
33
- ${b?R`<style>${$t}</style>`:C} ${Mn(o)}
34
- ${Le(o.shapes)}
35
- ${Le(this.tip.length||!this.crossState?this.tip:Ye(o,this.crossState))}
36
- ${Le(ut(o,this.focused))} ${Le(this.overlay)}
32
+ ${a.description?P`<desc>${a.description}</desc>`:T}
33
+ ${S?P`<style>${St}</style>`:T} ${Tn(a)}
34
+ ${ze(a.shapes)}
35
+ ${ze(this.tip.length||!this.crossState?this.tip:et(a,this.crossState))}
36
+ ${ze(ft(a,this.focused))} ${ze(this.overlay)}
37
37
  </svg>
38
- ${v?U`<div
38
+ ${v?K`<div
39
39
  role="tooltip"
40
40
  data-skdx-tooltip=${r}
41
41
  style="left:${v.x+12}px;top:${v.y+12}px"
42
42
  >
43
- ${v.lines.map(y=>U`<div>${y}</div>`)}
44
- </div>`:C}
45
- ${I?U`<table data-skdx-table=${r}>
43
+ ${v.lines.map(M=>K`<div>${M}</div>`)}
44
+ </div>`:T}
45
+ ${C?K`<table data-skdx-table=${r}>
46
46
  <caption>
47
- ${k}
47
+ ${y}
48
48
  </caption>
49
49
  <thead>
50
50
  <tr>
51
- ${(I[0]??[]).map(y=>U`<th scope="col">${y}</th>`)}
51
+ ${(C[0]??[]).map(M=>K`<th scope="col">${M}</th>`)}
52
52
  </tr>
53
53
  </thead>
54
54
  <tbody>
55
- ${I.slice(1).map(y=>U`<tr>
56
- ${y.map((S,A)=>A===0?U`<th scope="row">${S}</th>`:U`<td>${S}</td>`)}
55
+ ${C.slice(1).map(M=>K`<tr>
56
+ ${M.map((A,I)=>I===0?K`<th scope="row">${A}</th>`:K`<td>${A}</td>`)}
57
57
  </tr>`)}
58
58
  </tbody>
59
- </table>`:C}`}};x.styles=yn`
59
+ </table>`:T}`}};x.styles=Sn`
60
60
  :host {
61
61
  display: inline-block;
62
62
  }
@@ -109,4 +109,4 @@ var Yt=Object.defineProperty;var Qt=Object.getOwnPropertyDescriptor;var h=(e,n,t
109
109
  [role='tooltip'] > :first-child:not(:only-child) {
110
110
  font-weight: bold;
111
111
  }
112
- `,h([f({type:Number})],x.prototype,"width",2),h([f({type:Number})],x.prototype,"height",2),h([f()],x.prototype,"label",2),h([f({type:Boolean,reflect:!0})],x.prototype,"legend",2),h([f({type:Boolean,attribute:"no-tooltip",converter:$n})],x.prototype,"tooltip",2),h([f({attribute:!1})],x.prototype,"format",2),h([f({attribute:!1})],x.prototype,"palette",2),h([f({attribute:!1})],x.prototype,"hiddenSeries",2),h([f({attribute:!1})],x.prototype,"selected",2),h([f({attribute:"selection-mode"})],x.prototype,"selectionMode",2),h([f({attribute:!1})],x.prototype,"highlighted",2),h([f({attribute:!1})],x.prototype,"highlightScope",2),h([f({type:Boolean,reflect:!0})],x.prototype,"loading",2),h([f()],x.prototype,"error",2),h([f({attribute:"empty-message"})],x.prototype,"emptyMessage",2),h([f()],x.prototype,"description",2),h([f({type:Boolean,reflect:!0})],x.prototype,"decorative",2),h([f({type:Boolean,attribute:"accessible-table"})],x.prototype,"accessibleTable",2),h([f({attribute:!1})],x.prototype,"zoom",2),h([f({attribute:!1})],x.prototype,"view",2),h([f({type:Boolean,reflect:!0})],x.prototype,"zoomable",2),h([f({type:Boolean,reflect:!0})],x.prototype,"editable",2),h([f({attribute:"sync-id"})],x.prototype,"syncId",2),h([f({type:Boolean,attribute:"cross-filter"})],x.prototype,"crossFilter",2),h([f({converter:{fromAttribute:t=>t===null?!1:t===""?!0:Number(t)}})],x.prototype,"animated",2),h([f({type:Boolean,reflect:!0})],x.prototype,"responsive",2),h([B()],x.prototype,"tip",2),h([B()],x.prototype,"overlay",2),h([B()],x.prototype,"portal",2),h([B()],x.prototype,"measured",2),h([B()],x.prototype,"viewState",2),h([B()],x.prototype,"highlightState",2),h([B()],x.prototype,"crossState",2),h([B()],x.prototype,"focused",2),h([B()],x.prototype,"hiddenState",2),h([B()],x.prototype,"zoomState",2),h([B()],x.prototype,"selectedState",2);var M=class extends x{constructor(){super(...arguments);this.series=[];this.labels=!1;this.connectNulls=!1;this.stacked=!1;this.brush=!1;this.crosshair=!1}input(){let{series:t,categories:r,xAxis:i,yAxis:o,rightAxis:s,references:a,annotations:c,labels:l,curve:u,connectNulls:d,nulls:b,stacked:I,stackOffset:k,orientation:v,radius:y,barGap:S,barWidth:A,sort:T,transform:O,transforms:fe,bins:K,binWidth:be,binDomain:D,binMode:_,sampling:q,brush:ge,crosshair:xe}=this;return{...this.sized(),series:t,categories:r,xAxis:i,yAxis:o,rightAxis:s,references:a,annotations:c,labels:l,curve:u,connectNulls:d,nulls:b,stacked:I,stackOffset:k,orientation:v,radius:y,barGap:S,barWidth:A,sort:T,transform:O,transforms:fe,bins:K,binWidth:be,binDomain:D,binMode:_,sampling:q,brush:ge,crosshair:xe}}};h([f({attribute:!1})],M.prototype,"series",2),h([f({attribute:!1})],M.prototype,"categories",2),h([f({attribute:!1})],M.prototype,"xAxis",2),h([f({attribute:!1})],M.prototype,"yAxis",2),h([f({attribute:!1})],M.prototype,"rightAxis",2),h([f({attribute:!1})],M.prototype,"references",2),h([f({attribute:!1})],M.prototype,"annotations",2),h([f({type:Boolean,reflect:!0})],M.prototype,"labels",2),h([f()],M.prototype,"curve",2),h([f({type:Boolean,attribute:"connect-nulls"})],M.prototype,"connectNulls",2),h([f()],M.prototype,"nulls",2),h([f({reflect:!0,converter:{fromAttribute:t=>t==="percent"?"percent":t!==null}})],M.prototype,"stacked",2),h([f({attribute:"stack-offset"})],M.prototype,"stackOffset",2),h([f()],M.prototype,"orientation",2),h([f({type:Number})],M.prototype,"radius",2),h([f({type:Number,attribute:"bar-gap"})],M.prototype,"barGap",2),h([f({type:Number,attribute:"bar-width"})],M.prototype,"barWidth",2),h([f()],M.prototype,"sort",2),h([f()],M.prototype,"transform",2),h([f({attribute:!1})],M.prototype,"transforms",2),h([f({type:Number})],M.prototype,"bins",2),h([f({type:Number,attribute:"bin-width"})],M.prototype,"binWidth",2),h([f({attribute:!1})],M.prototype,"binDomain",2),h([f({attribute:"bin-mode"})],M.prototype,"binMode",2),h([f({attribute:!1})],M.prototype,"sampling",2),h([f({type:Boolean,reflect:!0})],M.prototype,"brush",2),h([f({type:Boolean,reflect:!0})],M.prototype,"crosshair",2);var Mn=e=>e.defs&&e.defs.length?R`<defs>${e.defs.map(n=>R`<linearGradient id=${n.id} x1="0" y1="0" x2=${n.vertical===!1?1:0} y2=${n.vertical===!1?0:1}>${n.stops.map(t=>R`<stop offset=${t.offset} stop-color=${t.color} stop-opacity=${$(t.opacity)}></stop>`)}</linearGradient>`)}</defs>`:C,Le=e=>R`${e.map((n,t)=>{let r=n.title?R`<title>${n.title}</title>`:C,i=n.item?t:void 0;switch(n.kind){case"path":return R`<path data-skdx-part=${n.part} data-skdx-i=${$(i)} d=${n.d} fill=${n.fill??"none"} stroke=${$(n.stroke)} stroke-width=${$(n.strokeWidth)} stroke-linecap=${$(n.strokeLinecap)} stroke-linejoin=${$(n.strokeLinejoin)} stroke-dasharray=${$(n.dash)} opacity=${$(n.opacity)} fill-opacity=${$(n.fillOpacity)}>${r}</path>`;case"rect":return R`<rect data-skdx-part=${n.part} data-skdx-i=${$(i)} x=${n.x} y=${n.y} width=${n.width} height=${n.height} rx=${$(n.rx)} style=${$(Ce(n.part)?`rx:${Ce(n.part)}`:void 0)} fill=${n.fill} stroke=${$(n.stroke)} fill-opacity=${$(n.opacity)} pointer-events=${$(n.part==="stage-label-background"||n.part==="label-background"?"none":void 0)}>${r}</rect>`;case"line":return R`<line data-skdx-part=${n.part} data-skdx-i=${$(i)} x1=${n.x1} y1=${n.y1} x2=${n.x2} y2=${n.y2} stroke=${n.stroke} stroke-width=${$(n.strokeWidth)} stroke-dasharray=${$(n.dash)} opacity=${$(n.opacity)}>${r}</line>`;case"circle":return R`<circle data-skdx-part=${n.part} data-skdx-i=${$(i)} cx=${n.cx} cy=${n.cy} r=${n.r} fill=${n.fill} stroke=${$(n.stroke)} opacity=${$(n.opacity)}>${r}</circle>`;case"text":return R`<text aria-label=${$(n.title)} data-skdx-part=${n.part} data-skdx-i=${$(i)} x=${n.x} y=${n.y} text-anchor=${$(n.anchor)} dominant-baseline=${$(n.baseline)} fill=${$(n.fill)} font-weight=${$(n.weight)} pointer-events=${$(i===void 0?"none":void 0)} transform=${$(n.rotate?`rotate(${n.rotate} ${n.x} ${n.y})`:void 0)}>${n.text}</text>`}})}`;var j=class extends x{render(){let{names:n,matrix:t,links:r,padding:i,sort:o}=this;return this.root(wt({...this.sized(),names:n,matrix:t,links:r,padding:i,sort:o}),"chord",this.label??"Chord chart")}};h([me({attribute:!1})],j.prototype,"names",2),h([me({attribute:!1})],j.prototype,"matrix",2),h([me({attribute:!1})],j.prototype,"links",2),h([me({type:Number})],j.prototype,"padding",2),h([me()],j.prototype,"sort",2),j=h([wn("skdx-chord-chart")],j);export{j as SkdxChordChart};
112
+ `,u([m({type:Number})],x.prototype,"width",2),u([m({type:Number})],x.prototype,"height",2),u([m()],x.prototype,"label",2),u([m({type:Boolean,reflect:!0})],x.prototype,"legend",2),u([m({type:Boolean,attribute:"no-tooltip",converter:In})],x.prototype,"tooltip",2),u([m({attribute:!1})],x.prototype,"format",2),u([m({attribute:!1})],x.prototype,"palette",2),u([m({attribute:!1})],x.prototype,"hiddenSeries",2),u([m({attribute:!1})],x.prototype,"selected",2),u([m({attribute:"selection-mode"})],x.prototype,"selectionMode",2),u([m({attribute:!1})],x.prototype,"highlighted",2),u([m({attribute:!1})],x.prototype,"highlightScope",2),u([m({type:Boolean,reflect:!0})],x.prototype,"loading",2),u([m()],x.prototype,"error",2),u([m({attribute:"empty-message"})],x.prototype,"emptyMessage",2),u([m()],x.prototype,"description",2),u([m({type:Boolean,reflect:!0})],x.prototype,"decorative",2),u([m({type:Boolean,attribute:"accessible-table"})],x.prototype,"accessibleTable",2),u([m({attribute:!1})],x.prototype,"zoom",2),u([m({attribute:!1})],x.prototype,"view",2),u([m({type:Boolean,reflect:!0})],x.prototype,"zoomable",2),u([m({type:Boolean,reflect:!0})],x.prototype,"editable",2),u([m({attribute:"sync-id"})],x.prototype,"syncId",2),u([m({type:Boolean,attribute:"cross-filter"})],x.prototype,"crossFilter",2),u([m({converter:{fromAttribute:t=>t===null?!1:t===""?!0:Number(t)}})],x.prototype,"animated",2),u([m({type:Boolean,reflect:!0})],x.prototype,"responsive",2),u([E()],x.prototype,"tip",2),u([E()],x.prototype,"overlay",2),u([E()],x.prototype,"portal",2),u([E()],x.prototype,"measured",2),u([E()],x.prototype,"viewState",2),u([E()],x.prototype,"highlightState",2),u([E()],x.prototype,"crossState",2),u([E()],x.prototype,"focused",2),u([E()],x.prototype,"hiddenState",2),u([E()],x.prototype,"zoomState",2),u([E()],x.prototype,"selectedState",2);var k=class extends x{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:c,annotations:s,labels:l,curve:h,connectNulls:d,nulls:g,stacked:S,stackOffset:C,orientation:y,radius:v,barGap:M,barWidth:A,sort:I,transform:O,transforms:ge,bins:q,binWidth:be,binDomain:N,binMode:G,sampling:X,brush:xe,crosshair:ye}=this;return{...this.sized(),series:t,categories:r,xAxis:i,yAxis:o,rightAxis:a,references:c,annotations:s,labels:l,curve:h,connectNulls:d,nulls:g,stacked:S,stackOffset:C,orientation:y,radius:v,barGap:M,barWidth:A,sort:I,transform:O,transforms:ge,bins:q,binWidth:be,binDomain:N,binMode:G,sampling:X,brush:xe,crosshair:ye,...this.compactOverrides()}}};u([m({attribute:!1})],k.prototype,"series",2),u([m({attribute:!1})],k.prototype,"categories",2),u([m({attribute:!1})],k.prototype,"xAxis",2),u([m({attribute:!1})],k.prototype,"yAxis",2),u([m({attribute:!1})],k.prototype,"rightAxis",2),u([m({attribute:!1})],k.prototype,"references",2),u([m({attribute:!1})],k.prototype,"annotations",2),u([m({type:Boolean,reflect:!0})],k.prototype,"labels",2),u([m()],k.prototype,"curve",2),u([m({type:Boolean,attribute:"connect-nulls"})],k.prototype,"connectNulls",2),u([m()],k.prototype,"nulls",2),u([m({reflect:!0,converter:{fromAttribute:t=>t==="percent"?"percent":t!==null}})],k.prototype,"stacked",2),u([m({attribute:"stack-offset"})],k.prototype,"stackOffset",2),u([m()],k.prototype,"orientation",2),u([m({type:Number})],k.prototype,"radius",2),u([m({type:Number,attribute:"bar-gap"})],k.prototype,"barGap",2),u([m({type:Number,attribute:"bar-width"})],k.prototype,"barWidth",2),u([m()],k.prototype,"sort",2),u([m()],k.prototype,"transform",2),u([m({attribute:!1})],k.prototype,"transforms",2),u([m({type:Number})],k.prototype,"bins",2),u([m({type:Number,attribute:"bin-width"})],k.prototype,"binWidth",2),u([m({attribute:!1})],k.prototype,"binDomain",2),u([m({attribute:"bin-mode"})],k.prototype,"binMode",2),u([m({attribute:!1})],k.prototype,"sampling",2),u([m({type:Boolean,reflect:!0})],k.prototype,"brush",2),u([m({type:Boolean,reflect:!0})],k.prototype,"crosshair",2);var Tn=e=>e.defs&&e.defs.length?P`<defs>${e.defs.map(n=>P`<linearGradient id=${n.id} x1="0" y1="0" x2=${n.vertical===!1?1:0} y2=${n.vertical===!1?0:1}>${n.stops.map(t=>P`<stop offset=${t.offset} stop-color=${t.color} stop-opacity=${w(t.opacity)}></stop>`)}</linearGradient>`)}</defs>`:T,ze=e=>P`${e.map((n,t)=>{let r=n.title?P`<title>${n.title}</title>`:T,i=n.item?t:void 0;switch(n.kind){case"path":return P`<path data-skdx-part=${n.part} data-skdx-i=${w(i)} d=${n.d} fill=${n.fill??"none"} stroke=${w(n.stroke)} stroke-width=${w(n.strokeWidth)} stroke-linecap=${w(n.strokeLinecap)} stroke-linejoin=${w(n.strokeLinejoin)} stroke-dasharray=${w(n.dash)} opacity=${w(n.opacity)} fill-opacity=${w(n.fillOpacity)}>${r}</path>`;case"rect":return P`<rect data-skdx-part=${n.part} data-skdx-i=${w(i)} x=${n.x} y=${n.y} width=${n.width} height=${n.height} rx=${w(n.rx)} style=${w(Ie(n.part)?`rx:${Ie(n.part)}`:void 0)} fill=${n.fill} stroke=${w(n.stroke)} fill-opacity=${w(n.opacity)} pointer-events=${w(n.part==="stage-label-background"||n.part==="label-background"?"none":void 0)}>${r}</rect>`;case"line":return P`<line data-skdx-part=${n.part} data-skdx-i=${w(i)} x1=${n.x1} y1=${n.y1} x2=${n.x2} y2=${n.y2} stroke=${n.stroke} stroke-width=${w(n.strokeWidth)} stroke-dasharray=${w(n.dash)} opacity=${w(n.opacity)}>${r}</line>`;case"circle":return P`<circle data-skdx-part=${n.part} data-skdx-i=${w(i)} cx=${n.cx} cy=${n.cy} r=${n.r} fill=${n.fill} stroke=${w(n.stroke)} opacity=${w(n.opacity)}>${r}</circle>`;case"text":return P`<text aria-label=${w(n.title)} data-skdx-part=${n.part} data-skdx-i=${w(i)} x=${n.x} y=${n.y} text-anchor=${w(n.anchor)} dominant-baseline=${w(n.baseline)} fill=${w(n.fill)} font-weight=${w(n.weight)} pointer-events=${w(i===void 0?"none":void 0)} transform=${w(n.rotate?`rotate(${n.rotate} ${n.x} ${n.y})`:void 0)}>${n.text}</text>`}})}`;var F=class extends x{render(){let{names:n,matrix:t,links:r,padding:i,sort:o}=this,a={...this.sized(),names:n,matrix:t,links:r,padding:i,sort:o,...this.compactOverrides()};return this.root(It(a),"chord",this.label??"Chord chart",a)}};u([me({attribute:!1})],F.prototype,"names",2),u([me({attribute:!1})],F.prototype,"matrix",2),u([me({attribute:!1})],F.prototype,"links",2),u([me({type:Number})],F.prototype,"padding",2),u([me()],F.prototype,"sort",2),F=u([An("skdx-chord-chart")],F);export{F as SkdxChordChart};