import{d as k,ey as y,H as h,b,c as g,u as _}from"./outputWidgets.8a1294ac.js";import{e as w,a as H,b as C}from"./icons.25b21aee.js";import{a as I}from"./asyncComputed.3699cd44.js";import{H as p}from"./hooks.e742fa23.js";import{C as x}from"./CrudView.707fb9d1.js";import{a as D}from"./ant-design.8f569ff8.js";import"./activeRecord.4f50a80e.js";import"./pubsub.5ff7800d.js";import"./index.21148e20.js";import"./Title.c5e29cf7.js";import"./Form.1860c0ed.js";import"./router.e765b2a2.js";import"./index.04ab96ef.js";import"./url.9a5c0e6d.js";import"./index.d5d7d1dc.js";import"./index.4fc6eb1b.js";import"./index.91683b65.js";import"./index.bf7f5369.js";import"./index.0f4f2049.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]="93b80cf5-8572-4aa5-abe5-58691d26f986",a._sentryDebugIdIdentifier="sentry-dbid-93b80cf5-8572-4aa5-abe5-58691d26f986")}catch{}})();const K=k({__name:"Hooks",setup(a){const n=y(),{loading:s,result:i,refetch:l}=I(()=>p.list()),c=({key:e})=>n.push({path:`/_editor/hook/${encodeURIComponent(e)}`}),d=async({key:e})=>{var o,t;await((t=(o=i.value)==null?void 0:o.find(r=>r.path===e))==null?void 0:t.duplicate()),l()},m=async()=>{const e=await p.create();c({key:e.path})},u=async({key:e})=>{var o,t;await D("Are you sure you want to delete this hook?")&&(await((t=(o=i.value)==null?void 0:o.find(r=>r.path===e))==null?void 0:t.delete()),l())},f=h(()=>{var e,o;return{columns:[{name:"Hook Name"},{name:"Path"},{name:"Actions",align:"right"}],rows:(o=(e=i.value)==null?void 0:e.map(t=>({key:t.path,cells:[{text:t.title,link:`/_editor/hook/${encodeURIComponent(t.path)}`},{text:t.path},{text:"",actions:[{icon:w,label:"Edit Hook",onClick:c},{icon:H,label:"Duplicate",onClick:d},{icon:C,label:"Delete",onClick:u,dangerous:!0}]}]})))!=null?o:[]}});return(e,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{K as default};
//# sourceMappingURL=Hooks.1b0834dd.js.map
