@skdx/web-components-charts 0.38.0 → 0.39.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 (81) hide show
  1. package/dist/area.cjs +31 -31
  2. package/dist/area.js +11 -11
  3. package/dist/bar.cjs +31 -31
  4. package/dist/bar.js +11 -11
  5. package/dist/boxplot.cjs +8 -8
  6. package/dist/boxplot.js +9 -9
  7. package/dist/bubble.cjs +9 -9
  8. package/dist/bubble.js +10 -10
  9. package/dist/bullet.cjs +12 -12
  10. package/dist/bullet.js +13 -13
  11. package/dist/bump.cjs +7 -7
  12. package/dist/bump.js +8 -8
  13. package/dist/candlestick.cjs +34 -34
  14. package/dist/candlestick.js +34 -34
  15. package/dist/chord.cjs +35 -35
  16. package/dist/chord.js +21 -21
  17. package/dist/circle-packing.cjs +16 -16
  18. package/dist/circle-packing.js +30 -30
  19. package/dist/combo.cjs +31 -31
  20. package/dist/combo.js +11 -11
  21. package/dist/dumbbell.cjs +21 -21
  22. package/dist/dumbbell.js +24 -24
  23. package/dist/funnel.cjs +7 -7
  24. package/dist/funnel.js +7 -7
  25. package/dist/gantt.cjs +7 -7
  26. package/dist/gantt.js +8 -8
  27. package/dist/gauge.cjs +6 -6
  28. package/dist/gauge.js +6 -6
  29. package/dist/heatmap.cjs +9 -9
  30. package/dist/heatmap.js +10 -10
  31. package/dist/histogram.cjs +30 -30
  32. package/dist/histogram.js +11 -11
  33. package/dist/icicle.cjs +16 -16
  34. package/dist/icicle.js +16 -16
  35. package/dist/index.cjs +33 -33
  36. package/dist/index.js +17 -17
  37. package/dist/line.cjs +31 -31
  38. package/dist/line.js +11 -11
  39. package/dist/linear-gauge.cjs +12 -12
  40. package/dist/linear-gauge.js +13 -13
  41. package/dist/map.cjs +6 -6
  42. package/dist/map.js +6 -6
  43. package/dist/marimekko.cjs +17 -17
  44. package/dist/marimekko.js +20 -20
  45. package/dist/network.cjs +14 -14
  46. package/dist/network.js +13 -13
  47. package/dist/organization.cjs +10 -10
  48. package/dist/organization.js +14 -14
  49. package/dist/parallel.cjs +6 -6
  50. package/dist/parallel.js +6 -6
  51. package/dist/pareto.cjs +30 -30
  52. package/dist/pareto.js +12 -12
  53. package/dist/pie.cjs +6 -6
  54. package/dist/pie.js +6 -6
  55. package/dist/polar-area.cjs +7 -7
  56. package/dist/polar-area.js +7 -7
  57. package/dist/radar.cjs +7 -7
  58. package/dist/radar.js +6 -6
  59. package/dist/radial.cjs +6 -6
  60. package/dist/radial.js +6 -6
  61. package/dist/range.cjs +31 -31
  62. package/dist/range.js +15 -15
  63. package/dist/sankey.cjs +10 -10
  64. package/dist/sankey.js +15 -15
  65. package/dist/scatter.cjs +31 -31
  66. package/dist/scatter.js +12 -12
  67. package/dist/sunburst.cjs +28 -28
  68. package/dist/sunburst.js +8 -8
  69. package/dist/swarm.cjs +16 -16
  70. package/dist/swarm.js +17 -17
  71. package/dist/timeline.cjs +6 -6
  72. package/dist/timeline.js +6 -6
  73. package/dist/tree.cjs +10 -10
  74. package/dist/tree.js +13 -13
  75. package/dist/treemap.cjs +7 -7
  76. package/dist/treemap.js +7 -7
  77. package/dist/waffle.cjs +31 -31
  78. package/dist/waffle.js +31 -31
  79. package/dist/waterfall.cjs +14 -14
  80. package/dist/waterfall.js +18 -18
  81. package/package.json +3 -3
@@ -1,5 +1,5 @@
1
- var Ft=Object.defineProperty;var Gt=Object.getOwnPropertyDescriptor;var h=(e,n,t,r)=>{for(var i=r>1?void 0:r?Gt(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&&Ft(n,t,i),i};import{customElement as an,property as H}from"lit/decorators.js";var dt=e=>Number(e.toPrecision(12)),jt,Ht=e=>(jt??(jt=new Intl.NumberFormat)).format(dt(e)),Vt=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 X(e){if(e===void 0)return Ht;if(typeof e=="function")return e;let{style:n,locale:t,digits:r,unit:i="",timeZone:o}=e,s=d=>i?p=>d(p)+i:d,a=d=>r===void 0?d===void 0?{}:{maximumFractionDigits:d}:{minimumFractionDigits:r,maximumFractionDigits:r},l=d=>{let p=new Intl.NumberFormat(t,d);return s(y=>p.format(dt(y)))},u=d=>{let p=new Intl.DateTimeFormat(t,o?{...d,timeZone:o}:d);return y=>p.format(y)};switch(n){case"integer":return l({maximumFractionDigits:0});case"decimal":return l(a(2));case"percent":return l({style:"percent",...a(0)});case"currency":return l({style:"currency",currency:e.currency??"USD",...a()});case"compact":return l({notation:"compact",...a(1)});case"scientific":return l({notation:"scientific",...a(2)});case"date":return u({dateStyle:"medium"});case"time":return u({timeStyle:"short"});case"datetime":return u({dateStyle:"medium",timeStyle:"short"});case"duration":return s(Vt)}}function ce([e,n],[t,r]){let i=n-e;return o=>i===0?t:t+(o-e)/i*(r-t)}function ue(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,l=Math.ceil(n/s)*s,u=[];for(let d=a;d<=l+s/2;d+=s)u.push(pt(d));return u}function ht(e,[n,t],r=.2){let i=e===0?0:(t-n)/e,o=i*(1-Math.max(0,Math.min(.9,r)));return{step:i,bandwidth:o,start:s=>n+s*i+(i-o)/2,center:s=>n+(s+.5)*i}}var pt=e=>Number(e.toPrecision(12)),f=e=>Number(e.toFixed(2)),N=e=>typeof e=="number"&&Number.isFinite(e);function ve(e){let n=1/0,t=-1/0;for(let r of e)N(r)&&(r<n&&(n=r),r>t&&(t=r));return n===1/0?[0,0]:[n,t]}var te=1e3,ne=60*te,re=60*ne,le=24*re,un=[te,5*te,15*te,30*te,ne,5*ne,15*ne,30*ne,re,3*re,6*re,12*re,le,2*le,7*le,14*le];function ft(e,n){let t=Math.floor(Math.log10(e)),r=Math.ceil(Math.log10(n)),i=r-t<=1?[1,2,5]:[1],o=[];for(let s=t;s<=r;s++)for(let a of i)o.push(pt(a*10**s));return o.filter(s=>s>=e/1.0001&&s<=n*1.0001)}var Zt=/-?\d*\.?\d+(?:e[-+]?\d+)?/gi,_t=/([MLTHVCSQAZmlthvcsqaz])([^MLTHVCSQAZmlthvcsqaz]*)/g,Wt={M:2,L:2,T:2,C:6,S:4,Q:4,A:7,H:-1,V:-2};function Et(e,n,t){return e.replace(_t,(r,i,o)=>{let s=Wt[i];if(s===void 0)return i+o;let l=(o.match(Zt)??[]).map((u,d)=>{let p=Number(u);if(s===-1)return String(p+n);if(s===-2)return String(p+t);let y=d%s;return s===7?y===5?String(p+n):y===6?String(p+t):u:String(y%2===0?p+n:p+t)});return i+l.join(" ")})}var mt=(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:Et(r.d,n,t)}}});var we=["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)"))),k={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)"},ke=(e="neutral")=>e==="neutral"?k.axis:`var(--skdx-color-${e}-500)`;var gt=(e,n)=>n??we[e%we.length];var q={top:16,right:16,bottom:32,left:48};function bt(e,n,t=q){return{x:t.left,y:t.top,width:Math.max(0,e-t.left-t.right),height:Math.max(0,n-t.top-t.bottom)}}function ie(e){let n=e.legend;if(n)return n===!0?{}:n.enabled===!1?void 0:n}function xt(e){let n=e.tooltip;return n===void 0||n===!0?{enabled:!0}:n===!1?{enabled:!1}:{...n,enabled:n.enabled??!0}}var de=20,Ut=120,yt=e=>{let n=ie(e);return n&&(n.position==="left"||n.position==="right")?n.width??Ut:0},$e=(e,n=600,t=300)=>({width:(e.width??n)-yt(e),height:(e.height??t)-(ie(e)?.position==="bottom"?de:0)}),vt=e=>{let n=ie(e);return n&&(n.position===void 0||n.position==="top")?de:0},Z=6.5,wt=(e,n,t)=>t??(e.palette&&e.palette.length>0?e.palette[n%e.palette.length]:gt(n)),kt=(e,n)=>e.hiddenSeries?.includes(n)??!1;function Me(e,n,t=[],r={},i=10,o=8,s=!1){let a=[],l=r.maxItems,u=l!==void 0&&l>=0&&e.length>l?e.slice(0,l):e,d=e.length-u.length,p=r.interactive??!0,y=o,w=i,M=(c,g,b,$)=>{let I=(g?18:4)+c.length*Z;y>o&&(s||y+I>n-8)&&(y=o,w+=de),g&&a.push({kind:"rect",part:"legend-swatch",x:y,y:w-5,width:10,height:10,fill:g,opacity:$?.3:void 0,item:b}),a.push({kind:"text",part:"legend-label",x:y+(g?14:0),y:w,text:c,baseline:"middle",fill:$?k.grid:k.label,item:b}),y+=I+12};for(let c of u){let g=t.includes(c.name),b=p?{label:c.name,series:c.name,legend:!0}:void 0;M(r.formatter?.(c.name)??c.name,c.color,b,g)}return d>0&&M(`+${d} more`,void 0,void 0,!1),r.align==="end"?Kt(a,n):a}function Kt(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*Z)),s=n-8-o;for(let a of i)r.push({...a,x:a.x+s})}return r}var Yt=(e,n,t={})=>new Set(Me(e,n,[],t).flatMap(r=>r.kind==="text"?[r.y]:[])).size;function Ce(e,n,t,r=[]){let i=ie(e),o=i&&e.direction==="rtl"&&i.align===void 0?{...i,align:"end"}:i,s=xt(e),a=o?.position==="bottom",l=yt(e),u=e.hiddenSeries??[],d=o?l?Me(r,1/0,u,o,10,(o.position==="right"?n:0)+8,!0):Me(r,n,u,o,a?t+10:10):[],p=a?Yt(r,n,o):0;return{width:n+l,height:a?t+Math.max(1,p)*de:t,legendOffset:o?.position==="left"?l:void 0,tooltip:s.enabled,tooltipFormatter:s.formatter,axisTooltipFormatter:s.axisFormatter,tooltipPortal:s.portal,tooltipPlacement:s.placement,tooltipAnchored:s.followPointer===!1?!0:void 0,description:e.description,decorative:e.decorative,animate:e.animate===!0?300:e.animate||void 0,responsive:!!e.responsive,shapes:d}}function Se(e){let n=e.legendOffset;if(!n)return e;let t=[...mt(e.shapes.filter(l=>!l.part.startsWith("legend-")),n,0),...e.shapes.filter(l=>l.part.startsWith("legend-"))],r=l=>({...l,x:l.x+n}),i=e.hit?{...e.hit,plot:r(e.hit.plot),xs:e.hit.xs.map(l=>l+n),brush:e.hit.brush?{box:r(e.hit.brush.box),window:r(e.hit.brush.window)}:void 0}:void 0,o=e.edit,s=o?{...o,scale:l=>o.scale(l)+n,invert:l=>o.invert(l-n),bars:o.bars.map(l=>({...l,x0:l.x0+n,x1:l.x1+n}))}:void 0,a=e.map?{...e.map,plot:r(e.map.plot)}:void 0;return{...e,shapes:t,hit:i,edit:s,map:a,legendOffset:void 0}}function he(e,n,t,r,i,o="auto"){let s=Array.isArray(t)?t:[t],a=Math.max(...s.map(y=>y.length))*Z+12,l=6+s.length*16,u=o==="top"?{x:e-a/2,y:n-l-8}:o==="bottom"?{x:e-a/2,y:n+8}:o==="left"?{x:e-a-8,y:n-l/2}:o==="right"?{x:e+8,y:n-l/2}:{x:e+12,y:n-l-6},d=Math.max(0,Math.min(r-a,u.x)),p=Math.max(0,Math.min(i-l,u.y));return[{kind:"rect",part:"tooltip",x:f(d),y:f(p),width:f(a),height:l,fill:"var(--skdx-color-surface-raised)",stroke:k.axis,rx:3},...s.map((y,w)=>({kind:"text",part:"tooltip-label",x:f(d+6),y:f(p+11+w*16),text:y,baseline:"middle",fill:"var(--skdx-color-text-default)",weight:s.length>1&&w===0?"bold":void 0}))]}function Mt([e,n],t,r=!1,i){let o=typeof r=="boolean"?{scale:r?"log":"linear"}:r,s=X(o.format??i),a=o.min??e,l=o.max??n;o.reversed&&(t=[t[1],t[0]]);let u={id:o.id,position:o.position,options:o};if(o.scale==="sqrt"){let c=T=>Math.sign(T)*Math.sqrt(Math.abs(T)),g=o.nice===!1?[a,l]:ue(a,l,o.ticks),b=o.min??g[0],$=o.max??g[g.length-1],I=ce([c(b),c($)],t),A=T=>I(c(T)),x=ue(b,$,o.ticks).filter(T=>T>=b-1e-9&&T<=$+1e-9);return{...u,scale:A,domain:[b,$],format:s,ticks:(x.length>=2?x:[b,$]).map(T=>({pos:f(A(T)),label:s(T)})),zero:f(A(Math.min(Math.max(0,b),$)))}}if(o.scale==="log"){let c=Math.max(a,Number.EPSILON),g=Math.max(l,c),b=ft(c,g),$=[Math.log10(c),Math.log10(g)],I=ce($,t),A=x=>I(Math.log10(Math.max(x,Number.EPSILON)));return{...u,scale:A,domain:$,format:s,ticks:b.map(x=>({pos:f(A(x)),label:s(x)})),zero:f(t[0])}}let d=ue(a,l,o.ticks),p=[o.min??(o.nice===!1?a:d[0]),o.max??(o.nice===!1?l:d[d.length-1])],y=ce(p,t),w=d.filter(c=>c>=p[0]-1e-9&&c<=p[1]+1e-9),M=(w.length>=2?w:[p[0],p[1]]).map(c=>({pos:f(y(c)),label:s(c)}));return{...u,scale:y,domain:p,format:s,ticks:M,zero:f(y(Math.min(Math.max(0,p[0]),p[1])))}}function Ie(e,n){if(e.length<2)return e;let t=e.reduce((i,o)=>Math.max(i,o.label.length),0)*Z+8,r=Math.max(1,Math.ceil(e.length*t/Math.max(1,n)));return r===1?e:e.filter((i,o)=>o%r===0)}function pe(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}=$e(e,t,r),a=i==="error"?e.error:i==="loading"?"Loading\u2026":e.emptyMessage??"No data available",l=[];return i==="loading"&&l.push({kind:"rect",part:"skeleton",x:0,y:0,width:o,height:s,fill:"var(--skdx-color-surface-sunken)",rx:4}),l.push({kind:"text",part:`state-${i}`,x:f(o/2),y:f(s/2),text:a,anchor:"middle",baseline:"middle",fill:i==="error"?"var(--skdx-color-text-danger)":k.label}),{...Ce(e,o,s),shapes:l,tooltip:!1}}function $t(e,n={}){let{plot:t,xTicks:r,yTicks:i,baseline:o}=e,s=t.x+t.width,a=t.y+t.height,l=[],u=n.grid??!0,d=(M,c)=>c?{kind:"line",part:"grid",x1:M.pos,x2:M.pos,y1:t.y,y2:a,stroke:k.grid}:{kind:"line",part:"grid",x1:t.x,x2:s,y1:M.pos,y2:M.pos,stroke:k.grid},p=n.x?.tickRotation??0,y=(M,c,g,b)=>p?L(M,c,g,{part:b,anchor:p<0?"end":"start",baseline:"middle",rotate:p}):L(M,c,g,{part:b,anchor:"middle"}),w=(M,c,g,b,$)=>{for(let I of M)l.push(c==="x"?{kind:"line",part:"tick",x1:I.pos,x2:I.pos,y1:g,y2:f(g+b*$),stroke:k.axis}:{kind:"line",part:"tick",x1:g,x2:f(g+b*$),y1:I.pos,y2:I.pos,stroke:k.axis})};if(n.categoryGrid)for(let M of r)l.push(d(M,!n.horizontal));if(n.horizontal){let M=n.axes??[{ticks:i,position:"bottom",offset:0,label:n.yLabel,...n.y}];if(u)for(let c of i)l.push(d(c,!0));M[0]?.showLine!==!1&&l.push({kind:"line",part:"axis",x1:o,x2:o,y1:t.y,y2:a,stroke:k.axis});for(let c of M){let g=c.position==="top"||c.position==="right",b=f(g?t.y-c.offset:a+c.offset),$=g||c.offset>0;c.showLine&&$&&l.push({kind:"line",part:"axis",x1:t.x,x2:s,y1:b,y2:b,stroke:k.axis}),c.showTicks&&w(c.ticks,"x",b,g?-1:1,c.tickSize??4);let I=f(g?b-8:b+20);for(let A of c.ticks)l.push(g?L(A.pos,I,A.label,{part:"x-label-top",anchor:"middle"}):y(A.pos,I,A.label,"x-label"));c.label&&l.push($?L(4,I,c.label,{part:"axis-title",anchor:"start",baseline:g?void 0:"middle"}):L(4,t.y-6,c.label,{part:"axis-title",anchor:"start"}))}n.x?.showLine&&l.push({kind:"line",part:"axis",x1:n.rtl?s:t.x,x2:n.rtl?s:t.x,y1:t.y,y2:a,stroke:k.axis}),n.x?.showTicks&&w(r,"y",n.rtl?s:t.x,n.rtl?1:-1,n.x.tickSize??4);for(let c of r)l.push(n.rtl?L(s+8,c.pos,c.label,{part:"y-label",anchor:"start",baseline:"middle"}):L(t.x-8,c.pos,c.label,{part:"y-label",anchor:"end",baseline:"middle"}))}else{if(u)for(let c of i)l.push(d(c,!1));n.y?.showLine!==!1&&l.push({kind:"line",part:"axis",x1:t.x,x2:s,y1:o,y2:o,stroke:k.axis});let M=n.axes??[{ticks:i,position:"left",offset:0,label:n.yLabel,...n.y},...n.rightTicks?[{ticks:n.rightTicks,position:"right",offset:0,label:n.rightLabel}]:[]];for(let c of M){let g=c.position==="left",b=g?t.x-c.offset:s+c.offset,$=g?"y-label":"y-label-right";c.showLine&&l.push({kind:"line",part:"axis",x1:f(b),x2:f(b),y1:t.y,y2:a,stroke:k.axis}),c.showTicks&&w(c.ticks,"y",f(b),g?-1:1,c.tickSize??4);for(let I of c.ticks)l.push(L(f(g?b-8:b+8),I.pos,I.label,{part:$,anchor:g?"end":"start",baseline:"middle"}));c.label&&l.push(L(f(g?c.offset===0?4:Math.max(4,b-40):c.offset===0?e.width-4:Math.min(e.width-4,b+40)),t.y-6,c.label,{part:"axis-title",anchor:g?"start":"end"}))}n.x?.showTicks&&w(r,"x",a,1,n.x.tickSize??4);for(let c of r)l.push(y(c.pos,a+(p?12:20),c.label,"x-label"))}return n.xLabel&&l.push(L(f(t.x+t.width/2),e.height-4,n.xLabel,{part:"axis-title",anchor:"middle"})),n.horizontal&&n.rightLabel&&l.push(L(e.width-4,t.y-6,n.rightLabel,{part:"axis-title",anchor:"end"})),l}var L=(e,n,t,r={})=>({kind:"text",part:"label",x:e,y:n,text:t,fill:k.label,...r});function fe(e){return e==null?[]:(Array.isArray(e)?e:[e]).map(t=>typeof t=="object"?t:{id:t})}var Te=e=>e.id??e.name??e.series,Ct=e=>e.seriesId??e.series;function G(e,n){let t=!1;return n.id!==void 0&&(t=!0,Te(e)!==n.id&&e.id!==n.id&&e.name!==n.id)||n.series!==void 0&&(t=!0,Ct(e)!==n.series&&e.series!==n.series)||n.index!==void 0&&(t=!0,e.index!==n.index)||n.category!==void 0&&(t=!0,e.category!==n.category)?!1:t}function _(e){let n={},t=Te(e);t!==void 0&&(n.id=t);let r=Ct(e);return r!==void 0&&e.series!==void 0&&(n.series=r),e.index!==void 0&&(n.index=e.index),n}var ze=(e,n)=>e.id===n.id&&e.series===n.series&&e.index===n.index&&e.category===n.category;function Oe(e,n,t){let r=fe(e),i=_(n),o=r.some(s=>G(n,s));return t==="single"?o?[]:[i]:o?r.filter(s=>!G(n,s)):[...r,i]}var qt=.2;function Xt(e){let n=k.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 Qt=(e,n)=>e.kind==="text"?{...e,fill:k.grid}:{...e,opacity:(e.opacity??1)*n};function Ae(e,n){let t=fe(n.selected),r=n.highlighted===void 0||n.highlighted===null?[]:fe(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=d=>!i||r.some(p=>G(d,p))?!0:o.highlighted==="series"?r.some(p=>p.series!==void 0&&G(d,{series:p.series})):!1,l=d=>{if(!i||o.faded==="none"||a(d))return!1;if(o.faded==="series"){let p=i.series;return p!==void 0&&G(d,{series:p})}return!0},u=e.shapes.map(d=>{let p=d.item;if(!p||p.legend)return d;if(t.some(y=>G(p,y))){let y=Xt(d);y&&s.push(y)}return l(p)?Qt(d,qt):d});return s.length?{...e,shapes:[...u,...s]}:{...e,shapes:u}}function Jt(e,n){let t=[],r=n;for(let i of e??[]){let o=typeof i=="number"?{from:r,to:i}:i;N(o.to)&&(t.push(o),r=o.to)}return t}function St(e){let n=e.data.filter(x=>N(x.value)),t=pe(e,n.length===0,600,40+44*Math.max(1,e.data.length));if(t)return t;let r=X(e.format),i=e.orientation==="vertical",{width:o,height:s}=$e(e,600,i?300:40+44*n.length),a=x=>x.ranges??e.ranges,l=n.flatMap(x=>[x.value,x.target,...(a(x)??[]).map(T=>typeof T=="number"?T:T.to)]),[u,d]=ve(l),p=e.min??Math.min(0,u),y=Math.max(0,...n.map(x=>x.name.length))*Z,w=bt(o,s,{top:q.top+vt(e),right:e.labels&&!i?56:q.right,bottom:q.bottom,left:i?q.left:Math.max(q.left,y+16)}),M=i?[w.y+w.height,w.y]:[w.x,w.x+w.width],c=Mt([p,Math.max(p,d)],M,{min:p,max:e.max,ticks:e.ticks},e.format),g=ht(n.length,i?[w.x,w.x+w.width]:[w.y,w.y+w.height],.3),b=Ce(e,o,s),$=n.map((x,T)=>({pos:f(g.center(T)),label:x.name})),I=$t({...b,plot:w,xTicks:i?Ie($,w.width):$,yTicks:i?c.ticks:Ie(c.ticks,w.width),baseline:c.zero},{horizontal:!i}),A=(x,T,B,P,U)=>{let K=c.scale(x),V=c.scale(T),Y=Math.max(1,Math.abs(V-K));return i?{kind:"rect",x:f(B-P/2),y:f(Math.min(K,V)),width:f(P),height:f(Y),...U}:{kind:"rect",x:f(Math.min(K,V)),y:f(B-P/2),width:f(Y),height:f(P),...U}};return n.forEach((x,T)=>{if(kt(e,x.name))return;let B=g.center(T),P=g.bandwidth,U=Jt(a(x),p);U.forEach((z,ut)=>{let Dt=`${x.name} ${z.label??`range ${ut+1}`}: ${r(z.from)} \u2013 ${r(z.to)}`;I.push(A(z.from,z.to,B,P,{part:"range",fill:z.color??(z.variant?ke(z.variant):k.axis),opacity:z.variant||z.color?.25:Math.max(.1,.4-ut*.1),title:Dt}))});let K=N(x.target)?` \xB7 target ${r(x.target)}`:"",V=U.find(z=>x.value>=z.from&&x.value<=z.to),Y=`${x.name}: ${r(x.value)}${K}${V?.label?` (${V.label})`:""}`;if(I.push(A(Math.min(p,x.value),x.value,B,P/3,{part:"measure",fill:wt(e,T,x.color),title:Y,item:{label:Y,id:x.id,name:x.name,index:T,value:x.value}})),N(x.target)){let z=f(c.scale(x.target));I.push({kind:"line",part:"target",x1:i?f(B-P/2.5):z,x2:i?f(B+P/2.5):z,y1:i?z:f(B-P/2.5),y2:i?z:f(B+P/2.5),stroke:"var(--skdx-color-text-default)",strokeWidth:3,title:`${x.name} target: ${r(x.target)}`})}if(e.labels){let z=c.scale(N(x.target)?Math.max(x.value,x.target):x.value);I.push(i?L(f(B),f(z-6),r(x.value),{part:"value-label",anchor:"middle"}):L(f(z+6),f(B),r(x.value),{part:"value-label",baseline:"middle"}))}}),{...b,shapes:[...I,...b.shapes]}}function ee(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 Le=(e,n,t)=>n>=e.x&&n<=e.x+e.width&&t>=e.y&&t<=e.y+e.height;function It(e,n){let t=0,r=1/0;return e.xs.forEach((i,o)=>{let s=Math.abs(i-n);s<r&&(r=s,t=o)}),t}function oe(e,n){let t=e.hit;if(!t||t.xs.length===0)return;let r=It(t,n),i=t.rows[r]??[];return{index:r,rows:e.axisTooltipFormatter?.(i,r)??i}}function Be(e,n){let t=e.hit;if(!t||t.xs.length===0)return;let r=t.xs[It(t,n)];return{kind:"line",part:"crosshair",x1:r,x2:r,y1:t.plot.y,y2:t.plot.y+t.plot.height,stroke:k.axis,dash:"3 3"}}function Pe(e,n,t){let r=e.hit;if(!r||!r.crosshair||r.xs.length===0||!Le(r.plot,n,t))return[];let i=Be(e,n),{rows:o}=oe(e,n),s=e.tooltipAnchored?r.plot.y+8:t;return[i,...he(i.x1,s,o,e.width,e.height,e.tooltipPlacement)]}function Re(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 Pe(e,i,t.plot.y+8)}function Ne(e,n,t,r,i){if(!e.tooltip)return{lines:[],shapes:[]};if(e.hit?.crosshair){let{x:l,y:u}=ee(t,r,i,e.width,e.height);if(Le(e.hit.plot,l,u)){let d=oe(e,l),p=Be(e,l);if(d&&p)return{lines:d.rows,shapes:[p]}}}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(l=>l.tagName.toLowerCase()==="title")?.textContent;return a?{lines:Array.isArray(a)?a:[a],shapes:[]}:{lines:[],shapes:[]}}function Tt(e,n,t,r,i,o,s){let a=e?.closest?.("[data-skdx-part]"),l=s&&s.tooltipFormatter?W(s,e)?.item:void 0,u=l&&s?.tooltipFormatter?.(l)||a&&Array.from(a.children).find(M=>M.tagName.toLowerCase()==="title")?.textContent;if(!u)return[];let d=s?.tooltipAnchored?W(s,e):void 0,p=d?s?.shapes[d.index]:void 0,{x:y,y:w}=p?se(p):ee(n,t,r,i,o);return he(y,w,u,i,o,s?.tooltipPlacement)}function De(e,n,t,r,i){if(!e.tooltip)return[];if(e.hit?.crosshair){let{x:o,y:s}=ee(t,r,i,e.width,e.height),a=Pe(e,o,s);if(a.length>0)return a}return Tt(n,t,r,i,e.width,e.height,e)}function Fe(e,n){let t=W(e,n);return t&&!t.item.legend?_(t.item):null}var en=(e,n)=>{let{x:t,y:r}=se(e),i=e.kind==="circle"?e.cy:e.kind==="rect"?e.y+e.height/2:r;return t>=n.x&&t<=n.x+n.width&&i>=n.y&&i<=n.y+n.height};function Ge(e,n){let t=new Set,r=[];for(let i of e.shapes){if(!i.item||i.item.legend||i.part==="anchor"||!en(i,n))continue;let o=_(i.item),s=JSON.stringify(o);t.has(s)||(t.add(s),r.push(o))}return r}var je=e=>({kind:"rect",part:"selection-box",x:f(e.x),y:f(e.y),width:f(e.width),height:f(e.height),fill:k.focus,opacity:.12,stroke:k.focus}),ge=(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 zt(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 He(e,n){if(n.length<3)return[];let t=new Set,r=[];for(let i of e.shapes){if(!i.item||i.item.legend||i.part==="anchor")continue;let{x:o,y:s}=se(i),a=i.kind==="circle"?i.cy:i.kind==="rect"?i.y+i.height/2:s;if(!zt(n,o,a))continue;let l=_(i.item),u=JSON.stringify(l);t.has(u)||(t.add(u),r.push(l))}return r}var Ve=e=>({kind:"path",part:"selection-lasso",d:e.length?`M${e.map(n=>`${f(n.x)} ${f(n.y)}`).join("L")}`:"",fill:k.focus,fillOpacity:.12,stroke:k.focus,dash:"4 3"}),me=6;function Ze(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-me||n>i.x1+me))return Math.abs(n-i.x0)<=me?{bar:i,mode:"start"}:Math.abs(n-i.x1)<=me?{bar:i,mode:"end"}:{bar:i,mode:"move"}}}function _e(e,n,t){let r=e.edit;return Ot(r,n,r.invert(n.bar.x0+t)-r.invert(n.bar.x0))}function We(e,n,t){let r=e.edit,i=t.key==="ArrowRight"?1:t.key==="ArrowLeft"?-1:0;if(!r||n===null||!i||!(t.shiftKey||t.altKey))return;let o=r.bars.find(l=>l.index===n);if(!o)return;let s=t.altKey?t.shiftKey?"start":"end":"move",a=r.snap??r.invert(o.x0+10)-r.invert(o.x0);return Ot(r,{bar:o,mode:s},i*a)}function Ot(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 Ee(e,n,t){let r=e.edit,i=r.scale(t.start),o=r.scale(t.end);return{kind:"rect",part:"edit-ghost",x:f(Math.min(i,o)),y:f(n.bar.y),width:f(Math.max(1,Math.abs(o-i))),height:f(n.bar.height),fill:k.focus,opacity:.25,stroke:k.focus,rx:2}}var tn=64,nn=e=>Math.max(1,Math.min(tn,e));function Ue(e,n,t,r){let i=n>0?.8:1.25,o=nn(e.view.zoom*i);if(o===e.view.zoom)return e.view;let{plot:s,scale:a}=e,[l,u]=e.view.center,d=(t-(s.x+s.width/2))/a,p=(r-(s.y+s.height/2))/a,y=e.view.zoom/o;return{center:[l+d*(1-y),e.fromY(e.toY(u)-p*(1-y))],zoom:o}}function Ke(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 be=e=>e.shapes.flatMap((n,t)=>n.item&&!n.item.legend?[t]:[]);function se(e){switch(e.kind){case"rect":return{x:e.x+e.width/2,y:e.y};case"circle":return{x:e.cx,y:e.cy-e.r};case"line":return{x:(e.x1+e.x2)/2,y:Math.min(e.y1,e.y2)};case"text":return{x:e.x,y:e.y};case"path":{let n=/M\s*(-?[\d.]+)[ ,](-?[\d.]+)/.exec(e.d);return n?{x:Number(n[1]),y:Number(n[2])}:{x:0,y:0}}}}function Ye(e,n){let t=n===null?void 0:e.shapes[n];if(!t)return[];let r=k.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*Z+4,height:16,fill:"none",stroke:r,rx:2};break;case"path":i={kind:"path",part:"focus",d:t.d,stroke:r,strokeWidth:2,fill:"none"};break}let{x:o,y:s}=se(t),a=t.item&&e.tooltipFormatter?.(t.item)||(t.item?.label??t.title??"");return[i,...a?he(f(o),f(s),a,e.width,e.height):[]]}function qe(e,n,t){let r=be(e);if(r.length===0)return;let i=n===null?-1:r.indexOf(n);switch(t){case"ArrowRight":case"ArrowDown":return r[Math.min(r.length-1,i+1)];case"ArrowLeft":case"ArrowUp":return r[Math.max(0,i<=0?0:i-1)];case"Home":return r[0];case"End":return r[r.length-1];case"Escape":return null;default:return}}var Q=2,J=(e,n,t)=>{let r=Math.max(Q,Math.min(t,Math.round(n))),i=Math.max(0,Math.min(t-r,Math.round(e)));return{start:i,end:i+r}},At=(e,n)=>!e||e.start<=0&&e.end>=n;function Xe(e,n,t){if(e.count<=Q||!e.plot.width)return;let{start:r,end:i}=e.zoom,o=i-r,s=n>0?1.25:.8,a=Math.max(Q,Math.min(e.count,Math.round(o*s)));if(a===o)return n>0&&!At(e.zoom,e.count)?J(r,a,e.count):void 0;let l=Math.max(0,Math.min(1,(t-e.plot.x)/e.plot.width)),u=r+l*o;return J(u-l*a,a,e.count)}function Qe(e,n,t,r){let i=n.end-n.start,o=Math.max(Q,Math.min(e.count,Math.round(i/Math.max(.05,t)))),s=Math.max(0,Math.min(1,(r-e.plot.x)/Math.max(1,e.plot.width)));return J(n.start+s*i-s*o,o,e.count)}function Je(e,n,t){let r=n.end-n.start,i=e.plot.width/Math.max(1,r);return J(n.start-t/i,r,e.count)}function et(e,n,t){let r=e.brush;if(!r||!Le(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:J(s-o/2,o,e.count)}}function tt(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 J(t.start+o,t.end-t.start,e.count);if(n==="left")return{start:Math.max(0,Math.min(t.end-Q,Math.round(t.start+o))),end:t.end};let s=Math.min(e.count,Math.max(t.start+Q,Math.round(t.end+o)));return{start:t.start,end:s}}function rt(e,n){switch(n.type){case"svg":return Promise.resolve(nt(e,n.label,n.resolve));case"csv":return Promise.resolve(Rt(n.rows));case"png":{if(typeof document>"u"||typeof Image>"u")return Promise.reject(new Error("PNG export needs a browser"));let t=nt(e,n.label,n.resolve);return Pt(t,e.width,e.height,n.scale,n.background)}}}var j=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/"/g,"&quot;"),ae=e=>e.filter(([,n])=>n!==void 0&&n!=="").map(([n,t])=>` ${n}="${j(String(t))}"`).join("");function Lt(e){let n=e.title?`<title>${j(e.title)}</title>`:"",t=["data-skdx-part",e.part];switch(e.kind){case"path":return`<path${ae([t,["d",e.d],["fill",e.fill??"none"],["stroke",e.stroke],["stroke-width",e.strokeWidth],["stroke-linecap",e.strokeLinecap],["stroke-linejoin",e.strokeLinejoin],["stroke-dasharray",e.dash],["opacity",e.opacity],["fill-opacity",e.fillOpacity]])}>${n}</path>`;case"rect":return`<rect${ae([t,["x",e.x],["y",e.y],["width",e.width],["height",e.height],["rx",e.rx],["fill",e.fill],["stroke",e.stroke],["fill-opacity",e.opacity]])}>${n}</rect>`;case"line":return`<line${ae([t,["x1",e.x1],["y1",e.y1],["x2",e.x2],["y2",e.y2],["stroke",e.stroke],["stroke-width",e.strokeWidth],["stroke-dasharray",e.dash],["opacity",e.opacity]])}>${n}</line>`;case"circle":return`<circle${ae([t,["cx",e.cx],["cy",e.cy],["r",e.r],["fill",e.fill],["stroke",e.stroke]])}>${n}</circle>`;case"text":return`<text${ae([t,["x",e.x],["y",e.y],["text-anchor",e.anchor],["dominant-baseline",e.baseline],["fill",e.fill],["font-weight",e.weight],["transform",e.rotate?`rotate(${e.rotate} ${e.x} ${e.y})`:void 0]])}>${j(e.text)}</text>`}}function Bt(e){let n=e.defs??[];return n.length===0?"":`<defs>${n.map(t=>`<linearGradient id="${j(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="${j(r.color)}"${r.opacity===void 0?"":` stop-opacity="${r.opacity}"`}/>`).join("")}</linearGradient>`).join("")}</defs>`}function nt(e,n,t){let r=Bt(e)+e.shapes.map(Lt).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="${j(n)}" font-family="${j(k.fontFamily)}" font-size="${j(k.fontSize)}"><title>${j(n)}</title>${r}</svg>`}function Pt(e,n,t,r=2,i){return new Promise((o,s)=>{let a=URL.createObjectURL(new Blob([e],{type:"image/svg+xml;charset=utf-8"})),l=new Image;l.onload=()=>{URL.revokeObjectURL(a);let u=document.createElement("canvas");u.width=Math.round(n*r),u.height=Math.round(t*r);let d=u.getContext("2d");if(!d)return s(new Error("canvas 2d context unavailable"));i&&(d.fillStyle=i,d.fillRect(0,0,u.width,u.height)),d.drawImage(l,0,0,u.width,u.height),u.toBlob(p=>p?o(p):s(new Error("toBlob failed")),"image/png")},l.onerror=()=>{URL.revokeObjectURL(a),s(new Error("svg could not be decoded"))},l.src=a})}function Rt(e){let n=t=>{let r=t==null?"":String(t);return/[",\n\r]/.test(r)?`"${r.replace(/"/g,'""')}"`:r};return e.map(t=>t.map(n).join(",")).join(`\r
2
- `)}function it(e,n){if(!n)return;let t=typeof n=="object"?n.maxRows??500:500,r=e.hit;if(r&&r.rows.length>0){let a=r.rows[0];if(r.rows.length>t)return;let l=["",...a.slice(1).map(d=>d.replace(/:\s[^:]*$/,""))],u=r.rows.map(d=>[d[0],...d.slice(1).map(p=>p.slice(p.lastIndexOf(": ")+2))]);return[l,...u]}let i=e.shapes.flatMap(a=>a.item&&!a.item.legend&&!(a.part==="anchor"&&!a.title)?[a.item]:[]);if(i.length===0||i.length>t)return;let o=["series","name","category","value"].filter(a=>i.some(l=>l[a]!==void 0)),s=(a,l)=>a[l]===void 0?"":String(a[l]);return[o.map(a=>a[0]?.toUpperCase()+a.slice(1)),...i.map(a=>o.map(l=>s(a,l)))]}var ot=new Map;function xe(e){let n=ot.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&&ot.delete(e)}},publish(o,s){Object.assign(r,o);for(let a of t)a(o,s)}};return ot.set(e,{group:i,listeners:t}),i}var Nt='[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}}${Nt}{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){${Nt}{animation:none;transition:none}}`;function at(e){let n=e.animate;return n&&e.shapes.length<=1500?`${n}ms`:void 0}function lt(e){let n=e.orientation==="vertical",t=pe(e,!N(e.value),600,n?300:64);if(t)return t;let r=X(e.format),i=e.min??0,o=(e.bands??[]).filter(u=>N(u.from)&&N(u.to)),s=e.max??Math.max(100,e.value,e.target??-1/0,...o.map(u=>u.to)),a=N(e.target)?`, target ${r(e.target)}`:"";return{...St({...e,height:e.height??(n?300:64),data:[{id:"value",name:e.caption??"",value:e.value,target:e.target,ranges:o}],min:i,max:s,labels:e.labels??!0,ticks:e.ticks}),description:e.description??`${e.caption??"Value"} ${r(e.value)} on a scale from ${r(i)} to ${r(s)}${a}.`}}import{css as rn,html as E,LitElement as on,nothing as O,svg as D}from"lit";import{property as m,state as F}from"lit/decorators.js";import{ifDefined as S}from"lit/directives/if-defined.js";var ct={fromAttribute:()=>!1},v=class extends on{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=[je(ge(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=[Ve(i.points)];return}if(i?.grab==="edit"){if(!i.gantt)return;let{x:o}=this.viewBox(t,r);i.change=_e(r,i.gantt,o-i.x),this.overlay=[Ee(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(Ke(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(Qe(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"?Je(r.hit,i.zoom,o-i.x):tt(r.hit,i.grab,i.zoom,o-i.x));return}if(r.tooltipPortal){let{lines:o,shapes:s}=Ne(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=De(r,t.target,t.currentTarget,t.clientX,t.clientY);(o.length>0||this.tip.length>0)&&(this.tip=o)}if(this.highlight(Fe(r,t.target)),this.syncId&&r.hit?.crosshair){let o=oe(r,this.viewBox(t,r).x);this.shareCrosshair(o?r.hit.rows[o.index]?.[0]??null:null)}};this.onPointerDown=t=>{let r=this.layout;if(!r||t.button!==0)return;let{x:i,y:o}=this.viewBox(t,r),s=W(r,t.target)?.item.legend,a=this.canEdit(r)?Ze(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 u=r.map.plot;if(i<u.x||i>u.x+u.width||o<u.y||o>u.y+u.height)return;this.drag={x:i,y:o,zoom:{start:0,end:0},grab:"map",view:r.map.view},t.currentTarget.setPointerCapture(t.pointerId),this.clearTip();return}let l=r.hit;if(!(!l||!this.canZoom(r))){if(this.pointers.set(t.pointerId,i),this.pointers.size===2){let[u,d]=[...this.pointers.values()];this.drag={x:(u+d)/2,y:o,zoom:l.zoom,grab:"pinch",distance:Math.abs(u-d)||1}}else{let u=et(l,i,o);if(u)this.drag={x:i,y:o,zoom:u.zoom,grab:u.grab},u.zoom!==l.zoom&&this.setZoom(u.zoom);else if(this.zoomable&&i>=l.plot.x&&i<=l.plot.x+l.plot.width&&o>=l.plot.y&&o<=l.plot.y+l.plot.height)this.drag={x:i,y:o,zoom:l.zoom,grab:"pan"};else{this.pointers.delete(t.pointerId);return}}t.currentTarget.setPointerCapture(t.pointerId),this.clearTip()}};this.onPointerUp=t=>{this.pointers.delete(t.pointerId);let r=t.currentTarget;r.hasPointerCapture(t.pointerId)&&r.releasePointerCapture(t.pointerId);let i=this.drag,o=this.layout;if(o&&(i?.grab==="select"||i?.grab==="lasso"||i?.grab==="edit"||i?.grab==="map")){this.overlay=[];let{x:s,y:a}=this.viewBox(t,o);if(Math.abs(s-i.x)>2||Math.abs(a-i.y)>2){i.grab==="select"?this.setSelected(Ge(o,ge(i.x,i.y,s,a))):i.grab==="lasso"?this.setSelected(He(o,i.points??[])):i.grab==="edit"&&i.change&&this.emit("skdx-task-change",i.change),this.drag={...i,distance:-1};return}this.drag=null;return}(this.pointers.size===0||this.drag?.grab==="pinch")&&(this.drag=null)};this.onWheel=t=>{let r=this.layout;if(!r)return;let{x:i,y:o}=this.viewBox(t,r);if(r.map&&this.canPan(r)){let l=r.map.plot;if(i<l.x||i>l.x+l.width||o<l.y||o>l.y+l.height)return;t.preventDefault(),this.setView(Ue(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=Xe(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=>{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)?We(r,this.focused,t):void 0;if(i){t.preventDefault(),this.emit("skdx-task-change",i);return}let o=qe(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?_(s):null)}}connectedCallback(){super.connectedCallback(),!(typeof ResizeObserver>"u")&&(this.observer=new ResizeObserver(([t])=>{let r=Math.floor(t?.contentRect.width??0);r>0&&(this.measured=r)}),this.observer.observe(this))}disconnectedCallback(){this.observer?.disconnect(),this.leave?.(),this.leave=void 0,this.joined=void 0,super.disconnectedCallback()}sized(){let{width:t,height:r,legend:i,tooltip:o,format:s,palette:a,loading:l,error:u,emptyMessage:d,description:p,decorative:y,animated:w,responsive:M,highlighted:c,highlightScope:g,accessibleTable:b}=this;return{...typeof M=="object"&&this.measured!==void 0&&this.measured<(M.breakpoint??480)?M.compact:void 0,width:M&&this.measured?this.measured:t,height:r,animate:w,responsive:M,legend:i,tooltip:o,format:s,palette:a,loading:l,error:u,emptyMessage:d,description:p,decorative:y,highlighted:c===void 0?this.highlightState:c,highlightScope:g,accessibleTable:b,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&&xe(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=xe(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&&ze(r,t)||(this.hover=t,this.emit("skdx-highlighted-change",t),this.syncId&&(this.highlightState=t,this.publish({highlighted:t})))}select(t){let r=this.selectionMode;r!=="none"&&this.setSelected(Oe(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 ee(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&&G(o.item,t));return i<0?!1:(this.getSvgElement()?.focus(),this.focused=i,!0)}export(t){let r=this.layout;return r?rt(r,{...t,label:t.label??this.label??this.localName}):Promise.reject(new Error("not rendered yet"))}root(t,r,i){this.join();let o=Ae(Se(t),this.sized());if(this.layout=o,o.issues!==this.reported){this.reported=o.issues;for(let b of o.issues??[])this.emit("skdx-data-issue",b)}let s=this.canZoom(o),a=this.canPan(o),l=this.canEdit(o),u=this.brushing(),d=s||a||l||u,p=!o.decorative&&be(o).length>0,y=o.description?`${r}-desc`:void 0,w=at(o),M=it(o,this.accessibleTable),c=typeof this.accessibleTable=="object"&&this.accessibleTable.caption||i,g=this.portal;return E`<svg
1
+ var jt=Object.defineProperty;var Ht=Object.getOwnPropertyDescriptor;var h=(e,n,t,r)=>{for(var i=r>1?void 0:r?Ht(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&&jt(n,t,i),i};import{customElement as ln,property as V}from"lit/decorators.js";var dt=e=>Number(e.toPrecision(12)),Vt,Zt=e=>(Vt??(Vt=new Intl.NumberFormat)).format(dt(e)),_t=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 X(e){if(e===void 0)return Zt;if(typeof e=="function")return e;let{style:n,locale:t,digits:r,unit:i="",timeZone:o}=e,s=d=>i?p=>d(p)+i:d,a=d=>r===void 0?d===void 0?{}:{maximumFractionDigits:d}:{minimumFractionDigits:r,maximumFractionDigits:r},l=d=>{let p=new Intl.NumberFormat(t,d);return s(y=>p.format(dt(y)))},u=d=>{let p=new Intl.DateTimeFormat(t,o?{...d,timeZone:o}:d);return y=>p.format(y)};switch(n){case"integer":return l({maximumFractionDigits:0});case"decimal":return l(a(2));case"percent":return l({style:"percent",...a(0)});case"currency":return l({style:"currency",currency:e.currency??"USD",...a()});case"compact":return l({notation:"compact",...a(1)});case"scientific":return l({notation:"scientific",...a(2)});case"date":return u({dateStyle:"medium"});case"time":return u({timeStyle:"short"});case"datetime":return u({dateStyle:"medium",timeStyle:"short"});case"duration":return s(_t)}}function ce([e,n],[t,r]){let i=n-e;return o=>i===0?t:t+(o-e)/i*(r-t)}function ue(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,l=Math.ceil(n/s)*s,u=[];for(let d=a;d<=l+s/2;d+=s)u.push(pt(d));return u}function ht(e,[n,t],r=.2){let i=e===0?0:(t-n)/e,o=i*(1-Math.max(0,Math.min(.9,r)));return{step:i,bandwidth:o,start:s=>n+s*i+(i-o)/2,center:s=>n+(s+.5)*i}}var pt=e=>Number(e.toPrecision(12)),f=e=>Number(e.toFixed(2)),N=e=>typeof e=="number"&&Number.isFinite(e);function we(e){let n=1/0,t=-1/0;for(let r of e)N(r)&&(r<n&&(n=r),r>t&&(t=r));return n===1/0?[0,0]:[n,t]}var te=1e3,ne=60*te,re=60*ne,le=24*re,dn=[te,5*te,15*te,30*te,ne,5*ne,15*ne,30*ne,re,3*re,6*re,12*re,le,2*le,7*le,14*le];function ft(e,n){let t=Math.floor(Math.log10(e)),r=Math.ceil(Math.log10(n)),i=r-t<=1?[1,2,5]:[1],o=[];for(let s=t;s<=r;s++)for(let a of i)o.push(pt(a*10**s));return o.filter(s=>s>=e/1.0001&&s<=n*1.0001)}var Wt=/-?\d*\.?\d+(?:e[-+]?\d+)?/gi,Et=/([MLTHVCSQAZmlthvcsqaz])([^MLTHVCSQAZmlthvcsqaz]*)/g,Ut={M:2,L:2,T:2,C:6,S:4,Q:4,A:7,H:-1,V:-2};function Kt(e,n,t){return e.replace(Et,(r,i,o)=>{let s=Ut[i];if(s===void 0)return i+o;let l=(o.match(Wt)??[]).map((u,d)=>{let p=Number(u);if(s===-1)return String(p+n);if(s===-2)return String(p+t);let y=d%s;return s===7?y===5?String(p+n):y===6?String(p+t):u:String(y%2===0?p+n:p+t)});return i+l.join(" ")})}var mt=(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:Kt(r.d,n,t)}}});var ke=["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)"))),M={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)"},Me=(e="neutral")=>e==="neutral"?M.axis:`var(--skdx-color-${e}-500)`;var gt=(e,n)=>n??ke[e%ke.length];var q={top:16,right:16,bottom:32,left:48};function bt(e,n,t=q){return{x:t.left,y:t.top,width:Math.max(0,e-t.left-t.right),height:Math.max(0,n-t.top-t.bottom)}}function ie(e){let n=e.legend;if(n)return n===!0?{}:n.enabled===!1?void 0:n}function xt(e){let n=e.tooltip;return n===void 0||n===!0?{enabled:!0}:n===!1?{enabled:!1}:{...n,enabled:n.enabled??!0}}var de=20,Yt=120,yt=e=>{let n=ie(e);return n&&(n.position==="left"||n.position==="right")?n.width??Yt:0},he=(e,n=600,t=300)=>({width:(e.width??n)-yt(e),height:(e.height??t)-(ie(e)?.position==="bottom"?de:0)}),vt=(e,n,t)=>{let r=ie(e);return!r||!(r.position===void 0||r.position==="top")?0:(n?Math.max(1,Mt(n,t??he(e).width,r)):1)*de},G=6.5,wt=(e,n,t)=>t??(e.palette&&e.palette.length>0?e.palette[n%e.palette.length]:gt(n)),kt=(e,n)=>e.hiddenSeries?.includes(n)??!1;function $e(e,n,t=[],r={},i=10,o=8,s=!1){let a=[],l=r.maxItems,u=l!==void 0&&l>=0&&e.length>l?e.slice(0,l):e,d=e.length-u.length,p=r.interactive??!0,y=o,w=i,k=(c,g,b,$)=>{let I=(g?18:4)+c.length*G;y>o&&(s||y+I>n-8)&&(y=o,w+=de),g&&a.push({kind:"rect",part:"legend-swatch",x:y,y:w-5,width:10,height:10,fill:g,opacity:$?.3:void 0,item:b}),a.push({kind:"text",part:"legend-label",x:y+(g?14:0),y:w,text:c,baseline:"middle",fill:$?M.grid:M.label,item:b}),y+=I+12};for(let c of u){let g=t.includes(c.name),b=p?{label:c.name,series:c.name,legend:!0}:void 0;k(r.formatter?.(c.name)??c.name,c.color,b,g)}return d>0&&k(`+${d} more`,void 0,void 0,!1),r.align==="end"?qt(a,n):a}function qt(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*G)),s=n-8-o;for(let a of i)r.push({...a,x:a.x+s})}return r}var Mt=(e,n,t={})=>new Set($e(e,n,[],t).flatMap(r=>r.kind==="text"?[r.y]:[])).size;function Ce(e,n,t,r=[]){let i=ie(e),o=i&&e.direction==="rtl"&&i.align===void 0?{...i,align:"end"}:i,s=xt(e),a=o?.position==="bottom",l=yt(e),u=e.hiddenSeries??[],d=o?l?$e(r,1/0,u,o,10,(o.position==="right"?n:0)+8,!0):$e(r,n,u,o,a?t+10:10):[],p=a?Mt(r,n,o):0;return{width:n+l,height:a?t+Math.max(1,p)*de:t,legendOffset:o?.position==="left"?l:void 0,tooltip:s.enabled,tooltipFormatter:s.formatter,axisTooltipFormatter:s.axisFormatter,tooltipPortal:s.portal,tooltipPlacement:s.placement,tooltipAnchored:s.followPointer===!1?!0:void 0,description:e.description,decorative:e.decorative,animate:e.animate===!0?300:e.animate||void 0,responsive:!!e.responsive,shapes:d}}function Se(e){let n=e.legendOffset;if(!n)return e;let t=[...mt(e.shapes.filter(l=>!l.part.startsWith("legend-")),n,0),...e.shapes.filter(l=>l.part.startsWith("legend-"))],r=l=>({...l,x:l.x+n}),i=e.hit?{...e.hit,plot:r(e.hit.plot),xs:e.hit.xs.map(l=>l+n),brush:e.hit.brush?{box:r(e.hit.brush.box),window:r(e.hit.brush.window)}:void 0}:void 0,o=e.edit,s=o?{...o,scale:l=>o.scale(l)+n,invert:l=>o.invert(l-n),bars:o.bars.map(l=>({...l,x0:l.x0+n,x1:l.x1+n}))}:void 0,a=e.map?{...e.map,plot:r(e.map.plot)}:void 0;return{...e,shapes:t,hit:i,edit:s,map:a,legendOffset:void 0}}function pe(e,n,t,r,i,o="auto"){let s=Array.isArray(t)?t:[t],a=Math.max(...s.map(y=>y.length))*G+12,l=6+s.length*16,u=o==="top"?{x:e-a/2,y:n-l-8}:o==="bottom"?{x:e-a/2,y:n+8}:o==="left"?{x:e-a-8,y:n-l/2}:o==="right"?{x:e+8,y:n-l/2}:{x:e+12,y:n-l-6},d=Math.max(0,Math.min(r-a,u.x)),p=Math.max(0,Math.min(i-l,u.y));return[{kind:"rect",part:"tooltip",x:f(d),y:f(p),width:f(a),height:l,fill:"var(--skdx-color-surface-raised)",stroke:M.axis,rx:3},...s.map((y,w)=>({kind:"text",part:"tooltip-label",x:f(d+6),y:f(p+11+w*16),text:y,baseline:"middle",fill:"var(--skdx-color-text-default)",weight:s.length>1&&w===0?"bold":void 0}))]}function $t([e,n],t,r=!1,i){let o=typeof r=="boolean"?{scale:r?"log":"linear"}:r,s=X(o.format??i),a=o.min??e,l=o.max??n;o.reversed&&(t=[t[1],t[0]]);let u={id:o.id,position:o.position,options:o};if(o.scale==="sqrt"){let c=T=>Math.sign(T)*Math.sqrt(Math.abs(T)),g=o.nice===!1?[a,l]:ue(a,l,o.ticks),b=o.min??g[0],$=o.max??g[g.length-1],I=ce([c(b),c($)],t),A=T=>I(c(T)),x=ue(b,$,o.ticks).filter(T=>T>=b-1e-9&&T<=$+1e-9);return{...u,scale:A,domain:[b,$],format:s,ticks:(x.length>=2?x:[b,$]).map(T=>({pos:f(A(T)),label:s(T)})),zero:f(A(Math.min(Math.max(0,b),$)))}}if(o.scale==="log"){let c=Math.max(a,Number.EPSILON),g=Math.max(l,c),b=ft(c,g),$=[Math.log10(c),Math.log10(g)],I=ce($,t),A=x=>I(Math.log10(Math.max(x,Number.EPSILON)));return{...u,scale:A,domain:$,format:s,ticks:b.map(x=>({pos:f(A(x)),label:s(x)})),zero:f(t[0])}}let d=ue(a,l,o.ticks),p=[o.min??(o.nice===!1?a:d[0]),o.max??(o.nice===!1?l:d[d.length-1])],y=ce(p,t),w=d.filter(c=>c>=p[0]-1e-9&&c<=p[1]+1e-9),k=(w.length>=2?w:[p[0],p[1]]).map(c=>({pos:f(y(c)),label:s(c)}));return{...u,scale:y,domain:p,format:s,ticks:k,zero:f(y(Math.min(Math.max(0,p[0]),p[1])))}}function Ie(e,n){if(e.length<2)return e;let t=e.reduce((i,o)=>Math.max(i,o.label.length),0)*G+8,r=Math.max(1,Math.ceil(e.length*t/Math.max(1,n)));return r===1?e:e.filter((i,o)=>o%r===0)}function fe(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}=he(e,t,r),a=i==="error"?e.error:i==="loading"?"Loading\u2026":e.emptyMessage??"No data available",l=[];return i==="loading"&&l.push({kind:"rect",part:"skeleton",x:0,y:0,width:o,height:s,fill:"var(--skdx-color-surface-sunken)",rx:4}),l.push({kind:"text",part:`state-${i}`,x:f(o/2),y:f(s/2),text:a,anchor:"middle",baseline:"middle",fill:i==="error"?"var(--skdx-color-text-danger)":M.label}),{...Ce(e,o,s),shapes:l,tooltip:!1}}var Ct=(e,n,t)=>{let r=n.length*G/2;return e+r>t?"end":e-r<0?"start":"middle"};function St(e,n={}){let{plot:t,xTicks:r,yTicks:i,baseline:o}=e,s=t.x+t.width,a=t.y+t.height,l=[],u=n.grid??!0,d=(k,c)=>c?{kind:"line",part:"grid",x1:k.pos,x2:k.pos,y1:t.y,y2:a,stroke:M.grid}:{kind:"line",part:"grid",x1:t.x,x2:s,y1:k.pos,y2:k.pos,stroke:M.grid},p=n.x?.tickRotation??0,y=(k,c,g,b)=>p?L(k,c,g,{part:b,anchor:p<0?"end":"start",baseline:"middle",rotate:p}):L(k,c,g,{part:b,anchor:Ct(k,g,e.width)}),w=(k,c,g,b,$)=>{for(let I of k)l.push(c==="x"?{kind:"line",part:"tick",x1:I.pos,x2:I.pos,y1:g,y2:f(g+b*$),stroke:M.axis}:{kind:"line",part:"tick",x1:g,x2:f(g+b*$),y1:I.pos,y2:I.pos,stroke:M.axis})};if(n.categoryGrid)for(let k of r)l.push(d(k,!n.horizontal));if(n.horizontal){let k=n.axes??[{ticks:i,position:"bottom",offset:0,label:n.yLabel,...n.y}];if(u)for(let c of i)l.push(d(c,!0));k[0]?.showLine!==!1&&l.push({kind:"line",part:"axis",x1:o,x2:o,y1:t.y,y2:a,stroke:M.axis});for(let c of k){let g=c.position==="top"||c.position==="right",b=f(g?t.y-c.offset:a+c.offset),$=g||c.offset>0;c.showLine&&$&&l.push({kind:"line",part:"axis",x1:t.x,x2:s,y1:b,y2:b,stroke:M.axis}),c.showTicks&&w(c.ticks,"x",b,g?-1:1,c.tickSize??4);let I=f(g?b-8:b+20);for(let A of c.ticks)l.push(g?L(A.pos,I,A.label,{part:"x-label-top",anchor:Ct(A.pos,A.label,e.width)}):y(A.pos,I,A.label,"x-label"));c.label&&l.push($?L(4,I,c.label,{part:"axis-title",anchor:"start",baseline:g?void 0:"middle"}):L(4,t.y-6,c.label,{part:"axis-title",anchor:"start"}))}n.x?.showLine&&l.push({kind:"line",part:"axis",x1:n.rtl?s:t.x,x2:n.rtl?s:t.x,y1:t.y,y2:a,stroke:M.axis}),n.x?.showTicks&&w(r,"y",n.rtl?s:t.x,n.rtl?1:-1,n.x.tickSize??4);for(let c of r)l.push(n.rtl?L(s+8,c.pos,c.label,{part:"y-label",anchor:"start",baseline:"middle"}):L(t.x-8,c.pos,c.label,{part:"y-label",anchor:"end",baseline:"middle"}))}else{if(u)for(let c of i)l.push(d(c,!1));n.y?.showLine!==!1&&l.push({kind:"line",part:"axis",x1:t.x,x2:s,y1:o,y2:o,stroke:M.axis});let k=n.axes??[{ticks:i,position:"left",offset:0,label:n.yLabel,...n.y},...n.rightTicks?[{ticks:n.rightTicks,position:"right",offset:0,label:n.rightLabel}]:[]];for(let c of k){let g=c.position==="left",b=g?t.x-c.offset:s+c.offset,$=g?"y-label":"y-label-right";c.showLine&&l.push({kind:"line",part:"axis",x1:f(b),x2:f(b),y1:t.y,y2:a,stroke:M.axis}),c.showTicks&&w(c.ticks,"y",f(b),g?-1:1,c.tickSize??4);for(let I of c.ticks)l.push(L(f(g?b-8:b+8),I.pos,I.label,{part:$,anchor:g?"end":"start",baseline:"middle"}));c.label&&l.push(L(f(g?c.offset===0?4:Math.max(4,b-40):c.offset===0?e.width-4:Math.min(e.width-4,b+40)),t.y-6,c.label,{part:"axis-title",anchor:g?"start":"end"}))}n.x?.showTicks&&w(r,"x",a,1,n.x.tickSize??4);for(let c of r)l.push(y(c.pos,a+(p?12:20),c.label,"x-label"))}return n.xLabel&&l.push(L(f(t.x+t.width/2),e.height-4,n.xLabel,{part:"axis-title",anchor:"middle"})),n.horizontal&&n.rightLabel&&l.push(L(e.width-4,t.y-6,n.rightLabel,{part:"axis-title",anchor:"end"})),l}var L=(e,n,t,r={})=>({kind:"text",part:"label",x:e,y:n,text:t,fill:M.label,...r});function me(e){return e==null?[]:(Array.isArray(e)?e:[e]).map(t=>typeof t=="object"?t:{id:t})}var Te=e=>e.id??e.name??e.series,It=e=>e.seriesId??e.series;function j(e,n){let t=!1;return n.id!==void 0&&(t=!0,Te(e)!==n.id&&e.id!==n.id&&e.name!==n.id)||n.series!==void 0&&(t=!0,It(e)!==n.series&&e.series!==n.series)||n.index!==void 0&&(t=!0,e.index!==n.index)||n.category!==void 0&&(t=!0,e.category!==n.category)?!1:t}function _(e){let n={},t=Te(e);t!==void 0&&(n.id=t);let r=It(e);return r!==void 0&&e.series!==void 0&&(n.series=r),e.index!==void 0&&(n.index=e.index),n}var ze=(e,n)=>e.id===n.id&&e.series===n.series&&e.index===n.index&&e.category===n.category;function Oe(e,n,t){let r=me(e),i=_(n),o=r.some(s=>j(n,s));return t==="single"?o?[]:[i]:o?r.filter(s=>!j(n,s)):[...r,i]}var Xt=.2;function Qt(e){let n=M.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 Jt=(e,n)=>e.kind==="text"?{...e,fill:M.grid}:{...e,opacity:(e.opacity??1)*n};function Ae(e,n){let t=me(n.selected),r=n.highlighted===void 0||n.highlighted===null?[]:me(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=d=>!i||r.some(p=>j(d,p))?!0:o.highlighted==="series"?r.some(p=>p.series!==void 0&&j(d,{series:p.series})):!1,l=d=>{if(!i||o.faded==="none"||a(d))return!1;if(o.faded==="series"){let p=i.series;return p!==void 0&&j(d,{series:p})}return!0},u=e.shapes.map(d=>{let p=d.item;if(!p||p.legend)return d;if(t.some(y=>j(p,y))){let y=Qt(d);y&&s.push(y)}return l(p)?Jt(d,Xt):d});return s.length?{...e,shapes:[...u,...s]}:{...e,shapes:u}}function en(e,n){let t=[],r=n;for(let i of e??[]){let o=typeof i=="number"?{from:r,to:i}:i;N(o.to)&&(t.push(o),r=o.to)}return t}function Tt(e){let n=e.data.filter(x=>N(x.value)),t=fe(e,n.length===0,600,40+44*Math.max(1,e.data.length));if(t)return t;let r=X(e.format),i=e.orientation==="vertical",{width:o,height:s}=he(e,600,i?300:40+44*n.length),a=x=>x.ranges??e.ranges,l=n.flatMap(x=>[x.value,x.target,...(a(x)??[]).map(T=>typeof T=="number"?T:T.to)]),[u,d]=we(l),p=e.min??Math.min(0,u),y=Math.max(0,...n.map(x=>x.name.length))*G,w=bt(o,s,{top:q.top+vt(e),right:e.labels&&!i?56:q.right,bottom:q.bottom,left:i?q.left:Math.max(q.left,y+16)}),k=i?[w.y+w.height,w.y]:[w.x,w.x+w.width],c=$t([p,Math.max(p,d)],k,{min:p,max:e.max,ticks:e.ticks},e.format),g=ht(n.length,i?[w.x,w.x+w.width]:[w.y,w.y+w.height],.3),b=Ce(e,o,s),$=n.map((x,T)=>({pos:f(g.center(T)),label:x.name})),I=St({...b,plot:w,xTicks:i?Ie($,w.width):$,yTicks:i?c.ticks:Ie(c.ticks,w.width),baseline:c.zero},{horizontal:!i}),A=(x,T,B,P,U)=>{let K=c.scale(x),Z=c.scale(T),Y=Math.max(1,Math.abs(Z-K));return i?{kind:"rect",x:f(B-P/2),y:f(Math.min(K,Z)),width:f(P),height:f(Y),...U}:{kind:"rect",x:f(Math.min(K,Z)),y:f(B-P/2),width:f(Y),height:f(P),...U}};return n.forEach((x,T)=>{if(kt(e,x.name))return;let B=g.center(T),P=g.bandwidth,U=en(a(x),p);U.forEach((z,ut)=>{let Gt=`${x.name} ${z.label??`range ${ut+1}`}: ${r(z.from)} \u2013 ${r(z.to)}`;I.push(A(z.from,z.to,B,P,{part:"range",fill:z.color??(z.variant?Me(z.variant):M.axis),opacity:z.variant||z.color?.25:Math.max(.1,.4-ut*.1),title:Gt}))});let K=N(x.target)?` \xB7 target ${r(x.target)}`:"",Z=U.find(z=>x.value>=z.from&&x.value<=z.to),Y=`${x.name}: ${r(x.value)}${K}${Z?.label?` (${Z.label})`:""}`;if(I.push(A(Math.min(p,x.value),x.value,B,P/3,{part:"measure",fill:wt(e,T,x.color),title:Y,item:{label:Y,id:x.id,name:x.name,index:T,value:x.value}})),N(x.target)){let z=f(c.scale(x.target));I.push({kind:"line",part:"target",x1:i?f(B-P/2.5):z,x2:i?f(B+P/2.5):z,y1:i?z:f(B-P/2.5),y2:i?z:f(B+P/2.5),stroke:"var(--skdx-color-text-default)",strokeWidth:3,title:`${x.name} target: ${r(x.target)}`})}if(e.labels){let z=c.scale(N(x.target)?Math.max(x.value,x.target):x.value);I.push(i?L(f(B),f(z-6),r(x.value),{part:"value-label",anchor:"middle"}):L(f(z+6),f(B),r(x.value),{part:"value-label",baseline:"middle"}))}}),{...b,shapes:[...I,...b.shapes]}}function ee(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 Le=(e,n,t)=>n>=e.x&&n<=e.x+e.width&&t>=e.y&&t<=e.y+e.height;function zt(e,n){let t=0,r=1/0;return e.xs.forEach((i,o)=>{let s=Math.abs(i-n);s<r&&(r=s,t=o)}),t}function oe(e,n){let t=e.hit;if(!t||t.xs.length===0)return;let r=zt(t,n),i=t.rows[r]??[];return{index:r,rows:e.axisTooltipFormatter?.(i,r)??i}}function Be(e,n){let t=e.hit;if(!t||t.xs.length===0)return;let r=t.xs[zt(t,n)];return{kind:"line",part:"crosshair",x1:r,x2:r,y1:t.plot.y,y2:t.plot.y+t.plot.height,stroke:M.axis,dash:"3 3"}}function Pe(e,n,t){let r=e.hit;if(!r||!r.crosshair||r.xs.length===0||!Le(r.plot,n,t))return[];let i=Be(e,n),{rows:o}=oe(e,n),s=e.tooltipAnchored?r.plot.y+8:t;return[i,...pe(i.x1,s,o,e.width,e.height,e.tooltipPlacement)]}function Re(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 Pe(e,i,t.plot.y+8)}function Ne(e,n,t,r,i){if(!e.tooltip)return{lines:[],shapes:[]};if(e.hit?.crosshair){let{x:l,y:u}=ee(t,r,i,e.width,e.height);if(Le(e.hit.plot,l,u)){let d=oe(e,l),p=Be(e,l);if(d&&p)return{lines:d.rows,shapes:[p]}}}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(l=>l.tagName.toLowerCase()==="title")?.textContent;return a?{lines:Array.isArray(a)?a:[a],shapes:[]}:{lines:[],shapes:[]}}function Ot(e,n,t,r,i,o,s){let a=e?.closest?.("[data-skdx-part]"),l=s&&s.tooltipFormatter?W(s,e)?.item:void 0,u=l&&s?.tooltipFormatter?.(l)||a&&Array.from(a.children).find(k=>k.tagName.toLowerCase()==="title")?.textContent;if(!u)return[];let d=s?.tooltipAnchored?W(s,e):void 0,p=d?s?.shapes[d.index]:void 0,{x:y,y:w}=p?se(p):ee(n,t,r,i,o);return pe(y,w,u,i,o,s?.tooltipPlacement)}function De(e,n,t,r,i){if(!e.tooltip)return[];if(e.hit?.crosshair){let{x:o,y:s}=ee(t,r,i,e.width,e.height),a=Pe(e,o,s);if(a.length>0)return a}return Ot(n,t,r,i,e.width,e.height,e)}function Fe(e,n){let t=W(e,n);return t&&!t.item.legend?_(t.item):null}var tn=(e,n)=>{let{x:t,y:r}=se(e),i=e.kind==="circle"?e.cy:e.kind==="rect"?e.y+e.height/2:r;return t>=n.x&&t<=n.x+n.width&&i>=n.y&&i<=n.y+n.height};function Ge(e,n){let t=new Set,r=[];for(let i of e.shapes){if(!i.item||i.item.legend||i.part==="anchor"||!tn(i,n))continue;let o=_(i.item),s=JSON.stringify(o);t.has(s)||(t.add(s),r.push(o))}return r}var je=e=>({kind:"rect",part:"selection-box",x:f(e.x),y:f(e.y),width:f(e.width),height:f(e.height),fill:M.focus,opacity:.12,stroke:M.focus}),be=(e,n,t,r)=>({x:Math.min(e,t),y:Math.min(n,r),width:Math.abs(t-e),height:Math.abs(r-n)});function At(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 He(e,n){if(n.length<3)return[];let t=new Set,r=[];for(let i of e.shapes){if(!i.item||i.item.legend||i.part==="anchor")continue;let{x:o,y:s}=se(i),a=i.kind==="circle"?i.cy:i.kind==="rect"?i.y+i.height/2:s;if(!At(n,o,a))continue;let l=_(i.item),u=JSON.stringify(l);t.has(u)||(t.add(u),r.push(l))}return r}var Ve=e=>({kind:"path",part:"selection-lasso",d:e.length?`M${e.map(n=>`${f(n.x)} ${f(n.y)}`).join("L")}`:"",fill:M.focus,fillOpacity:.12,stroke:M.focus,dash:"4 3"}),ge=6;function Ze(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-ge||n>i.x1+ge))return Math.abs(n-i.x0)<=ge?{bar:i,mode:"start"}:Math.abs(n-i.x1)<=ge?{bar:i,mode:"end"}:{bar:i,mode:"move"}}}function _e(e,n,t){let r=e.edit;return Lt(r,n,r.invert(n.bar.x0+t)-r.invert(n.bar.x0))}function We(e,n,t){let r=e.edit,i=t.key==="ArrowRight"?1:t.key==="ArrowLeft"?-1:0;if(!r||n===null||!i||!(t.shiftKey||t.altKey))return;let o=r.bars.find(l=>l.index===n);if(!o)return;let s=t.altKey?t.shiftKey?"start":"end":"move",a=r.snap??r.invert(o.x0+10)-r.invert(o.x0);return Lt(r,{bar:o,mode:s},i*a)}function Lt(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 Ee(e,n,t){let r=e.edit,i=r.scale(t.start),o=r.scale(t.end);return{kind:"rect",part:"edit-ghost",x:f(Math.min(i,o)),y:f(n.bar.y),width:f(Math.max(1,Math.abs(o-i))),height:f(n.bar.height),fill:M.focus,opacity:.25,stroke:M.focus,rx:2}}var nn=64,rn=e=>Math.max(1,Math.min(nn,e));function Ue(e,n,t,r){let i=n>0?.8:1.25,o=rn(e.view.zoom*i);if(o===e.view.zoom)return e.view;let{plot:s,scale:a}=e,[l,u]=e.view.center,d=(t-(s.x+s.width/2))/a,p=(r-(s.y+s.height/2))/a,y=e.view.zoom/o;return{center:[l+d*(1-y),e.fromY(e.toY(u)-p*(1-y))],zoom:o}}function Ke(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 xe=e=>e.shapes.flatMap((n,t)=>n.item&&!n.item.legend?[t]:[]);function se(e){switch(e.kind){case"rect":return{x:e.x+e.width/2,y:e.y};case"circle":return{x:e.cx,y:e.cy-e.r};case"line":return{x:(e.x1+e.x2)/2,y:Math.min(e.y1,e.y2)};case"text":return{x:e.x,y:e.y};case"path":{let n=/M\s*(-?[\d.]+)[ ,](-?[\d.]+)/.exec(e.d);return n?{x:Number(n[1]),y:Number(n[2])}:{x:0,y:0}}}}function Ye(e,n){let t=n===null?void 0:e.shapes[n];if(!t)return[];let r=M.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*G+4,height:16,fill:"none",stroke:r,rx:2};break;case"path":i={kind:"path",part:"focus",d:t.d,stroke:r,strokeWidth:2,fill:"none"};break}let{x:o,y:s}=se(t),a=t.item&&e.tooltipFormatter?.(t.item)||(t.item?.label??t.title??"");return[i,...a?pe(f(o),f(s),a,e.width,e.height):[]]}function qe(e,n,t){let r=xe(e);if(r.length===0)return;let i=n===null?-1:r.indexOf(n);switch(t){case"ArrowRight":case"ArrowDown":return r[Math.min(r.length-1,i+1)];case"ArrowLeft":case"ArrowUp":return r[Math.max(0,i<=0?0:i-1)];case"Home":return r[0];case"End":return r[r.length-1];case"Escape":return null;default:return}}var Q=2,J=(e,n,t)=>{let r=Math.max(Q,Math.min(t,Math.round(n))),i=Math.max(0,Math.min(t-r,Math.round(e)));return{start:i,end:i+r}},Bt=(e,n)=>!e||e.start<=0&&e.end>=n;function Xe(e,n,t){if(e.count<=Q||!e.plot.width)return;let{start:r,end:i}=e.zoom,o=i-r,s=n>0?1.25:.8,a=Math.max(Q,Math.min(e.count,Math.round(o*s)));if(a===o)return n>0&&!Bt(e.zoom,e.count)?J(r,a,e.count):void 0;let l=Math.max(0,Math.min(1,(t-e.plot.x)/e.plot.width)),u=r+l*o;return J(u-l*a,a,e.count)}function Qe(e,n,t,r){let i=n.end-n.start,o=Math.max(Q,Math.min(e.count,Math.round(i/Math.max(.05,t)))),s=Math.max(0,Math.min(1,(r-e.plot.x)/Math.max(1,e.plot.width)));return J(n.start+s*i-s*o,o,e.count)}function Je(e,n,t){let r=n.end-n.start,i=e.plot.width/Math.max(1,r);return J(n.start-t/i,r,e.count)}function et(e,n,t){let r=e.brush;if(!r||!Le(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:J(s-o/2,o,e.count)}}function tt(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 J(t.start+o,t.end-t.start,e.count);if(n==="left")return{start:Math.max(0,Math.min(t.end-Q,Math.round(t.start+o))),end:t.end};let s=Math.min(e.count,Math.max(t.start+Q,Math.round(t.end+o)));return{start:t.start,end:s}}function rt(e,n){switch(n.type){case"svg":return Promise.resolve(nt(e,n.label,n.resolve));case"csv":return Promise.resolve(Dt(n.rows));case"png":{if(typeof document>"u"||typeof Image>"u")return Promise.reject(new Error("PNG export needs a browser"));let t=nt(e,n.label,n.resolve);return Nt(t,e.width,e.height,n.scale,n.background)}}}var H=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/"/g,"&quot;"),ae=e=>e.filter(([,n])=>n!==void 0&&n!=="").map(([n,t])=>` ${n}="${H(String(t))}"`).join("");function Pt(e){let n=e.title?`<title>${H(e.title)}</title>`:"",t=["data-skdx-part",e.part];switch(e.kind){case"path":return`<path${ae([t,["d",e.d],["fill",e.fill??"none"],["stroke",e.stroke],["stroke-width",e.strokeWidth],["stroke-linecap",e.strokeLinecap],["stroke-linejoin",e.strokeLinejoin],["stroke-dasharray",e.dash],["opacity",e.opacity],["fill-opacity",e.fillOpacity]])}>${n}</path>`;case"rect":return`<rect${ae([t,["x",e.x],["y",e.y],["width",e.width],["height",e.height],["rx",e.rx],["fill",e.fill],["stroke",e.stroke],["fill-opacity",e.opacity]])}>${n}</rect>`;case"line":return`<line${ae([t,["x1",e.x1],["y1",e.y1],["x2",e.x2],["y2",e.y2],["stroke",e.stroke],["stroke-width",e.strokeWidth],["stroke-dasharray",e.dash],["opacity",e.opacity]])}>${n}</line>`;case"circle":return`<circle${ae([t,["cx",e.cx],["cy",e.cy],["r",e.r],["fill",e.fill],["stroke",e.stroke]])}>${n}</circle>`;case"text":return`<text${ae([t,["x",e.x],["y",e.y],["text-anchor",e.anchor],["dominant-baseline",e.baseline],["fill",e.fill],["font-weight",e.weight],["transform",e.rotate?`rotate(${e.rotate} ${e.x} ${e.y})`:void 0]])}>${H(e.text)}</text>`}}function Rt(e){let n=e.defs??[];return n.length===0?"":`<defs>${n.map(t=>`<linearGradient id="${H(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="${H(r.color)}"${r.opacity===void 0?"":` stop-opacity="${r.opacity}"`}/>`).join("")}</linearGradient>`).join("")}</defs>`}function nt(e,n,t){let r=Rt(e)+e.shapes.map(Pt).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="${H(n)}" font-family="${H(M.fontFamily)}" font-size="${H(M.fontSize)}"><title>${H(n)}</title>${r}</svg>`}function Nt(e,n,t,r=2,i){return new Promise((o,s)=>{let a=URL.createObjectURL(new Blob([e],{type:"image/svg+xml;charset=utf-8"})),l=new Image;l.onload=()=>{URL.revokeObjectURL(a);let u=document.createElement("canvas");u.width=Math.round(n*r),u.height=Math.round(t*r);let d=u.getContext("2d");if(!d)return s(new Error("canvas 2d context unavailable"));i&&(d.fillStyle=i,d.fillRect(0,0,u.width,u.height)),d.drawImage(l,0,0,u.width,u.height),u.toBlob(p=>p?o(p):s(new Error("toBlob failed")),"image/png")},l.onerror=()=>{URL.revokeObjectURL(a),s(new Error("svg could not be decoded"))},l.src=a})}function Dt(e){let n=t=>{let r=t==null?"":String(t);return/[",\n\r]/.test(r)?`"${r.replace(/"/g,'""')}"`:r};return e.map(t=>t.map(n).join(",")).join(`\r
2
+ `)}function it(e,n){if(!n)return;let t=typeof n=="object"?n.maxRows??500:500,r=e.hit;if(r&&r.rows.length>0){let a=r.rows[0];if(r.rows.length>t)return;let l=["",...a.slice(1).map(d=>d.replace(/:\s[^:]*$/,""))],u=r.rows.map(d=>[d[0],...d.slice(1).map(p=>p.slice(p.lastIndexOf(": ")+2))]);return[l,...u]}let i=e.shapes.flatMap(a=>a.item&&!a.item.legend&&!(a.part==="anchor"&&!a.title)?[a.item]:[]);if(i.length===0||i.length>t)return;let o=["series","name","category","value"].filter(a=>i.some(l=>l[a]!==void 0)),s=(a,l)=>a[l]===void 0?"":String(a[l]);return[o.map(a=>a[0]?.toUpperCase()+a.slice(1)),...i.map(a=>o.map(l=>s(a,l)))]}var ot=new Map;function ye(e){let n=ot.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&&ot.delete(e)}},publish(o,s){Object.assign(r,o);for(let a of t)a(o,s)}};return ot.set(e,{group:i,listeners:t}),i}var Ft='[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}}${Ft}{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){${Ft}{animation:none;transition:none}}`;function at(e){let n=e.animate;return n&&e.shapes.length<=1500?`${n}ms`:void 0}function lt(e){let n=e.orientation==="vertical",t=fe(e,!N(e.value),600,n?300:64);if(t)return t;let r=X(e.format),i=e.min??0,o=(e.bands??[]).filter(u=>N(u.from)&&N(u.to)),s=e.max??Math.max(100,e.value,e.target??-1/0,...o.map(u=>u.to)),a=N(e.target)?`, target ${r(e.target)}`:"";return{...Tt({...e,height:e.height??(n?300:64),data:[{id:"value",name:e.caption??"",value:e.value,target:e.target,ranges:o}],min:i,max:s,labels:e.labels??!0,ticks:e.ticks}),description:e.description??`${e.caption??"Value"} ${r(e.value)} on a scale from ${r(i)} to ${r(s)}${a}.`}}import{css as on,html as E,LitElement as sn,nothing as O,svg as D}from"lit";import{property as m,state as F}from"lit/decorators.js";import{ifDefined as S}from"lit/directives/if-defined.js";var ct={fromAttribute:()=>!1},v=class extends sn{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=[je(be(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=[Ve(i.points)];return}if(i?.grab==="edit"){if(!i.gantt)return;let{x:o}=this.viewBox(t,r);i.change=_e(r,i.gantt,o-i.x),this.overlay=[Ee(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(Ke(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(Qe(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"?Je(r.hit,i.zoom,o-i.x):tt(r.hit,i.grab,i.zoom,o-i.x));return}if(r.tooltipPortal){let{lines:o,shapes:s}=Ne(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=De(r,t.target,t.currentTarget,t.clientX,t.clientY);(o.length>0||this.tip.length>0)&&(this.tip=o)}if(this.highlight(Fe(r,t.target)),this.syncId&&r.hit?.crosshair){let o=oe(r,this.viewBox(t,r).x);this.shareCrosshair(o?r.hit.rows[o.index]?.[0]??null:null)}};this.onPointerDown=t=>{let r=this.layout;if(!r||t.button!==0)return;let{x:i,y:o}=this.viewBox(t,r),s=W(r,t.target)?.item.legend,a=this.canEdit(r)?Ze(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 u=r.map.plot;if(i<u.x||i>u.x+u.width||o<u.y||o>u.y+u.height)return;this.drag={x:i,y:o,zoom:{start:0,end:0},grab:"map",view:r.map.view},t.currentTarget.setPointerCapture(t.pointerId),this.clearTip();return}let l=r.hit;if(!(!l||!this.canZoom(r))){if(this.pointers.set(t.pointerId,i),this.pointers.size===2){let[u,d]=[...this.pointers.values()];this.drag={x:(u+d)/2,y:o,zoom:l.zoom,grab:"pinch",distance:Math.abs(u-d)||1}}else{let u=et(l,i,o);if(u)this.drag={x:i,y:o,zoom:u.zoom,grab:u.grab},u.zoom!==l.zoom&&this.setZoom(u.zoom);else if(this.zoomable&&i>=l.plot.x&&i<=l.plot.x+l.plot.width&&o>=l.plot.y&&o<=l.plot.y+l.plot.height)this.drag={x:i,y:o,zoom:l.zoom,grab:"pan"};else{this.pointers.delete(t.pointerId);return}}t.currentTarget.setPointerCapture(t.pointerId),this.clearTip()}};this.onPointerUp=t=>{this.pointers.delete(t.pointerId);let r=t.currentTarget;r.hasPointerCapture(t.pointerId)&&r.releasePointerCapture(t.pointerId);let i=this.drag,o=this.layout;if(o&&(i?.grab==="select"||i?.grab==="lasso"||i?.grab==="edit"||i?.grab==="map")){this.overlay=[];let{x:s,y:a}=this.viewBox(t,o);if(Math.abs(s-i.x)>2||Math.abs(a-i.y)>2){i.grab==="select"?this.setSelected(Ge(o,be(i.x,i.y,s,a))):i.grab==="lasso"?this.setSelected(He(o,i.points??[])):i.grab==="edit"&&i.change&&this.emit("skdx-task-change",i.change),this.drag={...i,distance:-1};return}this.drag=null;return}(this.pointers.size===0||this.drag?.grab==="pinch")&&(this.drag=null)};this.onWheel=t=>{let r=this.layout;if(!r)return;let{x:i,y:o}=this.viewBox(t,r);if(r.map&&this.canPan(r)){let l=r.map.plot;if(i<l.x||i>l.x+l.width||o<l.y||o>l.y+l.height)return;t.preventDefault(),this.setView(Ue(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=Xe(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=>{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)?We(r,this.focused,t):void 0;if(i){t.preventDefault(),this.emit("skdx-task-change",i);return}let o=qe(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?_(s):null)}}connectedCallback(){super.connectedCallback(),!(typeof ResizeObserver>"u")&&(this.observer=new ResizeObserver(([t])=>{let r=Math.floor(t?.contentRect.width??0);r>0&&(this.measured=r)}),this.observer.observe(this))}disconnectedCallback(){this.observer?.disconnect(),this.leave?.(),this.leave=void 0,this.joined=void 0,super.disconnectedCallback()}sized(){let{width:t,height:r,legend:i,tooltip:o,format:s,palette:a,loading:l,error:u,emptyMessage:d,description:p,decorative:y,animated:w,responsive:k,highlighted:c,highlightScope:g,accessibleTable:b}=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:w,responsive:k,legend:i,tooltip:o,format:s,palette:a,loading:l,error:u,emptyMessage:d,description:p,decorative:y,highlighted:c===void 0?this.highlightState:c,highlightScope:g,accessibleTable:b,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&&ye(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=ye(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&&ze(r,t)||(this.hover=t,this.emit("skdx-highlighted-change",t),this.syncId&&(this.highlightState=t,this.publish({highlighted:t})))}select(t){let r=this.selectionMode;r!=="none"&&this.setSelected(Oe(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 ee(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&&j(o.item,t));return i<0?!1:(this.getSvgElement()?.focus(),this.focused=i,!0)}export(t){let r=this.layout;return r?rt(r,{...t,label:t.label??this.label??this.localName}):Promise.reject(new Error("not rendered yet"))}root(t,r,i){this.join();let o=Ae(Se(t),this.sized());if(this.layout=o,o.issues!==this.reported){this.reported=o.issues;for(let b of o.issues??[])this.emit("skdx-data-issue",b)}let s=this.canZoom(o),a=this.canPan(o),l=this.canEdit(o),u=this.brushing(),d=s||a||l||u,p=!o.decorative&&xe(o).length>0,y=o.description?`${r}-desc`:void 0,w=at(o),k=it(o,this.accessibleTable),c=typeof this.accessibleTable=="object"&&this.accessibleTable.caption||i,g=this.portal;return E`<svg
3
3
  xmlns="http://www.w3.org/2000/svg"
4
4
  viewBox="0 0 ${o.width} ${o.height}"
5
5
  width=${o.width}
@@ -14,8 +14,8 @@ var Ft=Object.defineProperty;var Gt=Object.getOwnPropertyDescriptor;var h=(e,n,t
14
14
  data-brushing=${u&&!(s||a)?"":O}
15
15
  data-editable=${l?"":O}
16
16
  style=${w?`--skdx-chart-duration:${w}`:O}
17
- font-family=${k.fontFamily}
18
- font-size=${k.fontSize}
17
+ font-family=${M.fontFamily}
18
+ font-size=${M.fontSize}
19
19
  @pointermove=${o.tooltip||d?this.onPointerMove:O}
20
20
  @pointerleave=${()=>{this.clearTip(),this.highlight(null)}}
21
21
  @pointerdown=${d?this.onPointerDown:O}
@@ -29,10 +29,10 @@ var Ft=Object.defineProperty;var Gt=Object.getOwnPropertyDescriptor;var h=(e,n,t
29
29
  >
30
30
  <title>${i}</title>
31
31
  ${o.description?D`<desc id=${S(y)}>${o.description}</desc>`:O}
32
- ${w?D`<style>${st}</style>`:O} ${sn(o)}
33
- ${ye(o.shapes)}
34
- ${ye(this.tip.length||!this.crossState?this.tip:Re(o,this.crossState))}
35
- ${ye(Ye(o,this.focused))} ${ye(this.overlay)}
32
+ ${w?D`<style>${st}</style>`:O} ${an(o)}
33
+ ${ve(o.shapes)}
34
+ ${ve(this.tip.length||!this.crossState?this.tip:Re(o,this.crossState))}
35
+ ${ve(Ye(o,this.focused))} ${ve(this.overlay)}
36
36
  </svg>
37
37
  ${g?E`<div
38
38
  role="tooltip"
@@ -41,21 +41,21 @@ var Ft=Object.defineProperty;var Gt=Object.getOwnPropertyDescriptor;var h=(e,n,t
41
41
  >
42
42
  ${g.lines.map(b=>E`<div>${b}</div>`)}
43
43
  </div>`:O}
44
- ${M?E`<table data-skdx-table=${r}>
44
+ ${k?E`<table data-skdx-table=${r}>
45
45
  <caption>
46
46
  ${c}
47
47
  </caption>
48
48
  <thead>
49
49
  <tr>
50
- ${(M[0]??[]).map(b=>E`<th scope="col">${b}</th>`)}
50
+ ${(k[0]??[]).map(b=>E`<th scope="col">${b}</th>`)}
51
51
  </tr>
52
52
  </thead>
53
53
  <tbody>
54
- ${M.slice(1).map(b=>E`<tr>
54
+ ${k.slice(1).map(b=>E`<tr>
55
55
  ${b.map(($,I)=>I===0?E`<th scope="row">${$}</th>`:E`<td>${$}</td>`)}
56
56
  </tr>`)}
57
57
  </tbody>
58
- </table>`:O}`}};v.styles=rn`
58
+ </table>`:O}`}};v.styles=on`
59
59
  :host {
60
60
  display: inline-block;
61
61
  }
@@ -106,4 +106,4 @@ var Ft=Object.defineProperty;var Gt=Object.getOwnPropertyDescriptor;var h=(e,n,t
106
106
  [role='tooltip'] > :first-child:not(:only-child) {
107
107
  font-weight: bold;
108
108
  }
109
- `,h([m({type:Number})],v.prototype,"width",2),h([m({type:Number})],v.prototype,"height",2),h([m()],v.prototype,"label",2),h([m({type:Boolean,reflect:!0})],v.prototype,"legend",2),h([m({type:Boolean,attribute:"no-tooltip",converter:ct})],v.prototype,"tooltip",2),h([m({attribute:!1})],v.prototype,"format",2),h([m({attribute:!1})],v.prototype,"palette",2),h([m({attribute:!1})],v.prototype,"hiddenSeries",2),h([m({attribute:!1})],v.prototype,"selected",2),h([m({attribute:"selection-mode"})],v.prototype,"selectionMode",2),h([m({attribute:!1})],v.prototype,"highlighted",2),h([m({attribute:!1})],v.prototype,"highlightScope",2),h([m({type:Boolean,reflect:!0})],v.prototype,"loading",2),h([m()],v.prototype,"error",2),h([m({attribute:"empty-message"})],v.prototype,"emptyMessage",2),h([m()],v.prototype,"description",2),h([m({type:Boolean,reflect:!0})],v.prototype,"decorative",2),h([m({type:Boolean,attribute:"accessible-table"})],v.prototype,"accessibleTable",2),h([m({attribute:!1})],v.prototype,"zoom",2),h([m({attribute:!1})],v.prototype,"view",2),h([m({type:Boolean,reflect:!0})],v.prototype,"zoomable",2),h([m({type:Boolean,reflect:!0})],v.prototype,"editable",2),h([m({attribute:"sync-id"})],v.prototype,"syncId",2),h([m({type:Boolean,attribute:"cross-filter"})],v.prototype,"crossFilter",2),h([m({converter:{fromAttribute:t=>t===null?!1:t===""?!0:Number(t)}})],v.prototype,"animated",2),h([m({type:Boolean,reflect:!0})],v.prototype,"responsive",2),h([F()],v.prototype,"tip",2),h([F()],v.prototype,"overlay",2),h([F()],v.prototype,"portal",2),h([F()],v.prototype,"measured",2),h([F()],v.prototype,"viewState",2),h([F()],v.prototype,"highlightState",2),h([F()],v.prototype,"crossState",2),h([F()],v.prototype,"focused",2),h([F()],v.prototype,"hiddenState",2),h([F()],v.prototype,"zoomState",2),h([F()],v.prototype,"selectedState",2);var C=class extends v{constructor(){super(...arguments);this.series=[];this.labels=!1;this.connectNulls=!1;this.stacked=!1;this.brush=!1;this.crosshair=!1}input(){let{series:t,categories:r,xAxis:i,yAxis:o,rightAxis:s,references:a,annotations:l,labels:u,curve:d,connectNulls:p,nulls:y,stacked:w,stackOffset:M,orientation:c,radius:g,barGap:b,barWidth:$,sort:I,transform:A,transforms:x,bins:T,binWidth:B,binDomain:P,binMode:U,sampling:K,brush:V,crosshair:Y}=this;return{...this.sized(),series:t,categories:r,xAxis:i,yAxis:o,rightAxis:s,references:a,annotations:l,labels:u,curve:d,connectNulls:p,nulls:y,stacked:w,stackOffset:M,orientation:c,radius:g,barGap:b,barWidth:$,sort:I,transform:A,transforms:x,bins:T,binWidth:B,binDomain:P,binMode:U,sampling:K,brush:V,crosshair:Y}}};h([m({attribute:!1})],C.prototype,"series",2),h([m({attribute:!1})],C.prototype,"categories",2),h([m({attribute:!1})],C.prototype,"xAxis",2),h([m({attribute:!1})],C.prototype,"yAxis",2),h([m({attribute:!1})],C.prototype,"rightAxis",2),h([m({attribute:!1})],C.prototype,"references",2),h([m({attribute:!1})],C.prototype,"annotations",2),h([m({type:Boolean,reflect:!0})],C.prototype,"labels",2),h([m()],C.prototype,"curve",2),h([m({type:Boolean,attribute:"connect-nulls"})],C.prototype,"connectNulls",2),h([m()],C.prototype,"nulls",2),h([m({reflect:!0,converter:{fromAttribute:t=>t==="percent"?"percent":t!==null}})],C.prototype,"stacked",2),h([m({attribute:"stack-offset"})],C.prototype,"stackOffset",2),h([m()],C.prototype,"orientation",2),h([m({type:Number})],C.prototype,"radius",2),h([m({type:Number,attribute:"bar-gap"})],C.prototype,"barGap",2),h([m({type:Number,attribute:"bar-width"})],C.prototype,"barWidth",2),h([m()],C.prototype,"sort",2),h([m()],C.prototype,"transform",2),h([m({attribute:!1})],C.prototype,"transforms",2),h([m({type:Number})],C.prototype,"bins",2),h([m({type:Number,attribute:"bin-width"})],C.prototype,"binWidth",2),h([m({attribute:!1})],C.prototype,"binDomain",2),h([m({attribute:"bin-mode"})],C.prototype,"binMode",2),h([m({attribute:!1})],C.prototype,"sampling",2),h([m({type:Boolean,reflect:!0})],C.prototype,"brush",2),h([m({type:Boolean,reflect:!0})],C.prototype,"crosshair",2);var sn=e=>e.defs&&e.defs.length?D`<defs>${e.defs.map(n=>D`<linearGradient id=${n.id} x1="0" y1="0" x2=${n.vertical===!1?1:0} y2=${n.vertical===!1?0:1}>${n.stops.map(t=>D`<stop offset=${t.offset} stop-color=${t.color} stop-opacity=${S(t.opacity)}></stop>`)}</linearGradient>`)}</defs>`:O,ye=e=>D`${e.map((n,t)=>{let r=n.title?D`<title>${n.title}</title>`:O,i=n.item?t:void 0;switch(n.kind){case"path":return D`<path data-skdx-part=${n.part} data-skdx-i=${S(i)} d=${n.d} fill=${n.fill??"none"} stroke=${S(n.stroke)} stroke-width=${S(n.strokeWidth)} stroke-linecap=${S(n.strokeLinecap)} stroke-linejoin=${S(n.strokeLinejoin)} stroke-dasharray=${S(n.dash)} opacity=${S(n.opacity)} fill-opacity=${S(n.fillOpacity)}>${r}</path>`;case"rect":return D`<rect data-skdx-part=${n.part} data-skdx-i=${S(i)} x=${n.x} y=${n.y} width=${n.width} height=${n.height} rx=${S(n.rx)} fill=${n.fill} stroke=${S(n.stroke)} fill-opacity=${S(n.opacity)}>${r}</rect>`;case"line":return D`<line data-skdx-part=${n.part} data-skdx-i=${S(i)} x1=${n.x1} y1=${n.y1} x2=${n.x2} y2=${n.y2} stroke=${n.stroke} stroke-width=${S(n.strokeWidth)} stroke-dasharray=${S(n.dash)} opacity=${S(n.opacity)}>${r}</line>`;case"circle":return D`<circle data-skdx-part=${n.part} data-skdx-i=${S(i)} cx=${n.cx} cy=${n.cy} r=${n.r} fill=${n.fill} stroke=${S(n.stroke)} opacity=${S(n.opacity)}>${r}</circle>`;case"text":return D`<text data-skdx-part=${n.part} data-skdx-i=${S(i)} x=${n.x} y=${n.y} text-anchor=${S(n.anchor)} dominant-baseline=${S(n.baseline)} fill=${S(n.fill)} font-weight=${S(n.weight)} pointer-events=${S(i===void 0?"none":void 0)} transform=${S(n.rotate?`rotate(${n.rotate} ${n.x} ${n.y})`:void 0)}>${n.text}</text>`}})}`;var R=class extends v{constructor(){super(...arguments);this.value=Number.NaN;this.labels=!0}render(){let{value:t,min:r,max:i,target:o,bands:s,orientation:a,caption:l,labels:u,ticks:d}=this;return this.root(lt({...this.sized(),value:t,min:r,max:i,target:o,bands:s,orientation:a,caption:l,labels:u,ticks:d}),"linear-gauge",this.label??"Linear gauge")}};h([H({type:Number})],R.prototype,"value",2),h([H({type:Number})],R.prototype,"min",2),h([H({type:Number})],R.prototype,"max",2),h([H({type:Number})],R.prototype,"target",2),h([H({attribute:!1})],R.prototype,"bands",2),h([H()],R.prototype,"orientation",2),h([H()],R.prototype,"caption",2),h([H({type:Boolean,attribute:"no-labels",converter:ct})],R.prototype,"labels",2),h([H({type:Number})],R.prototype,"ticks",2),R=h([an("skdx-linear-gauge")],R);export{R as SkdxLinearGauge};
109
+ `,h([m({type:Number})],v.prototype,"width",2),h([m({type:Number})],v.prototype,"height",2),h([m()],v.prototype,"label",2),h([m({type:Boolean,reflect:!0})],v.prototype,"legend",2),h([m({type:Boolean,attribute:"no-tooltip",converter:ct})],v.prototype,"tooltip",2),h([m({attribute:!1})],v.prototype,"format",2),h([m({attribute:!1})],v.prototype,"palette",2),h([m({attribute:!1})],v.prototype,"hiddenSeries",2),h([m({attribute:!1})],v.prototype,"selected",2),h([m({attribute:"selection-mode"})],v.prototype,"selectionMode",2),h([m({attribute:!1})],v.prototype,"highlighted",2),h([m({attribute:!1})],v.prototype,"highlightScope",2),h([m({type:Boolean,reflect:!0})],v.prototype,"loading",2),h([m()],v.prototype,"error",2),h([m({attribute:"empty-message"})],v.prototype,"emptyMessage",2),h([m()],v.prototype,"description",2),h([m({type:Boolean,reflect:!0})],v.prototype,"decorative",2),h([m({type:Boolean,attribute:"accessible-table"})],v.prototype,"accessibleTable",2),h([m({attribute:!1})],v.prototype,"zoom",2),h([m({attribute:!1})],v.prototype,"view",2),h([m({type:Boolean,reflect:!0})],v.prototype,"zoomable",2),h([m({type:Boolean,reflect:!0})],v.prototype,"editable",2),h([m({attribute:"sync-id"})],v.prototype,"syncId",2),h([m({type:Boolean,attribute:"cross-filter"})],v.prototype,"crossFilter",2),h([m({converter:{fromAttribute:t=>t===null?!1:t===""?!0:Number(t)}})],v.prototype,"animated",2),h([m({type:Boolean,reflect:!0})],v.prototype,"responsive",2),h([F()],v.prototype,"tip",2),h([F()],v.prototype,"overlay",2),h([F()],v.prototype,"portal",2),h([F()],v.prototype,"measured",2),h([F()],v.prototype,"viewState",2),h([F()],v.prototype,"highlightState",2),h([F()],v.prototype,"crossState",2),h([F()],v.prototype,"focused",2),h([F()],v.prototype,"hiddenState",2),h([F()],v.prototype,"zoomState",2),h([F()],v.prototype,"selectedState",2);var C=class extends v{constructor(){super(...arguments);this.series=[];this.labels=!1;this.connectNulls=!1;this.stacked=!1;this.brush=!1;this.crosshair=!1}input(){let{series:t,categories:r,xAxis:i,yAxis:o,rightAxis:s,references:a,annotations:l,labels:u,curve:d,connectNulls:p,nulls:y,stacked:w,stackOffset:k,orientation:c,radius:g,barGap:b,barWidth:$,sort:I,transform:A,transforms:x,bins:T,binWidth:B,binDomain:P,binMode:U,sampling:K,brush:Z,crosshair:Y}=this;return{...this.sized(),series:t,categories:r,xAxis:i,yAxis:o,rightAxis:s,references:a,annotations:l,labels:u,curve:d,connectNulls:p,nulls:y,stacked:w,stackOffset:k,orientation:c,radius:g,barGap:b,barWidth:$,sort:I,transform:A,transforms:x,bins:T,binWidth:B,binDomain:P,binMode:U,sampling:K,brush:Z,crosshair:Y}}};h([m({attribute:!1})],C.prototype,"series",2),h([m({attribute:!1})],C.prototype,"categories",2),h([m({attribute:!1})],C.prototype,"xAxis",2),h([m({attribute:!1})],C.prototype,"yAxis",2),h([m({attribute:!1})],C.prototype,"rightAxis",2),h([m({attribute:!1})],C.prototype,"references",2),h([m({attribute:!1})],C.prototype,"annotations",2),h([m({type:Boolean,reflect:!0})],C.prototype,"labels",2),h([m()],C.prototype,"curve",2),h([m({type:Boolean,attribute:"connect-nulls"})],C.prototype,"connectNulls",2),h([m()],C.prototype,"nulls",2),h([m({reflect:!0,converter:{fromAttribute:t=>t==="percent"?"percent":t!==null}})],C.prototype,"stacked",2),h([m({attribute:"stack-offset"})],C.prototype,"stackOffset",2),h([m()],C.prototype,"orientation",2),h([m({type:Number})],C.prototype,"radius",2),h([m({type:Number,attribute:"bar-gap"})],C.prototype,"barGap",2),h([m({type:Number,attribute:"bar-width"})],C.prototype,"barWidth",2),h([m()],C.prototype,"sort",2),h([m()],C.prototype,"transform",2),h([m({attribute:!1})],C.prototype,"transforms",2),h([m({type:Number})],C.prototype,"bins",2),h([m({type:Number,attribute:"bin-width"})],C.prototype,"binWidth",2),h([m({attribute:!1})],C.prototype,"binDomain",2),h([m({attribute:"bin-mode"})],C.prototype,"binMode",2),h([m({attribute:!1})],C.prototype,"sampling",2),h([m({type:Boolean,reflect:!0})],C.prototype,"brush",2),h([m({type:Boolean,reflect:!0})],C.prototype,"crosshair",2);var an=e=>e.defs&&e.defs.length?D`<defs>${e.defs.map(n=>D`<linearGradient id=${n.id} x1="0" y1="0" x2=${n.vertical===!1?1:0} y2=${n.vertical===!1?0:1}>${n.stops.map(t=>D`<stop offset=${t.offset} stop-color=${t.color} stop-opacity=${S(t.opacity)}></stop>`)}</linearGradient>`)}</defs>`:O,ve=e=>D`${e.map((n,t)=>{let r=n.title?D`<title>${n.title}</title>`:O,i=n.item?t:void 0;switch(n.kind){case"path":return D`<path data-skdx-part=${n.part} data-skdx-i=${S(i)} d=${n.d} fill=${n.fill??"none"} stroke=${S(n.stroke)} stroke-width=${S(n.strokeWidth)} stroke-linecap=${S(n.strokeLinecap)} stroke-linejoin=${S(n.strokeLinejoin)} stroke-dasharray=${S(n.dash)} opacity=${S(n.opacity)} fill-opacity=${S(n.fillOpacity)}>${r}</path>`;case"rect":return D`<rect data-skdx-part=${n.part} data-skdx-i=${S(i)} x=${n.x} y=${n.y} width=${n.width} height=${n.height} rx=${S(n.rx)} fill=${n.fill} stroke=${S(n.stroke)} fill-opacity=${S(n.opacity)}>${r}</rect>`;case"line":return D`<line data-skdx-part=${n.part} data-skdx-i=${S(i)} x1=${n.x1} y1=${n.y1} x2=${n.x2} y2=${n.y2} stroke=${n.stroke} stroke-width=${S(n.strokeWidth)} stroke-dasharray=${S(n.dash)} opacity=${S(n.opacity)}>${r}</line>`;case"circle":return D`<circle data-skdx-part=${n.part} data-skdx-i=${S(i)} cx=${n.cx} cy=${n.cy} r=${n.r} fill=${n.fill} stroke=${S(n.stroke)} opacity=${S(n.opacity)}>${r}</circle>`;case"text":return D`<text data-skdx-part=${n.part} data-skdx-i=${S(i)} x=${n.x} y=${n.y} text-anchor=${S(n.anchor)} dominant-baseline=${S(n.baseline)} fill=${S(n.fill)} font-weight=${S(n.weight)} pointer-events=${S(i===void 0?"none":void 0)} transform=${S(n.rotate?`rotate(${n.rotate} ${n.x} ${n.y})`:void 0)}>${n.text}</text>`}})}`;var R=class extends v{constructor(){super(...arguments);this.value=Number.NaN;this.labels=!0}render(){let{value:t,min:r,max:i,target:o,bands:s,orientation:a,caption:l,labels:u,ticks:d}=this;return this.root(lt({...this.sized(),value:t,min:r,max:i,target:o,bands:s,orientation:a,caption:l,labels:u,ticks:d}),"linear-gauge",this.label??"Linear gauge")}};h([V({type:Number})],R.prototype,"value",2),h([V({type:Number})],R.prototype,"min",2),h([V({type:Number})],R.prototype,"max",2),h([V({type:Number})],R.prototype,"target",2),h([V({attribute:!1})],R.prototype,"bands",2),h([V()],R.prototype,"orientation",2),h([V()],R.prototype,"caption",2),h([V({type:Boolean,attribute:"no-labels",converter:ct})],R.prototype,"labels",2),h([V({type:Number})],R.prototype,"ticks",2),R=h([ln("skdx-linear-gauge")],R);export{R as SkdxLinearGauge};
package/dist/map.cjs CHANGED
@@ -1,5 +1,5 @@
1
- "use strict";var he=Object.defineProperty;var xt=Object.getOwnPropertyDescriptor;var tn=Object.getOwnPropertyNames;var nn=Object.prototype.hasOwnProperty;var rn=(e,n)=>{for(var t in n)he(e,t,{get:n[t],enumerable:!0})},on=(e,n,t,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of tn(n))!nn.call(e,i)&&i!==t&&he(e,i,{get:()=>n[i],enumerable:!(r=xt(n,i))||r.enumerable});return e};var sn=e=>on(he({},"__esModule",{value:!0}),e),h=(e,n,t,r)=>{for(var i=r>1?void 0:r?xt(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&&he(n,t,i),i};var Tn={};rn(Tn,{SkdxMapChart:()=>P});module.exports=sn(Tn);var N=require("lit/decorators.js");var yt=e=>Number(e.toPrecision(12)),an,ln=e=>(an??(an=new Intl.NumberFormat)).format(yt(e)),cn=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 vt(e){if(e===void 0)return ln;if(typeof e=="function")return e;let{style:n,locale:t,digits:r,unit:i="",timeZone:o}=e,s=u=>i?p=>u(p)+i:u,a=u=>r===void 0?u===void 0?{}:{maximumFractionDigits:u}:{minimumFractionDigits:r,maximumFractionDigits:r},l=u=>{let p=new Intl.NumberFormat(t,u);return s(b=>p.format(yt(b)))},d=u=>{let p=new Intl.DateTimeFormat(t,o?{...u,timeZone:o}:u);return b=>p.format(b)};switch(n){case"integer":return l({maximumFractionDigits:0});case"decimal":return l(a(2));case"percent":return l({style:"percent",...a(0)});case"currency":return l({style:"currency",currency:e.currency??"USD",...a()});case"compact":return l({notation:"compact",...a(1)});case"scientific":return l({notation:"scientific",...a(2)});case"date":return d({dateStyle:"medium"});case"time":return d({timeStyle:"short"});case"datetime":return d({dateStyle:"medium",timeStyle:"short"});case"duration":return s(cn)}}var x=e=>Number(e.toFixed(2)),q=e=>typeof e=="number"&&Number.isFinite(e);function F(e){let n=1/0,t=-1/0;for(let r of e)q(r)&&(r<n&&(n=r),r>t&&(t=r));return n===1/0?[0,0]:[n,t]}var ne=1e3,re=60*ne,ie=60*re,pe=24*ie,zn=[ne,5*ne,15*ne,30*ne,re,5*re,15*re,30*re,ie,3*ie,6*ie,12*ie,pe,2*pe,7*pe,14*pe];var un=/-?\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 pn(e,n,t){return e.replace(dn,(r,i,o)=>{let s=hn[i];if(s===void 0)return i+o;let l=(o.match(un)??[]).map((d,u)=>{let p=Number(d);if(s===-1)return String(p+n);if(s===-2)return String(p+t);let b=u%s;return s===7?b===5?String(p+n):b===6?String(p+t):d:String(b%2===0?p+n:p+t)});return i+l.join(" ")})}var wt=(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:pn(r.d,n,t)}}});var Se=["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 Mt=(e,n)=>n??Se[e%Se.length];function oe(e){let n=e.legend;if(n)return n===!0?{}:n.enabled===!1?void 0:n}function kt(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,mn=120,St=e=>{let n=oe(e);return n&&(n.position==="left"||n.position==="right")?n.width??mn:0},Ce=(e,n=600,t=300)=>({width:(e.width??n)-St(e),height:(e.height??t)-(oe(e)?.position==="bottom"?me:0)}),$t=e=>{let n=oe(e);return n&&(n.position===void 0||n.position==="top")?me:0},K=6.5,fe=(e,n,t)=>t??(e.palette&&e.palette.length>0?e.palette[n%e.palette.length]:Mt(n));function $e(e,n,t=[],r={},i=10,o=8,s=!1){let a=[],l=r.maxItems,d=l!==void 0&&l>=0&&e.length>l?e.slice(0,l):e,u=e.length-d.length,p=r.interactive??!0,b=o,C=i,I=($,f,v,M)=>{let O=(f?18:4)+$.length*K;b>o&&(s||b+O>n-8)&&(b=o,C+=me),f&&a.push({kind:"rect",part:"legend-swatch",x:b,y:C-5,width:10,height:10,fill:f,opacity:M?.3:void 0,item:v}),a.push({kind:"text",part:"legend-label",x:b+(f?14:0),y:C,text:$,baseline:"middle",fill:M?w.grid:w.label,item:v}),b+=O+12};for(let $ of d){let f=t.includes($.name),v=p?{label:$.name,series:$.name,legend:!0}:void 0;I(r.formatter?.($.name)??$.name,$.color,v,f)}return u>0&&I(`+${u} more`,void 0,void 0,!1),r.align==="end"?fn(a,n):a}function fn(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*K)),s=n-8-o;for(let a of i)r.push({...a,x:a.x+s})}return r}var gn=(e,n,t={})=>new Set($e(e,n,[],t).flatMap(r=>r.kind==="text"?[r.y]:[])).size;function Ie(e,n,t,r=[]){let i=oe(e),o=i&&e.direction==="rtl"&&i.align===void 0?{...i,align:"end"}:i,s=kt(e),a=o?.position==="bottom",l=St(e),d=e.hiddenSeries??[],u=o?l?$e(r,1/0,d,o,10,(o.position==="right"?n:0)+8,!0):$e(r,n,d,o,a?t+10:10):[],p=a?gn(r,n,o):0;return{width:n+l,height:a?t+Math.max(1,p)*me:t,legendOffset:o?.position==="left"?l:void 0,tooltip:s.enabled,tooltipFormatter:s.formatter,axisTooltipFormatter:s.axisFormatter,tooltipPortal:s.portal,tooltipPlacement:s.placement,tooltipAnchored:s.followPointer===!1?!0:void 0,description:e.description,decorative:e.decorative,animate:e.animate===!0?300:e.animate||void 0,responsive:!!e.responsive,shapes:u}}function Te(e){let n=e.legendOffset;if(!n)return e;let t=[...wt(e.shapes.filter(l=>!l.part.startsWith("legend-")),n,0),...e.shapes.filter(l=>l.part.startsWith("legend-"))],r=l=>({...l,x:l.x+n}),i=e.hit?{...e.hit,plot:r(e.hit.plot),xs:e.hit.xs.map(l=>l+n),brush:e.hit.brush?{box:r(e.hit.brush.box),window:r(e.hit.brush.window)}:void 0}:void 0,o=e.edit,s=o?{...o,scale:l=>o.scale(l)+n,invert:l=>o.invert(l-n),bars:o.bars.map(l=>({...l,x0:l.x0+n,x1:l.x1+n}))}:void 0,a=e.map?{...e.map,plot:r(e.map.plot)}:void 0;return{...e,shapes:t,hit:i,edit:s,map:a,legendOffset:void 0}}function ge(e,n,t,r,i,o="auto"){let s=Array.isArray(t)?t:[t],a=Math.max(...s.map(b=>b.length))*K+12,l=6+s.length*16,d=o==="top"?{x:e-a/2,y:n-l-8}:o==="bottom"?{x:e-a/2,y:n+8}:o==="left"?{x:e-a-8,y:n-l/2}:o==="right"?{x:e+8,y:n-l/2}:{x:e+12,y:n-l-6},u=Math.max(0,Math.min(r-a,d.x)),p=Math.max(0,Math.min(i-l,d.y));return[{kind:"rect",part:"tooltip",x:x(u),y:x(p),width:x(a),height:l,fill:"var(--skdx-color-surface-raised)",stroke:w.axis,rx:3},...s.map((b,C)=>({kind:"text",part:"tooltip-label",x:x(u+6),y:x(p+11+C*16),text:b,baseline:"middle",fill:"var(--skdx-color-text-default)",weight:s.length>1&&C===0?"bold":void 0}))]}function Ct(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}=Ce(e,t,r),a=i==="error"?e.error:i==="loading"?"Loading\u2026":e.emptyMessage??"No data available",l=[];return i==="loading"&&l.push({kind:"rect",part:"skeleton",x:0,y:0,width:o,height:s,fill:"var(--skdx-color-surface-sunken)",rx:4}),l.push({kind:"text",part:`state-${i}`,x:x(o/2),y:x(s/2),text:a,anchor:"middle",baseline:"middle",fill:i==="error"?"var(--skdx-color-text-danger)":w.label}),{...Ie(e,o,s),shapes:l,tooltip:!1}}var It=(e,n,t,r={})=>({kind:"text",part:"label",x:e,y:n,text:t,fill:w.label,...r});var se=e=>Math.max(0,Math.min(1,e));function Tt(e){let n=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());if(n){let r=n[1],i=r.length===3?r.split("").map(o=>o+o).join(""):r;return[0,2,4].map(o=>parseInt(i.slice(o,o+2),16))}let t=/^rgba?\(\s*(\d+)[\s,]+(\d+)[\s,]+(\d+)/i.exec(e.trim());return t?[Number(t[1]),Number(t[2]),Number(t[3])]:void 0}function Lt(e,n){if(e.length===0)return w.axis;if(e.length===1)return e[0];let t=se(n)*(e.length-1),r=Math.min(e.length-2,Math.floor(t)),i=t-r,o=Tt(e[r]),s=Tt(e[r+1]);if(!o||!s)return e[Math.round(t)];let a=l=>Math.round(o[l]+(s[l]-o[l])*i);return`rgb(${a(0)}, ${a(1)}, ${a(2)})`}var Ot=(e,n)=>n!==void 0&&n>=2?Math.min(n-1,Math.floor(se(e)*n))/(n-1):se(e);function zt(e,n,t,r=w.negative,i=String){let[o,s]=F(n),a=e??{type:"sequential"},l=f=>x(.15+.85*f);if(a.type==="threshold"){let{thresholds:f,colors:v,labels:M}=a,O=A=>{if(typeof A!="number"||!Number.isFinite(A))return;let T=0;for(;T<f.length&&A>=f[T];)T++;return{fill:v[Math.min(T,v.length-1)]??t,opacity:1}},R=v.map((A,T)=>({fill:A,opacity:1,label:M?.[T]??(T===0?`< ${i(f[0]??0)}`:T===f.length?`\u2265 ${i(f[T-1])}`:`${i(f[T-1])} \u2013 ${i(f[T])}`)}));return{color:O,domain:[o,s],swatches:R,kind:"threshold"}}if(a.type==="ordinal"){let f=a.colors?.length?a.colors:[t];return{color:M=>typeof M=="number"&&Number.isFinite(M)?{fill:f[Math.abs(Math.round(M))%f.length],opacity:1}:void 0,domain:[o,s],swatches:f.map((M,O)=>({fill:M,opacity:1,label:String(O)})),kind:"ordinal"}}if(a.type==="diverging"){let[f,v,M]=a.domain??[-Math.max(Math.abs(o),Math.abs(s)),0,Math.max(Math.abs(o),Math.abs(s))],O=a.colors,R=z=>z<v?.5*(z-f)/Math.max(1e-12,v-f):.5+.5*(z-v)/Math.max(1e-12,M-v),A=z=>{let D=Ot(a.reversed?1-se(z):z,a.steps);if(O&&O.length>=2)return{fill:Lt(O,D),opacity:1};let B=D<.5?r:t,V=Math.abs(D-.5)*2;return{fill:B,opacity:l(V)}},T=z=>typeof z=="number"&&Number.isFinite(z)?A(R(z)):void 0,_=a.steps??5,Y=Array.from({length:_},(z,D)=>{let B=_===1?.5:D/(_-1),V=B<.5?f+(v-f)*(B*2):v+(M-v)*((B-.5)*2);return{...A(B),label:i(V)}});return{color:T,domain:[f,M],swatches:Y,kind:"diverging"}}let[d,u]=a.domain??[o,s],p=a.colors,b=f=>{let v=Ot(a.reversed?1-se(f):f,a.steps);return p&&p.length>=2?{fill:Lt(p,v),opacity:1}:{fill:p?.[0]??t,opacity:l(v)}},C=f=>typeof f!="number"||!Number.isFinite(f)?void 0:b(u===d?1:(f-d)/(u-d)),I=a.steps??5,$=Array.from({length:I},(f,v)=>{let M=I===1?1:v/(I-1);return{...b(M),label:i(d+(u-d)*M)}});return{color:C,domain:[d,u],swatches:$,kind:"sequential"}}var bn=34,xn=72;function be(e){if(!e)return{bottom:0,right:0,options:{}};let n=e===!0?{}:e;return n.orientation==="vertical"?{bottom:0,right:xn,options:n}:{bottom:bn,right:0,options:n}}function At(e,n,t){let r=typeof t=="string"?{title:t}:t??{},i=r.title,o=e.swatches;if(o.length===0||n.width<=0)return[];if(r.orientation==="vertical"){let u=Math.max(0,n.height-(i?16:0)),p=Math.min(16,u/o.length),b=n.y+(i?16:0),C=o.map(($,f)=>({kind:"rect",part:"color-legend-swatch",x:x(n.x),y:x(b+f*p),width:10,height:x(p),fill:$.fill,opacity:$.opacity,title:$.label})),I=p>=12?1:2;return o.forEach(($,f)=>{f%I!==0&&f!==o.length-1||C.push({kind:"text",part:"color-legend-label",x:x(n.x+14),y:x(b+(f+.5)*p),text:$.label,baseline:"middle",fill:w.label})}),i&&C.push({kind:"text",part:"color-legend-title",x:x(n.x),y:x(n.y+6),text:i,baseline:"middle",fill:w.label}),C}let s=Math.min(n.width/o.length,96),a=n.x+(n.width-s*o.length)/2,l=o.map((u,p)=>({kind:"rect",part:"color-legend-swatch",x:x(a+p*s),y:x(n.y),width:x(s),height:10,fill:u.fill,opacity:u.opacity,title:u.label})),d=e.kind==="threshold"?1:Math.max(1,Math.ceil(o.length*7*K/Math.max(1,s*o.length)));return o.forEach((u,p)=>{p%d!==0&&p!==o.length-1||l.push({kind:"text",part:"color-legend-label",x:x(a+(p+.5)*s),y:x(n.y+22),text:u.label,anchor:"middle",fill:w.label})}),i&&l.push({kind:"text",part:"color-legend-title",x:x(a-6),y:x(n.y+5),text:i,anchor:"end",baseline:"middle",fill:w.label}),l}function xe(e){return e==null?[]:(Array.isArray(e)?e:[e]).map(t=>typeof t=="object"?t:{id:t})}var Le=e=>e.id??e.name??e.series,Pt=e=>e.seriesId??e.series;function j(e,n){let t=!1;return n.id!==void 0&&(t=!0,Le(e)!==n.id&&e.id!==n.id&&e.name!==n.id)||n.series!==void 0&&(t=!0,Pt(e)!==n.series&&e.series!==n.series)||n.index!==void 0&&(t=!0,e.index!==n.index)||n.category!==void 0&&(t=!0,e.category!==n.category)?!1:t}function E(e){let n={},t=Le(e);t!==void 0&&(n.id=t);let r=Pt(e);return r!==void 0&&e.series!==void 0&&(n.series=r),e.index!==void 0&&(n.index=e.index),n}var Oe=(e,n)=>e.id===n.id&&e.series===n.series&&e.index===n.index&&e.category===n.category;function ze(e,n,t){let r=xe(e),i=E(n),o=r.some(s=>j(n,s));return t==="single"?o?[]:[i]:o?r.filter(s=>!j(n,s)):[...r,i]}var yn=.2;function vn(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 wn=(e,n)=>e.kind==="text"?{...e,fill:w.grid}:{...e,opacity:(e.opacity??1)*n};function Ae(e,n){let t=xe(n.selected),r=n.highlighted===void 0||n.highlighted===null?[]:xe(n.highlighted),i=r[0];if(t.length===0&&!i)return e;let o={highlighted:n.highlightScope?.highlighted??"item",faded:n.highlightScope?.faded??"global"},s=[],a=u=>!i||r.some(p=>j(u,p))?!0:o.highlighted==="series"?r.some(p=>p.series!==void 0&&j(u,{series:p.series})):!1,l=u=>{if(!i||o.faded==="none"||a(u))return!1;if(o.faded==="series"){let p=i.series;return p!==void 0&&j(u,{series:p})}return!0},d=e.shapes.map(u=>{let p=u.item;if(!p||p.legend)return u;if(t.some(b=>j(p,b))){let b=vn(u);b&&s.push(b)}return l(p)?wn(u,yn):u});return s.length?{...e,shapes:[...d,...s]}:{...e,shapes:d}}function ee(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 Pe=(e,n,t)=>n>=e.x&&n<=e.x+e.width&&t>=e.y&&t<=e.y+e.height;function Rt(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 ae(e,n){let t=e.hit;if(!t||t.xs.length===0)return;let r=Rt(t,n),i=t.rows[r]??[];return{index:r,rows:e.axisTooltipFormatter?.(i,r)??i}}function Re(e,n){let t=e.hit;if(!t||t.xs.length===0)return;let r=t.xs[Rt(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 Be(e,n,t){let r=e.hit;if(!r||!r.crosshair||r.xs.length===0||!Pe(r.plot,n,t))return[];let i=Re(e,n),{rows:o}=ae(e,n),s=e.tooltipAnchored?r.plot.y+8:t;return[i,...ge(i.x1,s,o,e.width,e.height,e.tooltipPlacement)]}function Ne(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 Be(e,i,t.plot.y+8)}function Fe(e,n,t,r,i){if(!e.tooltip)return{lines:[],shapes:[]};if(e.hit?.crosshair){let{x:l,y:d}=ee(t,r,i,e.width,e.height);if(Pe(e.hit.plot,l,d)){let u=ae(e,l),p=Re(e,l);if(u&&p)return{lines:u.rows,shapes:[p]}}}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(l=>l.tagName.toLowerCase()==="title")?.textContent;return a?{lines:Array.isArray(a)?a:[a],shapes:[]}:{lines:[],shapes:[]}}function Bt(e,n,t,r,i,o,s){let a=e?.closest?.("[data-skdx-part]"),l=s&&s.tooltipFormatter?W(s,e)?.item:void 0,d=l&&s?.tooltipFormatter?.(l)||a&&Array.from(a.children).find(I=>I.tagName.toLowerCase()==="title")?.textContent;if(!d)return[];let u=s?.tooltipAnchored?W(s,e):void 0,p=u?s?.shapes[u.index]:void 0,{x:b,y:C}=p?le(p):ee(n,t,r,i,o);return ge(b,C,d,i,o,s?.tooltipPlacement)}function De(e,n,t,r,i){if(!e.tooltip)return[];if(e.hit?.crosshair){let{x:o,y:s}=ee(t,r,i,e.width,e.height),a=Be(e,o,s);if(a.length>0)return a}return Bt(n,t,r,i,e.width,e.height,e)}function Ge(e,n){let t=W(e,n);return t&&!t.item.legend?E(t.item):null}var Mn=(e,n)=>{let{x:t,y:r}=le(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 je(e,n){let t=new Set,r=[];for(let i of e.shapes){if(!i.item||i.item.legend||i.part==="anchor"||!Mn(i,n))continue;let o=E(i.item),s=JSON.stringify(o);t.has(s)||(t.add(s),r.push(o))}return r}var He=e=>({kind:"rect",part:"selection-box",x:x(e.x),y:x(e.y),width:x(e.width),height:x(e.height),fill:w.focus,opacity:.12,stroke:w.focus}),ve=(e,n,t,r)=>({x:Math.min(e,t),y:Math.min(n,r),width:Math.abs(t-e),height:Math.abs(r-n)});function Nt(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 _e(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}=le(i),a=i.kind==="circle"?i.cy:i.kind==="rect"?i.y+i.height/2:s;if(!Nt(n,o,a))continue;let l=E(i.item),d=JSON.stringify(l);t.has(d)||(t.add(d),r.push(l))}return r}var Ve=e=>({kind:"path",part:"selection-lasso",d:e.length?`M${e.map(n=>`${x(n.x)} ${x(n.y)}`).join("L")}`:"",fill:w.focus,fillOpacity:.12,stroke:w.focus,dash:"4 3"}),ye=6;function Ze(e,n,t){let r=e.edit;if(r){for(let i of r.bars)if(!(t<i.y||t>i.y+i.height||n<i.x0-ye||n>i.x1+ye))return Math.abs(n-i.x0)<=ye?{bar:i,mode:"start"}:Math.abs(n-i.x1)<=ye?{bar:i,mode:"end"}:{bar:i,mode:"move"}}}function Ee(e,n,t){let r=e.edit;return Ft(r,n,r.invert(n.bar.x0+t)-r.invert(n.bar.x0))}function We(e,n,t){let r=e.edit,i=t.key==="ArrowRight"?1:t.key==="ArrowLeft"?-1:0;if(!r||n===null||!i||!(t.shiftKey||t.altKey))return;let o=r.bars.find(l=>l.index===n);if(!o)return;let s=t.altKey?t.shiftKey?"start":"end":"move",a=r.snap??r.invert(o.x0+10)-r.invert(o.x0);return Ft(r,{bar:o,mode:s},i*a)}function Ft(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 Ue(e,n,t){let r=e.edit,i=r.scale(t.start),o=r.scale(t.end);return{kind:"rect",part:"edit-ghost",x:x(Math.min(i,o)),y:x(n.bar.y),width:x(Math.max(1,Math.abs(o-i))),height:x(n.bar.height),fill:w.focus,opacity:.25,stroke:w.focus,rx:2}}var kn=64,Sn=e=>Math.max(1,Math.min(kn,e));function qe(e,n,t,r){let i=n>0?.8:1.25,o=Sn(e.view.zoom*i);if(o===e.view.zoom)return e.view;let{plot:s,scale:a}=e,[l,d]=e.view.center,u=(t-(s.x+s.width/2))/a,p=(r-(s.y+s.height/2))/a,b=e.view.zoom/o;return{center:[l+u*(1-b),e.fromY(e.toY(d)-p*(1-b))],zoom:o}}function Ke(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 we=e=>e.shapes.flatMap((n,t)=>n.item&&!n.item.legend?[t]:[]);function le(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 Ye(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*K+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}=le(t),a=t.item&&e.tooltipFormatter?.(t.item)||(t.item?.label??t.title??"");return[i,...a?ge(x(o),x(s),a,e.width,e.height):[]]}function Xe(e,n,t){let r=we(e);if(r.length===0)return;let i=n===null?-1:r.indexOf(n);switch(t){case"ArrowRight":case"ArrowDown":return r[Math.min(r.length-1,i+1)];case"ArrowLeft":case"ArrowUp":return r[Math.max(0,i<=0?0:i-1)];case"Home":return r[0];case"End":return r[r.length-1];case"Escape":return null;default:return}}var Q=2,J=(e,n,t)=>{let r=Math.max(Q,Math.min(t,Math.round(n))),i=Math.max(0,Math.min(t-r,Math.round(e)));return{start:i,end:i+r}},Dt=(e,n)=>!e||e.start<=0&&e.end>=n;function Qe(e,n,t){if(e.count<=Q||!e.plot.width)return;let{start:r,end:i}=e.zoom,o=i-r,s=n>0?1.25:.8,a=Math.max(Q,Math.min(e.count,Math.round(o*s)));if(a===o)return n>0&&!Dt(e.zoom,e.count)?J(r,a,e.count):void 0;let l=Math.max(0,Math.min(1,(t-e.plot.x)/e.plot.width)),d=r+l*o;return J(d-l*a,a,e.count)}function Je(e,n,t,r){let i=n.end-n.start,o=Math.max(Q,Math.min(e.count,Math.round(i/Math.max(.05,t)))),s=Math.max(0,Math.min(1,(r-e.plot.x)/Math.max(1,e.plot.width)));return J(n.start+s*i-s*o,o,e.count)}function et(e,n,t){let r=n.end-n.start,i=e.plot.width/Math.max(1,r);return J(n.start-t/i,r,e.count)}function tt(e,n,t){let r=e.brush;if(!r||!Pe(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:J(s-o/2,o,e.count)}}function nt(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 J(t.start+o,t.end-t.start,e.count);if(n==="left")return{start:Math.max(0,Math.min(t.end-Q,Math.round(t.start+o))),end:t.end};let s=Math.min(e.count,Math.max(t.start+Q,Math.round(t.end+o)));return{start:t.start,end:s}}function it(e,n){switch(n.type){case"svg":return Promise.resolve(rt(e,n.label,n.resolve));case"csv":return Promise.resolve(_t(n.rows));case"png":{if(typeof document>"u"||typeof Image>"u")return Promise.reject(new Error("PNG export needs a browser"));let t=rt(e,n.label,n.resolve);return Ht(t,e.width,e.height,n.scale,n.background)}}}var H=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/"/g,"&quot;"),ce=e=>e.filter(([,n])=>n!==void 0&&n!=="").map(([n,t])=>` ${n}="${H(String(t))}"`).join("");function Gt(e){let n=e.title?`<title>${H(e.title)}</title>`:"",t=["data-skdx-part",e.part];switch(e.kind){case"path":return`<path${ce([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${ce([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${ce([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${ce([t,["cx",e.cx],["cy",e.cy],["r",e.r],["fill",e.fill],["stroke",e.stroke]])}>${n}</circle>`;case"text":return`<text${ce([t,["x",e.x],["y",e.y],["text-anchor",e.anchor],["dominant-baseline",e.baseline],["fill",e.fill],["font-weight",e.weight],["transform",e.rotate?`rotate(${e.rotate} ${e.x} ${e.y})`:void 0]])}>${H(e.text)}</text>`}}function jt(e){let n=e.defs??[];return n.length===0?"":`<defs>${n.map(t=>`<linearGradient id="${H(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="${H(r.color)}"${r.opacity===void 0?"":` stop-opacity="${r.opacity}"`}/>`).join("")}</linearGradient>`).join("")}</defs>`}function rt(e,n,t){let r=jt(e)+e.shapes.map(Gt).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="${H(n)}" font-family="${H(w.fontFamily)}" font-size="${H(w.fontSize)}"><title>${H(n)}</title>${r}</svg>`}function Ht(e,n,t,r=2,i){return new Promise((o,s)=>{let a=URL.createObjectURL(new Blob([e],{type:"image/svg+xml;charset=utf-8"})),l=new Image;l.onload=()=>{URL.revokeObjectURL(a);let d=document.createElement("canvas");d.width=Math.round(n*r),d.height=Math.round(t*r);let u=d.getContext("2d");if(!u)return s(new Error("canvas 2d context unavailable"));i&&(u.fillStyle=i,u.fillRect(0,0,d.width,d.height)),u.drawImage(l,0,0,d.width,d.height),d.toBlob(p=>p?o(p):s(new Error("toBlob failed")),"image/png")},l.onerror=()=>{URL.revokeObjectURL(a),s(new Error("svg could not be decoded"))},l.src=a})}function _t(e){let n=t=>{let r=t==null?"":String(t);return/[",\n\r]/.test(r)?`"${r.replace(/"/g,'""')}"`:r};return e.map(t=>t.map(n).join(",")).join(`\r
2
- `)}function ot(e,n){if(!n)return;let t=typeof n=="object"?n.maxRows??500:500,r=e.hit;if(r&&r.rows.length>0){let a=r.rows[0];if(r.rows.length>t)return;let l=["",...a.slice(1).map(u=>u.replace(/:\s[^:]*$/,""))],d=r.rows.map(u=>[u[0],...u.slice(1).map(p=>p.slice(p.lastIndexOf(": ")+2))]);return[l,...d]}let i=e.shapes.flatMap(a=>a.item&&!a.item.legend&&!(a.part==="anchor"&&!a.title)?[a.item]:[]);if(i.length===0||i.length>t)return;let o=["series","name","category","value"].filter(a=>i.some(l=>l[a]!==void 0)),s=(a,l)=>a[l]===void 0?"":String(a[l]);return[o.map(a=>a[0]?.toUpperCase()+a.slice(1)),...i.map(a=>o.map(l=>s(a,l)))]}var st=new Map;function Me(e){let n=st.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&&st.delete(e)}},publish(o,s){Object.assign(r,o);for(let a of t)a(o,s)}};return st.set(e,{group:i,listeners:t}),i}var Vt='[data-skdx-part]:not([data-skdx-part^="tooltip"]):not([data-skdx-part="focus"]):not([data-skdx-part="crosshair"])',at=`@keyframes skdx-in{from{opacity:0}to{opacity:1}}${Vt}{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){${Vt}{animation:none;transition:none}}`;function lt(e){let n=e.animate;return n&&e.shapes.length<=1500?`${n}ms`:void 0}var U=8,ct=e=>e.geometry.type==="Polygon"?e.geometry.coordinates:e.geometry.type==="MultiPolygon"?e.geometry.coordinates.flat():[],Et=e=>e.geometry.type==="Point"?[e.geometry.coordinates]:e.geometry.type==="MultiPoint"?e.geometry.coordinates:[],Wt=e=>e.geometry.type==="LineString"?[e.geometry.coordinates]:e.geometry.type==="MultiLineString"?e.geometry.coordinates:[],Zt=e=>[...ct(e).flat(),...Et(e),...Wt(e).flat()],$n=e=>Math.log(Math.tan(Math.PI/4+Math.max(-85,Math.min(85,e))*Math.PI/360)),te=e=>e!==void 0&&Number.isFinite(e[0])&&Number.isFinite(e[1]);function ut(e){let n=[],t=e.features.filter(c=>{let L=Zt(c).some(te);return L||n.push({code:"invalid-geometry",severity:"warning",message:`Feature "${c.name}" has no valid coordinates and was dropped.`,itemId:c.id??c.name}),L}),r=Ct(e,t.length===0);if(r)return{...r,issues:n};let i=vt(e.format),{width:o,height:s}=Ce(e),a=$t(e),l=be(e.colorLegend).bottom,d=be(e.colorLegend).right,u=e.projection==="mercator"?$n:c=>c,p=t.filter(c=>ct(c).length>0),b=(p.length?p:t).flatMap(c=>Zt(c).filter(te)),[C,I]=b.length?F(b.map(c=>c[0])):[0,1],[$,f]=b.length?F(b.map(c=>u(c[1]))):[0,1],v=Math.min((o-d-2*U)/Math.max(1e-9,I-C),(s-a-l-2*U)/Math.max(1e-9,f-$)),M={x:U,y:a+U,width:o-d-2*U,height:s-a-l-2*U},O=Math.max(1,Math.min(64,e.view?.zoom??1)),R=v*O,A=e.view?.center?[e.view.center[0],u(e.view.center[1])]:[(C+I)/2,($+f)/2],T=M.x+M.width/2-A[0]*R,_=M.y+M.height/2+A[1]*R,Y=([c,L])=>({x:x(T+c*R),y:x(_-u(L)*R)}),z=c=>{let{x:L,y:G}=Y(c);return`${L} ${G}`},D=fe(e,0,e.color),B=zt(e.colorScale,t.map(c=>c.value),D,void 0,i),V=[],Ut=p.map(c=>{let L=ct(c);if(e.labels&&L.length){let Z=L.reduce((X,bt)=>bt.length>X.length?bt:X),[de,Qt]=F(Z.map(X=>X[0])),[Jt,en]=F(Z.map(X=>u(X[1])));V.push(It(x(T+((de+Qt)/2-C)*R),x(_+(f-(Jt+en)/2)*R),c.name,{part:"region-label",anchor:"middle",baseline:"middle",fill:"var(--skdx-color-text-default)"}))}let G=c.color!==void 0?{fill:c.color,opacity:1}:B.color(c.value),ue=`${c.name}${q(c.value)?`: ${i(c.value)}`:""}`;return{kind:"path",part:"region",d:L.map(Z=>`M${Z.filter(te).map(z).join("L")}Z`).join(""),fill:G?.fill??w.grid,opacity:G?.opacity??.6,stroke:"var(--skdx-color-surface-default)",title:ue,item:{label:ue,id:c.id??c.name,name:c.name,value:c.value}}}),dt=[...e.lines??[],...t.flatMap(c=>Wt(c).map(L=>({id:c.id,name:c.name,coordinates:L,value:c.value,color:c.color??(q(c.value)?B.color(c.value)?.fill:void 0),dash:void 0})))].filter(c=>c.coordinates.filter(te).length>=2),[,ht]=F(dt.map(c=>c.value)),qt=dt.map((c,L)=>{let G=`${c.name}${q(c.value)?`: ${i(c.value)}`:""}`;return{kind:"path",part:"route",d:`M${c.coordinates.filter(te).map(z).join("L")}`,stroke:c.color??fe(e,2),strokeWidth:q(c.value)&&ht>0?1+3*Math.sqrt(Math.max(0,c.value)/ht):1.5,strokeLinecap:"round",strokeLinejoin:"round",dash:c.dash,opacity:.85,title:G,item:{label:G,id:c.id??c.name,name:c.name,index:L,value:c.value}}}),pt=[...e.points??[],...t.flatMap(c=>Et(c).map(L=>({id:c.id,name:c.name,coordinates:L,value:c.value,color:c.color??(q(c.value)?B.color(c.value)?.fill:void 0)})))].filter(c=>te(c.coordinates)),[mt,Kt]=e.sizeRange??[3,14],[,ft]=F(pt.map(c=>c.value)),Yt=pt.map((c,L)=>{let{x:G,y:ue}=Y(c.coordinates),Z=Number.isFinite(c.value)&&ft>0,de=`${c.name}${Z?`: ${i(c.value)}`:""}`;return{kind:"circle",part:Z?"bubble":"point",cx:G,cy:ue,r:x(Z?Math.max(mt,Math.sqrt(Math.max(0,c.value)/ft)*Kt):mt),fill:c.color??fe(e,1),stroke:"var(--skdx-color-surface-default)",opacity:.85,title:de,item:{label:de,id:c.id??c.name,name:c.name,index:L,value:c.value}}}),Xt=e.colorLegend?At(B,d?{x:M.x+M.width+12,y:M.y,width:d,height:M.height}:{x:U,y:s-l+8,width:o-2*U,height:l},be(e.colorLegend).options):[],gt=e.projection==="mercator"?c=>Math.atan(Math.exp(c))*360/Math.PI-90:c=>c;return{...Ie(e,o,s),shapes:[...Ut,...qt,...V,...Yt,...Xt],issues:n,map:{view:{center:[A[0],gt(A[1])],zoom:O},bounds:{minLon:C,maxLon:I,minLat:$,maxLat:f},plot:M,scale:R,toY:u,fromY:gt}}}var g=require("lit"),m=require("lit/decorators.js"),k=require("lit/directives/if-defined.js");var Cn={fromAttribute:()=>!1},y=class extends g.LitElement{constructor(){super(...arguments);this.legend=!1;this.tooltip=!0;this.selectionMode="none";this.loading=!1;this.decorative=!1;this.accessibleTable=!1;this.zoomable=!1;this.editable=!1;this.crossFilter=!1;this.animated=!1;this.responsive=!1;this.tip=[];this.overlay=[];this.portal=null;this.highlightState=null;this.crossState=null;this.lastCross=null;this.pointers=new Map;this.hover=null;this.token={};this.focused=null;this.hiddenState=[];this.drag=null;this.onPointerMove=t=>{let r=this.layout;if(!r)return;this.pointers.has(t.pointerId)&&this.pointers.set(t.pointerId,this.viewBox(t,r).x);let i=this.drag;if(i?.grab==="select"){let{x:o,y:s}=this.viewBox(t,r);this.overlay=[He(ve(i.x,i.y,o,s))];return}if(i?.grab==="lasso"){let{x:o,y:s}=this.viewBox(t,r);i.points=[...i.points??[],{x:o,y:s}],this.overlay=[Ve(i.points)];return}if(i?.grab==="edit"){if(!i.gantt)return;let{x:o}=this.viewBox(t,r);i.change=Ee(r,i.gantt,o-i.x),this.overlay=[Ue(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(Ke(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(Je(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"?et(r.hit,i.zoom,o-i.x):nt(r.hit,i.grab,i.zoom,o-i.x));return}if(r.tooltipPortal){let{lines:o,shapes:s}=Fe(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=De(r,t.target,t.currentTarget,t.clientX,t.clientY);(o.length>0||this.tip.length>0)&&(this.tip=o)}if(this.highlight(Ge(r,t.target)),this.syncId&&r.hit?.crosshair){let o=ae(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)?Ze(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 d=r.map.plot;if(i<d.x||i>d.x+d.width||o<d.y||o>d.y+d.height)return;this.drag={x:i,y:o,zoom:{start:0,end:0},grab:"map",view:r.map.view},t.currentTarget.setPointerCapture(t.pointerId),this.clearTip();return}let l=r.hit;if(!(!l||!this.canZoom(r))){if(this.pointers.set(t.pointerId,i),this.pointers.size===2){let[d,u]=[...this.pointers.values()];this.drag={x:(d+u)/2,y:o,zoom:l.zoom,grab:"pinch",distance:Math.abs(d-u)||1}}else{let d=tt(l,i,o);if(d)this.drag={x:i,y:o,zoom:d.zoom,grab:d.grab},d.zoom!==l.zoom&&this.setZoom(d.zoom);else if(this.zoomable&&i>=l.plot.x&&i<=l.plot.x+l.plot.width&&o>=l.plot.y&&o<=l.plot.y+l.plot.height)this.drag={x:i,y:o,zoom:l.zoom,grab:"pan"};else{this.pointers.delete(t.pointerId);return}}t.currentTarget.setPointerCapture(t.pointerId),this.clearTip()}};this.onPointerUp=t=>{this.pointers.delete(t.pointerId);let r=t.currentTarget;r.hasPointerCapture(t.pointerId)&&r.releasePointerCapture(t.pointerId);let i=this.drag,o=this.layout;if(o&&(i?.grab==="select"||i?.grab==="lasso"||i?.grab==="edit"||i?.grab==="map")){this.overlay=[];let{x:s,y:a}=this.viewBox(t,o);if(Math.abs(s-i.x)>2||Math.abs(a-i.y)>2){i.grab==="select"?this.setSelected(je(o,ve(i.x,i.y,s,a))):i.grab==="lasso"?this.setSelected(_e(o,i.points??[])):i.grab==="edit"&&i.change&&this.emit("skdx-task-change",i.change),this.drag={...i,distance:-1};return}this.drag=null;return}(this.pointers.size===0||this.drag?.grab==="pinch")&&(this.drag=null)};this.onWheel=t=>{let r=this.layout;if(!r)return;let{x:i,y:o}=this.viewBox(t,r);if(r.map&&this.canPan(r)){let l=r.map.plot;if(i<l.x||i>l.x+l.width||o<l.y||o>l.y+l.height)return;t.preventDefault(),this.setView(qe(r.map,t.deltaY,i,o));return}let s=r.hit;if(!s||!this.canZoom(r)||o<s.plot.y||o>s.plot.y+s.plot.height)return;let a=Qe(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=>{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)?We(r,this.focused,t):void 0;if(i){t.preventDefault(),this.emit("skdx-task-change",i);return}let o=Xe(r,this.focused,t.key);if(o===void 0)return;t.preventDefault(),this.focused=o;let s=o===null?void 0:r.shapes[o]?.item;this.highlight(s?E(s):null)}}connectedCallback(){super.connectedCallback(),!(typeof ResizeObserver>"u")&&(this.observer=new ResizeObserver(([t])=>{let r=Math.floor(t?.contentRect.width??0);r>0&&(this.measured=r)}),this.observer.observe(this))}disconnectedCallback(){this.observer?.disconnect(),this.leave?.(),this.leave=void 0,this.joined=void 0,super.disconnectedCallback()}sized(){let{width:t,height:r,legend:i,tooltip:o,format:s,palette:a,loading:l,error:d,emptyMessage:u,description:p,decorative:b,animated:C,responsive:I,highlighted:$,highlightScope:f,accessibleTable:v}=this;return{...typeof I=="object"&&this.measured!==void 0&&this.measured<(I.breakpoint??480)?I.compact:void 0,width:I&&this.measured?this.measured:t,height:r,animate:C,responsive:I,legend:i,tooltip:o,format:s,palette:a,loading:l,error:d,emptyMessage:u,description:p,decorative:b,highlighted:$===void 0?this.highlightState:$,highlightScope:f,accessibleTable:v,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&&Me(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=Me(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&&Oe(r,t)||(this.hover=t,this.emit("skdx-highlighted-change",t),this.syncId&&(this.highlightState=t,this.publish({highlighted:t})))}select(t){let r=this.selectionMode;r!=="none"&&this.setSelected(ze(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 ee(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&&j(o.item,t));return i<0?!1:(this.getSvgElement()?.focus(),this.focused=i,!0)}export(t){let r=this.layout;return r?it(r,{...t,label:t.label??this.label??this.localName}):Promise.reject(new Error("not rendered yet"))}root(t,r,i){this.join();let o=Ae(Te(t),this.sized());if(this.layout=o,o.issues!==this.reported){this.reported=o.issues;for(let v of o.issues??[])this.emit("skdx-data-issue",v)}let s=this.canZoom(o),a=this.canPan(o),l=this.canEdit(o),d=this.brushing(),u=s||a||l||d,p=!o.decorative&&we(o).length>0,b=o.description?`${r}-desc`:void 0,C=lt(o),I=ot(o,this.accessibleTable),$=typeof this.accessibleTable=="object"&&this.accessibleTable.caption||i,f=this.portal;return g.html`<svg
1
+ "use strict";var he=Object.defineProperty;var xt=Object.getOwnPropertyDescriptor;var nn=Object.getOwnPropertyNames;var rn=Object.prototype.hasOwnProperty;var on=(e,n)=>{for(var t in n)he(e,t,{get:n[t],enumerable:!0})},sn=(e,n,t,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of nn(n))!rn.call(e,i)&&i!==t&&he(e,i,{get:()=>n[i],enumerable:!(r=xt(n,i))||r.enumerable});return e};var an=e=>sn(he({},"__esModule",{value:!0}),e),h=(e,n,t,r)=>{for(var i=r>1?void 0:r?xt(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&&he(n,t,i),i};var Tn={};on(Tn,{SkdxMapChart:()=>P});module.exports=an(Tn);var N=require("lit/decorators.js");var yt=e=>Number(e.toPrecision(12)),ln,cn=e=>(ln??(ln=new Intl.NumberFormat)).format(yt(e)),un=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 vt(e){if(e===void 0)return cn;if(typeof e=="function")return e;let{style:n,locale:t,digits:r,unit:i="",timeZone:o}=e,s=u=>i?p=>u(p)+i:u,a=u=>r===void 0?u===void 0?{}:{maximumFractionDigits:u}:{minimumFractionDigits:r,maximumFractionDigits:r},l=u=>{let p=new Intl.NumberFormat(t,u);return s(b=>p.format(yt(b)))},d=u=>{let p=new Intl.DateTimeFormat(t,o?{...u,timeZone:o}:u);return b=>p.format(b)};switch(n){case"integer":return l({maximumFractionDigits:0});case"decimal":return l(a(2));case"percent":return l({style:"percent",...a(0)});case"currency":return l({style:"currency",currency:e.currency??"USD",...a()});case"compact":return l({notation:"compact",...a(1)});case"scientific":return l({notation:"scientific",...a(2)});case"date":return d({dateStyle:"medium"});case"time":return d({timeStyle:"short"});case"datetime":return d({dateStyle:"medium",timeStyle:"short"});case"duration":return s(un)}}var x=e=>Number(e.toFixed(2)),q=e=>typeof e=="number"&&Number.isFinite(e);function F(e){let n=1/0,t=-1/0;for(let r of e)q(r)&&(r<n&&(n=r),r>t&&(t=r));return n===1/0?[0,0]:[n,t]}var ne=1e3,re=60*ne,ie=60*re,pe=24*ie,zn=[ne,5*ne,15*ne,30*ne,re,5*re,15*re,30*re,ie,3*ie,6*ie,12*ie,pe,2*pe,7*pe,14*pe];var dn=/-?\d*\.?\d+(?:e[-+]?\d+)?/gi,hn=/([MLTHVCSQAZmlthvcsqaz])([^MLTHVCSQAZmlthvcsqaz]*)/g,pn={M:2,L:2,T:2,C:6,S:4,Q:4,A:7,H:-1,V:-2};function mn(e,n,t){return e.replace(hn,(r,i,o)=>{let s=pn[i];if(s===void 0)return i+o;let l=(o.match(dn)??[]).map((d,u)=>{let p=Number(d);if(s===-1)return String(p+n);if(s===-2)return String(p+t);let b=u%s;return s===7?b===5?String(p+n):b===6?String(p+t):d:String(b%2===0?p+n:p+t)});return i+l.join(" ")})}var wt=(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:mn(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)"))),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 Mt=(e,n)=>n??$e[e%$e.length];function oe(e){let n=e.legend;if(n)return n===!0?{}:n.enabled===!1?void 0:n}function kt(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,fn=120,St=e=>{let n=oe(e);return n&&(n.position==="left"||n.position==="right")?n.width??fn:0},fe=(e,n=600,t=300)=>({width:(e.width??n)-St(e),height:(e.height??t)-(oe(e)?.position==="bottom"?me:0)}),$t=(e,n,t)=>{let r=oe(e);return!r||!(r.position===void 0||r.position==="top")?0:(n?Math.max(1,Ct(n,t??fe(e).width,r)):1)*me},K=6.5,ge=(e,n,t)=>t??(e.palette&&e.palette.length>0?e.palette[n%e.palette.length]:Mt(n));function Ce(e,n,t=[],r={},i=10,o=8,s=!1){let a=[],l=r.maxItems,d=l!==void 0&&l>=0&&e.length>l?e.slice(0,l):e,u=e.length-d.length,p=r.interactive??!0,b=o,C=i,I=($,f,v,M)=>{let O=(f?18:4)+$.length*K;b>o&&(s||b+O>n-8)&&(b=o,C+=me),f&&a.push({kind:"rect",part:"legend-swatch",x:b,y:C-5,width:10,height:10,fill:f,opacity:M?.3:void 0,item:v}),a.push({kind:"text",part:"legend-label",x:b+(f?14:0),y:C,text:$,baseline:"middle",fill:M?w.grid:w.label,item:v}),b+=O+12};for(let $ of d){let f=t.includes($.name),v=p?{label:$.name,series:$.name,legend:!0}:void 0;I(r.formatter?.($.name)??$.name,$.color,v,f)}return u>0&&I(`+${u} more`,void 0,void 0,!1),r.align==="end"?gn(a,n):a}function gn(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*K)),s=n-8-o;for(let a of i)r.push({...a,x:a.x+s})}return r}var Ct=(e,n,t={})=>new Set(Ce(e,n,[],t).flatMap(r=>r.kind==="text"?[r.y]:[])).size;function Ie(e,n,t,r=[]){let i=oe(e),o=i&&e.direction==="rtl"&&i.align===void 0?{...i,align:"end"}:i,s=kt(e),a=o?.position==="bottom",l=St(e),d=e.hiddenSeries??[],u=o?l?Ce(r,1/0,d,o,10,(o.position==="right"?n:0)+8,!0):Ce(r,n,d,o,a?t+10:10):[],p=a?Ct(r,n,o):0;return{width:n+l,height:a?t+Math.max(1,p)*me:t,legendOffset:o?.position==="left"?l:void 0,tooltip:s.enabled,tooltipFormatter:s.formatter,axisTooltipFormatter:s.axisFormatter,tooltipPortal:s.portal,tooltipPlacement:s.placement,tooltipAnchored:s.followPointer===!1?!0:void 0,description:e.description,decorative:e.decorative,animate:e.animate===!0?300:e.animate||void 0,responsive:!!e.responsive,shapes:u}}function Te(e){let n=e.legendOffset;if(!n)return e;let t=[...wt(e.shapes.filter(l=>!l.part.startsWith("legend-")),n,0),...e.shapes.filter(l=>l.part.startsWith("legend-"))],r=l=>({...l,x:l.x+n}),i=e.hit?{...e.hit,plot:r(e.hit.plot),xs:e.hit.xs.map(l=>l+n),brush:e.hit.brush?{box:r(e.hit.brush.box),window:r(e.hit.brush.window)}:void 0}:void 0,o=e.edit,s=o?{...o,scale:l=>o.scale(l)+n,invert:l=>o.invert(l-n),bars:o.bars.map(l=>({...l,x0:l.x0+n,x1:l.x1+n}))}:void 0,a=e.map?{...e.map,plot:r(e.map.plot)}:void 0;return{...e,shapes:t,hit:i,edit:s,map:a,legendOffset:void 0}}function be(e,n,t,r,i,o="auto"){let s=Array.isArray(t)?t:[t],a=Math.max(...s.map(b=>b.length))*K+12,l=6+s.length*16,d=o==="top"?{x:e-a/2,y:n-l-8}:o==="bottom"?{x:e-a/2,y:n+8}:o==="left"?{x:e-a-8,y:n-l/2}:o==="right"?{x:e+8,y:n-l/2}:{x:e+12,y:n-l-6},u=Math.max(0,Math.min(r-a,d.x)),p=Math.max(0,Math.min(i-l,d.y));return[{kind:"rect",part:"tooltip",x:x(u),y:x(p),width:x(a),height:l,fill:"var(--skdx-color-surface-raised)",stroke:w.axis,rx:3},...s.map((b,C)=>({kind:"text",part:"tooltip-label",x:x(u+6),y:x(p+11+C*16),text:b,baseline:"middle",fill:"var(--skdx-color-text-default)",weight:s.length>1&&C===0?"bold":void 0}))]}function It(e,n,t,r){let i=e.error!==void 0?"error":e.loading?"loading":n?"empty":null;if(!i)return null;let{width:o,height:s}=fe(e,t,r),a=i==="error"?e.error:i==="loading"?"Loading\u2026":e.emptyMessage??"No data available",l=[];return i==="loading"&&l.push({kind:"rect",part:"skeleton",x:0,y:0,width:o,height:s,fill:"var(--skdx-color-surface-sunken)",rx:4}),l.push({kind:"text",part:`state-${i}`,x:x(o/2),y:x(s/2),text:a,anchor:"middle",baseline:"middle",fill:i==="error"?"var(--skdx-color-text-danger)":w.label}),{...Ie(e,o,s),shapes:l,tooltip:!1}}var Tt=(e,n,t,r={})=>({kind:"text",part:"label",x:e,y:n,text:t,fill:w.label,...r});var se=e=>Math.max(0,Math.min(1,e));function Lt(e){let n=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());if(n){let r=n[1],i=r.length===3?r.split("").map(o=>o+o).join(""):r;return[0,2,4].map(o=>parseInt(i.slice(o,o+2),16))}let t=/^rgba?\(\s*(\d+)[\s,]+(\d+)[\s,]+(\d+)/i.exec(e.trim());return t?[Number(t[1]),Number(t[2]),Number(t[3])]:void 0}function Ot(e,n){if(e.length===0)return w.axis;if(e.length===1)return e[0];let t=se(n)*(e.length-1),r=Math.min(e.length-2,Math.floor(t)),i=t-r,o=Lt(e[r]),s=Lt(e[r+1]);if(!o||!s)return e[Math.round(t)];let a=l=>Math.round(o[l]+(s[l]-o[l])*i);return`rgb(${a(0)}, ${a(1)}, ${a(2)})`}var zt=(e,n)=>n!==void 0&&n>=2?Math.min(n-1,Math.floor(se(e)*n))/(n-1):se(e);function At(e,n,t,r=w.negative,i=String){let[o,s]=F(n),a=e??{type:"sequential"},l=f=>x(.15+.85*f);if(a.type==="threshold"){let{thresholds:f,colors:v,labels:M}=a,O=A=>{if(typeof A!="number"||!Number.isFinite(A))return;let T=0;for(;T<f.length&&A>=f[T];)T++;return{fill:v[Math.min(T,v.length-1)]??t,opacity:1}},R=v.map((A,T)=>({fill:A,opacity:1,label:M?.[T]??(T===0?`< ${i(f[0]??0)}`:T===f.length?`\u2265 ${i(f[T-1])}`:`${i(f[T-1])} \u2013 ${i(f[T])}`)}));return{color:O,domain:[o,s],swatches:R,kind:"threshold"}}if(a.type==="ordinal"){let f=a.colors?.length?a.colors:[t];return{color:M=>typeof M=="number"&&Number.isFinite(M)?{fill:f[Math.abs(Math.round(M))%f.length],opacity:1}:void 0,domain:[o,s],swatches:f.map((M,O)=>({fill:M,opacity:1,label:String(O)})),kind:"ordinal"}}if(a.type==="diverging"){let[f,v,M]=a.domain??[-Math.max(Math.abs(o),Math.abs(s)),0,Math.max(Math.abs(o),Math.abs(s))],O=a.colors,R=z=>z<v?.5*(z-f)/Math.max(1e-12,v-f):.5+.5*(z-v)/Math.max(1e-12,M-v),A=z=>{let D=zt(a.reversed?1-se(z):z,a.steps);if(O&&O.length>=2)return{fill:Ot(O,D),opacity:1};let B=D<.5?r:t,V=Math.abs(D-.5)*2;return{fill:B,opacity:l(V)}},T=z=>typeof z=="number"&&Number.isFinite(z)?A(R(z)):void 0,_=a.steps??5,Y=Array.from({length:_},(z,D)=>{let B=_===1?.5:D/(_-1),V=B<.5?f+(v-f)*(B*2):v+(M-v)*((B-.5)*2);return{...A(B),label:i(V)}});return{color:T,domain:[f,M],swatches:Y,kind:"diverging"}}let[d,u]=a.domain??[o,s],p=a.colors,b=f=>{let v=zt(a.reversed?1-se(f):f,a.steps);return p&&p.length>=2?{fill:Ot(p,v),opacity:1}:{fill:p?.[0]??t,opacity:l(v)}},C=f=>typeof f!="number"||!Number.isFinite(f)?void 0:b(u===d?1:(f-d)/(u-d)),I=a.steps??5,$=Array.from({length:I},(f,v)=>{let M=I===1?1:v/(I-1);return{...b(M),label:i(d+(u-d)*M)}});return{color:C,domain:[d,u],swatches:$,kind:"sequential"}}var bn=34,xn=72;function xe(e){if(!e)return{bottom:0,right:0,options:{}};let n=e===!0?{}:e;return n.orientation==="vertical"?{bottom:0,right:xn,options:n}:{bottom:bn,right:0,options:n}}function Pt(e,n,t){let r=typeof t=="string"?{title:t}:t??{},i=r.title,o=e.swatches;if(o.length===0||n.width<=0)return[];if(r.orientation==="vertical"){let u=Math.max(0,n.height-(i?16:0)),p=Math.min(16,u/o.length),b=n.y+(i?16:0),C=o.map(($,f)=>({kind:"rect",part:"color-legend-swatch",x:x(n.x),y:x(b+f*p),width:10,height:x(p),fill:$.fill,opacity:$.opacity,title:$.label})),I=p>=12?1:2;return o.forEach(($,f)=>{f%I!==0&&f!==o.length-1||C.push({kind:"text",part:"color-legend-label",x:x(n.x+14),y:x(b+(f+.5)*p),text:$.label,baseline:"middle",fill:w.label})}),i&&C.push({kind:"text",part:"color-legend-title",x:x(n.x),y:x(n.y+6),text:i,baseline:"middle",fill:w.label}),C}let s=Math.min(n.width/o.length,96),a=n.x+(n.width-s*o.length)/2,l=o.map((u,p)=>({kind:"rect",part:"color-legend-swatch",x:x(a+p*s),y:x(n.y),width:x(s),height:10,fill:u.fill,opacity:u.opacity,title:u.label})),d=e.kind==="threshold"?1:Math.max(1,Math.ceil(o.length*7*K/Math.max(1,s*o.length)));return o.forEach((u,p)=>{p%d!==0&&p!==o.length-1||l.push({kind:"text",part:"color-legend-label",x:x(a+(p+.5)*s),y:x(n.y+22),text:u.label,anchor:"middle",fill:w.label})}),i&&l.push({kind:"text",part:"color-legend-title",x:x(a-6),y:x(n.y+5),text:i,anchor:"end",baseline:"middle",fill:w.label}),l}function ye(e){return e==null?[]:(Array.isArray(e)?e:[e]).map(t=>typeof t=="object"?t:{id:t})}var Le=e=>e.id??e.name??e.series,Rt=e=>e.seriesId??e.series;function j(e,n){let t=!1;return n.id!==void 0&&(t=!0,Le(e)!==n.id&&e.id!==n.id&&e.name!==n.id)||n.series!==void 0&&(t=!0,Rt(e)!==n.series&&e.series!==n.series)||n.index!==void 0&&(t=!0,e.index!==n.index)||n.category!==void 0&&(t=!0,e.category!==n.category)?!1:t}function E(e){let n={},t=Le(e);t!==void 0&&(n.id=t);let r=Rt(e);return r!==void 0&&e.series!==void 0&&(n.series=r),e.index!==void 0&&(n.index=e.index),n}var Oe=(e,n)=>e.id===n.id&&e.series===n.series&&e.index===n.index&&e.category===n.category;function ze(e,n,t){let r=ye(e),i=E(n),o=r.some(s=>j(n,s));return t==="single"?o?[]:[i]:o?r.filter(s=>!j(n,s)):[...r,i]}var yn=.2;function vn(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 wn=(e,n)=>e.kind==="text"?{...e,fill:w.grid}:{...e,opacity:(e.opacity??1)*n};function Ae(e,n){let t=ye(n.selected),r=n.highlighted===void 0||n.highlighted===null?[]:ye(n.highlighted),i=r[0];if(t.length===0&&!i)return e;let o={highlighted:n.highlightScope?.highlighted??"item",faded:n.highlightScope?.faded??"global"},s=[],a=u=>!i||r.some(p=>j(u,p))?!0:o.highlighted==="series"?r.some(p=>p.series!==void 0&&j(u,{series:p.series})):!1,l=u=>{if(!i||o.faded==="none"||a(u))return!1;if(o.faded==="series"){let p=i.series;return p!==void 0&&j(u,{series:p})}return!0},d=e.shapes.map(u=>{let p=u.item;if(!p||p.legend)return u;if(t.some(b=>j(p,b))){let b=vn(u);b&&s.push(b)}return l(p)?wn(u,yn):u});return s.length?{...e,shapes:[...d,...s]}:{...e,shapes:d}}function ee(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 Pe=(e,n,t)=>n>=e.x&&n<=e.x+e.width&&t>=e.y&&t<=e.y+e.height;function Bt(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 ae(e,n){let t=e.hit;if(!t||t.xs.length===0)return;let r=Bt(t,n),i=t.rows[r]??[];return{index:r,rows:e.axisTooltipFormatter?.(i,r)??i}}function Re(e,n){let t=e.hit;if(!t||t.xs.length===0)return;let r=t.xs[Bt(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 Be(e,n,t){let r=e.hit;if(!r||!r.crosshair||r.xs.length===0||!Pe(r.plot,n,t))return[];let i=Re(e,n),{rows:o}=ae(e,n),s=e.tooltipAnchored?r.plot.y+8:t;return[i,...be(i.x1,s,o,e.width,e.height,e.tooltipPlacement)]}function Ne(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 Be(e,i,t.plot.y+8)}function Fe(e,n,t,r,i){if(!e.tooltip)return{lines:[],shapes:[]};if(e.hit?.crosshair){let{x:l,y:d}=ee(t,r,i,e.width,e.height);if(Pe(e.hit.plot,l,d)){let u=ae(e,l),p=Re(e,l);if(u&&p)return{lines:u.rows,shapes:[p]}}}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(l=>l.tagName.toLowerCase()==="title")?.textContent;return a?{lines:Array.isArray(a)?a:[a],shapes:[]}:{lines:[],shapes:[]}}function Nt(e,n,t,r,i,o,s){let a=e?.closest?.("[data-skdx-part]"),l=s&&s.tooltipFormatter?W(s,e)?.item:void 0,d=l&&s?.tooltipFormatter?.(l)||a&&Array.from(a.children).find(I=>I.tagName.toLowerCase()==="title")?.textContent;if(!d)return[];let u=s?.tooltipAnchored?W(s,e):void 0,p=u?s?.shapes[u.index]:void 0,{x:b,y:C}=p?le(p):ee(n,t,r,i,o);return be(b,C,d,i,o,s?.tooltipPlacement)}function De(e,n,t,r,i){if(!e.tooltip)return[];if(e.hit?.crosshair){let{x:o,y:s}=ee(t,r,i,e.width,e.height),a=Be(e,o,s);if(a.length>0)return a}return Nt(n,t,r,i,e.width,e.height,e)}function Ge(e,n){let t=W(e,n);return t&&!t.item.legend?E(t.item):null}var Mn=(e,n)=>{let{x:t,y:r}=le(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 je(e,n){let t=new Set,r=[];for(let i of e.shapes){if(!i.item||i.item.legend||i.part==="anchor"||!Mn(i,n))continue;let o=E(i.item),s=JSON.stringify(o);t.has(s)||(t.add(s),r.push(o))}return r}var He=e=>({kind:"rect",part:"selection-box",x:x(e.x),y:x(e.y),width:x(e.width),height:x(e.height),fill:w.focus,opacity:.12,stroke:w.focus}),we=(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 Ft(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 _e(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}=le(i),a=i.kind==="circle"?i.cy:i.kind==="rect"?i.y+i.height/2:s;if(!Ft(n,o,a))continue;let l=E(i.item),d=JSON.stringify(l);t.has(d)||(t.add(d),r.push(l))}return r}var Ve=e=>({kind:"path",part:"selection-lasso",d:e.length?`M${e.map(n=>`${x(n.x)} ${x(n.y)}`).join("L")}`:"",fill:w.focus,fillOpacity:.12,stroke:w.focus,dash:"4 3"}),ve=6;function Ze(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-ve||n>i.x1+ve))return Math.abs(n-i.x0)<=ve?{bar:i,mode:"start"}:Math.abs(n-i.x1)<=ve?{bar:i,mode:"end"}:{bar:i,mode:"move"}}}function Ee(e,n,t){let r=e.edit;return Dt(r,n,r.invert(n.bar.x0+t)-r.invert(n.bar.x0))}function We(e,n,t){let r=e.edit,i=t.key==="ArrowRight"?1:t.key==="ArrowLeft"?-1:0;if(!r||n===null||!i||!(t.shiftKey||t.altKey))return;let o=r.bars.find(l=>l.index===n);if(!o)return;let s=t.altKey?t.shiftKey?"start":"end":"move",a=r.snap??r.invert(o.x0+10)-r.invert(o.x0);return Dt(r,{bar:o,mode:s},i*a)}function Dt(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 Ue(e,n,t){let r=e.edit,i=r.scale(t.start),o=r.scale(t.end);return{kind:"rect",part:"edit-ghost",x:x(Math.min(i,o)),y:x(n.bar.y),width:x(Math.max(1,Math.abs(o-i))),height:x(n.bar.height),fill:w.focus,opacity:.25,stroke:w.focus,rx:2}}var kn=64,Sn=e=>Math.max(1,Math.min(kn,e));function qe(e,n,t,r){let i=n>0?.8:1.25,o=Sn(e.view.zoom*i);if(o===e.view.zoom)return e.view;let{plot:s,scale:a}=e,[l,d]=e.view.center,u=(t-(s.x+s.width/2))/a,p=(r-(s.y+s.height/2))/a,b=e.view.zoom/o;return{center:[l+u*(1-b),e.fromY(e.toY(d)-p*(1-b))],zoom:o}}function Ke(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 Me=e=>e.shapes.flatMap((n,t)=>n.item&&!n.item.legend?[t]:[]);function le(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 Ye(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*K+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}=le(t),a=t.item&&e.tooltipFormatter?.(t.item)||(t.item?.label??t.title??"");return[i,...a?be(x(o),x(s),a,e.width,e.height):[]]}function Xe(e,n,t){let r=Me(e);if(r.length===0)return;let i=n===null?-1:r.indexOf(n);switch(t){case"ArrowRight":case"ArrowDown":return r[Math.min(r.length-1,i+1)];case"ArrowLeft":case"ArrowUp":return r[Math.max(0,i<=0?0:i-1)];case"Home":return r[0];case"End":return r[r.length-1];case"Escape":return null;default:return}}var Q=2,J=(e,n,t)=>{let r=Math.max(Q,Math.min(t,Math.round(n))),i=Math.max(0,Math.min(t-r,Math.round(e)));return{start:i,end:i+r}},Gt=(e,n)=>!e||e.start<=0&&e.end>=n;function Qe(e,n,t){if(e.count<=Q||!e.plot.width)return;let{start:r,end:i}=e.zoom,o=i-r,s=n>0?1.25:.8,a=Math.max(Q,Math.min(e.count,Math.round(o*s)));if(a===o)return n>0&&!Gt(e.zoom,e.count)?J(r,a,e.count):void 0;let l=Math.max(0,Math.min(1,(t-e.plot.x)/e.plot.width)),d=r+l*o;return J(d-l*a,a,e.count)}function Je(e,n,t,r){let i=n.end-n.start,o=Math.max(Q,Math.min(e.count,Math.round(i/Math.max(.05,t)))),s=Math.max(0,Math.min(1,(r-e.plot.x)/Math.max(1,e.plot.width)));return J(n.start+s*i-s*o,o,e.count)}function et(e,n,t){let r=n.end-n.start,i=e.plot.width/Math.max(1,r);return J(n.start-t/i,r,e.count)}function tt(e,n,t){let r=e.brush;if(!r||!Pe(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:J(s-o/2,o,e.count)}}function nt(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 J(t.start+o,t.end-t.start,e.count);if(n==="left")return{start:Math.max(0,Math.min(t.end-Q,Math.round(t.start+o))),end:t.end};let s=Math.min(e.count,Math.max(t.start+Q,Math.round(t.end+o)));return{start:t.start,end:s}}function it(e,n){switch(n.type){case"svg":return Promise.resolve(rt(e,n.label,n.resolve));case"csv":return Promise.resolve(Vt(n.rows));case"png":{if(typeof document>"u"||typeof Image>"u")return Promise.reject(new Error("PNG export needs a browser"));let t=rt(e,n.label,n.resolve);return _t(t,e.width,e.height,n.scale,n.background)}}}var H=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/"/g,"&quot;"),ce=e=>e.filter(([,n])=>n!==void 0&&n!=="").map(([n,t])=>` ${n}="${H(String(t))}"`).join("");function jt(e){let n=e.title?`<title>${H(e.title)}</title>`:"",t=["data-skdx-part",e.part];switch(e.kind){case"path":return`<path${ce([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${ce([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${ce([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${ce([t,["cx",e.cx],["cy",e.cy],["r",e.r],["fill",e.fill],["stroke",e.stroke]])}>${n}</circle>`;case"text":return`<text${ce([t,["x",e.x],["y",e.y],["text-anchor",e.anchor],["dominant-baseline",e.baseline],["fill",e.fill],["font-weight",e.weight],["transform",e.rotate?`rotate(${e.rotate} ${e.x} ${e.y})`:void 0]])}>${H(e.text)}</text>`}}function Ht(e){let n=e.defs??[];return n.length===0?"":`<defs>${n.map(t=>`<linearGradient id="${H(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="${H(r.color)}"${r.opacity===void 0?"":` stop-opacity="${r.opacity}"`}/>`).join("")}</linearGradient>`).join("")}</defs>`}function rt(e,n,t){let r=Ht(e)+e.shapes.map(jt).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="${H(n)}" font-family="${H(w.fontFamily)}" font-size="${H(w.fontSize)}"><title>${H(n)}</title>${r}</svg>`}function _t(e,n,t,r=2,i){return new Promise((o,s)=>{let a=URL.createObjectURL(new Blob([e],{type:"image/svg+xml;charset=utf-8"})),l=new Image;l.onload=()=>{URL.revokeObjectURL(a);let d=document.createElement("canvas");d.width=Math.round(n*r),d.height=Math.round(t*r);let u=d.getContext("2d");if(!u)return s(new Error("canvas 2d context unavailable"));i&&(u.fillStyle=i,u.fillRect(0,0,d.width,d.height)),u.drawImage(l,0,0,d.width,d.height),d.toBlob(p=>p?o(p):s(new Error("toBlob failed")),"image/png")},l.onerror=()=>{URL.revokeObjectURL(a),s(new Error("svg could not be decoded"))},l.src=a})}function Vt(e){let n=t=>{let r=t==null?"":String(t);return/[",\n\r]/.test(r)?`"${r.replace(/"/g,'""')}"`:r};return e.map(t=>t.map(n).join(",")).join(`\r
2
+ `)}function ot(e,n){if(!n)return;let t=typeof n=="object"?n.maxRows??500:500,r=e.hit;if(r&&r.rows.length>0){let a=r.rows[0];if(r.rows.length>t)return;let l=["",...a.slice(1).map(u=>u.replace(/:\s[^:]*$/,""))],d=r.rows.map(u=>[u[0],...u.slice(1).map(p=>p.slice(p.lastIndexOf(": ")+2))]);return[l,...d]}let i=e.shapes.flatMap(a=>a.item&&!a.item.legend&&!(a.part==="anchor"&&!a.title)?[a.item]:[]);if(i.length===0||i.length>t)return;let o=["series","name","category","value"].filter(a=>i.some(l=>l[a]!==void 0)),s=(a,l)=>a[l]===void 0?"":String(a[l]);return[o.map(a=>a[0]?.toUpperCase()+a.slice(1)),...i.map(a=>o.map(l=>s(a,l)))]}var st=new Map;function ke(e){let n=st.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&&st.delete(e)}},publish(o,s){Object.assign(r,o);for(let a of t)a(o,s)}};return st.set(e,{group:i,listeners:t}),i}var Zt='[data-skdx-part]:not([data-skdx-part^="tooltip"]):not([data-skdx-part="focus"]):not([data-skdx-part="crosshair"])',at=`@keyframes skdx-in{from{opacity:0}to{opacity:1}}${Zt}{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){${Zt}{animation:none;transition:none}}`;function lt(e){let n=e.animate;return n&&e.shapes.length<=1500?`${n}ms`:void 0}var U=8,ct=e=>e.geometry.type==="Polygon"?e.geometry.coordinates:e.geometry.type==="MultiPolygon"?e.geometry.coordinates.flat():[],Wt=e=>e.geometry.type==="Point"?[e.geometry.coordinates]:e.geometry.type==="MultiPoint"?e.geometry.coordinates:[],Ut=e=>e.geometry.type==="LineString"?[e.geometry.coordinates]:e.geometry.type==="MultiLineString"?e.geometry.coordinates:[],Et=e=>[...ct(e).flat(),...Wt(e),...Ut(e).flat()],$n=e=>Math.log(Math.tan(Math.PI/4+Math.max(-85,Math.min(85,e))*Math.PI/360)),te=e=>e!==void 0&&Number.isFinite(e[0])&&Number.isFinite(e[1]);function ut(e){let n=[],t=e.features.filter(c=>{let L=Et(c).some(te);return L||n.push({code:"invalid-geometry",severity:"warning",message:`Feature "${c.name}" has no valid coordinates and was dropped.`,itemId:c.id??c.name}),L}),r=It(e,t.length===0);if(r)return{...r,issues:n};let i=vt(e.format),{width:o,height:s}=fe(e),a=$t(e),l=xe(e.colorLegend).bottom,d=xe(e.colorLegend).right,u=e.projection==="mercator"?$n:c=>c,p=t.filter(c=>ct(c).length>0),b=(p.length?p:t).flatMap(c=>Et(c).filter(te)),[C,I]=b.length?F(b.map(c=>c[0])):[0,1],[$,f]=b.length?F(b.map(c=>u(c[1]))):[0,1],v=Math.min((o-d-2*U)/Math.max(1e-9,I-C),(s-a-l-2*U)/Math.max(1e-9,f-$)),M={x:U,y:a+U,width:o-d-2*U,height:s-a-l-2*U},O=Math.max(1,Math.min(64,e.view?.zoom??1)),R=v*O,A=e.view?.center?[e.view.center[0],u(e.view.center[1])]:[(C+I)/2,($+f)/2],T=M.x+M.width/2-A[0]*R,_=M.y+M.height/2+A[1]*R,Y=([c,L])=>({x:x(T+c*R),y:x(_-u(L)*R)}),z=c=>{let{x:L,y:G}=Y(c);return`${L} ${G}`},D=ge(e,0,e.color),B=At(e.colorScale,t.map(c=>c.value),D,void 0,i),V=[],qt=p.map(c=>{let L=ct(c);if(e.labels&&L.length){let Z=L.reduce((X,bt)=>bt.length>X.length?bt:X),[de,Jt]=F(Z.map(X=>X[0])),[en,tn]=F(Z.map(X=>u(X[1])));V.push(Tt(x(T+((de+Jt)/2-C)*R),x(_+(f-(en+tn)/2)*R),c.name,{part:"region-label",anchor:"middle",baseline:"middle",fill:"var(--skdx-color-text-default)"}))}let G=c.color!==void 0?{fill:c.color,opacity:1}:B.color(c.value),ue=`${c.name}${q(c.value)?`: ${i(c.value)}`:""}`;return{kind:"path",part:"region",d:L.map(Z=>`M${Z.filter(te).map(z).join("L")}Z`).join(""),fill:G?.fill??w.grid,opacity:G?.opacity??.6,stroke:"var(--skdx-color-surface-default)",title:ue,item:{label:ue,id:c.id??c.name,name:c.name,value:c.value}}}),dt=[...e.lines??[],...t.flatMap(c=>Ut(c).map(L=>({id:c.id,name:c.name,coordinates:L,value:c.value,color:c.color??(q(c.value)?B.color(c.value)?.fill:void 0),dash:void 0})))].filter(c=>c.coordinates.filter(te).length>=2),[,ht]=F(dt.map(c=>c.value)),Kt=dt.map((c,L)=>{let G=`${c.name}${q(c.value)?`: ${i(c.value)}`:""}`;return{kind:"path",part:"route",d:`M${c.coordinates.filter(te).map(z).join("L")}`,stroke:c.color??ge(e,2),strokeWidth:q(c.value)&&ht>0?1+3*Math.sqrt(Math.max(0,c.value)/ht):1.5,strokeLinecap:"round",strokeLinejoin:"round",dash:c.dash,opacity:.85,title:G,item:{label:G,id:c.id??c.name,name:c.name,index:L,value:c.value}}}),pt=[...e.points??[],...t.flatMap(c=>Wt(c).map(L=>({id:c.id,name:c.name,coordinates:L,value:c.value,color:c.color??(q(c.value)?B.color(c.value)?.fill:void 0)})))].filter(c=>te(c.coordinates)),[mt,Yt]=e.sizeRange??[3,14],[,ft]=F(pt.map(c=>c.value)),Xt=pt.map((c,L)=>{let{x:G,y:ue}=Y(c.coordinates),Z=Number.isFinite(c.value)&&ft>0,de=`${c.name}${Z?`: ${i(c.value)}`:""}`;return{kind:"circle",part:Z?"bubble":"point",cx:G,cy:ue,r:x(Z?Math.max(mt,Math.sqrt(Math.max(0,c.value)/ft)*Yt):mt),fill:c.color??ge(e,1),stroke:"var(--skdx-color-surface-default)",opacity:.85,title:de,item:{label:de,id:c.id??c.name,name:c.name,index:L,value:c.value}}}),Qt=e.colorLegend?Pt(B,d?{x:M.x+M.width+12,y:M.y,width:d,height:M.height}:{x:U,y:s-l+8,width:o-2*U,height:l},xe(e.colorLegend).options):[],gt=e.projection==="mercator"?c=>Math.atan(Math.exp(c))*360/Math.PI-90:c=>c;return{...Ie(e,o,s),shapes:[...qt,...Kt,...V,...Xt,...Qt],issues:n,map:{view:{center:[A[0],gt(A[1])],zoom:O},bounds:{minLon:C,maxLon:I,minLat:$,maxLat:f},plot:M,scale:R,toY:u,fromY:gt}}}var g=require("lit"),m=require("lit/decorators.js"),k=require("lit/directives/if-defined.js");var Cn={fromAttribute:()=>!1},y=class extends g.LitElement{constructor(){super(...arguments);this.legend=!1;this.tooltip=!0;this.selectionMode="none";this.loading=!1;this.decorative=!1;this.accessibleTable=!1;this.zoomable=!1;this.editable=!1;this.crossFilter=!1;this.animated=!1;this.responsive=!1;this.tip=[];this.overlay=[];this.portal=null;this.highlightState=null;this.crossState=null;this.lastCross=null;this.pointers=new Map;this.hover=null;this.token={};this.focused=null;this.hiddenState=[];this.drag=null;this.onPointerMove=t=>{let r=this.layout;if(!r)return;this.pointers.has(t.pointerId)&&this.pointers.set(t.pointerId,this.viewBox(t,r).x);let i=this.drag;if(i?.grab==="select"){let{x:o,y:s}=this.viewBox(t,r);this.overlay=[He(we(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=[Ve(i.points)];return}if(i?.grab==="edit"){if(!i.gantt)return;let{x:o}=this.viewBox(t,r);i.change=Ee(r,i.gantt,o-i.x),this.overlay=[Ue(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(Ke(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(Je(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"?et(r.hit,i.zoom,o-i.x):nt(r.hit,i.grab,i.zoom,o-i.x));return}if(r.tooltipPortal){let{lines:o,shapes:s}=Fe(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=De(r,t.target,t.currentTarget,t.clientX,t.clientY);(o.length>0||this.tip.length>0)&&(this.tip=o)}if(this.highlight(Ge(r,t.target)),this.syncId&&r.hit?.crosshair){let o=ae(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)?Ze(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 d=r.map.plot;if(i<d.x||i>d.x+d.width||o<d.y||o>d.y+d.height)return;this.drag={x:i,y:o,zoom:{start:0,end:0},grab:"map",view:r.map.view},t.currentTarget.setPointerCapture(t.pointerId),this.clearTip();return}let l=r.hit;if(!(!l||!this.canZoom(r))){if(this.pointers.set(t.pointerId,i),this.pointers.size===2){let[d,u]=[...this.pointers.values()];this.drag={x:(d+u)/2,y:o,zoom:l.zoom,grab:"pinch",distance:Math.abs(d-u)||1}}else{let d=tt(l,i,o);if(d)this.drag={x:i,y:o,zoom:d.zoom,grab:d.grab},d.zoom!==l.zoom&&this.setZoom(d.zoom);else if(this.zoomable&&i>=l.plot.x&&i<=l.plot.x+l.plot.width&&o>=l.plot.y&&o<=l.plot.y+l.plot.height)this.drag={x:i,y:o,zoom:l.zoom,grab:"pan"};else{this.pointers.delete(t.pointerId);return}}t.currentTarget.setPointerCapture(t.pointerId),this.clearTip()}};this.onPointerUp=t=>{this.pointers.delete(t.pointerId);let r=t.currentTarget;r.hasPointerCapture(t.pointerId)&&r.releasePointerCapture(t.pointerId);let i=this.drag,o=this.layout;if(o&&(i?.grab==="select"||i?.grab==="lasso"||i?.grab==="edit"||i?.grab==="map")){this.overlay=[];let{x:s,y:a}=this.viewBox(t,o);if(Math.abs(s-i.x)>2||Math.abs(a-i.y)>2){i.grab==="select"?this.setSelected(je(o,we(i.x,i.y,s,a))):i.grab==="lasso"?this.setSelected(_e(o,i.points??[])):i.grab==="edit"&&i.change&&this.emit("skdx-task-change",i.change),this.drag={...i,distance:-1};return}this.drag=null;return}(this.pointers.size===0||this.drag?.grab==="pinch")&&(this.drag=null)};this.onWheel=t=>{let r=this.layout;if(!r)return;let{x:i,y:o}=this.viewBox(t,r);if(r.map&&this.canPan(r)){let l=r.map.plot;if(i<l.x||i>l.x+l.width||o<l.y||o>l.y+l.height)return;t.preventDefault(),this.setView(qe(r.map,t.deltaY,i,o));return}let s=r.hit;if(!s||!this.canZoom(r)||o<s.plot.y||o>s.plot.y+s.plot.height)return;let a=Qe(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=>{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)?We(r,this.focused,t):void 0;if(i){t.preventDefault(),this.emit("skdx-task-change",i);return}let o=Xe(r,this.focused,t.key);if(o===void 0)return;t.preventDefault(),this.focused=o;let s=o===null?void 0:r.shapes[o]?.item;this.highlight(s?E(s):null)}}connectedCallback(){super.connectedCallback(),!(typeof ResizeObserver>"u")&&(this.observer=new ResizeObserver(([t])=>{let r=Math.floor(t?.contentRect.width??0);r>0&&(this.measured=r)}),this.observer.observe(this))}disconnectedCallback(){this.observer?.disconnect(),this.leave?.(),this.leave=void 0,this.joined=void 0,super.disconnectedCallback()}sized(){let{width:t,height:r,legend:i,tooltip:o,format:s,palette:a,loading:l,error:d,emptyMessage:u,description:p,decorative:b,animated:C,responsive:I,highlighted:$,highlightScope:f,accessibleTable:v}=this;return{...typeof I=="object"&&this.measured!==void 0&&this.measured<(I.breakpoint??480)?I.compact:void 0,width:I&&this.measured?this.measured:t,height:r,animate:C,responsive:I,legend:i,tooltip:o,format:s,palette:a,loading:l,error:d,emptyMessage:u,description:p,decorative:b,highlighted:$===void 0?this.highlightState:$,highlightScope:f,accessibleTable:v,hiddenSeries:this.hiddenSeries??this.hiddenState,zoom:this.zoom??this.zoomState,selected:this.selected??this.selectedState,view:this.view??this.viewState}}emit(t,r){this.dispatchEvent(new CustomEvent(t,{detail:r,bubbles:!0,composed:!0}))}publish(t){this.syncId&&ke(this.syncId).publish(t,this.token)}join(){if(this.joined===this.syncId||(this.leave?.(),this.leave=void 0,this.joined=this.syncId,!this.syncId))return;let t=ke(this.syncId),r=i=>{"highlighted"in i&&(this.highlightState=i.highlighted??null),i.selected&&(this.selectedState=i.selected,this.crossFilter&&(this.highlightState=i.selected.length?i.selected:null)),"zoom"in i&&(this.zoomState=i.zoom),i.hiddenSeries&&(this.hiddenState=i.hiddenSeries),"crosshair"in i&&(this.crossState=i.crosshair??null)};r(t.current),this.leave=t.subscribe((i,o)=>{o!==this.token&&r(i)})}setZoom(t){this.zoomState=t,this.emit("skdx-zoom-change",t),this.publish({zoom:t})}setView(t){this.viewState=t,this.emit("skdx-view-change",t)}setSelected(t){this.selectedState=t,this.emit("skdx-selected-change",t),this.publish({selected:t})}toggle(t){let r=this.hiddenSeries??this.hiddenState,i=r.includes(t)?r.filter(o=>o!==t):[...r,t];this.hiddenState=i,this.emit("skdx-hidden-series-change",i),this.publish({hiddenSeries:i})}highlight(t){let r=this.hover;r===t||r&&t&&Oe(r,t)||(this.hover=t,this.emit("skdx-highlighted-change",t),this.syncId&&(this.highlightState=t,this.publish({highlighted:t})))}select(t){let r=this.selectionMode;r!=="none"&&this.setSelected(ze(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 ee(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&&j(o.item,t));return i<0?!1:(this.getSvgElement()?.focus(),this.focused=i,!0)}export(t){let r=this.layout;return r?it(r,{...t,label:t.label??this.label??this.localName}):Promise.reject(new Error("not rendered yet"))}root(t,r,i){this.join();let o=Ae(Te(t),this.sized());if(this.layout=o,o.issues!==this.reported){this.reported=o.issues;for(let v of o.issues??[])this.emit("skdx-data-issue",v)}let s=this.canZoom(o),a=this.canPan(o),l=this.canEdit(o),d=this.brushing(),u=s||a||l||d,p=!o.decorative&&Me(o).length>0,b=o.description?`${r}-desc`:void 0,C=lt(o),I=ot(o,this.accessibleTable),$=typeof this.accessibleTable=="object"&&this.accessibleTable.caption||i,f=this.portal;return g.html`<svg
3
3
  xmlns="http://www.w3.org/2000/svg"
4
4
  viewBox="0 0 ${o.width} ${o.height}"
5
5
  width=${o.width}
@@ -30,9 +30,9 @@
30
30
  <title>${i}</title>
31
31
  ${o.description?g.svg`<desc id=${(0,k.ifDefined)(b)}>${o.description}</desc>`:g.nothing}
32
32
  ${C?g.svg`<style>${at}</style>`:g.nothing} ${In(o)}
33
- ${ke(o.shapes)}
34
- ${ke(this.tip.length||!this.crossState?this.tip:Ne(o,this.crossState))}
35
- ${ke(Ye(o,this.focused))} ${ke(this.overlay)}
33
+ ${Se(o.shapes)}
34
+ ${Se(this.tip.length||!this.crossState?this.tip:Ne(o,this.crossState))}
35
+ ${Se(Ye(o,this.focused))} ${Se(this.overlay)}
36
36
  </svg>
37
37
  ${f?g.html`<div
38
38
  role="tooltip"
@@ -106,4 +106,4 @@
106
106
  [role='tooltip'] > :first-child:not(:only-child) {
107
107
  font-weight: bold;
108
108
  }
109
- `,h([(0,m.property)({type:Number})],y.prototype,"width",2),h([(0,m.property)({type:Number})],y.prototype,"height",2),h([(0,m.property)()],y.prototype,"label",2),h([(0,m.property)({type:Boolean,reflect:!0})],y.prototype,"legend",2),h([(0,m.property)({type:Boolean,attribute:"no-tooltip",converter:Cn})],y.prototype,"tooltip",2),h([(0,m.property)({attribute:!1})],y.prototype,"format",2),h([(0,m.property)({attribute:!1})],y.prototype,"palette",2),h([(0,m.property)({attribute:!1})],y.prototype,"hiddenSeries",2),h([(0,m.property)({attribute:!1})],y.prototype,"selected",2),h([(0,m.property)({attribute:"selection-mode"})],y.prototype,"selectionMode",2),h([(0,m.property)({attribute:!1})],y.prototype,"highlighted",2),h([(0,m.property)({attribute:!1})],y.prototype,"highlightScope",2),h([(0,m.property)({type:Boolean,reflect:!0})],y.prototype,"loading",2),h([(0,m.property)()],y.prototype,"error",2),h([(0,m.property)({attribute:"empty-message"})],y.prototype,"emptyMessage",2),h([(0,m.property)()],y.prototype,"description",2),h([(0,m.property)({type:Boolean,reflect:!0})],y.prototype,"decorative",2),h([(0,m.property)({type:Boolean,attribute:"accessible-table"})],y.prototype,"accessibleTable",2),h([(0,m.property)({attribute:!1})],y.prototype,"zoom",2),h([(0,m.property)({attribute:!1})],y.prototype,"view",2),h([(0,m.property)({type:Boolean,reflect:!0})],y.prototype,"zoomable",2),h([(0,m.property)({type:Boolean,reflect:!0})],y.prototype,"editable",2),h([(0,m.property)({attribute:"sync-id"})],y.prototype,"syncId",2),h([(0,m.property)({type:Boolean,attribute:"cross-filter"})],y.prototype,"crossFilter",2),h([(0,m.property)({converter:{fromAttribute:t=>t===null?!1:t===""?!0:Number(t)}})],y.prototype,"animated",2),h([(0,m.property)({type:Boolean,reflect:!0})],y.prototype,"responsive",2),h([(0,m.state)()],y.prototype,"tip",2),h([(0,m.state)()],y.prototype,"overlay",2),h([(0,m.state)()],y.prototype,"portal",2),h([(0,m.state)()],y.prototype,"measured",2),h([(0,m.state)()],y.prototype,"viewState",2),h([(0,m.state)()],y.prototype,"highlightState",2),h([(0,m.state)()],y.prototype,"crossState",2),h([(0,m.state)()],y.prototype,"focused",2),h([(0,m.state)()],y.prototype,"hiddenState",2),h([(0,m.state)()],y.prototype,"zoomState",2),h([(0,m.state)()],y.prototype,"selectedState",2);var S=class extends y{constructor(){super(...arguments);this.series=[];this.labels=!1;this.connectNulls=!1;this.stacked=!1;this.brush=!1;this.crosshair=!1}input(){let{series:t,categories:r,xAxis:i,yAxis:o,rightAxis:s,references:a,annotations:l,labels:d,curve:u,connectNulls:p,nulls:b,stacked:C,stackOffset:I,orientation:$,radius:f,barGap:v,barWidth:M,sort:O,transform:R,transforms:A,bins:T,binWidth:_,binDomain:Y,binMode:z,sampling:D,brush:B,crosshair:V}=this;return{...this.sized(),series:t,categories:r,xAxis:i,yAxis:o,rightAxis:s,references:a,annotations:l,labels:d,curve:u,connectNulls:p,nulls:b,stacked:C,stackOffset:I,orientation:$,radius:f,barGap:v,barWidth:M,sort:O,transform:R,transforms:A,bins:T,binWidth:_,binDomain:Y,binMode:z,sampling:D,brush:B,crosshair:V}}};h([(0,m.property)({attribute:!1})],S.prototype,"series",2),h([(0,m.property)({attribute:!1})],S.prototype,"categories",2),h([(0,m.property)({attribute:!1})],S.prototype,"xAxis",2),h([(0,m.property)({attribute:!1})],S.prototype,"yAxis",2),h([(0,m.property)({attribute:!1})],S.prototype,"rightAxis",2),h([(0,m.property)({attribute:!1})],S.prototype,"references",2),h([(0,m.property)({attribute:!1})],S.prototype,"annotations",2),h([(0,m.property)({type:Boolean,reflect:!0})],S.prototype,"labels",2),h([(0,m.property)()],S.prototype,"curve",2),h([(0,m.property)({type:Boolean,attribute:"connect-nulls"})],S.prototype,"connectNulls",2),h([(0,m.property)()],S.prototype,"nulls",2),h([(0,m.property)({reflect:!0,converter:{fromAttribute:t=>t==="percent"?"percent":t!==null}})],S.prototype,"stacked",2),h([(0,m.property)({attribute:"stack-offset"})],S.prototype,"stackOffset",2),h([(0,m.property)()],S.prototype,"orientation",2),h([(0,m.property)({type:Number})],S.prototype,"radius",2),h([(0,m.property)({type:Number,attribute:"bar-gap"})],S.prototype,"barGap",2),h([(0,m.property)({type:Number,attribute:"bar-width"})],S.prototype,"barWidth",2),h([(0,m.property)()],S.prototype,"sort",2),h([(0,m.property)()],S.prototype,"transform",2),h([(0,m.property)({attribute:!1})],S.prototype,"transforms",2),h([(0,m.property)({type:Number})],S.prototype,"bins",2),h([(0,m.property)({type:Number,attribute:"bin-width"})],S.prototype,"binWidth",2),h([(0,m.property)({attribute:!1})],S.prototype,"binDomain",2),h([(0,m.property)({attribute:"bin-mode"})],S.prototype,"binMode",2),h([(0,m.property)({attribute:!1})],S.prototype,"sampling",2),h([(0,m.property)({type:Boolean,reflect:!0})],S.prototype,"brush",2),h([(0,m.property)({type:Boolean,reflect:!0})],S.prototype,"crosshair",2);var In=e=>e.defs&&e.defs.length?g.svg`<defs>${e.defs.map(n=>g.svg`<linearGradient id=${n.id} x1="0" y1="0" x2=${n.vertical===!1?1:0} y2=${n.vertical===!1?0:1}>${n.stops.map(t=>g.svg`<stop offset=${t.offset} stop-color=${t.color} stop-opacity=${(0,k.ifDefined)(t.opacity)}></stop>`)}</linearGradient>`)}</defs>`:g.nothing,ke=e=>g.svg`${e.map((n,t)=>{let r=n.title?g.svg`<title>${n.title}</title>`:g.nothing,i=n.item?t:void 0;switch(n.kind){case"path":return g.svg`<path data-skdx-part=${n.part} data-skdx-i=${(0,k.ifDefined)(i)} d=${n.d} fill=${n.fill??"none"} stroke=${(0,k.ifDefined)(n.stroke)} stroke-width=${(0,k.ifDefined)(n.strokeWidth)} stroke-linecap=${(0,k.ifDefined)(n.strokeLinecap)} stroke-linejoin=${(0,k.ifDefined)(n.strokeLinejoin)} stroke-dasharray=${(0,k.ifDefined)(n.dash)} opacity=${(0,k.ifDefined)(n.opacity)} fill-opacity=${(0,k.ifDefined)(n.fillOpacity)}>${r}</path>`;case"rect":return g.svg`<rect data-skdx-part=${n.part} data-skdx-i=${(0,k.ifDefined)(i)} x=${n.x} y=${n.y} width=${n.width} height=${n.height} rx=${(0,k.ifDefined)(n.rx)} fill=${n.fill} stroke=${(0,k.ifDefined)(n.stroke)} fill-opacity=${(0,k.ifDefined)(n.opacity)}>${r}</rect>`;case"line":return g.svg`<line data-skdx-part=${n.part} data-skdx-i=${(0,k.ifDefined)(i)} x1=${n.x1} y1=${n.y1} x2=${n.x2} y2=${n.y2} stroke=${n.stroke} stroke-width=${(0,k.ifDefined)(n.strokeWidth)} stroke-dasharray=${(0,k.ifDefined)(n.dash)} opacity=${(0,k.ifDefined)(n.opacity)}>${r}</line>`;case"circle":return g.svg`<circle data-skdx-part=${n.part} data-skdx-i=${(0,k.ifDefined)(i)} cx=${n.cx} cy=${n.cy} r=${n.r} fill=${n.fill} stroke=${(0,k.ifDefined)(n.stroke)} opacity=${(0,k.ifDefined)(n.opacity)}>${r}</circle>`;case"text":return g.svg`<text data-skdx-part=${n.part} data-skdx-i=${(0,k.ifDefined)(i)} x=${n.x} y=${n.y} text-anchor=${(0,k.ifDefined)(n.anchor)} dominant-baseline=${(0,k.ifDefined)(n.baseline)} fill=${(0,k.ifDefined)(n.fill)} font-weight=${(0,k.ifDefined)(n.weight)} pointer-events=${(0,k.ifDefined)(i===void 0?"none":void 0)} transform=${(0,k.ifDefined)(n.rotate?`rotate(${n.rotate} ${n.x} ${n.y})`:void 0)}>${n.text}</text>`}})}`;var P=class extends y{constructor(){super(...arguments);this.features=[];this.labels=!1}render(){let{features:t,color:r,colorScale:i,colorLegend:o,projection:s,points:a,lines:l,sizeRange:d,labels:u}=this;return this.root(ut({...this.sized(),features:t,color:r,colorScale:i,colorLegend:o,projection:s,points:a,lines:l,sizeRange:d,labels:u}),"map",this.label??"Map")}};h([(0,N.property)({attribute:!1})],P.prototype,"features",2),h([(0,N.property)()],P.prototype,"color",2),h([(0,N.property)({attribute:!1})],P.prototype,"colorScale",2),h([(0,N.property)({attribute:!1})],P.prototype,"colorLegend",2),h([(0,N.property)()],P.prototype,"projection",2),h([(0,N.property)({attribute:!1})],P.prototype,"points",2),h([(0,N.property)({attribute:!1})],P.prototype,"lines",2),h([(0,N.property)({attribute:!1})],P.prototype,"sizeRange",2),h([(0,N.property)({type:Boolean,reflect:!0})],P.prototype,"labels",2),P=h([(0,N.customElement)("skdx-map-chart")],P);0&&(module.exports={SkdxMapChart});
109
+ `,h([(0,m.property)({type:Number})],y.prototype,"width",2),h([(0,m.property)({type:Number})],y.prototype,"height",2),h([(0,m.property)()],y.prototype,"label",2),h([(0,m.property)({type:Boolean,reflect:!0})],y.prototype,"legend",2),h([(0,m.property)({type:Boolean,attribute:"no-tooltip",converter:Cn})],y.prototype,"tooltip",2),h([(0,m.property)({attribute:!1})],y.prototype,"format",2),h([(0,m.property)({attribute:!1})],y.prototype,"palette",2),h([(0,m.property)({attribute:!1})],y.prototype,"hiddenSeries",2),h([(0,m.property)({attribute:!1})],y.prototype,"selected",2),h([(0,m.property)({attribute:"selection-mode"})],y.prototype,"selectionMode",2),h([(0,m.property)({attribute:!1})],y.prototype,"highlighted",2),h([(0,m.property)({attribute:!1})],y.prototype,"highlightScope",2),h([(0,m.property)({type:Boolean,reflect:!0})],y.prototype,"loading",2),h([(0,m.property)()],y.prototype,"error",2),h([(0,m.property)({attribute:"empty-message"})],y.prototype,"emptyMessage",2),h([(0,m.property)()],y.prototype,"description",2),h([(0,m.property)({type:Boolean,reflect:!0})],y.prototype,"decorative",2),h([(0,m.property)({type:Boolean,attribute:"accessible-table"})],y.prototype,"accessibleTable",2),h([(0,m.property)({attribute:!1})],y.prototype,"zoom",2),h([(0,m.property)({attribute:!1})],y.prototype,"view",2),h([(0,m.property)({type:Boolean,reflect:!0})],y.prototype,"zoomable",2),h([(0,m.property)({type:Boolean,reflect:!0})],y.prototype,"editable",2),h([(0,m.property)({attribute:"sync-id"})],y.prototype,"syncId",2),h([(0,m.property)({type:Boolean,attribute:"cross-filter"})],y.prototype,"crossFilter",2),h([(0,m.property)({converter:{fromAttribute:t=>t===null?!1:t===""?!0:Number(t)}})],y.prototype,"animated",2),h([(0,m.property)({type:Boolean,reflect:!0})],y.prototype,"responsive",2),h([(0,m.state)()],y.prototype,"tip",2),h([(0,m.state)()],y.prototype,"overlay",2),h([(0,m.state)()],y.prototype,"portal",2),h([(0,m.state)()],y.prototype,"measured",2),h([(0,m.state)()],y.prototype,"viewState",2),h([(0,m.state)()],y.prototype,"highlightState",2),h([(0,m.state)()],y.prototype,"crossState",2),h([(0,m.state)()],y.prototype,"focused",2),h([(0,m.state)()],y.prototype,"hiddenState",2),h([(0,m.state)()],y.prototype,"zoomState",2),h([(0,m.state)()],y.prototype,"selectedState",2);var S=class extends y{constructor(){super(...arguments);this.series=[];this.labels=!1;this.connectNulls=!1;this.stacked=!1;this.brush=!1;this.crosshair=!1}input(){let{series:t,categories:r,xAxis:i,yAxis:o,rightAxis:s,references:a,annotations:l,labels:d,curve:u,connectNulls:p,nulls:b,stacked:C,stackOffset:I,orientation:$,radius:f,barGap:v,barWidth:M,sort:O,transform:R,transforms:A,bins:T,binWidth:_,binDomain:Y,binMode:z,sampling:D,brush:B,crosshair:V}=this;return{...this.sized(),series:t,categories:r,xAxis:i,yAxis:o,rightAxis:s,references:a,annotations:l,labels:d,curve:u,connectNulls:p,nulls:b,stacked:C,stackOffset:I,orientation:$,radius:f,barGap:v,barWidth:M,sort:O,transform:R,transforms:A,bins:T,binWidth:_,binDomain:Y,binMode:z,sampling:D,brush:B,crosshair:V}}};h([(0,m.property)({attribute:!1})],S.prototype,"series",2),h([(0,m.property)({attribute:!1})],S.prototype,"categories",2),h([(0,m.property)({attribute:!1})],S.prototype,"xAxis",2),h([(0,m.property)({attribute:!1})],S.prototype,"yAxis",2),h([(0,m.property)({attribute:!1})],S.prototype,"rightAxis",2),h([(0,m.property)({attribute:!1})],S.prototype,"references",2),h([(0,m.property)({attribute:!1})],S.prototype,"annotations",2),h([(0,m.property)({type:Boolean,reflect:!0})],S.prototype,"labels",2),h([(0,m.property)()],S.prototype,"curve",2),h([(0,m.property)({type:Boolean,attribute:"connect-nulls"})],S.prototype,"connectNulls",2),h([(0,m.property)()],S.prototype,"nulls",2),h([(0,m.property)({reflect:!0,converter:{fromAttribute:t=>t==="percent"?"percent":t!==null}})],S.prototype,"stacked",2),h([(0,m.property)({attribute:"stack-offset"})],S.prototype,"stackOffset",2),h([(0,m.property)()],S.prototype,"orientation",2),h([(0,m.property)({type:Number})],S.prototype,"radius",2),h([(0,m.property)({type:Number,attribute:"bar-gap"})],S.prototype,"barGap",2),h([(0,m.property)({type:Number,attribute:"bar-width"})],S.prototype,"barWidth",2),h([(0,m.property)()],S.prototype,"sort",2),h([(0,m.property)()],S.prototype,"transform",2),h([(0,m.property)({attribute:!1})],S.prototype,"transforms",2),h([(0,m.property)({type:Number})],S.prototype,"bins",2),h([(0,m.property)({type:Number,attribute:"bin-width"})],S.prototype,"binWidth",2),h([(0,m.property)({attribute:!1})],S.prototype,"binDomain",2),h([(0,m.property)({attribute:"bin-mode"})],S.prototype,"binMode",2),h([(0,m.property)({attribute:!1})],S.prototype,"sampling",2),h([(0,m.property)({type:Boolean,reflect:!0})],S.prototype,"brush",2),h([(0,m.property)({type:Boolean,reflect:!0})],S.prototype,"crosshair",2);var In=e=>e.defs&&e.defs.length?g.svg`<defs>${e.defs.map(n=>g.svg`<linearGradient id=${n.id} x1="0" y1="0" x2=${n.vertical===!1?1:0} y2=${n.vertical===!1?0:1}>${n.stops.map(t=>g.svg`<stop offset=${t.offset} stop-color=${t.color} stop-opacity=${(0,k.ifDefined)(t.opacity)}></stop>`)}</linearGradient>`)}</defs>`:g.nothing,Se=e=>g.svg`${e.map((n,t)=>{let r=n.title?g.svg`<title>${n.title}</title>`:g.nothing,i=n.item?t:void 0;switch(n.kind){case"path":return g.svg`<path data-skdx-part=${n.part} data-skdx-i=${(0,k.ifDefined)(i)} d=${n.d} fill=${n.fill??"none"} stroke=${(0,k.ifDefined)(n.stroke)} stroke-width=${(0,k.ifDefined)(n.strokeWidth)} stroke-linecap=${(0,k.ifDefined)(n.strokeLinecap)} stroke-linejoin=${(0,k.ifDefined)(n.strokeLinejoin)} stroke-dasharray=${(0,k.ifDefined)(n.dash)} opacity=${(0,k.ifDefined)(n.opacity)} fill-opacity=${(0,k.ifDefined)(n.fillOpacity)}>${r}</path>`;case"rect":return g.svg`<rect data-skdx-part=${n.part} data-skdx-i=${(0,k.ifDefined)(i)} x=${n.x} y=${n.y} width=${n.width} height=${n.height} rx=${(0,k.ifDefined)(n.rx)} fill=${n.fill} stroke=${(0,k.ifDefined)(n.stroke)} fill-opacity=${(0,k.ifDefined)(n.opacity)}>${r}</rect>`;case"line":return g.svg`<line data-skdx-part=${n.part} data-skdx-i=${(0,k.ifDefined)(i)} x1=${n.x1} y1=${n.y1} x2=${n.x2} y2=${n.y2} stroke=${n.stroke} stroke-width=${(0,k.ifDefined)(n.strokeWidth)} stroke-dasharray=${(0,k.ifDefined)(n.dash)} opacity=${(0,k.ifDefined)(n.opacity)}>${r}</line>`;case"circle":return g.svg`<circle data-skdx-part=${n.part} data-skdx-i=${(0,k.ifDefined)(i)} cx=${n.cx} cy=${n.cy} r=${n.r} fill=${n.fill} stroke=${(0,k.ifDefined)(n.stroke)} opacity=${(0,k.ifDefined)(n.opacity)}>${r}</circle>`;case"text":return g.svg`<text data-skdx-part=${n.part} data-skdx-i=${(0,k.ifDefined)(i)} x=${n.x} y=${n.y} text-anchor=${(0,k.ifDefined)(n.anchor)} dominant-baseline=${(0,k.ifDefined)(n.baseline)} fill=${(0,k.ifDefined)(n.fill)} font-weight=${(0,k.ifDefined)(n.weight)} pointer-events=${(0,k.ifDefined)(i===void 0?"none":void 0)} transform=${(0,k.ifDefined)(n.rotate?`rotate(${n.rotate} ${n.x} ${n.y})`:void 0)}>${n.text}</text>`}})}`;var P=class extends y{constructor(){super(...arguments);this.features=[];this.labels=!1}render(){let{features:t,color:r,colorScale:i,colorLegend:o,projection:s,points:a,lines:l,sizeRange:d,labels:u}=this;return this.root(ut({...this.sized(),features:t,color:r,colorScale:i,colorLegend:o,projection:s,points:a,lines:l,sizeRange:d,labels:u}),"map",this.label??"Map")}};h([(0,N.property)({attribute:!1})],P.prototype,"features",2),h([(0,N.property)()],P.prototype,"color",2),h([(0,N.property)({attribute:!1})],P.prototype,"colorScale",2),h([(0,N.property)({attribute:!1})],P.prototype,"colorLegend",2),h([(0,N.property)()],P.prototype,"projection",2),h([(0,N.property)({attribute:!1})],P.prototype,"points",2),h([(0,N.property)({attribute:!1})],P.prototype,"lines",2),h([(0,N.property)({attribute:!1})],P.prototype,"sizeRange",2),h([(0,N.property)({type:Boolean,reflect:!0})],P.prototype,"labels",2),P=h([(0,N.customElement)("skdx-map-chart")],P);0&&(module.exports={SkdxMapChart});