import{e as D,b as g,a6 as j,n as d,g as i,p as e,K as b,w as l,v as n,f as k,j as r,O as z,Z as H,E as u,T as p,q as h,t as y,am as T,bi as V,bj as E,aO as K}from"./jwt-decode.esm-CzNJpMna.js";import{_ as L}from"./AbstraButton.vue_vue_type_script_setup_true_lang-Bb3vA821.js";import{F}from"./PhKey.vue-BuuXv9Ne.js";import{G as N}from"./PhPencil.vue-BdquHkzg.js";import{_ as v,P as w}from"./vue-flow-core-BOunt6lE.js";import{C as R}from"./index-zwdtp9eM.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},c=new Error().stack;c&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[c]="762335f8-d252-4b70-ad07-7cc6bae01157",t._sentryDebugIdIdentifier="sentry-dbid-762335f8-d252-4b70-ad07-7cc6bae01157")}catch{}})();const G=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}},emits:["dblclick","delete"],setup(t,{emit:c}){const a=t,C=c,m=g(()=>a.maxVisibleColumns??5),x=g(()=>a.table.getColumns().slice(0,m.value)),B=g(()=>a.table.getColumns().length>m.value),_=g(()=>!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 $=j("RouterLink");return i(),d(e(R),{hoverable:!0,class:b(["table-card",{"table-highlighted":t.isHighlighted}]),onDblclick:o[1]||(o[1]=s=>C("dblclick"))},{title:l(()=>[n(e(u),{align:"center",justify:"space-between"},{default:l(()=>[n(e(T),{level:5,style:{margin:"0"}},{default:l(()=>[h(y(t.table.name),1)]),_:1}),n(e(u),{gap:"small",align:"center"},{default:l(()=>[t.showEditButton?(i(),d($,{key:0,to:`/projects/${t.projectId}/tables/${t.table.id}`},{default:l(()=>[n(L,{size:"small",type:"text"},{default:l(()=>[n(e(N),{size:16})]),_:1})]),_:1},8,["to"])):r("",!0),t.showDeleteButton?(i(),k("button",{key:1,class:"delete-btn",onClick:o[0]||(o[0]=V(s=>C("delete"),["stop","prevent"]))},[n(e(E),{size:16})])):r("",!0)]),_:1})]),_:1})]),default:l(()=>[n(e(u),{vertical:"",gap:"small",class:"columns-list"},{default:l(()=>[(i(!0),k(z,null,H(x.value,s=>(i(),d(e(u),{key:s.id,align:"center",gap:"small",class:b(["column-row",{"column-highlighted":s.id&&t.highlightedColumns?.includes(s.id)}])},{default:l(()=>[t.showHandles&&s.foreignKey?(i(),d(e(v),{key:0,id:`target-${s.id}`,type:"target",position:e(w).Left,connectable:!1},null,8,["id","position"])):r("",!0),s.primaryKey?(i(),d(e(F),{key:1,size:14,class:"key-icon"})):r("",!0),n(e(p),{strong:"",style:{flex:"1","font-size":"13px","line-height":"1"}},{default:l(()=>[h(y(s.name),1)]),_:2},1024),n(e(p),{type:"secondary",style:{"line-height":"1"}},{default:l(()=>[h(y(s.type),1)]),_:2},1024),t.showHandles&&(s.primaryKey||s.id&&I(s.id))?(i(),d(e(v),{key:2,id:`source-${s.id}`,type:"source",position:e(w).Right,connectable:!1},null,8,["id","position"])):r("",!0)]),_:2},1032,["class"]))),128)),B.value?(i(),d(e(u),{key:0,justify:"center",align:"center",style:{"padding-top":"8px"},class:b({"more-columns-highlighted":_.value})},{default:l(()=>[n(e(p),{type:"secondary",style:{"font-size":"12px"}},{default:l(()=>[h(" +"+y(t.table.getColumns().length-m.value)+" more columns ",1)]),_:1})]),_:1},8,["class"])):r("",!0)]),_:1})]),_:1},8,["class"])}}}),Z=K(G,[["__scopeId","data-v-eb2ff5e4"]]);export{Z as T};
//# sourceMappingURL=TableCard-DfUbOEv5.js.map
