import{d as k,eA as y,G as h,b,c as g,u as _}from"./outputWidgets.0ed3a637.js";import{e as w,d as C,a as H}from"./icons.8d5441dc.js";import{a as I}from"./asyncComputed.054ae312.js";import{H as l}from"./hooks.1ffd77ec.js";import{C as x}from"./CrudView.931c84f7.js";import{a as D}from"./ant-design.b8da9ea1.js";import"./activeRecord.e0ef2424.js";import"./pubsub.5dd4605f.js";import"./Text.e89a9af1.js";import"./Base.69739fb7.js";import"./transButton.3ca23b61.js";import"./router.d8af0f7d.js";import"./Title.53f943d2.js";import"./index.230ffe19.js";import"./url.4f7be002.js";import"./index.0f5ee3e7.js";import"./index.feaa4503.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]="ddfcfc58-dc7a-49e6-8389-d7d3778425da",a._sentryDebugIdIdentifier="sentry-dbid-ddfcfc58-dc7a-49e6-8389-d7d3778425da")}catch{}})();const z=k({__name:"Hooks",setup(a){const n=y(),{loading:s,result:i,refetch:d}=I(()=>l.list()),c=({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()),d()},u=async()=>{const e=await l.create();c({key:e.path})},m=async({key:e})=>{var o,t;await D("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()),d())},f=h(()=>{var e,o;return{columns:[{name:"Hook Name"},{name:"Path"},{name:"Actions",align:"right"}],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:w,label:"Edit Hook",onClick:c},{icon:C,label:"Duplicate",onClick:p},{icon:H,label:"Delete",onClick:m,dangerous:!0}]}]})))!=null?o:[]}});return(e,o)=>(b(),g(x,{loading:_(s),title:"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{z as default};
//# sourceMappingURL=Hooks.cc408935.js.map
