"use strict";(self.webpackChunkunifiNetworkUi=self.webpackChunkunifiNetworkUi||[]).push([[93978],{87785(e,n,l){l.d(n,{A:()=>m});var t=l(274934),i=l(602086),s=l(605280),a=l(903736),o=l.n(a),r=l(247816),d=l(291508);const c=(0,r.A)("div",(0,d.A)("x","y","displayGrid","hideHorizontalScrollBar"))`
  position: relative;
  overflow: hidden;

  display: ${({displayGrid:e})=>e?"grid":"block"};

  > div {
    overflow-x: ${({x:e})=>e?"auto":"hidden"};
    overflow-y: ${({y:e})=>e?"auto":"hidden"};
    padding-right: ${({hideHorizontalScrollBar:e,x:n})=>e&&n?"10px":"0px"};
  }
`,u=(0,r.A)("div",(0,d.A)("top","right","bottom","left","darker"))`
  position: absolute;
  pointer-events: none;
  width: ${({top:e,bottom:n})=>e||n?"calc(100% - 36px)":"0"};
  height: ${({top:e,bottom:n})=>e||n?"0":"calc(100% - 36px)"};

  ${e=>{const n=["top","right","bottom","left"].find(n=>e[n]),l=["top","bottom"].includes(n)?"left":"top";return n?`\n      ${n}: 0;\n      ${l}: 18px;\n      box-shadow: 0 0 15px 15px ${o()(e.theme.motifPalette.uiBase).darken(e.darker?.1:0).alpha(.4).css()};\n    `:""}};
`,m=({children:e,className:n,darker:l,height:a,horizontal:o,hideHorizontalScrollBar:r=!1,vertical:d,width:m,displayGrid:h})=>{const A=(0,i.useRef)(null),[{top:f,right:g,bottom:p,left:b},x]=(0,i.useState)({}),E=(0,s.A)(()=>{if(A?.current){const{scrollLeft:e,scrollTop:n,offsetWidth:l,offsetHeight:t,scrollWidth:i,scrollHeight:s}=A.current;x({top:n>0,right:i>l+e,bottom:s>t+n,left:e>0})}},16);(0,i.useEffect)(()=>{const e=A.current;return e?.addEventListener("scroll",E),window.addEventListener("resize",E),E(),()=>{e?.removeEventListener("scroll",E),window.removeEventListener("resize",E)}},[A.current]);const C=d&&f?(0,t.jsx)(u,{top:!0,darker:l}):null,v=o&&g?(0,t.jsx)(u,{right:!0,darker:l}):null,M=d&&p?(0,t.jsx)(u,{bottom:!0,darker:l}):null,j=o&&b?(0,t.jsx)(u,{left:!0,darker:l}):null;return(0,t.jsxs)(c,{y:d,x:o,displayGrid:h,hideHorizontalScrollBar:r,style:{height:a,width:m},className:n,children:[(0,t.jsx)("div",{ref:A,style:{height:a,width:m},children:e}),C,v,M,j]})}},637731(e,n,l){l.d(n,{A:()=>o});var t=l(274934),i=l(602086),s=l(954702),a=l(470070);const o=(0,i.forwardRef)(({onRemove:e,...n},l)=>(0,t.jsx)(s.A,{...n,name:"table-manage-remove",onPress:e,type:"button",fontSize:"medium",variant:"destructive",ref:l,children:(0,t.jsx)(a.sA,{id:"COMMON_ACTION_REMOVE"})}))},762736(e,n,l){l.d(n,{A:()=>d});var t=l(274934),i=l(95032),s=l(100978),a=l(470070),o=l(256468),r=l(146215);const d=({children:e,onRemove:n,names:l,removeMessageId:d,message:c})=>(0,t.jsx)(r.A,{trigger:e,message:c??(0,t.jsx)(a.sA,{id:d||"COMMON_QUESTION_ARE_YOU_SURE_YOU_WANT_TO_REMOVE",values:{name:l.join('", "'),count:l.length>1?o.Uh.PLURAL:o.Uh.SINGLE}}),onConfirm:n,title:(0,t.jsx)(s.A,{maxWidth:300,overflow:"hidden",children:(0,t.jsx)(i.A,{isTruncated:!0,variant:"inherit",children:(0,t.jsx)(a.sA,{id:"COMMON_QUESTION_REMOVE",values:{name:l.join('", "')}})})})})},493978(e,n,l){l.d(n,{Ay:()=>D,MS:()=>L});var t=l(274934),i=l(602086),s=l(814557),a=l(977872),o=l(686050),r=l(792929),d=l(214829),c=l(849753),u=l(599110),m=l(558948),h=l(247816),A=l(263705),f=l(814328),g=l(833466),p=l(309130),b=l(87785),x=l(100978),E=l(869332),C=l(771927),v=l(470070),M=l(256468),j=l(547967),R=l(897166),w=l(202730),N=l(147045),O=l(409033),k=l(762736),S=l(637731);const y="table-with-manage-narrow-column",_=(0,h.A)(b.A)`
  .${y} {
    padding-left: ${p.YC};
  }
`;var I;!function(e){e.REMOVE="remove",e.PAUSE="pause",e.RESUME="resume",e.DRAG_AND_DROP="dragAndDrop",e.DUPLICATE="duplicate"}(I||(I={}));const T=e=>e?.name||"";function L(e,n){return async(l,t)=>{await n((0,c.be)(e,l,t),e[l])}}const D=function({footerContent:e,managingFooterContent:n,getName:l=T,isRemovable:c,removeItems:h,isPauseable:b,pauseItems:L,pauseMessage:D,removeMessage:U,isResumable:P,resumeItems:G,fetchFunctions:z=[],fetchQueries:$=[],forwardedRef:B,onRowClick:H,maxResumableItems:V,showEmptyTable:F,dragAndDrop:Q,onDrop:W,isTableInDragAndDropMode:Y,dragAndDropFetchFunctions:q=[],showDragAndDropHandles:J,setIsManageMode:K,alwaysShowManage:X,forceManageButtonEnabled:Z=!1,renderManageButton:ee,narrowLeftColumn:ne,renderRemoveAction:le,shouldConfirmRemove:te=!0,renderPauseAction:ie,renderResumeAction:se,hideManageButton:ae,rowReorderVariant:oe,duplicateItems:re,isDuplicable:de,...ce}){const{items:ue,idField:me,columns:he}=ce,{themeName:Ae}=(0,A.u)(),fe=(0,a.wA)(),[ge,pe]=(0,i.useState)(!1),[be,xe]=(0,i.useState)([]),[Ee,Ce]=(0,i.useState)(null),ve=(0,f.jE)(),Me=(0,O.R)(),je=(0,i.useCallback)(()=>{z.forEach(fe),$.forEach(e=>ve.invalidateQueries(e(Me)))},[fe,z,$,ve,Me]),Re=(0,i.useMemo)(()=>"function"==typeof he?he({isManaging:ge}):he,[he,ge]),we=(0,a.d4)(R.EL),Ne=(0,i.useMemo)(()=>![c,b,P,de].some(e=>e&&ue.some(e))&&!Z,[c,b,P,de,Z,ue]),Oe=!Ne&&!ae||!!e,ke=(0,i.useMemo)(()=>Ne?ue:ue.map(e=>{const n=e.children?.map(e=>[c,b,P].some(n=>n?.(e))?e:{...e,disabled:e.disabled||ge});return[c,b,P].some(n=>n?.(e))?{...e,children:n}:{...e,disabled:e.disabled||ge,children:n}}),[ge,ue,Ne,c,b,P]),Se=(0,i.useMemo)(()=>ue.filter(e=>be.includes(e[me||"id"])),[be,ue,me]),[ye,_e,Ie,Te]=(0,i.useMemo)(()=>{const e=P&&Se.filter(e=>e&&P(e))||[];return[Se.some(e=>e&&c(e)),!!b&&Se.some(e=>e&&b(e)),!!P&&(void 0!==V?e.length>0&&e.length<=V:e.length>0),!!de&&Se.every(e=>e&&de(e))]},[Se,b,P,V,c,de]),Le=(0,i.useCallback)(()=>{pe(!ge),K&&K(!ge),ge&&xe([])},[ge,K]),De=(0,i.useCallback)(()=>{const e=P?Se.filter(P):[];Ce(I.RESUME),G?.(e).finally(()=>{Ce(null),je()})},[P,Se,G,je]),Ue=(0,i.useCallback)(e=>{Ce(I.PAUSE),L?.(e).finally(()=>{Ce(null),je()})},[L,je]),Pe=(0,i.useCallback)(()=>{const e=b?Se.filter(b):[],n=e.map(l).filter(Boolean).join('", "');fe((0,C.E)({title:"SETTINGS_PAUSE_TITLE",titleValues:{name:n||null},message:D,messageValues:{name:n||null,count:Se.length>1?M.Uh.PLURAL:M.Uh.SINGLE},confirmButtonText:"COMMON_ACTION_PAUSE",onConfirm:()=>{fe((0,E.AS)()),Ue(e)}}))},[b,Se,l,fe,D,Ue]),Ge=(0,i.useCallback)(e=>(fe((0,E.AS)()),Ce(I.REMOVE),h(e).then(()=>{K?.(!1),pe(!1),xe([])}).finally(()=>{Ce(null),je()})),[fe,h,K,je]),ze=(0,i.useCallback)(()=>Ge(Se.filter(c)),[Se,c,Ge]),$e=(0,i.useCallback)((e,n)=>{ge?n?.target?.closest("tr")?.querySelector('input[type="checkbox"]')?.click():H?.(e)},[H,ge]),Be=(0,i.useCallback)(e=>{const n=e.active?.data?.current?.index,l=e.over?.data?.current?.index;(0,o.A)(n)||(0,o.A)(l)||(Ce(I.DRAG_AND_DROP),W?.(n+(ce.rowOffset??0),l+(ce.rowOffset??0)).finally(()=>{Ce(null),Y||((q||z).forEach(fe),$.forEach(e=>ve.invalidateQueries(e(Me))))}))},[W,ce.rowOffset,Y,q,z,fe,$,ve,Me]),He=(0,i.useCallback)(e=>(Ce(I.DUPLICATE),re?.(e).then(()=>{K?.(!1),pe(!1),xe([])}).finally(()=>{Ce(null),je()})),[re,K,je]),Ve=(0,i.useMemo)(()=>({name:"table-manage-"+(ge?"done":"manage"),size:"medium",type:"button",variant:"inline",disabled:(Ne&&!ge||Y)&&!Z,onClick:Le,children:(0,t.jsx)(v.sA,{id:ge?"COMMON_ACTION_DONE":"COMMON_ACTION_MANAGE"})}),[Ne,Z,Le,ge,Y]),Fe=(0,i.useCallback)((e,n)=>ce.cellClassName?"string"==typeof ce.cellClassName?ce.cellClassName:ce.cellClassName(e,n):ne&&n.id===Re?.[0]?.id?y:"",[Re,ne,ce]),Qe=!ae&&(!Ne&&ue.length>0||X||ge),We=ge?Ie||_e||ye:!!e;return(0,i.useEffect)(()=>{Ee||Y||Ce(null)},[Y,Ee]),(0,t.jsxs)(x.A,{flexDirection:"column",width:"100%",children:[0!==ue.length||F?(0,t.jsx)(_,{horizontal:!0,children:!ge&&Q?(0,t.jsx)(d.A,{...ce,cellClassName:Fe,columns:Re,disableColumnFilters:!0,disableSelection:!0,onRowClick:H,onDragEnd:Be,showHandles:J,truncateHeaderCells:!0,rowProps:()=>({...H&&{[N.L]:w.b.SIDE_PANEL_TRIGGER}}),..."dropzone"===oe?{rowReorderVariant:oe,placeHolderClassName:j.Rm}:{}}):(0,t.jsx)(r.A,{...ce,cellClassName:Fe,columns:Re,items:ke,multiSelectMode:ge,selectedIds:be,onChangeSelection:xe,disableSelection:!ge,onRowClick:$e,dragAndDrop:!1,truncateHeaderCells:!0,rowProps:()=>({[N.L]:w.b.SIDE_PANEL_TRIGGER})})}):null,Oe&&!we?(0,t.jsxs)(x.A,{marginTop:p.YC,alignItems:"center",gap:p.Ln,height:g.b,children:[We?(0,t.jsx)(x.A,{children:ge?(0,t.jsxs)(x.A,{gap:p.Ln,alignItems:"center",children:[Ie?(0,t.jsx)(x.A,{children:se&&P?se({pending:!!Ee,onResume:De,items:Se.filter(P)}):(0,t.jsx)(u.A,{name:"table-manage-resume",onClick:De,type:"button",size:"medium",variant:"inline",disabled:!!Ee,children:(0,t.jsx)(v.sA,{id:"COMMON_ACTION_RESUME"})})}):null,_e?(0,t.jsx)(x.A,{children:ie&&b?ie({pending:!!Ee,onPause:()=>Ue(Se.filter(b)),items:Se.filter(b)}):(0,t.jsx)(u.A,{name:"table-manage-pause",onClick:Pe,type:"button",size:"medium",variant:"inline",disabled:!!Ee,children:(0,t.jsx)(v.sA,{id:"COMMON_ACTION_PAUSE"})})}):null,ye?(0,t.jsx)(x.A,{children:le?le({pending:!!Ee,onRemove:()=>Ge(Se.filter(c)),items:Se.filter(c)}):te?(0,t.jsx)(k.A,{onRemove:ze,names:Se.filter(c).map(l).filter(Boolean),removeMessageId:U,children:(0,t.jsx)(S.A,{isPending:!!Ee})}):(0,t.jsx)(S.A,{isPending:!!Ee,onRemove:ze})}):null,Te?(0,t.jsx)(x.A,{children:(0,t.jsx)(u.A,{name:"table-manage-duplicate",onClick:()=>He(Se.filter(de)),type:"button",size:"medium",variant:"inline",disabled:!!Ee,children:(0,t.jsx)(v.sA,{id:"SETTINGS_DUPLICATE"})})}):null]}):e}):null,Qe&&We?(0,t.jsx)(m.A,{orientation:"vertical",style:{height:p.Ln},color:s.Ay[`desktop-color-neutral-03-${Ae}`]}):null,Qe?(0,t.jsx)(x.A,{children:ee?.({...Ve,isManaging:ge})||(0,t.jsx)(u.A,{type:"button",...Ve})}):null,Qe&&ge&&n?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(m.A,{orientation:"vertical",style:{height:p.Ln},color:s.Ay[`desktop-color-neutral-03-${Ae}`]}),n]}):null]}):null]})}}}]);