import{Eu as e,Fn as t,Pd as n,Zn as r,ir as i,mc as a,pc as o,zd as s}from"./index-Q5R6-AeA.js";var c=s(n(),1),l=e(),u=({subCommentaryData:e,dataRow:n})=>{let[o,s]=(0,c.useState)(!1),u=e.map(e=>r(a,e));return(0,l.jsxs)(l.Fragment,{children:[n((0,l.jsx)(t,{toggleExpansion:s,isExpanded:o})),o&&(0,l.jsx)(`tr`,{children:(0,l.jsx)(`td`,{colSpan:99,children:(0,l.jsxs)(i,{striped:!0,highlightOnHover:!0,className:`ml-8 w-full h-full`,children:[(0,l.jsx)(`thead`,{children:(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`th`,{children:`Entity`}),(0,l.jsx)(`th`,{children:`Amount`})]})}),(0,l.jsxs)(`tbody`,{children:[u?.sort((e,t)=>e.financialEntity.name.localeCompare(t.financialEntity.name)).map(e=>(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`td`,{children:e.financialEntity.name}),(0,l.jsx)(`td`,{children:e.amount.formatted})]},e.financialEntity.id)),(0,l.jsx)(`tr`,{children:(0,l.jsx)(`td`,{colSpan:8})})]})]})})})]})},d=({commentaryData:e,dataRow:n})=>{let[a,s]=(0,c.useState)(!1),{records:d}=r(o,e);return(0,l.jsxs)(l.Fragment,{children:[n(d.length?(0,l.jsx)(t,{toggleExpansion:s,isExpanded:a}):null),a&&(0,l.jsx)(`tr`,{children:(0,l.jsx)(`td`,{colSpan:99,children:(0,l.jsxs)(i,{striped:!0,highlightOnHover:!0,className:`ml-8 w-full h-full`,children:[(0,l.jsx)(`thead`,{children:(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`th`,{children:`Sort Code`}),(0,l.jsx)(`th`,{children:`Amount`}),(0,l.jsx)(`th`,{})]})}),(0,l.jsxs)(`tbody`,{children:[d?.sort((e,t)=>e.sortCode.key-t.sortCode.key).map(e=>(0,l.jsx)(u,{dataRow:t=>(0,l.jsxs)(`tr`,{children:[(0,l.jsxs)(`td`,{children:[e.sortCode.key,` - `,e.sortCode.name]}),(0,l.jsx)(`td`,{children:e.amount.formatted}),(0,l.jsx)(`td`,{children:t})]},e.sortCode.key),subCommentaryData:e.records},e.sortCode.key)),(0,l.jsx)(`tr`,{children:(0,l.jsx)(`td`,{colSpan:8})})]})]})})})]})};export{d as t};