1import{as as x,an as j,af as t,r as y}from"./vendor-B2oIjyY4.js";import{b as F,p as P,st as _,su as A,sv as E,_ as M,rO as C,f5 as O,w as S,sw as w,e1 as D,R,C as V,f6 as B,ob as L,l as T,f8 as W,n as k,oO as z,aj as H,y as U}from"./main-CJK8sxkW.js";import{u as N}from"./use-optimistic-value-ACNSQkFa.js";import"./bounded-range-fetch-CggGfMWc.js";import"./vendor-charts-BqgCVUWx.js";const J=()=>{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:s=>{var n;return(n=s.functions)==null?void 0:n[0]},suspense:!0}),v=M({v2:{resource:"event_function",grant:"can_update",id:String(i)}},{enabled:!!i}),h=C({eventsRbacEnabled:p,resource:e,user:l,permissions:v}),{optimisticValue:a,setOptimisticValue:r,clearOptimisticValue:g}=N({name:e==null?void 0:e.name,description:e==null?void 0:e.description},e),{name:c,description:b}=a;if(!e)return t.jsx(O,{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 s=>{try{await f.mutateAsync({id:e.id,versionNumber:e.version_number,input:s}),o({id:"update-function",title:"Function updated",variant:"success"})}catch(n){H(n),g(),o({id:"update-function",title:"Failed to update function",message:n.message,variant:"error"})}};return t.jsx(S,{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:!h}],header:t.jsxs(R,{flex:1,minWidth:0,align:"center",justify:"space-between",children:[t.jsxs(V,{flex:1,minWidth:0,gap:2,children:[t.jsx(B,{permission:{v2:{resource:"event_function",grant:"can_update",id:e.id}},placeholder:"Add a nameâ¦",size:"lg",value:c??"",onChange:s=>{r({...a,name:s}),u({name:s})}}),t.jsx(L,{permission:{v2:{resource:"event_function",grant:"can_update",id:e.id}},placeholder:"Add a descriptionâ¦",value:b??"",onChange:s=>{r({...a,description:s}),u({description:s})}})]}),t.jsxs(T,{isLazy:!1,children:[t.jsx(W,{variant:"secondary"}),t.jsx(k,{children:t.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:t.jsx(y.Suspense,{fallback:t.jsx(D,{}),children:t.jsx(w,{context:{function:e}})})})};export{J as FunctionLayout}; 2//# sourceMappingURL=index-2IX3uAg3.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.