import{d as y,K as h,b,t as g,z as d,H as _}from"./registerWidgets.726232df.js";import{f as H,g as w,h as C}from"./icons.f7969917.js";import{a as I}from"./asyncComputed.638ec138.js";import{H as u}from"./hooks.a4dbd566.js";import{R as x}from"./RuntimeList.0ea6da76.js";import"./activeRecord.acbdb8bc.js";import"./DropdownMenu.3ede6951.js";import"./CircularLoading.4a9d4906.js";import"./lottie.1c3b7cde.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]="32c9cffa-ff37-4466-8516-8c8947c31ce0",a._sentryDebugIdIdentifier="sentry-dbid-32c9cffa-ff37-4466-8516-8c8947c31ce0")}catch{}})();const U=y({__name:"Hooks",setup(a){const n=_(),{loading:i,result:s,refetch:r}=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(c=>c.path===e))==null?void 0:t.duplicate()),r()},f=async()=>{const e=await u.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=s.value)==null?void 0:o.find(c=>c.path===e))==null?void 0:t.delete()),r())},k=h(()=>{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:m,dangerous:!0},{icon:w,label:"Edit Hook",onClick:l},{icon:C,label:"Duplicate",onClick:p}]}]})))!=null?o:[]}});return(e,o)=>(b(),g(x,{loading:d(i),title:"Python Hooks",description:"Trigger your Python scripts with a request.","create-button-text":"Create Hook","empty-title":"No hooks here yet",table:d(k),onCreate:f},null,8,["loading","table"]))}});export{U as default};
//# sourceMappingURL=Hooks.4ae2c75c.js.map
