import{d as k,K as y,b as h,t as g,z as d,H as _}from"./registerWidgets.29e41a54.js";import{f as H,g as w,h as C}from"./icons.b931f659.js";import{a as I}from"./asyncComputed.0126d7e4.js";import{H as u}from"./hooks.88687a86.js";import{R as x}from"./RuntimeList.2dcbb582.js";import"./activeRecord.d63d0be1.js";import"./DropdownMenu.7bd7adf5.js";import"./CircularLoading.0d1cd4f5.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]="e0df9b1a-006d-466b-a0e5-6308ba495eb6",a._sentryDebugIdIdentifier="sentry-dbid-e0df9b1a-006d-466b-a0e5-6308ba495eb6")}catch{}})();const T=k({__name:"Hooks",setup(a){const n=_(),{loading:r,result:s,refetch:c}=I(()=>u.list()),l=({key:e})=>n.push({path:`/_editor/hook/${encodeURIComponent(e)}`}),p=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 u.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:p}]}]})))!=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{T as default};
//# sourceMappingURL=Hooks.ee14edbe.js.map
