import{v as C,o as M,ai as R,g as v,r as E}from"./ReferenceContentLoader-Z8YmHBVJ.js";import{i as s,o as t,j as N,d as k,r as x,h as D,n as i,k as b,l as n,v as w,g as h,b as B,F as $,e as I,c as S,E as z,y as F,s as V,t as A}from"./index-DPl1iiyq.js";import"./navigation-BzNQiq4W.js";import{m as L}from"./Draggable.vue-BpyfrEtT.js";import{w as O}from"./DeleteSidebarListElement.vue-BDbPRHND.js";const j={},q={class:"gap-1/2 flex flex-col px-3 pb-[75px]"};function K(r,u){return t(),s("ul",q,[N(r.$slots,"default")])}const Y=C(j,[["render",K]]),T={class:"absolute right-1 flex opacity-0 group-hover:opacity-100"},W=k({__name:"SidebarListElementActions",props:{variable:{},warningMessage:{},isCopyable:{type:Boolean},isDeletable:{type:Boolean},isRenameable:{type:Boolean}},emits:["delete","rename"],setup(r,{emit:u}){const c=u,l=x({action:"None",name:""}),p=M(),{copyToClipboard:g}=R();function f(a){l.value={action:a,name:r.variable.name},p.show()}function d(){p.hide(),l.value={action:"None",name:""}}function y(a){c("delete",a),d()}return(a,e)=>(t(),s($,null,[D("div",T,[a.isCopyable?(t(),s("button",{key:0,class:"text-c-3 hover:bg-b-3 hover:text-c-1 rounded p-[5px]",type:"button",onClick:e[0]||(e[0]=o=>n(g)(a.variable.name))},[i(n(v),{class:"h-3 w-3",icon:"Clipboard"})])):b("",!0),a.isRenameable?(t(),s("button",{key:1,class:"text-c-3 hover:bg-b-3 hover:text-c-1 rounded p-[5px]",type:"button",onClick:e[1]||(e[1]=o=>c("rename",a.variable.uid))},[i(n(v),{class:"h-3 w-3",icon:"Edit"})])):b("",!0),!a.variable.isDefault&&a.isDeletable?(t(),s("button",{key:2,class:"text-c-3 hover:bg-b-3 hover:text-c-1 rounded p-1",type:"button",onClick:e[2]||(e[2]=w(o=>f("Delete"),["prevent"]))},[i(n(v),{class:"h-3.5 w-3.5",icon:"Close"})])):b("",!0)]),i(n(E),{size:"sm",state:n(p),title:`${l.value.action} ${l.value.name}`},{default:h(()=>[l.value.action==="Delete"?(t(),B(O,{key:0,variableName:l.value.name,warningMessage:a.warningMessage,onClose:d,onDelete:e[3]||(e[3]=o=>y(a.variable.uid))},null,8,["variableName","warningMessage"])):b("",!0)]),_:1},8,["state","title"])],64))}}),G={class:"empty-variable-name line-clamp-1 text-sm break-all group-hover:pr-5"},H=k({__name:"SidebarListElement",props:{variable:{},warningMessage:{},to:{},isDeletable:{type:Boolean},isCopyable:{type:Boolean},isRenameable:{type:Boolean},isDraggable:{type:Boolean,default:!1},isDroppable:{type:[Boolean,Function],default:!1},collectionId:{}},emits:["delete","colorModal","rename","onDragEnd"],setup(r,{emit:u}){const c=u,l=I(),p=e=>{e.metaKey?window.open(l.resolve(r.to).href,"_blank"):l.push(r.to)},g=e=>{c("delete",e)},f=e=>{c("colorModal",e)},d=e=>{c("rename",e)},y=x(null),a=S(()=>({ceiling:.5,floor:.5}));return(e,o)=>{const _=z("router-link");return t(),s("li",null,[i(n(L),{id:e.variable.uid,ref_key:"draggableRef",ref:y,ceiling:a.value.ceiling,floor:a.value.floor,isDraggable:e.isDraggable,isDroppable:e.isDroppable,parentIds:e.collectionId?[e.collectionId]:[],onOnDragEnd:o[2]||(o[2]=(...m)=>e.$emit("onDragEnd",...m))},{default:h(()=>[i(_,{class:F(["text-c-2 hover:bg-b-2 group relative flex h-8 items-center gap-1.5 rounded py-1 pr-1.5 font-medium no-underline",[e.variable.color?"pl-5":"pl-1.5"]]),exactActiveClass:"bg-b-2 !text-c-1",role:"button",to:e.to,onClick:o[1]||(o[1]=w(m=>p(m),["prevent"]))},{default:h(()=>[e.variable.color?(t(),s("button",{key:0,class:"hover:bg-b-3 rounded p-1.5",type:"button",onClick:o[0]||(o[0]=m=>f(e.variable.uid))},[D("div",{class:"h-2.5 w-2.5 rounded-xl",style:V({backgroundColor:e.variable.color})},null,4)])):b("",!0),e.variable.icon?(t(),B(n(v),{key:1,class:"text-sidebar-c-2 size-3.5 stroke-[2.25]",icon:e.variable.icon},null,8,["icon"])):b("",!0),D("span",G,A(e.variable.name),1),i(W,{isCopyable:!!e.isCopyable,isDeletable:!!e.isDeletable,isRenameable:!!e.isRenameable,variable:{...e.variable,isDefault:e.variable.isDefault??!1},warningMessage:e.warningMessage,onDelete:g,onRename:d},null,8,["isCopyable","isDeletable","isRenameable","variable","warningMessage"])]),_:1},8,["class","to"])]),_:1},8,["id","ceiling","floor","isDraggable","isDroppable","parentIds"])])}}}),Z=C(H,[["__scopeId","data-v-0b6c70e4"]]);export{Y as _,Z as p};
