import{d as h,K as y,b,t as F,z as i,H as w}from"./registerWidgets.802bba2f.js";import{f as C,g as _,h as g}from"./icons.1dc8a69b.js";import{a as k}from"./asyncComputed.1364aaa9.js";import{F as c}from"./forms.91463966.js";import{R as x}from"./RuntimeList.0e990b61.js";import"./utils.95f0e9e8.js";import"./pubsub.a0411919.js";import"./DropdownMenu.32db0ef2.js";import"./CircularLoading.5c7f2ad7.js";const z=h({__name:"Forms",setup(R){const m=w(),{loading:l,result:a,refetch:r}=k(()=>c.list()),s=({key:e})=>m.push({path:`/_editor/form/${encodeURIComponent(e)}`}),p=async({key:e})=>{var o,t;await((t=(o=a.value)==null?void 0:o.find(n=>n.path===e))==null?void 0:t.duplicate()),r()},d=async()=>{const e=await c.create();s({key:e.path})},u=async({key:e})=>{var o,t;confirm("Are you sure you want to delete this form?")&&(await((t=(o=a.value)==null?void 0:o.find(n=>n.path===e))==null?void 0:t.delete()),r())},f=y(()=>{var e,o;return{columns:[{name:"Form Name"},{name:"Path"},{name:"Form Actions"}],rows:(o=(e=a.value)==null?void 0:e.map(t=>({key:t.path,cells:[{text:t.title,classes:["title","centered"],link:`/_editor/form/${encodeURIComponent(t.path)}`},{text:t.path},{text:"",classes:["centered"],actions:[{icon:C,label:"Delete",onClick:u,dangerous:!0},{icon:_,label:"Edit Form",onClick:s},{icon:g,label:"Duplicate",onClick:p}]}]})))!=null?o:[]}});return(e,o)=>(b(),F(x,{loading:i(l),title:"Dynamic Python forms",description:"Create forms with advanced logic, easy integrations and custom branding.","create-button-text":"Create Form","empty-title":"No forms here yet","video-url":"https://www.youtube.com/embed/tN7SRGmVPwc",table:i(f),onCreate:d},null,8,["loading","table"]))}});export{z as default};
//# sourceMappingURL=Forms.d06c3f8e.js.map
