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