iobroker.admin 7.6.2 → 7.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/README.md +5 -10
  2. package/adminWww/assets/{AdapterUpdateDialog-CdDzwRjx.js → AdapterUpdateDialog-CRermRaB.js} +1 -1
  3. package/adminWww/assets/{Adapters-BtSoe3ny.js → Adapters-Bs8G-cxo.js} +1 -1
  4. package/adminWww/assets/{Config-DV-y10Fh.js → Config-Di_mkCPb.js} +1 -1
  5. package/adminWww/assets/{CustomModal-CYOPWjwy.js → CustomModal-BTTKhEC8.js} +1 -1
  6. package/adminWww/assets/{CustomTab-cprIlE4B.js → CustomTab-D6Mn63bB.js} +1 -1
  7. package/adminWww/assets/{EasyMode-Cd88-W7q.js → EasyMode-DKcbIjJ6.js} +1 -1
  8. package/adminWww/assets/{Enums-nUibAZSg.js → Enums-uOeKEKzl.js} +1 -1
  9. package/adminWww/assets/{Fields-vrlzBhCD.js → Fields-TuYhaeX9.js} +1 -1
  10. package/adminWww/assets/{Files-DClcJEP9.js → Files-BhPaQLPw.js} +1 -1
  11. package/adminWww/assets/{Hosts-DLnI_Hxs.js → Hosts-BNvz1qdC.js} +1 -1
  12. package/adminWww/assets/{Instances-BaExCFtw.js → Instances-L7eZoDyM.js} +2 -2
  13. package/adminWww/assets/{Intro-wT4JOxpS.js → Intro-Dih9urjd.js} +1 -1
  14. package/adminWww/assets/{Logs-CSsFxtVG.js → Logs-C8bVKj2s.js} +1 -1
  15. package/adminWww/assets/{Objects-Bbrov7BJ.js → Objects-CD7n6XMI.js} +1 -1
  16. package/adminWww/assets/{State-CmEur1zC.js → State-Bs4eLVUn.js} +1 -1
  17. package/adminWww/assets/{Tabs-CmlBtpRi.js → Tabs-C57_YqtR.js} +1 -1
  18. package/adminWww/assets/{Users-CPHL5ErP.js → Users-DMJv0VQ1.js} +1 -1
  19. package/adminWww/assets/{bootstrap-CoF0Rq1_.js → bootstrap-DF1rNJUh.js} +43 -43
  20. package/adminWww/assets/{index-BKyxHMBB.js → index-Cmq0Omjs.js} +1 -1
  21. package/adminWww/assets/{index-DO87nxhY.js → index-DGeySK-Q.js} +2 -2
  22. package/adminWww/assets/{index-yI_g3hCZ.js → index-lAM5Xnu_.js} +1 -1
  23. package/adminWww/assets/{sentry-Cc5WioqD.js → sentry-ClQ-PGjf.js} +1 -1
  24. package/adminWww/assets/{zh-cn-CzBq9Ifq.js → zh-cn-DrUOm-Ho.js} +1 -1
  25. package/adminWww/index.html +1 -1
  26. package/adminWww/mf-manifest.json +1 -1
  27. package/adminWww/remoteEntry.js +2 -2
  28. package/build-backend/lib/web.js +2 -1
  29. package/build-backend/lib/web.js.map +1 -1
  30. package/io-package.json +22 -14
  31. package/package.json +4 -4
@@ -1,4 +1,4 @@
1
- import{R as zn,c as z,a7 as Wr,T as Wn,a as Y,g as Q,y as ot,j as S,s as D,e as N,b as et,z as st,d as pt,A as Vt,o as Un,a2 as Go,w as Ur,P as Hr}from"./DefaultPropsProvider-Beyggw1o.js";import{e as Vr,t as Kr,a as Qt,b as Rt,v as _r,g as Bt,R as Ge,l as Zt,o as Mt,i as Hn,I as Vn,w as Kn,x as _n,y as Xn,z as qn,c as Ee,m as We,A as Xr,B as ho,C as Gn,d as Ue,s as Yo,p as qr,k as Oo,n as bo,u as io,F as Yn}from"./FilledInput-Bfz0Aef-.js";import{i as p,a as Qn,R as Gt}from"./iobroker_admin__loadShare__react__loadShare__-T96CJO0k.js";import"./iobroker_admin__loadShare__prop_mf_2_types__loadShare__-C8Lvs8Es.js";import{c as so}from"./createSvgIcon-DHNqxcCi.js";import{i as Ft}from"./iobroker_admin__loadShare___mf_0_emotion_mf_1_react__loadShare__-gw2iqPBS.js";import{_ as Gr}from"./extends-CF3RwP-h.js";function Zn(t,e){if(t==null)return{};var o={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(e.includes(n))continue;o[n]=t[n]}return o}function Jn(t){const{theme:e,name:o,props:n}=t;return!e||!e.components||!e.components[o]||!e.components[o].defaultProps?n:zn(e.components[o].defaultProps,n)}function Yr({props:t,name:e,defaultTheme:o,themeId:n}){let r=Vr(o);return n&&(r=r[n]||r),Jn({theme:r,name:e,props:t})}function Qr(t,e,o,n,r){const[i,s]=p.useState(()=>r&&o?o(t).matches:n?n(t).matches:e);return Qt(()=>{if(!o)return;const a=o(t),l=()=>{s(a.matches)};return l(),a.addEventListener("change",l),()=>{a.removeEventListener("change",l)}},[t,o]),i}const Zr={...Qn},tr=Zr.useSyncExternalStore;function Jr(t,e,o,n,r){const i=p.useCallback(()=>e,[e]),s=p.useMemo(()=>{if(r&&o)return()=>o(t).matches;if(n!==null){const{matches:d}=n(t);return()=>d}return i},[i,t,n,r,o]),[a,l]=p.useMemo(()=>{if(o===null)return[i,()=>()=>{}];const d=o(t);return[()=>d.matches,u=>(d.addEventListener("change",u),()=>{d.removeEventListener("change",u)})]},[i,o,t]);return tr(l,a,s)}function er(t={}){const{themeId:e}=t;return function(n,r={}){let i=Kr();i&&e&&(i=i[e]||i);const s=typeof window<"u"&&typeof window.matchMedia<"u",{defaultMatches:a=!1,matchMedia:l=s?window.matchMedia:null,ssrMatchMedia:c=null,noSsr:d=!1}=Jn({name:"MuiUseMediaQuery",props:r,theme:i});let u=typeof n=="function"?n(i):n;return u=u.replace(/^@media( ?)/m,""),(tr!==void 0?Jr:Qr)(u,a,l,c,d)}}er();function Qo(...t){return t.reduce((e,o)=>o==null?e:function(...r){e.apply(this,r),o.apply(this,r)},()=>{})}function Je(t,e){var o,n,r;return p.isValidElement(t)&&e.indexOf(t.type.muiName??((r=(n=(o=t.type)==null?void 0:o._payload)==null?void 0:n.value)==null?void 0:r.muiName))!==-1}let Zo=0;function ti(t){const[e,o]=p.useState(t),n=t||e;return p.useEffect(()=>{e==null&&(Zo+=1,o(`mui-${Zo}`))},[e]),n}const ei={...Qn},Jo=ei.useId;function He(t){if(Jo!==void 0){const e=Jo();return t??e}return ti(t)}function tn({controlled:t,default:e,name:o,state:n="value"}){const{current:r}=p.useRef(t!==void 0),[i,s]=p.useState(e),a=r?t:i,l=p.useCallback(c=>{r||s(c)},[]);return[a,l]}function Yt(t){const e=p.useRef(t);return Qt(()=>{e.current=t}),p.useRef((...o)=>(0,e.current)(...o)).current}const en={};function or(t,e){const o=p.useRef(en);return o.current===en&&(o.current=t(e)),o}const oi=[];function ni(t){p.useEffect(t,oi)}class Bo{static create(){return new Bo}currentId=null;start(e,o){this.clear(),this.currentId=setTimeout(()=>{this.currentId=null,o()},e)}clear=()=>{this.currentId!==null&&(clearTimeout(this.currentId),this.currentId=null)};disposeEffect=()=>this.clear}function nr(){const t=or(Bo.create).current;return ni(t.disposeEffect),t}function on(t){try{return t.matches(":focus-visible")}catch{}return!1}function rr(t=window){const e=t.document.documentElement.clientWidth;return t.innerWidth-e}const hd={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",whiteSpace:"nowrap",width:"1px"};function ri(t){return typeof t=="string"}function ir(t,e,o){return t===void 0||ri(t)?e:{...e,ownerState:{...e.ownerState,...o}}}function sr(t,e=[]){if(t===void 0)return{};const o={};return Object.keys(t).filter(n=>n.match(/^on[A-Z]/)&&typeof t[n]=="function"&&!e.includes(n)).forEach(n=>{o[n]=t[n]}),o}function nn(t){if(t===void 0)return{};const e={};return Object.keys(t).filter(o=>!(o.match(/^on[A-Z]/)&&typeof t[o]=="function")).forEach(o=>{e[o]=t[o]}),e}function ar(t){const{getSlotProps:e,additionalProps:o,externalSlotProps:n,externalForwardedProps:r,className:i}=t;if(!e){const f=z(o==null?void 0:o.className,i,r==null?void 0:r.className,n==null?void 0:n.className),m={...o==null?void 0:o.style,...r==null?void 0:r.style,...n==null?void 0:n.style},b={...o,...r,...n};return f.length>0&&(b.className=f),Object.keys(m).length>0&&(b.style=m),{props:b,internalRef:void 0}}const s=sr({...r,...n}),a=nn(n),l=nn(r),c=e(s),d=z(c==null?void 0:c.className,o==null?void 0:o.className,i,r==null?void 0:r.className,n==null?void 0:n.className),u={...c==null?void 0:c.style,...o==null?void 0:o.style,...r==null?void 0:r.style,...n==null?void 0:n.style},g={...c,...o,...l,...a};return d.length>0&&(g.className=d),Object.keys(u).length>0&&(g.style=u),{props:g,internalRef:c.ref}}function lr(t,e,o){return typeof t=="function"?t(e,o):t}function Ce(t){var u;const{elementType:e,externalSlotProps:o,ownerState:n,skipResolvingSlotProps:r=!1,...i}=t,s=r?{}:lr(o,n),{props:a,internalRef:l}=ar({...i,externalSlotProps:s}),c=Rt(l,s==null?void 0:s.ref,(u=t.additionalProps)==null?void 0:u.ref);return ir(e,{...a,ref:c},n)}function Ve(t){var e;return parseInt(p.version,10)>=19?((e=t==null?void 0:t.props)==null?void 0:e.ref)||null:(t==null?void 0:t.ref)||null}function bd(t){return String(parseFloat(t)).length===String(t).length}function cr(t){return String(t).match(/[\d.\-+]*\s*(.*)/)[1]||""}function oe(t){return parseFloat(t)}function yd(t){return(e,o)=>{const n=cr(e);if(n===o)return e;let r=oe(e);n!=="px"&&(n==="em"||n==="rem")&&(r=oe(e)*oe(t));let i=r;if(o!=="px")if(o==="em")i=r/oe(t);else if(o==="rem")i=r/oe(t);else return e;return parseFloat(i.toFixed(5))+o}}function xd({size:t,grid:e}){const o=t-t%e,n=o+e;return t-o<n-t?o:n}function Cd({lineHeight:t,pixels:e,htmlFontSize:o}){return e/(t*o)}function Sd({cssProperty:t,min:e,max:o,unit:n="rem",breakpoints:r=[600,900,1200],transform:i=null}){const s={[t]:`${e}${n}`},a=(o-e)/r[r.length-1];return r.forEach(l=>{let c=e+a*l;i!==null&&(c=i(c)),s[`@media (min-width:${l}px)`]={[t]:`${Math.round(c*1e4)/1e4}${n}`}}),s}function wd({props:t,name:e}){return Yr({props:t,name:e,defaultTheme:Wr,themeId:Wn})}function ii(t){return Q("MuiTypography",t)}const Rd=Y("MuiTypography",["root","h1","h2","h3","h4","h5","h6","subtitle1","subtitle2","body1","body2","inherit","button","caption","overline","alignLeft","alignRight","alignCenter","alignJustify","noWrap","gutterBottom","paragraph"]),si={primary:!0,secondary:!0,error:!0,info:!0,success:!0,warning:!0,textPrimary:!0,textSecondary:!0,textDisabled:!0},ai=_r(),li=t=>{const{align:e,gutterBottom:o,noWrap:n,paragraph:r,variant:i,classes:s}=t,a={root:["root",i,t.align!=="inherit"&&`align${N(e)}`,o&&"gutterBottom",n&&"noWrap",r&&"paragraph"]};return et(a,ii,s)},ci=D("span",{name:"MuiTypography",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:o}=t;return[e.root,o.variant&&e[o.variant],o.align!=="inherit"&&e[`align${N(o.align)}`],o.noWrap&&e.noWrap,o.gutterBottom&&e.gutterBottom,o.paragraph&&e.paragraph]}})(st(({theme:t})=>{var e;return{margin:0,variants:[{props:{variant:"inherit"},style:{font:"inherit",lineHeight:"inherit",letterSpacing:"inherit"}},...Object.entries(t.typography).filter(([o,n])=>o!=="inherit"&&n&&typeof n=="object").map(([o,n])=>({props:{variant:o},style:n})),...Object.entries(t.palette).filter(Bt()).map(([o])=>({props:{color:o},style:{color:(t.vars||t).palette[o].main}})),...Object.entries(((e=t.palette)==null?void 0:e.text)||{}).filter(([,o])=>typeof o=="string").map(([o])=>({props:{color:`text${N(o)}`},style:{color:(t.vars||t).palette.text[o]}})),{props:({ownerState:o})=>o.align!=="inherit",style:{textAlign:"var(--Typography-textAlign)"}},{props:({ownerState:o})=>o.noWrap,style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},{props:({ownerState:o})=>o.gutterBottom,style:{marginBottom:"0.35em"}},{props:({ownerState:o})=>o.paragraph,style:{marginBottom:16}}]}})),rn={h1:"h1",h2:"h2",h3:"h3",h4:"h4",h5:"h5",h6:"h6",subtitle1:"h6",subtitle2:"h6",body1:"p",body2:"p",inherit:"p"},di=p.forwardRef(function(e,o){const{color:n,...r}=ot({props:e,name:"MuiTypography"}),i=!si[n],s=ai({...r,...i&&{color:n}}),{align:a="inherit",className:l,component:c,gutterBottom:d=!1,noWrap:u=!1,paragraph:g=!1,variant:f="body1",variantMapping:m=rn,...b}=s,h={...s,align:a,color:n,className:l,component:c,gutterBottom:d,noWrap:u,paragraph:g,variant:f,variantMapping:m},x=c||(g?"p":m[f]||rn[f])||"span",C=li(h);return S.jsx(ci,{as:x,ref:o,className:z(C.root,l),...b,ownerState:h,style:{...a!=="inherit"&&{"--Typography-textAlign":a},...b.style}})});function pi(t,e){if(!t)return e;if(typeof t=="function"||typeof e=="function")return r=>{const i=typeof e=="function"?e(r):e,s=typeof t=="function"?t({...r,...i}):t,a=z(r==null?void 0:r.className,i==null?void 0:i.className,s==null?void 0:s.className);return{...i,...s,...!!a&&{className:a},...(i==null?void 0:i.style)&&(s==null?void 0:s.style)&&{style:{...i.style,...s.style}},...(i==null?void 0:i.sx)&&(s==null?void 0:s.sx)&&{sx:[...Array.isArray(i.sx)?i.sx:[i.sx],...Array.isArray(s.sx)?s.sx:[s.sx]]}}};const o=e,n=z(o==null?void 0:o.className,t==null?void 0:t.className);return{...e,...t,...!!n&&{className:n},...(o==null?void 0:o.style)&&(t==null?void 0:t.style)&&{style:{...o.style,...t.style}},...(o==null?void 0:o.sx)&&(t==null?void 0:t.sx)&&{sx:[...Array.isArray(o.sx)?o.sx:[o.sx],...Array.isArray(t.sx)?t.sx:[t.sx]]}}}class eo{static create(){return new eo}static use(){const e=or(eo.create).current,[o,n]=p.useState(!1);return e.shouldMount=o,e.setShouldMount=n,p.useEffect(e.mountEffect,[o]),e}constructor(){this.ref={current:null},this.mounted=null,this.didMount=!1,this.shouldMount=!1,this.setShouldMount=null}mount(){return this.mounted||(this.mounted=fi(),this.shouldMount=!0,this.setShouldMount(this.shouldMount)),this.mounted}mountEffect=()=>{this.shouldMount&&!this.didMount&&this.ref.current!==null&&(this.didMount=!0,this.mounted.resolve())};start(...e){this.mount().then(()=>{var o;return(o=this.ref.current)==null?void 0:o.start(...e)})}stop(...e){this.mount().then(()=>{var o;return(o=this.ref.current)==null?void 0:o.stop(...e)})}pulsate(...e){this.mount().then(()=>{var o;return(o=this.ref.current)==null?void 0:o.pulsate(...e)})}}function ui(){return eo.use()}function fi(){let t,e;const o=new Promise((n,r)=>{t=n,e=r});return o.resolve=t,o.reject=e,o}function yo(t,e){return yo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(o,n){return o.__proto__=n,o},yo(t,e)}function dr(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,yo(t,e)}const sn={disabled:!1},oo=Gt.createContext(null);var vi=function(e){return e.scrollTop},Le="unmounted",le="exited",ce="entering",xe="entered",xo="exiting",Kt=function(t){dr(e,t);function e(n,r){var i;i=t.call(this,n,r)||this;var s=r,a=s&&!s.isMounting?n.enter:n.appear,l;return i.appearStatus=null,n.in?a?(l=le,i.appearStatus=ce):l=xe:n.unmountOnExit||n.mountOnEnter?l=Le:l=le,i.state={status:l},i.nextCallback=null,i}e.getDerivedStateFromProps=function(r,i){var s=r.in;return s&&i.status===Le?{status:le}:null};var o=e.prototype;return o.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},o.componentDidUpdate=function(r){var i=null;if(r!==this.props){var s=this.state.status;this.props.in?s!==ce&&s!==xe&&(i=ce):(s===ce||s===xe)&&(i=xo)}this.updateStatus(!1,i)},o.componentWillUnmount=function(){this.cancelNextCallback()},o.getTimeouts=function(){var r=this.props.timeout,i,s,a;return i=s=a=r,r!=null&&typeof r!="number"&&(i=r.exit,s=r.enter,a=r.appear!==void 0?r.appear:s),{exit:i,enter:s,appear:a}},o.updateStatus=function(r,i){if(r===void 0&&(r=!1),i!==null)if(this.cancelNextCallback(),i===ce){if(this.props.unmountOnExit||this.props.mountOnEnter){var s=this.props.nodeRef?this.props.nodeRef.current:Ge.findDOMNode(this);s&&vi(s)}this.performEnter(r)}else this.performExit();else this.props.unmountOnExit&&this.state.status===le&&this.setState({status:Le})},o.performEnter=function(r){var i=this,s=this.props.enter,a=this.context?this.context.isMounting:r,l=this.props.nodeRef?[a]:[Ge.findDOMNode(this),a],c=l[0],d=l[1],u=this.getTimeouts(),g=a?u.appear:u.enter;if(!r&&!s||sn.disabled){this.safeSetState({status:xe},function(){i.props.onEntered(c)});return}this.props.onEnter(c,d),this.safeSetState({status:ce},function(){i.props.onEntering(c,d),i.onTransitionEnd(g,function(){i.safeSetState({status:xe},function(){i.props.onEntered(c,d)})})})},o.performExit=function(){var r=this,i=this.props.exit,s=this.getTimeouts(),a=this.props.nodeRef?void 0:Ge.findDOMNode(this);if(!i||sn.disabled){this.safeSetState({status:le},function(){r.props.onExited(a)});return}this.props.onExit(a),this.safeSetState({status:xo},function(){r.props.onExiting(a),r.onTransitionEnd(s.exit,function(){r.safeSetState({status:le},function(){r.props.onExited(a)})})})},o.cancelNextCallback=function(){this.nextCallback!==null&&(this.nextCallback.cancel(),this.nextCallback=null)},o.safeSetState=function(r,i){i=this.setNextCallback(i),this.setState(r,i)},o.setNextCallback=function(r){var i=this,s=!0;return this.nextCallback=function(a){s&&(s=!1,i.nextCallback=null,r(a))},this.nextCallback.cancel=function(){s=!1},this.nextCallback},o.onTransitionEnd=function(r,i){this.setNextCallback(i);var s=this.props.nodeRef?this.props.nodeRef.current:Ge.findDOMNode(this),a=r==null&&!this.props.addEndListener;if(!s||a){setTimeout(this.nextCallback,0);return}if(this.props.addEndListener){var l=this.props.nodeRef?[this.nextCallback]:[s,this.nextCallback],c=l[0],d=l[1];this.props.addEndListener(c,d)}r!=null&&setTimeout(this.nextCallback,r)},o.render=function(){var r=this.state.status;if(r===Le)return null;var i=this.props,s=i.children;i.in,i.mountOnEnter,i.unmountOnExit,i.appear,i.enter,i.exit,i.timeout,i.addEndListener,i.onEnter,i.onEntering,i.onEntered,i.onExit,i.onExiting,i.onExited,i.nodeRef;var a=Zn(i,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]);return Gt.createElement(oo.Provider,{value:null},typeof s=="function"?s(r,a):Gt.cloneElement(Gt.Children.only(s),a))},e}(Gt.Component);Kt.contextType=oo;Kt.propTypes={};function ye(){}Kt.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:ye,onEntering:ye,onEntered:ye,onExit:ye,onExiting:ye,onExited:ye};Kt.UNMOUNTED=Le;Kt.EXITED=le;Kt.ENTERING=ce;Kt.ENTERED=xe;Kt.EXITING=xo;function mi(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Lo(t,e){var o=function(i){return e&&p.isValidElement(i)?e(i):i},n=Object.create(null);return t&&p.Children.map(t,function(r){return r}).forEach(function(r){n[r.key]=o(r)}),n}function gi(t,e){t=t||{},e=e||{};function o(d){return d in e?e[d]:t[d]}var n=Object.create(null),r=[];for(var i in t)i in e?r.length&&(n[i]=r,r=[]):r.push(i);var s,a={};for(var l in e){if(n[l])for(s=0;s<n[l].length;s++){var c=n[l][s];a[n[l][s]]=o(c)}a[l]=o(l)}for(s=0;s<r.length;s++)a[r[s]]=o(r[s]);return a}function de(t,e,o){return o[e]!=null?o[e]:t.props[e]}function hi(t,e){return Lo(t.children,function(o){return p.cloneElement(o,{onExited:e.bind(null,o),in:!0,appear:de(o,"appear",t),enter:de(o,"enter",t),exit:de(o,"exit",t)})})}function bi(t,e,o){var n=Lo(t.children),r=gi(e,n);return Object.keys(r).forEach(function(i){var s=r[i];if(p.isValidElement(s)){var a=i in e,l=i in n,c=e[i],d=p.isValidElement(c)&&!c.props.in;l&&(!a||d)?r[i]=p.cloneElement(s,{onExited:o.bind(null,s),in:!0,exit:de(s,"exit",t),enter:de(s,"enter",t)}):!l&&a&&!d?r[i]=p.cloneElement(s,{in:!1}):l&&a&&p.isValidElement(c)&&(r[i]=p.cloneElement(s,{onExited:o.bind(null,s),in:c.props.in,exit:de(s,"exit",t),enter:de(s,"enter",t)}))}}),r}var yi=Object.values||function(t){return Object.keys(t).map(function(e){return t[e]})},xi={component:"div",childFactory:function(e){return e}},No=function(t){dr(e,t);function e(n,r){var i;i=t.call(this,n,r)||this;var s=i.handleExited.bind(mi(i));return i.state={contextValue:{isMounting:!0},handleExited:s,firstRender:!0},i}var o=e.prototype;return o.componentDidMount=function(){this.mounted=!0,this.setState({contextValue:{isMounting:!1}})},o.componentWillUnmount=function(){this.mounted=!1},e.getDerivedStateFromProps=function(r,i){var s=i.children,a=i.handleExited,l=i.firstRender;return{children:l?hi(r,a):bi(r,s,a),firstRender:!1}},o.handleExited=function(r,i){var s=Lo(this.props.children);r.key in s||(r.props.onExited&&r.props.onExited(i),this.mounted&&this.setState(function(a){var l=Gr({},a.children);return delete l[r.key],{children:l}}))},o.render=function(){var r=this.props,i=r.component,s=r.childFactory,a=Zn(r,["component","childFactory"]),l=this.state.contextValue,c=yi(this.state.children).map(s);return delete a.appear,delete a.enter,delete a.exit,i===null?Gt.createElement(oo.Provider,{value:l},c):Gt.createElement(oo.Provider,{value:l},Gt.createElement(i,a,c))},e}(Gt.Component);No.propTypes={};No.defaultProps=xi;function Ci(t){const{className:e,classes:o,pulsate:n=!1,rippleX:r,rippleY:i,rippleSize:s,in:a,onExited:l,timeout:c}=t,[d,u]=p.useState(!1),g=z(e,o.ripple,o.rippleVisible,n&&o.ripplePulsate),f={width:s,height:s,top:-(s/2)+i,left:-(s/2)+r},m=z(o.child,d&&o.childLeaving,n&&o.childPulsate);return!a&&!d&&u(!0),p.useEffect(()=>{if(!a&&l!=null){const b=setTimeout(l,c);return()=>{clearTimeout(b)}}},[l,a,c]),S.jsx("span",{className:g,style:f,children:S.jsx("span",{className:m})})}function Id(t){return Q("MuiTouchRipple",t)}const Ot=Y("MuiTouchRipple",["root","ripple","rippleVisible","ripplePulsate","child","childLeaving","childPulsate"]),Co=550,Si=80,wi=Ft.keyframes`
1
+ import{R as zn,c as z,a7 as Wr,T as Wn,a as Y,g as Q,y as ot,j as S,s as D,e as N,b as et,z as st,d as pt,A as Vt,o as Un,a2 as Go,w as Ur,P as Hr}from"./DefaultPropsProvider-Beyggw1o.js";import{e as Vr,t as Kr,a as Qt,b as Rt,v as _r,g as Bt,R as Ge,l as Zt,o as Mt,i as Hn,I as Vn,w as Kn,x as _n,y as Xn,z as qn,c as Ee,m as We,A as Xr,B as ho,C as Gn,d as Ue,s as Yo,p as qr,k as Oo,n as bo,u as io,F as Yn}from"./FilledInput-Bfz0Aef-.js";import{i as p,a as Qn,R as Gt}from"./iobroker_admin__loadShare__react__loadShare__-T96CJO0k.js";import"./iobroker_admin__loadShare__prop_mf_2_types__loadShare__-C8Lvs8Es.js";import{c as so}from"./createSvgIcon-DHNqxcCi.js";import{i as Ft}from"./iobroker_admin__loadShare___mf_0_emotion_mf_1_react__loadShare__-gw2iqPBS.js";import{_ as Gr}from"./extends-CF3RwP-h.js";function Zn(t,e){if(t==null)return{};var o={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(e.indexOf(n)!==-1)continue;o[n]=t[n]}return o}function Jn(t){const{theme:e,name:o,props:n}=t;return!e||!e.components||!e.components[o]||!e.components[o].defaultProps?n:zn(e.components[o].defaultProps,n)}function Yr({props:t,name:e,defaultTheme:o,themeId:n}){let r=Vr(o);return n&&(r=r[n]||r),Jn({theme:r,name:e,props:t})}function Qr(t,e,o,n,r){const[i,s]=p.useState(()=>r&&o?o(t).matches:n?n(t).matches:e);return Qt(()=>{if(!o)return;const a=o(t),l=()=>{s(a.matches)};return l(),a.addEventListener("change",l),()=>{a.removeEventListener("change",l)}},[t,o]),i}const Zr={...Qn},tr=Zr.useSyncExternalStore;function Jr(t,e,o,n,r){const i=p.useCallback(()=>e,[e]),s=p.useMemo(()=>{if(r&&o)return()=>o(t).matches;if(n!==null){const{matches:d}=n(t);return()=>d}return i},[i,t,n,r,o]),[a,l]=p.useMemo(()=>{if(o===null)return[i,()=>()=>{}];const d=o(t);return[()=>d.matches,u=>(d.addEventListener("change",u),()=>{d.removeEventListener("change",u)})]},[i,o,t]);return tr(l,a,s)}function er(t={}){const{themeId:e}=t;return function(n,r={}){let i=Kr();i&&e&&(i=i[e]||i);const s=typeof window<"u"&&typeof window.matchMedia<"u",{defaultMatches:a=!1,matchMedia:l=s?window.matchMedia:null,ssrMatchMedia:c=null,noSsr:d=!1}=Jn({name:"MuiUseMediaQuery",props:r,theme:i});let u=typeof n=="function"?n(i):n;return u=u.replace(/^@media( ?)/m,""),(tr!==void 0?Jr:Qr)(u,a,l,c,d)}}er();function Qo(...t){return t.reduce((e,o)=>o==null?e:function(...r){e.apply(this,r),o.apply(this,r)},()=>{})}function Je(t,e){var o,n,r;return p.isValidElement(t)&&e.indexOf(t.type.muiName??((r=(n=(o=t.type)==null?void 0:o._payload)==null?void 0:n.value)==null?void 0:r.muiName))!==-1}let Zo=0;function ti(t){const[e,o]=p.useState(t),n=t||e;return p.useEffect(()=>{e==null&&(Zo+=1,o(`mui-${Zo}`))},[e]),n}const ei={...Qn},Jo=ei.useId;function He(t){if(Jo!==void 0){const e=Jo();return t??e}return ti(t)}function tn({controlled:t,default:e,name:o,state:n="value"}){const{current:r}=p.useRef(t!==void 0),[i,s]=p.useState(e),a=r?t:i,l=p.useCallback(c=>{r||s(c)},[]);return[a,l]}function Yt(t){const e=p.useRef(t);return Qt(()=>{e.current=t}),p.useRef((...o)=>(0,e.current)(...o)).current}const en={};function or(t,e){const o=p.useRef(en);return o.current===en&&(o.current=t(e)),o}const oi=[];function ni(t){p.useEffect(t,oi)}class Bo{static create(){return new Bo}currentId=null;start(e,o){this.clear(),this.currentId=setTimeout(()=>{this.currentId=null,o()},e)}clear=()=>{this.currentId!==null&&(clearTimeout(this.currentId),this.currentId=null)};disposeEffect=()=>this.clear}function nr(){const t=or(Bo.create).current;return ni(t.disposeEffect),t}function on(t){try{return t.matches(":focus-visible")}catch{}return!1}function rr(t=window){const e=t.document.documentElement.clientWidth;return t.innerWidth-e}const hd={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",whiteSpace:"nowrap",width:"1px"};function ri(t){return typeof t=="string"}function ir(t,e,o){return t===void 0||ri(t)?e:{...e,ownerState:{...e.ownerState,...o}}}function sr(t,e=[]){if(t===void 0)return{};const o={};return Object.keys(t).filter(n=>n.match(/^on[A-Z]/)&&typeof t[n]=="function"&&!e.includes(n)).forEach(n=>{o[n]=t[n]}),o}function nn(t){if(t===void 0)return{};const e={};return Object.keys(t).filter(o=>!(o.match(/^on[A-Z]/)&&typeof t[o]=="function")).forEach(o=>{e[o]=t[o]}),e}function ar(t){const{getSlotProps:e,additionalProps:o,externalSlotProps:n,externalForwardedProps:r,className:i}=t;if(!e){const f=z(o==null?void 0:o.className,i,r==null?void 0:r.className,n==null?void 0:n.className),m={...o==null?void 0:o.style,...r==null?void 0:r.style,...n==null?void 0:n.style},b={...o,...r,...n};return f.length>0&&(b.className=f),Object.keys(m).length>0&&(b.style=m),{props:b,internalRef:void 0}}const s=sr({...r,...n}),a=nn(n),l=nn(r),c=e(s),d=z(c==null?void 0:c.className,o==null?void 0:o.className,i,r==null?void 0:r.className,n==null?void 0:n.className),u={...c==null?void 0:c.style,...o==null?void 0:o.style,...r==null?void 0:r.style,...n==null?void 0:n.style},g={...c,...o,...l,...a};return d.length>0&&(g.className=d),Object.keys(u).length>0&&(g.style=u),{props:g,internalRef:c.ref}}function lr(t,e,o){return typeof t=="function"?t(e,o):t}function Ce(t){var u;const{elementType:e,externalSlotProps:o,ownerState:n,skipResolvingSlotProps:r=!1,...i}=t,s=r?{}:lr(o,n),{props:a,internalRef:l}=ar({...i,externalSlotProps:s}),c=Rt(l,s==null?void 0:s.ref,(u=t.additionalProps)==null?void 0:u.ref);return ir(e,{...a,ref:c},n)}function Ve(t){var e;return parseInt(p.version,10)>=19?((e=t==null?void 0:t.props)==null?void 0:e.ref)||null:(t==null?void 0:t.ref)||null}function bd(t){return String(parseFloat(t)).length===String(t).length}function cr(t){return String(t).match(/[\d.\-+]*\s*(.*)/)[1]||""}function oe(t){return parseFloat(t)}function yd(t){return(e,o)=>{const n=cr(e);if(n===o)return e;let r=oe(e);n!=="px"&&(n==="em"||n==="rem")&&(r=oe(e)*oe(t));let i=r;if(o!=="px")if(o==="em")i=r/oe(t);else if(o==="rem")i=r/oe(t);else return e;return parseFloat(i.toFixed(5))+o}}function xd({size:t,grid:e}){const o=t-t%e,n=o+e;return t-o<n-t?o:n}function Cd({lineHeight:t,pixels:e,htmlFontSize:o}){return e/(t*o)}function Sd({cssProperty:t,min:e,max:o,unit:n="rem",breakpoints:r=[600,900,1200],transform:i=null}){const s={[t]:`${e}${n}`},a=(o-e)/r[r.length-1];return r.forEach(l=>{let c=e+a*l;i!==null&&(c=i(c)),s[`@media (min-width:${l}px)`]={[t]:`${Math.round(c*1e4)/1e4}${n}`}}),s}function wd({props:t,name:e}){return Yr({props:t,name:e,defaultTheme:Wr,themeId:Wn})}function ii(t){return Q("MuiTypography",t)}const Rd=Y("MuiTypography",["root","h1","h2","h3","h4","h5","h6","subtitle1","subtitle2","body1","body2","inherit","button","caption","overline","alignLeft","alignRight","alignCenter","alignJustify","noWrap","gutterBottom","paragraph"]),si={primary:!0,secondary:!0,error:!0,info:!0,success:!0,warning:!0,textPrimary:!0,textSecondary:!0,textDisabled:!0},ai=_r(),li=t=>{const{align:e,gutterBottom:o,noWrap:n,paragraph:r,variant:i,classes:s}=t,a={root:["root",i,t.align!=="inherit"&&`align${N(e)}`,o&&"gutterBottom",n&&"noWrap",r&&"paragraph"]};return et(a,ii,s)},ci=D("span",{name:"MuiTypography",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:o}=t;return[e.root,o.variant&&e[o.variant],o.align!=="inherit"&&e[`align${N(o.align)}`],o.noWrap&&e.noWrap,o.gutterBottom&&e.gutterBottom,o.paragraph&&e.paragraph]}})(st(({theme:t})=>{var e;return{margin:0,variants:[{props:{variant:"inherit"},style:{font:"inherit",lineHeight:"inherit",letterSpacing:"inherit"}},...Object.entries(t.typography).filter(([o,n])=>o!=="inherit"&&n&&typeof n=="object").map(([o,n])=>({props:{variant:o},style:n})),...Object.entries(t.palette).filter(Bt()).map(([o])=>({props:{color:o},style:{color:(t.vars||t).palette[o].main}})),...Object.entries(((e=t.palette)==null?void 0:e.text)||{}).filter(([,o])=>typeof o=="string").map(([o])=>({props:{color:`text${N(o)}`},style:{color:(t.vars||t).palette.text[o]}})),{props:({ownerState:o})=>o.align!=="inherit",style:{textAlign:"var(--Typography-textAlign)"}},{props:({ownerState:o})=>o.noWrap,style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},{props:({ownerState:o})=>o.gutterBottom,style:{marginBottom:"0.35em"}},{props:({ownerState:o})=>o.paragraph,style:{marginBottom:16}}]}})),rn={h1:"h1",h2:"h2",h3:"h3",h4:"h4",h5:"h5",h6:"h6",subtitle1:"h6",subtitle2:"h6",body1:"p",body2:"p",inherit:"p"},di=p.forwardRef(function(e,o){const{color:n,...r}=ot({props:e,name:"MuiTypography"}),i=!si[n],s=ai({...r,...i&&{color:n}}),{align:a="inherit",className:l,component:c,gutterBottom:d=!1,noWrap:u=!1,paragraph:g=!1,variant:f="body1",variantMapping:m=rn,...b}=s,h={...s,align:a,color:n,className:l,component:c,gutterBottom:d,noWrap:u,paragraph:g,variant:f,variantMapping:m},x=c||(g?"p":m[f]||rn[f])||"span",C=li(h);return S.jsx(ci,{as:x,ref:o,className:z(C.root,l),...b,ownerState:h,style:{...a!=="inherit"&&{"--Typography-textAlign":a},...b.style}})});function pi(t,e){if(!t)return e;if(typeof t=="function"||typeof e=="function")return r=>{const i=typeof e=="function"?e(r):e,s=typeof t=="function"?t({...r,...i}):t,a=z(r==null?void 0:r.className,i==null?void 0:i.className,s==null?void 0:s.className);return{...i,...s,...!!a&&{className:a},...(i==null?void 0:i.style)&&(s==null?void 0:s.style)&&{style:{...i.style,...s.style}},...(i==null?void 0:i.sx)&&(s==null?void 0:s.sx)&&{sx:[...Array.isArray(i.sx)?i.sx:[i.sx],...Array.isArray(s.sx)?s.sx:[s.sx]]}}};const o=e,n=z(o==null?void 0:o.className,t==null?void 0:t.className);return{...e,...t,...!!n&&{className:n},...(o==null?void 0:o.style)&&(t==null?void 0:t.style)&&{style:{...o.style,...t.style}},...(o==null?void 0:o.sx)&&(t==null?void 0:t.sx)&&{sx:[...Array.isArray(o.sx)?o.sx:[o.sx],...Array.isArray(t.sx)?t.sx:[t.sx]]}}}class eo{static create(){return new eo}static use(){const e=or(eo.create).current,[o,n]=p.useState(!1);return e.shouldMount=o,e.setShouldMount=n,p.useEffect(e.mountEffect,[o]),e}constructor(){this.ref={current:null},this.mounted=null,this.didMount=!1,this.shouldMount=!1,this.setShouldMount=null}mount(){return this.mounted||(this.mounted=fi(),this.shouldMount=!0,this.setShouldMount(this.shouldMount)),this.mounted}mountEffect=()=>{this.shouldMount&&!this.didMount&&this.ref.current!==null&&(this.didMount=!0,this.mounted.resolve())};start(...e){this.mount().then(()=>{var o;return(o=this.ref.current)==null?void 0:o.start(...e)})}stop(...e){this.mount().then(()=>{var o;return(o=this.ref.current)==null?void 0:o.stop(...e)})}pulsate(...e){this.mount().then(()=>{var o;return(o=this.ref.current)==null?void 0:o.pulsate(...e)})}}function ui(){return eo.use()}function fi(){let t,e;const o=new Promise((n,r)=>{t=n,e=r});return o.resolve=t,o.reject=e,o}function yo(t,e){return yo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(o,n){return o.__proto__=n,o},yo(t,e)}function dr(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,yo(t,e)}const sn={disabled:!1},oo=Gt.createContext(null);var vi=function(e){return e.scrollTop},Le="unmounted",le="exited",ce="entering",xe="entered",xo="exiting",Kt=function(t){dr(e,t);function e(n,r){var i;i=t.call(this,n,r)||this;var s=r,a=s&&!s.isMounting?n.enter:n.appear,l;return i.appearStatus=null,n.in?a?(l=le,i.appearStatus=ce):l=xe:n.unmountOnExit||n.mountOnEnter?l=Le:l=le,i.state={status:l},i.nextCallback=null,i}e.getDerivedStateFromProps=function(r,i){var s=r.in;return s&&i.status===Le?{status:le}:null};var o=e.prototype;return o.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},o.componentDidUpdate=function(r){var i=null;if(r!==this.props){var s=this.state.status;this.props.in?s!==ce&&s!==xe&&(i=ce):(s===ce||s===xe)&&(i=xo)}this.updateStatus(!1,i)},o.componentWillUnmount=function(){this.cancelNextCallback()},o.getTimeouts=function(){var r=this.props.timeout,i,s,a;return i=s=a=r,r!=null&&typeof r!="number"&&(i=r.exit,s=r.enter,a=r.appear!==void 0?r.appear:s),{exit:i,enter:s,appear:a}},o.updateStatus=function(r,i){if(r===void 0&&(r=!1),i!==null)if(this.cancelNextCallback(),i===ce){if(this.props.unmountOnExit||this.props.mountOnEnter){var s=this.props.nodeRef?this.props.nodeRef.current:Ge.findDOMNode(this);s&&vi(s)}this.performEnter(r)}else this.performExit();else this.props.unmountOnExit&&this.state.status===le&&this.setState({status:Le})},o.performEnter=function(r){var i=this,s=this.props.enter,a=this.context?this.context.isMounting:r,l=this.props.nodeRef?[a]:[Ge.findDOMNode(this),a],c=l[0],d=l[1],u=this.getTimeouts(),g=a?u.appear:u.enter;if(!r&&!s||sn.disabled){this.safeSetState({status:xe},function(){i.props.onEntered(c)});return}this.props.onEnter(c,d),this.safeSetState({status:ce},function(){i.props.onEntering(c,d),i.onTransitionEnd(g,function(){i.safeSetState({status:xe},function(){i.props.onEntered(c,d)})})})},o.performExit=function(){var r=this,i=this.props.exit,s=this.getTimeouts(),a=this.props.nodeRef?void 0:Ge.findDOMNode(this);if(!i||sn.disabled){this.safeSetState({status:le},function(){r.props.onExited(a)});return}this.props.onExit(a),this.safeSetState({status:xo},function(){r.props.onExiting(a),r.onTransitionEnd(s.exit,function(){r.safeSetState({status:le},function(){r.props.onExited(a)})})})},o.cancelNextCallback=function(){this.nextCallback!==null&&(this.nextCallback.cancel(),this.nextCallback=null)},o.safeSetState=function(r,i){i=this.setNextCallback(i),this.setState(r,i)},o.setNextCallback=function(r){var i=this,s=!0;return this.nextCallback=function(a){s&&(s=!1,i.nextCallback=null,r(a))},this.nextCallback.cancel=function(){s=!1},this.nextCallback},o.onTransitionEnd=function(r,i){this.setNextCallback(i);var s=this.props.nodeRef?this.props.nodeRef.current:Ge.findDOMNode(this),a=r==null&&!this.props.addEndListener;if(!s||a){setTimeout(this.nextCallback,0);return}if(this.props.addEndListener){var l=this.props.nodeRef?[this.nextCallback]:[s,this.nextCallback],c=l[0],d=l[1];this.props.addEndListener(c,d)}r!=null&&setTimeout(this.nextCallback,r)},o.render=function(){var r=this.state.status;if(r===Le)return null;var i=this.props,s=i.children;i.in,i.mountOnEnter,i.unmountOnExit,i.appear,i.enter,i.exit,i.timeout,i.addEndListener,i.onEnter,i.onEntering,i.onEntered,i.onExit,i.onExiting,i.onExited,i.nodeRef;var a=Zn(i,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]);return Gt.createElement(oo.Provider,{value:null},typeof s=="function"?s(r,a):Gt.cloneElement(Gt.Children.only(s),a))},e}(Gt.Component);Kt.contextType=oo;Kt.propTypes={};function ye(){}Kt.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:ye,onEntering:ye,onEntered:ye,onExit:ye,onExiting:ye,onExited:ye};Kt.UNMOUNTED=Le;Kt.EXITED=le;Kt.ENTERING=ce;Kt.ENTERED=xe;Kt.EXITING=xo;function mi(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Lo(t,e){var o=function(i){return e&&p.isValidElement(i)?e(i):i},n=Object.create(null);return t&&p.Children.map(t,function(r){return r}).forEach(function(r){n[r.key]=o(r)}),n}function gi(t,e){t=t||{},e=e||{};function o(d){return d in e?e[d]:t[d]}var n=Object.create(null),r=[];for(var i in t)i in e?r.length&&(n[i]=r,r=[]):r.push(i);var s,a={};for(var l in e){if(n[l])for(s=0;s<n[l].length;s++){var c=n[l][s];a[n[l][s]]=o(c)}a[l]=o(l)}for(s=0;s<r.length;s++)a[r[s]]=o(r[s]);return a}function de(t,e,o){return o[e]!=null?o[e]:t.props[e]}function hi(t,e){return Lo(t.children,function(o){return p.cloneElement(o,{onExited:e.bind(null,o),in:!0,appear:de(o,"appear",t),enter:de(o,"enter",t),exit:de(o,"exit",t)})})}function bi(t,e,o){var n=Lo(t.children),r=gi(e,n);return Object.keys(r).forEach(function(i){var s=r[i];if(p.isValidElement(s)){var a=i in e,l=i in n,c=e[i],d=p.isValidElement(c)&&!c.props.in;l&&(!a||d)?r[i]=p.cloneElement(s,{onExited:o.bind(null,s),in:!0,exit:de(s,"exit",t),enter:de(s,"enter",t)}):!l&&a&&!d?r[i]=p.cloneElement(s,{in:!1}):l&&a&&p.isValidElement(c)&&(r[i]=p.cloneElement(s,{onExited:o.bind(null,s),in:c.props.in,exit:de(s,"exit",t),enter:de(s,"enter",t)}))}}),r}var yi=Object.values||function(t){return Object.keys(t).map(function(e){return t[e]})},xi={component:"div",childFactory:function(e){return e}},No=function(t){dr(e,t);function e(n,r){var i;i=t.call(this,n,r)||this;var s=i.handleExited.bind(mi(i));return i.state={contextValue:{isMounting:!0},handleExited:s,firstRender:!0},i}var o=e.prototype;return o.componentDidMount=function(){this.mounted=!0,this.setState({contextValue:{isMounting:!1}})},o.componentWillUnmount=function(){this.mounted=!1},e.getDerivedStateFromProps=function(r,i){var s=i.children,a=i.handleExited,l=i.firstRender;return{children:l?hi(r,a):bi(r,s,a),firstRender:!1}},o.handleExited=function(r,i){var s=Lo(this.props.children);r.key in s||(r.props.onExited&&r.props.onExited(i),this.mounted&&this.setState(function(a){var l=Gr({},a.children);return delete l[r.key],{children:l}}))},o.render=function(){var r=this.props,i=r.component,s=r.childFactory,a=Zn(r,["component","childFactory"]),l=this.state.contextValue,c=yi(this.state.children).map(s);return delete a.appear,delete a.enter,delete a.exit,i===null?Gt.createElement(oo.Provider,{value:l},c):Gt.createElement(oo.Provider,{value:l},Gt.createElement(i,a,c))},e}(Gt.Component);No.propTypes={};No.defaultProps=xi;function Ci(t){const{className:e,classes:o,pulsate:n=!1,rippleX:r,rippleY:i,rippleSize:s,in:a,onExited:l,timeout:c}=t,[d,u]=p.useState(!1),g=z(e,o.ripple,o.rippleVisible,n&&o.ripplePulsate),f={width:s,height:s,top:-(s/2)+i,left:-(s/2)+r},m=z(o.child,d&&o.childLeaving,n&&o.childPulsate);return!a&&!d&&u(!0),p.useEffect(()=>{if(!a&&l!=null){const b=setTimeout(l,c);return()=>{clearTimeout(b)}}},[l,a,c]),S.jsx("span",{className:g,style:f,children:S.jsx("span",{className:m})})}function Id(t){return Q("MuiTouchRipple",t)}const Ot=Y("MuiTouchRipple",["root","ripple","rippleVisible","ripplePulsate","child","childLeaving","childPulsate"]),Co=550,Si=80,wi=Ft.keyframes`
2
2
  0% {
3
3
  transform: scale(0);
4
4
  opacity: 0.1;
@@ -1 +1 @@
1
- import{j as t}from"./DefaultPropsProvider-Beyggw1o.js";import{X as P,Y as O,U as h,i,a as d,b as w,Z as F,f as b,_ as E,$ as N,a0 as W,a1 as z,h as B,T as R}from"./bootstrap-CoF0Rq1_.js";import{i as j}from"./iobroker_admin__loadShare__react__loadShare__-T96CJO0k.js";import{I as y,a as S,b as $}from"./Fields-vrlzBhCD.js";import A from"./user1-BHHH0LIq.js";import M from"./user2-BN56rMPt.js";import L from"./user3-Mx6XZSLK.js";import H from"./user4-DpEs_YiD.js";import Y from"./user5-CVfrnlXE.js";import q from"./user6-C7HkYnq4.js";import V from"./user7-VAQcubFn.js";import X from"./user8-CwACr_jq.js";import Z from"./user9-Dk4Mlhcc.js";import J from"./user10-Dvmqf8l1.js";import K from"./user11-C8ly5pY7.js";import Q from"./user12-CHtaF3qG.js";import ee from"./group1-DBYxcyxq.js";import te from"./group2-BUQSell7.js";import se from"./group3-B0AdMrOp.js";import oe from"./group4-TeCgDok7.js";import ie from"./group5-CJ_-VPxg.js";import re from"./group6-JW-nEhw_.js";import ne from"./group7-CWpVuR4T.js";import le from"./group8-CRGBxCwd.js";import ae from"./group9-BXRQchYG.js";import ce from"./group10-BIcZMfE3.js";import"./iobroker_admin__loadShare__prop_mf_2_types__loadShare__-C8Lvs8Es.js";import"./_commonjsHelpers-BosuxZz1.js";import"./iobroker_admin__mf_v__runtimeInit__mf_v__-VDoBF19b.js";import"./emotion-serialize.esm-BUa21YfQ.js";import"./iobroker_admin__loadShare___mf_0_emotion_mf_1_react__loadShare__-gw2iqPBS.js";import"./ace-BAuRYJjv.js";import"./FilledInput-Bfz0Aef-.js";import"./preload-helper-C1FmrZbK.js";import"./blueGrey-BKTirx-Z.js";import"./emotion-cache.browser.esm-B8BFze5o.js";import"./iobroker_admin__loadShare__leaflet__loadShare__-FMqZHPyC.js";import"./extends-CF3RwP-h.js";const k=e=>{const s=e.isDragging?0:1,o=h.getInvertedColor(e.user.common.color,e.themeType,!0),r={cursor:"grab",opacity:s,overflow:"hidden",color:o};return e.user.common.color&&(r.backgroundColor=e.user.common.color),t.jsx(i.Card,{style:r,sx:e.styles.userGroupCard2,children:t.jsxs("div",{style:e.styles.userCardContent,children:[t.jsxs("div",{style:e.styles.right,children:[t.jsx(i.Checkbox,{checked:e.user.common.enabled,style:{color:o},disabled:e.user.common.dontDelete,onChange:()=>{e.socket.extendObject(e.user._id,{common:{enabled:!e.user.common.enabled}}).then(()=>e.updateData())}}),t.jsx(i.IconButton,{size:"small",onClick:()=>e.showUserEditDialog(e.user,!1),children:t.jsx(d.Edit,{style:{color:o}})}),t.jsx(i.IconButton,{size:"small",onClick:()=>e.showUserDeleteDialog(e.user),disabled:e.user.common.dontDelete,children:t.jsx(d.Delete,{style:e.user.common.dontDelete?null:{color:o}})})]}),t.jsxs(i.CardContent,{children:[t.jsxs(i.Typography,{gutterBottom:!0,component:"div",style:e.styles.userGroupTitle,children:[e.user.common.icon?t.jsx(w,{style:e.styles.icon,src:e.user.common.icon}):t.jsx(d.Person,{style:e.styles.icon}),t.jsxs("div",{children:[t.jsxs("div",{children:[t.jsx("span",{style:e.styles.userGroupUserName,children:e.getText(e.user.common.name)}),t.jsxs("span",{style:e.styles.userGroupUserID,children:["[",e.user._id,"]"]})]}),t.jsx("span",{children:e.user.common.desc?t.jsx("div",{style:e.styles.description,children:e.getText(e.user.common.desc)}):null})]})]}),e.groups.find(n=>n.common.members&&n.common.members.includes(e.user._id))?t.jsxs("div",{children:[e.t("In groups"),":"]}):null,t.jsx("div",{children:e.groups.map(n=>{var m,p;if(!n.common.members||!n.common.members.includes(e.user._id))return null;const a=n&&((m=n.common)!=null&&m.color)?h.getInvertedColor(n.common.color,e.themeType,!0):o;return t.jsxs(i.Card,{variant:"outlined",sx:e.styles.userGroupMember,style:{color:a,borderColor:`${a}80`,background:((p=n.common)==null?void 0:p.color)||"inherit"},children:[n.common.icon?t.jsx(w,{style:e.styles.icon,src:n.common.icon}):t.jsx(d.Group,{style:e.styles.icon}),e.getText(n.common.name),t.jsx(i.IconButton,{size:"small",onClick:()=>e.removeUserFromGroup(e.user._id,n._id),children:t.jsx(d.Clear,{style:{color:a}})})]},n._id)})})]})]})})},de=e=>{const s=j.useRef(),[{isDragging:o},r,n]=P({type:"user",item:()=>{var a;return{userId:e.user._id,preview:t.jsx("div",{style:{width:(a=s.current)==null?void 0:a.offsetWidth},children:t.jsx(k,{...e})})}},end:(a,m)=>{const p=m.getDropResult();a&&p&&e.addUserToGroup(a.userId,p.groupId)},collect:a=>({isDragging:a.isDragging(),handlerId:a.getHandlerId()})});return j.useEffect(()=>{n(O(),{captureDraggingState:!0})},[n]),t.jsx("div",{ref:r,children:t.jsx("div",{ref:s,children:t.jsx(k,{isDragging:o,...e})})})};function he(e,s){return s.group.common.members?!s.group.common.members.includes(e.getItem().userId):!0}const me=e=>{var D;const[{CanDrop:s,isOver:o},r]=F(()=>({accept:"user",drop:()=>({groupId:e.group._id}),canDrop:(g,c)=>he(c,e),collect:g=>({isOver:g.isOver(),CanDrop:g.canDrop()})}),[e.group.common.members]);let n=.7,a;s&&o?(n=s?1:.125,a=e.styles.userGroupCardSecondary):s&&(n=s?.75:.25);const p=h.getInvertedColor(e.group.common.color,e.themeType,!0),x={opacity:n,overflow:"hidden",color:p};return e.group.common.color&&(x.backgroundColor=e.group.common.color),t.jsxs(i.Card,{style:x,ref:r,sx:h.getStyle(e.theme,e.styles.userGroupCard2,a),children:[t.jsxs("div",{style:e.styles.right,children:[t.jsx(i.IconButton,{size:"small",onClick:()=>e.showGroupEditDialog(e.group,!1),children:t.jsx(d.Edit,{style:{color:p}})}),t.jsx(i.IconButton,{size:"small",onClick:()=>e.showGroupDeleteDialog(e.group),disabled:e.group.common.dontDelete,children:t.jsx(d.Delete,{style:e.group.common.dontDelete?null:{color:p}})})]}),t.jsxs(i.CardContent,{children:[t.jsxs(i.Typography,{gutterBottom:!0,component:"div",style:e.styles.userGroupTitle,children:[e.group.common.icon?t.jsx(w,{style:e.styles.icon,src:e.group.common.icon}):t.jsx(d.Group,{style:e.styles.icon}),t.jsxs("div",{children:[t.jsxs("div",{children:[t.jsx("span",{style:e.styles.userGroupUserName,children:e.getText(e.group.common.name)}),t.jsxs("span",{children:["[",e.group._id,"]"]})]}),e.group.common.desc?t.jsx("div",{style:e.styles.description,children:e.getText(e.group.common.desc)}):null]})]}),(D=e.group.common.members)!=null&&D.length?t.jsxs("div",{children:[e.t("Group members"),":"]}):null,t.jsx("div",{children:(e.group.common.members||[]).map((g,c)=>{var G,T;const l=e.users.find(I=>I._id===g),f=l&&((G=l.common)!=null&&G.color)?h.getInvertedColor(l.common.color,e.themeType,!0):p;return l?t.jsxs(i.Card,{variant:"outlined",sx:e.styles.userGroupMember,style:{color:f,borderColor:`${f}40`,background:((T=l.common)==null?void 0:T.color)||"inherit"},children:[l.common.icon?t.jsx(w,{style:e.styles.icon,src:l.common.icon}):t.jsx(d.Person,{style:e.styles.icon}),e.getText(l.common.name),t.jsx(i.IconButton,{size:"small",onClick:()=>e.removeUserFromGroup(g,e.group._id),children:t.jsx(d.Clear,{style:{color:f}})})]},c):null})})]})]})},_=[A,M,L,H,Y,q,V,X,Z,J,K,Q],pe={contentRoot:{padding:"16px 24px"}};class ue extends j.Component{constructor(s){super(s),this.state={originalId:s.user._id,passwordRepeat:s.user.common.password}}componentDidMount(){if(this.props.isNew){const s=_[Math.round(Math.random()*(_.length-1))];s&&h.getSvg(s).then(o=>{const r=h.clone(this.props.user);r.common.icon=o,this.props.onChange(r)})}}render(){const s=this.props.users.find(c=>c._id===this.props.user._id),o=this.props.user._id!==this.state.originalId,r=c=>c.split(".").pop(),n=c=>c.replace(h.FORBIDDEN_CHARS,"_").replace(/\s/g,"_").replace(/\./g,"_").replace(/,/g,"_").replace(/__/g,"_").replace(/__/g,"_").toLowerCase(),a=(c,l)=>{const f=c.split(".");return f[f.length-1]=l,f.join(".")},m=this.props.getText(this.props.user.common.desc),p=this.props.getText(this.props.user.common.name),x=b.checkPassword(this.props.user.common.password),D=b.checkPassword(this.props.user.common.password,this.state.passwordRepeat);let g=this.props.user._id!=="system.user."&&!x&&!D;return(this.props.isNew&&s||s&&o)&&(g=!1),t.jsxs(i.Dialog,{fullWidth:this.props.innerWidth<500,open:!0,onClose:(c,l)=>{l!=="backdropClick"&&l!=="escapeKeyDown"&&this.props.onClose()},children:[t.jsx(i.DialogTitle,{style:{...this.props.styles.dialogTitle,padding:12},children:this.props.t("User parameters")}),t.jsx(i.DialogContent,{sx:{"&.MuiDialogContent-root":{...this.props.innerWidth<500?this.props.styles.narrowContent:void 0,...pe.contentRoot}},children:t.jsxs(i.Grid2,{container:!0,spacing:this.props.innerWidth<500?1:4,style:this.props.styles.dialog,children:[t.jsx(i.Grid2,{size:{xs:12,md:6},children:t.jsx(y,{label:"Name",t:this.props.t,value:p,onChange:c=>{const l=h.clone(this.props.user);!this.props.user.common.dontDelete&&n(this.props.getText(l.common.name))===r(l._id)&&(l._id=a(l._id,n(c))),l.common.name=c,this.props.onChange(l)},autoComplete:"new-password",icon:d.TextFields,styles:this.props.styles})}),t.jsx(i.Grid2,{size:{xs:12,md:6},children:t.jsx(y,{label:"ID edit",t:this.props.t,disabled:this.props.user.common.dontDelete,value:this.props.user._id.split(".")[this.props.user._id.split(".").length-1],onChange:c=>{const l=h.clone(this.props.user);l._id=a(l._id,n(c)),this.props.onChange(l)},icon:d.LocalOffer,styles:this.props.styles})}),t.jsx(i.Grid2,{size:{xs:12,md:6},children:t.jsx(y,{label:"ID preview",t:this.props.t,disabled:!0,value:this.props.user._id,icon:d.Pageview,styles:this.props.styles})}),t.jsx(i.Grid2,{size:{xs:12,md:6},children:t.jsx(y,{label:"Description",t:this.props.t,value:m,onChange:c=>{const l=h.clone(this.props.user);l.common.desc=c,this.props.onChange(l)},icon:d.Description,styles:this.props.styles})}),t.jsx(i.Grid2,{size:{xs:12,md:6},children:t.jsx(y,{label:"Password",t:this.props.t,value:this.props.user.common.password,error:x?this.props.t(x):void 0,onChange:c=>{const l=h.clone(this.props.user);l.common.password=c,this.props.onChange(l)},type:"password",autoComplete:"new-password",icon:d.VpnKey,styles:this.props.styles})}),t.jsx(i.Grid2,{size:{xs:12,md:6},children:t.jsx(y,{label:"Password repeat",t:this.props.t,value:this.state.passwordRepeat,error:D?this.props.t(D):void 0,onChange:c=>this.setState({passwordRepeat:c}),type:"password",autoComplete:"new-password",icon:d.VpnKey,styles:this.props.styles})}),t.jsx(i.Grid2,{size:{xs:12,md:6},children:t.jsx(E,{icons:_,label:"Icon",value:this.props.user.common.icon,onChange:c=>{const l=h.clone(this.props.user);l.common.icon=c,this.props.onChange(l)},previewStyle:this.props.styles.iconPreview,icon:d.Image})}),t.jsx(i.Grid2,{size:{xs:12,md:6},children:t.jsx(S,{label:"Color",t:this.props.t,value:this.props.user.common.color,previewStyle:this.props.styles.iconPreview,onChange:c=>{const l=h.clone(this.props.user);l.common.color=c,this.props.onChange(l)},icon:d.ColorLens,style:this.props.styles.colorPicker,styles:this.props.styles})})]})}),t.jsxs(i.DialogActions,{style:this.props.styles.dialogActions,children:[t.jsx(i.Button,{variant:"contained",color:"primary",autoFocus:!0,onClick:()=>this.props.saveData(this.props.isNew?null:this.state.originalId),disabled:!g,startIcon:t.jsx(d.Check,{}),children:this.props.t("Save")}),t.jsx(i.Button,{variant:"contained",color:"grey",onClick:this.props.onClose,startIcon:t.jsx(d.Close,{}),children:this.props.t("Cancel")})]})]})}}const v=[ee,te,se,oe,ie,re,ne,le,ae,ce];function ge(e){const s=(r,n)=>Object.values(r).map((a,m)=>{const p=Object.keys(r)[m];return n(a,p)});let o=e.group.common.acl;return o=o||{},o.object=o.object||{read:!0,list:!0,write:!0,delete:!1,create:void 0},o.object={read:!0,list:!0,write:!0,delete:!1,...o.object},o.state=o.state||{read:!0,list:!0,write:!0,delete:!1,create:void 0},o.state={read:!0,list:!0,write:!0,delete:!1,...o.state},o.users=o.users||{write:!1,delete:!1,create:!1,list:void 0,read:void 0},o.users={write:!1,delete:!1,create:!1,...o.users},o.other=o.other||{http:!1,execute:!1,sendto:!0},o.other={http:!1,execute:!1,sendto:!0,...o.other},o.file=o.file||{read:!0,list:!0,write:!1,delete:!1,create:!1},o.file={read:!0,list:!0,write:!1,delete:!1,create:!1,...o.file},t.jsx(i.Grid2,{container:!0,spacing:e.innerWidth<500?1:4,style:e.styles.dialog,children:s(e.group.common.acl||{},(r,n)=>t.jsxs(i.Grid2,{size:{xs:12,md:12},children:[t.jsx(i.Box,{component:"h2",sx:e.styles.permHeaders,children:e.t(`group_acl_${n}`)}),s(r,(a,m)=>t.jsx(i.FormControlLabel,{control:t.jsx(i.Checkbox,{disabled:e.group._id==="system.group.administrator",checked:a,onChange:p=>{const x=h.clone(e.group);x.common.acl[n][m]=p.target.checked,e.onChange(x)}}),label:e.t(`group_acl_${m}`),labelPlacement:"top"},m))]},n))},"PermissionsTab")}const xe={contentRoot:{padding:"16px 24px"}};class fe extends j.Component{constructor(s){super(s),this.state={tab:0,originalId:s.group._id}}componentDidMount(){if(this.props.isNew){const s=v[Math.round(Math.random()*(v.length-1))];s&&h.getSvg(s).then(o=>{const r=h.clone(this.props.group);r.common.icon=o,this.props.onChange(r)})}}render(){const s=this.props.groups.find(c=>c._id===this.props.group._id),o=this.props.group._id!==this.state.originalId;let r=this.props.group._id!=="system.group."&&this.props.group.common.password===this.props.group.common.passwordRepeat;const n=c=>c.split(".").pop(),a=c=>c.replace(h.FORBIDDEN_CHARS,"_").replace(/\s/g,"_").replace(/\./g,"_").toLowerCase(),m=(c,l)=>{const f=c.split(".");return f[f.length-1]=l,f.join(".")};this.props.isNew?s&&(r=!1):s&&o&&(r=!1);const p=this.props.getText(this.props.group.common.desc),x=this.props.getText(this.props.group.common.name),g=[t.jsxs(i.Grid2,{container:!0,spacing:this.props.innerWidth<500?1:4,style:this.props.styles.dialog,children:[t.jsx(i.Grid2,{size:{xs:12,md:6},children:t.jsx(y,{label:"Name",t:this.props.t,value:x,onChange:c=>{const l=h.clone(this.props.group);!this.props.group.common.dontDelete&&a(this.props.getText(l.common.name))===n(l._id)&&(l._id=m(l._id,a(c))),l.common.name=c,this.props.onChange(l)},autoComplete:"off",icon:d.TextFields,styles:this.props.styles})}),t.jsx(i.Grid2,{size:{xs:12,md:6},children:t.jsx(y,{label:"ID edit",t:this.props.t,disabled:this.props.group.common.dontDelete,value:this.props.group._id.split(".")[this.props.group._id.split(".").length-1],onChange:c=>{const l=h.clone(this.props.group);l._id=m(l._id,a(c)),this.props.onChange(l)},icon:d.LocalOffer,styles:this.props.styles})}),t.jsx(i.Grid2,{size:{xs:12,md:6},children:t.jsx(y,{label:"ID preview",t:this.props.t,disabled:!0,value:this.props.group._id,icon:d.Pageview,styles:this.props.styles})}),t.jsx(i.Grid2,{size:{xs:12,md:6},children:t.jsx(y,{label:"Description",t:this.props.t,value:p,onChange:c=>{const l=h.clone(this.props.group);l.common.desc=c,this.props.onChange(l)},icon:d.Description,styles:this.props.styles})}),t.jsx(i.Grid2,{size:{xs:12,md:6},children:t.jsx(E,{label:"Icon",icons:v,value:this.props.group.common.icon,onChange:c=>{const l=h.clone(this.props.group);l.common.icon=c,this.props.onChange(l)},previewStyle:this.props.styles.iconPreview,icon:d.Image})}),t.jsx(i.Grid2,{size:{xs:12,md:6},children:t.jsx(S,{label:"Color",t:this.props.t,value:this.props.group.common.color,previewStyle:this.props.styles.iconPreview,onChange:c=>{const l=h.clone(this.props.group);l.common.color=c,this.props.onChange(l)},icon:d.ColorLens,style:this.props.styles.colorPicker,styles:this.props.styles})})]}),ge(this.props)][this.state.tab];return t.jsxs(i.Dialog,{open:!0,onClose:(c,l)=>{l!=="backdropClick"&&l!=="escapeKeyDown"&&this.props.onClose()},fullWidth:this.props.innerWidth<500,children:[t.jsx(i.DialogTitle,{style:this.props.styles.dialogTitle,children:t.jsxs(i.Tabs,{variant:"fullWidth",value:this.state.tab,onChange:(c,l)=>this.setState({tab:l}),children:[t.jsx(i.Tab,{label:this.props.t("Main"),value:0}),t.jsx(i.Tab,{label:this.props.t("Permissions"),value:1})]})}),t.jsx(i.DialogContent,{sx:{"&.MuiDialogContent-root":{...this.props.innerWidth<500?this.props.styles.narrowContent:void 0,...xe.contentRoot}},children:g}),t.jsxs(i.DialogActions,{style:this.props.styles.dialogActions,children:[t.jsx(i.Button,{variant:"contained",color:"primary",autoFocus:!0,onClick:()=>this.props.saveData(this.props.isNew?null:this.state.originalId),disabled:!r,startIcon:t.jsx(d.Check,{}),children:this.props.t("Save")}),t.jsx(i.Button,{variant:"contained",color:"grey",onClick:this.props.onClose,startIcon:t.jsx(d.Close,{}),children:this.props.t("Cancel")})]})]})}}function ye(e){return t.jsxs(i.Dialog,{open:!0,onClose:e.onClose,children:[t.jsx(i.DialogTitle,{children:e.t("Please confirm")}),t.jsx(i.DialogContent,{children:t.jsx(i.DialogContentText,{children:e.t("Do you want to delete user %s?",e.getText(e.user.common.name))})}),t.jsxs(i.DialogActions,{children:[t.jsx(i.Button,{variant:"contained",color:"primary",onClick:()=>e.deleteUser(e.user._id),startIcon:t.jsx(d.Delete,{}),children:e.t("Delete")}),t.jsx(i.Button,{variant:"contained",color:"grey",autoFocus:!0,onClick:e.onClose,startIcon:t.jsx(d.Close,{}),children:e.t("Cancel")})]})]})}function De(e){return t.jsxs(i.Dialog,{open:!0,onClose:e.onClose,children:[t.jsx(i.DialogTitle,{children:e.t("Please confirm")}),t.jsx(i.DialogContent,{children:t.jsx(i.DialogContentText,{children:e.t("Do you want to delete group %s?",e.getText(e.group.common.name))})}),t.jsxs(i.DialogActions,{style:e.styles.dialogActions,children:[t.jsx(i.Button,{variant:"contained",color:"primary",onClick:()=>e.deleteGroup(e.group._id),startIcon:t.jsx(d.Delete,{}),children:e.t("Delete")}),t.jsx(i.Button,{variant:"contained",color:"grey",autoFocus:!0,onClick:e.onClose,startIcon:t.jsx(d.Close,{}),children:e.t("Cancel")})]})]})}const U="***********",Ce="0 1px 1px 0 rgba(0, 0, 0, .4),0 6px 6px 0 rgba(0, 0, 0, .2)",u={mainGridCont:{height:"calc(100% - 55px)",overflowY:"auto"},childGridCont:{display:"flex",flexDirection:"column"},childGridContWide:{height:"100%"},canDrop:e=>({backgroundColor:e.palette.background.default}),headContainer:{margin:10},blocksContainer:{overflowY:"auto",overflowX:"hidden"},userGroupCard2:e=>({border:"1px solid #FFF",borderColor:e.palette.divider,m:"10px",minHeight:150,backgroundColor:e.palette.background.default,color:e.palette.text.primary,transition:"all 200ms ease-out",opacity:1,overflow:"hidden","&:hover":{overflowY:"auto",boxShadow:Ce}}),userGroupCardSecondary:e=>({color:e.palette.text.primary,backgroundColor:e.palette.success.light}),permHeaders:e=>({backgroundColor:e.palette.mode==="dark"?e.palette.background.default:e.palette.primary.main,p:"4px",borderRadius:"2px",color:"#EEE"}),userCardContent:{height:"100%",opacity:1},userGroupTitle:{display:"inline-flex",alignItems:"center"},userGroupUserName:{fontWeight:900,padding:5},userGroupUserID:{opacity:.7,padding:5},description:{fontSize:10,fontStyle:"italic",marginLeft:5,opacity:.7},userGroupMember:e=>({display:"inline-flex",m:"4px",p:"4px",backgroundColor:"#00000010",border:"1px solid #FFF",borderColor:e.palette.text.primary,color:e.palette.text.primary,alignItems:"center"}),icon:{height:32,width:32,marginRight:5,backgroundSize:"cover",backgroundPosition:"center"},right:{float:"right"},left:{float:"left",marginRight:10},dialog:{},flex:{display:"flex"},formControl:{display:"flex",padding:24,flexGrow:1e3},formContainer:{display:"flex",justifyContent:"center",alignItems:"center"},formIcon:{margin:10,opacity:.6},descriptionPanel:e=>({width:"100%",backgroundColor:"transparent",mb:"20px",mt:"20px",ml:"20px",opacity:.75,border:"none",display:"flex",alignItems:"center","& a":{pl:"3px",color:e.palette.mode==="dark"?"#EEE":"#111"}}),dialogTitle:{borderBottom:"1px solid #00000020",padding:0,width:"100%"},dialogActions:{borderTop:"1px solid #00000020",width:"100%"},dialogPaper:{overflowY:"initial",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",width:"calc(100% - 100px)",height:"calc(100% - 100px)",maxWidth:800,maxHeight:"100%"},dialogPaperMini:{maxHeight:300},colorPicker:{},iconPreview:{height:40,width:40},mainDescription:{fontSize:"200%"},deleteDialog:{padding:20},narrowContent:{padding:"8px 8px 8px 8px"}},je=()=>{const e=$();return e.display?t.jsx("div",{style:e.style,children:e.item.preview}):null},we={_id:"system.user.",type:"user",common:{name:"",password:"",enabled:!0,color:"",desc:""},native:{},enums:{}},_e={_id:void 0,native:{},type:"group",common:{name:"",desc:"",members:[],dontDelete:void 0,acl:{object:{list:!1,read:!1,write:!1,delete:!1,create:void 0},state:{list:!1,read:!1,write:!1,create:!1,delete:!1},users:{list:!1,read:!1,write:!1,create:!1,delete:!1},other:{execute:!1,http:!1,sendto:!1},file:{list:!1,read:!1,write:!1,create:!1,delete:!1}},icon:"",color:""}};class C extends j.Component{constructor(s){super(s),this.state={users:null,groups:null,userEditDialog:!1,userEditDialogNew:null,groupEditDialog:!1,groupEditDialogNew:null,userDeleteDialog:!1,groupDeleteDialog:!1,innerWidth:0}}componentDidMount(){this.setState({innerWidth:window.innerWidth},()=>this.updateData())}componentDidUpdate(){window.innerWidth!==this.state.innerWidth&&setTimeout(()=>this.setState({innerWidth:window.innerWidth}),100)}getText=s=>s&&(typeof s=="object"?s[this.props.lang]||s.en||"":s||"")||"";showUserEditDialog=(s,o)=>{s=h.clone(s),s.common.password=s.common.password?U:"",this.setState({userEditDialog:s,userEditDialogNew:o})};showGroupEditDialog=(s,o)=>{s=h.clone(s),this.setState({groupEditDialog:s,groupEditDialogNew:o})};updateData=()=>{let s;return this.props.socket.getForeignObjects("system.user.*","user").then(o=>(s=Object.values(o).sort((r,n)=>r._id>n._id?1:-1),s.forEach(r=>{r.common&&r.common.description&&(r.common.desc||(r.common.desc=r.common.description),delete r.common.description)}),this.props.socket.getForeignObjects("system.group.*","group"))).then(o=>{const r=Object.values(o).sort((n,a)=>n._id>a._id?1:-1);r.forEach(n=>{n.common&&n.common.description&&(n.common.desc||(n.common.desc=n.common.description),delete n.common.description)}),this.setState({groups:r,users:s})})};changeUserFormData=s=>this.setState({userEditDialog:s});changeGroupFormData=s=>this.setState({groupEditDialog:s});saveUser=async s=>{const o=h.clone(this.state.userEditDialog),r=this.state.users.find(a=>a._id===o._id),n=o.common.password&&o.common.password!==U?o.common.password:"";if(r?o.common.password=r.common.password:o.common.password="",await this.props.socket.setObject(o._id,o),typeof this.state.userEditDialog=="object"&&s&&s!==this.state.userEditDialog._id)try{await this.props.socket.delObject(s);for(let a=0;a<this.state.groups.length;a++){const m=this.state.groups[a];if(m.common.members.includes(s)){const p=h.clone(m);p.common.members[p.common.members.indexOf(s)]=o._id,await this.props.socket.setObject(p._id,p)}}}catch(a){window.alert(`Cannot delete user: ${a}`)}if(n)try{await this.props.socket.changePassword(o._id,n)}catch(a){window.alert(`Cannot change password: ${a}`)}this.setState({userEditDialog:!1},()=>this.updateData())};saveGroup=async s=>{if(typeof this.state.groupEditDialog=="object"){if(await this.props.socket.setObject(this.state.groupEditDialog._id,this.state.groupEditDialog),s&&s!==this.state.groupEditDialog._id)try{await this.props.socket.delObject(s)}catch(o){window.alert(`Cannot delete user: ${o}`)}this.setState({groupEditDialog:!1},()=>this.updateData())}};showUserDeleteDialog=s=>this.setState({userDeleteDialog:s});showGroupDeleteDialog=s=>this.setState({groupDeleteDialog:s});deleteUser=s=>{this.props.socket.delObject(s).then(()=>Promise.all(this.state.groups.map(o=>{if(o.common.members.includes(s)){const r=h.clone(o);return r.common.members.splice(r.common.members.indexOf(s),1),this.props.socket.setObject(r._id,r)}return Promise.resolve(null)}))).catch(o=>window.alert(`Cannot delete user: ${o}`)).then(()=>{this.setState({userDeleteDialog:!1},()=>this.updateData())})};deleteGroup=s=>this.props.socket.delObject(s).then(()=>this.setState({groupDeleteDialog:!1},()=>this.updateData())).catch(o=>window.alert(`Cannot delete user: ${o}`));addUserToGroup=(s,o)=>{const r=this.state.groups.find(a=>a._id===o),n=r.common.members;n.includes(s)||(n.push(s),this.props.socket.setObject(r._id,r).then(()=>this.updateData()).catch(a=>window.alert(`Cannot delete user: ${a}`)))};removeUserFromGroup=(s,o)=>{const r=this.state.groups.find(a=>a._id===o),n=r.common.members;n.includes(s)&&(n.splice(n.indexOf(s),1),this.props.socket.setObject(r._id,r).then(()=>this.updateData()))};static _isUniqueName(s,o,r){return!s.find(n=>n._id===`system.user.${o.toLowerCase()}_${r}`||n.common.name===`${o} ${r}`)}static findNewUniqueName(s,o,r){let n=1;for(;!C._isUniqueName(o,r,n);)n++;return{_id:`system.${s?"group":"user"}.${r.toLowerCase()}_${n}`,name:`${r} ${n}`}}render(){return!this.state.users||!this.state.groups?t.jsx(i.LinearProgress,{}):t.jsxs(N,{backend:b.isTouchDevice()?W:z,children:[t.jsx(je,{}),t.jsx(i.Box,{component:"div",sx:u.descriptionPanel,children:this.props.t("You can drag users to groups.")}),t.jsxs(i.Grid2,{container:!0,spacing:2,style:u.mainGridCont,children:[t.jsxs(i.Grid2,{size:{xs:12,md:6},style:{...u.childGridCont,...this.state.innerWidth>600?u.childGridContWide:void 0},children:[t.jsxs("div",{style:u.headContainer,children:[t.jsx(i.Fab,{size:"small",style:u.right,onClick:()=>{const{_id:s,name:o}=C.findNewUniqueName(!0,this.state.groups,this.props.t("Group")),r=h.clone(_e);r._id=s,r.common.name=o,this.showGroupEditDialog(r,!0)},children:t.jsx(d.GroupAdd,{})}),t.jsx(i.Typography,{gutterBottom:!0,variant:"h4",component:"h4",children:this.props.t("Groups")})]}),t.jsx("div",{style:u.blocksContainer,children:this.state.groups.sort((s,o)=>{var a,m;const r=(this.getText((a=s==null?void 0:s.common)==null?void 0:a.name)||s._id).toLowerCase(),n=(this.getText((m=o==null?void 0:o.common)==null?void 0:m.name)||o._id).toLowerCase();return r>n?1:r<n?-1:0}).map(s=>t.jsx(me,{themeType:this.props.themeType,group:s,users:this.state.users,showGroupEditDialog:this.showGroupEditDialog,showGroupDeleteDialog:this.showGroupDeleteDialog,removeUserFromGroup:this.removeUserFromGroup,getText:this.getText,styles:u,...this.props},s._id))})]}),t.jsxs(i.Grid2,{size:{xs:12,md:6},style:{...u.childGridCont,...this.state.innerWidth>600?u.childGridContWide:void 0},children:[t.jsxs("div",{style:u.headContainer,children:[t.jsx(i.Fab,{size:"small",style:u.right,onClick:()=>{const{_id:s,name:o}=C.findNewUniqueName(!1,this.state.users,this.props.t("User")),r=h.clone(we);r._id=s,r.common.name=o,this.showUserEditDialog(r,!0)},children:t.jsx(d.PersonAdd,{})}),t.jsx(i.Typography,{gutterBottom:!0,variant:"h4",component:"h4",children:this.props.t("Users")})]}),t.jsx("div",{style:u.blocksContainer,children:this.state.users.sort((s,o)=>{var a,m;const r=(this.getText((a=s==null?void 0:s.common)==null?void 0:a.name)||s._id).toLowerCase(),n=(this.getText((m=o==null?void 0:o.common)==null?void 0:m.name)||o._id).toLowerCase();return r>n?1:r<n?-1:0}).map(s=>t.jsx(de,{themeType:this.props.themeType,user:s,groups:this.state.groups,showUserEditDialog:this.showUserEditDialog,showUserDeleteDialog:this.showUserDeleteDialog,updateData:this.updateData,addUserToGroup:this.addUserToGroup,removeUserFromGroup:this.removeUserFromGroup,getText:this.getText,styles:u,...this.props},s._id))})]})]}),this.state.userEditDialog?t.jsx(ue,{onClose:()=>this.setState({userEditDialog:!1}),users:this.state.users,user:this.state.userEditDialog,isNew:this.state.userEditDialogNew,t:this.props.t,getText:this.getText,styles:u,onChange:this.changeUserFormData,saveData:this.saveUser,innerWidth:this.state.innerWidth}):null,this.state.groupEditDialog?t.jsx(fe,{onClose:()=>this.setState({groupEditDialog:!1}),groups:this.state.groups,group:this.state.groupEditDialog,isNew:this.state.groupEditDialogNew,t:this.props.t,getText:this.getText,styles:u,onChange:this.changeGroupFormData,innerWidth:this.state.innerWidth,saveData:this.saveGroup}):null,this.state.userDeleteDialog?t.jsx(ye,{getText:this.getText,onClose:()=>this.setState({userDeleteDialog:!1}),user:this.state.userDeleteDialog,t:this.props.t,deleteUser:this.deleteUser}):null,this.state.groupDeleteDialog?t.jsx(De,{getText:this.getText,onClose:()=>this.setState({groupDeleteDialog:!1}),group:this.state.groupDeleteDialog,t:this.props.t,styles:u,deleteGroup:this.deleteGroup}):null]})}}function at(e){return t.jsx(B,{children:t.jsx(R,{style:{display:"flex",flexDirection:"column",overflow:"auto"},children:t.jsx(C,{t:e.t,lang:e.lang,socket:e.socket,ready:e.ready,expertMode:e.expertMode,themeType:e.themeType,theme:e.theme})})})}export{at as default};
1
+ import{j as t}from"./DefaultPropsProvider-Beyggw1o.js";import{X as P,Y as O,U as h,i,a as d,b as w,Z as F,f as b,_ as E,$ as N,a0 as W,a1 as z,h as B,T as R}from"./bootstrap-DF1rNJUh.js";import{i as j}from"./iobroker_admin__loadShare__react__loadShare__-T96CJO0k.js";import{I as y,a as S,b as $}from"./Fields-TuYhaeX9.js";import A from"./user1-BHHH0LIq.js";import M from"./user2-BN56rMPt.js";import L from"./user3-Mx6XZSLK.js";import H from"./user4-DpEs_YiD.js";import Y from"./user5-CVfrnlXE.js";import q from"./user6-C7HkYnq4.js";import V from"./user7-VAQcubFn.js";import X from"./user8-CwACr_jq.js";import Z from"./user9-Dk4Mlhcc.js";import J from"./user10-Dvmqf8l1.js";import K from"./user11-C8ly5pY7.js";import Q from"./user12-CHtaF3qG.js";import ee from"./group1-DBYxcyxq.js";import te from"./group2-BUQSell7.js";import se from"./group3-B0AdMrOp.js";import oe from"./group4-TeCgDok7.js";import ie from"./group5-CJ_-VPxg.js";import re from"./group6-JW-nEhw_.js";import ne from"./group7-CWpVuR4T.js";import le from"./group8-CRGBxCwd.js";import ae from"./group9-BXRQchYG.js";import ce from"./group10-BIcZMfE3.js";import"./iobroker_admin__loadShare__prop_mf_2_types__loadShare__-C8Lvs8Es.js";import"./_commonjsHelpers-BosuxZz1.js";import"./iobroker_admin__mf_v__runtimeInit__mf_v__-VDoBF19b.js";import"./emotion-serialize.esm-BUa21YfQ.js";import"./iobroker_admin__loadShare___mf_0_emotion_mf_1_react__loadShare__-gw2iqPBS.js";import"./ace-BAuRYJjv.js";import"./FilledInput-Bfz0Aef-.js";import"./preload-helper-C1FmrZbK.js";import"./blueGrey-BKTirx-Z.js";import"./emotion-cache.browser.esm-B8BFze5o.js";import"./iobroker_admin__loadShare__leaflet__loadShare__-FMqZHPyC.js";import"./extends-CF3RwP-h.js";const k=e=>{const s=e.isDragging?0:1,o=h.getInvertedColor(e.user.common.color,e.themeType,!0),r={cursor:"grab",opacity:s,overflow:"hidden",color:o};return e.user.common.color&&(r.backgroundColor=e.user.common.color),t.jsx(i.Card,{style:r,sx:e.styles.userGroupCard2,children:t.jsxs("div",{style:e.styles.userCardContent,children:[t.jsxs("div",{style:e.styles.right,children:[t.jsx(i.Checkbox,{checked:e.user.common.enabled,style:{color:o},disabled:e.user.common.dontDelete,onChange:()=>{e.socket.extendObject(e.user._id,{common:{enabled:!e.user.common.enabled}}).then(()=>e.updateData())}}),t.jsx(i.IconButton,{size:"small",onClick:()=>e.showUserEditDialog(e.user,!1),children:t.jsx(d.Edit,{style:{color:o}})}),t.jsx(i.IconButton,{size:"small",onClick:()=>e.showUserDeleteDialog(e.user),disabled:e.user.common.dontDelete,children:t.jsx(d.Delete,{style:e.user.common.dontDelete?null:{color:o}})})]}),t.jsxs(i.CardContent,{children:[t.jsxs(i.Typography,{gutterBottom:!0,component:"div",style:e.styles.userGroupTitle,children:[e.user.common.icon?t.jsx(w,{style:e.styles.icon,src:e.user.common.icon}):t.jsx(d.Person,{style:e.styles.icon}),t.jsxs("div",{children:[t.jsxs("div",{children:[t.jsx("span",{style:e.styles.userGroupUserName,children:e.getText(e.user.common.name)}),t.jsxs("span",{style:e.styles.userGroupUserID,children:["[",e.user._id,"]"]})]}),t.jsx("span",{children:e.user.common.desc?t.jsx("div",{style:e.styles.description,children:e.getText(e.user.common.desc)}):null})]})]}),e.groups.find(n=>n.common.members&&n.common.members.includes(e.user._id))?t.jsxs("div",{children:[e.t("In groups"),":"]}):null,t.jsx("div",{children:e.groups.map(n=>{var m,p;if(!n.common.members||!n.common.members.includes(e.user._id))return null;const a=n&&((m=n.common)!=null&&m.color)?h.getInvertedColor(n.common.color,e.themeType,!0):o;return t.jsxs(i.Card,{variant:"outlined",sx:e.styles.userGroupMember,style:{color:a,borderColor:`${a}80`,background:((p=n.common)==null?void 0:p.color)||"inherit"},children:[n.common.icon?t.jsx(w,{style:e.styles.icon,src:n.common.icon}):t.jsx(d.Group,{style:e.styles.icon}),e.getText(n.common.name),t.jsx(i.IconButton,{size:"small",onClick:()=>e.removeUserFromGroup(e.user._id,n._id),children:t.jsx(d.Clear,{style:{color:a}})})]},n._id)})})]})]})})},de=e=>{const s=j.useRef(),[{isDragging:o},r,n]=P({type:"user",item:()=>{var a;return{userId:e.user._id,preview:t.jsx("div",{style:{width:(a=s.current)==null?void 0:a.offsetWidth},children:t.jsx(k,{...e})})}},end:(a,m)=>{const p=m.getDropResult();a&&p&&e.addUserToGroup(a.userId,p.groupId)},collect:a=>({isDragging:a.isDragging(),handlerId:a.getHandlerId()})});return j.useEffect(()=>{n(O(),{captureDraggingState:!0})},[n]),t.jsx("div",{ref:r,children:t.jsx("div",{ref:s,children:t.jsx(k,{isDragging:o,...e})})})};function he(e,s){return s.group.common.members?!s.group.common.members.includes(e.getItem().userId):!0}const me=e=>{var D;const[{CanDrop:s,isOver:o},r]=F(()=>({accept:"user",drop:()=>({groupId:e.group._id}),canDrop:(g,c)=>he(c,e),collect:g=>({isOver:g.isOver(),CanDrop:g.canDrop()})}),[e.group.common.members]);let n=.7,a;s&&o?(n=s?1:.125,a=e.styles.userGroupCardSecondary):s&&(n=s?.75:.25);const p=h.getInvertedColor(e.group.common.color,e.themeType,!0),x={opacity:n,overflow:"hidden",color:p};return e.group.common.color&&(x.backgroundColor=e.group.common.color),t.jsxs(i.Card,{style:x,ref:r,sx:h.getStyle(e.theme,e.styles.userGroupCard2,a),children:[t.jsxs("div",{style:e.styles.right,children:[t.jsx(i.IconButton,{size:"small",onClick:()=>e.showGroupEditDialog(e.group,!1),children:t.jsx(d.Edit,{style:{color:p}})}),t.jsx(i.IconButton,{size:"small",onClick:()=>e.showGroupDeleteDialog(e.group),disabled:e.group.common.dontDelete,children:t.jsx(d.Delete,{style:e.group.common.dontDelete?null:{color:p}})})]}),t.jsxs(i.CardContent,{children:[t.jsxs(i.Typography,{gutterBottom:!0,component:"div",style:e.styles.userGroupTitle,children:[e.group.common.icon?t.jsx(w,{style:e.styles.icon,src:e.group.common.icon}):t.jsx(d.Group,{style:e.styles.icon}),t.jsxs("div",{children:[t.jsxs("div",{children:[t.jsx("span",{style:e.styles.userGroupUserName,children:e.getText(e.group.common.name)}),t.jsxs("span",{children:["[",e.group._id,"]"]})]}),e.group.common.desc?t.jsx("div",{style:e.styles.description,children:e.getText(e.group.common.desc)}):null]})]}),(D=e.group.common.members)!=null&&D.length?t.jsxs("div",{children:[e.t("Group members"),":"]}):null,t.jsx("div",{children:(e.group.common.members||[]).map((g,c)=>{var G,T;const l=e.users.find(I=>I._id===g),f=l&&((G=l.common)!=null&&G.color)?h.getInvertedColor(l.common.color,e.themeType,!0):p;return l?t.jsxs(i.Card,{variant:"outlined",sx:e.styles.userGroupMember,style:{color:f,borderColor:`${f}40`,background:((T=l.common)==null?void 0:T.color)||"inherit"},children:[l.common.icon?t.jsx(w,{style:e.styles.icon,src:l.common.icon}):t.jsx(d.Person,{style:e.styles.icon}),e.getText(l.common.name),t.jsx(i.IconButton,{size:"small",onClick:()=>e.removeUserFromGroup(g,e.group._id),children:t.jsx(d.Clear,{style:{color:f}})})]},c):null})})]})]})},_=[A,M,L,H,Y,q,V,X,Z,J,K,Q],pe={contentRoot:{padding:"16px 24px"}};class ue extends j.Component{constructor(s){super(s),this.state={originalId:s.user._id,passwordRepeat:s.user.common.password}}componentDidMount(){if(this.props.isNew){const s=_[Math.round(Math.random()*(_.length-1))];s&&h.getSvg(s).then(o=>{const r=h.clone(this.props.user);r.common.icon=o,this.props.onChange(r)})}}render(){const s=this.props.users.find(c=>c._id===this.props.user._id),o=this.props.user._id!==this.state.originalId,r=c=>c.split(".").pop(),n=c=>c.replace(h.FORBIDDEN_CHARS,"_").replace(/\s/g,"_").replace(/\./g,"_").replace(/,/g,"_").replace(/__/g,"_").replace(/__/g,"_").toLowerCase(),a=(c,l)=>{const f=c.split(".");return f[f.length-1]=l,f.join(".")},m=this.props.getText(this.props.user.common.desc),p=this.props.getText(this.props.user.common.name),x=b.checkPassword(this.props.user.common.password),D=b.checkPassword(this.props.user.common.password,this.state.passwordRepeat);let g=this.props.user._id!=="system.user."&&!x&&!D;return(this.props.isNew&&s||s&&o)&&(g=!1),t.jsxs(i.Dialog,{fullWidth:this.props.innerWidth<500,open:!0,onClose:(c,l)=>{l!=="backdropClick"&&l!=="escapeKeyDown"&&this.props.onClose()},children:[t.jsx(i.DialogTitle,{style:{...this.props.styles.dialogTitle,padding:12},children:this.props.t("User parameters")}),t.jsx(i.DialogContent,{sx:{"&.MuiDialogContent-root":{...this.props.innerWidth<500?this.props.styles.narrowContent:void 0,...pe.contentRoot}},children:t.jsxs(i.Grid2,{container:!0,spacing:this.props.innerWidth<500?1:4,style:this.props.styles.dialog,children:[t.jsx(i.Grid2,{size:{xs:12,md:6},children:t.jsx(y,{label:"Name",t:this.props.t,value:p,onChange:c=>{const l=h.clone(this.props.user);!this.props.user.common.dontDelete&&n(this.props.getText(l.common.name))===r(l._id)&&(l._id=a(l._id,n(c))),l.common.name=c,this.props.onChange(l)},autoComplete:"new-password",icon:d.TextFields,styles:this.props.styles})}),t.jsx(i.Grid2,{size:{xs:12,md:6},children:t.jsx(y,{label:"ID edit",t:this.props.t,disabled:this.props.user.common.dontDelete,value:this.props.user._id.split(".")[this.props.user._id.split(".").length-1],onChange:c=>{const l=h.clone(this.props.user);l._id=a(l._id,n(c)),this.props.onChange(l)},icon:d.LocalOffer,styles:this.props.styles})}),t.jsx(i.Grid2,{size:{xs:12,md:6},children:t.jsx(y,{label:"ID preview",t:this.props.t,disabled:!0,value:this.props.user._id,icon:d.Pageview,styles:this.props.styles})}),t.jsx(i.Grid2,{size:{xs:12,md:6},children:t.jsx(y,{label:"Description",t:this.props.t,value:m,onChange:c=>{const l=h.clone(this.props.user);l.common.desc=c,this.props.onChange(l)},icon:d.Description,styles:this.props.styles})}),t.jsx(i.Grid2,{size:{xs:12,md:6},children:t.jsx(y,{label:"Password",t:this.props.t,value:this.props.user.common.password,error:x?this.props.t(x):void 0,onChange:c=>{const l=h.clone(this.props.user);l.common.password=c,this.props.onChange(l)},type:"password",autoComplete:"new-password",icon:d.VpnKey,styles:this.props.styles})}),t.jsx(i.Grid2,{size:{xs:12,md:6},children:t.jsx(y,{label:"Password repeat",t:this.props.t,value:this.state.passwordRepeat,error:D?this.props.t(D):void 0,onChange:c=>this.setState({passwordRepeat:c}),type:"password",autoComplete:"new-password",icon:d.VpnKey,styles:this.props.styles})}),t.jsx(i.Grid2,{size:{xs:12,md:6},children:t.jsx(E,{icons:_,label:"Icon",value:this.props.user.common.icon,onChange:c=>{const l=h.clone(this.props.user);l.common.icon=c,this.props.onChange(l)},previewStyle:this.props.styles.iconPreview,icon:d.Image})}),t.jsx(i.Grid2,{size:{xs:12,md:6},children:t.jsx(S,{label:"Color",t:this.props.t,value:this.props.user.common.color,previewStyle:this.props.styles.iconPreview,onChange:c=>{const l=h.clone(this.props.user);l.common.color=c,this.props.onChange(l)},icon:d.ColorLens,style:this.props.styles.colorPicker,styles:this.props.styles})})]})}),t.jsxs(i.DialogActions,{style:this.props.styles.dialogActions,children:[t.jsx(i.Button,{variant:"contained",color:"primary",autoFocus:!0,onClick:()=>this.props.saveData(this.props.isNew?null:this.state.originalId),disabled:!g,startIcon:t.jsx(d.Check,{}),children:this.props.t("Save")}),t.jsx(i.Button,{variant:"contained",color:"grey",onClick:this.props.onClose,startIcon:t.jsx(d.Close,{}),children:this.props.t("Cancel")})]})]})}}const v=[ee,te,se,oe,ie,re,ne,le,ae,ce];function ge(e){const s=(r,n)=>Object.values(r).map((a,m)=>{const p=Object.keys(r)[m];return n(a,p)});let o=e.group.common.acl;return o=o||{},o.object=o.object||{read:!0,list:!0,write:!0,delete:!1,create:void 0},o.object={read:!0,list:!0,write:!0,delete:!1,...o.object},o.state=o.state||{read:!0,list:!0,write:!0,delete:!1,create:void 0},o.state={read:!0,list:!0,write:!0,delete:!1,...o.state},o.users=o.users||{write:!1,delete:!1,create:!1,list:void 0,read:void 0},o.users={write:!1,delete:!1,create:!1,...o.users},o.other=o.other||{http:!1,execute:!1,sendto:!0},o.other={http:!1,execute:!1,sendto:!0,...o.other},o.file=o.file||{read:!0,list:!0,write:!1,delete:!1,create:!1},o.file={read:!0,list:!0,write:!1,delete:!1,create:!1,...o.file},t.jsx(i.Grid2,{container:!0,spacing:e.innerWidth<500?1:4,style:e.styles.dialog,children:s(e.group.common.acl||{},(r,n)=>t.jsxs(i.Grid2,{size:{xs:12,md:12},children:[t.jsx(i.Box,{component:"h2",sx:e.styles.permHeaders,children:e.t(`group_acl_${n}`)}),s(r,(a,m)=>t.jsx(i.FormControlLabel,{control:t.jsx(i.Checkbox,{disabled:e.group._id==="system.group.administrator",checked:a,onChange:p=>{const x=h.clone(e.group);x.common.acl[n][m]=p.target.checked,e.onChange(x)}}),label:e.t(`group_acl_${m}`),labelPlacement:"top"},m))]},n))},"PermissionsTab")}const xe={contentRoot:{padding:"16px 24px"}};class fe extends j.Component{constructor(s){super(s),this.state={tab:0,originalId:s.group._id}}componentDidMount(){if(this.props.isNew){const s=v[Math.round(Math.random()*(v.length-1))];s&&h.getSvg(s).then(o=>{const r=h.clone(this.props.group);r.common.icon=o,this.props.onChange(r)})}}render(){const s=this.props.groups.find(c=>c._id===this.props.group._id),o=this.props.group._id!==this.state.originalId;let r=this.props.group._id!=="system.group."&&this.props.group.common.password===this.props.group.common.passwordRepeat;const n=c=>c.split(".").pop(),a=c=>c.replace(h.FORBIDDEN_CHARS,"_").replace(/\s/g,"_").replace(/\./g,"_").toLowerCase(),m=(c,l)=>{const f=c.split(".");return f[f.length-1]=l,f.join(".")};this.props.isNew?s&&(r=!1):s&&o&&(r=!1);const p=this.props.getText(this.props.group.common.desc),x=this.props.getText(this.props.group.common.name),g=[t.jsxs(i.Grid2,{container:!0,spacing:this.props.innerWidth<500?1:4,style:this.props.styles.dialog,children:[t.jsx(i.Grid2,{size:{xs:12,md:6},children:t.jsx(y,{label:"Name",t:this.props.t,value:x,onChange:c=>{const l=h.clone(this.props.group);!this.props.group.common.dontDelete&&a(this.props.getText(l.common.name))===n(l._id)&&(l._id=m(l._id,a(c))),l.common.name=c,this.props.onChange(l)},autoComplete:"off",icon:d.TextFields,styles:this.props.styles})}),t.jsx(i.Grid2,{size:{xs:12,md:6},children:t.jsx(y,{label:"ID edit",t:this.props.t,disabled:this.props.group.common.dontDelete,value:this.props.group._id.split(".")[this.props.group._id.split(".").length-1],onChange:c=>{const l=h.clone(this.props.group);l._id=m(l._id,a(c)),this.props.onChange(l)},icon:d.LocalOffer,styles:this.props.styles})}),t.jsx(i.Grid2,{size:{xs:12,md:6},children:t.jsx(y,{label:"ID preview",t:this.props.t,disabled:!0,value:this.props.group._id,icon:d.Pageview,styles:this.props.styles})}),t.jsx(i.Grid2,{size:{xs:12,md:6},children:t.jsx(y,{label:"Description",t:this.props.t,value:p,onChange:c=>{const l=h.clone(this.props.group);l.common.desc=c,this.props.onChange(l)},icon:d.Description,styles:this.props.styles})}),t.jsx(i.Grid2,{size:{xs:12,md:6},children:t.jsx(E,{label:"Icon",icons:v,value:this.props.group.common.icon,onChange:c=>{const l=h.clone(this.props.group);l.common.icon=c,this.props.onChange(l)},previewStyle:this.props.styles.iconPreview,icon:d.Image})}),t.jsx(i.Grid2,{size:{xs:12,md:6},children:t.jsx(S,{label:"Color",t:this.props.t,value:this.props.group.common.color,previewStyle:this.props.styles.iconPreview,onChange:c=>{const l=h.clone(this.props.group);l.common.color=c,this.props.onChange(l)},icon:d.ColorLens,style:this.props.styles.colorPicker,styles:this.props.styles})})]}),ge(this.props)][this.state.tab];return t.jsxs(i.Dialog,{open:!0,onClose:(c,l)=>{l!=="backdropClick"&&l!=="escapeKeyDown"&&this.props.onClose()},fullWidth:this.props.innerWidth<500,children:[t.jsx(i.DialogTitle,{style:this.props.styles.dialogTitle,children:t.jsxs(i.Tabs,{variant:"fullWidth",value:this.state.tab,onChange:(c,l)=>this.setState({tab:l}),children:[t.jsx(i.Tab,{label:this.props.t("Main"),value:0}),t.jsx(i.Tab,{label:this.props.t("Permissions"),value:1})]})}),t.jsx(i.DialogContent,{sx:{"&.MuiDialogContent-root":{...this.props.innerWidth<500?this.props.styles.narrowContent:void 0,...xe.contentRoot}},children:g}),t.jsxs(i.DialogActions,{style:this.props.styles.dialogActions,children:[t.jsx(i.Button,{variant:"contained",color:"primary",autoFocus:!0,onClick:()=>this.props.saveData(this.props.isNew?null:this.state.originalId),disabled:!r,startIcon:t.jsx(d.Check,{}),children:this.props.t("Save")}),t.jsx(i.Button,{variant:"contained",color:"grey",onClick:this.props.onClose,startIcon:t.jsx(d.Close,{}),children:this.props.t("Cancel")})]})]})}}function ye(e){return t.jsxs(i.Dialog,{open:!0,onClose:e.onClose,children:[t.jsx(i.DialogTitle,{children:e.t("Please confirm")}),t.jsx(i.DialogContent,{children:t.jsx(i.DialogContentText,{children:e.t("Do you want to delete user %s?",e.getText(e.user.common.name))})}),t.jsxs(i.DialogActions,{children:[t.jsx(i.Button,{variant:"contained",color:"primary",onClick:()=>e.deleteUser(e.user._id),startIcon:t.jsx(d.Delete,{}),children:e.t("Delete")}),t.jsx(i.Button,{variant:"contained",color:"grey",autoFocus:!0,onClick:e.onClose,startIcon:t.jsx(d.Close,{}),children:e.t("Cancel")})]})]})}function De(e){return t.jsxs(i.Dialog,{open:!0,onClose:e.onClose,children:[t.jsx(i.DialogTitle,{children:e.t("Please confirm")}),t.jsx(i.DialogContent,{children:t.jsx(i.DialogContentText,{children:e.t("Do you want to delete group %s?",e.getText(e.group.common.name))})}),t.jsxs(i.DialogActions,{style:e.styles.dialogActions,children:[t.jsx(i.Button,{variant:"contained",color:"primary",onClick:()=>e.deleteGroup(e.group._id),startIcon:t.jsx(d.Delete,{}),children:e.t("Delete")}),t.jsx(i.Button,{variant:"contained",color:"grey",autoFocus:!0,onClick:e.onClose,startIcon:t.jsx(d.Close,{}),children:e.t("Cancel")})]})]})}const U="***********",Ce="0 1px 1px 0 rgba(0, 0, 0, .4),0 6px 6px 0 rgba(0, 0, 0, .2)",u={mainGridCont:{height:"calc(100% - 55px)",overflowY:"auto"},childGridCont:{display:"flex",flexDirection:"column"},childGridContWide:{height:"100%"},canDrop:e=>({backgroundColor:e.palette.background.default}),headContainer:{margin:10},blocksContainer:{overflowY:"auto",overflowX:"hidden"},userGroupCard2:e=>({border:"1px solid #FFF",borderColor:e.palette.divider,m:"10px",minHeight:150,backgroundColor:e.palette.background.default,color:e.palette.text.primary,transition:"all 200ms ease-out",opacity:1,overflow:"hidden","&:hover":{overflowY:"auto",boxShadow:Ce}}),userGroupCardSecondary:e=>({color:e.palette.text.primary,backgroundColor:e.palette.success.light}),permHeaders:e=>({backgroundColor:e.palette.mode==="dark"?e.palette.background.default:e.palette.primary.main,p:"4px",borderRadius:"2px",color:"#EEE"}),userCardContent:{height:"100%",opacity:1},userGroupTitle:{display:"inline-flex",alignItems:"center"},userGroupUserName:{fontWeight:900,padding:5},userGroupUserID:{opacity:.7,padding:5},description:{fontSize:10,fontStyle:"italic",marginLeft:5,opacity:.7},userGroupMember:e=>({display:"inline-flex",m:"4px",p:"4px",backgroundColor:"#00000010",border:"1px solid #FFF",borderColor:e.palette.text.primary,color:e.palette.text.primary,alignItems:"center"}),icon:{height:32,width:32,marginRight:5,backgroundSize:"cover",backgroundPosition:"center"},right:{float:"right"},left:{float:"left",marginRight:10},dialog:{},flex:{display:"flex"},formControl:{display:"flex",padding:24,flexGrow:1e3},formContainer:{display:"flex",justifyContent:"center",alignItems:"center"},formIcon:{margin:10,opacity:.6},descriptionPanel:e=>({width:"100%",backgroundColor:"transparent",mb:"20px",mt:"20px",ml:"20px",opacity:.75,border:"none",display:"flex",alignItems:"center","& a":{pl:"3px",color:e.palette.mode==="dark"?"#EEE":"#111"}}),dialogTitle:{borderBottom:"1px solid #00000020",padding:0,width:"100%"},dialogActions:{borderTop:"1px solid #00000020",width:"100%"},dialogPaper:{overflowY:"initial",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",width:"calc(100% - 100px)",height:"calc(100% - 100px)",maxWidth:800,maxHeight:"100%"},dialogPaperMini:{maxHeight:300},colorPicker:{},iconPreview:{height:40,width:40},mainDescription:{fontSize:"200%"},deleteDialog:{padding:20},narrowContent:{padding:"8px 8px 8px 8px"}},je=()=>{const e=$();return e.display?t.jsx("div",{style:e.style,children:e.item.preview}):null},we={_id:"system.user.",type:"user",common:{name:"",password:"",enabled:!0,color:"",desc:""},native:{},enums:{}},_e={_id:void 0,native:{},type:"group",common:{name:"",desc:"",members:[],dontDelete:void 0,acl:{object:{list:!1,read:!1,write:!1,delete:!1,create:void 0},state:{list:!1,read:!1,write:!1,create:!1,delete:!1},users:{list:!1,read:!1,write:!1,create:!1,delete:!1},other:{execute:!1,http:!1,sendto:!1},file:{list:!1,read:!1,write:!1,create:!1,delete:!1}},icon:"",color:""}};class C extends j.Component{constructor(s){super(s),this.state={users:null,groups:null,userEditDialog:!1,userEditDialogNew:null,groupEditDialog:!1,groupEditDialogNew:null,userDeleteDialog:!1,groupDeleteDialog:!1,innerWidth:0}}componentDidMount(){this.setState({innerWidth:window.innerWidth},()=>this.updateData())}componentDidUpdate(){window.innerWidth!==this.state.innerWidth&&setTimeout(()=>this.setState({innerWidth:window.innerWidth}),100)}getText=s=>s&&(typeof s=="object"?s[this.props.lang]||s.en||"":s||"")||"";showUserEditDialog=(s,o)=>{s=h.clone(s),s.common.password=s.common.password?U:"",this.setState({userEditDialog:s,userEditDialogNew:o})};showGroupEditDialog=(s,o)=>{s=h.clone(s),this.setState({groupEditDialog:s,groupEditDialogNew:o})};updateData=()=>{let s;return this.props.socket.getForeignObjects("system.user.*","user").then(o=>(s=Object.values(o).sort((r,n)=>r._id>n._id?1:-1),s.forEach(r=>{r.common&&r.common.description&&(r.common.desc||(r.common.desc=r.common.description),delete r.common.description)}),this.props.socket.getForeignObjects("system.group.*","group"))).then(o=>{const r=Object.values(o).sort((n,a)=>n._id>a._id?1:-1);r.forEach(n=>{n.common&&n.common.description&&(n.common.desc||(n.common.desc=n.common.description),delete n.common.description)}),this.setState({groups:r,users:s})})};changeUserFormData=s=>this.setState({userEditDialog:s});changeGroupFormData=s=>this.setState({groupEditDialog:s});saveUser=async s=>{const o=h.clone(this.state.userEditDialog),r=this.state.users.find(a=>a._id===o._id),n=o.common.password&&o.common.password!==U?o.common.password:"";if(r?o.common.password=r.common.password:o.common.password="",await this.props.socket.setObject(o._id,o),typeof this.state.userEditDialog=="object"&&s&&s!==this.state.userEditDialog._id)try{await this.props.socket.delObject(s);for(let a=0;a<this.state.groups.length;a++){const m=this.state.groups[a];if(m.common.members.includes(s)){const p=h.clone(m);p.common.members[p.common.members.indexOf(s)]=o._id,await this.props.socket.setObject(p._id,p)}}}catch(a){window.alert(`Cannot delete user: ${a}`)}if(n)try{await this.props.socket.changePassword(o._id,n)}catch(a){window.alert(`Cannot change password: ${a}`)}this.setState({userEditDialog:!1},()=>this.updateData())};saveGroup=async s=>{if(typeof this.state.groupEditDialog=="object"){if(await this.props.socket.setObject(this.state.groupEditDialog._id,this.state.groupEditDialog),s&&s!==this.state.groupEditDialog._id)try{await this.props.socket.delObject(s)}catch(o){window.alert(`Cannot delete user: ${o}`)}this.setState({groupEditDialog:!1},()=>this.updateData())}};showUserDeleteDialog=s=>this.setState({userDeleteDialog:s});showGroupDeleteDialog=s=>this.setState({groupDeleteDialog:s});deleteUser=s=>{this.props.socket.delObject(s).then(()=>Promise.all(this.state.groups.map(o=>{if(o.common.members.includes(s)){const r=h.clone(o);return r.common.members.splice(r.common.members.indexOf(s),1),this.props.socket.setObject(r._id,r)}return Promise.resolve(null)}))).catch(o=>window.alert(`Cannot delete user: ${o}`)).then(()=>{this.setState({userDeleteDialog:!1},()=>this.updateData())})};deleteGroup=s=>this.props.socket.delObject(s).then(()=>this.setState({groupDeleteDialog:!1},()=>this.updateData())).catch(o=>window.alert(`Cannot delete user: ${o}`));addUserToGroup=(s,o)=>{const r=this.state.groups.find(a=>a._id===o),n=r.common.members;n.includes(s)||(n.push(s),this.props.socket.setObject(r._id,r).then(()=>this.updateData()).catch(a=>window.alert(`Cannot delete user: ${a}`)))};removeUserFromGroup=(s,o)=>{const r=this.state.groups.find(a=>a._id===o),n=r.common.members;n.includes(s)&&(n.splice(n.indexOf(s),1),this.props.socket.setObject(r._id,r).then(()=>this.updateData()))};static _isUniqueName(s,o,r){return!s.find(n=>n._id===`system.user.${o.toLowerCase()}_${r}`||n.common.name===`${o} ${r}`)}static findNewUniqueName(s,o,r){let n=1;for(;!C._isUniqueName(o,r,n);)n++;return{_id:`system.${s?"group":"user"}.${r.toLowerCase()}_${n}`,name:`${r} ${n}`}}render(){return!this.state.users||!this.state.groups?t.jsx(i.LinearProgress,{}):t.jsxs(N,{backend:b.isTouchDevice()?W:z,children:[t.jsx(je,{}),t.jsx(i.Box,{component:"div",sx:u.descriptionPanel,children:this.props.t("You can drag users to groups.")}),t.jsxs(i.Grid2,{container:!0,spacing:2,style:u.mainGridCont,children:[t.jsxs(i.Grid2,{size:{xs:12,md:6},style:{...u.childGridCont,...this.state.innerWidth>600?u.childGridContWide:void 0},children:[t.jsxs("div",{style:u.headContainer,children:[t.jsx(i.Fab,{size:"small",style:u.right,onClick:()=>{const{_id:s,name:o}=C.findNewUniqueName(!0,this.state.groups,this.props.t("Group")),r=h.clone(_e);r._id=s,r.common.name=o,this.showGroupEditDialog(r,!0)},children:t.jsx(d.GroupAdd,{})}),t.jsx(i.Typography,{gutterBottom:!0,variant:"h4",component:"h4",children:this.props.t("Groups")})]}),t.jsx("div",{style:u.blocksContainer,children:this.state.groups.sort((s,o)=>{var a,m;const r=(this.getText((a=s==null?void 0:s.common)==null?void 0:a.name)||s._id).toLowerCase(),n=(this.getText((m=o==null?void 0:o.common)==null?void 0:m.name)||o._id).toLowerCase();return r>n?1:r<n?-1:0}).map(s=>t.jsx(me,{themeType:this.props.themeType,group:s,users:this.state.users,showGroupEditDialog:this.showGroupEditDialog,showGroupDeleteDialog:this.showGroupDeleteDialog,removeUserFromGroup:this.removeUserFromGroup,getText:this.getText,styles:u,...this.props},s._id))})]}),t.jsxs(i.Grid2,{size:{xs:12,md:6},style:{...u.childGridCont,...this.state.innerWidth>600?u.childGridContWide:void 0},children:[t.jsxs("div",{style:u.headContainer,children:[t.jsx(i.Fab,{size:"small",style:u.right,onClick:()=>{const{_id:s,name:o}=C.findNewUniqueName(!1,this.state.users,this.props.t("User")),r=h.clone(we);r._id=s,r.common.name=o,this.showUserEditDialog(r,!0)},children:t.jsx(d.PersonAdd,{})}),t.jsx(i.Typography,{gutterBottom:!0,variant:"h4",component:"h4",children:this.props.t("Users")})]}),t.jsx("div",{style:u.blocksContainer,children:this.state.users.sort((s,o)=>{var a,m;const r=(this.getText((a=s==null?void 0:s.common)==null?void 0:a.name)||s._id).toLowerCase(),n=(this.getText((m=o==null?void 0:o.common)==null?void 0:m.name)||o._id).toLowerCase();return r>n?1:r<n?-1:0}).map(s=>t.jsx(de,{themeType:this.props.themeType,user:s,groups:this.state.groups,showUserEditDialog:this.showUserEditDialog,showUserDeleteDialog:this.showUserDeleteDialog,updateData:this.updateData,addUserToGroup:this.addUserToGroup,removeUserFromGroup:this.removeUserFromGroup,getText:this.getText,styles:u,...this.props},s._id))})]})]}),this.state.userEditDialog?t.jsx(ue,{onClose:()=>this.setState({userEditDialog:!1}),users:this.state.users,user:this.state.userEditDialog,isNew:this.state.userEditDialogNew,t:this.props.t,getText:this.getText,styles:u,onChange:this.changeUserFormData,saveData:this.saveUser,innerWidth:this.state.innerWidth}):null,this.state.groupEditDialog?t.jsx(fe,{onClose:()=>this.setState({groupEditDialog:!1}),groups:this.state.groups,group:this.state.groupEditDialog,isNew:this.state.groupEditDialogNew,t:this.props.t,getText:this.getText,styles:u,onChange:this.changeGroupFormData,innerWidth:this.state.innerWidth,saveData:this.saveGroup}):null,this.state.userDeleteDialog?t.jsx(ye,{getText:this.getText,onClose:()=>this.setState({userDeleteDialog:!1}),user:this.state.userDeleteDialog,t:this.props.t,deleteUser:this.deleteUser}):null,this.state.groupDeleteDialog?t.jsx(De,{getText:this.getText,onClose:()=>this.setState({groupDeleteDialog:!1}),group:this.state.groupDeleteDialog,t:this.props.t,styles:u,deleteGroup:this.deleteGroup}):null]})}}function at(e){return t.jsx(B,{children:t.jsx(R,{style:{display:"flex",flexDirection:"column",overflow:"auto"},children:t.jsx(C,{t:e.t,lang:e.lang,socket:e.socket,ready:e.ready,expertMode:e.expertMode,themeType:e.themeType,theme:e.theme})})})}export{at as default};