import{d as b,ez as k,J as y,b as h,c as _,u as g}from"./outputWidgets.c072fe4e.js";import{e as w,a as H,b as C}from"./icons.158b4825.js";import{a as I}from"./asyncComputed.376cdc00.js";import{H as d}from"./hooks.bc826a67.js";import{_ as x}from"./CrudView.vue_vue_type_script_setup_true_lang.9296340f.js";import{a as D}from"./ant-design.5cb2a38e.js";import"./activeRecord.fdc25b97.js";import"./pubsub.98ad9fe0.js";import"./index.4cff163b.js";import"./Title.e3dcb8ea.js";import"./Form.9f52866c.js";import"./index.4e6af937.js";import"./index.d9c3e0de.js";import"./index.2e3640f1.js";import"./index.e7c5574b.js";import"./index.ec8e038a.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]="59753d7b-b750-42c9-a025-6d9e2b02471b",a._sentryDebugIdIdentifier="sentry-dbid-59753d7b-b750-42c9-a025-6d9e2b02471b")}catch{}})();const j=b({__name:"Hooks",setup(a){const n=k(),{loading:s,result:i,refetch:c}=I(()=>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;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()),c())},f=y(()=>{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:l},{icon:H,label:"Duplicate",onClick:p},{icon:C,label:"Delete",onClick:m,dangerous:!0}]}]})))!=null?o:[]}});return(e,o)=>(h(),_(x,{loading:g(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.5cba1e50.js.map
