import{j as e,Y as h,v as y}from"./app-CffHYkHW.js";import{d as D,e as g,f as k,D as w,a as C,c as t}from"./bluetooth-context-CLrE8g1i.js";import{u as r}from"./app-layout-D-VS7nVU.js";import{c as d}from"./createLucideIcon-DAR-hy5d.js";import{T as x}from"./trash-o9eyCj69.js";import{D as v,a as M,b,c as A,e as _,g as $}from"./dialog-Djfc3pyN.js";import{B as u}from"./button-qhe8lrPU.js";import{t as N}from"./index-Dw4sHwMN.js";import{X as H}from"./x-BfabuQJD.js";/**
 * @license lucide-react v0.475.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const S=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"m12 16 4-4-4-4",key:"1i9zcv"}]],T=d("CircleArrowRight",S);/**
 * @license lucide-react v0.475.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const z=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],B=d("Ellipsis",z);/**
 * @license lucide-react v0.475.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const R=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],j=d("SquarePen",R);function J({withDetail:o=!1,withEdit:s=!0,withDelete:i=!0,isModal:c=!1,actionEdit:l,actionDetailHref:n="",actionEditHref:m="",actionDelete:p,permissionPrefix:a,children:f}){return e.jsxs(D,{modal:!1,children:[e.jsx(g,{className:"focus-within:outline-none",children:e.jsx(B,{})}),e.jsxs(k,{side:"left",align:"start",children:[e.jsx(w,{children:"Aksi"}),e.jsx(C,{}),f,o&&r([`${a}-show`])&&e.jsx(t,{asChild:!0,children:e.jsxs(h,{href:n,children:[e.jsx(T,{})," Detail"]})}),c?s&&r([`${a}-update`])&&e.jsxs(t,{onClick:l,children:[e.jsx(j,{})," Ubah"]}):s&&r([`${a}-update`])&&e.jsx(t,{asChild:!0,children:e.jsxs(h,{href:m,children:[e.jsx(j,{})," Ubah"]})}),i&&r([`${a}-delete`])&&e.jsxs(t,{onClick:p,children:[e.jsx(x,{})," Hapus"]})]})]})}function K({open:o,onOpenChange:s,url:i}){const{delete:c}=y(),l=async n=>{c(n,{onSuccess:()=>{s(!1),N.success("Data berhasil dihapus.")}})};return e.jsx(v,{open:o,onOpenChange:s,children:e.jsxs(M,{children:[e.jsxs(b,{children:[e.jsx(A,{children:"Delete Confirmation"}),e.jsx(_,{"aria-describedby":"modal-delete",children:"Are you sure want to delete this data ?"})]}),e.jsxs("div",{className:"flex justify-center sm:justify-start items-center gap-2 mt-2",children:[e.jsx($,{asChild:!0,children:e.jsxs(u,{variant:"destructive",children:[e.jsx(H,{})," Cancel"]})}),e.jsxs(u,{type:"button",variant:"default",onClick:()=>l(i),children:[e.jsx(x,{})," Yes, Delete it"]})]})]})})}export{J as A,K as M};
