PageSourceSearch

https://treasury.cordial.systems/assets/index-CUIK1Y5n.js

js cordial.systems collected 2026-10-03 21:19:10 UTC 23,507 bytes, 1 lines download raw bytes

1import{R as b,j as e,r as R}from"./vendor-react-DD4RfgUY.js";import{gt as Na,gu as Pe,gv as Aa,gw as De,gx as ya,gy as Ca,gz as wa,gA as Ia,gB as Sa,gC as Ra,gD as Ee,gE as Oa,b3 as _,cE as Ue,d as Me,aL as ka,i as Ta,b as za,gF as _a,d8 as Pa,cK as Da,O as Ea,gG as Ua,fA as Ma,bM as $a,gH as La,cJ as Ha,cv as $e,bq as Va,b2 as C,aO as Ne,Y as Ae,Z as ye,a1 as Ce,gI as Fa,$ as we,a0 as B,c0 as q,ej as Ba,b_ as ae,db as se,b$ as Ie,dc as qa,dd as Ga,de as Ya,df as Ka,dg as Xa,dh as ne,bX as te,bY as oe,bZ as ie,gm as Za,ba as z,cA as Ja,dk as Le,af as re,bc as Se,bT as Re,bU as Oe,bV as ke,fr as Te,aR as G,aM as A,gh as ze,fB as Qa,fC as Wa,ag as es,w as as,fx as ss,g as ns}from"./index-BFcWLo4X.js";import{P as _e,a as rs}from"./data-table-DsWv1Xpq.js";import{g as ts,A as os,a as He,b as is}from"./review-layouts-Z2n2ds5Q.js";import{u as cs,a as ls,b as ds,g as us,c as ms}from"./use-treasury-client-ready-CjtQlIyL.js";import{H as ps}from"./history-YrQMrwNv.js";import{S as xs}from"./search-x-GOqONLoi.js";import{L as hs}from"./list-restart-D8BqoF8X.js";import"./vendor-tanstack-devtools-DProp50S.js";import"./vendor-tanstack-query-CAzJjGHj.js";import"./vendor-noble-D72enfjI.js";import"./use-get-treasury-asset-BJAaxoYp.js";import"./amount-filter-DexROtpA.js";import"./tag-Di898605.js";var y="Accordion",fs=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[ue,gs,js]=Na(y),[K,an]=Aa(y,[js,De]),me=De(),Ve=b.forwardRef((a,t)=>{const{type:r,...i}=a,c=i,o=i;return e.jsx(ue.Provider,{scope:a.__scopeAccordion,children:r==="multiple"?e.jsx(As,{...o,ref:t}):e.jsx(Ns,{...c,ref:t})})});Ve.displayName=y;var[Fe,bs]=K(y),[Be,vs]=K(y,{collapsible:!1}),Ns=b.forwardRef((a,t)=>{const{value:r,defaultValue:i,onValueChange:c=()=>{},collapsible:o=!1,...l}=a,[m,p]=Pe({prop:r,defaultProp:i??"",onChange:c,caller:y});return e.jsx(Fe,{scope:a.__scopeAccordion,value:b.useMemo(()=>m?[m]:[],[m]),onItemOpen:p,onItemClose:b.useCallback(()=>o&&p(""),[o,p]),children:e.jsx(Be,{scope:a.__scopeAccordion,collapsible:o,children:e.jsx(qe,{...l,ref:t})})})}),As=b.forwardRef((a,t)=>{const{value:r,defaultValue:i,onValueChange:c=()=>{},...o}=a,[l,m]=Pe({prop:r,defaultProp:i??[],onChange:c,caller:y}),p=b.useCallback(j=>m((h=[])=>[...h,j]),[m]),x=b.useCallback(j=>m((h=[])=>h.filter(g=>g!==j)),[m]);return e.jsx(Fe,{scope:a.__scopeAccordion,value:l,onItemOpen:p,onItemClose:x,children:e.jsx(Be,{scope:a.__scopeAccordion,collapsible:!0,children:e.jsx(qe,{...o,ref:t})})})}),[ys,X]=K(y),qe=b.forwardRef((a,t)=>{const{__scopeAccordion:r,disabled:i,dir:c,orientation:o="vertical",...l}=a,m=b.useRef(null),p=Ia(m,t),x=gs(r),h=Sa(c)==="ltr",g=Ra(a.onKeyDown,d=>{if(!fs.includes(d.key))return;const P=d.target,O=x().filter($=>!$.ref.current?.disabled),I=O.findIndex($=>$.ref.current===P),D=O.length;if(I===-1)return;d.preventDefault();let v=I;const E=0,k=D-1,U=()=>{v=I+1,v>k&&(v=E)},M=()=>{v=I-1,v<E&&(v=k)};switch(d.key){case"Home":v=E;break;case"End":v=k;break;case"ArrowRight":o==="horizontal"&&(h?U():M());break;case"ArrowDown":o==="vertical"&&U();break;case"ArrowLeft":o==="horizontal"&&(h?M():U());break;case"ArrowUp":o==="vertical"&&M();break}const F=v%D;O[F].ref.current?.focus()});return e.jsx(ys,{scope:r,disabled:i,direction:c,orientation:o,children:e.jsx(ue.Slot,{scope:r,children:e.jsx(Ee.div,{...l,"data-orientation":o,ref:p,onKeyDown:i?void 0:g})})})}),Y="AccordionItem",[Cs,pe]=K(Y),Ge=b.forwardRef((a,t)=>{const{__scopeAccordion:r,value:i,...c}=a,o=X(Y,r),l=bs(Y,r),m=me(r),p=ya(),x=i&&l.value.includes(i)||!1,j=o.disabled||a.disabled;return e.jsx(Cs,{scope:r,open:x,disabled:j,triggerId:p,children:e.jsx(Ca,{"data-orientation":o.orientation,"data-state":Qe(x),...m,...c,ref:t,disabled:j,open:x,onOpenChange:h=>{h?l.onItemOpen(i):l.onItemClose(i)}})})});Ge.displayName=Y;var Ye="AccordionHeader",Ke=b.forwardRef((a,t)=>{const{__scopeAccordion:r,...i}=a,c=X(y,r),o=pe(Ye,r);return e.jsx(Ee.h3,{"data-orientation":c.orientation,"data-state":Qe(o.open),"data-disabled":o.disabled?"":void 0,...i,ref:t})});Ke.displayName=Ye;var ce="AccordionTrigger",Xe=b.forwardRef((a,t)=>{const{__scopeAccordion:r,...i}=a,c=X(y,r),o=pe(ce,r),l=vs(ce,r),m=me(r);return e.jsx(ue.ItemSlot,{scope:r,children:e.jsx(Oa,{"aria-disabled":o.open&&!l.collapsible||void 0,"data-orientation":c.orientation,id:o.triggerId,...m,...i,ref:t})})});Xe.displayName=ce;var Ze="AccordionContent",Je=b.forwardRef((a,t)=>{const{__scopeAccordion:r,...i}=a,c=X(y,r),o=pe(Ze,r),l=me(r);return e.jsx(wa,{role:"region","aria-labelledby":o.triggerId,"data-orientation":c.orientation,...l,...i,ref:t,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...a.style}})});Je.displayName=Ze;function Qe(a){return a?"open":"closed"}var ws=Ve,Is=Ge,Ss=Ke,We=Xe,ea=Je;const Rs=ws,aa=R.forwardRef(({className:a,...t},r)=>e.jsx(Is,{ref:r,className:_("border-b",a),...t}));aa.displayName="AccordionItem";const Os=R.forwardRef(({className:a,children:t,...r},i)=>e.jsx(Ss,{className:"flex",children:e.jsx(We,{ref:i,className:_("flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",a),...r,children:e.jsxs("div",{className:"flex min-w-0 flex-1 items-center justify-between",children:[t,e.jsx(Ue,{className:"h-4 w-4 shrink-0 transition-transform duration-200"})]})})}));Os.displayName=We.displayName;const sa=R.forwardRef(({className:a,children:t,...r},i)=>e.jsx(ea,{ref:i,className:"overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...r,children:e.jsx("div",{className:_("pb-4 pt-0",a),children:t})}));sa.displayName=ea.displayName;const le=[{label:"Access",id:"access",icon:Ce("AccessRule")},{label:"Transfers",id:"transfers",icon:Ce("Transfer")},{label:"All",id:"all",icon:Fa}],na=[{label:"Approvals",id:"approvals",icon:$e},{label:"History",id:"history",icon:ps}],ks=na.map(a=>a.id);function Ts(a){const t=le.find(r=>r.id===a);return t?e.jsx(t.icon,{}):null}function w(a){return a.trim().replace(/^users\//,"").replace(/^user_/,"")}function ra(a){return a instanceof HTMLElement?!!a.closest(["a","button","form","input","select","textarea","[role='dialog']","[role='menu']","[role='listbox']","[role='menuitem']","[data-radix-popper-content-wrapper]"].join(",")):!1}function de(a){return a.replace(/[_-]+/g," ")}function zs(a){const t=de(a).trim();return t&&t.charAt(0).toUpperCase()+t.slice(1)}function _s(a){switch(a){case"succeeded":case"success":case"completed":return"border-emerald-300/60 bg-emerald-500/10 text-emerald-900 dark:border-emerald-400/30 dark:bg-emerald-400/15 dark:text-emerald-200";case"failed":case"rejected":case"cancelled":case"canceled":return"border-red-300/60 bg-red-500/10 text-red-900 dark:border-red-400/30 dark:bg-red-400/15 dark:text-red-200";
1default:return"border-muted-foreground/20 bg-muted text-muted-foreground"}}function ta(a){if(a.state==="succeeded"||a.state==="success")return null;const r=(a.state==="failed"||a.state==="rejected"||a.state==="cancelled"||a.state==="canceled")&&a.errorStatus?`${de(a.state)}: ${zs(a.errorStatus)}`:de(a.state);return e.jsx(es,{variant:"outline",className:_("shrink-0 capitalize",_s(a.state)),children:r})}function V(a,t=24){return a.length<=t?a:`${a.slice(0,t-1)}…`}function Ps(a){if(a&&typeof a=="object"&&!Array.isArray(a))return a;if(typeof a=="string")try{const t=JSON.parse(a);if(t&&typeof t=="object"&&!Array.isArray(t))return t}catch{return null}return null}function Ds(a){const t=a.endsWith("s")?a.slice(0,-1):a;return t.charAt(0).toUpperCase()+t.slice(1)}function Es(a){const t=Ps(a.request?.body),r=a.response!=null&&typeof a.response=="object"&&!Array.isArray(a.response)?a.response:null,i=(typeof a.request?.name=="string"?a.request.name:null)??(typeof r?.name=="string"?r.name:null),c=typeof t?.description=="string"?t.description.trim():"";try{if(!i)return c?{primary:V(c)}:null;const o=as(i),l=V(c||o.id);return o.parent?{primary:l,parentType:Ds(o.parent.type),parentId:V(o.parent.id,12)}:{primary:l}}catch{return c?{primary:V(c)}:i?{primary:V(G(i))}:null}}
1function Us(a){if(!a.currentUserId)return null;const t=new Set((a.usersData??[]).filter(r=>r.matchedAdminUser?.id===a.currentUserId).flatMap(r=>[r.name,r.id,r.ssoSubject,`users/${r.id}`,`users/${r.ssoSubject}`]).map(r=>w(r)));return t.size?t.has(w(a.initiator))?"You cannot approve your own request":a.approvers.some(r=>t.has(w(r)))?"You already approved this":null:null}function Ms(a){const t=a.layout.icon;return t?e.jsx(t,{operation:a.operation}):null}function $s(a){return e.jsx(is,{operation:a.operation,layout:a.layout})}function Ls(a){const t=Me(),r=Qa({onSuccess:d=>{A.success("Operation signed off",{description:d.name})},onError:d=>{A.error(e.jsx(z,{error:d,message:"Error signing operation"}))}}),i=Wa({onSuccess:d=>{A.success("Operation cancelled",{description:d.name})},onError:d=>{A.error(e.jsx(z,{error:d,message:"Error cancelling operation"}))}}),c=r.isPending||i.isPending,o=a.currentUserId?w(a.currentUserId):null,l=o!=null&&w(a.operation.initiator)===o,m=o!=null&&a.operation.signoffUserIds.some(d=>w(d)===o),p=!m&&(l||a.isAdminInSelectedOrganization),x=m?"You already signed off this operation":l||a.isAdminInSelectedOrganization?null:"You must be the initiator or an admin in the selected organization",j=l||a.isAdminInSelectedOrganization,h=j?null:"You must be the initiator or an admin in the selected organization",g=Es(a.operation.operation);return e.jsxs("div",{className:"my-2 flex w-full cursor-pointer flex-row items-center justify-between rounded-lg border bg-card px-3 py-3",onClick:d=>{ra(d.target)||t({to:"/admin/operations/$",params:{_splat:a.operation.name},search:{source:"approvals",tab:a.canAct?"approvals":"history"}})},children:[e.jsx("div",{className:"flex min-w-0 items-center gap-2 pr-2",children:e.jsxs("div",{className:"flex min-w-0 flex-col gap-1",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsxs("p",{className:"truncate",children:[e.jsx("span",{className:"mr-2 rounded-full bg-muted px-2 py-0.5 text-[0.65rem] font-medium tracking-wide text-muted-foreground",children:"Admin"}),e.jsx("span",{className:He(a.operation.action),children:a.operation.action})," ",e.jsx("strong",{children:a.operation.resource}),g?e.jsxs(e.Fragment,{children:[" ",g.primary,g.parentType&&g.parentId?e.jsxs(e.Fragment,{children:[" ",e.jsxs("span",{className:"text-muted-foreground",children:["for ",g.parentType]})," ",g.parentId]}):null]}):null]}),a.showState?e.jsx(ta,{state:a.operation.state,errorStatus:a.operation.operation.error?.status}):null]}),e.jsxs("p",{className:"truncate text-xs text-muted-foreground",children:[e.jsx(Le,{dateData:a.operation.createdAt,className:"hidden xs:inline"}),e.jsx("span",{className:"hidden px-1 xs:inline",children:"-"}),e.jsx("span",{className:"hidden sm:inline",children:a.operation.name}),e.jsx("span",{className:"inline sm:hidden",children:a.operation.id})]})]})}),e.jsx("div",{className:"flex gap-1 px-2 sm:gap-2",children:a.canAct?e.jsxs(e.Fragment,{children:[e.jsxs(te,{children:[e.jsx(oe,{asChild:!0,children:e.jsx("span",{title:x??void 0,children:e.jsx(C,{variant:"default",size:"sm",className:"h-7 bg-emerald-600 text-white hover:bg-emerald-500",disabled:c||!p,onClick:d=>{d.stopPropagation(),r.mutate({operationName:a.operation.name,allowedCredentialIdsHex:a.allowedCredentialIdsHex})},children:e.jsx("span",{children:"Signoff"})})})}),x?e.jsx(ie,{children:x}):null]}),e.jsxs(te,{children:[e.jsx(oe,{asChild:!0,children:e.jsx("span",{title:h??void 0,children:e.jsx(C,{variant:"destructive",size:"sm",className:"h-7",disabled:c||!j,onClick:d=>{d.stopPropagation(),i.mutate({operationName:a.operation.name})},children:e.jsx("span",{children:"Cancel"})})})}),h?e.jsx(ie,{children:h}):null]})]}):null})]})}function sn(){const a=Me(),{user:t}=ka(),[r]=Ta(),[i]=za(),c=i?.url??null,{isTreasuryClientReady:o}=cs(),{search:l,pageSize:m,tab:p,type:x}=_a.useSearch(),j=R.useRef(null),[h,g]=R.useState(""),[d,P]=R.useState(null),[O,I]=R.useState(null),{autofetch:D,toggleAutofetch:v,handlePageSizeChange:E}=Pa(),[k]=Da(l,500),U=Ea({queryKey:["auth","verify"],queryFn:async()=>{const s=ns(),n=await fetch(`${ss}/verify`,{...s&&{headers:{Authorization:`Bearer ${s}`}}});if(!n.ok)throw new Error(`Failed to verify auth state: ${n.status}`);return await n.json()}}),{data:M,error:F,isLoading:$,fetchNextPage:oa,hasNextPage:ia,isFetching:Z,refetch:xe}=Ua({search:k,tab:p,type:x,pageSize:m},{enabled:o&&!!c}),{data:ca,error:he,isLoading:la,refetch:da}=Ma({search:k,tab:p},{enabled:x==="all"}),{data:ua={passkeys:[]}}=$a({enabled:x==="all"}),{data:fe}=La({},{enabled:o&&!!c}),ma=ua.passkeys.map(s=>s.rawId()).filter(s=>s.trim()!==""),{mutate:pa}=ls({onSuccess:(s,n)=>(P(null),s.operation.state==="authorizing"?A.warning(e.jsx(ze,{operationName:s.operation.name})):A.success(`Operation ${n.operation.name} approved successfully`)),onError:s=>{P(null),A.error(e.jsx(z,{error:s,message:"Error approving operation"}))}}),{mutate:xa}=ds({onSuccess:(s,n)=>(I(null),s.operation.state==="authorizing"?A.warning(e.jsx(ze,{operationName:s.operation.name})):A.success(`Operation ${n.operation.name} cancelled successfully`)),onError:(s,n)=>(I(null),s.cause&&typeof s.cause=="object"&&"code"in s.cause&&s.cause.code===1?A.success(`Operation ${n.operation.name} cancelled successfully`):A.error(e.jsx(z,{error:s,message:"Error cancelling operation"})))});R.useEffect(()=>{g("")},[p]);const S=p==="approvals",ha=x==="all"?ca?.operations??[]:[],fa=r!=null&&U.data?.user?.organizations?.[r.name]==="admin",ga=M?.pages.flatMap(s=>s.operations)??[],J=[...ha.map(s=>({kind:"admin",sortTime:s.operation.create_time?new Date(s.operation.create_time).getTime():0,operation:s})),...ga.map(s=>({kind:"treasury",sortTime:s._unparsed.create_time?new Date(s._unparsed.create_time).getTime():0,operation:s}))].sort((s,n)=>n.sortTime-s.sortTime),ja=!c&&x==="all"?S?"No admin operations need a
1pproval":"No admin operation history":S?"No operations need approval":"No operation history";function ge(s){a({to:".",search:n=>({...n,search:s})})}function ba(s){a({to:".",search:n=>({...n,tab:s,pageToken:void 0}),replace:!0})}const Q=Ha({tabs:ks,activeTab:p,onTabChange:ba});function je(s){a({to:".",search:n=>({...n,type:s})})}function W(){j.current&&(j.current.value="",ge(""))}function be(s){const n=w(s);return(fe??[]).find(N=>{const L=w(N.id),H=w(N.name),u=w(N.ssoSubject);return N.name===s||N.id===s||N.ssoSubject===s||`users/${N.id}`===s||`users/${N.ssoSubject}`===s||L===n||H===n||u===n})}function ve(s,n){return n?.matchedAdminUser?.email??n?.matchedAdminUser?.displayName??G(s)}const va=s=>s?"inline-flex items-center border-b-2 border-primary px-1 py-2.5 text-sm font-medium text-foreground sm:py-3":"inline-flex items-center border-b-2 border-transparent px-1 py-2.5 text-sm font-medium text-muted-foreground hover:border-border hover:text-foreground sm:py-3";return e.jsxs("main",{className:"flex min-w-0 touch-pan-y flex-col space-y-4 overflow-x-hidden",...Q.getSwipeHandlers(),children:[e.jsx("div",{className:"border-b",children:e.jsx("nav",{className:"-mb-px flex items-center gap-2 sm:gap-5",children:na.map(s=>e.jsxs("button",{type:"button",onClick:()=>Q.switchTab(s.id),className:va(p===s.id),children:[e.jsx(s.icon,{className:"mr-1.5 size-3.5"}),s.label]},s.id))})}),e.jsxs("div",{ref:Q.contentRef,className:"space-y-4 will-change-transform",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("h1",{className:"max-w-[300px] truncate text-2xl font-medium",children:S?"Approvals":"History"}),e.jsx("h2",{className:"text-sm text-muted-foreground",children:S?"Review, approve, or reject operations that require manual authorization due to access or transfer rule restrictions":"Review operations that have already left the approval queue"})]}),e.jsxs("div",{className:"flex w-full items-center gap-2",children:[e.jsxs("div",{className:"relative min-w-0 flex-1",children:[e.jsx(Va,{ref:j,placeholder:"Search",defaultValue:l,onChange:s=>ge(s.target.value),className:"min-w-0 pr-8"}),l&&e.jsxs(C,{variant:"ghost",size:"icon",className:"absolute right-1 top-1/2 size-7 -translate-y-1/2",onClick:W,children:[e.jsx(Ne,{className:"size-4"}),e.jsx("span",{className:"sr-only",children:"Clear search"})]})]}),e.jsxs(Ae,{children:[e.jsx(ye,{asChild:!0,children:e.jsxs(C,{variant:"outline",size:"sm",className:"h-8 shrink-0 px-2 sm:h-9 sm:px-3",children:[Ts(x),e.jsx("span",{className:"hidden sm:inline",children:le.find(s=>s.id===x)?.label??"All"})]})}),e.jsx(we,{align:"end",children:le.map(s=>e.jsxs(B,{onClick:()=>je(s.id),children:[s.label,e.jsx(q,{children:e.jsx(s.icon,{})})]},s.id))})]}),e.jsxs(Ae,{children:[e.jsx(ye,{asChild:!0,children:e.jsxs(C,{variant:"outline",size:"icon",className:"size-8 shrink-0 sm:size-9",children:[e.jsx(Ba,{className:"size-4"}),e.jsx("span",{className:"sr-only",children:"Approval settings"})]})}),e.jsxs(we,{align:"end",className:"w-40",children:[e.jsx(ae,{children:"Filtering"}),e.jsxs(se,{children:[e.jsxs(B,{onClick:W,children:["Clear search",e.jsx(q,{children:e.jsx(xs,{})})]}),e.jsxs(B,{onClick:()=>{je("all"),W()},children:["Reset all",e.jsx(q,{children:e.jsx(hs,{})})]})]}),e.jsx(Ie,{}),e.jsx(ae,{children:"Data"}),e.jsx(se,{children:e.jsxs(B,{onClick:()=>xe(),children:["Refresh",e.jsx(q,{children:e.jsx(qa,{})})]})}),e.jsx(Ie,{}),e.jsx(ae,{children:"View config"}),e.jsxs(se,{children:[e.jsxs(Ga,{children:[e.jsx(Ya,{children:"Items per page"}),e.jsx(Ka,{children:e.jsxs(Xa,{children:[_e.map(s=>e.jsx(ne,{checked:s===m,onCheckedChange:()=>E(s),children:s},s)),!_e.includes(m)&&e.jsx(ne,{checked:!0,disabled:!0,children:m})]})})]}),e.jsxs(te,{children:[e.jsx(oe,{asChild:!0,children:e.jsx(ne,{checked:D,indicatorSide:"right",onCheckedChange:v,children:"Auto-load"})}),e.jsx(ie,{children:"Automatically load more data when scrolling to the bottom of the list"})]})]})]})]}),e.jsx(Za,{className:"size-8 shrink-0 sm:size-9",onRefresh:()=>Promise.all([xe(),da()]),disabled:Z,spinning:Z})]}),he?e.jsx(z,{coloredText:!0,error:he,message:"Failed to load admin approvals"}):null,c?null:e.jsx("div",{className:"rounded-lg border bg-card p-4 text-card-foreground shadow-sm",children:e.jsxs("div",{className:"space-y-1",children:[e.jsx("h3",{className:"text-sm font-semibold",children:"No Treasury Selected"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Admin approvals still appear here. Select a treasury in the global picker to also review treasury approvals."})]})}),$||la&&J.length===0?[1,2,3].map(s=>e.jsx(Ja,{className:"h-16 w-full"},s)):F?e.jsx(z,{coloredText:!0,error:F,message:"Failed to load approvals"}):J.length?e.jsx(Rs,{type:"single",collapsible:!0,value:h,onValueChange:s=>g(s),children:J.map(s=>{if(s.kind==="admin"){const u=s.operation;return e.jsx(Ls,{operation:{...u,signoffUserIds:u.operation.signoffs?.map(f=>f.user).filter(f=>!!f)??[]},currentUserId:t?.id,isAdminInSelectedOrganization:!!fa,canAct:S,showState:!S,allowedCredentialIdsHex:ma},u.name)}const n=s.operation,N=ts(n),L=Us({currentUserId:t?.id,usersData:fe,initiator:n.content.initiator,approvers:n.
1content.approvers}),H=S&&n.state==="authorizing";return e.jsxs(aa,{value:n.name,className:"border-0",children:[e.jsxs(os,{operation:n,className:"my-2 flex w-full cursor-pointer flex-row items-center justify-between px-3 py-3",onClick:u=>{ra(u.target)||g(f=>f===n.name?"":n.name)},children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2 pr-2",children:[e.jsx(Ms,{operation:n,layout:N}),e.jsxs("div",{className:"flex min-w-0 flex-col gap-1",children:[(()=>{const u=us(n),f=ms(n),T=n.title.resource.id,ee=T?f?e.jsx("a",{href:f,className:"underline hover:text-foreground",children:T}):e.jsx(e.Fragment,{children:T}):null;return e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsxs("p",{className:"truncate",children:[e.jsx("span",{className:He(n.title.action),children:n.title.action})," ",e.jsx("strong",{children:n.title.resource.name}),ee?e.jsxs(e.Fragment,{children:[" ",ee]}):null,!ee&&u?` ${u}`:""]}),S?null:e.jsx(ta,{state:n.state,errorStatus:n._unparsed.error?.status})]})})(),e.jsxs("p",{className:"truncate text-xs text-muted-foreground",children:[e.jsx(Le,{dateData:n.title.time,className:"hidden xs:inline"}),e.jsx("span",{className:"hidden px-1 xs:inline",children:"-"}),e.jsx(re,{to:"/approvals/$",params:{_splat:n.name},search:{tab:p},className:"hidden hover:underline sm:inline",children:n.name}),e.jsx("span",{className:"inline sm:hidden",children:n.title.id})]})]})]}),e.jsxs("div",{className:"flex gap-1 px-2 sm:gap-2",children:[e.jsx(C,{variant:"ghost",size:"icon",className:"size-7 text-muted-foreground",onClick:u=>{u.stopPropagation(),g(f=>f===n.name?"":n.name)},title:h===n.name?"Collapse":"Expand",children:e.jsx(Ue,{className:_("size-4 transition-transform",h===n.name&&"rotate-180")})}),e.jsx(re,{to:"/approvals/$",params:{_splat:n.name},search:{tab:p},onClick:u=>u.stopPropagation(),children:e.jsx(C,{variant:"secondary",size:"sm",className:"h-7",children:e.jsx("span",{children:"View"})})}),H?e.jsxs(C,{variant:"destructive",size:"sm",className:"h-7",disabled:d!==null||O!==null,onClick:u=>{u.stopPropagation(),I(n.name),xa({operation:n._unparsed})},title:"Cancel",children:[O===n.name?e.jsx(Se,{className:"size-4 animate-spin"}):e.jsx(Ne,{}),e.jsx("span",{className:"hidden sm:inline",children:"Cancel"})]}):null]})]}),e.jsxs(sa,{className:"mb-2",children:[e.jsx($s,{operation:n,layout:N}),e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row",children:[e.jsx("div",{className:"flex flex-1 items-center gap-2 p-2",children:(()=>{const u=be(n.content.initiator),f=ve(n.content.initiator,u);return e.jsxs(e.Fragment,{children:[e.jsxs(Re,{className:"size-7",children:[e.jsx(Oe,{src:u?.matchedAdminUser?.imageUrl}),e.jsx(ke,{children:f.charAt(0).toUpperCase()})]}),e.jsx(Te,{text:f,to:"/team/users/$userId",params:{userId:G(n.content.initiator)}})]})})()}),e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1 p-2",children:[e.jsx("h4",{className:"truncate pr-2 text-sm",children:"Approved by"}),n.content.approvers.length>0?e.jsx("ul",{className:"flex flex-col gap-2 truncate",children:n.content.approvers.map(u=>{const f=be(u),T=ve(u,f);return e.jsxs("li",{className:"flex items-center gap-2 truncate",children:[e.jsxs(Re,{className:"size-7",children:[e.jsx(Oe,{src:f?.matchedAdminUser?.imageUrl}),e.jsx(ke,{children:T.charAt(0).toUpperCase()})]}),e.jsx(Te,{text:T,to:"/team/users/$userId",params:{userId:G(u)}})]},u)})}):e.jsx("p",{className:"text-sm text-muted-foreground",children:"No one yet"})]})]}),e.jsxs("div",{className:_("flex items-center gap-2 px-2 pt-1",H?"justify-between":"justify-start"),children:[e.jsx(re,{to:"/treasury/operations/$",params:{_splat:n.name},search:{source:"approvals",tab:p},children:e.jsx(C,{variant:"link",size:"sm",className:"text-xs text-foreground",children:"View raw operation"})}),H?e.jsx("span",{title:L??void 0,children:e.jsxs(C,{variant:"default",size:"sm",className:"h-8 bg-emerald-600 text-white hover:bg-emerald-500",disabled:d!==null||O!==null||!!L,onClick:()=>{P(n.name),pa({operation:n._unparsed})},title:L??"Approve",children:[d===n.name?e.jsx(Se,{className:"size-4 animate-spin"}):e.jsx($e,{}),e.jsx("span",{children:"Approve"})]})}):null]})]})]},n.name)})}):e.jsx("p",{className:"text-sm text-muted-foreground",children:ja}),e.jsx(rs,{hasNextPage:ia,isFetching:Z,fetchNextPage:oa,autofetch:D})]})]})}export{sn as component};

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.