@skdx/web-components-charts 0.38.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.
- package/LICENSE +21 -0
- package/README.md +98 -0
- package/dist/area.cjs +109 -0
- package/dist/area.d.cts +2 -0
- package/dist/area.d.ts +2 -0
- package/dist/area.js +109 -0
- package/dist/bar.cjs +109 -0
- package/dist/bar.d.cts +2 -0
- package/dist/bar.d.ts +2 -0
- package/dist/bar.js +109 -0
- package/dist/boxplot.cjs +109 -0
- package/dist/boxplot.d.cts +2 -0
- package/dist/boxplot.d.ts +2 -0
- package/dist/boxplot.js +109 -0
- package/dist/bubble.cjs +109 -0
- package/dist/bubble.d.cts +2 -0
- package/dist/bubble.d.ts +2 -0
- package/dist/bubble.js +109 -0
- package/dist/bullet.cjs +109 -0
- package/dist/bullet.d.cts +2 -0
- package/dist/bullet.d.ts +2 -0
- package/dist/bullet.js +109 -0
- package/dist/bump.cjs +109 -0
- package/dist/bump.d.cts +2 -0
- package/dist/bump.d.ts +2 -0
- package/dist/bump.js +109 -0
- package/dist/candlestick.cjs +109 -0
- package/dist/candlestick.d.cts +2 -0
- package/dist/candlestick.d.ts +2 -0
- package/dist/candlestick.js +109 -0
- package/dist/chord.cjs +109 -0
- package/dist/chord.d.cts +2 -0
- package/dist/chord.d.ts +2 -0
- package/dist/chord.js +109 -0
- package/dist/circle-packing.cjs +109 -0
- package/dist/circle-packing.d.cts +2 -0
- package/dist/circle-packing.d.ts +2 -0
- package/dist/circle-packing.js +109 -0
- package/dist/combo.cjs +109 -0
- package/dist/combo.d.cts +2 -0
- package/dist/combo.d.ts +2 -0
- package/dist/combo.js +109 -0
- package/dist/dumbbell.cjs +109 -0
- package/dist/dumbbell.d.cts +2 -0
- package/dist/dumbbell.d.ts +2 -0
- package/dist/dumbbell.js +109 -0
- package/dist/funnel.cjs +109 -0
- package/dist/funnel.d.cts +2 -0
- package/dist/funnel.d.ts +2 -0
- package/dist/funnel.js +109 -0
- package/dist/gantt.cjs +109 -0
- package/dist/gantt.d.cts +2 -0
- package/dist/gantt.d.ts +2 -0
- package/dist/gantt.js +109 -0
- package/dist/gauge.cjs +109 -0
- package/dist/gauge.d.cts +2 -0
- package/dist/gauge.d.ts +2 -0
- package/dist/gauge.js +109 -0
- package/dist/heatmap.cjs +109 -0
- package/dist/heatmap.d.cts +2 -0
- package/dist/heatmap.d.ts +2 -0
- package/dist/heatmap.js +109 -0
- package/dist/histogram.cjs +109 -0
- package/dist/histogram.d.cts +2 -0
- package/dist/histogram.d.ts +2 -0
- package/dist/histogram.js +109 -0
- package/dist/icicle.cjs +109 -0
- package/dist/icicle.d.cts +2 -0
- package/dist/icicle.d.ts +2 -0
- package/dist/icicle.js +109 -0
- package/dist/index-oF5ss8v9.d.cts +2331 -0
- package/dist/index-oF5ss8v9.d.ts +2331 -0
- package/dist/index.cjs +109 -0
- package/dist/index.d.cts +29 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.js +109 -0
- package/dist/line.cjs +109 -0
- package/dist/line.d.cts +2 -0
- package/dist/line.d.ts +2 -0
- package/dist/line.js +109 -0
- package/dist/linear-gauge.cjs +109 -0
- package/dist/linear-gauge.d.cts +2 -0
- package/dist/linear-gauge.d.ts +2 -0
- package/dist/linear-gauge.js +109 -0
- package/dist/map.cjs +109 -0
- package/dist/map.d.cts +2 -0
- package/dist/map.d.ts +2 -0
- package/dist/map.js +109 -0
- package/dist/marimekko.cjs +109 -0
- package/dist/marimekko.d.cts +2 -0
- package/dist/marimekko.d.ts +2 -0
- package/dist/marimekko.js +109 -0
- package/dist/network.cjs +109 -0
- package/dist/network.d.cts +2 -0
- package/dist/network.d.ts +2 -0
- package/dist/network.js +109 -0
- package/dist/organization.cjs +109 -0
- package/dist/organization.d.cts +2 -0
- package/dist/organization.d.ts +2 -0
- package/dist/organization.js +109 -0
- package/dist/parallel.cjs +109 -0
- package/dist/parallel.d.cts +2 -0
- package/dist/parallel.d.ts +2 -0
- package/dist/parallel.js +109 -0
- package/dist/pareto.cjs +109 -0
- package/dist/pareto.d.cts +2 -0
- package/dist/pareto.d.ts +2 -0
- package/dist/pareto.js +109 -0
- package/dist/pie.cjs +109 -0
- package/dist/pie.d.cts +2 -0
- package/dist/pie.d.ts +2 -0
- package/dist/pie.js +109 -0
- package/dist/polar-area.cjs +109 -0
- package/dist/polar-area.d.cts +2 -0
- package/dist/polar-area.d.ts +2 -0
- package/dist/polar-area.js +109 -0
- package/dist/radar.cjs +109 -0
- package/dist/radar.d.cts +2 -0
- package/dist/radar.d.ts +2 -0
- package/dist/radar.js +109 -0
- package/dist/radial.cjs +109 -0
- package/dist/radial.d.cts +2 -0
- package/dist/radial.d.ts +2 -0
- package/dist/radial.js +109 -0
- package/dist/range.cjs +109 -0
- package/dist/range.d.cts +2 -0
- package/dist/range.d.ts +2 -0
- package/dist/range.js +109 -0
- package/dist/sankey.cjs +109 -0
- package/dist/sankey.d.cts +2 -0
- package/dist/sankey.d.ts +2 -0
- package/dist/sankey.js +109 -0
- package/dist/scatter.cjs +109 -0
- package/dist/scatter.d.cts +2 -0
- package/dist/scatter.d.ts +2 -0
- package/dist/scatter.js +109 -0
- package/dist/sparkline.cjs +109 -0
- package/dist/sparkline.d.cts +2 -0
- package/dist/sparkline.d.ts +2 -0
- package/dist/sparkline.js +109 -0
- package/dist/sunburst.cjs +109 -0
- package/dist/sunburst.d.cts +2 -0
- package/dist/sunburst.d.ts +2 -0
- package/dist/sunburst.js +109 -0
- package/dist/swarm.cjs +109 -0
- package/dist/swarm.d.cts +2 -0
- package/dist/swarm.d.ts +2 -0
- package/dist/swarm.js +109 -0
- package/dist/timeline.cjs +109 -0
- package/dist/timeline.d.cts +2 -0
- package/dist/timeline.d.ts +2 -0
- package/dist/timeline.js +109 -0
- package/dist/tree.cjs +109 -0
- package/dist/tree.d.cts +2 -0
- package/dist/tree.d.ts +2 -0
- package/dist/tree.js +109 -0
- package/dist/treemap.cjs +109 -0
- package/dist/treemap.d.cts +2 -0
- package/dist/treemap.d.ts +2 -0
- package/dist/treemap.js +109 -0
- package/dist/waffle.cjs +109 -0
- package/dist/waffle.d.cts +2 -0
- package/dist/waffle.d.ts +2 -0
- package/dist/waffle.js +109 -0
- package/dist/waterfall.cjs +109 -0
- package/dist/waterfall.d.cts +2 -0
- package/dist/waterfall.d.ts +2 -0
- package/dist/waterfall.js +109 -0
- package/package.json +76 -0
package/dist/bar.js
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
var Zr=Object.defineProperty;var Er=Object.getOwnPropertyDescriptor;var M=(e,n,t,r)=>{for(var i=r>1?void 0:r?Er(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&&Zr(n,t,i),i};import{customElement as Oi}from"lit/decorators.js";var qn=e=>Number(e.toPrecision(12)),Wr,Yn=e=>(Wr??(Wr=new Intl.NumberFormat)).format(qn(e)),Ur=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 Se(e){if(e===void 0)return Yn;if(typeof e=="function")return e;let{style:n,locale:t,digits:r,unit:i="",timeZone:o}=e,s=u=>i?h=>u(h)+i:u,l=u=>r===void 0?u===void 0?{}:{maximumFractionDigits:u}:{minimumFractionDigits:r,maximumFractionDigits:r},c=u=>{let h=new Intl.NumberFormat(t,u);return s(b=>h.format(qn(b)))},d=u=>{let h=new Intl.DateTimeFormat(t,o?{...u,timeZone:o}:u);return b=>h.format(b)};switch(n){case"integer":return c({maximumFractionDigits:0});case"decimal":return c(l(2));case"percent":return c({style:"percent",...l(0)});case"currency":return c({style:"currency",currency:e.currency??"USD",...l()});case"compact":return c({notation:"compact",...l(1)});case"scientific":return c({notation:"scientific",...l(2)});case"date":return d({dateStyle:"medium"});case"time":return d({timeStyle:"short"});case"datetime":return d({dateStyle:"medium",timeStyle:"short"});case"duration":return s(Ur)}}function Qe(e,n){if(typeof e=="string")return e;let t=e instanceof Date?e.getTime():e;return n?Se(n)(t):e instanceof Date?new Intl.DateTimeFormat().format(e):Yn(t)}var se=e=>{if(e instanceof Date)return e.getTime();if(typeof e=="number")return e;let n=Number(e);return Number.isFinite(n)&&e.trim()!==""?n:Date.parse(e)};function $e([e,n],[t,r]){let i=n-e;return o=>i===0?t:t+(o-e)/i*(r-t)}function xe(e,n,t=5){if(e===n)return[e];let r=(n-e)/Math.max(1,t),i=10**Math.floor(Math.log10(r)),o=r/i,s=(o<1.5?1:o<3.5?2:o<7.5?5:10)*i,l=Math.floor(e/s)*s,c=Math.ceil(n/s)*s,d=[];for(let u=l;u<=c+s/2;u+=s)d.push(Qn(u));return d}function Xn(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 Qn=e=>Number(e.toPrecision(12)),m=e=>Number(e.toFixed(2)),C=e=>typeof e=="number"&&Number.isFinite(e),ae=e=>e.filter(C);function le(e){let n=1/0,t=-1/0;for(let r of e)C(r)&&(r<n&&(n=r),r>t&&(t=r));return n===1/0?[0,0]:[n,t]}function ye(e,n="linear"){if(e.length===0)return"";let t=e[0];if(n==="step"||n==="stepBefore"||n==="stepAfter"){let d=`M${t.x} ${t.y}`;for(let u=1;u<e.length;u++){let h=e[u-1],b=e[u];n==="stepAfter"?d+=`H${b.x}V${b.y}`:n==="stepBefore"?d+=`V${b.y}H${b.x}`:d+=`H${m((h.x+b.x)/2)}V${b.y}H${b.x}`}return d}if(n==="linear"||e.length<3)return`M${e.map(d=>`${d.x} ${d.y}`).join("L")}`;let r=e.length,i=e.slice(1).map((d,u)=>d.x-e[u].x),o=e.slice(1).map((d,u)=>d.y-e[u].y),s=i.map((d,u)=>d===0?0:o[u]/d),l=[s[0]];for(let d=1;d<r-1;d++){let u=s[d-1],h=s[d];l.push(u*h<=0?0:(u+h)/2)}l.push(s[r-2]);for(let d=0;d<r-1;d++){let u=s[d];if(u===0){l[d]=0,l[d+1]=0;continue}let h=l[d]/u,b=l[d+1]/u,y=Math.hypot(h,b);y>3&&(l[d]=3*h*u/y,l[d+1]=3*b*u/y)}let c=`M${t.x} ${t.y}`;for(let d=0;d<r-1;d++){let u=e[d],h=e[d+1],b=i[d]/3;c+=`C${m(u.x+b)} ${m(u.y+b*l[d])} ${m(h.x-b)} ${m(h.y-b*l[d+1])} ${h.x} ${h.y}`}return c}var Be=1e3,Pe=60*Be,De=60*Pe,Ne=24*De,Kr=[Be,5*Be,15*Be,30*Be,Pe,5*Pe,15*Pe,30*Pe,De,3*De,6*De,12*De,Ne,2*Ne,7*Ne,14*Ne];function Jn(e,n,t=6){if(!(n>e))return[e];let r=n-e,i=Kr.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*Ne),l=[1,2,3,6,12,24,60,120].find(h=>s/h<=t)??240,c=new Date(e),d=c.getUTCFullYear(),u=Math.ceil((c.getUTCMonth()+(c.getUTCDate()>1?1:0))/l)*l;for(let h=Date.UTC(d,u,1);h<=n;)o.push(h),u+=l,u>=12&&(d+=Math.floor(u/12),u%=12),h=Date.UTC(d,u,1);return o.length?o:[e,n]}function er(e,n){let t=Math.floor(Math.log10(e)),r=Math.ceil(Math.log10(n)),i=r-t<=1?[1,2,5]:[1],o=[];for(let s=t;s<=r;s++)for(let l of i)o.push(Qn(l*10**s));return o.filter(s=>s>=e/1.0001&&s<=n*1.0001)}function Je(e,n={}){if(n.thresholds&&n.thresholds.length>=2)return[...n.thresholds].filter(Number.isFinite).sort((c,d)=>c-d);let[t,r]=n.domain??le(e),i=Math.max(1,e.length),o=Math.max(1,n.bins??Math.ceil(Math.log2(i)+1)),s=n.binWidth??(r>t?(r-t)/o:1),l=r>t?Math.max(1,Math.ceil((r-t)/s-1e-9)):1;return Array.from({length:l+1},(c,d)=>Number((t+d*s).toPrecision(12)))}function et(e,n){let t=[];for(let o=0;o+1<n.length;o++)t.push({x0:n[o],x1:n[o+1],count:0});if(t.length===0)return t;let r=n[0],i=n[n.length-1];for(let o of ae(e)){if(o<r||o>i)continue;let s=0,l=t.length-1;for(;s<l;){let c=s+l+1>>1;t[c].x0<=o?s=c:l=c-1}t[s].count++}return t}var qr=/-?\d*\.?\d+(?:e[-+]?\d+)?/gi,Yr=/([MLTHVCSQAZmlthvcsqaz])([^MLTHVCSQAZmlthvcsqaz]*)/g,Xr={M:2,L:2,T:2,C:6,S:4,Q:4,A:7,H:-1,V:-2};function Qr(e,n,t){return e.replace(Yr,(r,i,o)=>{let s=Xr[i];if(s===void 0)return i+o;let c=(o.match(qr)??[]).map((d,u)=>{let h=Number(d);if(s===-1)return String(h+n);if(s===-2)return String(h+t);let b=u%s;return s===7?b===5?String(h+n):b===6?String(h+t):d:String(b%2===0?h+n:h+t)});return i+c.join(" ")})}var tr=(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:Qr(r.d,n,t)}}});var zt=["primary","success","warning","danger","neutral"].flatMap(e=>[500,700].map(n=>`var(--skdx-color-${e}-${n})`)).sort((e,n)=>Number(e.endsWith("700)"))-Number(n.endsWith("700)"))),R={axis:"var(--skdx-color-border-strong)",grid:"var(--skdx-color-border-subtle)",label:"var(--skdx-color-text-muted)",focus:"var(--skdx-color-focus-ring)",positive:"var(--skdx-color-success-500)",negative:"var(--skdx-color-danger-500)",fontFamily:"var(--skdx-font-family)",fontSize:"var(--skdx-font-size-xs)"},tt=(e="neutral")=>e==="neutral"?R.axis:`var(--skdx-color-${e}-500)`,Ot=(e="neutral")=>e==="neutral"?R.label:e==="primary"?"var(--skdx-color-text-accent)":`var(--skdx-color-text-${e})`,nr=(e,n)=>n??zt[e%zt.length];var ee={top:16,right:16,bottom:32,left:48};function rr(e,n,t=ee){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 Fe(e){let n=e.legend;if(n)return n===!0?{}:n.enabled===!1?void 0:n}function Rt(e){let n=e.tooltip;return n===void 0||n===!0?{enabled:!0}:n===!1?{enabled:!1}:{...n,enabled:n.enabled??!0}}var ir=e=>e.crosshair===!0||Rt(e).trigger==="axis",nt=20,Jr=120,or=e=>{let n=Fe(e);return n&&(n.position==="left"||n.position==="right")?n.width??Jr:0},Vt=(e,n=600,t=300)=>({width:(e.width??n)-or(e),height:(e.height??t)-(Fe(e)?.position==="bottom"?nt:0)}),sr=e=>{let n=Fe(e);return n&&(n.position===void 0||n.position==="top")?nt:0},ce=6.5,ar=(e,n,t)=>t??(e.palette&&e.palette.length>0?e.palette[n%e.palette.length]:nr(n)),lr=(e,n)=>e.hiddenSeries?.includes(n)??!1;function Lt(e,n,t=[],r={},i=10,o=8,s=!1){let l=[],c=r.maxItems,d=c!==void 0&&c>=0&&e.length>c?e.slice(0,c):e,u=e.length-d.length,h=r.interactive??!0,b=o,y=i,x=(p,S,v,f)=>{let w=(S?18:4)+p.length*ce;b>o&&(s||b+w>n-8)&&(b=o,y+=nt),S&&l.push({kind:"rect",part:"legend-swatch",x:b,y:y-5,width:10,height:10,fill:S,opacity:f?.3:void 0,item:v}),l.push({kind:"text",part:"legend-label",x:b+(S?14:0),y,text:p,baseline:"middle",fill:f?R.grid:R.label,item:v}),b+=w+12};for(let p of d){let S=t.includes(p.name),v=h?{label:p.name,series:p.name,legend:!0}:void 0;x(r.formatter?.(p.name)??p.name,p.color,v,S)}return u>0&&x(`+${u} more`,void 0,void 0,!1),r.align==="end"?ei(l,n):l}function ei(e,n){let t=new Map;for(let i of e){let o=i.kind==="rect"?i.y+5:i.y;t.set(o,[...t.get(o)??[],i])}let r=[];for(let i of t.values()){let o=Math.max(...i.map(l=>l.kind==="rect"?l.x+l.width:l.x+l.text.length*ce)),s=n-8-o;for(let l of i)r.push({...l,x:l.x+s})}return r}var ti=(e,n,t={})=>new Set(Lt(e,n,[],t).flatMap(r=>r.kind==="text"?[r.y]:[])).size;function Bt(e,n,t,r=[]){let i=Fe(e),o=i&&e.direction==="rtl"&&i.align===void 0?{...i,align:"end"}:i,s=Rt(e),l=o?.position==="bottom",c=or(e),d=e.hiddenSeries??[],u=o?c?Lt(r,1/0,d,o,10,(o.position==="right"?n:0)+8,!0):Lt(r,n,d,o,l?t+10:10):[],h=l?ti(r,n,o):0;return{width:n+c,height:l?t+Math.max(1,h)*nt:t,legendOffset:o?.position==="left"?c:void 0,tooltip:s.enabled,tooltipFormatter:s.formatter,axisTooltipFormatter:s.axisFormatter,tooltipPortal:s.portal,tooltipPlacement:s.placement,tooltipAnchored:s.followPointer===!1?!0:void 0,description:e.description,decorative:e.decorative,animate:e.animate===!0?300:e.animate||void 0,responsive:!!e.responsive,shapes:u}}function Pt(e){let n=e.legendOffset;if(!n)return e;let t=[...tr(e.shapes.filter(c=>!c.part.startsWith("legend-")),n,0),...e.shapes.filter(c=>c.part.startsWith("legend-"))],r=c=>({...c,x:c.x+n}),i=e.hit?{...e.hit,plot:r(e.hit.plot),xs:e.hit.xs.map(c=>c+n),brush:e.hit.brush?{box:r(e.hit.brush.box),window:r(e.hit.brush.window)}:void 0}:void 0,o=e.edit,s=o?{...o,scale:c=>o.scale(c)+n,invert:c=>o.invert(c-n),bars:o.bars.map(c=>({...c,x0:c.x0+n,x1:c.x1+n}))}:void 0,l=e.map?{...e.map,plot:r(e.map.plot)}:void 0;return{...e,shapes:t,hit:i,edit:s,map:l,legendOffset:void 0}}function rt(e,n,t,r,i,o="auto"){let s=Array.isArray(t)?t:[t],l=Math.max(...s.map(b=>b.length))*ce+12,c=6+s.length*16,d=o==="top"?{x:e-l/2,y:n-c-8}:o==="bottom"?{x:e-l/2,y:n+8}:o==="left"?{x:e-l-8,y:n-c/2}:o==="right"?{x:e+8,y:n-c/2}:{x:e+12,y:n-c-6},u=Math.max(0,Math.min(r-l,d.x)),h=Math.max(0,Math.min(i-c,d.y));return[{kind:"rect",part:"tooltip",x:m(u),y:m(h),width:m(l),height:c,fill:"var(--skdx-color-surface-raised)",stroke:R.axis,rx:3},...s.map((b,y)=>({kind:"text",part:"tooltip-label",x:m(u+6),y:m(h+11+y*16),text:b,baseline:"middle",fill:"var(--skdx-color-text-default)",weight:s.length>1&&y===0?"bold":void 0}))]}function cr([e,n],t,r=!1,i){let o=typeof r=="boolean"?{scale:r?"log":"linear"}:r,s=Se(o.format??i),l=o.min??e,c=o.max??n;o.reversed&&(t=[t[1],t[0]]);let d={id:o.id,position:o.position,options:o};if(o.scale==="sqrt"){let p=z=>Math.sign(z)*Math.sqrt(Math.abs(z)),S=o.nice===!1?[l,c]:xe(l,c,o.ticks),v=o.min??S[0],f=o.max??S[S.length-1],w=$e([p(v),p(f)],t),T=z=>w(p(z)),k=xe(v,f,o.ticks).filter(z=>z>=v-1e-9&&z<=f+1e-9);return{...d,scale:T,domain:[v,f],format:s,ticks:(k.length>=2?k:[v,f]).map(z=>({pos:m(T(z)),label:s(z)})),zero:m(T(Math.min(Math.max(0,v),f)))}}if(o.scale==="log"){let p=Math.max(l,Number.EPSILON),S=Math.max(c,p),v=er(p,S),f=[Math.log10(p),Math.log10(S)],w=$e(f,t),T=k=>w(Math.log10(Math.max(k,Number.EPSILON)));return{...d,scale:T,domain:f,format:s,ticks:v.map(k=>({pos:m(T(k)),label:s(k)})),zero:m(t[0])}}let u=xe(l,c,o.ticks),h=[o.min??(o.nice===!1?l:u[0]),o.max??(o.nice===!1?c:u[u.length-1])],b=$e(h,t),y=u.filter(p=>p>=h[0]-1e-9&&p<=h[1]+1e-9),x=(y.length>=2?y:[h[0],h[1]]).map(p=>({pos:m(b(p)),label:s(p)}));return{...d,scale:b,domain:h,format:s,ticks:x,zero:m(b(Math.min(Math.max(0,h[0]),h[1])))}}var dr=e=>e?.grid!==!1;function it(e,n){if(e.length<2)return e;let t=e.reduce((i,o)=>Math.max(i,o.label.length),0)*ce+8,r=Math.max(1,Math.ceil(e.length*t/Math.max(1,n)));return r===1?e:e.filter((i,o)=>o%r===0)}var Dt=(e,n,t,r)=>`${e}, ${n}: ${r(t)}`;function ur(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}=Vt(e,t,r),l=i==="error"?e.error:i==="loading"?"Loading\u2026":e.emptyMessage??"No data available",c=[];return i==="loading"&&c.push({kind:"rect",part:"skeleton",x:0,y:0,width:o,height:s,fill:"var(--skdx-color-surface-sunken)",rx:4}),c.push({kind:"text",part:`state-${i}`,x:m(o/2),y:m(s/2),text:l,anchor:"middle",baseline:"middle",fill:i==="error"?"var(--skdx-color-text-danger)":R.label}),{...Bt(e,o,s),shapes:c,tooltip:!1}}function Nt(e,n={}){let{plot:t,xTicks:r,yTicks:i,baseline:o}=e,s=t.x+t.width,l=t.y+t.height,c=[],d=n.grid??!0,u=(x,p)=>p?{kind:"line",part:"grid",x1:x.pos,x2:x.pos,y1:t.y,y2:l,stroke:R.grid}:{kind:"line",part:"grid",x1:t.x,x2:s,y1:x.pos,y2:x.pos,stroke:R.grid},h=n.x?.tickRotation??0,b=(x,p,S,v)=>h?q(x,p,S,{part:v,anchor:h<0?"end":"start",baseline:"middle",rotate:h}):q(x,p,S,{part:v,anchor:"middle"}),y=(x,p,S,v,f)=>{for(let w of x)c.push(p==="x"?{kind:"line",part:"tick",x1:w.pos,x2:w.pos,y1:S,y2:m(S+v*f),stroke:R.axis}:{kind:"line",part:"tick",x1:S,x2:m(S+v*f),y1:w.pos,y2:w.pos,stroke:R.axis})};if(n.categoryGrid)for(let x of r)c.push(u(x,!n.horizontal));if(n.horizontal){let x=n.axes??[{ticks:i,position:"bottom",offset:0,label:n.yLabel,...n.y}];if(d)for(let p of i)c.push(u(p,!0));x[0]?.showLine!==!1&&c.push({kind:"line",part:"axis",x1:o,x2:o,y1:t.y,y2:l,stroke:R.axis});for(let p of x){let S=p.position==="top"||p.position==="right",v=m(S?t.y-p.offset:l+p.offset),f=S||p.offset>0;p.showLine&&f&&c.push({kind:"line",part:"axis",x1:t.x,x2:s,y1:v,y2:v,stroke:R.axis}),p.showTicks&&y(p.ticks,"x",v,S?-1:1,p.tickSize??4);let w=m(S?v-8:v+20);for(let T of p.ticks)c.push(S?q(T.pos,w,T.label,{part:"x-label-top",anchor:"middle"}):b(T.pos,w,T.label,"x-label"));p.label&&c.push(f?q(4,w,p.label,{part:"axis-title",anchor:"start",baseline:S?void 0:"middle"}):q(4,t.y-6,p.label,{part:"axis-title",anchor:"start"}))}n.x?.showLine&&c.push({kind:"line",part:"axis",x1:n.rtl?s:t.x,x2:n.rtl?s:t.x,y1:t.y,y2:l,stroke:R.axis}),n.x?.showTicks&&y(r,"y",n.rtl?s:t.x,n.rtl?1:-1,n.x.tickSize??4);for(let p of r)c.push(n.rtl?q(s+8,p.pos,p.label,{part:"y-label",anchor:"start",baseline:"middle"}):q(t.x-8,p.pos,p.label,{part:"y-label",anchor:"end",baseline:"middle"}))}else{if(d)for(let p of i)c.push(u(p,!1));n.y?.showLine!==!1&&c.push({kind:"line",part:"axis",x1:t.x,x2:s,y1:o,y2:o,stroke:R.axis});let x=n.axes??[{ticks:i,position:"left",offset:0,label:n.yLabel,...n.y},...n.rightTicks?[{ticks:n.rightTicks,position:"right",offset:0,label:n.rightLabel}]:[]];for(let p of x){let S=p.position==="left",v=S?t.x-p.offset:s+p.offset,f=S?"y-label":"y-label-right";p.showLine&&c.push({kind:"line",part:"axis",x1:m(v),x2:m(v),y1:t.y,y2:l,stroke:R.axis}),p.showTicks&&y(p.ticks,"y",m(v),S?-1:1,p.tickSize??4);for(let w of p.ticks)c.push(q(m(S?v-8:v+8),w.pos,w.label,{part:f,anchor:S?"end":"start",baseline:"middle"}));p.label&&c.push(q(m(S?p.offset===0?4:Math.max(4,v-40):p.offset===0?e.width-4:Math.min(e.width-4,v+40)),t.y-6,p.label,{part:"axis-title",anchor:S?"start":"end"}))}n.x?.showTicks&&y(r,"x",l,1,n.x.tickSize??4);for(let p of r)c.push(b(p.pos,l+(h?12:20),p.label,"x-label"))}return n.xLabel&&c.push(q(m(t.x+t.width/2),e.height-4,n.xLabel,{part:"axis-title",anchor:"middle"})),n.horizontal&&n.rightLabel&&c.push(q(e.width-4,t.y-6,n.rightLabel,{part:"axis-title",anchor:"end"})),c}var q=(e,n,t,r={})=>({kind:"text",part:"label",x:e,y:n,text:t,fill:R.label,...r}),Ge=(e,n,t,r,i,o)=>({kind:"circle",part:"point",cx:e,cy:n,r:t,fill:r,title:i,item:o});function Ft(e,n){let t=[],{plot:r}=n,i=r.x+r.width,o=r.y+r.height,s=c=>Math.max(r.x,Math.min(i,c)),l=c=>Math.max(r.y,Math.min(o,c));for(let c of e??[]){let d=c.color??tt(c.variant),u=c.color??Ot(c.variant),h={part:"reference-label",fill:u},b=n.horizontal===!0;if("y"in c){let y=m(n.y(c.y,c.axis??"left"));if(b){let x=s(y);t.push(...fr(x,r.y,o,d,c.label,h))}else{let x=l(y);t.push(...hr(r.x,i,x,d,c.label,h))}}else if("x"in c){let y=n.x(c.x);if(y===void 0)continue;b?t.push(...hr(r.x,i,l(m(y)),d,c.label,h)):t.push(...fr(s(m(y)),r.y,o,d,c.label,h))}else if("y1"in c){let y=m(n.y(c.y1,c.axis??"left")),x=m(n.y(c.y2,c.axis??"left"));b?t.push(...pr(s(Math.min(y,x)),s(Math.max(y,x)),r,d,c.label,u)):t.push(...mr(l(Math.min(y,x)),l(Math.max(y,x)),r,d,c.label,u))}else{let y=n.x(c.x1),x=n.x(c.x2);if(y===void 0||x===void 0)continue;let p=m(Math.min(y,x)),S=m(Math.max(y,x));b?t.push(...mr(l(p),l(S),r,d,c.label,u)):t.push(...pr(s(p),s(S),r,d,c.label,u))}}return t}function hr(e,n,t,r,i,o){let s={kind:"line",part:"reference",x1:e,x2:n,y1:t,y2:t,stroke:r,dash:"6 4",strokeWidth:1.5,title:i};return i?[s,q(n-4,t-5,i,{...o,anchor:"end"})]:[s]}function fr(e,n,t,r,i,o){let s={kind:"line",part:"reference",x1:e,x2:e,y1:n,y2:t,stroke:r,dash:"6 4",strokeWidth:1.5,title:i};return i?[s,q(e+4,n+10,i,{...o,anchor:"start"})]:[s]}function mr(e,n,t,r,i,o){let s={kind:"rect",part:"reference-area",x:t.x,y:e,width:t.width,height:m(Math.max(0,n-e)),fill:r,opacity:.12,title:i};return i?[s,q(t.x+t.width-4,e+12,i,{part:"reference-label",fill:o,anchor:"end"})]:[s]}function pr(e,n,t,r,i,o){let s={kind:"rect",part:"reference-area",x:e,y:t.y,width:m(Math.max(0,n-e)),height:t.height,fill:r,opacity:.12,title:i};return i?[s,q(e+4,t.y+12,i,{part:"reference-label",fill:o,anchor:"start"})]:[s]}function br(e,n){let t=[],{plot:r}=n,i=r.x+r.width,o=r.y+r.height;for(let s of e??[]){let l=s.color??tt(s.variant),c=s.color??Ot(s.variant),d=(x,p,S)=>{let v=n.x(x);if(v===void 0)return;let f=n.y(p,S??"left");return n.horizontal?{x:m(f),y:m(v)}:{x:m(v),y:m(f)}},u=s.id??s.label,h=x=>({label:x,id:u,name:s.label});if(s.type==="line"||s.type==="band"){let{type:x,id:p,...S}=s;t.push(...Ft([S],n));continue}if(s.type==="rect"){let x=d(s.x1,s.y1,s.axis),p=d(s.x2,s.y2,s.axis);if(!x||!p)continue;let S=Math.max(r.x,Math.min(x.x,p.x)),v=Math.max(r.y,Math.min(x.y,p.y)),f=s.label??"";t.push({kind:"rect",part:"annotation-rect",x:m(S),y:m(v),width:m(Math.max(0,Math.min(i,Math.max(x.x,p.x))-S)),height:m(Math.max(0,Math.min(o,Math.max(x.y,p.y))-v)),fill:l,opacity:.12,stroke:l,title:f||void 0,item:f?h(f):void 0}),s.label&&t.push(q(m(S+4),m(v+12),s.label,{part:"annotation-label",fill:c}));continue}let b=d(s.x,s.y,s.axis);if(!b)continue;if(s.type==="text"){t.push(q(b.x,b.y,s.text,{part:"annotation-text",fill:c,anchor:"middle",baseline:"middle",title:s.label}));continue}let y=s.label??`${String(s.x)}, ${s.y}`;if(t.push({kind:"circle",part:"annotation-point",cx:b.x,cy:b.y,r:5,fill:l,stroke:"var(--skdx-color-surface-default)",title:y,item:h(y)}),s.type==="callout"&&s.label){let[x,p]=s.offset??[16,-16],S=m(Math.max(r.x,Math.min(i,b.x+x))),v=m(Math.max(r.y,Math.min(o,b.y+p)));t.push({kind:"line",part:"annotation-leader",x1:b.x,y1:b.y,x2:S,y2:v,stroke:l},q(S,v,s.label,{part:"annotation-label",fill:c,anchor:x>=0?"start":"end",baseline:"middle"}))}}return t}var Gt=2e3;function ni(e){if(e!=="none")return e===void 0||e==="auto"?{strategy:"lttb",threshold:Gt}:typeof e=="string"?{strategy:e,threshold:Gt}:{strategy:e.strategy,threshold:e.threshold??Gt}}function ri(e,n){let t=e.length;if(n>=t||n<3)return e.map((l,c)=>c);let r=[0],i=[],o=(t-2)/(n-2),s=0;for(let l=0;l<n-2;l++){let c=Math.floor((l+1)*o)+1,d=Math.min(t-1,Math.floor((l+2)*o)+1),u=0,h=0,b=0;for(let w=c;w<d;w++){let T=e[w];C(T)&&(u+=w,h+=T,b++)}u=b?u/b:(c+d)/2,h=b?h/b:0;let y=Math.floor(l*o)+1,x=Math.min(t-1,Math.floor((l+1)*o)+1),p=e[s],S=C(p)?p:0,v=-1,f=-1;for(let w=y;w<x;w++){let T=e[w];if(!C(T)){i.push(w);continue}let k=Math.abs((s-u)*(T-S)-(s-w)*(h-S));k>f&&(f=k,v=w)}v<0&&(v=y),r.push(v),s=v}return r.push(t-1),i.length?[...new Set([...r,...i])].sort((l,c)=>l-c):r}function ii(e,n){let t=e.length,r=Math.max(1,Math.floor(n/2));if(r*2>=t)return e.map((s,l)=>l);let i=[],o=t/r;for(let s=0;s<r;s++){let l=Math.floor(s*o),c=s===r-1?t:Math.floor((s+1)*o),d=-1,u=-1;for(let h=l;h<c;h++){let b=e[h];if(!C(b)){i.push(h);continue}(d<0||b<e[d])&&(d=h),(u<0||b>e[u])&&(u=h)}d>=0&&i.push(Math.min(d,u)),u>=0&&u!==d&&i.push(Math.max(d,u))}return[...new Set(i)].sort((s,l)=>s-l)}function oi(e,n){let t=e.length,r=Math.max(1,Math.floor(n/4));if(r*4>=t)return e.map((s,l)=>l);let i=[],o=t/r;for(let s=0;s<r;s++){let l=Math.floor(s*o),c=s===r-1?t:Math.floor((s+1)*o),d=-1,u=-1,h=-1,b=-1;for(let y=l;y<c;y++){let x=e[y];if(!C(x)){i.push(y);continue}h<0&&(h=y),b=y,(d<0||x<e[d])&&(d=y),(u<0||x>e[u])&&(u=y)}for(let y of[h,d,u,b])y>=0&&i.push(y)}return[...new Set(i)].sort((s,l)=>s-l)}function gr(e,n,t){let r=ni(t);if(!r||n<=r.threshold||e.length===0)return;let i=r.strategy==="minmax"?ii:r.strategy==="m4"?oi:ri,o=new Set;for(let s of e)for(let l of i(s.slice(0,n),r.threshold))o.add(l);return[...o].sort((s,l)=>s-l)}function xr(e,n,t,r,i,o,s,l){if(r==="circle")return{...Ge(e,n,t,i,o,s),part:l};let c=r==="square"?`M${m(e-t)} ${m(n-t)}h${m(2*t)}v${m(2*t)}h${m(-2*t)}Z`:r==="diamond"?`M${m(e)} ${m(n-t*1.3)}L${m(e+t*1.3)} ${m(n)}L${m(e)} ${m(n+t*1.3)}L${m(e-t*1.3)} ${m(n)}Z`:`M${m(e)} ${m(n-t*1.2)}L${m(e+t*1.15)} ${m(n+t*.9)}L${m(e-t*1.15)} ${m(n+t*.9)}Z`;return{kind:"path",part:l,d:c,fill:i,title:o,item:s}}var si=e=>{let n=0;return e.map(t=>C(t)?n+=t:null)},ai=e=>e.map((n,t)=>{let r=e[t-1];return t>0&&C(n)&&C(r)?n-r:null}),li=e=>e.map((n,t)=>{let r=e[t-1];return t>0&&C(n)&&C(r)&&r!==0?(n-r)/Math.abs(r):null});function ci(e,n){let t=Math.max(1,Math.floor(n));return e.map((r,i)=>{if(i<t-1)return null;let o=0;for(let s=i-t+1;s<=i;s++){let l=e[s];if(!C(l))return null;o+=l}return o/t})}function di(e,n="max"){let t=0;for(let r of e)C(r)&&(t=n==="sum"?t+r:Math.max(t,r));return e.map(r=>C(r)?t===0?0:r/t:null)}function ui(e,n="desc"){let t=e.filter(C).sort((r,i)=>n==="asc"?r-i:i-r);return e.map(r=>C(r)?t.indexOf(r)+1:null)}var hi=(e,n=-1/0,t=1/0)=>e.map(r=>C(r)&&r>=n&&r<=t?r:null),fi=(e,n="asc")=>[...e].sort((t,r)=>C(t)?C(r)?n==="asc"?t-r:r-t:-1:C(r)?1:0);function mi(e,n,t="sum"){let r=Math.max(1,Math.floor(n)),i=[];for(let o=0;o<e.length;o+=r){let s=e.slice(o,o+r).filter(C);if(s.length===0){i.push(null);continue}let l=s.reduce((c,d)=>c+d,0);i.push(t==="sum"?l:t==="mean"?l/s.length:t==="min"?Math.min(...s):Math.max(...s))}return i}function pi(e,n={}){let t=e.filter(C),r=Je(t,n);return{edges:r,counts:et(t,r).map(i=>i.count)}}function _t(e,n){let t=[...e];for(let r of n??[])switch(r.type){case"cumulative":t=si(t);break;case"difference":t=ai(t);break;case"percentageChange":t=li(t);break;case"movingAverage":t=ci(t,r.window);break;case"normalize":t=di(t,r.to);break;case"rank":t=ui(t,r.order);break;case"filter":t=hi(t,r.min,r.max);break;case"sort":t=fi(t,r.order);break;case"aggregate":t=mi(t,r.every,r.method);break;case"bin":t=pi(t,r).counts;break}return t}var bi=100,gi=2e3,yr=32,kr=28,st=e=>e.position==="right"||e.position==="top";function xi(e){let t=(e.yAxis===void 0?[]:Array.isArray(e.yAxis)?e.yAxis:[e.yAxis]).map((i,o)=>({...i,id:i.id??(o===0?"left":o===1?"right":String(o)),position:i.position??(o===1?"right":"left")}));t.length===0&&t.push({id:"left",position:"left"});let r=t.some(i=>i.id==="right"||st(i));return e.rightAxis?t.push({...e.rightAxis,id:"right",position:"right"}):!r&&e.series.some(i=>i.axis==="right")&&t.push({id:"right",position:"right"}),t}function wr(e,n){let t=e[0]?.id;return n===void 0||n==="left"?t:n==="right"?(e.find(r=>r.id==="right")??e.find(st))?.id:e.find(r=>r.id===n)?.id}var ot=e=>e.kind==="bar"||e.kind==="range"&&e.style==="bar";function Mr(e,n){let t=Se(e.format),{series:r,categories:i,issues:o,axes:s}=ki(e,n,t),l=e.direction==="rtl",c=e.baseline??0,d=Math.max(i.length,...r.map(a=>Math.max(a.data.length,a.low.length))),u=r.every(a=>ae(a.data).length===0&&ae(a.high).length===0),h=ur(e,u);if(h)return{...h,issues:o};let b=e.xAxis?.type??"category",y=b!=="category"&&i.length>0&&i.every(a=>typeof a!="string"||b==="time"&&C(se(a))),x=y?i.map(se):[],[p,S]=le(x),v=e.xAxis?.format??(b==="time"?{style:S-p<2*864e5?"time":"date"}:void 0),f=Array.from({length:d},(a,g)=>{let $=i[g];return $===void 0?String(g+1):Qe($,v)}),w=yi(e.zoom,d),T=Array.from({length:w.end-w.start},(a,g)=>w.start+g),k=e.orientation==="horizontal",G=r.map(a=>({...a,hidden:a.hidden||k&&!ot(a)})).filter(a=>!a.hidden),j=G.some(a=>!ot(a))?gr(G.filter(a=>!ot(a)).map(a=>T.map(g=>(a.kind==="range"?a.high[g]:a.data[g])??null)),T.length,e.sampling):void 0,B=j?j.map(a=>T[a]):T,Y=e.stacked==="percent"||e.stackOffset==="expand",Q=e.stackOffset??"zero",re=new Map,he=new Map,mt=new Map;for(let a of G)a.stack!==void 0&&a.kind!=="range"&&mt.set(a.stack,[...mt.get(a.stack)??[],a]);for(let a of mt.values()){let g=new Array(d).fill(c),$=new Array(d).fill(c),_=new Array(d).fill(0);if(Y)for(let P of a)P.data.forEach((O,N)=>{C(O)&&(_[N]=_[N]+Math.abs(O))});for(let P of a){let O=[],N=[];for(let D=0;D<d;D++){let F=P.data[D];if(!C(F)){O.push(null),N.push(null);continue}let L=_[D],I=Y?L>0?F/L:0:F,H=I>=0?g:$;O.push(H[D]),H[D]=H[D]+I,N.push(H[D])}re.set(P,O),he.set(P,N)}if(Q==="silhouette"||Q==="wiggle"){let P=new Array(d).fill(0);if(Q==="silhouette")for(let O=0;O<d;O++)P[O]=-(g[O]-c)/2;else{let O=0;for(let N=0;N<d;N++){let D=a.length,F=0;for(let I=0;I<D;I++){let H=a[I],E=H.data[N],K=H.data[N-1],J=N>0&&C(E)&&C(K)?E-K:0;F+=(D-I-.5)*J}let L=g[N]-c;O=N===0?-L/2:O-(L>0?F/Math.max(1,D):0),P[N]=O}}for(let O of a){let N=re.get(O),D=he.get(O);for(let F=0;F<d;F++){let L=N[F],I=D[F];C(L)&&(N[F]=L+P[F]),C(I)&&(D[F]=I+P[F])}}}}let Sn=a=>a.kind==="range"?{from:a.low,to:a.high}:{from:re.get(a)??new Array(d).fill(c),to:he.get(a)??a.data},$n=a=>{let g=[],$=!1;for(let O of G){if(O.axis!==a)continue;let{from:N,to:D}=Sn(O);for(let F of B){let L=D[F];if(C(L)&&g.push(L),O.kind==="range"||O.stack!==void 0){let I=N[F];C(I)&&g.push(I)}}if(O.errors)for(let F of B){let L=vr(O.data[F],O.errors[F]);L&&g.push(L[0],L[1])}(O.kind==="bar"||O.kind==="area")&&Q==="zero"&&($=!0)}let[_,P]=le(g);return $?[Math.min(c,_),Math.max(c,P)]:[_,P]},{width:Cn,height:In}=Vt(e),Br=e.brush?yr+kr:0,Tn=B.reduce((a,g)=>Math.max(a,f[g].length),0)*ce,An=Y?{style:"percent"}:void 0,Pr=a=>{if(a.scale==="log")return ee.left;let[g,$]=$n(a.id),_=Se(a.format??An??e.format),P=xe(a.min??g,a.max??$).reduce((O,N)=>Math.max(O,_(N).length),0);return Math.max(ee.left,P*ce+14)+(a.showTicks?a.tickSize??4:0)},pt=a=>k?st(a)?"top":"bottom":st(a)!==l?"right":"left",zn=a=>k?24+(a.showTicks?a.tickSize??4:0):Pr(a),Dr=new Set(G.map(a=>a.axis)),bt=s.filter(a=>Dr.has(a.id)||s.length>1),On=new Map,ke={left:0,right:0,top:0,bottom:0};for(let a of bt){let g=pt(a);On.set(a.id,ke[g]),ke[g]+=zn(a)}let Ln=bt.find(a=>pt(a)==="bottom"),Nr={top:ee.top+sr(e)+(s.some(a=>a.label)?12:0)+ke.top,right:k?l?Math.max(ee.left,Tn+16):ee.right:Math.max(ee.right,ke.right),bottom:ee.bottom+Br+(e.xAxis?.label?14:0)+(e.xAxis?.tickRotation?24:0)+ke.bottom-(Ln?zn(Ln):0),left:k?l?ee.right:Math.max(ee.left,Tn+16):Math.max(ee.left,ke.left)},U=rr(Cn,In,Nr),Fr=k?l?[U.x+U.width,U.x]:[U.x,U.x+U.width]:[U.y+U.height,U.y],Rn=k?[U.y,U.y+U.height]:l?[U.x+U.width,U.x]:[U.x,U.x+U.width],gt=new Map(s.map(a=>[a.id,{...cr($n(a.id),Fr,{format:An,...a},e.format),position:pt(a),offset:On.get(a.id)??0}])),Vn=s[0]?.id,Ze=gt.get(Vn),xt=a=>gt.get(wr(s,a)??Vn)??Ze,ie=(a,g)=>xt(g).scale(a),Bn=a=>m(a.scale(Math.min(Math.max(c,Math.min(...a.domain)),Math.max(...a.domain)))),Ee=Xn(B.length,Rn,e.barGap),yt=B.map(a=>x[a]),kt=[...yt].sort((a,g)=>a-g),ve=1/0;for(let a=1;a<kt.length;a++)ve=Math.min(ve,kt[a]-kt[a-1]);let[we,Ae]=le(yt),oe=ve===1/0?Math.max(1,Math.abs(Ae)*.05||1):ve/2,ze=$e([we-oe,Ae+oe],Rn),We=a=>m(y?ze(yt[a]):Ee.center(a)),Pn=y?Math.abs(ze(we+(ve===1/0?oe:ve))-ze(we))*.8:Ee.bandwidth,Dn=a=>y?We(a)-Pn/2:Ee.start(a),Gr=y?(b==="time"?Jn(we-oe,Ae+oe):xe(we-oe,Ae+oe)).filter(a=>a>=we-oe&&a<=Ae+oe).map(a=>({pos:m(ze(a)),label:Qe(a,v)})):it(B.map((a,g)=>({pos:We(g),label:f[a]})),k?1/0:U.width/Math.max(.2,Math.abs(Math.cos((e.xAxis?.tickRotation??0)*Math.PI/180)))),vt={...Bt(e,Cn,In,r.map(a=>({name:a.name,color:a.color}))),plot:U,xTicks:Gr,yTicks:k?it(Ze.ticks,U.width):Ze.ticks,baseline:Bn(Ze)},_r=s[0],Nn=Nt(vt,{horizontal:k,rtl:l,axes:bt.map(a=>{let g=gt.get(a.id);return{ticks:k?it(g.ticks,U.width):g.ticks,position:g.position,offset:g.offset??0,label:a.label,showLine:a.showLine,showTicks:a.showTicks,tickSize:a.tickSize}}),xLabel:e.xAxis?.label,grid:dr(_r),categoryGrid:e.xAxis?.grid===!0,x:e.xAxis}),jr=a=>{if(typeof a=="number"&&i.every($=>typeof $=="string"))return a;let g=typeof a=="string"?a:se(a);for(let $=0;$<d;$++){let _=i[$];if(_!==void 0&&(typeof g=="string"?_===g||f[$]===g:se(_)===g))return $}},Fn={plot:U,horizontal:k,x:a=>{if(y&&(typeof a!="string"||C(se(a))))return ze(se(a));let g=jr(a),$=g===void 0?-1:B.indexOf(g);return $<0?void 0:Ee.center($)},y:(a,g)=>ie(a,g)};Nn.push(...Ft(e.references,Fn));let wt=[],Mt=new Map;for(let a of G){if(!ot(a))continue;let g=a.stack??a,$=wt.indexOf(g);$<0&&($=wt.push(g)-1),Mt.set(a,$)}let Ue=Pn/Math.max(1,wt.length),fe=Math.min(Ue,e.barWidth??1/0),Gn=(Ue-fe)/2,St=[],Ke=[],$t=[],Ct=[],It=[],_n=[],qe=[],Ye=a=>xt(a.axis).format,Tt=Math.max(0,e.minBarSize??0),Hr=(a,g,$)=>{let _=Math.abs(g-a);if(_>=Tt)return[Math.min(a,g),_];let O=a+(k?$?1:-1:$?-1:1)*Tt;return[Math.min(a,O),Tt]},Oe=(a,g,$,_)=>({label:_,series:a.name,seriesId:a.id??a.name,category:f[g],index:g,value:$}),jn=(a,g,$,_)=>{let P=vr(_,a.errors?.[g]);if(!P)return;let O=m(ie(P[0],a.axis)),N=m(ie(P[1],a.axis)),D=4,F="var(--skdx-color-text-default)",L=`${a.name}, ${f[g]}: ${Ye(a)(P[0])} \u2013 ${Ye(a)(P[1])}`;_n.push(k?{kind:"line",part:"error-bar",x1:O,x2:N,y1:$,y2:$,stroke:F,title:L}:{kind:"line",part:"error-bar",x1:$,x2:$,y1:O,y2:N,stroke:F,title:L},k?{kind:"line",part:"error-cap",x1:O,x2:O,y1:m($-D),y2:m($+D),stroke:F}:{kind:"line",part:"error-cap",x1:m($-D),x2:m($+D),y1:O,y2:O,stroke:F},k?{kind:"line",part:"error-cap",x1:N,x2:N,y1:m($-D),y2:m($+D),stroke:F}:{kind:"line",part:"error-cap",x1:m($-D),x2:m($+D),y1:N,y2:N,stroke:F})};for(let a of G){let{from:g,to:$}=Sn(a),_=Ye(a),P=B.length<=gi;if(a.kind==="bar"){let L="";B.forEach((I,H)=>{let E=a.data[I],K=g[I],J=$[I];if(!C(E)||!C(K)||!C(J))return;let Me=ie(K,a.axis),ge=ie(J,a.axis),[Le,Re]=Hr(Me,ge,J>=K),Ve=Dn(H)+Mt.get(a)*Ue+Gn,Zn=m(k?Le:Ve),En=m(k?Ve:Le),At=m(k?Re:fe),Wn=m(k?fe:Re);if(!P){L+=`M${Zn} ${En}h${At}v${Wn}h${-At}Z`;return}let Un=Dt(a.name,f[I],Y?J-K:E,_);if(Ke.push({kind:"rect",part:"bar",x:Zn,y:En,width:At,height:Wn,fill:a.color,rx:e.radius,title:Un,item:Oe(a,I,E,Un)}),jn(a,I,m(Ve+fe/2),E),e.labels){let Kn=_(Y?J-K:E);It.push(k?q(m(Math.max(Me,ge)+4),m(Ve+fe/2),Kn,{baseline:"middle"}):q(m(Ve+fe/2),m(Math.min(Me,ge)-4),Kn,{anchor:"middle"}))}}),L&&Ke.push({kind:"path",part:"bars",d:L,fill:a.color,title:a.name});continue}if(a.kind==="range"&&a.style==="bar"){B.forEach((L,I)=>{let H=g[L],E=$[L];if(!C(H)||!C(E))return;let K=ie(Math.min(H,E),a.axis),J=ie(Math.max(H,E),a.axis),Me=Dn(I)+Mt.get(a)*Ue+Gn,ge=`${a.name}, ${f[L]}: ${_(Math.min(H,E))} \u2013 ${_(Math.max(H,E))}`,Le=Oe(a,L,E,ge),Re=Math.max(1,Math.abs(J-K));Ke.push(k?{kind:"rect",part:"range",x:m(Math.min(K,J)),y:m(Me),width:m(Re),height:m(fe),fill:a.color,rx:e.radius,title:P?ge:void 0,item:Le}:{kind:"rect",part:"range",x:m(Me),y:m(Math.min(K,J)),width:m(fe),height:m(Re),fill:a.color,rx:e.radius,title:P?ge:void 0,item:Le})});continue}let O=e.nulls==="connect"||e.nulls===void 0&&e.connectNulls,N=[],D=[];B.forEach((L,I)=>{let H=g[L],E=$[L];if(!C(E)||!C(H)){!O&&D.length&&(N.push(D),D=[]);return}D.push({x:We(I),y:m(ie(E,a.axis)),y0:m(ie(H,a.axis)),i:L})}),D.length&&N.push(D);let F=a.markers??B.length<=bi;for(let L of N){let I=ye(L,a.curve);if(a.kind==="range"&&a.style==="line"){$t.push({kind:"path",part:"range-high",d:I,stroke:a.color,strokeWidth:2,strokeLinejoin:"round"},{kind:"path",part:"range-low",d:ye(L.map(H=>({x:H.x,y:H.y0})),a.curve),stroke:a.color,strokeWidth:2,strokeLinejoin:"round",dash:"4 3"});continue}if(a.kind==="range"){let H=ye([...L].reverse().map(E=>({x:E.x,y:E.y0})),a.curve);St.push({kind:"path",part:"range",d:`${I}L${H.slice(1)}Z`,fill:a.color,fillOpacity:.2,title:a.name});continue}if(a.kind==="area"){let H=Bn(xt(a.axis)),E=a.stack!==void 0?ye([...L].reverse().map(J=>({x:J.x,y:J.y0})),a.curve).slice(1):`${L[L.length-1]?.x} ${H}L${L[0]?.x} ${H}`,K=`skdx-g-${a.index}`;a.gradient&&!qe.some(J=>J.id===K)&&qe.push({id:K,vertical:!0,stops:[{offset:0,color:a.color,opacity:a.fillOpacity},{offset:1,color:a.color,opacity:0}]}),St.push({kind:"path",part:"area",d:`${I}L${E}Z`,fill:a.gradient?`url(#${K})`:a.color,fillOpacity:a.gradient?void 0:a.fillOpacity})}$t.push({kind:"path",part:"line",d:I,stroke:a.color,strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",dash:a.dash})}if(a.kind==="range"&&P)for(let L of N)for(let I of L){let H=a.low[I.i],E=a.high[I.i],K=`${a.name}, ${f[I.i]}: ${_(Math.min(H,E))} \u2013 ${_(Math.max(H,E))}`;Ct.push({...Ge(I.x,I.y,.01,a.color,K,Oe(a,I.i,E,K)),part:"anchor"})}if(a.kind!=="range")for(let L of N)for(let I of L){if(!F&&!P&&!e.labels&&!a.errors)continue;let H=a.data[I.i],E=Y?$[I.i]-g[I.i]:H,K=Dt(a.name,f[I.i],E,_);(F||P)&&Ct.push(F&&a.symbol!=="circle"?xr(I.x,I.y,a.markerSize,a.symbol,a.color,P?K:void 0,Oe(a,I.i,H,K),"point"):{...Ge(I.x,I.y,F?a.markerSize:.01,a.color,P?K:void 0,Oe(a,I.i,H,K)),part:F?"point":"anchor"}),P&&jn(a,I.i,k?I.y:I.x,$[I.i]),e.labels&&It.push(q(I.x,I.y-8,_(E),{anchor:"middle"}))}}let Hn={plot:U,xs:k?[]:B.map((a,g)=>We(g)),rows:B.map(a=>[f[a],...G.map(g=>{let $=Ye(g);if(g.kind==="range"){let P=g.low[a],O=g.high[a];return`${g.name}: ${C(P)&&C(O)?`${$(P)} \u2013 ${$(O)}`:"\u2014"}`}let _=g.data[a];return`${g.name}: ${C(_)?$(Y?(he.get(g)?.[a]??0)-(re.get(g)?.[a]??0):_):"\u2014"}`})]),count:d,zoom:w,crosshair:ir(e)},Xe=[];if(e.brush&&!k){let a={x:U.x,y:U.y+U.height+kr,width:U.width,height:yr},g=G.find(_=>_.kind!=="range"),$={x:m(a.x+w.start/Math.max(1,d)*a.width),y:a.y,width:m((w.end-w.start)/Math.max(1,d)*a.width),height:a.height};if(Xe.push({kind:"rect",part:"brush",x:a.x,y:a.y,width:a.width,height:a.height,fill:"var(--skdx-color-surface-sunken)",stroke:R.grid}),g){let _=ae(g.data),[P,O]=le(_),N=d>1?a.width/(d-1):0,D=g.data.flatMap((L,I)=>C(L)?[{x:m(a.x+I*N),y:m(a.y+a.height-(O===P?.5:(L-P)/(O-P))*(a.height-4)-2)}]:[]),F=ye(D);D.length>1&&Xe.push({kind:"path",part:"brush-series",d:`${F}L${D[D.length-1]?.x} ${a.y+a.height}L${D[0]?.x} ${a.y+a.height}Z`,fill:g.color,fillOpacity:.3})}Xe.push({kind:"rect",part:"brush-window",...$,fill:"var(--skdx-color-primary-500)",opacity:.15,stroke:R.axis},{kind:"rect",part:"brush-handle",x:m($.x-3),y:a.y+8,width:6,height:a.height-16,fill:R.axis,rx:2},{kind:"rect",part:"brush-handle",x:m($.x+$.width-3),y:a.y+8,width:6,height:a.height-16,fill:R.axis,rx:2}),Hn.brush={box:a,window:$}}return{...vt,shapes:[...Nn,...St,...Ke,...$t,..._n,...Ct,...It,...br(e.annotations,Fn),...Xe,...vt.shapes],hit:Hn,issues:o,defs:qe.length?qe:void 0}}function vr(e,n){if(!(!C(e)||n===null||n===void 0))return typeof n=="number"?C(n)?[e-Math.abs(n),e+Math.abs(n)]:void 0:C(n[0])&&C(n[1])?[Math.min(n[0],n[1]),Math.max(n[0],n[1])]:void 0}function yi(e,n){if(!e||n<2)return{start:0,end:n};let t=Math.max(0,Math.min(n-1,Math.floor(e.start))),r=Math.max(t+1,Math.min(n,Math.ceil(e.end)));return r-t<2&&n>=2?{start:Math.min(t,n-2),end:Math.min(t,n-2)+2}:{start:t,end:r}}function ki(e,n,t){let r=f=>f.type??n,i=[],o=xi(e),s=e.categories??[],l=(e.transforms??[]).filter(f=>f.type==="sort"||f.type==="bin"||f.type==="aggregate"),c=(e.transforms??[]).filter(f=>!l.includes(f)),d=e.stacked||e.stackOffset!==void 0&&e.stackOffset!=="zero",u=(f,w,T)=>{let k=T.filter(z=>z!==null&&!(typeof z=="number"&&Number.isFinite(z))).length;k&&i.push({code:"invalid-value",severity:"warning",message:`Series "${f}" has ${k} value${k===1?"":"s"} that ${k===1?"is":"are"} neither a number nor null; drawn as gaps.`,itemId:w??f}),s.length&&T.length!==s.length&&!e.transform&&i.push({code:"length-mismatch",severity:"warning",message:`Series "${f}" has ${T.length} values for ${s.length} categories.`,itemId:w??f})},h=e.series.map((f,w)=>{let T=r(f),k=d?!0:void 0,z=f.type==="range"?void 0:f.stack,G=z===!1?void 0:z===!0||z===void 0&&k?`${T}`:z;f.type==="range"?(u(f.name,f.id,f.low),u(f.name,f.id,f.high)):u(f.name,f.id,f.data);let j=Y=>e.nulls==="zero"?Y.map(Q=>C(Q)?Q:0):Y,B=wr(o,f.axis);return B===void 0&&i.push({code:"unknown-axis",severity:"warning",message:`Series "${f.name}" names axis "${String(f.axis)}", which is not defined; drawn on the first axis.`,itemId:f.id??f.name}),{name:f.name,id:f.id,color:ar(e,w,f.color),axis:B??o[0]?.id,hidden:lr(e,f.name),index:w,kind:T,data:f.type==="range"?[]:j(_t(_t(f.data,c),f.transforms)),low:f.type==="range"?f.low:[],high:f.type==="range"?f.high:[],curve:f.curve??e.curve??"linear",dash:f.type==="range"?void 0:f.dash,markers:f.type==="range"?void 0:f.markers,symbol:f.type==="range"?"circle":f.symbol??"circle",markerSize:f.type==="range"?3:f.markerSize??3,errors:f.type==="range"?void 0:f.errors,stack:T==="range"||T==="line"?void 0:G,style:f.type==="range"?f.style??"area":"area",fillOpacity:(f.type==="range"?void 0:f.fillOpacity)??e.fillOpacity??.25,gradient:f.type!=="range"&&f.gradient===!0}}),b=()=>Math.max(s.length,...h.map(f=>Math.max(f.data.length,f.low.length))),y=f=>{let w=k=>k.length?f.map(z=>k[z]??null):k,T=Array.from({length:b()},(k,z)=>s[z]??String(z+1));s=f.map(k=>T[k]),h=h.map(k=>({...k,data:w(k.data),low:w(k.low),high:w(k.high)}))},x=(f,w)=>{let T=(w!==void 0?h.find(z=>z.name===w):void 0)??h.find(z=>!z.hidden&&z.kind!=="range")??h[0];w!==void 0&&!h.some(z=>z.name===w)&&i.push({code:"unknown-series",severity:"warning",message:`sort.by names "${w}", which is not a series; sorted by the first series.`});let k=Array.from({length:b()},(z,G)=>G).sort((z,G)=>{let j=T?.data[z]??T?.high[z],B=T?.data[G]??T?.high[G],Y=C(j)?j:-1/0,Q=C(B)?B:-1/0;return f==="asc"?Y-Q:Q-Y});y(k)},p=f=>{let w=h.flatMap(k=>ae(k.data)),T=Je(w,f);s=T.slice(1).map((k,z)=>`${t(T[z])}\u2013${t(k)}`),h=h.map(k=>{let z=ae(k.data),G=0,j=et(z,T).map(B=>e.binMode==="density"?z.length?B.count/(z.length*(B.x1-B.x0)):0:e.binMode==="cumulative"?G+=B.count:B.count);return{...k,data:j}})},S=(f,w)=>{let T=Math.max(1,Math.floor(f)),k=b(),z=j=>{if(!j.length)return j;let B=[];for(let Y=0;Y<k;Y+=T){let Q=ae(j.slice(Y,Y+T));B.push(Q.length===0?null:w==="sum"?Q.reduce((re,he)=>re+he,0):w==="mean"?Q.reduce((re,he)=>re+he,0)/Q.length:w==="min"?Math.min(...Q):Math.max(...Q))}return B};s=Array.from({length:k},(j,B)=>s[B]??String(B+1)).filter((j,B)=>B%T===0),h=h.map(j=>({...j,data:z(j.data),low:z(j.low),high:z(j.high)}))};e.transform==="histogram"?p({bins:e.bins,binWidth:e.binWidth,domain:e.binDomain}):e.transform==="cumulative"&&(h=h.map(f=>{let w=0;return{...f,data:f.data.map(T=>C(T)?w+=T:w)}}));for(let f of l)f.type==="sort"?x(f.order??"desc"):f.type==="bin"?p(f):f.type==="aggregate"&&S(f.every,f.method??"sum");typeof e.sort=="string"?x(e.sort):e.sort&&x(e.sort.order,e.sort.by);let v=e.xAxis?.domain;if(v){let f=b(),w=Array.from({length:f},(G,j)=>s[j]??String(j+1)),T=G=>{let j=typeof G=="string"?G:se(G);return w.findIndex(B=>typeof j=="string"?B===j||Qe(B)===j:se(B)===j)},k=v.map(T),z=G=>G.length?k.map(j=>j<0?null:G[j]??null):G;s=[...v],h=h.map(G=>({...G,data:z(G.data),low:z(G.low),high:z(G.high)}))}return{series:h,categories:s,issues:i,axes:o}}var jt=e=>Mr(e,"bar");function at(e){return e==null?[]:(Array.isArray(e)?e:[e]).map(t=>typeof t=="object"?t:{id:t})}var Ht=e=>e.id??e.name??e.series,Sr=e=>e.seriesId??e.series;function de(e,n){let t=!1;return n.id!==void 0&&(t=!0,Ht(e)!==n.id&&e.id!==n.id&&e.name!==n.id)||n.series!==void 0&&(t=!0,Sr(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 me(e){let n={},t=Ht(e);t!==void 0&&(n.id=t);let r=Sr(e);return r!==void 0&&e.series!==void 0&&(n.series=r),e.index!==void 0&&(n.index=e.index),n}var Zt=(e,n)=>e.id===n.id&&e.series===n.series&&e.index===n.index&&e.category===n.category;function Et(e,n,t){let r=at(e),i=me(n),o=r.some(s=>de(n,s));return t==="single"?o?[]:[i]:o?r.filter(s=>!de(n,s)):[...r,i]}var vi=.2;function wi(e){let n=R.focus;switch(e.kind){case"rect":return{kind:"rect",part:"selected",x:e.x-1.5,y:e.y-1.5,width:e.width+3,height:e.height+3,fill:"none",stroke:n,rx:e.rx};case"circle":return{kind:"circle",part:"selected",cx:e.cx,cy:e.cy,r:e.r+2.5,fill:"none",stroke:n};case"path":return{kind:"path",part:"selected",d:e.d,fill:"none",stroke:n,strokeWidth:2.5};case"line":return{...e,part:"selected",stroke:n,strokeWidth:(e.strokeWidth??1)+3,title:void 0,item:void 0};case"text":return}}var Mi=(e,n)=>e.kind==="text"?{...e,fill:R.grid}:{...e,opacity:(e.opacity??1)*n};function Wt(e,n){let t=at(n.selected),r=n.highlighted===void 0||n.highlighted===null?[]:at(n.highlighted),i=r[0];if(t.length===0&&!i)return e;let o={highlighted:n.highlightScope?.highlighted??"item",faded:n.highlightScope?.faded??"global"},s=[],l=u=>!i||r.some(h=>de(u,h))?!0:o.highlighted==="series"?r.some(h=>h.series!==void 0&&de(u,{series:h.series})):!1,c=u=>{if(!i||o.faded==="none"||l(u))return!1;if(o.faded==="series"){let h=i.series;return h!==void 0&&de(u,{series:h})}return!0},d=e.shapes.map(u=>{let h=u.item;if(!h||h.legend)return u;if(t.some(b=>de(h,b))){let b=wi(u);b&&s.push(b)}return c(h)?Mi(u,vi):u});return s.length?{...e,shapes:[...d,...s]}:{...e,shapes:d}}function Te(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 Ut=(e,n,t)=>n>=e.x&&n<=e.x+e.width&&t>=e.y&&t<=e.y+e.height;function $r(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 _e(e,n){let t=e.hit;if(!t||t.xs.length===0)return;let r=$r(t,n),i=t.rows[r]??[];return{index:r,rows:e.axisTooltipFormatter?.(i,r)??i}}function Kt(e,n){let t=e.hit;if(!t||t.xs.length===0)return;let r=t.xs[$r(t,n)];return{kind:"line",part:"crosshair",x1:r,x2:r,y1:t.plot.y,y2:t.plot.y+t.plot.height,stroke:R.axis,dash:"3 3"}}function qt(e,n,t){let r=e.hit;if(!r||!r.crosshair||r.xs.length===0||!Ut(r.plot,n,t))return[];let i=Kt(e,n),{rows:o}=_e(e,n),s=e.tooltipAnchored?r.plot.y+8:t;return[i,...rt(i.x1,s,o,e.width,e.height,e.tooltipPlacement)]}function Yt(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 qt(e,i,t.plot.y+8)}function Xt(e,n,t,r,i){if(!e.tooltip)return{lines:[],shapes:[]};if(e.hit?.crosshair){let{x:c,y:d}=Te(t,r,i,e.width,e.height);if(Ut(e.hit.plot,c,d)){let u=_e(e,c),h=Kt(e,c);if(u&&h)return{lines:u.rows,shapes:[h]}}}let o=n?.closest?.("[data-skdx-part]"),s=e.tooltipFormatter?pe(e,n)?.item:void 0,l=s&&e.tooltipFormatter?.(s)||o&&Array.from(o.children).find(c=>c.tagName.toLowerCase()==="title")?.textContent;return l?{lines:Array.isArray(l)?l:[l],shapes:[]}:{lines:[],shapes:[]}}function Cr(e,n,t,r,i,o,s){let l=e?.closest?.("[data-skdx-part]"),c=s&&s.tooltipFormatter?pe(s,e)?.item:void 0,d=c&&s?.tooltipFormatter?.(c)||l&&Array.from(l.children).find(x=>x.tagName.toLowerCase()==="title")?.textContent;if(!d)return[];let u=s?.tooltipAnchored?pe(s,e):void 0,h=u?s?.shapes[u.index]:void 0,{x:b,y}=h?je(h):Te(n,t,r,i,o);return rt(b,y,d,i,o,s?.tooltipPlacement)}function Qt(e,n,t,r,i){if(!e.tooltip)return[];if(e.hit?.crosshair){let{x:o,y:s}=Te(t,r,i,e.width,e.height),l=qt(e,o,s);if(l.length>0)return l}return Cr(n,t,r,i,e.width,e.height,e)}function Jt(e,n){let t=pe(e,n);return t&&!t.item.legend?me(t.item):null}var Si=(e,n)=>{let{x:t,y:r}=je(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 en(e,n){let t=new Set,r=[];for(let i of e.shapes){if(!i.item||i.item.legend||i.part==="anchor"||!Si(i,n))continue;let o=me(i.item),s=JSON.stringify(o);t.has(s)||(t.add(s),r.push(o))}return r}var tn=e=>({kind:"rect",part:"selection-box",x:m(e.x),y:m(e.y),width:m(e.width),height:m(e.height),fill:R.focus,opacity:.12,stroke:R.focus}),ct=(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 Ir(e,n,t){let r=!1;for(let i=0,o=e.length-1;i<e.length;o=i++){let s=e[i],l=e[o];s.y>t!=l.y>t&&n<(l.x-s.x)*(t-s.y)/(l.y-s.y)+s.x&&(r=!r)}return r}function nn(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}=je(i),l=i.kind==="circle"?i.cy:i.kind==="rect"?i.y+i.height/2:s;if(!Ir(n,o,l))continue;let c=me(i.item),d=JSON.stringify(c);t.has(d)||(t.add(d),r.push(c))}return r}var rn=e=>({kind:"path",part:"selection-lasso",d:e.length?`M${e.map(n=>`${m(n.x)} ${m(n.y)}`).join("L")}`:"",fill:R.focus,fillOpacity:.12,stroke:R.focus,dash:"4 3"}),lt=6;function on(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-lt||n>i.x1+lt))return Math.abs(n-i.x0)<=lt?{bar:i,mode:"start"}:Math.abs(n-i.x1)<=lt?{bar:i,mode:"end"}:{bar:i,mode:"move"}}}function sn(e,n,t){let r=e.edit;return Tr(r,n,r.invert(n.bar.x0+t)-r.invert(n.bar.x0))}function an(e,n,t){let r=e.edit,i=t.key==="ArrowRight"?1:t.key==="ArrowLeft"?-1:0;if(!r||n===null||!i||!(t.shiftKey||t.altKey))return;let o=r.bars.find(c=>c.index===n);if(!o)return;let s=t.altKey?t.shiftKey?"start":"end":"move",l=r.snap??r.invert(o.x0+10)-r.invert(o.x0);return Tr(r,{bar:o,mode:s},i*l)}function Tr(e,{bar:n,mode:t},r){let i=l=>e.snap?Math.round(l/e.snap)*e.snap:l,o=n.start,s=n.end;return t==="move"?(o=i(n.start+r),s=o+(n.end-n.start)):t==="start"?o=Math.min(i(n.start+r),n.end):s=Math.max(i(n.end+r),n.start),{id:n.id,name:n.name,start:o,end:s}}function ln(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:R.focus,opacity:.25,stroke:R.focus,rx:2}}var $i=64,Ci=e=>Math.max(1,Math.min($i,e));function cn(e,n,t,r){let i=n>0?.8:1.25,o=Ci(e.view.zoom*i);if(o===e.view.zoom)return e.view;let{plot:s,scale:l}=e,[c,d]=e.view.center,u=(t-(s.x+s.width/2))/l,h=(r-(s.y+s.height/2))/l,b=e.view.zoom/o;return{center:[c+u*(1-b),e.fromY(e.toY(d)-h*(1-b))],zoom:o}}function dn(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 pe(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 dt=e=>e.shapes.flatMap((n,t)=>n.item&&!n.item.legend?[t]:[]);function je(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 un(e,n){let t=n===null?void 0:e.shapes[n];if(!t)return[];let r=R.focus,i;switch(t.kind){case"rect":i={kind:"rect",part:"focus",x:t.x-2,y:t.y-2,width:t.width+4,height:t.height+4,fill:"none",stroke:r,rx:2};break;case"circle":i={kind:"circle",part:"focus",cx:t.cx,cy:t.cy,r:t.r+3,fill:"none",stroke:r};break;case"line":i={kind:"line",part:"focus",x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:r,strokeWidth:4};break;case"text":i={kind:"rect",part:"focus",x:t.x-2,y:t.y-8,width:t.text.length*ce+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}=je(t),l=t.item&&e.tooltipFormatter?.(t.item)||(t.item?.label??t.title??"");return[i,...l?rt(m(o),m(s),l,e.width,e.height):[]]}function hn(e,n,t){let r=dt(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 Ce=2,Ie=(e,n,t)=>{let r=Math.max(Ce,Math.min(t,Math.round(n))),i=Math.max(0,Math.min(t-r,Math.round(e)));return{start:i,end:i+r}},Ar=(e,n)=>!e||e.start<=0&&e.end>=n;function fn(e,n,t){if(e.count<=Ce||!e.plot.width)return;let{start:r,end:i}=e.zoom,o=i-r,s=n>0?1.25:.8,l=Math.max(Ce,Math.min(e.count,Math.round(o*s)));if(l===o)return n>0&&!Ar(e.zoom,e.count)?Ie(r,l,e.count):void 0;let c=Math.max(0,Math.min(1,(t-e.plot.x)/e.plot.width)),d=r+c*o;return Ie(d-c*l,l,e.count)}function mn(e,n,t,r){let i=n.end-n.start,o=Math.max(Ce,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 Ie(n.start+s*i-s*o,o,e.count)}function pn(e,n,t){let r=n.end-n.start,i=e.plot.width/Math.max(1,r);return Ie(n.start-t/i,r,e.count)}function bn(e,n,t){let r=e.brush;if(!r||!Ut(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:Ie(s-o/2,o,e.count)}}function gn(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 Ie(t.start+o,t.end-t.start,e.count);if(n==="left")return{start:Math.max(0,Math.min(t.end-Ce,Math.round(t.start+o))),end:t.end};let s=Math.min(e.count,Math.max(t.start+Ce,Math.round(t.end+o)));return{start:t.start,end:s}}function yn(e,n){switch(n.type){case"svg":return Promise.resolve(xn(e,n.label,n.resolve));case"csv":return Promise.resolve(Rr(n.rows));case"png":{if(typeof document>"u"||typeof Image>"u")return Promise.reject(new Error("PNG export needs a browser"));let t=xn(e,n.label,n.resolve);return Lr(t,e.width,e.height,n.scale,n.background)}}}var ue=e=>e.replace(/&/g,"&").replace(/</g,"<").replace(/"/g,"""),He=e=>e.filter(([,n])=>n!==void 0&&n!=="").map(([n,t])=>` ${n}="${ue(String(t))}"`).join("");function zr(e){let n=e.title?`<title>${ue(e.title)}</title>`:"",t=["data-skdx-part",e.part];switch(e.kind){case"path":return`<path${He([t,["d",e.d],["fill",e.fill??"none"],["stroke",e.stroke],["stroke-width",e.strokeWidth],["stroke-linecap",e.strokeLinecap],["stroke-linejoin",e.strokeLinejoin],["stroke-dasharray",e.dash],["opacity",e.opacity],["fill-opacity",e.fillOpacity]])}>${n}</path>`;case"rect":return`<rect${He([t,["x",e.x],["y",e.y],["width",e.width],["height",e.height],["rx",e.rx],["fill",e.fill],["stroke",e.stroke],["fill-opacity",e.opacity]])}>${n}</rect>`;case"line":return`<line${He([t,["x1",e.x1],["y1",e.y1],["x2",e.x2],["y2",e.y2],["stroke",e.stroke],["stroke-width",e.strokeWidth],["stroke-dasharray",e.dash],["opacity",e.opacity]])}>${n}</line>`;case"circle":return`<circle${He([t,["cx",e.cx],["cy",e.cy],["r",e.r],["fill",e.fill],["stroke",e.stroke]])}>${n}</circle>`;case"text":return`<text${He([t,["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]])}>${ue(e.text)}</text>`}}function Or(e){let n=e.defs??[];return n.length===0?"":`<defs>${n.map(t=>`<linearGradient id="${ue(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="${ue(r.color)}"${r.opacity===void 0?"":` stop-opacity="${r.opacity}"`}/>`).join("")}</linearGradient>`).join("")}</defs>`}function xn(e,n,t){let r=Or(e)+e.shapes.map(zr).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="${ue(n)}" font-family="${ue(R.fontFamily)}" font-size="${ue(R.fontSize)}"><title>${ue(n)}</title>${r}</svg>`}function Lr(e,n,t,r=2,i){return new Promise((o,s)=>{let l=URL.createObjectURL(new Blob([e],{type:"image/svg+xml;charset=utf-8"})),c=new Image;c.onload=()=>{URL.revokeObjectURL(l);let d=document.createElement("canvas");d.width=Math.round(n*r),d.height=Math.round(t*r);let u=d.getContext("2d");if(!u)return s(new Error("canvas 2d context unavailable"));i&&(u.fillStyle=i,u.fillRect(0,0,d.width,d.height)),u.drawImage(c,0,0,d.width,d.height),d.toBlob(h=>h?o(h):s(new Error("toBlob failed")),"image/png")},c.onerror=()=>{URL.revokeObjectURL(l),s(new Error("svg could not be decoded"))},c.src=l})}function Rr(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 kn(e,n){if(!n)return;let t=typeof n=="object"?n.maxRows??500:500,r=e.hit;if(r&&r.rows.length>0){let l=r.rows[0];if(r.rows.length>t)return;let c=["",...l.slice(1).map(u=>u.replace(/:\s[^:]*$/,""))],d=r.rows.map(u=>[u[0],...u.slice(1).map(h=>h.slice(h.lastIndexOf(": ")+2))]);return[c,...d]}let i=e.shapes.flatMap(l=>l.item&&!l.item.legend&&!(l.part==="anchor"&&!l.title)?[l.item]:[]);if(i.length===0||i.length>t)return;let o=["series","name","category","value"].filter(l=>i.some(c=>c[l]!==void 0)),s=(l,c)=>l[c]===void 0?"":String(l[c]);return[o.map(l=>l[0]?.toUpperCase()+l.slice(1)),...i.map(l=>o.map(c=>s(l,c)))]}var vn=new Map;function ut(e){let n=vn.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&&vn.delete(e)}},publish(o,s){Object.assign(r,o);for(let l of t)l(o,s)}};return vn.set(e,{group:i,listeners:t}),i}var Vr='[data-skdx-part]:not([data-skdx-part^="tooltip"]):not([data-skdx-part="focus"]):not([data-skdx-part="crosshair"])',wn=`@keyframes skdx-in{from{opacity:0}to{opacity:1}}${Vr}{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){${Vr}{animation:none;transition:none}}`;function Mn(e){let n=e.animate;return n&&e.shapes.length<=1500?`${n}ms`:void 0}import{css as Ii,html as be,LitElement as Ti,nothing as X,svg as te}from"lit";import{property as A,state as ne}from"lit/decorators.js";import{ifDefined as W}from"lit/directives/if-defined.js";var Ai={fromAttribute:()=>!1},V=class extends Ti{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=[tn(ct(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=[rn(i.points)];return}if(i?.grab==="edit"){if(!i.gantt)return;let{x:o}=this.viewBox(t,r);i.change=sn(r,i.gantt,o-i.x),this.overlay=[ln(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(dn(r.map,i.view,o-i.x,s-i.y));return}if(i&&r.hit){if(i.grab==="pinch"){let[s,l]=[...this.pointers.values()];if(s===void 0||l===void 0||!i.distance)return;this.setZoom(mn(r.hit,i.zoom,Math.abs(s-l)/i.distance,(s+l)/2));return}let{x:o}=this.viewBox(t,r);this.setZoom(i.grab==="pan"?pn(r.hit,i.zoom,o-i.x):gn(r.hit,i.grab,i.zoom,o-i.x));return}if(r.tooltipPortal){let{lines:o,shapes:s}=Xt(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=Qt(r,t.target,t.currentTarget,t.clientX,t.clientY);(o.length>0||this.tip.length>0)&&(this.tip=o)}if(this.highlight(Jt(r,t.target)),this.syncId&&r.hit?.crosshair){let o=_e(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=pe(r,t.target)?.item.legend,l=this.canEdit(r)?on(r,i,o):void 0;if(l){this.drag={x:i,y:o,zoom:{start:0,end:0},grab:"edit",gantt:l},t.currentTarget.setPointerCapture(t.pointerId),this.clearTip();return}if(this.brushing()&&!s){this.drag={x:i,y:o,zoom:{start:0,end:0},grab:this.selectionMode==="lasso"?"lasso":"select",points:[{x:i,y:o}]},t.currentTarget.setPointerCapture(t.pointerId),this.clearTip();return}if(this.canPan(r)&&r.map){let d=r.map.plot;if(i<d.x||i>d.x+d.width||o<d.y||o>d.y+d.height)return;this.drag={x:i,y:o,zoom:{start:0,end:0},grab:"map",view:r.map.view},t.currentTarget.setPointerCapture(t.pointerId),this.clearTip();return}let c=r.hit;if(!(!c||!this.canZoom(r))){if(this.pointers.set(t.pointerId,i),this.pointers.size===2){let[d,u]=[...this.pointers.values()];this.drag={x:(d+u)/2,y:o,zoom:c.zoom,grab:"pinch",distance:Math.abs(d-u)||1}}else{let d=bn(c,i,o);if(d)this.drag={x:i,y:o,zoom:d.zoom,grab:d.grab},d.zoom!==c.zoom&&this.setZoom(d.zoom);else if(this.zoomable&&i>=c.plot.x&&i<=c.plot.x+c.plot.width&&o>=c.plot.y&&o<=c.plot.y+c.plot.height)this.drag={x:i,y:o,zoom:c.zoom,grab:"pan"};else{this.pointers.delete(t.pointerId);return}}t.currentTarget.setPointerCapture(t.pointerId),this.clearTip()}};this.onPointerUp=t=>{this.pointers.delete(t.pointerId);let r=t.currentTarget;r.hasPointerCapture(t.pointerId)&&r.releasePointerCapture(t.pointerId);let i=this.drag,o=this.layout;if(o&&(i?.grab==="select"||i?.grab==="lasso"||i?.grab==="edit"||i?.grab==="map")){this.overlay=[];let{x:s,y:l}=this.viewBox(t,o);if(Math.abs(s-i.x)>2||Math.abs(l-i.y)>2){i.grab==="select"?this.setSelected(en(o,ct(i.x,i.y,s,l))):i.grab==="lasso"?this.setSelected(nn(o,i.points??[])):i.grab==="edit"&&i.change&&this.emit("skdx-task-change",i.change),this.drag={...i,distance:-1};return}this.drag=null;return}(this.pointers.size===0||this.drag?.grab==="pinch")&&(this.drag=null)};this.onWheel=t=>{let r=this.layout;if(!r)return;let{x:i,y:o}=this.viewBox(t,r);if(r.map&&this.canPan(r)){let c=r.map.plot;if(i<c.x||i>c.x+c.width||o<c.y||o>c.y+c.height)return;t.preventDefault(),this.setView(cn(r.map,t.deltaY,i,o));return}let s=r.hit;if(!s||!this.canZoom(r)||o<s.plot.y||o>s.plot.y+s.plot.height)return;let l=fn(s,t.deltaY,i);l&&(t.preventDefault(),this.setZoom(l))};this.onClick=t=>{if(!this.layout)return;if(this.drag?.distance===-1){this.drag=null;return}let r=pe(this.layout,t.target);r&&(r.item.range?this.setZoom(r.item.range):r.item.legend&&r.item.series!==void 0?this.toggle(r.item.series):(this.select(r.item),this.emit("skdx-item-click",r.item)))};this.onKeyDown=t=>{let r=this.layout;if(!r)return;if((t.key==="Enter"||t.key===" ")&&this.focused!==null){let l=r.shapes[this.focused]?.item;l&&(t.preventDefault(),this.select(l),this.emit("skdx-item-click",l));return}let i=this.canEdit(r)?an(r,this.focused,t):void 0;if(i){t.preventDefault(),this.emit("skdx-task-change",i);return}let o=hn(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?me(s):null)}}connectedCallback(){super.connectedCallback(),!(typeof ResizeObserver>"u")&&(this.observer=new ResizeObserver(([t])=>{let r=Math.floor(t?.contentRect.width??0);r>0&&(this.measured=r)}),this.observer.observe(this))}disconnectedCallback(){this.observer?.disconnect(),this.leave?.(),this.leave=void 0,this.joined=void 0,super.disconnectedCallback()}sized(){let{width:t,height:r,legend:i,tooltip:o,format:s,palette:l,loading:c,error:d,emptyMessage:u,description:h,decorative:b,animated:y,responsive:x,highlighted:p,highlightScope:S,accessibleTable:v}=this;return{...typeof x=="object"&&this.measured!==void 0&&this.measured<(x.breakpoint??480)?x.compact:void 0,width:x&&this.measured?this.measured:t,height:r,animate:y,responsive:x,legend:i,tooltip:o,format:s,palette:l,loading:c,error:d,emptyMessage:u,description:h,decorative:b,highlighted:p===void 0?this.highlightState:p,highlightScope:S,accessibleTable:v,hiddenSeries:this.hiddenSeries??this.hiddenState,zoom:this.zoom??this.zoomState,selected:this.selected??this.selectedState,view:this.view??this.viewState}}emit(t,r){this.dispatchEvent(new CustomEvent(t,{detail:r,bubbles:!0,composed:!0}))}publish(t){this.syncId&&ut(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=ut(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&&Zt(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(Et(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 Te(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&&de(o.item,t));return i<0?!1:(this.getSvgElement()?.focus(),this.focused=i,!0)}export(t){let r=this.layout;return r?yn(r,{...t,label:t.label??this.label??this.localName}):Promise.reject(new Error("not rendered yet"))}root(t,r,i){this.join();let o=Wt(Pt(t),this.sized());if(this.layout=o,o.issues!==this.reported){this.reported=o.issues;for(let v of o.issues??[])this.emit("skdx-data-issue",v)}let s=this.canZoom(o),l=this.canPan(o),c=this.canEdit(o),d=this.brushing(),u=s||l||c||d,h=!o.decorative&&dt(o).length>0,b=o.description?`${r}-desc`:void 0,y=Mn(o),x=kn(o,this.accessibleTable),p=typeof this.accessibleTable=="object"&&this.accessibleTable.caption||i,S=this.portal;return be`<svg
|
|
3
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
4
|
+
viewBox="0 0 ${o.width} ${o.height}"
|
|
5
|
+
width=${o.width}
|
|
6
|
+
height=${o.height}
|
|
7
|
+
role=${o.decorative?"presentation":"img"}
|
|
8
|
+
aria-hidden=${o.decorative?"true":X}
|
|
9
|
+
aria-label=${o.decorative?X:i}
|
|
10
|
+
aria-describedby=${W(b)}
|
|
11
|
+
tabindex=${h?0:X}
|
|
12
|
+
data-skdx-chart=${r}
|
|
13
|
+
data-zoomable=${s||l?"":X}
|
|
14
|
+
data-brushing=${d&&!(s||l)?"":X}
|
|
15
|
+
data-editable=${c?"":X}
|
|
16
|
+
style=${y?`--skdx-chart-duration:${y}`:X}
|
|
17
|
+
font-family=${R.fontFamily}
|
|
18
|
+
font-size=${R.fontSize}
|
|
19
|
+
@pointermove=${o.tooltip||u?this.onPointerMove:X}
|
|
20
|
+
@pointerleave=${()=>{this.clearTip(),this.highlight(null)}}
|
|
21
|
+
@pointerdown=${u?this.onPointerDown:X}
|
|
22
|
+
@pointerup=${u?this.onPointerUp:X}
|
|
23
|
+
@pointercancel=${u?this.onPointerUp:X}
|
|
24
|
+
@wheel=${s||l?this.onWheel:X}
|
|
25
|
+
@dblclick=${s||l?()=>l?this.setView(void 0):this.setZoom(void 0):X}
|
|
26
|
+
@click=${this.onClick}
|
|
27
|
+
@keydown=${h?this.onKeyDown:X}
|
|
28
|
+
@blur=${()=>{this.focused=null,this.highlight(null)}}
|
|
29
|
+
>
|
|
30
|
+
<title>${i}</title>
|
|
31
|
+
${o.description?te`<desc id=${W(b)}>${o.description}</desc>`:X}
|
|
32
|
+
${y?te`<style>${wn}</style>`:X} ${zi(o)}
|
|
33
|
+
${ht(o.shapes)}
|
|
34
|
+
${ht(this.tip.length||!this.crossState?this.tip:Yt(o,this.crossState))}
|
|
35
|
+
${ht(un(o,this.focused))} ${ht(this.overlay)}
|
|
36
|
+
</svg>
|
|
37
|
+
${S?be`<div
|
|
38
|
+
role="tooltip"
|
|
39
|
+
data-skdx-tooltip=${r}
|
|
40
|
+
style="left:${S.x+12}px;top:${S.y+12}px"
|
|
41
|
+
>
|
|
42
|
+
${S.lines.map(v=>be`<div>${v}</div>`)}
|
|
43
|
+
</div>`:X}
|
|
44
|
+
${x?be`<table data-skdx-table=${r}>
|
|
45
|
+
<caption>
|
|
46
|
+
${p}
|
|
47
|
+
</caption>
|
|
48
|
+
<thead>
|
|
49
|
+
<tr>
|
|
50
|
+
${(x[0]??[]).map(v=>be`<th scope="col">${v}</th>`)}
|
|
51
|
+
</tr>
|
|
52
|
+
</thead>
|
|
53
|
+
<tbody>
|
|
54
|
+
${x.slice(1).map(v=>be`<tr>
|
|
55
|
+
${v.map((f,w)=>w===0?be`<th scope="row">${f}</th>`:be`<td>${f}</td>`)}
|
|
56
|
+
</tr>`)}
|
|
57
|
+
</tbody>
|
|
58
|
+
</table>`:X}`}};V.styles=Ii`
|
|
59
|
+
:host {
|
|
60
|
+
display: inline-block;
|
|
61
|
+
}
|
|
62
|
+
svg {
|
|
63
|
+
display: block;
|
|
64
|
+
max-width: 100%;
|
|
65
|
+
height: auto;
|
|
66
|
+
outline: none;
|
|
67
|
+
}
|
|
68
|
+
svg[data-zoomable] {
|
|
69
|
+
cursor: grab;
|
|
70
|
+
touch-action: none;
|
|
71
|
+
}
|
|
72
|
+
svg[data-brushing] {
|
|
73
|
+
cursor: crosshair;
|
|
74
|
+
touch-action: none;
|
|
75
|
+
}
|
|
76
|
+
svg[data-editable] {
|
|
77
|
+
touch-action: none;
|
|
78
|
+
}
|
|
79
|
+
:host([responsive]) {
|
|
80
|
+
display: block;
|
|
81
|
+
}
|
|
82
|
+
table {
|
|
83
|
+
position: absolute;
|
|
84
|
+
width: 1px;
|
|
85
|
+
height: 1px;
|
|
86
|
+
margin: -1px;
|
|
87
|
+
padding: 0;
|
|
88
|
+
overflow: hidden;
|
|
89
|
+
clip: rect(0 0 0 0);
|
|
90
|
+
white-space: nowrap;
|
|
91
|
+
border: 0;
|
|
92
|
+
}
|
|
93
|
+
[role='tooltip'] {
|
|
94
|
+
position: fixed;
|
|
95
|
+
pointer-events: none;
|
|
96
|
+
z-index: 1000;
|
|
97
|
+
background: var(--skdx-color-surface-raised);
|
|
98
|
+
color: var(--skdx-color-text-default);
|
|
99
|
+
border: 1px solid var(--skdx-color-border-strong);
|
|
100
|
+
border-radius: 3px;
|
|
101
|
+
padding: 4px 8px;
|
|
102
|
+
font-family: var(--skdx-font-family);
|
|
103
|
+
font-size: var(--skdx-font-size-xs);
|
|
104
|
+
white-space: nowrap;
|
|
105
|
+
}
|
|
106
|
+
[role='tooltip'] > :first-child:not(:only-child) {
|
|
107
|
+
font-weight: bold;
|
|
108
|
+
}
|
|
109
|
+
`,M([A({type:Number})],V.prototype,"width",2),M([A({type:Number})],V.prototype,"height",2),M([A()],V.prototype,"label",2),M([A({type:Boolean,reflect:!0})],V.prototype,"legend",2),M([A({type:Boolean,attribute:"no-tooltip",converter:Ai})],V.prototype,"tooltip",2),M([A({attribute:!1})],V.prototype,"format",2),M([A({attribute:!1})],V.prototype,"palette",2),M([A({attribute:!1})],V.prototype,"hiddenSeries",2),M([A({attribute:!1})],V.prototype,"selected",2),M([A({attribute:"selection-mode"})],V.prototype,"selectionMode",2),M([A({attribute:!1})],V.prototype,"highlighted",2),M([A({attribute:!1})],V.prototype,"highlightScope",2),M([A({type:Boolean,reflect:!0})],V.prototype,"loading",2),M([A()],V.prototype,"error",2),M([A({attribute:"empty-message"})],V.prototype,"emptyMessage",2),M([A()],V.prototype,"description",2),M([A({type:Boolean,reflect:!0})],V.prototype,"decorative",2),M([A({type:Boolean,attribute:"accessible-table"})],V.prototype,"accessibleTable",2),M([A({attribute:!1})],V.prototype,"zoom",2),M([A({attribute:!1})],V.prototype,"view",2),M([A({type:Boolean,reflect:!0})],V.prototype,"zoomable",2),M([A({type:Boolean,reflect:!0})],V.prototype,"editable",2),M([A({attribute:"sync-id"})],V.prototype,"syncId",2),M([A({type:Boolean,attribute:"cross-filter"})],V.prototype,"crossFilter",2),M([A({converter:{fromAttribute:t=>t===null?!1:t===""?!0:Number(t)}})],V.prototype,"animated",2),M([A({type:Boolean,reflect:!0})],V.prototype,"responsive",2),M([ne()],V.prototype,"tip",2),M([ne()],V.prototype,"overlay",2),M([ne()],V.prototype,"portal",2),M([ne()],V.prototype,"measured",2),M([ne()],V.prototype,"viewState",2),M([ne()],V.prototype,"highlightState",2),M([ne()],V.prototype,"crossState",2),M([ne()],V.prototype,"focused",2),M([ne()],V.prototype,"hiddenState",2),M([ne()],V.prototype,"zoomState",2),M([ne()],V.prototype,"selectedState",2);var Z=class extends V{constructor(){super(...arguments);this.series=[];this.labels=!1;this.connectNulls=!1;this.stacked=!1;this.brush=!1;this.crosshair=!1}input(){let{series:t,categories:r,xAxis:i,yAxis:o,rightAxis:s,references:l,annotations:c,labels:d,curve:u,connectNulls:h,nulls:b,stacked:y,stackOffset:x,orientation:p,radius:S,barGap:v,barWidth:f,sort:w,transform:T,transforms:k,bins:z,binWidth:G,binDomain:j,binMode:B,sampling:Y,brush:Q,crosshair:re}=this;return{...this.sized(),series:t,categories:r,xAxis:i,yAxis:o,rightAxis:s,references:l,annotations:c,labels:d,curve:u,connectNulls:h,nulls:b,stacked:y,stackOffset:x,orientation:p,radius:S,barGap:v,barWidth:f,sort:w,transform:T,transforms:k,bins:z,binWidth:G,binDomain:j,binMode:B,sampling:Y,brush:Q,crosshair:re}}};M([A({attribute:!1})],Z.prototype,"series",2),M([A({attribute:!1})],Z.prototype,"categories",2),M([A({attribute:!1})],Z.prototype,"xAxis",2),M([A({attribute:!1})],Z.prototype,"yAxis",2),M([A({attribute:!1})],Z.prototype,"rightAxis",2),M([A({attribute:!1})],Z.prototype,"references",2),M([A({attribute:!1})],Z.prototype,"annotations",2),M([A({type:Boolean,reflect:!0})],Z.prototype,"labels",2),M([A()],Z.prototype,"curve",2),M([A({type:Boolean,attribute:"connect-nulls"})],Z.prototype,"connectNulls",2),M([A()],Z.prototype,"nulls",2),M([A({reflect:!0,converter:{fromAttribute:t=>t==="percent"?"percent":t!==null}})],Z.prototype,"stacked",2),M([A({attribute:"stack-offset"})],Z.prototype,"stackOffset",2),M([A()],Z.prototype,"orientation",2),M([A({type:Number})],Z.prototype,"radius",2),M([A({type:Number,attribute:"bar-gap"})],Z.prototype,"barGap",2),M([A({type:Number,attribute:"bar-width"})],Z.prototype,"barWidth",2),M([A()],Z.prototype,"sort",2),M([A()],Z.prototype,"transform",2),M([A({attribute:!1})],Z.prototype,"transforms",2),M([A({type:Number})],Z.prototype,"bins",2),M([A({type:Number,attribute:"bin-width"})],Z.prototype,"binWidth",2),M([A({attribute:!1})],Z.prototype,"binDomain",2),M([A({attribute:"bin-mode"})],Z.prototype,"binMode",2),M([A({attribute:!1})],Z.prototype,"sampling",2),M([A({type:Boolean,reflect:!0})],Z.prototype,"brush",2),M([A({type:Boolean,reflect:!0})],Z.prototype,"crosshair",2);var zi=e=>e.defs&&e.defs.length?te`<defs>${e.defs.map(n=>te`<linearGradient id=${n.id} x1="0" y1="0" x2=${n.vertical===!1?1:0} y2=${n.vertical===!1?0:1}>${n.stops.map(t=>te`<stop offset=${t.offset} stop-color=${t.color} stop-opacity=${W(t.opacity)}></stop>`)}</linearGradient>`)}</defs>`:X,ht=e=>te`${e.map((n,t)=>{let r=n.title?te`<title>${n.title}</title>`:X,i=n.item?t:void 0;switch(n.kind){case"path":return te`<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 te`<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 te`<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 te`<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 te`<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 ft=class extends Z{render(){return this.root(jt(this.input()),"bar",this.label??"Bar chart")}};ft=M([Oi("skdx-bar-chart")],ft);export{ft as SkdxBarChart};
|
package/dist/boxplot.cjs
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";var me=Object.defineProperty;var $t=Object.getOwnPropertyDescriptor;var rn=Object.getOwnPropertyNames;var on=Object.prototype.hasOwnProperty;var sn=(e,n)=>{for(var t in n)me(e,t,{get:n[t],enumerable:!0})},an=(e,n,t,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of rn(n))!on.call(e,i)&&i!==t&&me(e,i,{get:()=>n[i],enumerable:!(r=$t(n,i))||r.enumerable});return e};var cn=e=>an(me({},"__esModule",{value:!0}),e),h=(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&&me(n,t,i),i};var On={};sn(On,{SkdxBoxplot:()=>G});module.exports=cn(On);var V=require("lit/decorators.js");var Mt=e=>Number(e.toPrecision(12)),ln,un=e=>(ln??(ln=new Intl.NumberFormat)).format(Mt(e)),dn=e=>{let n=Math.round(Math.abs(e)),t=e<0?"-":"",r=Math.floor(n/3600),i=Math.floor(n%3600/60),o=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 be(e){if(e===void 0)return un;if(typeof e=="function")return e;let{style:n,locale:t,digits:r,unit:i="",timeZone:o}=e,s=d=>i?f=>d(f)+i:d,a=d=>r===void 0?d===void 0?{}:{maximumFractionDigits:d}:{minimumFractionDigits:r,maximumFractionDigits:r},c=d=>{let f=new Intl.NumberFormat(t,d);return s(g=>f.format(Mt(g)))},u=d=>{let f=new Intl.DateTimeFormat(t,o?{...d,timeZone:o}:d);return g=>f.format(g)};switch(n){case"integer":return c({maximumFractionDigits:0});case"decimal":return c(a(2));case"percent":return c({style:"percent",...a(0)});case"currency":return c({style:"currency",currency:e.currency??"USD",...a()});case"compact":return c({notation:"compact",...a(1)});case"scientific":return c({notation:"scientific",...a(2)});case"date":return u({dateStyle:"medium"});case"time":return u({timeStyle:"short"});case"datetime":return u({dateStyle:"medium",timeStyle:"short"});case"duration":return s(dn)}}function xe([e,n],[t,r]){let i=n-e;return o=>i===0?t:t+(o-e)/i*(r-t)}function ye(e,n,t=5){if(e===n)return[e];let r=(n-e)/Math.max(1,t),i=10**Math.floor(Math.log10(r)),o=r/i,s=(o<1.5?1:o<3.5?2:o<7.5?5:10)*i,a=Math.floor(e/s)*s,c=Math.ceil(n/s)*s,u=[];for(let d=a;d<=c+s/2;d+=s)u.push(Ct(d));return u}function St(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 Ct=e=>Number(e.toPrecision(12)),p=e=>Number(e.toFixed(2)),Y=e=>typeof e=="number"&&Number.isFinite(e),ve=e=>e.filter(Y);function It(e){let n=1/0,t=-1/0;for(let r of e)Y(r)&&(r<n&&(n=r),r>t&&(t=r));return n===1/0?[0,0]:[n,t]}var ae=1e3,ce=60*ae,le=60*ce,ge=24*le,Pn=[ae,5*ae,15*ae,30*ae,ce,5*ce,15*ce,30*ce,le,3*le,6*le,12*le,ge,2*ge,7*ge,14*ge];function Tt(e,n){let t=Math.floor(Math.log10(e)),r=Math.ceil(Math.log10(n)),i=r-t<=1?[1,2,5]:[1],o=[];for(let s=t;s<=r;s++)for(let a of i)o.push(Ct(a*10**s));return o.filter(s=>s>=e/1.0001&&s<=n*1.0001)}var hn=/-?\d*\.?\d+(?:e[-+]?\d+)?/gi,pn=/([MLTHVCSQAZmlthvcsqaz])([^MLTHVCSQAZmlthvcsqaz]*)/g,fn={M:2,L:2,T:2,C:6,S:4,Q:4,A:7,H:-1,V:-2};function mn(e,n,t){return e.replace(pn,(r,i,o)=>{let s=fn[i];if(s===void 0)return i+o;let c=(o.match(hn)??[]).map((u,d)=>{let f=Number(u);if(s===-1)return String(f+n);if(s===-2)return String(f+t);let g=d%s;return s===7?g===5?String(f+n):g===6?String(f+t):u:String(g%2===0?f+n:f+t)});return i+c.join(" ")})}var zt=(e,n,t)=>e.map(r=>{switch(r.kind){case"rect":return{...r,x:r.x+n,y:r.y+t};case"circle":return{...r,cx:r.cx+n,cy:r.cy+t};case"line":return{...r,x1:r.x1+n,x2:r.x2+n,y1:r.y1+t,y2:r.y2+t};case"text":return{...r,x:r.x+n,y:r.y+t};case"path":return{...r,d:mn(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)"))),S={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 At=(e,n)=>n??Oe[e%Oe.length];var Q={top:16,right:16,bottom:32,left:48};function Ot(e,n,t=Q){return{x:t.left,y:t.top,width:Math.max(0,e-t.left-t.right),height:Math.max(0,n-t.top-t.bottom)}}function ue(e){let n=e.legend;if(n)return n===!0?{}:n.enabled===!1?void 0:n}function Lt(e){let n=e.tooltip;return n===void 0||n===!0?{enabled:!0}:n===!1?{enabled:!1}:{...n,enabled:n.enabled??!0}}var we=20,bn=120,Bt=e=>{let n=ue(e);return n&&(n.position==="left"||n.position==="right")?n.width??bn:0},Be=(e,n=600,t=300)=>({width:(e.width??n)-Bt(e),height:(e.height??t)-(ue(e)?.position==="bottom"?we:0)}),Pt=e=>{let n=ue(e);return n&&(n.position===void 0||n.position==="top")?we:0},E=6.5,Pe=(e,n,t)=>t??(e.palette&&e.palette.length>0?e.palette[n%e.palette.length]:At(n)),Rt=(e,n)=>e.hiddenSeries?.includes(n)??!1;function Le(e,n,t=[],r={},i=10,o=8,s=!1){let a=[],c=r.maxItems,u=c!==void 0&&c>=0&&e.length>c?e.slice(0,c):e,d=e.length-u.length,f=r.interactive??!0,g=o,I=i,v=(l,y,w,$)=>{let A=(y?18:4)+l.length*E;g>o&&(s||g+A>n-8)&&(g=o,I+=we),y&&a.push({kind:"rect",part:"legend-swatch",x:g,y:I-5,width:10,height:10,fill:y,opacity:$?.3:void 0,item:w}),a.push({kind:"text",part:"legend-label",x:g+(y?14:0),y:I,text:l,baseline:"middle",fill:$?S.grid:S.label,item:w}),g+=A+12};for(let l of u){let y=t.includes(l.name),w=f?{label:l.name,series:l.name,legend:!0}:void 0;v(r.formatter?.(l.name)??l.name,l.color,w,y)}return d>0&&v(`+${d} more`,void 0,void 0,!1),r.align==="end"?gn(a,n):a}function gn(e,n){let t=new Map;for(let i of e){let o=i.kind==="rect"?i.y+5:i.y;t.set(o,[...t.get(o)??[],i])}let r=[];for(let i of t.values()){let o=Math.max(...i.map(a=>a.kind==="rect"?a.x+a.width:a.x+a.text.length*E)),s=n-8-o;for(let a of i)r.push({...a,x:a.x+s})}return r}var xn=(e,n,t={})=>new Set(Le(e,n,[],t).flatMap(r=>r.kind==="text"?[r.y]:[])).size;function Re(e,n,t,r=[]){let i=ue(e),o=i&&e.direction==="rtl"&&i.align===void 0?{...i,align:"end"}:i,s=Lt(e),a=o?.position==="bottom",c=Bt(e),u=e.hiddenSeries??[],d=o?c?Le(r,1/0,u,o,10,(o.position==="right"?n:0)+8,!0):Le(r,n,u,o,a?t+10:10):[],f=a?xn(r,n,o):0;return{width:n+c,height:a?t+Math.max(1,f)*we:t,legendOffset:o?.position==="left"?c:void 0,tooltip:s.enabled,tooltipFormatter:s.formatter,axisTooltipFormatter:s.axisFormatter,tooltipPortal:s.portal,tooltipPlacement:s.placement,tooltipAnchored:s.followPointer===!1?!0:void 0,description:e.description,decorative:e.decorative,animate:e.animate===!0?300:e.animate||void 0,responsive:!!e.responsive,shapes:d}}function Ne(e){let n=e.legendOffset;if(!n)return e;let t=[...zt(e.shapes.filter(c=>!c.part.startsWith("legend-")),n,0),...e.shapes.filter(c=>c.part.startsWith("legend-"))],r=c=>({...c,x:c.x+n}),i=e.hit?{...e.hit,plot:r(e.hit.plot),xs:e.hit.xs.map(c=>c+n),brush:e.hit.brush?{box:r(e.hit.brush.box),window:r(e.hit.brush.window)}:void 0}:void 0,o=e.edit,s=o?{...o,scale:c=>o.scale(c)+n,invert:c=>o.invert(c-n),bars:o.bars.map(c=>({...c,x0:c.x0+n,x1:c.x1+n}))}:void 0,a=e.map?{...e.map,plot:r(e.map.plot)}:void 0;return{...e,shapes:t,hit:i,edit:s,map:a,legendOffset:void 0}}function ke(e,n,t,r,i,o="auto"){let s=Array.isArray(t)?t:[t],a=Math.max(...s.map(g=>g.length))*E+12,c=6+s.length*16,u=o==="top"?{x:e-a/2,y:n-c-8}:o==="bottom"?{x:e-a/2,y:n+8}:o==="left"?{x:e-a-8,y:n-c/2}:o==="right"?{x:e+8,y:n-c/2}:{x:e+12,y:n-c-6},d=Math.max(0,Math.min(r-a,u.x)),f=Math.max(0,Math.min(i-c,u.y));return[{kind:"rect",part:"tooltip",x:p(d),y:p(f),width:p(a),height:c,fill:"var(--skdx-color-surface-raised)",stroke:S.axis,rx:3},...s.map((g,I)=>({kind:"text",part:"tooltip-label",x:p(d+6),y:p(f+11+I*16),text:g,baseline:"middle",fill:"var(--skdx-color-text-default)",weight:s.length>1&&I===0?"bold":void 0}))]}function Nt(e,n){let[t,r]=It(e);return n?[Math.min(0,t),Math.max(0,r)]:[t,r]}function Dt([e,n],t,r=!1,i){let o=typeof r=="boolean"?{scale:r?"log":"linear"}:r,s=be(o.format??i),a=o.min??e,c=o.max??n;o.reversed&&(t=[t[1],t[0]]);let u={id:o.id,position:o.position,options:o};if(o.scale==="sqrt"){let l=N=>Math.sign(N)*Math.sqrt(Math.abs(N)),y=o.nice===!1?[a,c]:ye(a,c,o.ticks),w=o.min??y[0],$=o.max??y[y.length-1],A=xe([l(w),l($)],t),P=N=>A(l(N)),F=ye(w,$,o.ticks).filter(N=>N>=w-1e-9&&N<=$+1e-9);return{...u,scale:P,domain:[w,$],format:s,ticks:(F.length>=2?F:[w,$]).map(N=>({pos:p(P(N)),label:s(N)})),zero:p(P(Math.min(Math.max(0,w),$)))}}if(o.scale==="log"){let l=Math.max(a,Number.EPSILON),y=Math.max(c,l),w=Tt(l,y),$=[Math.log10(l),Math.log10(y)],A=xe($,t),P=F=>A(Math.log10(Math.max(F,Number.EPSILON)));return{...u,scale:P,domain:$,format:s,ticks:w.map(F=>({pos:p(P(F)),label:s(F)})),zero:p(t[0])}}let d=ye(a,c,o.ticks),f=[o.min??(o.nice===!1?a:d[0]),o.max??(o.nice===!1?c:d[d.length-1])],g=xe(f,t),I=d.filter(l=>l>=f[0]-1e-9&&l<=f[1]+1e-9),v=(I.length>=2?I:[f[0],f[1]]).map(l=>({pos:p(g(l)),label:s(l)}));return{...u,scale:g,domain:f,format:s,ticks:v,zero:p(g(Math.min(Math.max(0,f[0]),f[1])))}}var Gt=e=>e?.grid!==!1;function De(e,n){if(e.length<2)return e;let t=e.reduce((i,o)=>Math.max(i,o.label.length),0)*E+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 Ft(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}=Be(e,t,r),a=i==="error"?e.error:i==="loading"?"Loading\u2026":e.emptyMessage??"No data available",c=[];return i==="loading"&&c.push({kind:"rect",part:"skeleton",x:0,y:0,width:o,height:s,fill:"var(--skdx-color-surface-sunken)",rx:4}),c.push({kind:"text",part:`state-${i}`,x:p(o/2),y:p(s/2),text:a,anchor:"middle",baseline:"middle",fill:i==="error"?"var(--skdx-color-text-danger)":S.label}),{...Re(e,o,s),shapes:c,tooltip:!1}}function jt(e,n={}){let{plot:t,xTicks:r,yTicks:i,baseline:o}=e,s=t.x+t.width,a=t.y+t.height,c=[],u=n.grid??!0,d=(v,l)=>l?{kind:"line",part:"grid",x1:v.pos,x2:v.pos,y1:t.y,y2:a,stroke:S.grid}:{kind:"line",part:"grid",x1:t.x,x2:s,y1:v.pos,y2:v.pos,stroke:S.grid},f=n.x?.tickRotation??0,g=(v,l,y,w)=>f?Z(v,l,y,{part:w,anchor:f<0?"end":"start",baseline:"middle",rotate:f}):Z(v,l,y,{part:w,anchor:"middle"}),I=(v,l,y,w,$)=>{for(let A of v)c.push(l==="x"?{kind:"line",part:"tick",x1:A.pos,x2:A.pos,y1:y,y2:p(y+w*$),stroke:S.axis}:{kind:"line",part:"tick",x1:y,x2:p(y+w*$),y1:A.pos,y2:A.pos,stroke:S.axis})};if(n.categoryGrid)for(let v of r)c.push(d(v,!n.horizontal));if(n.horizontal){let v=n.axes??[{ticks:i,position:"bottom",offset:0,label:n.yLabel,...n.y}];if(u)for(let l of i)c.push(d(l,!0));v[0]?.showLine!==!1&&c.push({kind:"line",part:"axis",x1:o,x2:o,y1:t.y,y2:a,stroke:S.axis});for(let l of v){let y=l.position==="top"||l.position==="right",w=p(y?t.y-l.offset:a+l.offset),$=y||l.offset>0;l.showLine&&$&&c.push({kind:"line",part:"axis",x1:t.x,x2:s,y1:w,y2:w,stroke:S.axis}),l.showTicks&&I(l.ticks,"x",w,y?-1:1,l.tickSize??4);let A=p(y?w-8:w+20);for(let P of l.ticks)c.push(y?Z(P.pos,A,P.label,{part:"x-label-top",anchor:"middle"}):g(P.pos,A,P.label,"x-label"));l.label&&c.push($?Z(4,A,l.label,{part:"axis-title",anchor:"start",baseline:y?void 0:"middle"}):Z(4,t.y-6,l.label,{part:"axis-title",anchor:"start"}))}n.x?.showLine&&c.push({kind:"line",part:"axis",x1:n.rtl?s:t.x,x2:n.rtl?s:t.x,y1:t.y,y2:a,stroke:S.axis}),n.x?.showTicks&&I(r,"y",n.rtl?s:t.x,n.rtl?1:-1,n.x.tickSize??4);for(let l of r)c.push(n.rtl?Z(s+8,l.pos,l.label,{part:"y-label",anchor:"start",baseline:"middle"}):Z(t.x-8,l.pos,l.label,{part:"y-label",anchor:"end",baseline:"middle"}))}else{if(u)for(let l of i)c.push(d(l,!1));n.y?.showLine!==!1&&c.push({kind:"line",part:"axis",x1:t.x,x2:s,y1:o,y2:o,stroke:S.axis});let v=n.axes??[{ticks:i,position:"left",offset:0,label:n.yLabel,...n.y},...n.rightTicks?[{ticks:n.rightTicks,position:"right",offset:0,label:n.rightLabel}]:[]];for(let l of v){let y=l.position==="left",w=y?t.x-l.offset:s+l.offset,$=y?"y-label":"y-label-right";l.showLine&&c.push({kind:"line",part:"axis",x1:p(w),x2:p(w),y1:t.y,y2:a,stroke:S.axis}),l.showTicks&&I(l.ticks,"y",p(w),y?-1:1,l.tickSize??4);for(let A of l.ticks)c.push(Z(p(y?w-8:w+8),A.pos,A.label,{part:$,anchor:y?"end":"start",baseline:"middle"}));l.label&&c.push(Z(p(y?l.offset===0?4:Math.max(4,w-40):l.offset===0?e.width-4:Math.min(e.width-4,w+40)),t.y-6,l.label,{part:"axis-title",anchor:y?"start":"end"}))}n.x?.showTicks&&I(r,"x",a,1,n.x.tickSize??4);for(let l of r)c.push(g(l.pos,a+(f?12:20),l.label,"x-label"))}return n.xLabel&&c.push(Z(p(t.x+t.width/2),e.height-4,n.xLabel,{part:"axis-title",anchor:"middle"})),n.horizontal&&n.rightLabel&&c.push(Z(e.width-4,t.y-6,n.rightLabel,{part:"axis-title",anchor:"end"})),c}var Z=(e,n,t,r={})=>({kind:"text",part:"label",x:e,y:n,text:t,fill:S.label,...r});function $e(e){return e==null?[]:(Array.isArray(e)?e:[e]).map(t=>typeof t=="object"?t:{id:t})}var Ge=e=>e.id??e.name??e.series,Vt=e=>e.seriesId??e.series;function _(e,n){let t=!1;return n.id!==void 0&&(t=!0,Ge(e)!==n.id&&e.id!==n.id&&e.name!==n.id)||n.series!==void 0&&(t=!0,Vt(e)!==n.series&&e.series!==n.series)||n.index!==void 0&&(t=!0,e.index!==n.index)||n.category!==void 0&&(t=!0,e.category!==n.category)?!1:t}function U(e){let n={},t=Ge(e);t!==void 0&&(n.id=t);let r=Vt(e);return r!==void 0&&e.series!==void 0&&(n.series=r),e.index!==void 0&&(n.index=e.index),n}var Fe=(e,n)=>e.id===n.id&&e.series===n.series&&e.index===n.index&&e.category===n.category;function je(e,n,t){let r=$e(e),i=U(n),o=r.some(s=>_(n,s));return t==="single"?o?[]:[i]:o?r.filter(s=>!_(n,s)):[...r,i]}var yn=.2;function vn(e){let n=S.focus;switch(e.kind){case"rect":return{kind:"rect",part:"selected",x:e.x-1.5,y:e.y-1.5,width:e.width+3,height:e.height+3,fill:"none",stroke:n,rx:e.rx};case"circle":return{kind:"circle",part:"selected",cx:e.cx,cy:e.cy,r:e.r+2.5,fill:"none",stroke:n};case"path":return{kind:"path",part:"selected",d:e.d,fill:"none",stroke:n,strokeWidth:2.5};case"line":return{...e,part:"selected",stroke:n,strokeWidth:(e.strokeWidth??1)+3,title:void 0,item:void 0};case"text":return}}var wn=(e,n)=>e.kind==="text"?{...e,fill:S.grid}:{...e,opacity:(e.opacity??1)*n};function Ve(e,n){let t=$e(n.selected),r=n.highlighted===void 0||n.highlighted===null?[]:$e(n.highlighted),i=r[0];if(t.length===0&&!i)return e;let o={highlighted:n.highlightScope?.highlighted??"item",faded:n.highlightScope?.faded??"global"},s=[],a=d=>!i||r.some(f=>_(d,f))?!0:o.highlighted==="series"?r.some(f=>f.series!==void 0&&_(d,{series:f.series})):!1,c=d=>{if(!i||o.faded==="none"||a(d))return!1;if(o.faded==="series"){let f=i.series;return f!==void 0&&_(d,{series:f})}return!0},u=e.shapes.map(d=>{let f=d.item;if(!f||f.legend)return d;if(t.some(g=>_(f,g))){let g=vn(d);g&&s.push(g)}return c(f)?wn(d,yn):d});return s.length?{...e,shapes:[...u,...s]}:{...e,shapes:u}}function ne(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 Ze=(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 de(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 qe(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:S.axis,dash:"3 3"}}function He(e,n,t){let r=e.hit;if(!r||!r.crosshair||r.xs.length===0||!Ze(r.plot,n,t))return[];let i=qe(e,n),{rows:o}=de(e,n),s=e.tooltipAnchored?r.plot.y+8:t;return[i,...ke(i.x1,s,o,e.width,e.height,e.tooltipPlacement)]}function _e(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 We(e,n,t,r,i){if(!e.tooltip)return{lines:[],shapes:[]};if(e.hit?.crosshair){let{x:c,y:u}=ne(t,r,i,e.width,e.height);if(Ze(e.hit.plot,c,u)){let d=de(e,c),f=qe(e,c);if(d&&f)return{lines:d.rows,shapes:[f]}}}let o=n?.closest?.("[data-skdx-part]"),s=e.tooltipFormatter?K(e,n)?.item:void 0,a=s&&e.tooltipFormatter?.(s)||o&&Array.from(o.children).find(c=>c.tagName.toLowerCase()==="title")?.textContent;return a?{lines:Array.isArray(a)?a:[a],shapes:[]}:{lines:[],shapes:[]}}function qt(e,n,t,r,i,o,s){let a=e?.closest?.("[data-skdx-part]"),c=s&&s.tooltipFormatter?K(s,e)?.item:void 0,u=c&&s?.tooltipFormatter?.(c)||a&&Array.from(a.children).find(v=>v.tagName.toLowerCase()==="title")?.textContent;if(!u)return[];let d=s?.tooltipAnchored?K(s,e):void 0,f=d?s?.shapes[d.index]:void 0,{x:g,y:I}=f?he(f):ne(n,t,r,i,o);return ke(g,I,u,i,o,s?.tooltipPlacement)}function Ee(e,n,t,r,i){if(!e.tooltip)return[];if(e.hit?.crosshair){let{x:o,y:s}=ne(t,r,i,e.width,e.height),a=He(e,o,s);if(a.length>0)return a}return qt(n,t,r,i,e.width,e.height,e)}function Ue(e,n){let t=K(e,n);return t&&!t.item.legend?U(t.item):null}var kn=(e,n)=>{let{x:t,y:r}=he(e),i=e.kind==="circle"?e.cy:e.kind==="rect"?e.y+e.height/2:r;return t>=n.x&&t<=n.x+n.width&&i>=n.y&&i<=n.y+n.height};function Ke(e,n){let t=new Set,r=[];for(let i of e.shapes){if(!i.item||i.item.legend||i.part==="anchor"||!kn(i,n))continue;let o=U(i.item),s=JSON.stringify(o);t.has(s)||(t.add(s),r.push(o))}return r}var Ye=e=>({kind:"rect",part:"selection-box",x:p(e.x),y:p(e.y),width:p(e.width),height:p(e.height),fill:S.focus,opacity:.12,stroke:S.focus}),Se=(e,n,t,r)=>({x:Math.min(e,t),y:Math.min(n,r),width:Math.abs(t-e),height:Math.abs(r-n)});function Ht(e,n,t){let r=!1;for(let i=0,o=e.length-1;i<e.length;o=i++){let s=e[i],a=e[o];s.y>t!=a.y>t&&n<(a.x-s.x)*(t-s.y)/(a.y-s.y)+s.x&&(r=!r)}return r}function Qe(e,n){if(n.length<3)return[];let t=new Set,r=[];for(let i of e.shapes){if(!i.item||i.item.legend||i.part==="anchor")continue;let{x:o,y:s}=he(i),a=i.kind==="circle"?i.cy:i.kind==="rect"?i.y+i.height/2:s;if(!Ht(n,o,a))continue;let c=U(i.item),u=JSON.stringify(c);t.has(u)||(t.add(u),r.push(c))}return r}var Xe=e=>({kind:"path",part:"selection-lasso",d:e.length?`M${e.map(n=>`${p(n.x)} ${p(n.y)}`).join("L")}`:"",fill:S.focus,fillOpacity:.12,stroke:S.focus,dash:"4 3"}),Me=6;function Je(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 et(e,n,t){let r=e.edit;return _t(r,n,r.invert(n.bar.x0+t)-r.invert(n.bar.x0))}function tt(e,n,t){let r=e.edit,i=t.key==="ArrowRight"?1:t.key==="ArrowLeft"?-1:0;if(!r||n===null||!i||!(t.shiftKey||t.altKey))return;let o=r.bars.find(c=>c.index===n);if(!o)return;let s=t.altKey?t.shiftKey?"start":"end":"move",a=r.snap??r.invert(o.x0+10)-r.invert(o.x0);return _t(r,{bar:o,mode:s},i*a)}function _t(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 nt(e,n,t){let r=e.edit,i=r.scale(t.start),o=r.scale(t.end);return{kind:"rect",part:"edit-ghost",x:p(Math.min(i,o)),y:p(n.bar.y),width:p(Math.max(1,Math.abs(o-i))),height:p(n.bar.height),fill:S.focus,opacity:.25,stroke:S.focus,rx:2}}var $n=64,Mn=e=>Math.max(1,Math.min($n,e));function rt(e,n,t,r){let i=n>0?.8:1.25,o=Mn(e.view.zoom*i);if(o===e.view.zoom)return e.view;let{plot:s,scale:a}=e,[c,u]=e.view.center,d=(t-(s.x+s.width/2))/a,f=(r-(s.y+s.height/2))/a,g=e.view.zoom/o;return{center:[c+d*(1-g),e.fromY(e.toY(u)-f*(1-g))],zoom:o}}function it(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 K(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 Ce=e=>e.shapes.flatMap((n,t)=>n.item&&!n.item.legend?[t]:[]);function he(e){switch(e.kind){case"rect":return{x:e.x+e.width/2,y:e.y};case"circle":return{x:e.cx,y:e.cy-e.r};case"line":return{x:(e.x1+e.x2)/2,y:Math.min(e.y1,e.y2)};case"text":return{x:e.x,y:e.y};case"path":{let n=/M\s*(-?[\d.]+)[ ,](-?[\d.]+)/.exec(e.d);return n?{x:Number(n[1]),y:Number(n[2])}:{x:0,y:0}}}}function ot(e,n){let t=n===null?void 0:e.shapes[n];if(!t)return[];let r=S.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*E+4,height:16,fill:"none",stroke:r,rx:2};break;case"path":i={kind:"path",part:"focus",d:t.d,stroke:r,strokeWidth:2,fill:"none"};break}let{x:o,y:s}=he(t),a=t.item&&e.tooltipFormatter?.(t.item)||(t.item?.label??t.title??"");return[i,...a?ke(p(o),p(s),a,e.width,e.height):[]]}function st(e,n,t){let r=Ce(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 ee=2,te=(e,n,t)=>{let r=Math.max(ee,Math.min(t,Math.round(n))),i=Math.max(0,Math.min(t-r,Math.round(e)));return{start:i,end:i+r}},Wt=(e,n)=>!e||e.start<=0&&e.end>=n;function at(e,n,t){if(e.count<=ee||!e.plot.width)return;let{start:r,end:i}=e.zoom,o=i-r,s=n>0?1.25:.8,a=Math.max(ee,Math.min(e.count,Math.round(o*s)));if(a===o)return n>0&&!Wt(e.zoom,e.count)?te(r,a,e.count):void 0;let c=Math.max(0,Math.min(1,(t-e.plot.x)/e.plot.width)),u=r+c*o;return te(u-c*a,a,e.count)}function ct(e,n,t,r){let i=n.end-n.start,o=Math.max(ee,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 te(n.start+s*i-s*o,o,e.count)}function lt(e,n,t){let r=n.end-n.start,i=e.plot.width/Math.max(1,r);return te(n.start-t/i,r,e.count)}function ut(e,n,t){let r=e.brush;if(!r||!Ze(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:te(s-o/2,o,e.count)}}function dt(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 te(t.start+o,t.end-t.start,e.count);if(n==="left")return{start:Math.max(0,Math.min(t.end-ee,Math.round(t.start+o))),end:t.end};let s=Math.min(e.count,Math.max(t.start+ee,Math.round(t.end+o)));return{start:t.start,end:s}}function pt(e,n){switch(n.type){case"svg":return Promise.resolve(ht(e,n.label,n.resolve));case"csv":return Promise.resolve(Yt(n.rows));case"png":{if(typeof document>"u"||typeof Image>"u")return Promise.reject(new Error("PNG export needs a browser"));let t=ht(e,n.label,n.resolve);return Kt(t,e.width,e.height,n.scale,n.background)}}}var W=e=>e.replace(/&/g,"&").replace(/</g,"<").replace(/"/g,"""),pe=e=>e.filter(([,n])=>n!==void 0&&n!=="").map(([n,t])=>` ${n}="${W(String(t))}"`).join("");function Et(e){let n=e.title?`<title>${W(e.title)}</title>`:"",t=["data-skdx-part",e.part];switch(e.kind){case"path":return`<path${pe([t,["d",e.d],["fill",e.fill??"none"],["stroke",e.stroke],["stroke-width",e.strokeWidth],["stroke-linecap",e.strokeLinecap],["stroke-linejoin",e.strokeLinejoin],["stroke-dasharray",e.dash],["opacity",e.opacity],["fill-opacity",e.fillOpacity]])}>${n}</path>`;case"rect":return`<rect${pe([t,["x",e.x],["y",e.y],["width",e.width],["height",e.height],["rx",e.rx],["fill",e.fill],["stroke",e.stroke],["fill-opacity",e.opacity]])}>${n}</rect>`;case"line":return`<line${pe([t,["x1",e.x1],["y1",e.y1],["x2",e.x2],["y2",e.y2],["stroke",e.stroke],["stroke-width",e.strokeWidth],["stroke-dasharray",e.dash],["opacity",e.opacity]])}>${n}</line>`;case"circle":return`<circle${pe([t,["cx",e.cx],["cy",e.cy],["r",e.r],["fill",e.fill],["stroke",e.stroke]])}>${n}</circle>`;case"text":return`<text${pe([t,["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]])}>${W(e.text)}</text>`}}function Ut(e){let n=e.defs??[];return n.length===0?"":`<defs>${n.map(t=>`<linearGradient id="${W(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="${W(r.color)}"${r.opacity===void 0?"":` stop-opacity="${r.opacity}"`}/>`).join("")}</linearGradient>`).join("")}</defs>`}function ht(e,n,t){let r=Ut(e)+e.shapes.map(Et).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="${W(n)}" font-family="${W(S.fontFamily)}" font-size="${W(S.fontSize)}"><title>${W(n)}</title>${r}</svg>`}function Kt(e,n,t,r=2,i){return new Promise((o,s)=>{let a=URL.createObjectURL(new Blob([e],{type:"image/svg+xml;charset=utf-8"})),c=new Image;c.onload=()=>{URL.revokeObjectURL(a);let u=document.createElement("canvas");u.width=Math.round(n*r),u.height=Math.round(t*r);let d=u.getContext("2d");if(!d)return s(new Error("canvas 2d context unavailable"));i&&(d.fillStyle=i,d.fillRect(0,0,u.width,u.height)),d.drawImage(c,0,0,u.width,u.height),u.toBlob(f=>f?o(f):s(new Error("toBlob failed")),"image/png")},c.onerror=()=>{URL.revokeObjectURL(a),s(new Error("svg could not be decoded"))},c.src=a})}function Yt(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 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 c=["",...a.slice(1).map(d=>d.replace(/:\s[^:]*$/,""))],u=r.rows.map(d=>[d[0],...d.slice(1).map(f=>f.slice(f.lastIndexOf(": ")+2))]);return[c,...u]}let i=e.shapes.flatMap(a=>a.item&&!a.item.legend&&!(a.part==="anchor"&&!a.title)?[a.item]:[]);if(i.length===0||i.length>t)return;let o=["series","name","category","value"].filter(a=>i.some(c=>c[a]!==void 0)),s=(a,c)=>a[c]===void 0?"":String(a[c]);return[o.map(a=>a[0]?.toUpperCase()+a.slice(1)),...i.map(a=>o.map(c=>s(a,c)))]}var mt=new Map;function Ie(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 Qt='[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}}${Qt}{animation:skdx-in var(--skdx-chart-duration,0ms) ease-out;transition:${["x","y","width","height","cx","cy","r","opacity","fill-opacity","d"].map(e=>`${e} var(--skdx-chart-duration,0ms) ease-out`).join(",")}}@media (prefers-reduced-motion:reduce){${Qt}{animation:none;transition:none}}`;function gt(e){let n=e.animate;return n&&e.shapes.length<=1500?`${n}ms`:void 0}var xt=e=>{let n=e.length;return n===0?0:n%2?e[(n-1)/2]:(e[n/2-1]+e[n/2])/2},Sn=(e,n)=>{if(e.length===0)return 0;let t=(e.length-1)*n,r=Math.floor(t),i=Math.ceil(t),o=e[r],s=e[i];return o+(s-o)*(t-r)},Cn=(e,n)=>{let t=e.length;if(t===0)return 0;let r=(t+1)*n-1;if(r<=0)return e[0];if(r>=t-1)return e[t-1];let i=Math.floor(r),o=e[i],s=e[i+1];return o+(s-o)*(r-i)};function In(e,n="linear"){let t=xt(e),r=e.length;if(r===0)return{q1:0,median:0,q3:0};if(n==="tukey"){let o=Math.floor(r/2),s=e.slice(0,r%2?o+1:o),a=e.slice((r%2,o));return{q1:xt(s),median:t,q3:xt(a)}}let i=n==="exclusive"?Cn:Sn;return{q1:i(e,.25),median:t,q3:i(e,.75)}}function Tn(e,n="linear",t=1.5){let r=ve(e).sort((v,l)=>v-l),{q1:i,median:o,q3:s}=In(r,n),a=s-i,c=i-t*a,u=s+t*a,d=r.filter(v=>v>=c&&v<=u),f=r.length?r.reduce((v,l)=>v+l,0)/r.length:0,g=d[0]??i,I=d[d.length-1]??s;return{name:"",q1:i,median:o,q3:s,min:g,max:I,low:g,high:I,mean:f,outliers:r.filter(v=>v<c||v>u),count:r.length}}var Xt=e=>"median"in e&&!("data"in e),Jt=e=>"data"in e&&Array.isArray(e.data[0]);function yt(e){let n=e.quartileMethod??"linear",t=e.whisker??1.5,r=[],i=e.categories,o=i!==void 0,s=(m,x)=>r.push({code:"invalid-value",severity:"warning",message:x,itemId:m.id??m.name}),a=[];e.series.forEach((m,x)=>{let O=Pe(e,x,m.color),L=(B,C,q)=>{let R=q??(C&&ve(C).length?Tn(C,n,t):void 0);return!R||![R.min,R.q1,R.median,R.q3,R.max].every(Y)?!1:(R.count!==void 0&&R.count<5&&r.push({code:"small-sample",severity:"warning",message:`Series "${m.name}"${o?` at "${i[B]??B}"`:""} has ${R.count} observation${R.count===1?"":"s"}; quartiles are not meaningful below 5.`,itemId:m.id??m.name}),a.push({si:x,ci:B,name:m.name,id:m.id,color:O,st:{...R,name:m.name},raw:C}),!0)};if(!o){(Xt(m)?L(0,void 0,m):Jt(m)?L(0,m.data.flat()):L(0,m.data))||s(m,`Series "${m.name}" has no valid observations or summary and was skipped.`);return}if(Xt(m)){s(m,`Series "${m.name}" is a summary, which cannot be grouped by categories; it was skipped.`);return}if(!Jt(m)){s(m,`Series "${m.name}" is not grouped (its data is one sample, not one per category); it was drawn in the first category.`),L(0,m.data);return}i.forEach((B,C)=>L(C,m.data[C]))});let c=Ft(e,a.length===0);if(c)return{...c,issues:r};let u=be(e.yAxis?.format??e.format),{width:d,height:f}=Be(e),g=e.orientation==="horizontal",I=o?i:e.series.map(m=>m.name),v=Math.max(0,...I.map(m=>m.length))*E,l=Ot(d,f,{...Q,top:Q.top+Pt(e)+(e.yAxis?.label?12:0),left:g?Math.max(Q.left,v+16):Q.left,bottom:Q.bottom+(g&&e.yAxis?.label?14:0)}),y=a.filter(m=>!Rt(e,m.name)),w=y.flatMap(m=>[m.st.min,m.st.max,...m.st.outliers??[],...Y(m.st.mean)?[m.st.mean]:[]]),$=Dt(Nt(w,!1),g?[l.x,l.x+l.width]:[l.y+l.height,l.y],e.yAxis??{},e.format),A=St(I.length,g?[l.y,l.y+l.height]:[l.x,l.x+l.width]),P=o?[...new Set(y.map(m=>m.si))]:[],F=o?A.bandwidth/Math.max(1,P.length):A.bandwidth,N=m=>o?A.start(m.ci)+(P.indexOf(m.si)+.5)*F:A.center(m.si),re=Re(e,d,f,e.series.map((m,x)=>({name:m.name,color:Pe(e,x,m.color)}))),fe=I.map((m,x)=>({pos:p(A.center(x)),label:m})),X=jt({...re,plot:l,xTicks:g?fe:De(fe,l.width),yTicks:g?De($.ticks,l.width):$.ticks,baseline:g?l.x:l.y+l.height},{horizontal:g,grid:Gt(e.yAxis),...g?{xLabel:e.yAxis?.label}:{yLabel:e.yAxis?.label}}),ze=(m,x,O)=>{let L=p($.scale(m)),B=p($.scale(x));return g?{x1:L,x2:B,y1:O,y2:O}:{x1:O,x2:O,y1:L,y2:B}},Ae=(m,x,O,L)=>{let B=$.scale(m),C=$.scale(x),q=Math.max(1,Math.abs(C-B));return g?{x:p(Math.min(B,C)),y:p(O-L/2),width:p(q),height:p(L)}:{x:p(O-L/2),y:p(Math.min(B,C)),width:p(L),height:p(q)}},j=(m,x)=>g?`${p($.scale(m))} ${p(x)}`:`${p(x)} ${p($.scale(m))}`,vt=(m,x,O,L,B,C,q)=>({kind:"circle",part:B,cx:g?p($.scale(m)):p(x),cy:g?p(x):p($.scale(m)),r:O,fill:L,opacity:q,title:C});for(let m of y){let{st:x,color:O,name:L,raw:B}=m,C=p(N(m)),q=o?i[m.ci]:void 0,R=q!==void 0?`${L}, ${q}`:L,ie=`${R}: min ${u(x.min)} Q1 ${u(x.q1)} median ${u(x.median)} Q3 ${u(x.q3)} max ${u(x.max)}${e.mean&&Y(x.mean)?` mean ${u(x.mean)}`:""}`,wt={label:ie,id:m.id,series:L,seriesId:m.id??L,category:q,index:o?m.ci:m.si,value:x.median},oe=F*.6,D=oe/2,en=g?{x1:p($.scale(x.median)),x2:p($.scale(x.median)),y1:p(C-D),y2:p(C+D)}:{x1:p(C-D),x2:p(C+D),y1:p($.scale(x.median)),y2:p($.scale(x.median))},kt=x.count,se=e.notched&&kt?Math.min(1.58*(x.q3-x.q1)/Math.sqrt(kt),(x.q3-x.q1)/2):0,tn=se?{kind:"path",part:"box",d:`M${[j(x.q1,C-D),j(x.median-se,C-D),j(x.median,C-D+oe/4),j(x.median+se,C-D),j(x.q3,C-D),j(x.q3,C+D),j(x.median+se,C+D),j(x.median,C+D-oe/4),j(x.median-se,C+D),j(x.q1,C+D)].join("L")}Z`,fill:O,stroke:O,fillOpacity:.5,title:ie,item:wt}:{kind:"rect",part:"box",...Ae(x.q1,x.q3,C,oe),fill:O,stroke:O,opacity:.5,title:ie,item:wt};if(X.push({kind:"line",part:"whisker",...ze(x.max,x.min,C),stroke:O,title:ie},tn,{kind:"line",part:"median",...en,stroke:O,title:ie},...(x.outliers??[]).map(H=>vt(H,C,3,O,"outlier",`${R}: ${u(H)}`))),e.mean&&Y(x.mean)){let H=g?p($.scale(x.mean)):C,J=g?C:p($.scale(x.mean));X.push({kind:"path",part:"mean",d:`M${H} ${p(J-4)}L${p(H+4)} ${J}L${H} ${p(J+4)}L${p(H-4)} ${J}Z`,fill:"var(--skdx-color-text-default)",title:`${R} mean: ${u(x.mean)}`})}e.points&&B&&ve(B).forEach((H,J)=>{let nn=(J*7919%97/96-.5)*oe*.8;X.push(vt(H,C+nn,2,O,"observation",`${R}: ${u(H)}`,.6))})}return{...re,shapes:[...X,...re.shapes],issues:r}}var k=require("lit"),b=require("lit/decorators.js"),T=require("lit/directives/if-defined.js");var zn={fromAttribute:()=>!1},M=class extends k.LitElement{constructor(){super(...arguments);this.legend=!1;this.tooltip=!0;this.selectionMode="none";this.loading=!1;this.decorative=!1;this.accessibleTable=!1;this.zoomable=!1;this.editable=!1;this.crossFilter=!1;this.animated=!1;this.responsive=!1;this.tip=[];this.overlay=[];this.portal=null;this.highlightState=null;this.crossState=null;this.lastCross=null;this.pointers=new Map;this.hover=null;this.token={};this.focused=null;this.hiddenState=[];this.drag=null;this.onPointerMove=t=>{let r=this.layout;if(!r)return;this.pointers.has(t.pointerId)&&this.pointers.set(t.pointerId,this.viewBox(t,r).x);let i=this.drag;if(i?.grab==="select"){let{x:o,y:s}=this.viewBox(t,r);this.overlay=[Ye(Se(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=[Xe(i.points)];return}if(i?.grab==="edit"){if(!i.gantt)return;let{x:o}=this.viewBox(t,r);i.change=et(r,i.gantt,o-i.x),this.overlay=[nt(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(it(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(ct(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"?lt(r.hit,i.zoom,o-i.x):dt(r.hit,i.grab,i.zoom,o-i.x));return}if(r.tooltipPortal){let{lines:o,shapes:s}=We(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(Ue(r,t.target)),this.syncId&&r.hit?.crosshair){let o=de(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=K(r,t.target)?.item.legend,a=this.canEdit(r)?Je(r,i,o):void 0;if(a){this.drag={x:i,y:o,zoom:{start:0,end:0},grab:"edit",gantt:a},t.currentTarget.setPointerCapture(t.pointerId),this.clearTip();return}if(this.brushing()&&!s){this.drag={x:i,y:o,zoom:{start:0,end:0},grab:this.selectionMode==="lasso"?"lasso":"select",points:[{x:i,y:o}]},t.currentTarget.setPointerCapture(t.pointerId),this.clearTip();return}if(this.canPan(r)&&r.map){let u=r.map.plot;if(i<u.x||i>u.x+u.width||o<u.y||o>u.y+u.height)return;this.drag={x:i,y:o,zoom:{start:0,end:0},grab:"map",view:r.map.view},t.currentTarget.setPointerCapture(t.pointerId),this.clearTip();return}let c=r.hit;if(!(!c||!this.canZoom(r))){if(this.pointers.set(t.pointerId,i),this.pointers.size===2){let[u,d]=[...this.pointers.values()];this.drag={x:(u+d)/2,y:o,zoom:c.zoom,grab:"pinch",distance:Math.abs(u-d)||1}}else{let u=ut(c,i,o);if(u)this.drag={x:i,y:o,zoom:u.zoom,grab:u.grab},u.zoom!==c.zoom&&this.setZoom(u.zoom);else if(this.zoomable&&i>=c.plot.x&&i<=c.plot.x+c.plot.width&&o>=c.plot.y&&o<=c.plot.y+c.plot.height)this.drag={x:i,y:o,zoom:c.zoom,grab:"pan"};else{this.pointers.delete(t.pointerId);return}}t.currentTarget.setPointerCapture(t.pointerId),this.clearTip()}};this.onPointerUp=t=>{this.pointers.delete(t.pointerId);let r=t.currentTarget;r.hasPointerCapture(t.pointerId)&&r.releasePointerCapture(t.pointerId);let i=this.drag,o=this.layout;if(o&&(i?.grab==="select"||i?.grab==="lasso"||i?.grab==="edit"||i?.grab==="map")){this.overlay=[];let{x:s,y:a}=this.viewBox(t,o);if(Math.abs(s-i.x)>2||Math.abs(a-i.y)>2){i.grab==="select"?this.setSelected(Ke(o,Se(i.x,i.y,s,a))):i.grab==="lasso"?this.setSelected(Qe(o,i.points??[])):i.grab==="edit"&&i.change&&this.emit("skdx-task-change",i.change),this.drag={...i,distance:-1};return}this.drag=null;return}(this.pointers.size===0||this.drag?.grab==="pinch")&&(this.drag=null)};this.onWheel=t=>{let r=this.layout;if(!r)return;let{x:i,y:o}=this.viewBox(t,r);if(r.map&&this.canPan(r)){let c=r.map.plot;if(i<c.x||i>c.x+c.width||o<c.y||o>c.y+c.height)return;t.preventDefault(),this.setView(rt(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=at(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=K(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)?tt(r,this.focused,t):void 0;if(i){t.preventDefault(),this.emit("skdx-task-change",i);return}let o=st(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?U(s):null)}}connectedCallback(){super.connectedCallback(),!(typeof ResizeObserver>"u")&&(this.observer=new ResizeObserver(([t])=>{let r=Math.floor(t?.contentRect.width??0);r>0&&(this.measured=r)}),this.observer.observe(this))}disconnectedCallback(){this.observer?.disconnect(),this.leave?.(),this.leave=void 0,this.joined=void 0,super.disconnectedCallback()}sized(){let{width:t,height:r,legend:i,tooltip:o,format:s,palette:a,loading:c,error:u,emptyMessage:d,description:f,decorative:g,animated:I,responsive:v,highlighted:l,highlightScope:y,accessibleTable:w}=this;return{...typeof v=="object"&&this.measured!==void 0&&this.measured<(v.breakpoint??480)?v.compact:void 0,width:v&&this.measured?this.measured:t,height:r,animate:I,responsive:v,legend:i,tooltip:o,format:s,palette:a,loading:c,error:u,emptyMessage:d,description:f,decorative:g,highlighted:l===void 0?this.highlightState:l,highlightScope:y,accessibleTable:w,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&&Ie(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=Ie(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&&Fe(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(je(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 ne(t.currentTarget,t.clientX,t.clientY,r.width,r.height)}getSvgElement(){return this.renderRoot.querySelector("svg")}getLayout(){return this.layout}resetZoom(){this.setZoom(void 0)}zoomTo(t){this.setZoom(t)}focusItem(t){let r=this.layout;if(!r)return!1;let i=r.shapes.findIndex(o=>o.item&&!o.item.legend&&_(o.item,t));return i<0?!1:(this.getSvgElement()?.focus(),this.focused=i,!0)}export(t){let r=this.layout;return r?pt(r,{...t,label:t.label??this.label??this.localName}):Promise.reject(new Error("not rendered yet"))}root(t,r,i){this.join();let o=Ve(Ne(t),this.sized());if(this.layout=o,o.issues!==this.reported){this.reported=o.issues;for(let w of o.issues??[])this.emit("skdx-data-issue",w)}let s=this.canZoom(o),a=this.canPan(o),c=this.canEdit(o),u=this.brushing(),d=s||a||c||u,f=!o.decorative&&Ce(o).length>0,g=o.description?`${r}-desc`:void 0,I=gt(o),v=ft(o,this.accessibleTable),l=typeof this.accessibleTable=="object"&&this.accessibleTable.caption||i,y=this.portal;return k.html`<svg
|
|
3
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
4
|
+
viewBox="0 0 ${o.width} ${o.height}"
|
|
5
|
+
width=${o.width}
|
|
6
|
+
height=${o.height}
|
|
7
|
+
role=${o.decorative?"presentation":"img"}
|
|
8
|
+
aria-hidden=${o.decorative?"true":k.nothing}
|
|
9
|
+
aria-label=${o.decorative?k.nothing:i}
|
|
10
|
+
aria-describedby=${(0,T.ifDefined)(g)}
|
|
11
|
+
tabindex=${f?0:k.nothing}
|
|
12
|
+
data-skdx-chart=${r}
|
|
13
|
+
data-zoomable=${s||a?"":k.nothing}
|
|
14
|
+
data-brushing=${u&&!(s||a)?"":k.nothing}
|
|
15
|
+
data-editable=${c?"":k.nothing}
|
|
16
|
+
style=${I?`--skdx-chart-duration:${I}`:k.nothing}
|
|
17
|
+
font-family=${S.fontFamily}
|
|
18
|
+
font-size=${S.fontSize}
|
|
19
|
+
@pointermove=${o.tooltip||d?this.onPointerMove:k.nothing}
|
|
20
|
+
@pointerleave=${()=>{this.clearTip(),this.highlight(null)}}
|
|
21
|
+
@pointerdown=${d?this.onPointerDown:k.nothing}
|
|
22
|
+
@pointerup=${d?this.onPointerUp:k.nothing}
|
|
23
|
+
@pointercancel=${d?this.onPointerUp:k.nothing}
|
|
24
|
+
@wheel=${s||a?this.onWheel:k.nothing}
|
|
25
|
+
@dblclick=${s||a?()=>a?this.setView(void 0):this.setZoom(void 0):k.nothing}
|
|
26
|
+
@click=${this.onClick}
|
|
27
|
+
@keydown=${f?this.onKeyDown:k.nothing}
|
|
28
|
+
@blur=${()=>{this.focused=null,this.highlight(null)}}
|
|
29
|
+
>
|
|
30
|
+
<title>${i}</title>
|
|
31
|
+
${o.description?k.svg`<desc id=${(0,T.ifDefined)(g)}>${o.description}</desc>`:k.nothing}
|
|
32
|
+
${I?k.svg`<style>${bt}</style>`:k.nothing} ${An(o)}
|
|
33
|
+
${Te(o.shapes)}
|
|
34
|
+
${Te(this.tip.length||!this.crossState?this.tip:_e(o,this.crossState))}
|
|
35
|
+
${Te(ot(o,this.focused))} ${Te(this.overlay)}
|
|
36
|
+
</svg>
|
|
37
|
+
${y?k.html`<div
|
|
38
|
+
role="tooltip"
|
|
39
|
+
data-skdx-tooltip=${r}
|
|
40
|
+
style="left:${y.x+12}px;top:${y.y+12}px"
|
|
41
|
+
>
|
|
42
|
+
${y.lines.map(w=>k.html`<div>${w}</div>`)}
|
|
43
|
+
</div>`:k.nothing}
|
|
44
|
+
${v?k.html`<table data-skdx-table=${r}>
|
|
45
|
+
<caption>
|
|
46
|
+
${l}
|
|
47
|
+
</caption>
|
|
48
|
+
<thead>
|
|
49
|
+
<tr>
|
|
50
|
+
${(v[0]??[]).map(w=>k.html`<th scope="col">${w}</th>`)}
|
|
51
|
+
</tr>
|
|
52
|
+
</thead>
|
|
53
|
+
<tbody>
|
|
54
|
+
${v.slice(1).map(w=>k.html`<tr>
|
|
55
|
+
${w.map(($,A)=>A===0?k.html`<th scope="row">${$}</th>`:k.html`<td>${$}</td>`)}
|
|
56
|
+
</tr>`)}
|
|
57
|
+
</tbody>
|
|
58
|
+
</table>`:k.nothing}`}};M.styles=k.css`
|
|
59
|
+
:host {
|
|
60
|
+
display: inline-block;
|
|
61
|
+
}
|
|
62
|
+
svg {
|
|
63
|
+
display: block;
|
|
64
|
+
max-width: 100%;
|
|
65
|
+
height: auto;
|
|
66
|
+
outline: none;
|
|
67
|
+
}
|
|
68
|
+
svg[data-zoomable] {
|
|
69
|
+
cursor: grab;
|
|
70
|
+
touch-action: none;
|
|
71
|
+
}
|
|
72
|
+
svg[data-brushing] {
|
|
73
|
+
cursor: crosshair;
|
|
74
|
+
touch-action: none;
|
|
75
|
+
}
|
|
76
|
+
svg[data-editable] {
|
|
77
|
+
touch-action: none;
|
|
78
|
+
}
|
|
79
|
+
:host([responsive]) {
|
|
80
|
+
display: block;
|
|
81
|
+
}
|
|
82
|
+
table {
|
|
83
|
+
position: absolute;
|
|
84
|
+
width: 1px;
|
|
85
|
+
height: 1px;
|
|
86
|
+
margin: -1px;
|
|
87
|
+
padding: 0;
|
|
88
|
+
overflow: hidden;
|
|
89
|
+
clip: rect(0 0 0 0);
|
|
90
|
+
white-space: nowrap;
|
|
91
|
+
border: 0;
|
|
92
|
+
}
|
|
93
|
+
[role='tooltip'] {
|
|
94
|
+
position: fixed;
|
|
95
|
+
pointer-events: none;
|
|
96
|
+
z-index: 1000;
|
|
97
|
+
background: var(--skdx-color-surface-raised);
|
|
98
|
+
color: var(--skdx-color-text-default);
|
|
99
|
+
border: 1px solid var(--skdx-color-border-strong);
|
|
100
|
+
border-radius: 3px;
|
|
101
|
+
padding: 4px 8px;
|
|
102
|
+
font-family: var(--skdx-font-family);
|
|
103
|
+
font-size: var(--skdx-font-size-xs);
|
|
104
|
+
white-space: nowrap;
|
|
105
|
+
}
|
|
106
|
+
[role='tooltip'] > :first-child:not(:only-child) {
|
|
107
|
+
font-weight: bold;
|
|
108
|
+
}
|
|
109
|
+
`,h([(0,b.property)({type:Number})],M.prototype,"width",2),h([(0,b.property)({type:Number})],M.prototype,"height",2),h([(0,b.property)()],M.prototype,"label",2),h([(0,b.property)({type:Boolean,reflect:!0})],M.prototype,"legend",2),h([(0,b.property)({type:Boolean,attribute:"no-tooltip",converter:zn})],M.prototype,"tooltip",2),h([(0,b.property)({attribute:!1})],M.prototype,"format",2),h([(0,b.property)({attribute:!1})],M.prototype,"palette",2),h([(0,b.property)({attribute:!1})],M.prototype,"hiddenSeries",2),h([(0,b.property)({attribute:!1})],M.prototype,"selected",2),h([(0,b.property)({attribute:"selection-mode"})],M.prototype,"selectionMode",2),h([(0,b.property)({attribute:!1})],M.prototype,"highlighted",2),h([(0,b.property)({attribute:!1})],M.prototype,"highlightScope",2),h([(0,b.property)({type:Boolean,reflect:!0})],M.prototype,"loading",2),h([(0,b.property)()],M.prototype,"error",2),h([(0,b.property)({attribute:"empty-message"})],M.prototype,"emptyMessage",2),h([(0,b.property)()],M.prototype,"description",2),h([(0,b.property)({type:Boolean,reflect:!0})],M.prototype,"decorative",2),h([(0,b.property)({type:Boolean,attribute:"accessible-table"})],M.prototype,"accessibleTable",2),h([(0,b.property)({attribute:!1})],M.prototype,"zoom",2),h([(0,b.property)({attribute:!1})],M.prototype,"view",2),h([(0,b.property)({type:Boolean,reflect:!0})],M.prototype,"zoomable",2),h([(0,b.property)({type:Boolean,reflect:!0})],M.prototype,"editable",2),h([(0,b.property)({attribute:"sync-id"})],M.prototype,"syncId",2),h([(0,b.property)({type:Boolean,attribute:"cross-filter"})],M.prototype,"crossFilter",2),h([(0,b.property)({converter:{fromAttribute:t=>t===null?!1:t===""?!0:Number(t)}})],M.prototype,"animated",2),h([(0,b.property)({type:Boolean,reflect:!0})],M.prototype,"responsive",2),h([(0,b.state)()],M.prototype,"tip",2),h([(0,b.state)()],M.prototype,"overlay",2),h([(0,b.state)()],M.prototype,"portal",2),h([(0,b.state)()],M.prototype,"measured",2),h([(0,b.state)()],M.prototype,"viewState",2),h([(0,b.state)()],M.prototype,"highlightState",2),h([(0,b.state)()],M.prototype,"crossState",2),h([(0,b.state)()],M.prototype,"focused",2),h([(0,b.state)()],M.prototype,"hiddenState",2),h([(0,b.state)()],M.prototype,"zoomState",2),h([(0,b.state)()],M.prototype,"selectedState",2);var z=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:c,labels:u,curve:d,connectNulls:f,nulls:g,stacked:I,stackOffset:v,orientation:l,radius:y,barGap:w,barWidth:$,sort:A,transform:P,transforms:F,bins:N,binWidth:re,binDomain:fe,binMode:X,sampling:ze,brush:Ae,crosshair:j}=this;return{...this.sized(),series:t,categories:r,xAxis:i,yAxis:o,rightAxis:s,references:a,annotations:c,labels:u,curve:d,connectNulls:f,nulls:g,stacked:I,stackOffset:v,orientation:l,radius:y,barGap:w,barWidth:$,sort:A,transform:P,transforms:F,bins:N,binWidth:re,binDomain:fe,binMode:X,sampling:ze,brush:Ae,crosshair:j}}};h([(0,b.property)({attribute:!1})],z.prototype,"series",2),h([(0,b.property)({attribute:!1})],z.prototype,"categories",2),h([(0,b.property)({attribute:!1})],z.prototype,"xAxis",2),h([(0,b.property)({attribute:!1})],z.prototype,"yAxis",2),h([(0,b.property)({attribute:!1})],z.prototype,"rightAxis",2),h([(0,b.property)({attribute:!1})],z.prototype,"references",2),h([(0,b.property)({attribute:!1})],z.prototype,"annotations",2),h([(0,b.property)({type:Boolean,reflect:!0})],z.prototype,"labels",2),h([(0,b.property)()],z.prototype,"curve",2),h([(0,b.property)({type:Boolean,attribute:"connect-nulls"})],z.prototype,"connectNulls",2),h([(0,b.property)()],z.prototype,"nulls",2),h([(0,b.property)({reflect:!0,converter:{fromAttribute:t=>t==="percent"?"percent":t!==null}})],z.prototype,"stacked",2),h([(0,b.property)({attribute:"stack-offset"})],z.prototype,"stackOffset",2),h([(0,b.property)()],z.prototype,"orientation",2),h([(0,b.property)({type:Number})],z.prototype,"radius",2),h([(0,b.property)({type:Number,attribute:"bar-gap"})],z.prototype,"barGap",2),h([(0,b.property)({type:Number,attribute:"bar-width"})],z.prototype,"barWidth",2),h([(0,b.property)()],z.prototype,"sort",2),h([(0,b.property)()],z.prototype,"transform",2),h([(0,b.property)({attribute:!1})],z.prototype,"transforms",2),h([(0,b.property)({type:Number})],z.prototype,"bins",2),h([(0,b.property)({type:Number,attribute:"bin-width"})],z.prototype,"binWidth",2),h([(0,b.property)({attribute:!1})],z.prototype,"binDomain",2),h([(0,b.property)({attribute:"bin-mode"})],z.prototype,"binMode",2),h([(0,b.property)({attribute:!1})],z.prototype,"sampling",2),h([(0,b.property)({type:Boolean,reflect:!0})],z.prototype,"brush",2),h([(0,b.property)({type:Boolean,reflect:!0})],z.prototype,"crosshair",2);var An=e=>e.defs&&e.defs.length?k.svg`<defs>${e.defs.map(n=>k.svg`<linearGradient id=${n.id} x1="0" y1="0" x2=${n.vertical===!1?1:0} y2=${n.vertical===!1?0:1}>${n.stops.map(t=>k.svg`<stop offset=${t.offset} stop-color=${t.color} stop-opacity=${(0,T.ifDefined)(t.opacity)}></stop>`)}</linearGradient>`)}</defs>`:k.nothing,Te=e=>k.svg`${e.map((n,t)=>{let r=n.title?k.svg`<title>${n.title}</title>`:k.nothing,i=n.item?t:void 0;switch(n.kind){case"path":return k.svg`<path data-skdx-part=${n.part} data-skdx-i=${(0,T.ifDefined)(i)} d=${n.d} fill=${n.fill??"none"} stroke=${(0,T.ifDefined)(n.stroke)} stroke-width=${(0,T.ifDefined)(n.strokeWidth)} stroke-linecap=${(0,T.ifDefined)(n.strokeLinecap)} stroke-linejoin=${(0,T.ifDefined)(n.strokeLinejoin)} stroke-dasharray=${(0,T.ifDefined)(n.dash)} opacity=${(0,T.ifDefined)(n.opacity)} fill-opacity=${(0,T.ifDefined)(n.fillOpacity)}>${r}</path>`;case"rect":return k.svg`<rect data-skdx-part=${n.part} data-skdx-i=${(0,T.ifDefined)(i)} x=${n.x} y=${n.y} width=${n.width} height=${n.height} rx=${(0,T.ifDefined)(n.rx)} fill=${n.fill} stroke=${(0,T.ifDefined)(n.stroke)} fill-opacity=${(0,T.ifDefined)(n.opacity)}>${r}</rect>`;case"line":return k.svg`<line data-skdx-part=${n.part} data-skdx-i=${(0,T.ifDefined)(i)} x1=${n.x1} y1=${n.y1} x2=${n.x2} y2=${n.y2} stroke=${n.stroke} stroke-width=${(0,T.ifDefined)(n.strokeWidth)} stroke-dasharray=${(0,T.ifDefined)(n.dash)} opacity=${(0,T.ifDefined)(n.opacity)}>${r}</line>`;case"circle":return k.svg`<circle data-skdx-part=${n.part} data-skdx-i=${(0,T.ifDefined)(i)} cx=${n.cx} cy=${n.cy} r=${n.r} fill=${n.fill} stroke=${(0,T.ifDefined)(n.stroke)} opacity=${(0,T.ifDefined)(n.opacity)}>${r}</circle>`;case"text":return k.svg`<text data-skdx-part=${n.part} data-skdx-i=${(0,T.ifDefined)(i)} x=${n.x} y=${n.y} text-anchor=${(0,T.ifDefined)(n.anchor)} dominant-baseline=${(0,T.ifDefined)(n.baseline)} fill=${(0,T.ifDefined)(n.fill)} font-weight=${(0,T.ifDefined)(n.weight)} pointer-events=${(0,T.ifDefined)(i===void 0?"none":void 0)} transform=${(0,T.ifDefined)(n.rotate?`rotate(${n.rotate} ${n.x} ${n.y})`:void 0)}>${n.text}</text>`}})}`;var G=class extends M{constructor(){super(...arguments);this.series=[];this.mean=!1;this.points=!1;this.notched=!1}render(){let{series:t,orientation:r,quartileMethod:i,whisker:o,mean:s,points:a,notched:c,categories:u,yAxis:d}=this;return this.root(yt({...this.sized(),series:t,orientation:r,quartileMethod:i,whisker:o,mean:s,points:a,notched:c,categories:u,yAxis:d}),"boxplot",this.label??"Box plot")}};h([(0,V.property)({attribute:!1})],G.prototype,"series",2),h([(0,V.property)()],G.prototype,"orientation",2),h([(0,V.property)({attribute:"quartile-method"})],G.prototype,"quartileMethod",2),h([(0,V.property)({type:Number})],G.prototype,"whisker",2),h([(0,V.property)({type:Boolean,reflect:!0})],G.prototype,"mean",2),h([(0,V.property)({type:Boolean,reflect:!0})],G.prototype,"points",2),h([(0,V.property)({type:Boolean,reflect:!0})],G.prototype,"notched",2),h([(0,V.property)({attribute:!1})],G.prototype,"categories",2),h([(0,V.property)({attribute:!1})],G.prototype,"yAxis",2),G=h([(0,V.customElement)("skdx-boxplot")],G);0&&(module.exports={SkdxBoxplot});
|