import{d as k,ex as y,H as b,b as h,c as _,u as H}from"./registerWidgets.faec4901.js";import{e as g,a as w,b as C}from"./icons.4b27c20b.js";import{a as x}from"./asyncComputed.04758d6d.js";import{H as l}from"./hooks.3f6f18d7.js";import{_ as I}from"./CrudView.vue_vue_type_script_setup_true_lang.3dfdcdc3.js";import"./activeRecord.64153c3d.js";import"./pubsub.c32c984e.js";import"./Modal.c4a3eb37.js";import"./Title.38629c7e.js";import"./transButton.389d0ba4.js";import"./index.bd454869.js";import"./Text.8913855c.js";import"./index.353431e1.js";import"./index.da74220a.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]="103ddb87-0d18-4775-9d1d-7dbfcc993c74",a._sentryDebugIdIdentifier="sentry-dbid-103ddb87-0d18-4775-9d1d-7dbfcc993c74")}catch{}})();const j=k({__name:"Hooks",setup(a){const n=y(),{loading:s,result:i,refetch:c}=x(()=>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;confirm("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=b(()=>{var e,o;return{columns:[{name:"Hook Name"},{name:"Path"},{name:"Hook Actions"}],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:g,label:"Edit Hook",onClick:d},{icon:w,label:"Duplicate",onClick:p},{icon:C,label:"Delete",onClick:m,dangerous:!0}]}]})))!=null?o:[]}});return(e,o)=>(h(),_(I,{loading:H(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{j as default};
//# sourceMappingURL=Hooks.3f8d2ae5.js.map
