import{j as r}from"./tanstack-1.0.74-aU0azVkW.js";import{a as v}from"./TableContainer-1.0.74-CzT83gtM.js";import{u as h}from"./useTableInlineEditingErrors-1.0.74-BU_SqCqG.js";import{f as y,ab as u}from"./index-1.0.74-DxwH6OqZ.js";import{a as R}from"./ActionsDml-1.0.74-C175Bq0Y.js";import{e as m}from"./utils-1.0.74-7xWhx9mc.js";import{l as x}from"./lib-1.0.74-B5IEqfHg.js";import{I as T}from"./iconBase-1.0.74-Cs0vntJu.js";import{B as w}from"./ConfirmDialog-1.0.74-CXu4CqK2.js";import"./redux-1.0.74-D8bIc6ki.js";import"./vendor-1.0.74-CN03Eozo.js";import"./RestApiError-1.0.74-Bb1un17k.js";import"./AdminTheme-1.0.74-BtTaJUu_.js";import"./CircularProgress-1.0.74-QfwfRJ7i.js";import"./SharedContainer-1.0.74-EDNOiamc.js";import"./hooks-1.0.74-NYCTWeI9.js";import"./DynamicModeEnum-1.0.74-BXuL5kgA.js";import"./useRemoveAppFromStore-1.0.74-CJatuZ_l.js";import"./Languages-1.0.74-DaJcF5OJ.js";import"./CleanupDetails-1.0.74-CpCDzf3e.js";import"./useLocaleApp-1.0.74-BAnA1P2j.js";import"./useLocaleUd-1.0.74-DiRzsyAi.js";import"./RestApi-1.0.74-5XKxNzpR.js";import"./useFormDetails-1.0.74-eGZBYCv4.js";import"./useMetadata-1.0.74--jxfVI7W.js";import"./useTheme-1.0.74-CW3awVDs.js";import"./index-1.0.74-iJ_9eGZx.js";import"./Typography-1.0.74-B4mhsevh.js";import"./getThemeProps-1.0.74-DOfDN6_V.js";import"./useEnhancedEffect-1.0.74-B56M26dS.js";import"./useChartSettings-1.0.74-C6-5LBxk.js";import"./useBuiltins-1.0.74-D-15qGZw.js";import"./ThemeProvider-1.0.74-4uzbYYLM.js";import"./useStoreFormSettings-1.0.74-3dBRbl0S.js";import"./useScreenSize-1.0.74-DEibwIMk.js";import"./useFullScreen-1.0.74-DAWjksdW.js";import"./Box-1.0.74-DEbuVvGV.js";import"./Tooltip-1.0.74-Bsfqgjy3.js";import"./SanitizeComponent-1.0.74-DsOvasd7.js";import"./index-1.0.74-8lphm33F.js";import"./useAppFunctions-1.0.74-YEA5Kc-A.js";import"./index.esm-1.0.74-BYIJ7eFL.js";import"./createSvgIcon-1.0.74-Cw_ZFbxi.js";import"./ButtonBase-1.0.74-W6tAH7AI.js";import"./Stack-1.0.74-2Im9CMBM.js";import"./useThemeProps-1.0.74-eOKEtzB-.js";import"./Radio-1.0.74-fPSETwpC.js";import"./SwitchBase-1.0.74-pUYMwK3f.js";import"./Select-1.0.74-DHOnlEEH.js";import"./Menu-1.0.74-CdjCBJ4R.js";import"./isHostComponent-1.0.74-DVu5iVWx.js";import"./Portal-1.0.74-BrUPeMX9.js";import"./Modal-1.0.74-BfLid1bk.js";import"./Checkbox-1.0.74-DOdb-56q.js";import"./Chip-1.0.74-BR6j83mk.js";import"./Collapse-1.0.74-DA2Rx31o.js";import"./AlertTitle-1.0.74-BmkdSyE6.js";import"./Close-1.0.74-Ce0z5IFm.js";import"./TextField-1.0.74-BW9Byijb.js";import"./InputAdornment-1.0.74-DzikPcDx.js";import"./MenuItem-1.0.74-D9LDbFUb.js";import"./TableRow-1.0.74-CECYdZO6.js";import"./ListItemIcon-1.0.74-ppmWX5FC.js";import"./Divider-1.0.74-BpwHmJ_P.js";import"./FormControlLabel-1.0.74-CdAG1Jo8.js";import"./Switch-1.0.74-IHNqKL8Y.js";import"./Autocomplete-1.0.74-1_REDbpQ.js";import"./Slider-1.0.74-BxpDcEEP.js";import"./visuallyHidden-1.0.74-Dan1xhjv.js";import"./TimePicker-1.0.74-gWV6OwNg.js";import"./useMobilePicker-1.0.74-BBJYmeTF.js";import"./index-1.0.74-DtMr5-xA.js";import"./timeViewRenderers-1.0.74-DXJAb_je.js";import"./DateTimePicker-1.0.74-BxWsB93c.js";import"./Tabs-1.0.74-BLkbuumd.js";import"./dateViewRenderers-1.0.74-2jL9ogDX.js";import"./DatePicker-1.0.74-RL6FEWbq.js";import"./index-1.0.74-C9JunOsO.js";import"./math-1.0.74-CudmHSny.js";import"./ToggleButtonGroup-1.0.74-DMigw7sg.js";import"./index-1.0.74-CwV9FnQf.js";import"./index-1.0.74-FmkvObU2.js";import"./useLocaleMrt-1.0.74-BUIBUKA0.js";const ti=({appId:e,metaData:b,locale:a,appLanguage:o,tableWidth:k,refetch:n})=>{const j=h(e),i=v(e),s=Object.keys(i).length>0,l=()=>{let p=0;j.length===0&&Object.keys(i).map(c=>{const d={...i[c]},f={};b.primary_key.map(t=>{f[t]=i[c][t],delete d[t]}),R(e,f,d,t=>{if(x.debug(t),p++,t!=null&&t.code&&(t!=null&&t.message))switch(t.code){case"ok":m(o.updatedSuccessful,{variant:"success"});break;case"info":m(o.nothingToUpdate,{variant:"info"});break;default:console.error(t),m(t.message??o.invalidResponse,{variant:"error"})}else console.error(t),m(t.message??o.invalidResponse,{variant:"error"});p===Object.keys(i).length&&setTimeout(()=>{n()},200)},t=>{console.error("error",t),p++,m(t??o.invalidResponse,{variant:"error"}),p===Object.keys(i).length&&setTimeout(()=>{n()},200)})})};return k<900?r.jsx(y,{title:a.save,children:r.jsx(T,{disabled:!s,onClick:()=>{l()},children:r.jsx(u,{})})}):r.jsx(w,{disabled:!s,color:"primary",variant:"contained",onClick:()=>{l()},endIcon:r.jsx(u,{}),children:a.save})};export{ti as default};
