You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 lines
11 KiB
1 lines
11 KiB
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[17],{82456:function(e,t,n){var l=n(85893),r=n(67294),o=n(67645),a=n(56211),i=n(41247),u=n(63071),s=n(6903),c=n(32576),d=n(7576),h=n(67978);let reduceHeader=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),l=1;l<t;l++)n[l-1]=arguments[l];return"function"==typeof e?e(...n):e};t.Z=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];let[g]=t,{addHeader:f,editHeader:v,entriesUrl:p,getAddLoading:m,getDeleteErrorMessage:b,getDeleteHeader:y,getDeletePromiseChain:k=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),l=1;l<t;l++)n[l-1]=arguments[l];return e(...n)},getDeleteSuccessMessage:Z,getEditLoading:C=e=>e,listEmpty:x,listProps:j,onItemClick:E=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),l=1;l<t;l++)n[l-1]=arguments[l];return e(...n)},refreshInterval:S=5e3,renderAddForm:M,renderDeleteItem:w,renderEditForm:A,renderListItem:P,entryUrlPrefix:O=p}=g,V=(0,r.useRef)(null),L=(0,r.useRef)(null),{confirmDialog:_,finishConfirm:W,setConfirmDialogLoading:F,setConfirmDialogOpen:H,setConfirmDialogProps:I}=(0,d.Z)({initial:{scrollContent:!0}}),[R,T]=(0,r.useState)(!1),[D,U]=(0,r.useState)(),{data:$,mutate:q,loading:J}=(0,h.Z)(p,{refreshInterval:S}),{fetch:N,loading:B}=(0,s.Z)({onData:e=>U(e),url:O}),K=(0,r.useMemo)(()=>reduceHeader(f),[f]),z=(0,r.useMemo)(()=>reduceHeader(v,D),[D,v]),X=(0,r.useMemo)(()=>({add:{open:function(){var e;let t=!(arguments.length>0)||void 0===arguments[0]||arguments[0];return null==V?void 0:null===(e=V.current)||void 0===e?void 0:e.setOpen(t)}},confirm:{finish:W,loading:F,open:function(){let e=!(arguments.length>0)||void 0===arguments[0]||arguments[0];return H(e)},prepare:I},edit:{open:function(){var e;let t=!(arguments.length>0)||void 0===arguments[0]||arguments[0];return null==L?void 0:null===(e=L.current)||void 0===e?void 0:e.setOpen(t)}}}),[W,F,H,I]),{buildDeleteDialogProps:G,checks:Q,getCheck:Y,hasAllChecks:ee,hasChecks:et,multipleItems:en,resetChecks:el,setAllChecks:er,setCheck:eo}=(0,c.Z)({list:$});return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(u.Z,{allowCheckAll:en,allowEdit:!0,allowItemButton:R,disableDelete:!et,edit:R,getListCheckboxProps:()=>({checked:ee,onChange:(e,t)=>er(t)}),getListItemCheckboxProps:e=>({checked:Y(e),onChange:(t,n)=>eo(e,n)}),header:!0,listEmpty:x,listItems:$,loading:J,onAdd:()=>{var e;return null==V?void 0:null===(e=V.current)||void 0===e?void 0:e.setOpen(!0)},onDelete:()=>{I(G({onProceedAppend:()=>{F(!0),Promise.all(k((e,t)=>e.map(e=>o.Z.delete("".concat(t,"/").concat(e))),Q,p)).then(()=>{W("Success",Z()),q()}).catch(e=>{let t=(0,i.Z)(e);W("Error",b(t))}).finally(()=>{el()})},getConfirmDialogTitle:y,renderEntry:function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return w($,...t)}})),H(!0)},onEdit:()=>T(e=>!e),onItemClick:function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return E((e,t)=>{var n;null==L||null===(n=L.current)||void 0===n||n.setOpen(!0),N("/".concat(t))},...t)},renderListItem:P,...j}),(0,l.jsx)(a.Js,{header:K,loading:null==m?void 0:m.call(null),ref:V,showClose:!0,children:M(X)}),(0,l.jsx)(a.Js,{header:z,loading:C(B),ref:L,showClose:!0,children:A(X,D)}),_]})}},15079:function(e,t,n){var l=n(85893),r=n(97212),o=n(78462),a=n(5616),i=n(55238),u=n(84154),s=n(5744);let renderEntryValueWithMono=e=>{let{entry:t}=e;return(0,l.jsx)(u.$_,{whiteSpace:"nowrap",children:String(t)})},renderEntryValueWithPassword=e=>{let{entry:t,key:n}=e;return/passw/i.test(n)?(0,l.jsx)(u.PJ,{revealButtonProps:{sx:{marginRight:0,padding:0}},monospaced:!0,textLineHeight:null,children:String(t)}):renderEntryValueWithMono(e)},buildEntryList=e=>{let{depth:t=0,entries:n,getEntryLabel:a,getListProps:i,getListItemProps:u,listKey:s,maxDepth:c,renderEntry:d,renderEntryValue:h,skip:g}=e,f=[];Object.entries(n).forEach(e=>{let[n,o]=e,i="form-summary-entry-".concat(n),s=null!==o&&"object"==typeof o,v=s?null:o,p={depth:t,entry:v,key:n};g(e=>{let{key:t}=e;return!/confirm/i.test(t)},p)&&f.push((0,l.jsx)(r.ZP,{sx:{paddingLeft:"".concat(t,"em")},...null==u?void 0:u.call(null,p),children:d({depth:t,entry:v,getLabel:a,key:n,nest:s,renderValue:h})},i)),s&&t<c&&f.push(buildEntryList({depth:t+1,entries:o,getEntryLabel:a,listKey:n,maxDepth:c,renderEntry:d,renderEntryValue:h,skip:g}))});let v="form-summary-list-".concat(null!=s?s:"root");return(0,l.jsx)(o.Z,{dense:!0,disablePadding:!0,...null==i?void 0:i.call(null,{depth:t,entries:n,key:s}),children:f},v)};t.Z=e=>{let{entries:t,getEntryLabel:n=e=>{let{cap:t,key:n}=e;return t(n)},getListProps:r,getListItemProps:o,hasPassword:c,maxDepth:d=3,renderEntry:h=e=>{let{depth:t,entry:n,getLabel:r,key:o,nest:c,renderValue:d}=e;return(0,l.jsxs)(i.Z,{fullWidth:!0,growFirst:!0,row:!0,maxWidth:"100%",children:[(0,l.jsx)(u.Ac,{children:r({cap:s.Z,depth:t,entry:n,key:o})}),(0,l.jsx)(a.Z,{sx:{maxWidth:"100%",overflowX:"scroll"},children:!c&&d({depth:t,entry:n,key:o})})]})},renderEntryValue:g=e=>{let{entry:t}=e;return["",null,void 0].some(e=>t===e)?(0,l.jsx)(u.Ac,{children:"none"}):c?renderEntryValueWithPassword(e):renderEntryValueWithMono(e)},skip:f=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),l=1;l<t;l++)n[l-1]=arguments[l];return e(...n)}}=e;return buildEntryList({entries:t,getEntryLabel:n,getListProps:r,getListItemProps:o,maxDepth:d,renderEntry:h,renderEntryValue:g,skip:f})}},88468:function(e,t,n){var l=n(67294),r=n(94121),o=n(591);let a=(0,l.forwardRef)((e,t)=>{let{input:n,onChange:a=function(e){let{handlers:{base:t,origin:n}}=e;for(var l=arguments.length,r=Array(l>1?l-1:0),o=1;o<l;o++)r[o-1]=arguments[o];null==t||t.call(null,...r),null==n||n.call(null,...r)},onMount:i,onUnmount:u}=e,{props:s}=n,{valueKey:c,valueType:d}=(0,l.useMemo)(()=>{let{type:e}=s,t="value",n="string";return e===r.Z.checkbox&&(t="checked",n="boolean"),{valueKey:t,valueType:n}},[s]),{onChange:h,[c]:g,...f}=s,[v,p]=(0,l.useState)(g),m=(0,l.useCallback)(e=>{let{target:{[c]:t}}=e,n=o.Z[d](t);p(n)},[c,d]),b=(0,l.useCallback)(function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return null==a?void 0:a.call(null,{handlers:{base:m,origin:h}},...t)},[m,h,a]);return(0,l.useEffect)(()=>(null==i||i.call(null),u),[]),(0,l.useImperativeHandle)(t,()=>({get:()=>v,set:p}),[v]),(0,l.cloneElement)(n,{...f,onChange:b,[c]:v})});a.displayName="UncontrolledInput",t.Z=a},6903:function(e,t,n){var l=n(67294),r=n(67645),o=n(41247);t.Z=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{config:t,onError:n,onData:a,url:i=""}=e,[u,s]=(0,l.useState)(!1),c=(0,l.useCallback)(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",l=arguments.length>1?arguments[1]:void 0,u="".concat(i).concat(e);u&&(s(!0),r.Z.get(u,{...t,...l}).then(e=>{let{data:t}=e;null==a||a.call(null,t)}).catch(e=>{let t=(0,o.Z)(e);null==n||n.call(null,t)}).finally(()=>{s(!1)}))},[i,t,a,n]);return{fetch:c,loading:u}}},32576:function(e,t,n){var l=n(85893),r=n(67294),o=n(84070),a=n(15079);t.Z=e=>{let{list:t={}}=e,[n,i]=(0,r.useState)({}),u=(0,r.useMemo)(()=>Object.keys(t),[t]),s=(0,r.useMemo)(()=>Object.keys(n),[n]),c=(0,r.useMemo)(()=>s.length===u.length,[s.length,u.length]),d=(0,r.useMemo)(()=>s.length>0,[s.length]),h=(0,r.useMemo)(()=>u.length>1,[u.length]),g=(0,r.useCallback)(e=>{let{confirmDialogProps:t={},formSummaryProps:r={},getConfirmDialogTitle:o,onProceedAppend:i,renderEntry:u}=e;return{actionProceedText:"Delete",content:(0,l.jsx)(a.Z,{entries:n,maxDepth:0,renderEntry:u,...r}),onProceedAppend:i,proceedColour:"red",titleText:o(s.length),...t}},[n,s.length]),f=(0,r.useCallback)(e=>!!n[e],[n]),v=(0,r.useCallback)(()=>i({}),[]),p=(0,r.useCallback)(e=>i(u.reduce((t,n)=>(e&&(t[n]=e),t),{})),[u]),m=(0,r.useCallback)((e,t)=>i((0,o.ZP)(e,t||void 0)),[]);return{buildDeleteDialogProps:g,checklist:n,checks:s,getCheck:f,hasAllChecks:c,hasChecks:d,multipleItems:h,resetChecks:v,setAllChecks:p,setCheck:m}}},7576:function(e,t,n){var l=n(85893),r=n(67294),o=n(56597),a=n(68917);t.Z=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{initial:{actionProceedText:t="",content:n="",titleText:i="",...u}={}}=e,s=(0,r.useRef)(null),[c,d]=(0,r.useState)({actionProceedText:t,content:n,titleText:i}),h=(0,r.useCallback)(e=>d(t=>{let{loading:n,...l}=t;return{...l,loading:e}}),[]),g=(0,r.useCallback)(e=>{var t,n;return null==s?void 0:null===(n=s.current)||void 0===n?void 0:null===(t=n.setOpen)||void 0===t?void 0:t.call(null,e)},[]),f=(0,r.useCallback)((e,t)=>d({actionProceedText:"",content:(0,l.jsx)(a.Z,{...t}),showActionArea:!1,showClose:!0,titleText:e}),[]),v=(0,r.useMemo)(()=>(0,l.jsx)(o.Z,{...u,...c,ref:s}),[c,u]);return{confirmDialog:v,confirmDialogRef:s,setConfirmDialogLoading:h,setConfirmDialogOpen:g,setConfirmDialogProps:d,finishConfirm:f}}},67978:function(e,t,n){var l=n(67294),r=n(8100),o=n(98436),a=n(96262);t.Z=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{baseUrl:n=o.Z,fetcher:i=a.Z,mod:u,...s}=t,{data:c,error:d,mutate:h}=(0,r.ZP)("".concat(n).concat(e),i,s),g=(0,l.useMemo)(()=>u&&c&&u(c),[c,u]),f=!d&&!c;return{altData:g,data:c,error:d,mutate:h,loading:f}}},21197:function(e,t,n){n.d(t,{Z:function(){return hooks_useFormikUtils}});var l=n(82175),r=n(18446),o=n.n(r),a=n(13218),i=n.n(a),u=n(67294),s=n(23279),c=n.n(s),lib_debounce=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{wait:n=500,...l}=t;return c()(e,n,l)},d=n(43799);let isChainEqual=(e,t,n)=>{let[l,...r]=e;if(!(l in t))return!1;let a=t[l],u=n[l];return i()(a)&&i()(u)&&r.length?isChainEqual(r,a,u):!o()(a,u)};var hooks_useFormikUtils=e=>{let t=(0,l.TA)({...e}),n=(0,u.useCallback)(e=>{let n=e.split(".");return isChainEqual(n,t.values,t.initialValues)},[t.initialValues,t.values]),r=(0,u.useMemo)(()=>lib_debounce(t.handleChange),[t.handleChange]),o=(0,u.useMemo)(()=>!t.dirty||!t.isValid||t.isValidating||t.isSubmitting,[t.dirty,t.isSubmitting,t.isValid,t.isValidating]),a=(0,u.useMemo)(()=>(0,d.Z)(t.errors,{skip:e=>!n(e)}),[t.errors,n]);return{disabledSubmit:o,formik:t,formikErrors:a,handleChange:r}}},84070:function(e,t,n){n.d(t,{Um:function(){return buildRegExpObjectStateSetterCallback}});let defaultObjectStatePropSetter=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];let[,l,r,o]=t;void 0!==o&&(l[r]=o)},buildRegExpObjectStateSetterCallback=function(e,t){let{set:n=defaultObjectStatePropSetter}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return l=>{let r={};return Object.keys(l).forEach(o=>{e.test(o)?n(l,r,o,t):r[o]=l[o]}),r}};t.ZP=function(e,t){let{guard:n=()=>!0,set:l=defaultObjectStatePropSetter}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return r=>{let{[e]:o,...a}=r,i={...a};return n(r,e,t)&&l(r,i,e,t),i}}},5744:function(e,t,n){var l=n(48403),r=n.n(l);t.Z=e=>{let t=e.replace(/([a-z\d])([A-Z])/g,"$1 $2");return r()(t)}},43799:function(e,t,n){var l=n(5744);let getFormikErrorMessages=function(e){let{build:t=(e,t)=>{let n=t;if("string"==typeof n){let[e,...t]=n.split(/\s+/),r=(0,l.Z)(e.replace(/^[^\s]+\.([^.]+)/,"$1"));n=[r,...t].join(" ")}return{children:n,type:"warning"}},chain:n="",skip:r}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Object.entries(e).reduce((e,l)=>{let[o,a]=l,i=[n,o].filter(e=>!!e).join(".");return null!==a&&"object"==typeof a?{...e,...getFormikErrorMessages(a,{build:t,chain:i,skip:r})}:((null==r?void 0:r.call(null,i))||(e[i]=t(i,a)),e)},{})};t.Z=getFormikErrorMessages}}]); |