import{r as o}from"./index-BP8_t0zE.js";import{B as de}from"./Box-UI_bZnlM.js";import{w as me,L as ee,K as re,U as M,s as _,V as p,W as S,O as te,_ as ne,ad as ge,c as V,P as ae,b1 as ve,b2 as pe,b3 as U,af as be,aI as ye,a8 as he,r as Pe}from"./defaultI18nProvider-C_r1y4tu.js";import{g as _e,_ as y,j}from"./assertThisInitialized-ClXgY4BW.js";import{u as Oe}from"./hooks-kyAPvxe4.js";import{L as xe}from"./index-qEiLzbkV.js";import{T as Ce}from"./Typography-E7d16C50.js";import{S as ke}from"./Stack-BmeOikgJ.js";import{u as Re,a as Le,C as $e}from"./Chip-4IhPI0f3.js";import{u as oe,R as W}from"./useRecordContext-CmNI-aHo.js";import{u as ie}from"./useResourceContext-BI9mATY-.js";import{u as je}from"./useGetRecordRepresentation-DwGaoA_n.js";import{b as Ne,s as Ee,L as Fe,a as we}from"./ListNoResults-BHi6V5m8.js";import{R as Be}from"./ResourceContextProvider-_t2ysSg2.js";var Ie=function(e){var r=oe(e),t=ie(e),n=je(t);return o.createElement(o.Fragment,null,n(r))},N=function(){return N=Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++){r=arguments[t];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},N.apply(this,arguments)},Ae=function(e,r){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,n=Object.getOwnPropertySymbols(e);a<n.length;a++)r.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(t[n[a]]=e[n[a]]);return t},De=[],Te={},Me=function(e){var r=e.filter,t=r===void 0?Te:r,n=e.page,a=n===void 0?1:n,i=e.perPage,s=i===void 0?1e3:i,u=e.record,l=e.reference,h=e.sort,f=e.source,c=e.queryOptions,d=c===void 0?{}:c,b=me(),g=_e(u,f),m=d.meta,$=Ae(d,["meta"]),P=Array.isArray(g)?g:De,v=Re(l,{ids:P,meta:m},N({onError:function(x){return b(typeof x=="string"?x:x.message||"ra.notification.http_error",{type:"error",messageArgs:{_:typeof x=="string"?x:x&&x.message?x.message:void 0}})}},$)),O=v.data,C=v.error,R=v.isLoading,F=v.isFetching,E=v.isPending,w=v.refetch,k=Le({data:O,error:C,filter:t,isFetching:F,isLoading:R,isPending:E,page:a,perPage:s,sort:h});return N(N({},k),{defaultTitle:void 0,refetch:w,resource:l})};function Se(e){return ee("MuiLinearProgress",e)}re("MuiLinearProgress",["root","colorPrimary","colorSecondary","determinate","indeterminate","buffer","query","dashed","dashedColorPrimary","dashedColorSecondary","bar","barColorPrimary","barColorSecondary","bar1Indeterminate","bar1Determinate","bar1Buffer","bar2Indeterminate","bar2Buffer"]);const Ve=["className","color","value","valueBuffer","variant"];let L=e=>e,X,K,H,G,Q,J;const B=4,qe=M(X||(X=L`
  0% {
    left: -35%;
    right: 100%;
  }

  60% {
    left: 100%;
    right: -90%;
  }

  100% {
    left: 100%;
    right: -90%;
  }
`)),ze=M(K||(K=L`
  0% {
    left: -200%;
    right: 100%;
  }

  60% {
    left: 107%;
    right: -8%;
  }

  100% {
    left: 107%;
    right: -8%;
  }
`)),Ue=M(H||(H=L`
  0% {
    opacity: 1;
    background-position: 0 -23px;
  }

  60% {
    opacity: 0;
    background-position: 0 -23px;
  }

  100% {
    opacity: 1;
    background-position: -200px -23px;
  }
`)),We=e=>{const{classes:r,variant:t,color:n}=e,a={root:["root",`color${p(n)}`,t],dashed:["dashed",`dashedColor${p(n)}`],bar1:["bar",`barColor${p(n)}`,(t==="indeterminate"||t==="query")&&"bar1Indeterminate",t==="determinate"&&"bar1Determinate",t==="buffer"&&"bar1Buffer"],bar2:["bar",t!=="buffer"&&`barColor${p(n)}`,t==="buffer"&&`color${p(n)}`,(t==="indeterminate"||t==="query")&&"bar2Indeterminate",t==="buffer"&&"bar2Buffer"]};return ae(a,Se,r)},q=(e,r)=>r==="inherit"?"currentColor":e.vars?e.vars.palette.LinearProgress[`${r}Bg`]:e.palette.mode==="light"?ve(e.palette[r].main,.62):pe(e.palette[r].main,.5),Xe=_("span",{name:"MuiLinearProgress",slot:"Root",overridesResolver:(e,r)=>{const{ownerState:t}=e;return[r.root,r[`color${p(t.color)}`],r[t.variant]]}})(({ownerState:e,theme:r})=>y({position:"relative",overflow:"hidden",display:"block",height:4,zIndex:0,"@media print":{colorAdjust:"exact"},backgroundColor:q(r,e.color)},e.color==="inherit"&&e.variant!=="buffer"&&{backgroundColor:"none","&::before":{content:'""',position:"absolute",left:0,top:0,right:0,bottom:0,backgroundColor:"currentColor",opacity:.3}},e.variant==="buffer"&&{backgroundColor:"transparent"},e.variant==="query"&&{transform:"rotate(180deg)"})),Ke=_("span",{name:"MuiLinearProgress",slot:"Dashed",overridesResolver:(e,r)=>{const{ownerState:t}=e;return[r.dashed,r[`dashedColor${p(t.color)}`]]}})(({ownerState:e,theme:r})=>{const t=q(r,e.color);return y({position:"absolute",marginTop:0,height:"100%",width:"100%"},e.color==="inherit"&&{opacity:.3},{backgroundImage:`radial-gradient(${t} 0%, ${t} 16%, transparent 42%)`,backgroundSize:"10px 10px",backgroundPosition:"0 -23px"})},S(G||(G=L`
    animation: ${0} 3s infinite linear;
  `),Ue)),He=_("span",{name:"MuiLinearProgress",slot:"Bar1",overridesResolver:(e,r)=>{const{ownerState:t}=e;return[r.bar,r[`barColor${p(t.color)}`],(t.variant==="indeterminate"||t.variant==="query")&&r.bar1Indeterminate,t.variant==="determinate"&&r.bar1Determinate,t.variant==="buffer"&&r.bar1Buffer]}})(({ownerState:e,theme:r})=>y({width:"100%",position:"absolute",left:0,bottom:0,top:0,transition:"transform 0.2s linear",transformOrigin:"left",backgroundColor:e.color==="inherit"?"currentColor":(r.vars||r).palette[e.color].main},e.variant==="determinate"&&{transition:`transform .${B}s linear`},e.variant==="buffer"&&{zIndex:1,transition:`transform .${B}s linear`}),({ownerState:e})=>(e.variant==="indeterminate"||e.variant==="query")&&S(Q||(Q=L`
      width: auto;
      animation: ${0} 2.1s cubic-bezier(0.65, 0.815, 0.735, 0.395) infinite;
    `),qe)),Ge=_("span",{name:"MuiLinearProgress",slot:"Bar2",overridesResolver:(e,r)=>{const{ownerState:t}=e;return[r.bar,r[`barColor${p(t.color)}`],(t.variant==="indeterminate"||t.variant==="query")&&r.bar2Indeterminate,t.variant==="buffer"&&r.bar2Buffer]}})(({ownerState:e,theme:r})=>y({width:"100%",position:"absolute",left:0,bottom:0,top:0,transition:"transform 0.2s linear",transformOrigin:"left"},e.variant!=="buffer"&&{backgroundColor:e.color==="inherit"?"currentColor":(r.vars||r).palette[e.color].main},e.color==="inherit"&&{opacity:.3},e.variant==="buffer"&&{backgroundColor:q(r,e.color),transition:`transform .${B}s linear`}),({ownerState:e})=>(e.variant==="indeterminate"||e.variant==="query")&&S(J||(J=L`
      width: auto;
      animation: ${0} 2.1s cubic-bezier(0.165, 0.84, 0.44, 1) 1.15s infinite;
    `),ze)),Qe=o.forwardRef(function(r,t){const n=te({props:r,name:"MuiLinearProgress"}),{className:a,color:i="primary",value:s,valueBuffer:u,variant:l="indeterminate"}=n,h=ne(n,Ve),f=y({},n,{color:i,variant:l}),c=We(f),d=ge(),b={},g={bar1:{},bar2:{}};if((l==="determinate"||l==="buffer")&&s!==void 0){b["aria-valuenow"]=Math.round(s),b["aria-valuemin"]=0,b["aria-valuemax"]=100;let m=s-100;d&&(m=-m),g.bar1.transform=`translateX(${m}%)`}if(l==="buffer"&&u!==void 0){let m=(u||0)-100;d&&(m=-m),g.bar2.transform=`translateX(${m}%)`}return j.jsxs(Xe,y({className:V(c.root,a),ownerState:f,role:"progressbar"},b,{ref:t},h,{children:[l==="buffer"?j.jsx(Ke,{className:c.dashed,ownerState:f}):null,j.jsx(He,{className:c.bar1,ownerState:f,style:g.bar1}),l==="determinate"?null:j.jsx(Ge,{className:c.bar2,ownerState:f,style:g.bar2})]}))});function Je(e){return ee("MuiLink",e)}const Ye=re("MuiLink",["root","underlineNone","underlineHover","underlineAlways","button","focusVisible"]),se={primary:"primary.main",textPrimary:"text.primary",secondary:"secondary.main",textSecondary:"text.secondary",error:"error.main"},Ze=e=>se[e]||e,er=({theme:e,ownerState:r})=>{const t=Ze(r.color),n=U(e,`palette.${t}`,!1)||r.color,a=U(e,`palette.${t}Channel`);return"vars"in e&&a?`rgba(${a} / 0.4)`:be(n,.4)},rr=["className","color","component","onBlur","onFocus","TypographyClasses","underline","variant","sx"],tr=e=>{const{classes:r,component:t,focusVisible:n,underline:a}=e,i={root:["root",`underline${p(a)}`,t==="button"&&"button",n&&"focusVisible"]};return ae(i,Je,r)},nr=_(Ce,{name:"MuiLink",slot:"Root",overridesResolver:(e,r)=>{const{ownerState:t}=e;return[r.root,r[`underline${p(t.underline)}`],t.component==="button"&&r.button]}})(({theme:e,ownerState:r})=>y({},r.underline==="none"&&{textDecoration:"none"},r.underline==="hover"&&{textDecoration:"none","&:hover":{textDecoration:"underline"}},r.underline==="always"&&y({textDecoration:"underline"},r.color!=="inherit"&&{textDecorationColor:er({theme:e,ownerState:r})},{"&:hover":{textDecorationColor:"inherit"}}),r.component==="button"&&{position:"relative",WebkitTapHighlightColor:"transparent",backgroundColor:"transparent",outline:0,border:0,margin:0,borderRadius:0,padding:0,cursor:"pointer",userSelect:"none",verticalAlign:"middle",MozAppearance:"none",WebkitAppearance:"none","&::-moz-focus-inner":{borderStyle:"none"},[`&.${Ye.focusVisible}`]:{outline:"auto"}})),ar=o.forwardRef(function(r,t){const n=te({props:r,name:"MuiLink"}),{className:a,color:i="primary",component:s="a",onBlur:u,onFocus:l,TypographyClasses:h,underline:f="always",variant:c="inherit",sx:d}=n,b=ne(n,rr),{isFocusVisibleRef:g,onBlur:m,onFocus:$,ref:P}=ye(),[v,O]=o.useState(!1),C=he(t,P),R=k=>{m(k),g.current===!1&&O(!1),u&&u(k)},F=k=>{$(k),g.current===!0&&O(!0),l&&l(k)},E=y({},n,{color:i,component:s,focusVisible:v,underline:f,variant:c}),w=tr(E);return j.jsx(nr,y({color:i,className:V(w.root,a),classes:h,component:s,onBlur:R,onFocus:F,ref:C,ownerState:E,variant:c,sx:[...Object.keys(se).includes(i)?[]:[{color:i}],...Array.isArray(d)?d:[d]]},b))});var I=function(){return I=Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++){r=arguments[t];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},I.apply(this,arguments)},Y=function(e,r){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,n=Object.getOwnPropertySymbols(e);a<n.length;a++)r.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(t[n[a]]=e[n[a]]);return t},z=function(e){var r=e.timeout,t=r===void 0?1e3:r,n=Y(e,["timeout"]),a=n.className,i=Y(n,["className"]),s=Oe(t);return s?o.createElement(ir,I({className:a},i)):o.createElement(de,{my:1,height:4,component:"span",display:"block"})};z.displayName="LinearProgress";var or="RaLinearProgress",ir=_(Qe,{name:or,overridesResolver:function(e,r){return r.root}})(function(e){var r=e.theme;return{margin:"".concat(r.spacing(1)," 0"),width:r.spacing(20)}}),A=function(){return A=Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++){r=arguments[t];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},A.apply(this,arguments)},sr=function(e,r){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,n=Object.getOwnPropertySymbols(e);a<n.length;a++)r.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(t[n[a]]=e[n[a]]);return t},lr=function(e){var r=e.to,t=e.children,n=e.className,a=sr(e,["to","children","className"]);return o.createElement(fr,A({component:xe,to:r,className:V(ur.link,n)},a),t)},cr="RaLink",ur={link:"".concat(cr,"-link")},fr=_(ar)({}),D=function(){return D=Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++){r=arguments[t];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},D.apply(this,arguments)},dr=function(e,r){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,n=Object.getOwnPropertySymbols(e);a<n.length;a++)r.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(t[n[a]]=e[n[a]]);return t},mr=function(e){var r=e.className,t=e.children,n=e.empty,a=e.linkType,i=a===void 0?"edit":a,s=e.gap,u=s===void 0?1:s,l=e.direction,h=l===void 0?"row":l,f=dr(e,["className","children","empty","linkType","gap","direction"]),c=Ne(e),d=c.data,b=c.total,g=c.isPending,m=ie(e),$=Pe();return g===!0?o.createElement(z,null):d==null||d.length===0||b===0?n||null:o.createElement(gr,D({gap:u,direction:h,className:r},Ee(f)),d.map(function(P,v){var O,C,R=i?$({resource:m,type:i,id:P.id}):!1;return R?o.createElement(W,{value:P,key:(O=P.id)!==null&&O!==void 0?O:"row".concat(v)},o.createElement(lr,{className:ce.link,to:R,onClick:vr},t||o.createElement(Z,{clickable:!0}))):o.createElement(W,{value:P,key:(C=P.id)!==null&&C!==void 0?C:"row".concat(v)},t||o.createElement(Z,null))}))},le="RaSingleFieldList",ce={link:"".concat(le,"-link")},gr=_(ke,{name:le,overridesResolver:function(e,r){return r.root}})(function(e){var r,t=e.theme;return r={flexWrap:"wrap"},r["& .".concat(ce.link)]={textDecoration:"none","& > *":{color:t.palette.primary.main}},r}),vr=function(e){return e.stopPropagation()},Z=function(e){var r=e.clickable;return o.createElement($e,{sx:{cursor:"inherit"},size:"small",label:o.createElement(Ie,null),clickable:r})},T=function(){return T=Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++){r=arguments[t];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},T.apply(this,arguments)},wr=function(e){var r=e.filter,t=e.page,n=t===void 0?1:t,a=e.perPage,i=e.reference,s=e.resource,u=e.sort,l=e.source,h=e.queryOptions,f=oe(e),c=Me({filter:r,page:n,perPage:a,record:f,reference:i,resource:s,sort:u,source:l,queryOptions:h});return o.createElement(Be,{value:i},o.createElement(Fe,{value:c},o.createElement(yr,T({},e))))},pr=function(e){var r=e.children,t=e.pagination,n=e.className,a=e.sx,i=we(),s=i.isPending,u=i.total;return o.createElement(br,{className:n,sx:a},s?o.createElement(z,{className:fe.progress}):o.createElement("span",null,r||o.createElement(mr,null),t&&u!==void 0?t:null))},ue="RaReferenceArrayField",fe={progress:"".concat(ue,"-progress")},br=_("span",{name:ue,overridesResolver:function(e,r){return r.root}})(function(e){var r,t=e.theme;return r={display:"block"},r["& .".concat(fe.progress)]={marginTop:t.spacing(2)},r}),yr=o.memo(pr);export{ar as L,wr as R,mr as S,z as a,lr as b};
