import{T as b}from"./tabulator_esm-0A0yuExc.mjs";import{P as g}from"./papaparse.min-DhkuovF9.mjs";import{_ as y,d as _,e as F,q as ,ドルs as x}from"#entry";const j={props:{tableDataCsv:{type:String},fixedHeight:{type:Boolean,default:!1},tableHeight:{type:Number,default:500}},setup(){x({link:[{rel:"stylesheet",href:"https://unpkg.com/tabulator-tables@5.2.3/dist/css/tabulator.min.css"}]})},data(){return{tabulator:null}},computed:{cssVars(){return{fontFamily:this.$ss.general.primaryFontFamily,"--color-primary-main":this.$ss.colors.primary.main}}},async mounted(){const r=g.parse(this.tableDataCsv,{header:!0}).data.filter(t=>t&&Object.keys(t).length>0&&Object.values(t).some(e=>e!=="")),a={};r.forEach(t=>{Object.keys(t).forEach(e=>{if(typeof t[e]=="string"||t[e]instanceof String){const c=t[e].replace("%","").replace("$","").replace(",","").replace(/<[^>]*>/gi,""),s=Math.ceil(c.length/15);a?.[e]===void 0&&(a[e]=0),s>a[e]&&(a[e]=s)}})});let l=0;Object.keys(a).forEach(t=>{l+=a[t]});const o={data:r,layout:"fitColumns",height:this.fixedHeight&&this.tableHeight>0?this.tableHeight+"px":0},n=[];Object.keys(o.data[0]).forEach(t=>{n.push({title:t,field:t,formatter:"html",headerWordWrap:!0,widthGrow:`${Math.floor(100*a[t]/l/Object.keys(a).length)}`,sorter:function(e,c){const s=m=>{const h=m.replace("%","").replace("$","").replaceAll(",","").replace(/<[^>]*>/gi,""),d=/\((\d+)\)/,f=h.match(d);return f?-parseFloat(f[1]):h},i=s(e),p=s(c);return isNaN(parseFloat(i))||isNaN(parseFloat(p))?i>p?1:-1:parseFloat(i)>parseFloat(p)?1:-1}})}),this.tabulator=new b(this.$refs.table,{...o,columns:n})}};function O(r,a,l,o,n,u){return F(),_("div",{ref:"table",class:"web-data-table",style:$(u.cssVars)},null,4)}const N=Object.assign(y(j,[["render",O]]),{__name:"WebDataTable"});export{N as default};