import{i as e}from"./chunk-aKtaBQYM.js";import{Vt as t,wt as n}from"./mui-B6lh3XSP.js";import{n as r}from"./MenuItem-HQNtf0LG.js";import{n as i,t as a}from"./SearchHeader-CmohWzoP.js";import{t as o}from"./TableHead-_KJlbpnj.js";import{At as s,Dt as c,Ot as l,_t as u,pt as d,w as f,wt as p,yt as m}from"./index-KVuxnkWj.js";import{t as h}from"./CollectionActions-CDxOJIb6.js";import{t as g}from"./TableShimmer-f7Cf4NTV.js";import{n as _,t as v}from"./useSettingsStyles-X3caKosH.js";var y=e(t(),1),b=n(),x=()=>{let{classes:e}=v(),t=m(),[n,x]=(0,y.useReducer)(e=>e+1,0),[S,C]=(0,y.useState)([]),[w,T]=(0,y.useState)(``),[E,D]=(0,y.useState)(!0),O=(0,y.useCallback)(async(e,t)=>{let n=new URLSearchParams({limit:50,offset:e});w&&n.append(`keyword`,w);let r=await(await f(`/api/drivers?${n.toString()}`,{signal:t})).json();C(t=>e?[...t,...r]:r),D(r.length>=50)},[w]),k=u(()=>O(S.length));return d(async({signal:e})=>{C([]),await O(0,e)},[n,O]),(0,b.jsxs)(r,{menu:(0,b.jsx)(_,{}),breadcrumbs:[`settingsTitle`,`sharedDrivers`],children:[(0,b.jsx)(a,{keyword:w,setKeyword:T}),(0,b.jsxs)(s,{className:e.table,children:[(0,b.jsx)(o,{children:(0,b.jsxs)(p,{children:[(0,b.jsx)(c,{children:t(`sharedName`)}),(0,b.jsx)(c,{children:t(`deviceIdentifier`)}),(0,b.jsx)(c,{className:e.columnAction})]})}),(0,b.jsxs)(l,{children:[S.map(t=>(0,b.jsxs)(p,{children:[(0,b.jsx)(c,{children:t.name}),(0,b.jsx)(c,{children:t.uniqueId}),(0,b.jsx)(c,{className:e.columnAction,padding:`none`,children:(0,b.jsx)(h,{itemId:t.id,editPath:`/settings/driver`,endpoint:`drivers`,onReload:x})})]},t.id)),E&&(0,b.jsx)(g,{ref:S.length>0?k:null,columns:3,endAction:!0})]})]}),(0,b.jsx)(i,{editPath:`/settings/driver`})]})};export{x as default};