import{d as k,ex as y,H as b,b as h,c as _,u as H}from"./registerWidgets.1e9167ab.js";import{e as g,a as w,b as C}from"./icons.41af03d8.js";import{a as x}from"./asyncComputed.8a644895.js";import{H as d}from"./hooks.9dbb5925.js";import{_ as I}from"./CrudView.vue_vue_type_script_setup_true_lang.e0bf9fc2.js";import"./activeRecord.60b6bd01.js";import"./pubsub.09eafe35.js";import"./Modal.b646cd22.js";import"./Title.d1f45d59.js";import"./transButton.755e702e.js";import"./index.9165a659.js";import"./Text.c8d7b4c0.js";import"./index.32c7f8ee.js";import"./index.d74062f4.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]="4e38dab1-7338-4ed1-97cf-bdcd1f0ccaa1",a._sentryDebugIdIdentifier="sentry-dbid-4e38dab1-7338-4ed1-97cf-bdcd1f0ccaa1")}catch{}})();const j=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;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:l},{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.f7da9702.js.map
