import{e as D,b as h,$ as z,q as r,g as i,s as t,F as g,x as l,v as n,f as p,j as d,X as j,Y as V,aO as u,a1 as y,T as C,U as w,a0 as _,b1 as E,b3 as F,as as L}from"./jwt-decode.esm-C4US4bkT.js";import{_ as K}from"./AbstraButton.vue_vue_type_script_setup_true_lang-BCMHtrac.js";import{_ as x,P as v,H as k}from"./HighlightedText-58xitSdQ.js";import{F as N}from"./PhKey.vue-ClawQJg_.js";import{G as R}from"./PhPencil.vue-ZvRpmP6K.js";import{C as G}from"./index-BI9joMgN.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},c=new Error().stack;c&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[c]="06f6dae9-95c8-46f2-99cb-1f6ce3f7b1e4",e._sentryDebugIdIdentifier="sentry-dbid-06f6dae9-95c8-46f2-99cb-1f6ce3f7b1e4")}catch{}})();const M=D({__name:"TableCard",props:{table:{},projectId:{},showHandles:{type:Boolean},maxVisibleColumns:{},connectedColumns:{},highlightedColumns:{},isHighlighted:{type:Boolean},showEditButton:{type:Boolean,default:!0},showDeleteButton:{type:Boolean,default:!1},searchTerm:{}},emits:["dblclick","delete"],setup(e,{emit:c}){const a=e,b=c,m=h(()=>a.maxVisibleColumns??5),B=h(()=>a.table.getColumns().slice(0,m.value)),T=h(()=>a.table.getColumns().length>m.value),$=h(()=>!a.highlightedColumns||a.highlightedColumns.length===0?!1:a.table.getColumns().slice(m.value).some(o=>o.id&&a.highlightedColumns?.includes(o.id))),H=f=>a.connectedColumns?.includes(f)??!1;return(f,o)=>{const I=z("RouterLink");return i(),r(t(G),{hoverable:!0,class:g(["table-card",{"table-highlighted":e.isHighlighted}]),onDblclick:o[1]||(o[1]=s=>b("dblclick"))},{title:l(()=>[n(t(u),{align:"center",justify:"space-between",wrap:"nowrap",style:{gap:"8px"}},{default:l(()=>[n(t(_),{level:5,style:{margin:"0",overflow:"hidden","text-overflow":"ellipsis","white-space":"nowrap"}},{default:l(()=>[n(k,{text:e.table.name,term:e.searchTerm},null,8,["text","term"])]),_:1}),n(t(u),{gap:"small",align:"center",wrap:"nowrap",style:{"flex-shrink":"0"}},{default:l(()=>[e.showEditButton?(i(),r(I,{key:0,to:`/projects/${e.projectId}/tables/${e.table.id}`},{default:l(()=>[n(K,{size:"small",type:"text"},{default:l(()=>[n(t(R),{size:16})]),_:1})]),_:1},8,["to"])):d("",!0),e.showDeleteButton?(i(),p("button",{key:1,class:"delete-btn",onClick:o[0]||(o[0]=E(s=>b("delete"),["stop","prevent"]))},[n(t(F),{size:16})])):d("",!0)]),_:1})]),_:1})]),default:l(()=>[n(t(u),{vertical:"",gap:"small",class:"columns-list"},{default:l(()=>[(i(!0),p(j,null,V(B.value,s=>(i(),r(t(u),{key:s.id,align:"center",gap:"small",class:g(["column-row",{"column-highlighted":s.id&&e.highlightedColumns?.includes(s.id)}])},{default:l(()=>[e.showHandles&&s.foreignKey?(i(),r(t(x),{key:0,id:`target-${s.id}`,type:"target",position:t(v).Left,connectable:!1},null,8,["id","position"])):d("",!0),s.primaryKey?(i(),r(t(N),{key:1,size:14,class:"key-icon"})):d("",!0),n(t(y),{strong:"",style:{flex:"1","font-size":"13px","line-height":"1"}},{default:l(()=>[n(k,{text:s.name,term:e.searchTerm},null,8,["text","term"])]),_:2},1024),n(t(y),{type:"secondary",style:{"line-height":"1"}},{default:l(()=>[C(w(s.type),1)]),_:2},1024),e.showHandles&&(s.primaryKey||s.id&&H(s.id))?(i(),r(t(x),{key:2,id:`source-${s.id}`,type:"source",position:t(v).Right,connectable:!1},null,8,["id","position"])):d("",!0)]),_:2},1032,["class"]))),128)),T.value?(i(),r(t(u),{key:0,justify:"center",align:"center",style:{"padding-top":"8px"},class:g({"more-columns-highlighted":$.value})},{default:l(()=>[n(t(y),{type:"secondary",style:{"font-size":"12px"}},{default:l(()=>[C(" +"+w(e.table.getColumns().length-m.value)+" more columns ",1)]),_:1})]),_:1},8,["class"])):d("",!0)]),_:1})]),_:1},8,["class"])}}}),X=L(M,[["__scopeId","data-v-573f54c1"]]);export{X as T};
//# sourceMappingURL=TableCard-Db_dZ57p.js.map
