import{d as k,ez as y,J as h,b,c as g,u as _}from"./outputWidgets.9b7c29ed.js";import{e as w,a as C,b as H}from"./icons.7c250a15.js";import{a as I}from"./asyncComputed.6a414bed.js";import{H as l}from"./hooks.146679d7.js";import{C as x}from"./CrudView.73bf57c7.js";import{a as D}from"./ant-design.9b0f163e.js";import"./activeRecord.264ba54c.js";import"./pubsub.f1df5000.js";import"./index.ddedd1b8.js";import"./Title.55bc3e25.js";import"./Form.77e50956.js";import"./router.a8553211.js";import"./index.31be9da9.js";import"./url.c61c9940.js";import"./index.5695780b.js";import"./index.d8ed1958.js";import"./index.817f3ac7.js";import"./index.316bc1ac.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]="8a1e838a-1d0c-4fd9-9dd0-c397b03e77fd",a._sentryDebugIdIdentifier="sentry-dbid-8a1e838a-1d0c-4fd9-9dd0-c397b03e77fd")}catch{}})();const G=k({__name:"Hooks",setup(a){const n=y(),{loading:s,result:i,refetch:c}=I(()=>l.list()),d=({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()),c()},u=async()=>{const e=await l.create();d({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()),c())},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:d},{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.5f09f556.js.map
