import{r as t,h as e}from"./p-D0dWnGvB.js";const s=class{constructor(e){t(this,e),this.type="realistic",this.trend="positive",this.size="lg",this.showMarker=!1,this.data=[],this.lineColor="positive"===this.trend?"#067647":"#B42318",this.fillColor="positive"===this.trend?"#079455":"#D92D20",this.width="lg"===this.size?328:128,this.height=64}handleSizeChange(){this.width="lg"===this.size?328:128}getLinePath(){const t=this.getPoints();switch(this.type){case"realistic":case"layers":return this.getSmoothPath(t);case"wavy":return this.getWavyPath(t);case"straight":return this.getStraightPath(t);default:return""}}getPoints(){return this.data.map(((t,e)=>({x:e/(this.data.length-1)*this.width,y:this.height-t/Math.max(...this.data)*this.height})))}getSmoothPath(t){return t.reduce(((t,e,s,i)=>{if(0===s)return`M ${e.x},${e.y}`;const h=i[s-1],a=(h.x+e.x)/2;return`${t} C ${a},${h.y} ${a},${e.y} ${e.x},${e.y}`}),"")}getWavyPath(t){return t.reduce(((t,e,s)=>0===s?`M ${e.x},${e.y}`:`${t} Q ${e.x-10},${e.y+10} ${e.x},${e.y}`),"")}getStraightPath(t){return t.reduce(((t,e,s)=>0===s?`M ${e.x},${e.y}`:`${t} L ${e.x},${e.y}`),"")}getAreaPath(){return`${this.getLinePath()} L ${this.width},${this.height} L 0,${this.height} Z`}render(){const t=this.getLinePath(),s=this.getAreaPath();return e("svg",{key:"307dff369c3c7b97b21b4f9935ecaebe037f9f88",width:this.width,height:this.height,viewBox:`0 0 ${this.width} ${this.height}`},e("defs",{key:"870be4a080f43cbc3bab0415611def0fe8972867"},e("linearGradient",{key:"da285ca623dbb895b5a68439b5e294d3c473b29b",id:"areaGradient",x1:"0",x2:"0",y1:"0",y2:"1"},e("stop",{key:"4b52d643e6ba6fdcadb458c0927080d15a76cf4a",offset:"0%","stop-color":this.fillColor,"stop-opacity":"0.25"}),e("stop",{key:"3551bc2093619f416e8dbdaebb01552a2e2cb856",offset:"100%","stop-color":this.fillColor,"stop-opacity":"0"}))),e("path",{key:"d3e56ca310551702902d949efe9c560dc22ea6df",d:s,fill:"url(#areaGradient)"}),e("path",{key:"ba195d1f6b961271efc86deae9a98543ca04ecee",d:t,fill:"none",stroke:this.lineColor,"stroke-width":"2"}),this.showMarker&&this.getPoints().map((t=>e("circle",{cx:t.x,cy:t.y,r:"4",fill:"white",stroke:this.lineColor,"stroke-width":"2"}))))}static get watchers(){return{size:["handleSizeChange"]}}};export{s as dga_metric_chart}