"use client";
import{a as B}from"./chunk-W4XUJVWF.js";import{d as T,e as M}from"./chunk-CLTGASR6.js";import{a as E,d as k,m as p}from"./chunk-3CHPBNY2.js";import{v as A}from"./chunk-KEPQUAOX.js";import{forwardRef as ue}from"react";import Te from"clsx";import{forwardRef as Q}from"react";import X from"clsx";var J=E("EulTable",["alignLeft","alignRight","alignCenter","root","tableBody","tableCell","tableCellHead","tableHeader","tableRow","clickable","sortLabel","noPadding","sortActive","sortedAsc","sortedDesc","sticky","stickyLeft","stickyRight","firstStickyRight","lastStickyLeft"]),s=t=>M("EulTable",{root:["root",t?.noPadding&&"noPadding"],sortLabel:["sortLabel",t?.active&&"sortActive",t?.direction&&`sorted${k(t.direction)}`],tableBody:["tableBody"],tableCell:[t?.clickable&&"clickable",t?.align&&`align${k(t.align)}`,t?.sticky&&"sticky",t?.sticky&&typeof t.right>"u"&&"stickyLeft",t?.sticky&&typeof t.right<"u"&&typeof t.left>"u"&&"stickyRight"],tableCellBody:["tableCell"],tableCellHead:["tableCellHead"],tableHeader:["tableHeader"],tableRow:["tableRow",t?.clickable&&"clickable"]}),o=J;import{css as W}from"@emotion/react";var D=p("div")(({theme:t})=>W`
    display: none;
    width: 0;
    height: 0;
    color: ${t.palette.background[700]};
    border-right: 4px solid transparent;
    border-bottom: 5px solid currentColor;
    border-left: 4px solid transparent;

    .${o.sortLabel}.${o.sortActive} &,
    .${o.sortLabel}:hover & {
      display: block;
    }

    .${o.sortLabel}.${o.sortActive} & {
      color: ${t.palette.background[900]};
    }

    .${o.alignRight} & {
      order: -1;
    }

    .${o.sortedDesc}.${o.sortActive} & {
      border-top: 5px solid currentColor;
      border-bottom: 0;
    }
  `),I=p("button")(({theme:t})=>W`
    position: relative;
    display: flex;
    flex: 1;
    gap: ${t.spacing(3)};
    align-items: center;
    justify-content: inherit;
    width: 100%;
    color: inherit;
    background-color: transparent;
    border: none;
    cursor: pointer;
  `);import{jsx as Z,jsxs as _}from"react/jsx-runtime";var v=Q(({active:t,children:l,className:r,direction:a,...e},i)=>{let b=s({active:t,direction:a});return _(I,{...e,className:X(r,b.sortLabel),ref:i,children:[l,Z(D,{})]})});v.displayName="SortLabel";v.defaultProps={active:!1,direction:"asc"};var h=v;import{forwardRef as le,useContext as ae}from"react";import ie from"clsx";import{createContext as j}from"react";var ee=`${B.MissingProvider}: <TableSlot.Provider>`,te=j({get variant(){throw new Error(ee)}}),g=te;import{css as oe}from"@emotion/react";var c=t=>t.palette.background[500],z=p("div",{shouldForwardProp:t=>!["minWidth","width","colSpan","left","right"].includes(String(t))})(({colSpan:t,left:l,minWidth:r,right:a,theme:e,width:i})=>oe`
    position: relative;
    display: flex;
    flex: 1;
    flex-basis: ${i&&`${i}px`};
    flex-grow: ${t};
    gap: ${e.spacing(3)};
    align-items: center;
    min-width: ${r&&`${r}px`};
    max-width: ${i&&`${i}px`};
    padding: ${e.spacing(4)};
    color: ${e.palette.background[1e3]};

    .${o.noPadding} & {
      padding: ${e.spacing(3,0)};
    }

    &.${o.alignRight} {
      justify-content: flex-end;
    }

    &.${o.alignCenter} {
      justify-content: center;
    }

    &.${o.clickable} {
      cursor: pointer;
    }

    &.${o.sticky} {
      position: sticky;
      z-index: 1;
    }

    &.${o.stickyRight} {
      right: ${a||0}px;
    }

    &.${o.stickyLeft} {
      left: ${l||0}px;
    }

    &.${o.lastStickyLeft} {
      box-shadow: inset -1px 0 0 0 ${e.palette.background[600]};
    }

    &.${o.firstStickyRight} {
      box-shadow: inset 1px 0 0 0 ${e.palette.background[600]};
    }

    &.${o.tableCell} {
      font-size: ${e.typography.body1.fontSize};
      line-height: ${e.typography.body1.lineHeight};
      background: ${e.palette.background[500]};

      &:before {
        position: absolute;
        top: 0;
        left: 0;
        z-index: 0;
        width: 100%;
        height: 100%;
        background: ${A(e.palette.common.white,.02)};
        opacity: 0;
        transition: ${e.transitions.create("opacity")};
        content: "";
      }

      &:first-of-type {
        padding-left: ${e.spacing(8)};
        border-left: 1px solid ${c(e)};
      }

      &:last-of-type {
        padding-right: ${e.spacing(8)};
        border-right: 1px solid ${c(e)};
      }

      [role="row"].${o.clickable}:hover & {
        &:before {
          opacity: 1;
        }
      }

      [role="row"]:last-of-type & {
        border-bottom: 1px solid ${c(e)};

        &:first-of-type,
        &:first-of-type:before {
          border-bottom-left-radius: ${e.spacing(3)};
        }

        &:last-of-type,
        &:last-of-type:before {
          border-bottom-right-radius: ${e.spacing(3)};
        }
      }
    }

    &.${o.tableCellHead} {
      padding: ${e.spacing(3,4)};
      color: ${e.palette.background[900]};
      font-weight: ${e.typography.fontWeightRegular};
      font-size: ${e.typography.body2.fontSize};
      line-height: ${e.typography.body2.lineHeight};
      background: ${e.palette.background[400]};
      border: 1px solid ${c(e)};
      border-width: 1px 0 0;

      &:before {
        position: absolute;
        top: 50%;
        right: 1px;
        width: 1px;
        height: ${e.spacing(4)};
        background-color: ${e.palette.background[500]};
        transform: translateY(-50%);
        content: "";
      }

      &:last-of-type:before,
      &.${o.lastStickyLeft}:before, &.${o.firstStickyRight}:before {
        opacity: 0;
      }

      &:first-of-type {
        padding-left: ${e.spacing(8)};

        &,
        &:before {
          border-left: 1px solid ${c(e)};
          border-top-left-radius: ${e.spacing(3)};
        }
      }

      &:last-of-type {
        padding-right: ${e.spacing(8)};

        &,
        &:before {
          border-right: 1px solid ${c(e)};
          border-top-right-radius: ${e.spacing(3)};
        }
      }
    }
  `);import{jsx as se}from"react/jsx-runtime";var w=le(({align:t,children:l,className:r,colSpan:a,left:e,minWidth:i,onClick:b,right:f,sticky:y,width:d,...n},m)=>{let u=T(n),{variant:N}=ae(g),S=s({align:t,clickable:!!b,left:e,right:f,sticky:y});return e&&f&&console.warn("TableCell: left and right props are mutually exclusive. Please use only one."),se(z,{...u,className:ie(r,S.tableCell,N==="body"?S.tableCellBody:S.tableCellHead),colSpan:a,left:e,minWidth:i,onClick:b,ref:m,right:f,role:N==="body"?"cell":"columnheader",width:d,children:l})});w.displayName="TableCell";w.defaultProps={align:"left"};var L=w;import{Children as O,cloneElement as ne,forwardRef as pe,isValidElement as U,useMemo as de}from"react";import{Slot as be}from"@radix-ui/react-slot";import F from"clsx";import{jsx as ce}from"react/jsx-runtime";var V=pe(({asChild:t,children:l,className:r,onClick:a,...e},i)=>{let b=s({clickable:!!a||!!t}),f=t?be:"div",y=de(()=>O.toArray(l).reduce((n,m,u)=>(U(m)&&m.props.sticky&&(typeof m.props.right>"u"?n.lastLeftIndex=u:n.firstRightIndex===-1&&(n.firstRightIndex=u)),n),{firstRightIndex:-1,lastLeftIndex:-1}),[l]);return ce(f,{...e,className:F(r,b.tableRow),onClick:a,ref:i,role:"row",children:O.map(l,(d,n)=>U(d)?ne(d,{className:F(d.props.className,{[o.firstStickyRight]:n===y.firstRightIndex,[o.lastStickyLeft]:n===y.lastLeftIndex})}):d)})});V.displayName="TableRow";var R=V;import{forwardRef as P}from"react";import me from"clsx";var Y=p("div")({display:"flex",flexDirection:"column",[`&.${o.tableBody}`]:{gap:1}});import{jsx as x}from"react/jsx-runtime";var H=P(({children:t,className:l,variant:r,...a},e)=>{let i=s();return x(g.Provider,{value:{variant:r},children:x(Y,{...a,className:me(l,r==="body"?i.tableBody:i.tableHeader),ref:e,role:"rowgroup",children:t})})});H.displayName="TableSlot";var $=P(({children:t,className:l,...r},a)=>x(H,{...r,className:l,ref:a,variant:"body",children:t}));$.displayName="TableBody";var C=P(({children:t,className:l,...r},a)=>x(H,{...r,className:l,ref:a,variant:"header",children:t}));C.displayName="TableHeader";import{css as ge}from"@emotion/react";var q=p("div")(()=>ge`
    width: 100%;

    & .${o.tableRow} {
      position: relative;
      display: flex;
      align-items: stretch;
      text-decoration: none;

      &.${o.clickable} {
        cursor: pointer;
      }
    }
  `);import{jsx as Ce}from"react/jsx-runtime";var G=ue(({children:t,className:l,...r},a)=>{let e=T(r),i=s({noPadding:r.noPadding});return Ce(q,{...e,className:Te(i.root,l),ref:a,role:"table",children:t})});G.displayName="Table";var xe=Object.assign(G,{Body:$,Cell:L,Header:C,Row:R,SortLabel:h}),$e=xe;export{o as a,$e as b};
