import{r as i}from"./index-BP8_t0zE.js";import{aS as M,aT as U,F as H,A as I,S as k,Q as G,I as N,C as L,G as w,aU as D,T as j,aV as F,J as K,H as Q}from"./defaultI18nProvider-C_r1y4tu.js";import{d as O,C as Y,D as q,e as B,G as J,g as V,h as z,i as W,U as X,j as Z,A as $}from"./Button-C3j8Wgdd.js";import{P as ee}from"./PreferencesEditorContext-oPOmBo-a.js";import{c as te,R as re}from"./index-qEiLzbkV.js";var ne=function(e){var r=e.children,t=e.basename;return i.createElement(M.Provider,{value:t},r)},ae=function(e){var r=e.basename,t=r===void 0?"":r,n=e.children,a=U(),o=a?ie:oe;return i.createElement(ne,{basename:a?t:""},i.createElement(o,{basename:t},n))},ie=function(e){var r=e.children;return i.createElement(i.Fragment,null,r)},oe=function(e){var r=e.children,t=e.basename,n=te([{path:"*",element:i.createElement(i.Fragment,null,r)}],{basename:t});return i.createElement(re,{router:n})},y={create:Y,delete:q,deleteMany:B,getList:J,getMany:V,getManyReference:z,getOne:W,update:X,updateMany:Z},ue=function(e){var r=new Proxy(O,{get:function(t,n){return function(a,o){if(Object.keys(y).includes(n.toString())){var u=y[n.toString()];return e(u,a,o)}return e(n.toString(),a,o)}},apply:function(t,n,a){return e.apply(e,a)}});return r},le=function(e){var r=e.children,t=i.useState(!1),n=t[0],a=t[1],o=i.useState(null),u=o[0],l=o[1],s=i.useState(null),c=s[0],m=s[1],d=i.useState(null),v=d[0],h=d[1],E=i.useState(null),T=E[0],S=E[1],P=i.useState(),b=P[0],A=P[1],_=i.useCallback(function(){return a(!0)},[]),C=i.useCallback(function(){a(!1),l(null)},[]),g=i.useCallback(function(x,p){S(x),A(p)},[]),R=i.useMemo(function(){return{editor:u,setEditor:l,preferenceKey:c,setPreferenceKey:m,title:T,titleOptions:b,setTitle:g,isEnabled:n,disable:C,enable:_,path:v,setPath:h}},[C,_,u,c,n,v,h,T,b,g]);return i.createElement(ee.Provider,{value:R},r)},ce=D(),se=function(e){var r=e.authProvider,t=e.basename,n=e.dataProvider,a=n===void 0?O:n,o=e.i18nProvider,u=e.store,l=u===void 0?ce:u,s=e.children,c=e.queryClient;if(!a)throw new Error(`Missing dataProvider prop.
React-admin requires a valid dataProvider function to work.`);var m=i.useMemo(function(){return c||new H},[c]),d=i.useMemo(function(){return r instanceof Function?Ee(r):r},[r]),v=i.useMemo(function(){return a instanceof Function?ue(a):a},[a]);return i.createElement($.Provider,{value:d},i.createElement(I.Provider,{value:v},i.createElement(k,{value:l},i.createElement(le,null,i.createElement(G,{client:m},i.createElement(ae,{basename:t},i.createElement(N,{value:o},i.createElement(L,null,i.createElement(w,null,s)))))))))},de="AUTH_LOGIN",ve="AUTH_CHECK",me="AUTH_ERROR",fe="AUTH_LOGOUT",he="AUTH_GET_PERMISSIONS";const Ee=function(e){var r=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.apply(null,t)};return r.login=function(t){return e(de,t)},r.logout=function(t){return e(fe,t)},r.checkAuth=function(t){return e(ve,t)},r.checkError=function(t){return e(me,t)},r.getPermissions=function(t){return e(he,t)},r};var f=function(){return f=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},f.apply(this,arguments)},Te=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},Pe=function(e){var r=e.theme,t=e.lightTheme,n=t===void 0?Q:t,a=e.darkTheme,o=e.defaultTheme,u=e.children,l=Te(e,["theme","lightTheme","darkTheme","defaultTheme","children"]);return i.createElement(se,f({},l),i.createElement(j.Provider,{value:{lightTheme:r||n,darkTheme:r&&!a?void 0:!a&&a!==null?F:a??void 0,defaultTheme:o}},i.createElement(K,null,u)))};Pe.displayName="AdminContext";export{Pe as A};
