import{e as D,b as h,Z as z,n as r,g as i,p as t,x as g,w as s,q as n,f as p,j as d,W as j,X as V,aN as c,U as y,R as C,S as w,a0 as _,b0 as E,b1 as L,ar as N}from"./jwt-decode.esm-CZajAnkk.js";import{_ as R}from"./AbstraButton.vue_vue_type_script_setup_true_lang-BpvNJyII.js";import{_ as x,P as k,H as v}from"./HighlightedText-CFKtoGsH.js";import{F}from"./PhKey.vue-B8t-lLXK.js";import{G as K}from"./PhPencil.vue-B-zdR1aB.js";import{C as G}from"./index-Dl2ekNlA.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},u=new Error().stack;u&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[u]="8f3e4585-68c7-4b14-bcec-c1ce3e0f3fae",e._sentryDebugIdIdentifier="sentry-dbid-8f3e4585-68c7-4b14-bcec-c1ce3e0f3fae")}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:u}){const a=e,b=u,m=h(()=>a.maxVisibleColumns??5),B=h(()=>a.table.getColumns().slice(0,m.value)),T=h(()=>a.table.getColumns().length>m.value),H=h(()=>!a.highlightedColumns||a.highlightedColumns.length===0?!1:a.table.getColumns().slice(m.value).some(o=>o.id&&a.highlightedColumns?.includes(o.id))),I=f=>a.connectedColumns?.includes(f)??!1;return(f,o)=>{const $=z("RouterLink");return i(),r(t(G),{hoverable:!0,class:g(["table-card",{"table-highlighted":e.isHighlighted}]),onDblclick:o[1]||(o[1]=l=>b("dblclick"))},{title:s(()=>[n(t(c),{align:"center",justify:"space-between",wrap:"nowrap",style:{gap:"8px"}},{default:s(()=>[n(t(_),{level:5,style:{margin:"0",overflow:"hidden","text-overflow":"ellipsis","white-space":"nowrap"}},{default:s(()=>[n(v,{text:e.table.name,term:e.searchTerm},null,8,["text","term"])]),_:1}),n(t(c),{gap:"small",align:"center",wrap:"nowrap",style:{"flex-shrink":"0"}},{default:s(()=>[e.showEditButton?(i(),r($,{key:0,to:`/projects/${e.projectId}/tables/${e.table.id}`},{default:s(()=>[n(R,{size:"small",type:"text"},{default:s(()=>[n(t(K),{size:16})]),_:1})]),_:1},8,["to"])):d("",!0),e.showDeleteButton?(i(),p("button",{key:1,class:"delete-btn",onClick:o[0]||(o[0]=E(l=>b("delete"),["stop","prevent"]))},[n(t(L),{size:16})])):d("",!0)]),_:1})]),_:1})]),default:s(()=>[n(t(c),{vertical:"",gap:"small",class:"columns-list"},{default:s(()=>[(i(!0),p(j,null,V(B.value,l=>(i(),r(t(c),{key:l.id,align:"center",gap:"small",class:g(["column-row",{"column-highlighted":l.id&&e.highlightedColumns?.includes(l.id)}])},{default:s(()=>[e.showHandles&&l.foreignKey?(i(),r(t(x),{key:0,id:`target-${l.id}`,type:"target",position:t(k).Left,connectable:!1},null,8,["id","position"])):d("",!0),l.primaryKey?(i(),r(t(F),{key:1,size:14,class:"key-icon"})):d("",!0),n(t(y),{strong:"",style:{flex:"1","font-size":"13px","line-height":"1"}},{default:s(()=>[n(v,{text:l.name,term:e.searchTerm},null,8,["text","term"])]),_:2},1024),n(t(y),{type:"secondary",style:{"line-height":"1"}},{default:s(()=>[C(w(l.type),1)]),_:2},1024),e.showHandles&&(l.primaryKey||l.id&&I(l.id))?(i(),r(t(x),{key:2,id:`source-${l.id}`,type:"source",position:t(k).Right,connectable:!1},null,8,["id","position"])):d("",!0)]),_:2},1032,["class"]))),128)),T.value?(i(),r(t(c),{key:0,justify:"center",align:"center",style:{"padding-top":"8px"},class:g({"more-columns-highlighted":H.value})},{default:s(()=>[n(t(y),{type:"secondary",style:{"font-size":"12px"}},{default:s(()=>[C(" +"+w(e.table.getColumns().length-m.value)+" more columns ",1)]),_:1})]),_:1},8,["class"])):d("",!0)]),_:1})]),_:1},8,["class"])}}}),X=N(M,[["__scopeId","data-v-573f54c1"]]);export{X as T};
//# sourceMappingURL=TableCard-Bb01fJZB.js.map
