import{d as k,ey as y,H as h,b,c as g,u as _}from"./outputWidgets.a8447bcb.js";import{e as w,a as H,b as C}from"./icons.6de7af10.js";import{a as I}from"./asyncComputed.6c2627ea.js";import{H as p}from"./hooks.9f2c5143.js";import{C as x}from"./CrudView.996cd8b2.js";import{a as D}from"./ant-design.1bcd10c9.js";import"./activeRecord.52c1b6f8.js";import"./pubsub.3b516de1.js";import"./Text.722e2789.js";import"./Title.4127a4b4.js";import"./transButton.26020e2e.js";import"./router.8be149da.js";import"./Form.a869b3cf.js";import"./index.41d49230.js";import"./url.0a1547fb.js";import"./index.ee9a096e.js";import"./index.c058ebd2.js";import"./index.823e1eed.js";import"./index.71f713cd.js";import"./index.5fa32c06.js";(function(){try{var a=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},n=new Error().stack;n&&(a._sentryDebugIds=a._sentryDebugIds||{},a._sentryDebugIds[n]="d15f943f-4ded-4a43-86d3-68272d621808",a._sentryDebugIdIdentifier="sentry-dbid-d15f943f-4ded-4a43-86d3-68272d621808")}catch{}})();const L=k({__name:"Hooks",setup(a){const n=y(),{loading:s,result:i,refetch:d}=I(()=>p.list()),l=({key:t})=>n.push({path:`/_editor/hook/${encodeURIComponent(t)}`}),c=async({key:t})=>{var o,e;await((e=(o=i.value)==null?void 0:o.find(r=>r.path===t))==null?void 0:e.duplicate()),d()},m=async()=>{const t=await p.create();l({key:t.path})},u=async({key:t})=>{var o,e;await D("Are you sure you want to delete this hook?")&&(await((e=(o=i.value)==null?void 0:o.find(r=>r.path===t))==null?void 0:e.delete()),d())},f=h(()=>{var t,o;return{columns:[{name:"Hook Name"},{name:"Path"},{name:"Actions",align:"right"}],rows:(o=(t=i.value)==null?void 0:t.map(e=>({key:e.path,cells:[{text:e.title,link:`/_editor/hook/${encodeURIComponent(e.path)}`},{text:e.path},{text:"",actions:[{icon:w,label:"Edit Hook",onClick:l},{icon:H,label:"Duplicate",onClick:c},{icon:C,label:"Delete",onClick:u,dangerous:!0}]}]})))!=null?o:[]}});return(t,o)=>(b(),g(x,{loading:_(s),title:"Python Hooks",description:"Trigger your Python scripts with a request.","create-button-text":"Create Hook","empty-title":"No hooks here yet",table:f.value,"entity-name":"Hook",onCreate:m},null,8,["loading","table"]))}});export{L as default};
//# sourceMappingURL=Hooks.5101b155.js.map
