1import{as as x,an as j,af as s,r as y}from"./vendor-BgWhiDrf.js";import{b as F,p as P,sX as _,sY as A,sZ as E,$ as M,sg as C,f6 as S,w as D,s_ as R,e2 as V,R as w,C as B,f7 as L,oA as O,l as k,f9 as T,n as W,pb as z,ak as H,y as U}from"./main-COyT_q74.js";import{u as $}from"./use-optimistic-value-Do20OxuL.js";import"./bounded-range-fetch-CggGfMWc.js";import"./vendor-charts-34qQJjVh.js";const q=()=>{const{id:i}=x(),{toast:o}=U(),d=F(),{user:l}=P(),{eventsRbacEnabled:p}=j(),m=_(),f=A(),{data:e}=E({id:String(i)},{enabled:!!i,select:t=>{var n;return(n=t.functions)==null?void 0:n[0]},suspense:!0}),v=M({v2:{resource:"event_function",grant:"can_update",id:String(i)}},{enabled:!!i}),g=C({eventsRbacEnabled:p,resource:e,user:l,permissions:v}),{optimisticValue:a,setOptimisticValue:r,clearOptimisticValue:h}=$({name:e==null?void 0:e.name,description:e==null?void 0:e.description},e),{name:c,description:b}=a;if(!e)return s.jsx(S,{subtitle:"An error occurred while fetching this resource. Please try again, or contact support if the issue persists.",title:"Function not found"});const u=async t=>{try{await f.mutateAsync({id:e.id,versionNumber:e.version_number,input:t}),o({id:"update-function",title:"Function updated",variant:"success"})}catch(n){H(n),h(),o({id:"update-function",title:"Failed to update function",message:n.message,variant:"error"})}};return s.jsx(D,{tabDepth:5,title:`Edit function | ${e.name}`,crumbs:[{label:"Functions",link:"/events/functions"},{label:c||e.name}],tabs:[{title:"Code",path:"code",variant:"fullPage"},{title:"Connected syncs",path:"syncs",count:e.function_resources.length,variant:"table"},{title:"Permissions",path:"permissions",variant:"page",isHidden:!g}],header:s.jsxs(w,{flex:1,minWidth:0,align:"center",justify:"space-between",children:[s.jsxs(B,{flex:1,minWidth:0,gap:2,children:[s.jsx(L,{permission:{v2:{resource:"event_function",grant:"can_update",id:e.id}},placeholder:"Add a nameâ¦",size:"lg",value:c??"",onChange:t=>{r({...a,name:t}),u({name:t})}}),s.jsx(O,{permission:{v2:{resource:"event_function",grant:"can_update",id:e.id}},placeholder:"Add a descriptionâ¦",value:b??"",onChange:t=>{r({...a,description:t}),u({description:t})}})]}),s.jsxs(k,{isLazy:!1,children:[s.jsx(T,{variant:"secondary"}),s.jsx(W,{children:s.jsx(z,{permission:{v2:{resource:"event_function",grant:"can_delete",id:e.id}},variant:"menu",label:"function",onDelete:()=>m.mutateAsync({id:e.id}),onSuccess:()=>{d("/events/functions")}})})]})]}),children:s.jsx(y.Suspense,{fallback:s.jsx(V,{}),children:s.jsx(R,{context:{function:e}})})})};export{q as FunctionLayout}; 2//# sourceMappingURL=index-D3YS6utl.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.