import{d as h,G as y,b,t as F,y as i,K as _}from"./registerWidgets.fff064a1.js";import{e as w,f as g,g as C}from"./icons.907f45d7.js";import{a as k}from"./CircularLoading.59d7fd3d.js";import{F as c}from"./forms.7bc6baea.js";import{R as x}from"./RuntimeList.106b52b7.js";import"./utils.3371dfe5.js";const B=h({__name:"Forms",setup(v){const n=_(),{loading:l,result:a,refetch:s}=k(()=>c.list()),m=({key:e})=>n.push({path:`/_editor/form/${e}`}),u=async({key:e})=>{var o,t;await((t=(o=a.value)==null?void 0:o.find(r=>r.path===e))==null?void 0:t.duplicate()),s()},d=async()=>{const e=await c.create();n.push({path:`/_editor/form/${e.path}`})},p=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(r=>r.path===e))==null?void 0:t.delete()),s())},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/${t.path}`},{text:t.path},{text:"",classes:["centered"],actions:[{icon:w,label:"Delete",onClick:p,dangerous:!0},{icon:g,label:"Edit Form",onClick:m},{icon:C,label:"Duplicate",onClick:u}]}]})))!=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{B as default};
//# sourceMappingURL=Forms.8f844ffe.js.map
