import{d as k,ex as y,H as h,b as _,c as b,u as g}from"./registerWidgets.4340e287.js";import{e as H,a as w,b as C}from"./icons.da02f7f7.js";import{a as x}from"./asyncComputed.a4cc4ebe.js";import{H as d}from"./hooks.d572fc44.js";import{_ as I}from"./CrudView.vue_vue_type_script_setup_true_lang.e9f57b5e.js";import{a as D}from"./ant-design.56df7a71.js";import"./activeRecord.c40ac301.js";import"./pubsub.3290d859.js";import"./index.f58e2ef8.js";import"./Title.4165770a.js";import"./Form.7b78c348.js";import"./index.17a2edf7.js";import"./index.7bc7e814.js";import"./index.d24f6130.js";import"./index.9aade351.js";import"./index.c13b703c.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]="307a73ff-51c5-48a9-a8a6-4cd742da3146",a._sentryDebugIdIdentifier="sentry-dbid-307a73ff-51c5-48a9-a8a6-4cd742da3146")}catch{}})();const G=k({__name:"Hooks",setup(a){const n=y(),{loading:s,result:i,refetch:c}=x(()=>d.list()),l=({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 d.create();l({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:H,label:"Edit Hook",onClick:l},{icon:w,label:"Duplicate",onClick:p},{icon:C,label:"Delete",onClick:m,dangerous:!0}]}]})))!=null?o:[]}});return(e,o)=>(_(),b(I,{loading:g(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.902d4a5b.js.map
