import{d as k,K as y,b as h,t as g,z as d,H as _}from"./registerWidgets.cb3a7b8d.js";import{f as H,g as w,h as C}from"./icons.39dfa322.js";import{a as I}from"./asyncComputed.31994732.js";import{H as p}from"./hooks.fd4bb08f.js";import{R as x}from"./RuntimeList.ec9e2b4b.js";import"./activeRecord.adfc6223.js";import"./pubsub.f85a17d2.js";import"./DropdownMenu.c973057b.js";import"./CircularLoading.1e68d2b1.js";import"./lottie.234eb92e.js";(function(){try{var n=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},a=new Error().stack;a&&(n._sentryDebugIds=n._sentryDebugIds||{},n._sentryDebugIds[a]="c5ce1b87-c640-4e9b-b385-6087def9bc32",n._sentryDebugIdIdentifier="sentry-dbid-c5ce1b87-c640-4e9b-b385-6087def9bc32")}catch{}})();const $=k({__name:"Hooks",setup(n){const a=_(),{loading:r,result:s,refetch:c}=I(()=>p.list()),l=({key:e})=>a.push({path:`/_editor/hook/${encodeURIComponent(e)}`}),u=async({key:e})=>{var o,t;await((t=(o=s.value)==null?void 0:o.find(i=>i.path===e))==null?void 0:t.duplicate()),c()},m=async()=>{const e=await p.create();l({key:e.path})},f=async({key:e})=>{var o,t;confirm("Are you sure you want to delete this hook?")&&(await((t=(o=s.value)==null?void 0:o.find(i=>i.path===e))==null?void 0:t.delete()),c())},b=y(()=>{var e,o;return{columns:[{name:"Hook Name"},{name:"Path"},{name:"Hook Actions"}],rows:(o=(e=s.value)==null?void 0:e.map(t=>({key:t.path,cells:[{text:t.title,classes:["title","centered"],link:`/_editor/hook/${encodeURIComponent(t.path)}`},{text:t.path},{text:"",classes:["centered"],actions:[{icon:H,label:"Delete",onClick:f,dangerous:!0},{icon:w,label:"Edit Hook",onClick:l},{icon:C,label:"Duplicate",onClick:u}]}]})))!=null?o:[]}});return(e,o)=>(h(),g(x,{loading:d(r),title:"Python Hooks",description:"Trigger your Python scripts with a request.","create-button-text":"Create Hook","empty-title":"No hooks here yet",table:d(b),onCreate:m},null,8,["loading","table"]))}});export{$ as default};
//# sourceMappingURL=Hooks.c53952b8.js.map
