import{d as k,ez as y,J as b,b as h,c as g,u as _}from"./outputWidgets.903ef13f.js";import{e as w,a as C,b as H}from"./icons.c6b9d5b7.js";import{a as I}from"./asyncComputed.c4e04ddf.js";import{H as d}from"./hooks.25569791.js";import{C as x}from"./CrudView.87fcb808.js";import{a as D}from"./ant-design.6476f34e.js";import"./activeRecord.55ed0790.js";import"./pubsub.c9a1cd12.js";import"./index.038e0c5b.js";import"./Title.a0ce44ea.js";import"./Form.49dc913d.js";import"./router.ddb32f08.js";import"./index.e5fe38b8.js";import"./url.08ed6687.js";import"./index.c70ecf50.js";import"./index.d93d8aa2.js";import"./index.abf1ee4c.js";import"./index.ff825c04.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]="b496916c-0139-44dd-99b6-d356a7bf214e",a._sentryDebugIdIdentifier="sentry-dbid-b496916c-0139-44dd-99b6-d356a7bf214e")}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=b(()=>{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)=>(h(),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.cd9cec94.js.map
