@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
package/dist/timeline.js CHANGED
@@ -1,5 +1,5 @@
1
- var jt=Object.defineProperty;var Ht=Object.getOwnPropertyDescriptor;var u=(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 un,property as ye}from"lit/decorators.js";var bt=e=>Number(e.toPrecision(12)),_t,yt=e=>(_t??(_t=new Intl.NumberFormat)).format(bt(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 Zt(e){if(e===void 0)return yt;if(typeof e=="function")return e;let{style:n,locale:t,digits:r,unit:i="",timeZone:o}=e,s=c=>i?h=>c(h)+i:c,a=c=>r===void 0?c===void 0?{}:{maximumFractionDigits:c}:{minimumFractionDigits:r,maximumFractionDigits:r},l=c=>{let h=new Intl.NumberFormat(t,c);return s(x=>h.format(bt(x)))},d=c=>{let h=new Intl.DateTimeFormat(t,o?{...c,timeZone:o}:c);return x=>h.format(x)};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(Vt)}}function vt(e,n){if(typeof e=="string")return e;let t=e instanceof Date?e.getTime():e;return n?Zt(n)(t):e instanceof Date?new Intl.DateTimeFormat().format(e):yt(t)}function ke([e,n],[t,r]){let i=n-e;return o=>i===0?t:t+(o-e)/i*(r-t)}function Me(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 g=e=>Number(e.toFixed(2)),Et=e=>typeof e=="number"&&Number.isFinite(e);function Se(e){let n=1/0,t=-1/0;for(let r of e)Et(r)&&(r<n&&(n=r),r>t&&(t=r));return n===1/0?[0,0]:[n,t]}var Q=1e3,J=60*Q,ee=60*J,te=24*ee,Wt=[Q,5*Q,15*Q,30*Q,J,5*J,15*J,30*J,ee,3*ee,6*ee,12*ee,te,2*te,7*te,14*te];function wt(e,n,t=6){if(!(n>e))return[e];let r=n-e,i=Wt.find(h=>r/h<=t),o=[];if(i!==void 0){for(let h=Math.ceil(e/i)*i;h<=n;h+=i)o.push(h);return o.length?o:[e,n]}let s=r/(30*te),a=[1,2,3,6,12,24,60,120].find(h=>s/h<=t)??240,l=new Date(e),d=l.getUTCFullYear(),c=Math.ceil((l.getUTCMonth()+(l.getUTCDate()>1?1:0))/a)*a;for(let h=Date.UTC(d,c,1);h<=n;)o.push(h),c+=a,c>=12&&(d+=Math.floor(c/12),c%=12),h=Date.UTC(d,c,1);return o.length?o:[e,n]}var Ut=/-?\d*\.?\d+(?:e[-+]?\d+)?/gi,Kt=/([MLTHVCSQAZmlthvcsqaz])([^MLTHVCSQAZmlthvcsqaz]*)/g,Yt={M:2,L:2,T:2,C:6,S:4,Q:4,A:7,H:-1,V:-2};function qt(e,n,t){return e.replace(Kt,(r,i,o)=>{let s=Yt[i];if(s===void 0)return i+o;let l=(o.match(Ut)??[]).map((d,c)=>{let h=Number(d);if(s===-1)return String(h+n);if(s===-2)return String(h+t);let x=c%s;return s===7?x===5?String(h+n):x===6?String(h+t):d:String(x%2===0?h+n:h+t)});return i+l.join(" ")})}var kt=(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:qt(r.d,n,t)}}});var Ce=["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)"))),b={axis:"var(--skdx-color-border-strong)",grid:"var(--skdx-color-border-subtle)",label:"var(--skdx-color-text-muted)",focus:"var(--skdx-color-focus-ring)",positive:"var(--skdx-color-success-500)",negative:"var(--skdx-color-danger-500)",fontFamily:"var(--skdx-font-family)",fontSize:"var(--skdx-font-size-xs)"},$e=(e="neutral")=>e==="neutral"?b.axis:`var(--skdx-color-${e}-500)`;var Mt=(e,n)=>n??Ce[e%Ce.length];var Xt={top:16,right:16,bottom:32,left:48};function Te(e,n,t=Xt){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 ne(e){let n=e.legend;if(n)return n===!0?{}:n.enabled===!1?void 0:n}function St(e){let n=e.tooltip;return n===void 0||n===!0?{enabled:!0}:n===!1?{enabled:!1}:{...n,enabled:n.enabled??!0}}var ue=20,Qt=120,Ct=e=>{let n=ne(e);return n&&(n.position==="left"||n.position==="right")?n.width??Qt:0},Oe=(e,n=600,t=300)=>({width:(e.width??n)-Ct(e),height:(e.height??t)-(ne(e)?.position==="bottom"?ue:0)}),ze=e=>{let n=ne(e);return n&&(n.position===void 0||n.position==="top")?ue:0},B=6.5,Ae=(e,n,t)=>t??(e.palette&&e.palette.length>0?e.palette[n%e.palette.length]:Mt(n)),$t=(e,n)=>e.hiddenSeries?.includes(n)??!1;function Ie(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,c=e.length-d.length,h=r.interactive??!0,x=o,$=i,k=(O,M,I,T)=>{let G=(M?18:4)+O.length*B;x>o&&(s||x+G>n-8)&&(x=o,$+=ue),M&&a.push({kind:"rect",part:"legend-swatch",x,y:$-5,width:10,height:10,fill:M,opacity:T?.3:void 0,item:I}),a.push({kind:"text",part:"legend-label",x:x+(M?14:0),y:$,text:O,baseline:"middle",fill:T?b.grid:b.label,item:I}),x+=G+12};for(let O of d){let M=t.includes(O.name),I=h?{label:O.name,series:O.name,legend:!0}:void 0;k(r.formatter?.(O.name)??O.name,O.color,I,M)}return c>0&&k(`+${c} more`,void 0,void 0,!1),r.align==="end"?Jt(a,n):a}function Jt(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*B)),s=n-8-o;for(let a of i)r.push({...a,x:a.x+s})}return r}var en=(e,n,t={})=>new Set(Ie(e,n,[],t).flatMap(r=>r.kind==="text"?[r.y]:[])).size;function Le(e,n,t,r=[]){let i=ne(e),o=i&&e.direction==="rtl"&&i.align===void 0?{...i,align:"end"}:i,s=St(e),a=o?.position==="bottom",l=Ct(e),d=e.hiddenSeries??[],c=o?l?Ie(r,1/0,d,o,10,(o.position==="right"?n:0)+8,!0):Ie(r,n,d,o,a?t+10:10):[],h=a?en(r,n,o):0;return{width:n+l,height:a?t+Math.max(1,h)*ue: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:c}}function Pe(e){let n=e.legendOffset;if(!n)return e;let t=[...kt(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(x=>x.length))*B+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},c=Math.max(0,Math.min(r-a,d.x)),h=Math.max(0,Math.min(i-l,d.y));return[{kind:"rect",part:"tooltip",x:g(c),y:g(h),width:g(a),height:l,fill:"var(--skdx-color-surface-raised)",stroke:b.axis,rx:3},...s.map((x,$)=>({kind:"text",part:"tooltip-label",x:g(c+6),y:g(h+11+$*16),text:x,baseline:"middle",fill:"var(--skdx-color-text-default)",weight:s.length>1&&$===0?"bold":void 0}))]}function It(e,n){if(e.length<2)return e;let t=e.reduce((i,o)=>Math.max(i,o.label.length),0)*B+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 Tt(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}=Oe(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:g(o/2),y:g(s/2),text:a,anchor:"middle",baseline:"middle",fill:i==="error"?"var(--skdx-color-text-danger)":b.label}),{...Le(e,o,s),shapes:l,tooltip:!1}}var H=(e,n,t,r={})=>({kind:"text",part:"label",x:e,y:n,text:t,fill:b.label,...r});function pe(e){return e==null?[]:(Array.isArray(e)?e:[e]).map(t=>typeof t=="object"?t:{id:t})}var Be=e=>e.id??e.name??e.series,Ot=e=>e.seriesId??e.series;function D(e,n){let t=!1;return n.id!==void 0&&(t=!0,Be(e)!==n.id&&e.id!==n.id&&e.name!==n.id)||n.series!==void 0&&(t=!0,Ot(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=Be(e);t!==void 0&&(n.id=t);let r=Ot(e);return r!==void 0&&e.series!==void 0&&(n.series=r),e.index!==void 0&&(n.index=e.index),n}var Re=(e,n)=>e.id===n.id&&e.series===n.series&&e.index===n.index&&e.category===n.category;function Ne(e,n,t){let r=pe(e),i=_(n),o=r.some(s=>D(n,s));return t==="single"?o?[]:[i]:o?r.filter(s=>!D(n,s)):[...r,i]}var tn=.2;function nn(e){let n=b.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 rn=(e,n)=>e.kind==="text"?{...e,fill:b.grid}:{...e,opacity:(e.opacity??1)*n};function De(e,n){let t=pe(n.selected),r=n.highlighted===void 0||n.highlighted===null?[]:pe(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=c=>!i||r.some(h=>D(c,h))?!0:o.highlighted==="series"?r.some(h=>h.series!==void 0&&D(c,{series:h.series})):!1,l=c=>{if(!i||o.faded==="none"||a(c))return!1;if(o.faded==="series"){let h=i.series;return h!==void 0&&D(c,{series:h})}return!0},d=e.shapes.map(c=>{let h=c.item;if(!h||h.legend)return c;if(t.some(x=>D(h,x))){let x=nn(c);x&&s.push(x)}return l(h)?rn(c,tn):c});return s.length?{...e,shapes:[...d,...s]}:{...e,shapes:d}}var Fe=14;function Ge(e){let n=[],t=e.events.map((p,y)=>({event:p,index:y,time:new Date(p.date).getTime()})).filter(p=>Number.isFinite(p.time)?!(p.event.group!==void 0&&$t(e,p.event.group)):(n.push({code:"invalid-value",severity:"warning",message:`Event "${p.event.label}" has an unparseable date and was dropped.`,itemId:p.event.id??p.event.label}),!1)).sort((p,y)=>p.time-y.time||p.index-y.index),r=Tt(e,t.length===0);if(r)return{...r,issues:n};let{width:i,height:o}=Oe(e),s=e.orientation==="vertical",a=[...new Set(e.events.map(p=>p.group).filter(p=>p!==void 0))],l=a.length?a:[""],[d,c]=Se(t.map(p=>p.time)),h=e.xAxis?.format??{style:c-d<2*864e5?"time":"date"},x=p=>vt(p,h),$=e.labels??!0,k=t.map(p=>{let y=p.event.group,A=p.event.color??(p.event.variant?$e(p.event.variant):Ae(e,y===void 0?0:a.indexOf(y))),N=p.event.description?` \u2014 ${p.event.description}`:"";return{...p,lane:y===void 0?0:a.indexOf(y),color:A,text:`${p.event.label} \xB7 ${x(p.time)}${N}`}}),O=a.map((p,y)=>({name:p,color:Ae(e,y)})),M=Le(e,i,o,O),I=p=>({label:p.text,id:p.event.id,name:p.event.label,category:p.event.group,index:p.index,value:p.time}),T=[];if(s){let p=Math.max(...k.map(P=>x(P.time).length))*B+16,y=Te(i,o,{top:8+ze(e),right:8,bottom:8,left:p+12}),A=Me(k.length,[y.y,y.y+y.height],0),N=g(y.x);return T.push({kind:"line",part:"axis",x1:N,x2:N,y1:y.y,y2:y.y+y.height,stroke:b.axis}),k.forEach((P,ce)=>{let z=g(A.center(ce));if(T.push(H(g(y.x-12),z,x(P.time),{part:"x-label",anchor:"end",baseline:"middle"}),{kind:"circle",part:"event",cx:N,cy:z,r:5,fill:P.color,stroke:"var(--skdx-color-surface-default)",title:P.text,item:I(P)}),$){let X=P.event.description,de=A.step>=2*Fe&&X;T.push(H(g(y.x+12),de?g(z-7):z,P.event.label,{part:"event-label",baseline:"middle",fill:"var(--skdx-color-text-default)"})),de&&T.push(H(g(y.x+12),g(z+7),X,{part:"event-description",baseline:"middle"}))}}),{...M,shapes:[...T,...M.shapes],issues:n}}let G=a.length?Math.max(...a.map(p=>p.length))*B+16:8,se=Math.max(x(d).length,x(c).length)*B/2+4,S=Te(i,o,{top:8+ze(e),right:Math.max(16,se),bottom:32+(e.xAxis?.label?14:0),left:Math.max(16,G,se)}),j=(c-d)*.04||36e5,ae=ke([d-j,c+j],[S.x,S.x+S.width]),ve=wt(d-j,c+j).filter(p=>p>=d-j&&p<=c+j).map(p=>({pos:g(ae(p)),label:x(p)}));for(let p of It(ve,S.width))T.push({kind:"line",part:"grid",x1:p.pos,x2:p.pos,y1:S.y,y2:S.y+S.height,stroke:b.grid},H(p.pos,S.y+S.height+20,p.label,{part:"x-label",anchor:"middle"}));e.xAxis?.label&&T.push(H(g(S.x+S.width/2),o-4,e.xAxis.label,{part:"axis-title",anchor:"middle"}));let Y=Me(l.length,[S.y,S.y+S.height],0),le=Math.max(0,Math.floor((Y.step/2-14)/Fe));l.forEach((p,y)=>{let A=g(Y.center(y));T.push({kind:"line",part:"axis",x1:S.x,x2:S.x+S.width,y1:A,y2:A,stroke:b.axis}),p&&T.push(H(S.x-8,A,p,{part:"y-label",anchor:"end",baseline:"middle"}))});let we=l.map(()=>[]),q=[],gt=[];for(let p of k){let y=g(ae(p.time)),A=g(Y.center(p.lane));if(gt.push({kind:"circle",part:"event",cx:y,cy:A,r:5,fill:p.color,stroke:"var(--skdx-color-surface-default)",title:p.text,item:I(p)}),!$)continue;let N=p.event.label.length*B,P=y-N/2,ce=we[p.lane],z=0;for(;z<=le&&(ce[z]??-1/0)>P-6;)z++;if(z>le)continue;ce[z]=P+N;let X=g(A-12-z*Fe),de=g(Math.max(N/2+2,Math.min(i-N/2-2,y)));z>0&&q.push({kind:"line",part:"connector",x1:y,x2:y,y1:g(A-6),y2:g(X+4),stroke:b.grid}),q.push(H(de,X,p.event.label,{part:"event-label",anchor:"middle",fill:"var(--skdx-color-text-default)"}))}return{...M,shapes:[...T,...q,...gt,...M.shapes],issues:n}}function K(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 je=(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 re(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 He(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:b.axis,dash:"3 3"}}function _e(e,n,t){let r=e.hit;if(!r||!r.crosshair||r.xs.length===0||!je(r.plot,n,t))return[];let i=He(e,n),{rows:o}=re(e,n),s=e.tooltipAnchored?r.plot.y+8:t;return[i,...he(i.x1,s,o,e.width,e.height,e.tooltipPlacement)]}function Ve(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 _e(e,i,t.plot.y+8)}function Ze(e,n,t,r,i){if(!e.tooltip)return{lines:[],shapes:[]};if(e.hit?.crosshair){let{x:l,y:d}=K(t,r,i,e.width,e.height);if(je(e.hit.plot,l,d)){let c=re(e,l),h=He(e,l);if(c&&h)return{lines:c.rows,shapes:[h]}}}let o=n?.closest?.("[data-skdx-part]"),s=e.tooltipFormatter?V(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 At(e,n,t,r,i,o,s){let a=e?.closest?.("[data-skdx-part]"),l=s&&s.tooltipFormatter?V(s,e)?.item:void 0,d=l&&s?.tooltipFormatter?.(l)||a&&Array.from(a.children).find(k=>k.tagName.toLowerCase()==="title")?.textContent;if(!d)return[];let c=s?.tooltipAnchored?V(s,e):void 0,h=c?s?.shapes[c.index]:void 0,{x,y:$}=h?ie(h):K(n,t,r,i,o);return he(x,$,d,i,o,s?.tooltipPlacement)}function Ee(e,n,t,r,i){if(!e.tooltip)return[];if(e.hit?.crosshair){let{x:o,y:s}=K(t,r,i,e.width,e.height),a=_e(e,o,s);if(a.length>0)return a}return At(n,t,r,i,e.width,e.height,e)}function We(e,n){let t=V(e,n);return t&&!t.item.legend?_(t.item):null}var on=(e,n)=>{let{x:t,y:r}=ie(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 Ue(e,n){let t=new Set,r=[];for(let i of e.shapes){if(!i.item||i.item.legend||i.part==="anchor"||!on(i,n))continue;let o=_(i.item),s=JSON.stringify(o);t.has(s)||(t.add(s),r.push(o))}return r}var Ke=e=>({kind:"rect",part:"selection-box",x:g(e.x),y:g(e.y),width:g(e.width),height:g(e.height),fill:b.focus,opacity:.12,stroke:b.focus}),me=(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 Lt(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 Ye(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}=ie(i),a=i.kind==="circle"?i.cy:i.kind==="rect"?i.y+i.height/2:s;if(!Lt(n,o,a))continue;let l=_(i.item),d=JSON.stringify(l);t.has(d)||(t.add(d),r.push(l))}return r}var qe=e=>({kind:"path",part:"selection-lasso",d:e.length?`M${e.map(n=>`${g(n.x)} ${g(n.y)}`).join("L")}`:"",fill:b.focus,fillOpacity:.12,stroke:b.focus,dash:"4 3"}),fe=6;function Xe(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-fe||n>i.x1+fe))return Math.abs(n-i.x0)<=fe?{bar:i,mode:"start"}:Math.abs(n-i.x1)<=fe?{bar:i,mode:"end"}:{bar:i,mode:"move"}}}function Qe(e,n,t){let r=e.edit;return Pt(r,n,r.invert(n.bar.x0+t)-r.invert(n.bar.x0))}function Je(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 Pt(r,{bar:o,mode:s},i*a)}function Pt(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 et(e,n,t){let r=e.edit,i=r.scale(t.start),o=r.scale(t.end);return{kind:"rect",part:"edit-ghost",x:g(Math.min(i,o)),y:g(n.bar.y),width:g(Math.max(1,Math.abs(o-i))),height:g(n.bar.height),fill:b.focus,opacity:.25,stroke:b.focus,rx:2}}var sn=64,an=e=>Math.max(1,Math.min(sn,e));function tt(e,n,t,r){let i=n>0?.8:1.25,o=an(e.view.zoom*i);if(o===e.view.zoom)return e.view;let{plot:s,scale:a}=e,[l,d]=e.view.center,c=(t-(s.x+s.width/2))/a,h=(r-(s.y+s.height/2))/a,x=e.view.zoom/o;return{center:[l+c*(1-x),e.fromY(e.toY(d)-h*(1-x))],zoom:o}}function nt(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 V(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 ie(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 rt(e,n){let t=n===null?void 0:e.shapes[n];if(!t)return[];let r=b.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*B+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}=ie(t),a=t.item&&e.tooltipFormatter?.(t.item)||(t.item?.label??t.title??"");return[i,...a?he(g(o),g(s),a,e.width,e.height):[]]}function it(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 W=2,U=(e,n,t)=>{let r=Math.max(W,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 ot(e,n,t){if(e.count<=W||!e.plot.width)return;let{start:r,end:i}=e.zoom,o=i-r,s=n>0?1.25:.8,a=Math.max(W,Math.min(e.count,Math.round(o*s)));if(a===o)return n>0&&!Bt(e.zoom,e.count)?U(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 U(d-l*a,a,e.count)}function st(e,n,t,r){let i=n.end-n.start,o=Math.max(W,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 U(n.start+s*i-s*o,o,e.count)}function at(e,n,t){let r=n.end-n.start,i=e.plot.width/Math.max(1,r);return U(n.start-t/i,r,e.count)}function lt(e,n,t){let r=e.brush;if(!r||!je(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:U(s-o/2,o,e.count)}}function ct(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 U(t.start+o,t.end-t.start,e.count);if(n==="left")return{start:Math.max(0,Math.min(t.end-W,Math.round(t.start+o))),end:t.end};let s=Math.min(e.count,Math.max(t.start+W,Math.round(t.end+o)));return{start:t.start,end:s}}function ut(e,n){switch(n.type){case"svg":return Promise.resolve(dt(e,n.label,n.resolve));case"csv":return Promise.resolve(Ft(n.rows));case"png":{if(typeof document>"u"||typeof Image>"u")return Promise.reject(new Error("PNG export needs a browser"));let t=dt(e,n.label,n.resolve);return Dt(t,e.width,e.height,n.scale,n.background)}}}var F=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/"/g,"&quot;"),oe=e=>e.filter(([,n])=>n!==void 0&&n!=="").map(([n,t])=>` ${n}="${F(String(t))}"`).join("");function Rt(e){let n=e.title?`<title>${F(e.title)}</title>`:"",t=["data-skdx-part",e.part];switch(e.kind){case"path":return`<path${oe([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${oe([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${oe([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${oe([t,["cx",e.cx],["cy",e.cy],["r",e.r],["fill",e.fill],["stroke",e.stroke]])}>${n}</circle>`;case"text":return`<text${oe([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]])}>${F(e.text)}</text>`}}function Nt(e){let n=e.defs??[];return n.length===0?"":`<defs>${n.map(t=>`<linearGradient id="${F(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="${F(r.color)}"${r.opacity===void 0?"":` stop-opacity="${r.opacity}"`}/>`).join("")}</linearGradient>`).join("")}</defs>`}function dt(e,n,t){let r=Nt(e)+e.shapes.map(Rt).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="${F(n)}" font-family="${F(b.fontFamily)}" font-size="${F(b.fontSize)}"><title>${F(n)}</title>${r}</svg>`}function Dt(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 c=d.getContext("2d");if(!c)return s(new Error("canvas 2d context unavailable"));i&&(c.fillStyle=i,c.fillRect(0,0,d.width,d.height)),c.drawImage(l,0,0,d.width,d.height),d.toBlob(h=>h?o(h):s(new Error("toBlob failed")),"image/png")},l.onerror=()=>{URL.revokeObjectURL(a),s(new Error("svg could not be decoded"))},l.src=a})}function Ft(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 ht(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(c=>c.replace(/:\s[^:]*$/,""))],d=r.rows.map(c=>[c[0],...c.slice(1).map(h=>h.slice(h.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 pt=new Map;function ge(e){let n=pt.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&&pt.delete(e)}},publish(o,s){Object.assign(r,o);for(let a of t)a(o,s)}};return pt.set(e,{group:i,listeners:t}),i}var Gt='[data-skdx-part]:not([data-skdx-part^="tooltip"]):not([data-skdx-part="focus"]):not([data-skdx-part="crosshair"])',ft=`@keyframes skdx-in{from{opacity:0}to{opacity:1}}${Gt}{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){${Gt}{animation:none;transition:none}}`;function mt(e){let n=e.animate;return n&&e.shapes.length<=1500?`${n}ms`:void 0}import{css as ln,html as Z,LitElement as cn,nothing as C,svg as L}from"lit";import{property as f,state as R}from"lit/decorators.js";import{ifDefined as w}from"lit/directives/if-defined.js";var xt={fromAttribute:()=>!1},m=class extends cn{constructor(){super(...arguments);this.legend=!1;this.tooltip=!0;this.selectionMode="none";this.loading=!1;this.decorative=!1;this.accessibleTable=!1;this.zoomable=!1;this.editable=!1;this.crossFilter=!1;this.animated=!1;this.responsive=!1;this.tip=[];this.overlay=[];this.portal=null;this.highlightState=null;this.crossState=null;this.lastCross=null;this.pointers=new Map;this.hover=null;this.token={};this.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=[Ke(me(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=[qe(i.points)];return}if(i?.grab==="edit"){if(!i.gantt)return;let{x:o}=this.viewBox(t,r);i.change=Qe(r,i.gantt,o-i.x),this.overlay=[et(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(nt(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(st(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"?at(r.hit,i.zoom,o-i.x):ct(r.hit,i.grab,i.zoom,o-i.x));return}if(r.tooltipPortal){let{lines:o,shapes:s}=Ze(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=Ee(r,t.target,t.currentTarget,t.clientX,t.clientY);(o.length>0||this.tip.length>0)&&(this.tip=o)}if(this.highlight(We(r,t.target)),this.syncId&&r.hit?.crosshair){let o=re(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=V(r,t.target)?.item.legend,a=this.canEdit(r)?Xe(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,c]=[...this.pointers.values()];this.drag={x:(d+c)/2,y:o,zoom:l.zoom,grab:"pinch",distance:Math.abs(d-c)||1}}else{let d=lt(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(Ue(o,me(i.x,i.y,s,a))):i.grab==="lasso"?this.setSelected(Ye(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(tt(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=ot(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=V(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)?Je(r,this.focused,t):void 0;if(i){t.preventDefault(),this.emit("skdx-task-change",i);return}let o=it(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:d,emptyMessage:c,description:h,decorative:x,animated:$,responsive:k,highlighted:O,highlightScope:M,accessibleTable:I}=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:$,responsive:k,legend:i,tooltip:o,format:s,palette:a,loading:l,error:d,emptyMessage:c,description:h,decorative:x,highlighted:O===void 0?this.highlightState:O,highlightScope:M,accessibleTable:I,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&&ge(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=ge(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&&Re(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(Ne(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 K(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&&D(o.item,t));return i<0?!1:(this.getSvgElement()?.focus(),this.focused=i,!0)}export(t){let r=this.layout;return r?ut(r,{...t,label:t.label??this.label??this.localName}):Promise.reject(new Error("not rendered yet"))}root(t,r,i){this.join();let o=De(Pe(t),this.sized());if(this.layout=o,o.issues!==this.reported){this.reported=o.issues;for(let I of o.issues??[])this.emit("skdx-data-issue",I)}let s=this.canZoom(o),a=this.canPan(o),l=this.canEdit(o),d=this.brushing(),c=s||a||l||d,h=!o.decorative&&xe(o).length>0,x=o.description?`${r}-desc`:void 0,$=mt(o),k=ht(o,this.accessibleTable),O=typeof this.accessibleTable=="object"&&this.accessibleTable.caption||i,M=this.portal;return Z`<svg
1
+ var Ht=Object.defineProperty;var _t=Object.getOwnPropertyDescriptor;var u=(e,n,t,r)=>{for(var i=r>1?void 0:r?_t(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&&Ht(n,t,i),i};import{customElement as un,property as ve}from"lit/decorators.js";var bt=e=>Number(e.toPrecision(12)),Vt,yt=e=>(Vt??(Vt=new Intl.NumberFormat)).format(bt(e)),Zt=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 Et(e){if(e===void 0)return yt;if(typeof e=="function")return e;let{style:n,locale:t,digits:r,unit:i="",timeZone:o}=e,s=c=>i?h=>c(h)+i:c,a=c=>r===void 0?c===void 0?{}:{maximumFractionDigits:c}:{minimumFractionDigits:r,maximumFractionDigits:r},l=c=>{let h=new Intl.NumberFormat(t,c);return s(x=>h.format(bt(x)))},d=c=>{let h=new Intl.DateTimeFormat(t,o?{...c,timeZone:o}:c);return x=>h.format(x)};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(Zt)}}function vt(e,n){if(typeof e=="string")return e;let t=e instanceof Date?e.getTime():e;return n?Et(n)(t):e instanceof Date?new Intl.DateTimeFormat().format(e):yt(t)}function Me([e,n],[t,r]){let i=n-e;return o=>i===0?t:t+(o-e)/i*(r-t)}function Se(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 g=e=>Number(e.toFixed(2)),Wt=e=>typeof e=="number"&&Number.isFinite(e);function Ce(e){let n=1/0,t=-1/0;for(let r of e)Wt(r)&&(r<n&&(n=r),r>t&&(t=r));return n===1/0?[0,0]:[n,t]}var Q=1e3,J=60*Q,ee=60*J,te=24*ee,Ut=[Q,5*Q,15*Q,30*Q,J,5*J,15*J,30*J,ee,3*ee,6*ee,12*ee,te,2*te,7*te,14*te];function wt(e,n,t=6){if(!(n>e))return[e];let r=n-e,i=Ut.find(h=>r/h<=t),o=[];if(i!==void 0){for(let h=Math.ceil(e/i)*i;h<=n;h+=i)o.push(h);return o.length?o:[e,n]}let s=r/(30*te),a=[1,2,3,6,12,24,60,120].find(h=>s/h<=t)??240,l=new Date(e),d=l.getUTCFullYear(),c=Math.ceil((l.getUTCMonth()+(l.getUTCDate()>1?1:0))/a)*a;for(let h=Date.UTC(d,c,1);h<=n;)o.push(h),c+=a,c>=12&&(d+=Math.floor(c/12),c%=12),h=Date.UTC(d,c,1);return o.length?o:[e,n]}var Kt=/-?\d*\.?\d+(?:e[-+]?\d+)?/gi,Yt=/([MLTHVCSQAZmlthvcsqaz])([^MLTHVCSQAZmlthvcsqaz]*)/g,qt={M:2,L:2,T:2,C:6,S:4,Q:4,A:7,H:-1,V:-2};function Xt(e,n,t){return e.replace(Yt,(r,i,o)=>{let s=qt[i];if(s===void 0)return i+o;let l=(o.match(Kt)??[]).map((d,c)=>{let h=Number(d);if(s===-1)return String(h+n);if(s===-2)return String(h+t);let x=c%s;return s===7?x===5?String(h+n):x===6?String(h+t):d:String(x%2===0?h+n:h+t)});return i+l.join(" ")})}var kt=(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:Xt(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)"))),b={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)"},Ie=(e="neutral")=>e==="neutral"?b.axis:`var(--skdx-color-${e}-500)`;var Mt=(e,n)=>n??$e[e%$e.length];var Qt={top:16,right:16,bottom:32,left:48};function Oe(e,n,t=Qt){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 ne(e){let n=e.legend;if(n)return n===!0?{}:n.enabled===!1?void 0:n}function St(e){let n=e.tooltip;return n===void 0||n===!0?{enabled:!0}:n===!1?{enabled:!1}:{...n,enabled:n.enabled??!0}}var ue=20,Jt=120,Ct=e=>{let n=ne(e);return n&&(n.position==="left"||n.position==="right")?n.width??Jt:0},he=(e,n=600,t=300)=>({width:(e.width??n)-Ct(e),height:(e.height??t)-(ne(e)?.position==="bottom"?ue:0)}),ze=(e,n,t)=>{let r=ne(e);return!r||!(r.position===void 0||r.position==="top")?0:(n?Math.max(1,It(n,t??he(e).width,r)):1)*ue},B=6.5,Ae=(e,n,t)=>t??(e.palette&&e.palette.length>0?e.palette[n%e.palette.length]:Mt(n)),$t=(e,n)=>e.hiddenSeries?.includes(n)??!1;function Te(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,c=e.length-d.length,h=r.interactive??!0,x=o,$=i,k=(O,M,I,T)=>{let G=(M?18:4)+O.length*B;x>o&&(s||x+G>n-8)&&(x=o,$+=ue),M&&a.push({kind:"rect",part:"legend-swatch",x,y:$-5,width:10,height:10,fill:M,opacity:T?.3:void 0,item:I}),a.push({kind:"text",part:"legend-label",x:x+(M?14:0),y:$,text:O,baseline:"middle",fill:T?b.grid:b.label,item:I}),x+=G+12};for(let O of d){let M=t.includes(O.name),I=h?{label:O.name,series:O.name,legend:!0}:void 0;k(r.formatter?.(O.name)??O.name,O.color,I,M)}return c>0&&k(`+${c} more`,void 0,void 0,!1),r.align==="end"?en(a,n):a}function en(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*B)),s=n-8-o;for(let a of i)r.push({...a,x:a.x+s})}return r}var It=(e,n,t={})=>new Set(Te(e,n,[],t).flatMap(r=>r.kind==="text"?[r.y]:[])).size;function Le(e,n,t,r=[]){let i=ne(e),o=i&&e.direction==="rtl"&&i.align===void 0?{...i,align:"end"}:i,s=St(e),a=o?.position==="bottom",l=Ct(e),d=e.hiddenSeries??[],c=o?l?Te(r,1/0,d,o,10,(o.position==="right"?n:0)+8,!0):Te(r,n,d,o,a?t+10:10):[],h=a?It(r,n,o):0;return{width:n+l,height:a?t+Math.max(1,h)*ue: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:c}}function Pe(e){let n=e.legendOffset;if(!n)return e;let t=[...kt(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(x=>x.length))*B+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},c=Math.max(0,Math.min(r-a,d.x)),h=Math.max(0,Math.min(i-l,d.y));return[{kind:"rect",part:"tooltip",x:g(c),y:g(h),width:g(a),height:l,fill:"var(--skdx-color-surface-raised)",stroke:b.axis,rx:3},...s.map((x,$)=>({kind:"text",part:"tooltip-label",x:g(c+6),y:g(h+11+$*16),text:x,baseline:"middle",fill:"var(--skdx-color-text-default)",weight:s.length>1&&$===0?"bold":void 0}))]}function Tt(e,n){if(e.length<2)return e;let t=e.reduce((i,o)=>Math.max(i,o.label.length),0)*B+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 Ot(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:g(o/2),y:g(s/2),text:a,anchor:"middle",baseline:"middle",fill:i==="error"?"var(--skdx-color-text-danger)":b.label}),{...Le(e,o,s),shapes:l,tooltip:!1}}var H=(e,n,t,r={})=>({kind:"text",part:"label",x:e,y:n,text:t,fill:b.label,...r});function fe(e){return e==null?[]:(Array.isArray(e)?e:[e]).map(t=>typeof t=="object"?t:{id:t})}var Be=e=>e.id??e.name??e.series,zt=e=>e.seriesId??e.series;function D(e,n){let t=!1;return n.id!==void 0&&(t=!0,Be(e)!==n.id&&e.id!==n.id&&e.name!==n.id)||n.series!==void 0&&(t=!0,zt(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=Be(e);t!==void 0&&(n.id=t);let r=zt(e);return r!==void 0&&e.series!==void 0&&(n.series=r),e.index!==void 0&&(n.index=e.index),n}var Re=(e,n)=>e.id===n.id&&e.series===n.series&&e.index===n.index&&e.category===n.category;function Ne(e,n,t){let r=fe(e),i=_(n),o=r.some(s=>D(n,s));return t==="single"?o?[]:[i]:o?r.filter(s=>!D(n,s)):[...r,i]}var tn=.2;function nn(e){let n=b.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 rn=(e,n)=>e.kind==="text"?{...e,fill:b.grid}:{...e,opacity:(e.opacity??1)*n};function De(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=c=>!i||r.some(h=>D(c,h))?!0:o.highlighted==="series"?r.some(h=>h.series!==void 0&&D(c,{series:h.series})):!1,l=c=>{if(!i||o.faded==="none"||a(c))return!1;if(o.faded==="series"){let h=i.series;return h!==void 0&&D(c,{series:h})}return!0},d=e.shapes.map(c=>{let h=c.item;if(!h||h.legend)return c;if(t.some(x=>D(h,x))){let x=nn(c);x&&s.push(x)}return l(h)?rn(c,tn):c});return s.length?{...e,shapes:[...d,...s]}:{...e,shapes:d}}var Fe=14;function Ge(e){let n=[],t=e.events.map((p,y)=>({event:p,index:y,time:new Date(p.date).getTime()})).filter(p=>Number.isFinite(p.time)?!(p.event.group!==void 0&&$t(e,p.event.group)):(n.push({code:"invalid-value",severity:"warning",message:`Event "${p.event.label}" has an unparseable date and was dropped.`,itemId:p.event.id??p.event.label}),!1)).sort((p,y)=>p.time-y.time||p.index-y.index),r=Ot(e,t.length===0);if(r)return{...r,issues:n};let{width:i,height:o}=he(e),s=e.orientation==="vertical",a=[...new Set(e.events.map(p=>p.group).filter(p=>p!==void 0))],l=a.length?a:[""],[d,c]=Ce(t.map(p=>p.time)),h=e.xAxis?.format??{style:c-d<2*864e5?"time":"date"},x=p=>vt(p,h),$=e.labels??!0,k=t.map(p=>{let y=p.event.group,A=p.event.color??(p.event.variant?Ie(p.event.variant):Ae(e,y===void 0?0:a.indexOf(y))),N=p.event.description?` \u2014 ${p.event.description}`:"";return{...p,lane:y===void 0?0:a.indexOf(y),color:A,text:`${p.event.label} \xB7 ${x(p.time)}${N}`}}),O=a.map((p,y)=>({name:p,color:Ae(e,y)})),M=Le(e,i,o,O),I=p=>({label:p.text,id:p.event.id,name:p.event.label,category:p.event.group,index:p.index,value:p.time}),T=[];if(s){let p=Math.max(...k.map(P=>x(P.time).length))*B+16,y=Oe(i,o,{top:8+ze(e),right:8,bottom:8,left:p+12}),A=Se(k.length,[y.y,y.y+y.height],0),N=g(y.x);return T.push({kind:"line",part:"axis",x1:N,x2:N,y1:y.y,y2:y.y+y.height,stroke:b.axis}),k.forEach((P,ce)=>{let z=g(A.center(ce));if(T.push(H(g(y.x-12),z,x(P.time),{part:"x-label",anchor:"end",baseline:"middle"}),{kind:"circle",part:"event",cx:N,cy:z,r:5,fill:P.color,stroke:"var(--skdx-color-surface-default)",title:P.text,item:I(P)}),$){let X=P.event.description,de=A.step>=2*Fe&&X;T.push(H(g(y.x+12),de?g(z-7):z,P.event.label,{part:"event-label",baseline:"middle",fill:"var(--skdx-color-text-default)"})),de&&T.push(H(g(y.x+12),g(z+7),X,{part:"event-description",baseline:"middle"}))}}),{...M,shapes:[...T,...M.shapes],issues:n}}let G=a.length?Math.max(...a.map(p=>p.length))*B+16:8,se=Math.max(x(d).length,x(c).length)*B/2+4,S=Oe(i,o,{top:8+ze(e),right:Math.max(16,se),bottom:32+(e.xAxis?.label?14:0),left:Math.max(16,G,se)}),j=(c-d)*.04||36e5,ae=Me([d-j,c+j],[S.x,S.x+S.width]),we=wt(d-j,c+j).filter(p=>p>=d-j&&p<=c+j).map(p=>({pos:g(ae(p)),label:x(p)}));for(let p of Tt(we,S.width))T.push({kind:"line",part:"grid",x1:p.pos,x2:p.pos,y1:S.y,y2:S.y+S.height,stroke:b.grid},H(p.pos,S.y+S.height+20,p.label,{part:"x-label",anchor:"middle"}));e.xAxis?.label&&T.push(H(g(S.x+S.width/2),o-4,e.xAxis.label,{part:"axis-title",anchor:"middle"}));let Y=Se(l.length,[S.y,S.y+S.height],0),le=Math.max(0,Math.floor((Y.step/2-14)/Fe));l.forEach((p,y)=>{let A=g(Y.center(y));T.push({kind:"line",part:"axis",x1:S.x,x2:S.x+S.width,y1:A,y2:A,stroke:b.axis}),p&&T.push(H(S.x-8,A,p,{part:"y-label",anchor:"end",baseline:"middle"}))});let ke=l.map(()=>[]),q=[],gt=[];for(let p of k){let y=g(ae(p.time)),A=g(Y.center(p.lane));if(gt.push({kind:"circle",part:"event",cx:y,cy:A,r:5,fill:p.color,stroke:"var(--skdx-color-surface-default)",title:p.text,item:I(p)}),!$)continue;let N=p.event.label.length*B,P=y-N/2,ce=ke[p.lane],z=0;for(;z<=le&&(ce[z]??-1/0)>P-6;)z++;if(z>le)continue;ce[z]=P+N;let X=g(A-12-z*Fe),de=g(Math.max(N/2+2,Math.min(i-N/2-2,y)));z>0&&q.push({kind:"line",part:"connector",x1:y,x2:y,y1:g(A-6),y2:g(X+4),stroke:b.grid}),q.push(H(de,X,p.event.label,{part:"event-label",anchor:"middle",fill:"var(--skdx-color-text-default)"}))}return{...M,shapes:[...T,...q,...gt,...M.shapes],issues:n}}function K(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 je=(e,n,t)=>n>=e.x&&n<=e.x+e.width&&t>=e.y&&t<=e.y+e.height;function At(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 re(e,n){let t=e.hit;if(!t||t.xs.length===0)return;let r=At(t,n),i=t.rows[r]??[];return{index:r,rows:e.axisTooltipFormatter?.(i,r)??i}}function He(e,n){let t=e.hit;if(!t||t.xs.length===0)return;let r=t.xs[At(t,n)];return{kind:"line",part:"crosshair",x1:r,x2:r,y1:t.plot.y,y2:t.plot.y+t.plot.height,stroke:b.axis,dash:"3 3"}}function _e(e,n,t){let r=e.hit;if(!r||!r.crosshair||r.xs.length===0||!je(r.plot,n,t))return[];let i=He(e,n),{rows:o}=re(e,n),s=e.tooltipAnchored?r.plot.y+8:t;return[i,...pe(i.x1,s,o,e.width,e.height,e.tooltipPlacement)]}function Ve(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 _e(e,i,t.plot.y+8)}function Ze(e,n,t,r,i){if(!e.tooltip)return{lines:[],shapes:[]};if(e.hit?.crosshair){let{x:l,y:d}=K(t,r,i,e.width,e.height);if(je(e.hit.plot,l,d)){let c=re(e,l),h=He(e,l);if(c&&h)return{lines:c.rows,shapes:[h]}}}let o=n?.closest?.("[data-skdx-part]"),s=e.tooltipFormatter?V(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 Lt(e,n,t,r,i,o,s){let a=e?.closest?.("[data-skdx-part]"),l=s&&s.tooltipFormatter?V(s,e)?.item:void 0,d=l&&s?.tooltipFormatter?.(l)||a&&Array.from(a.children).find(k=>k.tagName.toLowerCase()==="title")?.textContent;if(!d)return[];let c=s?.tooltipAnchored?V(s,e):void 0,h=c?s?.shapes[c.index]:void 0,{x,y:$}=h?ie(h):K(n,t,r,i,o);return pe(x,$,d,i,o,s?.tooltipPlacement)}function Ee(e,n,t,r,i){if(!e.tooltip)return[];if(e.hit?.crosshair){let{x:o,y:s}=K(t,r,i,e.width,e.height),a=_e(e,o,s);if(a.length>0)return a}return Lt(n,t,r,i,e.width,e.height,e)}function We(e,n){let t=V(e,n);return t&&!t.item.legend?_(t.item):null}var on=(e,n)=>{let{x:t,y:r}=ie(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 Ue(e,n){let t=new Set,r=[];for(let i of e.shapes){if(!i.item||i.item.legend||i.part==="anchor"||!on(i,n))continue;let o=_(i.item),s=JSON.stringify(o);t.has(s)||(t.add(s),r.push(o))}return r}var Ke=e=>({kind:"rect",part:"selection-box",x:g(e.x),y:g(e.y),width:g(e.width),height:g(e.height),fill:b.focus,opacity:.12,stroke:b.focus}),xe=(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 Pt(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 Ye(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}=ie(i),a=i.kind==="circle"?i.cy:i.kind==="rect"?i.y+i.height/2:s;if(!Pt(n,o,a))continue;let l=_(i.item),d=JSON.stringify(l);t.has(d)||(t.add(d),r.push(l))}return r}var qe=e=>({kind:"path",part:"selection-lasso",d:e.length?`M${e.map(n=>`${g(n.x)} ${g(n.y)}`).join("L")}`:"",fill:b.focus,fillOpacity:.12,stroke:b.focus,dash:"4 3"}),me=6;function Xe(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 Qe(e,n,t){let r=e.edit;return Bt(r,n,r.invert(n.bar.x0+t)-r.invert(n.bar.x0))}function Je(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 Bt(r,{bar:o,mode:s},i*a)}function Bt(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 et(e,n,t){let r=e.edit,i=r.scale(t.start),o=r.scale(t.end);return{kind:"rect",part:"edit-ghost",x:g(Math.min(i,o)),y:g(n.bar.y),width:g(Math.max(1,Math.abs(o-i))),height:g(n.bar.height),fill:b.focus,opacity:.25,stroke:b.focus,rx:2}}var sn=64,an=e=>Math.max(1,Math.min(sn,e));function tt(e,n,t,r){let i=n>0?.8:1.25,o=an(e.view.zoom*i);if(o===e.view.zoom)return e.view;let{plot:s,scale:a}=e,[l,d]=e.view.center,c=(t-(s.x+s.width/2))/a,h=(r-(s.y+s.height/2))/a,x=e.view.zoom/o;return{center:[l+c*(1-x),e.fromY(e.toY(d)-h*(1-x))],zoom:o}}function nt(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 V(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 ge=e=>e.shapes.flatMap((n,t)=>n.item&&!n.item.legend?[t]:[]);function ie(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 rt(e,n){let t=n===null?void 0:e.shapes[n];if(!t)return[];let r=b.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*B+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}=ie(t),a=t.item&&e.tooltipFormatter?.(t.item)||(t.item?.label??t.title??"");return[i,...a?pe(g(o),g(s),a,e.width,e.height):[]]}function it(e,n,t){let r=ge(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 W=2,U=(e,n,t)=>{let r=Math.max(W,Math.min(t,Math.round(n))),i=Math.max(0,Math.min(t-r,Math.round(e)));return{start:i,end:i+r}},Rt=(e,n)=>!e||e.start<=0&&e.end>=n;function ot(e,n,t){if(e.count<=W||!e.plot.width)return;let{start:r,end:i}=e.zoom,o=i-r,s=n>0?1.25:.8,a=Math.max(W,Math.min(e.count,Math.round(o*s)));if(a===o)return n>0&&!Rt(e.zoom,e.count)?U(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 U(d-l*a,a,e.count)}function st(e,n,t,r){let i=n.end-n.start,o=Math.max(W,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 U(n.start+s*i-s*o,o,e.count)}function at(e,n,t){let r=n.end-n.start,i=e.plot.width/Math.max(1,r);return U(n.start-t/i,r,e.count)}function lt(e,n,t){let r=e.brush;if(!r||!je(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:U(s-o/2,o,e.count)}}function ct(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 U(t.start+o,t.end-t.start,e.count);if(n==="left")return{start:Math.max(0,Math.min(t.end-W,Math.round(t.start+o))),end:t.end};let s=Math.min(e.count,Math.max(t.start+W,Math.round(t.end+o)));return{start:t.start,end:s}}function ut(e,n){switch(n.type){case"svg":return Promise.resolve(dt(e,n.label,n.resolve));case"csv":return Promise.resolve(Gt(n.rows));case"png":{if(typeof document>"u"||typeof Image>"u")return Promise.reject(new Error("PNG export needs a browser"));let t=dt(e,n.label,n.resolve);return Ft(t,e.width,e.height,n.scale,n.background)}}}var F=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/"/g,"&quot;"),oe=e=>e.filter(([,n])=>n!==void 0&&n!=="").map(([n,t])=>` ${n}="${F(String(t))}"`).join("");function Nt(e){let n=e.title?`<title>${F(e.title)}</title>`:"",t=["data-skdx-part",e.part];switch(e.kind){case"path":return`<path${oe([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${oe([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${oe([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${oe([t,["cx",e.cx],["cy",e.cy],["r",e.r],["fill",e.fill],["stroke",e.stroke]])}>${n}</circle>`;case"text":return`<text${oe([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]])}>${F(e.text)}</text>`}}function Dt(e){let n=e.defs??[];return n.length===0?"":`<defs>${n.map(t=>`<linearGradient id="${F(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="${F(r.color)}"${r.opacity===void 0?"":` stop-opacity="${r.opacity}"`}/>`).join("")}</linearGradient>`).join("")}</defs>`}function dt(e,n,t){let r=Dt(e)+e.shapes.map(Nt).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="${F(n)}" font-family="${F(b.fontFamily)}" font-size="${F(b.fontSize)}"><title>${F(n)}</title>${r}</svg>`}function Ft(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 c=d.getContext("2d");if(!c)return s(new Error("canvas 2d context unavailable"));i&&(c.fillStyle=i,c.fillRect(0,0,d.width,d.height)),c.drawImage(l,0,0,d.width,d.height),d.toBlob(h=>h?o(h):s(new Error("toBlob failed")),"image/png")},l.onerror=()=>{URL.revokeObjectURL(a),s(new Error("svg could not be decoded"))},l.src=a})}function Gt(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 ht(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(c=>c.replace(/:\s[^:]*$/,""))],d=r.rows.map(c=>[c[0],...c.slice(1).map(h=>h.slice(h.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 pt=new Map;function be(e){let n=pt.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&&pt.delete(e)}},publish(o,s){Object.assign(r,o);for(let a of t)a(o,s)}};return pt.set(e,{group:i,listeners:t}),i}var jt='[data-skdx-part]:not([data-skdx-part^="tooltip"]):not([data-skdx-part="focus"]):not([data-skdx-part="crosshair"])',ft=`@keyframes skdx-in{from{opacity:0}to{opacity:1}}${jt}{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){${jt}{animation:none;transition:none}}`;function mt(e){let n=e.animate;return n&&e.shapes.length<=1500?`${n}ms`:void 0}import{css as ln,html as Z,LitElement as cn,nothing as C,svg as L}from"lit";import{property as f,state as R}from"lit/decorators.js";import{ifDefined as w}from"lit/directives/if-defined.js";var xt={fromAttribute:()=>!1},m=class extends cn{constructor(){super(...arguments);this.legend=!1;this.tooltip=!0;this.selectionMode="none";this.loading=!1;this.decorative=!1;this.accessibleTable=!1;this.zoomable=!1;this.editable=!1;this.crossFilter=!1;this.animated=!1;this.responsive=!1;this.tip=[];this.overlay=[];this.portal=null;this.highlightState=null;this.crossState=null;this.lastCross=null;this.pointers=new Map;this.hover=null;this.token={};this.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=[Ke(xe(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=[qe(i.points)];return}if(i?.grab==="edit"){if(!i.gantt)return;let{x:o}=this.viewBox(t,r);i.change=Qe(r,i.gantt,o-i.x),this.overlay=[et(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(nt(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(st(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"?at(r.hit,i.zoom,o-i.x):ct(r.hit,i.grab,i.zoom,o-i.x));return}if(r.tooltipPortal){let{lines:o,shapes:s}=Ze(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=Ee(r,t.target,t.currentTarget,t.clientX,t.clientY);(o.length>0||this.tip.length>0)&&(this.tip=o)}if(this.highlight(We(r,t.target)),this.syncId&&r.hit?.crosshair){let o=re(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=V(r,t.target)?.item.legend,a=this.canEdit(r)?Xe(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,c]=[...this.pointers.values()];this.drag={x:(d+c)/2,y:o,zoom:l.zoom,grab:"pinch",distance:Math.abs(d-c)||1}}else{let d=lt(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(Ue(o,xe(i.x,i.y,s,a))):i.grab==="lasso"?this.setSelected(Ye(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(tt(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=ot(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=V(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)?Je(r,this.focused,t):void 0;if(i){t.preventDefault(),this.emit("skdx-task-change",i);return}let o=it(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:d,emptyMessage:c,description:h,decorative:x,animated:$,responsive:k,highlighted:O,highlightScope:M,accessibleTable:I}=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:$,responsive:k,legend:i,tooltip:o,format:s,palette:a,loading:l,error:d,emptyMessage:c,description:h,decorative:x,highlighted:O===void 0?this.highlightState:O,highlightScope:M,accessibleTable:I,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&&be(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=be(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&&Re(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(Ne(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 K(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&&D(o.item,t));return i<0?!1:(this.getSvgElement()?.focus(),this.focused=i,!0)}export(t){let r=this.layout;return r?ut(r,{...t,label:t.label??this.label??this.localName}):Promise.reject(new Error("not rendered yet"))}root(t,r,i){this.join();let o=De(Pe(t),this.sized());if(this.layout=o,o.issues!==this.reported){this.reported=o.issues;for(let I of o.issues??[])this.emit("skdx-data-issue",I)}let s=this.canZoom(o),a=this.canPan(o),l=this.canEdit(o),d=this.brushing(),c=s||a||l||d,h=!o.decorative&&ge(o).length>0,x=o.description?`${r}-desc`:void 0,$=mt(o),k=ht(o,this.accessibleTable),O=typeof this.accessibleTable=="object"&&this.accessibleTable.caption||i,M=this.portal;return Z`<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 @@ var jt=Object.defineProperty;var Ht=Object.getOwnPropertyDescriptor;var u=(e,n,t
30
30
  <title>${i}</title>
31
31
  ${o.description?L`<desc id=${w(x)}>${o.description}</desc>`:C}
32
32
  ${$?L`<style>${ft}</style>`:C} ${dn(o)}
33
- ${be(o.shapes)}
34
- ${be(this.tip.length||!this.crossState?this.tip:Ve(o,this.crossState))}
35
- ${be(rt(o,this.focused))} ${be(this.overlay)}
33
+ ${ye(o.shapes)}
34
+ ${ye(this.tip.length||!this.crossState?this.tip:Ve(o,this.crossState))}
35
+ ${ye(rt(o,this.focused))} ${ye(this.overlay)}
36
36
  </svg>
37
37
  ${M?Z`<div
38
38
  role="tooltip"
@@ -106,4 +106,4 @@ var jt=Object.defineProperty;var Ht=Object.getOwnPropertyDescriptor;var u=(e,n,t
106
106
  [role='tooltip'] > :first-child:not(:only-child) {
107
107
  font-weight: bold;
108
108
  }
109
- `,u([f({type:Number})],m.prototype,"width",2),u([f({type:Number})],m.prototype,"height",2),u([f()],m.prototype,"label",2),u([f({type:Boolean,reflect:!0})],m.prototype,"legend",2),u([f({type:Boolean,attribute:"no-tooltip",converter:xt})],m.prototype,"tooltip",2),u([f({attribute:!1})],m.prototype,"format",2),u([f({attribute:!1})],m.prototype,"palette",2),u([f({attribute:!1})],m.prototype,"hiddenSeries",2),u([f({attribute:!1})],m.prototype,"selected",2),u([f({attribute:"selection-mode"})],m.prototype,"selectionMode",2),u([f({attribute:!1})],m.prototype,"highlighted",2),u([f({attribute:!1})],m.prototype,"highlightScope",2),u([f({type:Boolean,reflect:!0})],m.prototype,"loading",2),u([f()],m.prototype,"error",2),u([f({attribute:"empty-message"})],m.prototype,"emptyMessage",2),u([f()],m.prototype,"description",2),u([f({type:Boolean,reflect:!0})],m.prototype,"decorative",2),u([f({type:Boolean,attribute:"accessible-table"})],m.prototype,"accessibleTable",2),u([f({attribute:!1})],m.prototype,"zoom",2),u([f({attribute:!1})],m.prototype,"view",2),u([f({type:Boolean,reflect:!0})],m.prototype,"zoomable",2),u([f({type:Boolean,reflect:!0})],m.prototype,"editable",2),u([f({attribute:"sync-id"})],m.prototype,"syncId",2),u([f({type:Boolean,attribute:"cross-filter"})],m.prototype,"crossFilter",2),u([f({converter:{fromAttribute:t=>t===null?!1:t===""?!0:Number(t)}})],m.prototype,"animated",2),u([f({type:Boolean,reflect:!0})],m.prototype,"responsive",2),u([R()],m.prototype,"tip",2),u([R()],m.prototype,"overlay",2),u([R()],m.prototype,"portal",2),u([R()],m.prototype,"measured",2),u([R()],m.prototype,"viewState",2),u([R()],m.prototype,"highlightState",2),u([R()],m.prototype,"crossState",2),u([R()],m.prototype,"focused",2),u([R()],m.prototype,"hiddenState",2),u([R()],m.prototype,"zoomState",2),u([R()],m.prototype,"selectedState",2);var v=class extends m{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:c,connectNulls:h,nulls:x,stacked:$,stackOffset:k,orientation:O,radius:M,barGap:I,barWidth:T,sort:G,transform:se,transforms:S,bins:j,binWidth:ae,binDomain:ve,binMode:Y,sampling:le,brush:we,crosshair:q}=this;return{...this.sized(),series:t,categories:r,xAxis:i,yAxis:o,rightAxis:s,references:a,annotations:l,labels:d,curve:c,connectNulls:h,nulls:x,stacked:$,stackOffset:k,orientation:O,radius:M,barGap:I,barWidth:T,sort:G,transform:se,transforms:S,bins:j,binWidth:ae,binDomain:ve,binMode:Y,sampling:le,brush:we,crosshair:q}}};u([f({attribute:!1})],v.prototype,"series",2),u([f({attribute:!1})],v.prototype,"categories",2),u([f({attribute:!1})],v.prototype,"xAxis",2),u([f({attribute:!1})],v.prototype,"yAxis",2),u([f({attribute:!1})],v.prototype,"rightAxis",2),u([f({attribute:!1})],v.prototype,"references",2),u([f({attribute:!1})],v.prototype,"annotations",2),u([f({type:Boolean,reflect:!0})],v.prototype,"labels",2),u([f()],v.prototype,"curve",2),u([f({type:Boolean,attribute:"connect-nulls"})],v.prototype,"connectNulls",2),u([f()],v.prototype,"nulls",2),u([f({reflect:!0,converter:{fromAttribute:t=>t==="percent"?"percent":t!==null}})],v.prototype,"stacked",2),u([f({attribute:"stack-offset"})],v.prototype,"stackOffset",2),u([f()],v.prototype,"orientation",2),u([f({type:Number})],v.prototype,"radius",2),u([f({type:Number,attribute:"bar-gap"})],v.prototype,"barGap",2),u([f({type:Number,attribute:"bar-width"})],v.prototype,"barWidth",2),u([f()],v.prototype,"sort",2),u([f()],v.prototype,"transform",2),u([f({attribute:!1})],v.prototype,"transforms",2),u([f({type:Number})],v.prototype,"bins",2),u([f({type:Number,attribute:"bin-width"})],v.prototype,"binWidth",2),u([f({attribute:!1})],v.prototype,"binDomain",2),u([f({attribute:"bin-mode"})],v.prototype,"binMode",2),u([f({attribute:!1})],v.prototype,"sampling",2),u([f({type:Boolean,reflect:!0})],v.prototype,"brush",2),u([f({type:Boolean,reflect:!0})],v.prototype,"crosshair",2);var dn=e=>e.defs&&e.defs.length?L`<defs>${e.defs.map(n=>L`<linearGradient id=${n.id} x1="0" y1="0" x2=${n.vertical===!1?1:0} y2=${n.vertical===!1?0:1}>${n.stops.map(t=>L`<stop offset=${t.offset} stop-color=${t.color} stop-opacity=${w(t.opacity)}></stop>`)}</linearGradient>`)}</defs>`:C,be=e=>L`${e.map((n,t)=>{let r=n.title?L`<title>${n.title}</title>`:C,i=n.item?t:void 0;switch(n.kind){case"path":return L`<path data-skdx-part=${n.part} data-skdx-i=${w(i)} d=${n.d} fill=${n.fill??"none"} stroke=${w(n.stroke)} stroke-width=${w(n.strokeWidth)} stroke-linecap=${w(n.strokeLinecap)} stroke-linejoin=${w(n.strokeLinejoin)} stroke-dasharray=${w(n.dash)} opacity=${w(n.opacity)} fill-opacity=${w(n.fillOpacity)}>${r}</path>`;case"rect":return L`<rect data-skdx-part=${n.part} data-skdx-i=${w(i)} x=${n.x} y=${n.y} width=${n.width} height=${n.height} rx=${w(n.rx)} fill=${n.fill} stroke=${w(n.stroke)} fill-opacity=${w(n.opacity)}>${r}</rect>`;case"line":return L`<line data-skdx-part=${n.part} data-skdx-i=${w(i)} x1=${n.x1} y1=${n.y1} x2=${n.x2} y2=${n.y2} stroke=${n.stroke} stroke-width=${w(n.strokeWidth)} stroke-dasharray=${w(n.dash)} opacity=${w(n.opacity)}>${r}</line>`;case"circle":return L`<circle data-skdx-part=${n.part} data-skdx-i=${w(i)} cx=${n.cx} cy=${n.cy} r=${n.r} fill=${n.fill} stroke=${w(n.stroke)} opacity=${w(n.opacity)}>${r}</circle>`;case"text":return L`<text data-skdx-part=${n.part} data-skdx-i=${w(i)} x=${n.x} y=${n.y} text-anchor=${w(n.anchor)} dominant-baseline=${w(n.baseline)} fill=${w(n.fill)} font-weight=${w(n.weight)} pointer-events=${w(i===void 0?"none":void 0)} transform=${w(n.rotate?`rotate(${n.rotate} ${n.x} ${n.y})`:void 0)}>${n.text}</text>`}})}`;var E=class extends m{constructor(){super(...arguments);this.events=[];this.labels=!0}render(){let{events:t,orientation:r,xAxis:i,labels:o}=this;return this.root(Ge({...this.sized(),events:t,orientation:r,xAxis:i,labels:o}),"timeline",this.label??"Timeline chart")}};u([ye({attribute:!1})],E.prototype,"events",2),u([ye()],E.prototype,"orientation",2),u([ye({attribute:!1})],E.prototype,"xAxis",2),u([ye({type:Boolean,attribute:"no-labels",converter:xt})],E.prototype,"labels",2),E=u([un("skdx-timeline-chart")],E);export{E as SkdxTimelineChart};
109
+ `,u([f({type:Number})],m.prototype,"width",2),u([f({type:Number})],m.prototype,"height",2),u([f()],m.prototype,"label",2),u([f({type:Boolean,reflect:!0})],m.prototype,"legend",2),u([f({type:Boolean,attribute:"no-tooltip",converter:xt})],m.prototype,"tooltip",2),u([f({attribute:!1})],m.prototype,"format",2),u([f({attribute:!1})],m.prototype,"palette",2),u([f({attribute:!1})],m.prototype,"hiddenSeries",2),u([f({attribute:!1})],m.prototype,"selected",2),u([f({attribute:"selection-mode"})],m.prototype,"selectionMode",2),u([f({attribute:!1})],m.prototype,"highlighted",2),u([f({attribute:!1})],m.prototype,"highlightScope",2),u([f({type:Boolean,reflect:!0})],m.prototype,"loading",2),u([f()],m.prototype,"error",2),u([f({attribute:"empty-message"})],m.prototype,"emptyMessage",2),u([f()],m.prototype,"description",2),u([f({type:Boolean,reflect:!0})],m.prototype,"decorative",2),u([f({type:Boolean,attribute:"accessible-table"})],m.prototype,"accessibleTable",2),u([f({attribute:!1})],m.prototype,"zoom",2),u([f({attribute:!1})],m.prototype,"view",2),u([f({type:Boolean,reflect:!0})],m.prototype,"zoomable",2),u([f({type:Boolean,reflect:!0})],m.prototype,"editable",2),u([f({attribute:"sync-id"})],m.prototype,"syncId",2),u([f({type:Boolean,attribute:"cross-filter"})],m.prototype,"crossFilter",2),u([f({converter:{fromAttribute:t=>t===null?!1:t===""?!0:Number(t)}})],m.prototype,"animated",2),u([f({type:Boolean,reflect:!0})],m.prototype,"responsive",2),u([R()],m.prototype,"tip",2),u([R()],m.prototype,"overlay",2),u([R()],m.prototype,"portal",2),u([R()],m.prototype,"measured",2),u([R()],m.prototype,"viewState",2),u([R()],m.prototype,"highlightState",2),u([R()],m.prototype,"crossState",2),u([R()],m.prototype,"focused",2),u([R()],m.prototype,"hiddenState",2),u([R()],m.prototype,"zoomState",2),u([R()],m.prototype,"selectedState",2);var v=class extends m{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:c,connectNulls:h,nulls:x,stacked:$,stackOffset:k,orientation:O,radius:M,barGap:I,barWidth:T,sort:G,transform:se,transforms:S,bins:j,binWidth:ae,binDomain:we,binMode:Y,sampling:le,brush:ke,crosshair:q}=this;return{...this.sized(),series:t,categories:r,xAxis:i,yAxis:o,rightAxis:s,references:a,annotations:l,labels:d,curve:c,connectNulls:h,nulls:x,stacked:$,stackOffset:k,orientation:O,radius:M,barGap:I,barWidth:T,sort:G,transform:se,transforms:S,bins:j,binWidth:ae,binDomain:we,binMode:Y,sampling:le,brush:ke,crosshair:q}}};u([f({attribute:!1})],v.prototype,"series",2),u([f({attribute:!1})],v.prototype,"categories",2),u([f({attribute:!1})],v.prototype,"xAxis",2),u([f({attribute:!1})],v.prototype,"yAxis",2),u([f({attribute:!1})],v.prototype,"rightAxis",2),u([f({attribute:!1})],v.prototype,"references",2),u([f({attribute:!1})],v.prototype,"annotations",2),u([f({type:Boolean,reflect:!0})],v.prototype,"labels",2),u([f()],v.prototype,"curve",2),u([f({type:Boolean,attribute:"connect-nulls"})],v.prototype,"connectNulls",2),u([f()],v.prototype,"nulls",2),u([f({reflect:!0,converter:{fromAttribute:t=>t==="percent"?"percent":t!==null}})],v.prototype,"stacked",2),u([f({attribute:"stack-offset"})],v.prototype,"stackOffset",2),u([f()],v.prototype,"orientation",2),u([f({type:Number})],v.prototype,"radius",2),u([f({type:Number,attribute:"bar-gap"})],v.prototype,"barGap",2),u([f({type:Number,attribute:"bar-width"})],v.prototype,"barWidth",2),u([f()],v.prototype,"sort",2),u([f()],v.prototype,"transform",2),u([f({attribute:!1})],v.prototype,"transforms",2),u([f({type:Number})],v.prototype,"bins",2),u([f({type:Number,attribute:"bin-width"})],v.prototype,"binWidth",2),u([f({attribute:!1})],v.prototype,"binDomain",2),u([f({attribute:"bin-mode"})],v.prototype,"binMode",2),u([f({attribute:!1})],v.prototype,"sampling",2),u([f({type:Boolean,reflect:!0})],v.prototype,"brush",2),u([f({type:Boolean,reflect:!0})],v.prototype,"crosshair",2);var dn=e=>e.defs&&e.defs.length?L`<defs>${e.defs.map(n=>L`<linearGradient id=${n.id} x1="0" y1="0" x2=${n.vertical===!1?1:0} y2=${n.vertical===!1?0:1}>${n.stops.map(t=>L`<stop offset=${t.offset} stop-color=${t.color} stop-opacity=${w(t.opacity)}></stop>`)}</linearGradient>`)}</defs>`:C,ye=e=>L`${e.map((n,t)=>{let r=n.title?L`<title>${n.title}</title>`:C,i=n.item?t:void 0;switch(n.kind){case"path":return L`<path data-skdx-part=${n.part} data-skdx-i=${w(i)} d=${n.d} fill=${n.fill??"none"} stroke=${w(n.stroke)} stroke-width=${w(n.strokeWidth)} stroke-linecap=${w(n.strokeLinecap)} stroke-linejoin=${w(n.strokeLinejoin)} stroke-dasharray=${w(n.dash)} opacity=${w(n.opacity)} fill-opacity=${w(n.fillOpacity)}>${r}</path>`;case"rect":return L`<rect data-skdx-part=${n.part} data-skdx-i=${w(i)} x=${n.x} y=${n.y} width=${n.width} height=${n.height} rx=${w(n.rx)} fill=${n.fill} stroke=${w(n.stroke)} fill-opacity=${w(n.opacity)}>${r}</rect>`;case"line":return L`<line data-skdx-part=${n.part} data-skdx-i=${w(i)} x1=${n.x1} y1=${n.y1} x2=${n.x2} y2=${n.y2} stroke=${n.stroke} stroke-width=${w(n.strokeWidth)} stroke-dasharray=${w(n.dash)} opacity=${w(n.opacity)}>${r}</line>`;case"circle":return L`<circle data-skdx-part=${n.part} data-skdx-i=${w(i)} cx=${n.cx} cy=${n.cy} r=${n.r} fill=${n.fill} stroke=${w(n.stroke)} opacity=${w(n.opacity)}>${r}</circle>`;case"text":return L`<text data-skdx-part=${n.part} data-skdx-i=${w(i)} x=${n.x} y=${n.y} text-anchor=${w(n.anchor)} dominant-baseline=${w(n.baseline)} fill=${w(n.fill)} font-weight=${w(n.weight)} pointer-events=${w(i===void 0?"none":void 0)} transform=${w(n.rotate?`rotate(${n.rotate} ${n.x} ${n.y})`:void 0)}>${n.text}</text>`}})}`;var E=class extends m{constructor(){super(...arguments);this.events=[];this.labels=!0}render(){let{events:t,orientation:r,xAxis:i,labels:o}=this;return this.root(Ge({...this.sized(),events:t,orientation:r,xAxis:i,labels:o}),"timeline",this.label??"Timeline chart")}};u([ve({attribute:!1})],E.prototype,"events",2),u([ve()],E.prototype,"orientation",2),u([ve({attribute:!1})],E.prototype,"xAxis",2),u([ve({type:Boolean,attribute:"no-labels",converter:xt})],E.prototype,"labels",2),E=u([un("skdx-timeline-chart")],E);export{E as SkdxTimelineChart};
package/dist/tree.cjs CHANGED
@@ -1,5 +1,5 @@
1
- "use strict";var ue=Object.defineProperty;var $t=Object.getOwnPropertyDescriptor;var Kt=Object.getOwnPropertyNames;var Yt=Object.prototype.hasOwnProperty;var qt=(e,n)=>{for(var t in n)ue(e,t,{get:n[t],enumerable:!0})},Xt=(e,n,t,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of Kt(n))!Yt.call(e,i)&&i!==t&&ue(e,i,{get:()=>n[i],enumerable:!(r=$t(n,i))||r.enumerable});return e};var Qt=e=>Xt(ue({},"__esModule",{value:!0}),e),c=(e,n,t,r)=>{for(var i=r>1?void 0:r?$t(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&&ue(n,t,i),i};var xn={};qt(xn,{SkdxTreeChart:()=>z});module.exports=Qt(xn);var O=require("lit/decorators.js");var kt=e=>Number(e.toPrecision(12)),Jt,en=e=>(Jt??(Jt=new Intl.NumberFormat)).format(kt(e)),tn=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 St(e){if(e===void 0)return en;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(x=>p.format(kt(x)))},d=u=>{let p=new Intl.DateTimeFormat(t,o?{...u,timeZone:o}:u);return x=>p.format(x)};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(tn)}}var m=e=>Number(e.toFixed(2)),pe=e=>typeof e=="number"&&Number.isFinite(e);var ne=1e3,re=60*ne,ie=60*re,he=24*ie,wn=[ne,5*ne,15*ne,30*ne,re,5*re,15*re,30*re,ie,3*ie,6*ie,12*ie,he,2*he,7*he,14*he];var nn=/-?\d*\.?\d+(?:e[-+]?\d+)?/gi,rn=/([MLTHVCSQAZmlthvcsqaz])([^MLTHVCSQAZmlthvcsqaz]*)/g,on={M:2,L:2,T:2,C:6,S:4,Q:4,A:7,H:-1,V:-2};function sn(e,n,t){return e.replace(rn,(r,i,o)=>{let s=on[i];if(s===void 0)return i+o;let l=(o.match(nn)??[]).map((d,u)=>{let p=Number(d);if(s===-1)return String(p+n);if(s===-2)return String(p+t);let x=u%s;return s===7?x===5?String(p+n):x===6?String(p+t):d:String(x%2===0?p+n:p+t)});return i+l.join(" ")})}var Ct=(e,n,t)=>e.map(r=>{switch(r.kind){case"rect":return{...r,x:r.x+n,y:r.y+t};case"circle":return{...r,cx:r.cx+n,cy:r.cy+t};case"line":return{...r,x1:r.x1+n,x2:r.x2+n,y1:r.y1+t,y2:r.y2+t};case"text":return{...r,x:r.x+n,y:r.y+t};case"path":return{...r,d:sn(r.d,n,t)}}});var Oe=["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)"))),v={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??Oe[e%Oe.length];var an={top:16,right:16,bottom:32,left:48};function It(e,n,t=an){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 oe(e){let n=e.legend;if(n)return n===!0?{}:n.enabled===!1?void 0:n}function Tt(e){let n=e.tooltip;return n===void 0||n===!0?{enabled:!0}:n===!1?{enabled:!1}:{...n,enabled:n.enabled??!0}}var fe=20,ln=120,zt=e=>{let n=oe(e);return n&&(n.position==="left"||n.position==="right")?n.width??ln:0},Le=(e,n=600,t=300)=>({width:(e.width??n)-zt(e),height:(e.height??t)-(oe(e)?.position==="bottom"?fe:0)}),Pe=e=>{let n=oe(e);return n&&(n.position===void 0||n.position==="top")?fe:0},U=6.5,Ot=(e,n,t)=>t??(e.palette&&e.palette.length>0?e.palette[n%e.palette.length]:Mt(n));function Ae(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,x=o,k=i,S=($,M,I,A)=>{let H=(M?18:4)+$.length*U;x>o&&(s||x+H>n-8)&&(x=o,k+=fe),M&&a.push({kind:"rect",part:"legend-swatch",x,y:k-5,width:10,height:10,fill:M,opacity:A?.3:void 0,item:I}),a.push({kind:"text",part:"legend-label",x:x+(M?14:0),y:k,text:$,baseline:"middle",fill:A?v.grid:v.label,item:I}),x+=H+12};for(let $ of d){let M=t.includes($.name),I=p?{label:$.name,series:$.name,legend:!0}:void 0;S(r.formatter?.($.name)??$.name,$.color,I,M)}return u>0&&S(`+${u} more`,void 0,void 0,!1),r.align==="end"?cn(a,n):a}function cn(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*U)),s=n-8-o;for(let a of i)r.push({...a,x:a.x+s})}return r}var dn=(e,n,t={})=>new Set(Ae(e,n,[],t).flatMap(r=>r.kind==="text"?[r.y]:[])).size;function Ne(e,n,t,r=[]){let i=oe(e),o=i&&e.direction==="rtl"&&i.align===void 0?{...i,align:"end"}:i,s=Tt(e),a=o?.position==="bottom",l=zt(e),d=e.hiddenSeries??[],u=o?l?Ae(r,1/0,d,o,10,(o.position==="right"?n:0)+8,!0):Ae(r,n,d,o,a?t+10:10):[],p=a?dn(r,n,o):0;return{width:n+l,height:a?t+Math.max(1,p)*fe: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 Be(e){let n=e.legendOffset;if(!n)return e;let t=[...Ct(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 me(e,n,t,r,i,o="auto"){let s=Array.isArray(t)?t:[t],a=Math.max(...s.map(x=>x.length))*U+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:m(u),y:m(p),width:m(a),height:l,fill:"var(--skdx-color-surface-raised)",stroke:v.axis,rx:3},...s.map((x,k)=>({kind:"text",part:"tooltip-label",x:m(u+6),y:m(p+11+k*16),text:x,baseline:"middle",fill:"var(--skdx-color-text-default)",weight:s.length>1&&k===0?"bold":void 0}))]}function At(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}=Le(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:m(o/2),y:m(s/2),text:a,anchor:"middle",baseline:"middle",fill:i==="error"?"var(--skdx-color-text-danger)":v.label}),{...Ne(e,o,s),shapes:l,tooltip:!1}}var K=(e,n,t,r={})=>({kind:"text",part:"label",x:e,y:n,text:t,fill:v.label,...r});function be(e){return e==null?[]:(Array.isArray(e)?e:[e]).map(t=>typeof t=="object"?t:{id:t})}var Re=e=>e.id??e.name??e.series,Lt=e=>e.seriesId??e.series;function G(e,n){let t=!1;return n.id!==void 0&&(t=!0,Re(e)!==n.id&&e.id!==n.id&&e.name!==n.id)||n.series!==void 0&&(t=!0,Lt(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=Re(e);t!==void 0&&(n.id=t);let r=Lt(e);return r!==void 0&&e.series!==void 0&&(n.series=r),e.index!==void 0&&(n.index=e.index),n}var De=(e,n)=>e.id===n.id&&e.series===n.series&&e.index===n.index&&e.category===n.category;function Fe(e,n,t){let r=be(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 un=.2;function hn(e){let n=v.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 pn=(e,n)=>e.kind==="text"?{...e,fill:v.grid}:{...e,opacity:(e.opacity??1)*n};function Ge(e,n){let t=be(n.selected),r=n.highlighted===void 0||n.highlighted===null?[]:be(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=>G(u,p))?!0:o.highlighted==="series"?r.some(p=>p.series!==void 0&&G(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&&G(u,{series:p})}return!0},d=e.shapes.map(u=>{let p=u.item;if(!p||p.legend)return u;if(t.some(x=>G(p,x))){let x=hn(u);x&&s.push(x)}return l(p)?pn(u,un):u});return s.length?{...e,shapes:[...d,...s]}:{...e,shapes:d}}function Q(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 je=(e,n,t)=>n>=e.x&&n<=e.x+e.width&&t>=e.y&&t<=e.y+e.height;function Pt(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 se(e,n){let t=e.hit;if(!t||t.xs.length===0)return;let r=Pt(t,n),i=t.rows[r]??[];return{index:r,rows:e.axisTooltipFormatter?.(i,r)??i}}function He(e,n){let t=e.hit;if(!t||t.xs.length===0)return;let r=t.xs[Pt(t,n)];return{kind:"line",part:"crosshair",x1:r,x2:r,y1:t.plot.y,y2:t.plot.y+t.plot.height,stroke:v.axis,dash:"3 3"}}function Ve(e,n,t){let r=e.hit;if(!r||!r.crosshair||r.xs.length===0||!je(r.plot,n,t))return[];let i=He(e,n),{rows:o}=se(e,n),s=e.tooltipAnchored?r.plot.y+8:t;return[i,...me(i.x1,s,o,e.width,e.height,e.tooltipPlacement)]}function Ze(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 Ve(e,i,t.plot.y+8)}function _e(e,n,t,r,i){if(!e.tooltip)return{lines:[],shapes:[]};if(e.hit?.crosshair){let{x:l,y:d}=Q(t,r,i,e.width,e.height);if(je(e.hit.plot,l,d)){let u=se(e,l),p=He(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(S=>S.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,y:k}=p?ae(p):Q(n,t,r,i,o);return me(x,k,d,i,o,s?.tooltipPlacement)}function We(e,n,t,r,i){if(!e.tooltip)return[];if(e.hit?.crosshair){let{x:o,y:s}=Q(t,r,i,e.width,e.height),a=Ve(e,o,s);if(a.length>0)return a}return Nt(n,t,r,i,e.width,e.height,e)}function Ee(e,n){let t=W(e,n);return t&&!t.item.legend?_(t.item):null}var fn=(e,n)=>{let{x:t,y:r}=ae(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 Ue(e,n){let t=new Set,r=[];for(let i of e.shapes){if(!i.item||i.item.legend||i.part==="anchor"||!fn(i,n))continue;let o=_(i.item),s=JSON.stringify(o);t.has(s)||(t.add(s),r.push(o))}return r}var Ke=e=>({kind:"rect",part:"selection-box",x:m(e.x),y:m(e.y),width:m(e.width),height:m(e.height),fill:v.focus,opacity:.12,stroke:v.focus}),xe=(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 Bt(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 Ye(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}=ae(i),a=i.kind==="circle"?i.cy:i.kind==="rect"?i.y+i.height/2:s;if(!Bt(n,o,a))continue;let l=_(i.item),d=JSON.stringify(l);t.has(d)||(t.add(d),r.push(l))}return r}var qe=e=>({kind:"path",part:"selection-lasso",d:e.length?`M${e.map(n=>`${m(n.x)} ${m(n.y)}`).join("L")}`:"",fill:v.focus,fillOpacity:.12,stroke:v.focus,dash:"4 3"}),ge=6;function Xe(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 Qe(e,n,t){let r=e.edit;return Rt(r,n,r.invert(n.bar.x0+t)-r.invert(n.bar.x0))}function Je(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 Rt(r,{bar:o,mode:s},i*a)}function Rt(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 et(e,n,t){let r=e.edit,i=r.scale(t.start),o=r.scale(t.end);return{kind:"rect",part:"edit-ghost",x:m(Math.min(i,o)),y:m(n.bar.y),width:m(Math.max(1,Math.abs(o-i))),height:m(n.bar.height),fill:v.focus,opacity:.25,stroke:v.focus,rx:2}}var mn=64,bn=e=>Math.max(1,Math.min(mn,e));function tt(e,n,t,r){let i=n>0?.8:1.25,o=bn(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,x=e.view.zoom/o;return{center:[l+u*(1-x),e.fromY(e.toY(d)-p*(1-x))],zoom:o}}function nt(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 ye=e=>e.shapes.flatMap((n,t)=>n.item&&!n.item.legend?[t]:[]);function ae(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 rt(e,n){let t=n===null?void 0:e.shapes[n];if(!t)return[];let r=v.focus,i;switch(t.kind){case"rect":i={kind:"rect",part:"focus",x:t.x-2,y:t.y-2,width:t.width+4,height:t.height+4,fill:"none",stroke:r,rx:2};break;case"circle":i={kind:"circle",part:"focus",cx:t.cx,cy:t.cy,r:t.r+3,fill:"none",stroke:r};break;case"line":i={kind:"line",part:"focus",x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:r,strokeWidth:4};break;case"text":i={kind:"rect",part:"focus",x:t.x-2,y:t.y-8,width:t.text.length*U+4,height:16,fill:"none",stroke:r,rx:2};break;case"path":i={kind:"path",part:"focus",d:t.d,stroke:r,strokeWidth:2,fill:"none"};break}let{x:o,y:s}=ae(t),a=t.item&&e.tooltipFormatter?.(t.item)||(t.item?.label??t.title??"");return[i,...a?me(m(o),m(s),a,e.width,e.height):[]]}function it(e,n,t){let r=ye(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,X=(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 ot(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)?X(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 X(d-l*a,a,e.count)}function st(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 X(n.start+s*i-s*o,o,e.count)}function at(e,n,t){let r=n.end-n.start,i=e.plot.width/Math.max(1,r);return X(n.start-t/i,r,e.count)}function lt(e,n,t){let r=e.brush;if(!r||!je(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:X(s-o/2,o,e.count)}}function ct(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 X(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 ut(e,n){switch(n.type){case"svg":return Promise.resolve(dt(e,n.label,n.resolve));case"csv":return Promise.resolve(Ht(n.rows));case"png":{if(typeof document>"u"||typeof Image>"u")return Promise.reject(new Error("PNG export needs a browser"));let t=dt(e,n.label,n.resolve);return jt(t,e.width,e.height,n.scale,n.background)}}}var j=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/"/g,"&quot;"),le=e=>e.filter(([,n])=>n!==void 0&&n!=="").map(([n,t])=>` ${n}="${j(String(t))}"`).join("");function Ft(e){let n=e.title?`<title>${j(e.title)}</title>`:"",t=["data-skdx-part",e.part];switch(e.kind){case"path":return`<path${le([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${le([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${le([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${le([t,["cx",e.cx],["cy",e.cy],["r",e.r],["fill",e.fill],["stroke",e.stroke]])}>${n}</circle>`;case"text":return`<text${le([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 Gt(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 dt(e,n,t){let r=Gt(e)+e.shapes.map(Ft).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(v.fontFamily)}" font-size="${j(v.fontSize)}"><title>${j(n)}</title>${r}</svg>`}function jt(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 Ht(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
- `)}var ve=e=>pe(e.value)?e.value:(e.children??[]).reduce((n,t)=>n+ve(t),0);var we=e=>e.id??e.name;function Vt(e,n){for(let t of e){if(we(t)===n||t.name===n)return[t];let r=Vt(t.children??[],n);if(r)return[t,...r]}}function ht(e,n,t=1){return n===void 0?[...e]:e.map(r=>t>=n?{...r,value:ve(r),children:void 0}:{...r,children:r.children?ht(r.children,n,t+1):void 0})}function Zt(e,n){if(n===void 0)return{nodes:[...e],path:[]};let t=Vt(e,n);if(!t)return{nodes:[...e],path:[]};let r=t[t.length-1];return{nodes:r.children?.length?r.children:[r],path:t}}function pt(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 ft=new Map;function $e(e){let n=ft.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&&ft.delete(e)}},publish(o,s){Object.assign(r,o);for(let a of t)a(o,s)}};return ft.set(e,{group:i,listeners:t}),i}var _t='[data-skdx-part]:not([data-skdx-part^="tooltip"]):not([data-skdx-part="focus"]):not([data-skdx-part="crosshair"])',mt=`@keyframes skdx-in{from{opacity:0}to{opacity:1}}${_t}{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){${_t}{animation:none;transition:none}}`;function bt(e){let n=e.animate;return n&&e.shapes.length<=1500?`${n}ms`:void 0}function gt(e){let{nodes:n,path:t}=Zt(e.data,e.rootId),r=ht(n,e.maxDepth),i=At(e,r.length===0);if(i)return i;let o=St(e.format),{width:s,height:a}=Le(e),l=e.orientation!=="horizontal",d=e.nodeShape==="box",u=e.linkStyle??"curve",p=new Set(e.collapsed??[]),x=e.labels??!0,k=[],S=0,$=0,M=(g,C,T,de)=>{let Y=p.has(we(g))||p.has(g.name),te=Y?[]:g.children??[],R=g.color??T?.color??Ot(e,de),B={node:g,depth:C,slot:0,parent:T,collapsed:Y,color:R};if($=Math.max($,C),te.length===0)B.slot=S++;else{let L=te.map((D,F)=>M(D,C+1,B,F));B.slot=(L[0].slot+L[L.length-1].slot)/2}return k.push(B),B};r.forEach((g,C)=>M(g,0,void 0,C));let I=g=>Math.max(g.name.length,g.subtitle?.length??0),A=Math.max(0,...k.map(g=>I(g.node)))*U+16,H=e.nodeSize??36,P=e.nodeSize??5,V=d?A:2*P,Z=d?H:2*P,Se=!d&&x?A:0,N=It(s,a,{top:Pe(e)+Z/2+4,bottom:Z/2+4+(l&&!d?16:0),left:V/2+4,right:V/2+4+(l?0:Se)}),J=Math.max(1,S),ce=l?N.width:N.height,Ce=l?N.height:N.width,Me=J===1?0:ce/(J-1),Wt=$===0?0:Ce/$,yt=g=>{let C=J===1?ce/2:g.slot*Me,T=g.depth*Wt;return l?{x:m(N.x+C),y:m(N.y+T)}:{x:m(N.x+T),y:m(N.y+C)}},vt=[],Ie=[],ee=[];for(let g of k){let{x:C,y:T}=yt(g);if(g.parent){let R=yt(g.parent),B=d?l?Z/2:V/2:P,L=l?R.x:m(R.x+B),D=l?m(R.y+B):R.y,F=l?C:m(C-B),E=l?m(T-B):T,Te=m((L+F)/2),ze=m((D+E)/2),Ut=u==="straight"?`M${L} ${D}L${F} ${E}`:u==="elbow"?l?`M${L} ${D}V${ze}H${F}V${E}`:`M${L} ${D}H${Te}V${E}H${F}`:l?`M${L} ${D}C${L} ${ze} ${F} ${ze} ${F} ${E}`:`M${L} ${D}C${Te} ${D} ${Te} ${E} ${F} ${E}`;vt.push({kind:"path",part:"link",d:Ut,stroke:v.axis,strokeWidth:1.5,title:`${g.parent.node.name} \u2192 ${g.node.name}`})}let de=ve(g.node),Y=`${g.node.name}${g.node.subtitle?` \xB7 ${g.node.subtitle}`:""}${pe(g.node.value)||(g.node.children?.length??0)>0?`: ${o(de)}`:""}${g.collapsed?" (collapsed)":""}`,te={label:Y,id:we(g.node),name:g.node.name,value:de};if(d){if(Ie.push({kind:"rect",part:"node",x:m(C-V/2),y:m(T-Z/2),width:m(V),height:m(Z),fill:g.color,rx:4,title:Y,item:te}),x){let R=!!g.node.subtitle;ee.push(K(C,m(R?T-7:T),g.node.name,{part:"node-label",anchor:"middle",baseline:"middle",fill:"var(--skdx-color-text-on-accent)",weight:"bold"})),R&&ee.push(K(C,m(T+8),g.node.subtitle,{part:"node-subtitle",anchor:"middle",baseline:"middle",fill:"var(--skdx-color-text-on-accent)"}))}}else Ie.push({kind:"circle",part:"node",cx:C,cy:T,r:m(P),fill:g.color,stroke:"var(--skdx-color-surface-default)",title:Y,item:te}),x&&ee.push(l?K(C,m(T+P+12),g.node.name,{part:"node-label",anchor:"middle",fill:"var(--skdx-color-text-default)"}):K(m(C+P+4),T,g.node.name,{part:"node-label",baseline:"middle",fill:"var(--skdx-color-text-default)"}));g.collapsed&&ee.push(K(m(d?C+V/2-8:C+P+(l?6:-2)),m(d?T-Z/2+8:T-P-2),"+",{part:"collapsed",anchor:"middle",baseline:"middle",fill:v.label,weight:"bold"}))}let Et=t.length?[K(8,Pe(e)+10,t.map(g=>g.name).join(" \u203A "),{part:"breadcrumb",baseline:"middle"})]:[],wt=Ne(e,s,a);return{...wt,shapes:[...vt,...Ie,...ee,...Et,...wt.shapes]}}var f=require("lit"),h=require("lit/decorators.js"),y=require("lit/directives/if-defined.js");var xt={fromAttribute:()=>!1},b=class extends f.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=[Ke(xe(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=[qe(i.points)];return}if(i?.grab==="edit"){if(!i.gantt)return;let{x:o}=this.viewBox(t,r);i.change=Qe(r,i.gantt,o-i.x),this.overlay=[et(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(nt(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(st(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"?at(r.hit,i.zoom,o-i.x):ct(r.hit,i.grab,i.zoom,o-i.x));return}if(r.tooltipPortal){let{lines:o,shapes:s}=_e(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=We(r,t.target,t.currentTarget,t.clientX,t.clientY);(o.length>0||this.tip.length>0)&&(this.tip=o)}if(this.highlight(Ee(r,t.target)),this.syncId&&r.hit?.crosshair){let o=se(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)?Xe(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=lt(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(Ue(o,xe(i.x,i.y,s,a))):i.grab==="lasso"?this.setSelected(Ye(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(tt(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=ot(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)?Je(r,this.focused,t):void 0;if(i){t.preventDefault(),this.emit("skdx-task-change",i);return}let o=it(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:d,emptyMessage:u,description:p,decorative:x,animated:k,responsive:S,highlighted:$,highlightScope:M,accessibleTable:I}=this;return{...typeof S=="object"&&this.measured!==void 0&&this.measured<(S.breakpoint??480)?S.compact:void 0,width:S&&this.measured?this.measured:t,height:r,animate:k,responsive:S,legend:i,tooltip:o,format:s,palette:a,loading:l,error:d,emptyMessage:u,description:p,decorative:x,highlighted:$===void 0?this.highlightState:$,highlightScope:M,accessibleTable:I,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&&$e(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=$e(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&&De(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(Fe(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 Q(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?ut(r,{...t,label:t.label??this.label??this.localName}):Promise.reject(new Error("not rendered yet"))}root(t,r,i){this.join();let o=Ge(Be(t),this.sized());if(this.layout=o,o.issues!==this.reported){this.reported=o.issues;for(let I of o.issues??[])this.emit("skdx-data-issue",I)}let s=this.canZoom(o),a=this.canPan(o),l=this.canEdit(o),d=this.brushing(),u=s||a||l||d,p=!o.decorative&&ye(o).length>0,x=o.description?`${r}-desc`:void 0,k=bt(o),S=pt(o,this.accessibleTable),$=typeof this.accessibleTable=="object"&&this.accessibleTable.caption||i,M=this.portal;return f.html`<svg
1
+ "use strict";var ue=Object.defineProperty;var kt=Object.getOwnPropertyDescriptor;var qt=Object.getOwnPropertyNames;var Xt=Object.prototype.hasOwnProperty;var Qt=(e,n)=>{for(var t in n)ue(e,t,{get:n[t],enumerable:!0})},Jt=(e,n,t,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of qt(n))!Xt.call(e,i)&&i!==t&&ue(e,i,{get:()=>n[i],enumerable:!(r=kt(n,i))||r.enumerable});return e};var en=e=>Jt(ue({},"__esModule",{value:!0}),e),c=(e,n,t,r)=>{for(var i=r>1?void 0:r?kt(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&&ue(n,t,i),i};var yn={};Qt(yn,{SkdxTreeChart:()=>z});module.exports=en(yn);var O=require("lit/decorators.js");var Ct=e=>Number(e.toPrecision(12)),tn,nn=e=>(tn??(tn=new Intl.NumberFormat)).format(Ct(e)),rn=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 St(e){if(e===void 0)return nn;if(typeof e=="function")return e;let{style:n,locale:t,digits:r,unit:i="",timeZone:o}=e,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(g=>p.format(Ct(g)))},d=u=>{let p=new Intl.DateTimeFormat(t,o?{...u,timeZone:o}:u);return g=>p.format(g)};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(rn)}}var m=e=>Number(e.toFixed(2)),Oe=e=>typeof e=="number"&&Number.isFinite(e);var ne=1e3,re=60*ne,ie=60*re,he=24*ie,$n=[ne,5*ne,15*ne,30*ne,re,5*re,15*re,30*re,ie,3*ie,6*ie,12*ie,he,2*he,7*he,14*he];var on=/-?\d*\.?\d+(?:e[-+]?\d+)?/gi,sn=/([MLTHVCSQAZmlthvcsqaz])([^MLTHVCSQAZmlthvcsqaz]*)/g,an={M:2,L:2,T:2,C:6,S:4,Q:4,A:7,H:-1,V:-2};function ln(e,n,t){return e.replace(sn,(r,i,o)=>{let s=an[i];if(s===void 0)return i+o;let l=(o.match(on)??[]).map((d,u)=>{let p=Number(d);if(s===-1)return String(p+n);if(s===-2)return String(p+t);let g=u%s;return s===7?g===5?String(p+n):g===6?String(p+t):d:String(g%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:ln(r.d,n,t)}}});var Ae=["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)"))),v={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 It=(e,n)=>n??Ae[e%Ae.length];var cn={top:16,right:16,bottom:32,left:48};function Tt(e,n,t=cn){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 oe(e){let n=e.legend;if(n)return n===!0?{}:n.enabled===!1?void 0:n}function zt(e){let n=e.tooltip;return n===void 0||n===!0?{enabled:!0}:n===!1?{enabled:!1}:{...n,enabled:n.enabled??!0}}var pe=20,dn=120,Ot=e=>{let n=oe(e);return n&&(n.position==="left"||n.position==="right")?n.width??dn:0},fe=(e,n=600,t=300)=>({width:(e.width??n)-Ot(e),height:(e.height??t)-(oe(e)?.position==="bottom"?pe:0)}),Pe=(e,n,t)=>{let r=oe(e);return!r||!(r.position===void 0||r.position==="top")?0:(n?Math.max(1,Lt(n,t??fe(e).width,r)):1)*pe},U=6.5,At=(e,n,t)=>t??(e.palette&&e.palette.length>0?e.palette[n%e.palette.length]:It(n));function Le(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,g=o,k=i,C=($,M,I,A)=>{let j=(M?18:4)+$.length*U;g>o&&(s||g+j>n-8)&&(g=o,k+=pe),M&&a.push({kind:"rect",part:"legend-swatch",x:g,y:k-5,width:10,height:10,fill:M,opacity:A?.3:void 0,item:I}),a.push({kind:"text",part:"legend-label",x:g+(M?14:0),y:k,text:$,baseline:"middle",fill:A?v.grid:v.label,item:I}),g+=j+12};for(let $ of d){let M=t.includes($.name),I=p?{label:$.name,series:$.name,legend:!0}:void 0;C(r.formatter?.($.name)??$.name,$.color,I,M)}return u>0&&C(`+${u} more`,void 0,void 0,!1),r.align==="end"?un(a,n):a}function un(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*U)),s=n-8-o;for(let a of i)r.push({...a,x:a.x+s})}return r}var Lt=(e,n,t={})=>new Set(Le(e,n,[],t).flatMap(r=>r.kind==="text"?[r.y]:[])).size;function Ne(e,n,t,r=[]){let i=oe(e),o=i&&e.direction==="rtl"&&i.align===void 0?{...i,align:"end"}:i,s=zt(e),a=o?.position==="bottom",l=Ot(e),d=e.hiddenSeries??[],u=o?l?Le(r,1/0,d,o,10,(o.position==="right"?n:0)+8,!0):Le(r,n,d,o,a?t+10:10):[],p=a?Lt(r,n,o):0;return{width:n+l,height:a?t+Math.max(1,p)*pe: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 Be(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 me(e,n,t,r,i,o="auto"){let s=Array.isArray(t)?t:[t],a=Math.max(...s.map(g=>g.length))*U+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:m(u),y:m(p),width:m(a),height:l,fill:"var(--skdx-color-surface-raised)",stroke:v.axis,rx:3},...s.map((g,k)=>({kind:"text",part:"tooltip-label",x:m(u+6),y:m(p+11+k*16),text:g,baseline:"middle",fill:"var(--skdx-color-text-default)",weight:s.length>1&&k===0?"bold":void 0}))]}function Pt(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:m(o/2),y:m(s/2),text:a,anchor:"middle",baseline:"middle",fill:i==="error"?"var(--skdx-color-text-danger)":v.label}),{...Ne(e,o,s),shapes:l,tooltip:!1}}var K=(e,n,t,r={})=>({kind:"text",part:"label",x:e,y:n,text:t,fill:v.label,...r});function be(e){return e==null?[]:(Array.isArray(e)?e:[e]).map(t=>typeof t=="object"?t:{id:t})}var Re=e=>e.id??e.name??e.series,Nt=e=>e.seriesId??e.series;function F(e,n){let t=!1;return n.id!==void 0&&(t=!0,Re(e)!==n.id&&e.id!==n.id&&e.name!==n.id)||n.series!==void 0&&(t=!0,Nt(e)!==n.series&&e.series!==n.series)||n.index!==void 0&&(t=!0,e.index!==n.index)||n.category!==void 0&&(t=!0,e.category!==n.category)?!1:t}function _(e){let n={},t=Re(e);t!==void 0&&(n.id=t);let r=Nt(e);return r!==void 0&&e.series!==void 0&&(n.series=r),e.index!==void 0&&(n.index=e.index),n}var De=(e,n)=>e.id===n.id&&e.series===n.series&&e.index===n.index&&e.category===n.category;function Ge(e,n,t){let r=be(e),i=_(n),o=r.some(s=>F(n,s));return t==="single"?o?[]:[i]:o?r.filter(s=>!F(n,s)):[...r,i]}var hn=.2;function pn(e){let n=v.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 fn=(e,n)=>e.kind==="text"?{...e,fill:v.grid}:{...e,opacity:(e.opacity??1)*n};function Fe(e,n){let t=be(n.selected),r=n.highlighted===void 0||n.highlighted===null?[]:be(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=>F(u,p))?!0:o.highlighted==="series"?r.some(p=>p.series!==void 0&&F(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&&F(u,{series:p})}return!0},d=e.shapes.map(u=>{let p=u.item;if(!p||p.legend)return u;if(t.some(g=>F(p,g))){let g=pn(u);g&&s.push(g)}return l(p)?fn(u,hn):u});return s.length?{...e,shapes:[...d,...s]}:{...e,shapes:d}}function Q(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 Ve=(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 se(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 je(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:v.axis,dash:"3 3"}}function He(e,n,t){let r=e.hit;if(!r||!r.crosshair||r.xs.length===0||!Ve(r.plot,n,t))return[];let i=je(e,n),{rows:o}=se(e,n),s=e.tooltipAnchored?r.plot.y+8:t;return[i,...me(i.x1,s,o,e.width,e.height,e.tooltipPlacement)]}function Ze(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 He(e,i,t.plot.y+8)}function _e(e,n,t,r,i){if(!e.tooltip)return{lines:[],shapes:[]};if(e.hit?.crosshair){let{x:l,y:d}=Q(t,r,i,e.width,e.height);if(Ve(e.hit.plot,l,d)){let u=se(e,l),p=je(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 Rt(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(C=>C.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:g,y:k}=p?ae(p):Q(n,t,r,i,o);return me(g,k,d,i,o,s?.tooltipPlacement)}function We(e,n,t,r,i){if(!e.tooltip)return[];if(e.hit?.crosshair){let{x:o,y:s}=Q(t,r,i,e.width,e.height),a=He(e,o,s);if(a.length>0)return a}return Rt(n,t,r,i,e.width,e.height,e)}function Ee(e,n){let t=W(e,n);return t&&!t.item.legend?_(t.item):null}var mn=(e,n)=>{let{x:t,y:r}=ae(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 Ue(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=_(i.item),s=JSON.stringify(o);t.has(s)||(t.add(s),r.push(o))}return r}var Ke=e=>({kind:"rect",part:"selection-box",x:m(e.x),y:m(e.y),width:m(e.width),height:m(e.height),fill:v.focus,opacity:.12,stroke:v.focus}),xe=(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 Dt(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 Ye(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}=ae(i),a=i.kind==="circle"?i.cy:i.kind==="rect"?i.y+i.height/2:s;if(!Dt(n,o,a))continue;let l=_(i.item),d=JSON.stringify(l);t.has(d)||(t.add(d),r.push(l))}return r}var qe=e=>({kind:"path",part:"selection-lasso",d:e.length?`M${e.map(n=>`${m(n.x)} ${m(n.y)}`).join("L")}`:"",fill:v.focus,fillOpacity:.12,stroke:v.focus,dash:"4 3"}),ge=6;function Xe(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 Qe(e,n,t){let r=e.edit;return Gt(r,n,r.invert(n.bar.x0+t)-r.invert(n.bar.x0))}function Je(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 Gt(r,{bar:o,mode:s},i*a)}function Gt(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 et(e,n,t){let r=e.edit,i=r.scale(t.start),o=r.scale(t.end);return{kind:"rect",part:"edit-ghost",x:m(Math.min(i,o)),y:m(n.bar.y),width:m(Math.max(1,Math.abs(o-i))),height:m(n.bar.height),fill:v.focus,opacity:.25,stroke:v.focus,rx:2}}var bn=64,gn=e=>Math.max(1,Math.min(bn,e));function tt(e,n,t,r){let i=n>0?.8:1.25,o=gn(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,g=e.view.zoom/o;return{center:[l+u*(1-g),e.fromY(e.toY(d)-p*(1-g))],zoom:o}}function nt(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 ye=e=>e.shapes.flatMap((n,t)=>n.item&&!n.item.legend?[t]:[]);function ae(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 rt(e,n){let t=n===null?void 0:e.shapes[n];if(!t)return[];let r=v.focus,i;switch(t.kind){case"rect":i={kind:"rect",part:"focus",x:t.x-2,y:t.y-2,width:t.width+4,height:t.height+4,fill:"none",stroke:r,rx:2};break;case"circle":i={kind:"circle",part:"focus",cx:t.cx,cy:t.cy,r:t.r+3,fill:"none",stroke:r};break;case"line":i={kind:"line",part:"focus",x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:r,strokeWidth:4};break;case"text":i={kind:"rect",part:"focus",x:t.x-2,y:t.y-8,width:t.text.length*U+4,height:16,fill:"none",stroke:r,rx:2};break;case"path":i={kind:"path",part:"focus",d:t.d,stroke:r,strokeWidth:2,fill:"none"};break}let{x:o,y:s}=ae(t),a=t.item&&e.tooltipFormatter?.(t.item)||(t.item?.label??t.title??"");return[i,...a?me(m(o),m(s),a,e.width,e.height):[]]}function it(e,n,t){let r=ye(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,X=(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}},Ft=(e,n)=>!e||e.start<=0&&e.end>=n;function ot(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&&!Ft(e.zoom,e.count)?X(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 X(d-l*a,a,e.count)}function st(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 X(n.start+s*i-s*o,o,e.count)}function at(e,n,t){let r=n.end-n.start,i=e.plot.width/Math.max(1,r);return X(n.start-t/i,r,e.count)}function lt(e,n,t){let r=e.brush;if(!r||!Ve(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:X(s-o/2,o,e.count)}}function ct(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 X(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 ut(e,n){switch(n.type){case"svg":return Promise.resolve(dt(e,n.label,n.resolve));case"csv":return Promise.resolve(Zt(n.rows));case"png":{if(typeof document>"u"||typeof Image>"u")return Promise.reject(new Error("PNG export needs a browser"));let t=dt(e,n.label,n.resolve);return Ht(t,e.width,e.height,n.scale,n.background)}}}var V=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/"/g,"&quot;"),le=e=>e.filter(([,n])=>n!==void 0&&n!=="").map(([n,t])=>` ${n}="${V(String(t))}"`).join("");function Vt(e){let n=e.title?`<title>${V(e.title)}</title>`:"",t=["data-skdx-part",e.part];switch(e.kind){case"path":return`<path${le([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${le([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${le([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${le([t,["cx",e.cx],["cy",e.cy],["r",e.r],["fill",e.fill],["stroke",e.stroke]])}>${n}</circle>`;case"text":return`<text${le([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]])}>${V(e.text)}</text>`}}function jt(e){let n=e.defs??[];return n.length===0?"":`<defs>${n.map(t=>`<linearGradient id="${V(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="${V(r.color)}"${r.opacity===void 0?"":` stop-opacity="${r.opacity}"`}/>`).join("")}</linearGradient>`).join("")}</defs>`}function dt(e,n,t){let r=jt(e)+e.shapes.map(Vt).join("");return t&&(r=r.replace(/var\((--[\w-]+)\)/g,(i,o)=>t(o).trim()||i)),`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${e.width} ${e.height}" width="${e.width}" height="${e.height}" role="img" aria-label="${V(n)}" font-family="${V(v.fontFamily)}" font-size="${V(v.fontSize)}"><title>${V(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 Zt(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
+ `)}var ve=e=>Oe(e.value)?e.value:(e.children??[]).reduce((n,t)=>n+ve(t),0),ht=e=>Oe(e.value)||(e.children??[]).some(ht);var we=e=>e.id??e.name;function _t(e,n){for(let t of e){if(we(t)===n||t.name===n)return[t];let r=_t(t.children??[],n);if(r)return[t,...r]}}function pt(e,n,t=1){return n===void 0?[...e]:e.map(r=>t>=n?{...r,value:ve(r),children:void 0}:{...r,children:r.children?pt(r.children,n,t+1):void 0})}function Wt(e,n){if(n===void 0)return{nodes:[...e],path:[]};let t=_t(e,n);if(!t)return{nodes:[...e],path:[]};let r=t[t.length-1];return{nodes:r.children?.length?r.children:[r],path:t}}function ft(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 mt=new Map;function $e(e){let n=mt.get(e);if(n)return n.group;let t=new Set,r={},i={current:r,subscribe(o){return t.add(o),()=>{t.delete(o),t.size===0&&mt.delete(e)}},publish(o,s){Object.assign(r,o);for(let a of t)a(o,s)}};return mt.set(e,{group:i,listeners:t}),i}var Et='[data-skdx-part]:not([data-skdx-part^="tooltip"]):not([data-skdx-part="focus"]):not([data-skdx-part="crosshair"])',bt=`@keyframes skdx-in{from{opacity:0}to{opacity:1}}${Et}{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){${Et}{animation:none;transition:none}}`;function gt(e){let n=e.animate;return n&&e.shapes.length<=1500?`${n}ms`:void 0}function xt(e){let{nodes:n,path:t}=Wt(e.data,e.rootId),r=pt(n,e.maxDepth),i=Pt(e,r.length===0);if(i)return i;let o=St(e.format),{width:s,height:a}=fe(e),l=e.orientation!=="horizontal",d=e.nodeShape==="box",u=e.linkStyle??"curve",p=new Set(e.collapsed??[]),g=e.labels??!0,k=[],C=0,$=0,M=(x,S,T,de)=>{let Y=p.has(we(x))||p.has(x.name),te=Y?[]:x.children??[],R=x.color??T?.color??At(e,de),B={node:x,depth:S,slot:0,parent:T,collapsed:Y,color:R};if($=Math.max($,S),te.length===0)B.slot=C++;else{let L=te.map((D,G)=>M(D,S+1,B,G));B.slot=(L[0].slot+L[L.length-1].slot)/2}return k.push(B),B};r.forEach((x,S)=>M(x,0,void 0,S));let I=x=>Math.max(x.name.length,x.subtitle?.length??0),A=Math.max(0,...k.map(x=>I(x.node)))*U+16,j=e.nodeSize??36,P=e.nodeSize??5,H=d?A:2*P,Z=d?j:2*P,Ce=!d&&g?A:0,N=Tt(s,a,{top:Pe(e)+Z/2+4,bottom:Z/2+4+(l&&!d?16:0),left:H/2+4,right:H/2+4+(l?0:Ce)}),J=Math.max(1,C),ce=l?N.width:N.height,Se=l?N.height:N.width,Me=J===1?0:ce/(J-1),Ut=$===0?0:Se/$,vt=x=>{let S=J===1?ce/2:x.slot*Me,T=x.depth*Ut;return l?{x:m(N.x+S),y:m(N.y+T)}:{x:m(N.x+T),y:m(N.y+S)}},wt=[],Ie=[],ee=[];for(let x of k){let{x:S,y:T}=vt(x);if(x.parent){let R=vt(x.parent),B=d?l?Z/2:H/2:P,L=l?R.x:m(R.x+B),D=l?m(R.y+B):R.y,G=l?S:m(S-B),E=l?m(T-B):T,Te=m((L+G)/2),ze=m((D+E)/2),Yt=u==="straight"?`M${L} ${D}L${G} ${E}`:u==="elbow"?l?`M${L} ${D}V${ze}H${G}V${E}`:`M${L} ${D}H${Te}V${E}H${G}`:l?`M${L} ${D}C${L} ${ze} ${G} ${ze} ${G} ${E}`:`M${L} ${D}C${Te} ${D} ${Te} ${E} ${G} ${E}`;wt.push({kind:"path",part:"link",d:Yt,stroke:v.axis,strokeWidth:1.5,title:`${x.parent.node.name} \u2192 ${x.node.name}`})}let de=ve(x.node),Y=`${x.node.name}${x.node.subtitle?` \xB7 ${x.node.subtitle}`:""}${ht(x.node)?`: ${o(de)}`:""}${x.collapsed?" (collapsed)":""}`,te={label:Y,id:we(x.node),name:x.node.name,value:de};if(d){if(Ie.push({kind:"rect",part:"node",x:m(S-H/2),y:m(T-Z/2),width:m(H),height:m(Z),fill:x.color,rx:4,title:Y,item:te}),g){let R=!!x.node.subtitle;ee.push(K(S,m(R?T-7:T),x.node.name,{part:"node-label",anchor:"middle",baseline:"middle",fill:"var(--skdx-color-text-on-accent)",weight:"bold"})),R&&ee.push(K(S,m(T+8),x.node.subtitle,{part:"node-subtitle",anchor:"middle",baseline:"middle",fill:"var(--skdx-color-text-on-accent)"}))}}else Ie.push({kind:"circle",part:"node",cx:S,cy:T,r:m(P),fill:x.color,stroke:"var(--skdx-color-surface-default)",title:Y,item:te}),g&&ee.push(l?K(S,m(T+P+12),x.node.name,{part:"node-label",anchor:"middle",fill:"var(--skdx-color-text-default)"}):K(m(S+P+4),T,x.node.name,{part:"node-label",baseline:"middle",fill:"var(--skdx-color-text-default)"}));x.collapsed&&ee.push(K(m(d?S+H/2-8:S+P+(l?6:-2)),m(d?T-Z/2+8:T-P-2),"+",{part:"collapsed",anchor:"middle",baseline:"middle",fill:v.label,weight:"bold"}))}let Kt=t.length?[K(8,Pe(e)+10,t.map(x=>x.name).join(" \u203A "),{part:"breadcrumb",baseline:"middle"})]:[],$t=Ne(e,s,a);return{...$t,shapes:[...wt,...Ie,...ee,...Kt,...$t.shapes]}}var f=require("lit"),h=require("lit/decorators.js"),y=require("lit/directives/if-defined.js");var yt={fromAttribute:()=>!1},b=class extends f.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=[Ke(xe(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=[qe(i.points)];return}if(i?.grab==="edit"){if(!i.gantt)return;let{x:o}=this.viewBox(t,r);i.change=Qe(r,i.gantt,o-i.x),this.overlay=[et(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(nt(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(st(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"?at(r.hit,i.zoom,o-i.x):ct(r.hit,i.grab,i.zoom,o-i.x));return}if(r.tooltipPortal){let{lines:o,shapes:s}=_e(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=We(r,t.target,t.currentTarget,t.clientX,t.clientY);(o.length>0||this.tip.length>0)&&(this.tip=o)}if(this.highlight(Ee(r,t.target)),this.syncId&&r.hit?.crosshair){let o=se(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)?Xe(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=lt(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(Ue(o,xe(i.x,i.y,s,a))):i.grab==="lasso"?this.setSelected(Ye(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(tt(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=ot(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)?Je(r,this.focused,t):void 0;if(i){t.preventDefault(),this.emit("skdx-task-change",i);return}let o=it(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:d,emptyMessage:u,description:p,decorative:g,animated:k,responsive:C,highlighted:$,highlightScope:M,accessibleTable:I}=this;return{...typeof C=="object"&&this.measured!==void 0&&this.measured<(C.breakpoint??480)?C.compact:void 0,width:C&&this.measured?this.measured:t,height:r,animate:k,responsive:C,legend:i,tooltip:o,format:s,palette:a,loading:l,error:d,emptyMessage:u,description:p,decorative:g,highlighted:$===void 0?this.highlightState:$,highlightScope:M,accessibleTable:I,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&&$e(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=$e(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&&De(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(Ge(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 Q(t.currentTarget,t.clientX,t.clientY,r.width,r.height)}getSvgElement(){return this.renderRoot.querySelector("svg")}getLayout(){return this.layout}resetZoom(){this.setZoom(void 0)}zoomTo(t){this.setZoom(t)}focusItem(t){let r=this.layout;if(!r)return!1;let i=r.shapes.findIndex(o=>o.item&&!o.item.legend&&F(o.item,t));return i<0?!1:(this.getSvgElement()?.focus(),this.focused=i,!0)}export(t){let r=this.layout;return r?ut(r,{...t,label:t.label??this.label??this.localName}):Promise.reject(new Error("not rendered yet"))}root(t,r,i){this.join();let o=Fe(Be(t),this.sized());if(this.layout=o,o.issues!==this.reported){this.reported=o.issues;for(let I of o.issues??[])this.emit("skdx-data-issue",I)}let s=this.canZoom(o),a=this.canPan(o),l=this.canEdit(o),d=this.brushing(),u=s||a||l||d,p=!o.decorative&&ye(o).length>0,g=o.description?`${r}-desc`:void 0,k=gt(o),C=ft(o,this.accessibleTable),$=typeof this.accessibleTable=="object"&&this.accessibleTable.caption||i,M=this.portal;return f.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}
@@ -7,7 +7,7 @@
7
7
  role=${o.decorative?"presentation":"img"}
8
8
  aria-hidden=${o.decorative?"true":f.nothing}
9
9
  aria-label=${o.decorative?f.nothing:i}
10
- aria-describedby=${(0,y.ifDefined)(x)}
10
+ aria-describedby=${(0,y.ifDefined)(g)}
11
11
  tabindex=${p?0:f.nothing}
12
12
  data-skdx-chart=${r}
13
13
  data-zoomable=${s||a?"":f.nothing}
@@ -28,8 +28,8 @@
28
28
  @blur=${()=>{this.focused=null,this.highlight(null)}}
29
29
  >
30
30
  <title>${i}</title>
31
- ${o.description?f.svg`<desc id=${(0,y.ifDefined)(x)}>${o.description}</desc>`:f.nothing}
32
- ${k?f.svg`<style>${mt}</style>`:f.nothing} ${gn(o)}
31
+ ${o.description?f.svg`<desc id=${(0,y.ifDefined)(g)}>${o.description}</desc>`:f.nothing}
32
+ ${k?f.svg`<style>${bt}</style>`:f.nothing} ${xn(o)}
33
33
  ${ke(o.shapes)}
34
34
  ${ke(this.tip.length||!this.crossState?this.tip:Ze(o,this.crossState))}
35
35
  ${ke(rt(o,this.focused))} ${ke(this.overlay)}
@@ -41,18 +41,18 @@
41
41
  >
42
42
  ${M.lines.map(I=>f.html`<div>${I}</div>`)}
43
43
  </div>`:f.nothing}
44
- ${S?f.html`<table data-skdx-table=${r}>
44
+ ${C?f.html`<table data-skdx-table=${r}>
45
45
  <caption>
46
46
  ${$}
47
47
  </caption>
48
48
  <thead>
49
49
  <tr>
50
- ${(S[0]??[]).map(I=>f.html`<th scope="col">${I}</th>`)}
50
+ ${(C[0]??[]).map(I=>f.html`<th scope="col">${I}</th>`)}
51
51
  </tr>
52
52
  </thead>
53
53
  <tbody>
54
- ${S.slice(1).map(I=>f.html`<tr>
55
- ${I.map((A,H)=>H===0?f.html`<th scope="row">${A}</th>`:f.html`<td>${A}</td>`)}
54
+ ${C.slice(1).map(I=>f.html`<tr>
55
+ ${I.map((A,j)=>j===0?f.html`<th scope="row">${A}</th>`:f.html`<td>${A}</td>`)}
56
56
  </tr>`)}
57
57
  </tbody>
58
58
  </table>`:f.nothing}`}};b.styles=f.css`
@@ -106,4 +106,4 @@
106
106
  [role='tooltip'] > :first-child:not(:only-child) {
107
107
  font-weight: bold;
108
108
  }
109
- `,c([(0,h.property)({type:Number})],b.prototype,"width",2),c([(0,h.property)({type:Number})],b.prototype,"height",2),c([(0,h.property)()],b.prototype,"label",2),c([(0,h.property)({type:Boolean,reflect:!0})],b.prototype,"legend",2),c([(0,h.property)({type:Boolean,attribute:"no-tooltip",converter:xt})],b.prototype,"tooltip",2),c([(0,h.property)({attribute:!1})],b.prototype,"format",2),c([(0,h.property)({attribute:!1})],b.prototype,"palette",2),c([(0,h.property)({attribute:!1})],b.prototype,"hiddenSeries",2),c([(0,h.property)({attribute:!1})],b.prototype,"selected",2),c([(0,h.property)({attribute:"selection-mode"})],b.prototype,"selectionMode",2),c([(0,h.property)({attribute:!1})],b.prototype,"highlighted",2),c([(0,h.property)({attribute:!1})],b.prototype,"highlightScope",2),c([(0,h.property)({type:Boolean,reflect:!0})],b.prototype,"loading",2),c([(0,h.property)()],b.prototype,"error",2),c([(0,h.property)({attribute:"empty-message"})],b.prototype,"emptyMessage",2),c([(0,h.property)()],b.prototype,"description",2),c([(0,h.property)({type:Boolean,reflect:!0})],b.prototype,"decorative",2),c([(0,h.property)({type:Boolean,attribute:"accessible-table"})],b.prototype,"accessibleTable",2),c([(0,h.property)({attribute:!1})],b.prototype,"zoom",2),c([(0,h.property)({attribute:!1})],b.prototype,"view",2),c([(0,h.property)({type:Boolean,reflect:!0})],b.prototype,"zoomable",2),c([(0,h.property)({type:Boolean,reflect:!0})],b.prototype,"editable",2),c([(0,h.property)({attribute:"sync-id"})],b.prototype,"syncId",2),c([(0,h.property)({type:Boolean,attribute:"cross-filter"})],b.prototype,"crossFilter",2),c([(0,h.property)({converter:{fromAttribute:t=>t===null?!1:t===""?!0:Number(t)}})],b.prototype,"animated",2),c([(0,h.property)({type:Boolean,reflect:!0})],b.prototype,"responsive",2),c([(0,h.state)()],b.prototype,"tip",2),c([(0,h.state)()],b.prototype,"overlay",2),c([(0,h.state)()],b.prototype,"portal",2),c([(0,h.state)()],b.prototype,"measured",2),c([(0,h.state)()],b.prototype,"viewState",2),c([(0,h.state)()],b.prototype,"highlightState",2),c([(0,h.state)()],b.prototype,"crossState",2),c([(0,h.state)()],b.prototype,"focused",2),c([(0,h.state)()],b.prototype,"hiddenState",2),c([(0,h.state)()],b.prototype,"zoomState",2),c([(0,h.state)()],b.prototype,"selectedState",2);var w=class extends b{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:x,stacked:k,stackOffset:S,orientation:$,radius:M,barGap:I,barWidth:A,sort:H,transform:P,transforms:V,bins:Z,binWidth:Se,binDomain:N,binMode:J,sampling:ce,brush:Ce,crosshair:Me}=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:x,stacked:k,stackOffset:S,orientation:$,radius:M,barGap:I,barWidth:A,sort:H,transform:P,transforms:V,bins:Z,binWidth:Se,binDomain:N,binMode:J,sampling:ce,brush:Ce,crosshair:Me}}};c([(0,h.property)({attribute:!1})],w.prototype,"series",2),c([(0,h.property)({attribute:!1})],w.prototype,"categories",2),c([(0,h.property)({attribute:!1})],w.prototype,"xAxis",2),c([(0,h.property)({attribute:!1})],w.prototype,"yAxis",2),c([(0,h.property)({attribute:!1})],w.prototype,"rightAxis",2),c([(0,h.property)({attribute:!1})],w.prototype,"references",2),c([(0,h.property)({attribute:!1})],w.prototype,"annotations",2),c([(0,h.property)({type:Boolean,reflect:!0})],w.prototype,"labels",2),c([(0,h.property)()],w.prototype,"curve",2),c([(0,h.property)({type:Boolean,attribute:"connect-nulls"})],w.prototype,"connectNulls",2),c([(0,h.property)()],w.prototype,"nulls",2),c([(0,h.property)({reflect:!0,converter:{fromAttribute:t=>t==="percent"?"percent":t!==null}})],w.prototype,"stacked",2),c([(0,h.property)({attribute:"stack-offset"})],w.prototype,"stackOffset",2),c([(0,h.property)()],w.prototype,"orientation",2),c([(0,h.property)({type:Number})],w.prototype,"radius",2),c([(0,h.property)({type:Number,attribute:"bar-gap"})],w.prototype,"barGap",2),c([(0,h.property)({type:Number,attribute:"bar-width"})],w.prototype,"barWidth",2),c([(0,h.property)()],w.prototype,"sort",2),c([(0,h.property)()],w.prototype,"transform",2),c([(0,h.property)({attribute:!1})],w.prototype,"transforms",2),c([(0,h.property)({type:Number})],w.prototype,"bins",2),c([(0,h.property)({type:Number,attribute:"bin-width"})],w.prototype,"binWidth",2),c([(0,h.property)({attribute:!1})],w.prototype,"binDomain",2),c([(0,h.property)({attribute:"bin-mode"})],w.prototype,"binMode",2),c([(0,h.property)({attribute:!1})],w.prototype,"sampling",2),c([(0,h.property)({type:Boolean,reflect:!0})],w.prototype,"brush",2),c([(0,h.property)({type:Boolean,reflect:!0})],w.prototype,"crosshair",2);var gn=e=>e.defs&&e.defs.length?f.svg`<defs>${e.defs.map(n=>f.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=>f.svg`<stop offset=${t.offset} stop-color=${t.color} stop-opacity=${(0,y.ifDefined)(t.opacity)}></stop>`)}</linearGradient>`)}</defs>`:f.nothing,ke=e=>f.svg`${e.map((n,t)=>{let r=n.title?f.svg`<title>${n.title}</title>`:f.nothing,i=n.item?t:void 0;switch(n.kind){case"path":return f.svg`<path data-skdx-part=${n.part} data-skdx-i=${(0,y.ifDefined)(i)} d=${n.d} fill=${n.fill??"none"} stroke=${(0,y.ifDefined)(n.stroke)} stroke-width=${(0,y.ifDefined)(n.strokeWidth)} stroke-linecap=${(0,y.ifDefined)(n.strokeLinecap)} stroke-linejoin=${(0,y.ifDefined)(n.strokeLinejoin)} stroke-dasharray=${(0,y.ifDefined)(n.dash)} opacity=${(0,y.ifDefined)(n.opacity)} fill-opacity=${(0,y.ifDefined)(n.fillOpacity)}>${r}</path>`;case"rect":return f.svg`<rect data-skdx-part=${n.part} data-skdx-i=${(0,y.ifDefined)(i)} x=${n.x} y=${n.y} width=${n.width} height=${n.height} rx=${(0,y.ifDefined)(n.rx)} fill=${n.fill} stroke=${(0,y.ifDefined)(n.stroke)} fill-opacity=${(0,y.ifDefined)(n.opacity)}>${r}</rect>`;case"line":return f.svg`<line data-skdx-part=${n.part} data-skdx-i=${(0,y.ifDefined)(i)} x1=${n.x1} y1=${n.y1} x2=${n.x2} y2=${n.y2} stroke=${n.stroke} stroke-width=${(0,y.ifDefined)(n.strokeWidth)} stroke-dasharray=${(0,y.ifDefined)(n.dash)} opacity=${(0,y.ifDefined)(n.opacity)}>${r}</line>`;case"circle":return f.svg`<circle data-skdx-part=${n.part} data-skdx-i=${(0,y.ifDefined)(i)} cx=${n.cx} cy=${n.cy} r=${n.r} fill=${n.fill} stroke=${(0,y.ifDefined)(n.stroke)} opacity=${(0,y.ifDefined)(n.opacity)}>${r}</circle>`;case"text":return f.svg`<text data-skdx-part=${n.part} data-skdx-i=${(0,y.ifDefined)(i)} x=${n.x} y=${n.y} text-anchor=${(0,y.ifDefined)(n.anchor)} dominant-baseline=${(0,y.ifDefined)(n.baseline)} fill=${(0,y.ifDefined)(n.fill)} font-weight=${(0,y.ifDefined)(n.weight)} pointer-events=${(0,y.ifDefined)(i===void 0?"none":void 0)} transform=${(0,y.ifDefined)(n.rotate?`rotate(${n.rotate} ${n.x} ${n.y})`:void 0)}>${n.text}</text>`}})}`;var z=class extends b{constructor(){super(...arguments);this.data=[];this.labels=!0}render(){let{data:t,orientation:r,nodeShape:i,linkStyle:o,rootId:s,collapsed:a,maxDepth:l,labels:d,nodeSize:u}=this;return this.root(gt({...this.sized(),data:t,orientation:r,nodeShape:i,linkStyle:o,rootId:s,collapsed:a,maxDepth:l,labels:d,nodeSize:u}),"tree",this.label??"Tree chart")}};c([(0,O.property)({attribute:!1})],z.prototype,"data",2),c([(0,O.property)()],z.prototype,"orientation",2),c([(0,O.property)({attribute:"node-shape"})],z.prototype,"nodeShape",2),c([(0,O.property)({attribute:"link-style"})],z.prototype,"linkStyle",2),c([(0,O.property)({attribute:!1})],z.prototype,"rootId",2),c([(0,O.property)({attribute:!1})],z.prototype,"collapsed",2),c([(0,O.property)({type:Number,attribute:"max-depth"})],z.prototype,"maxDepth",2),c([(0,O.property)({type:Boolean,attribute:"no-labels",converter:xt})],z.prototype,"labels",2),c([(0,O.property)({type:Number,attribute:"node-size"})],z.prototype,"nodeSize",2),z=c([(0,O.customElement)("skdx-tree-chart")],z);0&&(module.exports={SkdxTreeChart});
109
+ `,c([(0,h.property)({type:Number})],b.prototype,"width",2),c([(0,h.property)({type:Number})],b.prototype,"height",2),c([(0,h.property)()],b.prototype,"label",2),c([(0,h.property)({type:Boolean,reflect:!0})],b.prototype,"legend",2),c([(0,h.property)({type:Boolean,attribute:"no-tooltip",converter:yt})],b.prototype,"tooltip",2),c([(0,h.property)({attribute:!1})],b.prototype,"format",2),c([(0,h.property)({attribute:!1})],b.prototype,"palette",2),c([(0,h.property)({attribute:!1})],b.prototype,"hiddenSeries",2),c([(0,h.property)({attribute:!1})],b.prototype,"selected",2),c([(0,h.property)({attribute:"selection-mode"})],b.prototype,"selectionMode",2),c([(0,h.property)({attribute:!1})],b.prototype,"highlighted",2),c([(0,h.property)({attribute:!1})],b.prototype,"highlightScope",2),c([(0,h.property)({type:Boolean,reflect:!0})],b.prototype,"loading",2),c([(0,h.property)()],b.prototype,"error",2),c([(0,h.property)({attribute:"empty-message"})],b.prototype,"emptyMessage",2),c([(0,h.property)()],b.prototype,"description",2),c([(0,h.property)({type:Boolean,reflect:!0})],b.prototype,"decorative",2),c([(0,h.property)({type:Boolean,attribute:"accessible-table"})],b.prototype,"accessibleTable",2),c([(0,h.property)({attribute:!1})],b.prototype,"zoom",2),c([(0,h.property)({attribute:!1})],b.prototype,"view",2),c([(0,h.property)({type:Boolean,reflect:!0})],b.prototype,"zoomable",2),c([(0,h.property)({type:Boolean,reflect:!0})],b.prototype,"editable",2),c([(0,h.property)({attribute:"sync-id"})],b.prototype,"syncId",2),c([(0,h.property)({type:Boolean,attribute:"cross-filter"})],b.prototype,"crossFilter",2),c([(0,h.property)({converter:{fromAttribute:t=>t===null?!1:t===""?!0:Number(t)}})],b.prototype,"animated",2),c([(0,h.property)({type:Boolean,reflect:!0})],b.prototype,"responsive",2),c([(0,h.state)()],b.prototype,"tip",2),c([(0,h.state)()],b.prototype,"overlay",2),c([(0,h.state)()],b.prototype,"portal",2),c([(0,h.state)()],b.prototype,"measured",2),c([(0,h.state)()],b.prototype,"viewState",2),c([(0,h.state)()],b.prototype,"highlightState",2),c([(0,h.state)()],b.prototype,"crossState",2),c([(0,h.state)()],b.prototype,"focused",2),c([(0,h.state)()],b.prototype,"hiddenState",2),c([(0,h.state)()],b.prototype,"zoomState",2),c([(0,h.state)()],b.prototype,"selectedState",2);var w=class extends b{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:g,stacked:k,stackOffset:C,orientation:$,radius:M,barGap:I,barWidth:A,sort:j,transform:P,transforms:H,bins:Z,binWidth:Ce,binDomain:N,binMode:J,sampling:ce,brush:Se,crosshair:Me}=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:g,stacked:k,stackOffset:C,orientation:$,radius:M,barGap:I,barWidth:A,sort:j,transform:P,transforms:H,bins:Z,binWidth:Ce,binDomain:N,binMode:J,sampling:ce,brush:Se,crosshair:Me}}};c([(0,h.property)({attribute:!1})],w.prototype,"series",2),c([(0,h.property)({attribute:!1})],w.prototype,"categories",2),c([(0,h.property)({attribute:!1})],w.prototype,"xAxis",2),c([(0,h.property)({attribute:!1})],w.prototype,"yAxis",2),c([(0,h.property)({attribute:!1})],w.prototype,"rightAxis",2),c([(0,h.property)({attribute:!1})],w.prototype,"references",2),c([(0,h.property)({attribute:!1})],w.prototype,"annotations",2),c([(0,h.property)({type:Boolean,reflect:!0})],w.prototype,"labels",2),c([(0,h.property)()],w.prototype,"curve",2),c([(0,h.property)({type:Boolean,attribute:"connect-nulls"})],w.prototype,"connectNulls",2),c([(0,h.property)()],w.prototype,"nulls",2),c([(0,h.property)({reflect:!0,converter:{fromAttribute:t=>t==="percent"?"percent":t!==null}})],w.prototype,"stacked",2),c([(0,h.property)({attribute:"stack-offset"})],w.prototype,"stackOffset",2),c([(0,h.property)()],w.prototype,"orientation",2),c([(0,h.property)({type:Number})],w.prototype,"radius",2),c([(0,h.property)({type:Number,attribute:"bar-gap"})],w.prototype,"barGap",2),c([(0,h.property)({type:Number,attribute:"bar-width"})],w.prototype,"barWidth",2),c([(0,h.property)()],w.prototype,"sort",2),c([(0,h.property)()],w.prototype,"transform",2),c([(0,h.property)({attribute:!1})],w.prototype,"transforms",2),c([(0,h.property)({type:Number})],w.prototype,"bins",2),c([(0,h.property)({type:Number,attribute:"bin-width"})],w.prototype,"binWidth",2),c([(0,h.property)({attribute:!1})],w.prototype,"binDomain",2),c([(0,h.property)({attribute:"bin-mode"})],w.prototype,"binMode",2),c([(0,h.property)({attribute:!1})],w.prototype,"sampling",2),c([(0,h.property)({type:Boolean,reflect:!0})],w.prototype,"brush",2),c([(0,h.property)({type:Boolean,reflect:!0})],w.prototype,"crosshair",2);var xn=e=>e.defs&&e.defs.length?f.svg`<defs>${e.defs.map(n=>f.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=>f.svg`<stop offset=${t.offset} stop-color=${t.color} stop-opacity=${(0,y.ifDefined)(t.opacity)}></stop>`)}</linearGradient>`)}</defs>`:f.nothing,ke=e=>f.svg`${e.map((n,t)=>{let r=n.title?f.svg`<title>${n.title}</title>`:f.nothing,i=n.item?t:void 0;switch(n.kind){case"path":return f.svg`<path data-skdx-part=${n.part} data-skdx-i=${(0,y.ifDefined)(i)} d=${n.d} fill=${n.fill??"none"} stroke=${(0,y.ifDefined)(n.stroke)} stroke-width=${(0,y.ifDefined)(n.strokeWidth)} stroke-linecap=${(0,y.ifDefined)(n.strokeLinecap)} stroke-linejoin=${(0,y.ifDefined)(n.strokeLinejoin)} stroke-dasharray=${(0,y.ifDefined)(n.dash)} opacity=${(0,y.ifDefined)(n.opacity)} fill-opacity=${(0,y.ifDefined)(n.fillOpacity)}>${r}</path>`;case"rect":return f.svg`<rect data-skdx-part=${n.part} data-skdx-i=${(0,y.ifDefined)(i)} x=${n.x} y=${n.y} width=${n.width} height=${n.height} rx=${(0,y.ifDefined)(n.rx)} fill=${n.fill} stroke=${(0,y.ifDefined)(n.stroke)} fill-opacity=${(0,y.ifDefined)(n.opacity)}>${r}</rect>`;case"line":return f.svg`<line data-skdx-part=${n.part} data-skdx-i=${(0,y.ifDefined)(i)} x1=${n.x1} y1=${n.y1} x2=${n.x2} y2=${n.y2} stroke=${n.stroke} stroke-width=${(0,y.ifDefined)(n.strokeWidth)} stroke-dasharray=${(0,y.ifDefined)(n.dash)} opacity=${(0,y.ifDefined)(n.opacity)}>${r}</line>`;case"circle":return f.svg`<circle data-skdx-part=${n.part} data-skdx-i=${(0,y.ifDefined)(i)} cx=${n.cx} cy=${n.cy} r=${n.r} fill=${n.fill} stroke=${(0,y.ifDefined)(n.stroke)} opacity=${(0,y.ifDefined)(n.opacity)}>${r}</circle>`;case"text":return f.svg`<text data-skdx-part=${n.part} data-skdx-i=${(0,y.ifDefined)(i)} x=${n.x} y=${n.y} text-anchor=${(0,y.ifDefined)(n.anchor)} dominant-baseline=${(0,y.ifDefined)(n.baseline)} fill=${(0,y.ifDefined)(n.fill)} font-weight=${(0,y.ifDefined)(n.weight)} pointer-events=${(0,y.ifDefined)(i===void 0?"none":void 0)} transform=${(0,y.ifDefined)(n.rotate?`rotate(${n.rotate} ${n.x} ${n.y})`:void 0)}>${n.text}</text>`}})}`;var z=class extends b{constructor(){super(...arguments);this.data=[];this.labels=!0}render(){let{data:t,orientation:r,nodeShape:i,linkStyle:o,rootId:s,collapsed:a,maxDepth:l,labels:d,nodeSize:u}=this;return this.root(xt({...this.sized(),data:t,orientation:r,nodeShape:i,linkStyle:o,rootId:s,collapsed:a,maxDepth:l,labels:d,nodeSize:u}),"tree",this.label??"Tree chart")}};c([(0,O.property)({attribute:!1})],z.prototype,"data",2),c([(0,O.property)()],z.prototype,"orientation",2),c([(0,O.property)({attribute:"node-shape"})],z.prototype,"nodeShape",2),c([(0,O.property)({attribute:"link-style"})],z.prototype,"linkStyle",2),c([(0,O.property)({attribute:!1})],z.prototype,"rootId",2),c([(0,O.property)({attribute:!1})],z.prototype,"collapsed",2),c([(0,O.property)({type:Number,attribute:"max-depth"})],z.prototype,"maxDepth",2),c([(0,O.property)({type:Boolean,attribute:"no-labels",converter:yt})],z.prototype,"labels",2),c([(0,O.property)({type:Number,attribute:"node-size"})],z.prototype,"nodeSize",2),z=c([(0,O.customElement)("skdx-tree-chart")],z);0&&(module.exports={SkdxTreeChart});