import{d as k,ez as y,J as h,b,c as g,u as _}from"./outputWidgets.65926c1d.js";import{e as w,a as C,b as H}from"./icons.da7d27cd.js";import{a as I}from"./asyncComputed.4723d9b8.js";import{H as d}from"./hooks.4d601fd1.js";import{C as x}from"./CrudView.bb677fb8.js";import{a as D}from"./ant-design.14676eb3.js";import"./activeRecord.994400e6.js";import"./pubsub.dc5bec39.js";import"./index.2740d90e.js";import"./Title.2cced18a.js";import"./Form.47548ee6.js";import"./router.52af5430.js";import"./index.553ada1f.js";import"./url.bc2b44ba.js";import"./index.0312767e.js";import"./index.006c6212.js";import"./index.73801d39.js";import"./index.1bb9605d.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]="d57e5d08-f614-46c0-9b51-a21bf6fdd453",a._sentryDebugIdIdentifier="sentry-dbid-d57e5d08-f614-46c0-9b51-a21bf6fdd453")}catch{}})();const G=k({__name:"Hooks",setup(a){const n=y(),{loading:s,result:i,refetch:l}=I(()=>d.list()),c=({key:e})=>n.push({path:`/_editor/hook/${encodeURIComponent(e)}`}),p=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()},u=async()=>{const e=await d.create();c({key:e.path})},m=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:C,label:"Duplicate",onClick:p},{icon:H,label:"Delete",onClick:m,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:u},null,8,["loading","table"]))}});export{G as default};
//# sourceMappingURL=Hooks.7d104946.js.map
