import{d as k,ey as y,H as h,b,c as g,u as _}from"./outputWidgets.d6334d0e.js";import{e as w,a as H,b as C}from"./icons.09e1f108.js";import{a as I}from"./asyncComputed.95fd0999.js";import{H as p}from"./hooks.41346d54.js";import{C as x}from"./CrudView.a040df87.js";import{a as D}from"./ant-design.765336cf.js";import"./activeRecord.aa738a85.js";import"./pubsub.9d7d329e.js";import"./Text.2f6a30da.js";import"./Title.132c3f7f.js";import"./transButton.97ae4a5a.js";import"./router.c9839d0e.js";import"./Form.afe8a620.js";import"./index.85dd1fea.js";import"./url.dce42ecb.js";import"./index.9476b093.js";import"./index.e0fb68fa.js";import"./index.98d66b02.js";import"./index.2221e01c.js";import"./index.6da051f8.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]="a25eb856-9090-4c8e-8d02-307eed4d4b90",a._sentryDebugIdIdentifier="sentry-dbid-a25eb856-9090-4c8e-8d02-307eed4d4b90")}catch{}})();const L=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{L as default};
//# sourceMappingURL=Hooks.c762119b.js.map
