iobroker.javascript 9.0.6 → 9.0.7

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 (26) hide show
  1. package/README.md +3 -5
  2. package/admin/assets/OpenAiDialog-CVjeP8wR.js +34 -0
  3. package/admin/assets/{Save-BKC3BS3x.js → Save-DgI3b32B.js} +1 -1
  4. package/admin/assets/{ScriptEditor-CzFTsfG9.js → ScriptEditor-CXV4FkqA.js} +1 -1
  5. package/admin/assets/{ScriptEditorVanillaMonaco-DEgxOslR.js → ScriptEditorVanillaMonaco-D-2WOvcn.js} +1 -1
  6. package/admin/assets/{createSvgIcon-BQT-7-GS.js → createSvgIcon-Dtl7HhPO.js} +3 -3
  7. package/admin/assets/{index-glyB1sbj.js → index-BwNmFzfy.js} +1 -1
  8. package/admin/assets/{index-DnqHzUyv.js → index-C5V5CZI4.js} +1 -1
  9. package/admin/assets/{index-JSzqpJXf.js → index-C8bcOa64.js} +9 -9
  10. package/admin/assets/{index-Cek-i92T.js → index-DLBeMhRC.js} +4 -4
  11. package/admin/assets/{index-BHQhuPkd.js → index-D_7ZHRw9.js} +1 -1
  12. package/admin/assets/{index-CpeX0MWe.js → index-Del0XJb9.js} +1 -1
  13. package/admin/assets/{inheritsLoose--KnFDOw1.js → inheritsLoose-C9MZGDit.js} +1 -1
  14. package/admin/assets/{useTheme-DF6qfrtI.js → useTheme-g_P2Itm2.js} +1 -1
  15. package/admin/custom/assets/{index-DxyyYdTq.js → index-B6ima1M5.js} +7 -7
  16. package/admin/custom/assets/index-CoMexdpH.js +1399 -0
  17. package/admin/custom/customComponents.js +2 -2
  18. package/admin/google-blockly/own/blocks_procedures.js +15 -9
  19. package/admin/google-blockly/own/blocks_time.js +20 -6
  20. package/admin/mf-manifest.json +1 -1
  21. package/admin/remoteEntry.js +2 -2
  22. package/admin/tab.html +4 -4
  23. package/io-package.json +14 -14
  24. package/package.json +1 -1
  25. package/admin/assets/OpenAiDialog-9N4LihWY.js +0 -34
  26. package/admin/custom/assets/index-Coei6-WB.js +0 -1399
@@ -1,18 +1,18 @@
1
- import{c as U,j as Q,o as Pe,a as vM,b as bM,d as QM,P as S}from"./createSvgIcon-BQT-7-GS.js";import{i as f,R as M}from"./iobroker_javascript__loadShare__react__loadShare__-BiJPUKBK.js";import{i as j,c as Ne,C as Oe,a as nt,S as lL,Q as gN,b as jN,Y as NL,Z,$ as LL,a0 as gL,a1 as jL,a2 as yL,a3 as UM,a4 as TL,a5 as dL,a6 as DL,a7 as hL,a8 as zL,a9 as $M,aa as wL,ab as CL,ac as IL,ad as pL,ae as AL,af as mL,ag as OL,ah as EL,ai as fL,aj as xL,ak as _L,al as SL,am as PM,an as WM,ao as kL,ap as BM,D as YL,aq as vL,ar as bL,as as QL,at as JM,au as UL,av as $L,aw as PL,T as WL,I as Pi}from"./index-DnqHzUyv.js";import{I as un}from"./Save-BKC3BS3x.js";import{c as ir,g as BL}from"./_commonjsHelpers-Cpj98o6Y.js";import{u as JL}from"./useTheme-DF6qfrtI.js";import{t as B}from"./index-Dm1jc4t6.js";import"./iobroker_javascript__mf_v__runtimeInit__mf_v__-CBQgOKij.js";const ln=U(Q.jsx("path",{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6z"}),"Add"),RL=U(Q.jsx("path",{d:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20z"}),"ArrowBack"),FL=U(Q.jsx("path",{d:"m10 17 5-5-5-5z"}),"ArrowRight"),GL=U(Q.jsx("path",{d:"M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8zm2 11h-3v3.75c0 1.24-1.01 2.25-2.25 2.25S8.5 17.99 8.5 16.75s1.01-2.25 2.25-2.25c.46 0 .89.14 1.25.38V11h4zm-3-4V3.5L18.5 9z"}),"AudioFile"),HL=U([Q.jsx("path",{d:"M16.5 12h-9c-.55 0-1 .45-1 1v1h11v-1c0-.55-.45-1-1-1M7.25 8.5h4v2h-4zm5.5 0h4v2h-4z"},"0"),Q.jsx("path",{d:"M20 2H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2m-1 15h-1.5v-1.5h-11V17H5v-3.83c0-.66.25-1.26.65-1.72V9c0-1.1.9-2 2-2H11c.37 0 .72.12 1 .32.28-.2.63-.32 1-.32h3.35c1.1 0 2 .9 2 2v2.45c.4.46.65 1.06.65 1.72z"},"1")],"BedroomParent"),VL=U(Q.jsx("path",{d:"M17 3H7c-1.1 0-1.99.9-1.99 2L5 21l7-3 7 3V5c0-1.1-.9-2-2-2"}),"Bookmark"),ZL=U(Q.jsx("path",{d:"M17 3H7c-1.1 0-1.99.9-1.99 2L5 21l7-3 7 3V5c0-1.1-.9-2-2-2m0 15-5-2.18L7 18V5h10z"}),"BookmarkBorder"),XL=U(Q.jsx("path",{d:"M22 24H2v-4h20zM13.06 5.19l3.75 3.75L7.75 18H4v-3.75zm4.82 2.68-3.75-3.75 1.83-1.83c.39-.39 1.02-.39 1.41 0l2.34 2.34c.39.39.39 1.02 0 1.41z"}),"BorderColor"),KL=U(Q.jsx("path",{d:"M20 8.69V4h-4.69L12 .69 8.69 4H4v4.69L.69 12 4 15.31V20h4.69L12 23.31 15.31 20H20v-4.69L23.31 12zM12 18c-.89 0-1.74-.2-2.5-.55C11.56 16.5 13 14.42 13 12s-1.44-4.5-3.5-5.45C10.26 6.2 11.11 6 12 6c3.31 0 6 2.69 6 6s-2.69 6-6 6"}),"Brightness4"),qL=U(Q.jsx("path",{d:"M20 15.31 23.31 12 20 8.69V4h-4.69L12 .69 8.69 4H4v4.69L.69 12 4 15.31V20h4.69L12 23.31 15.31 20H20zM12 18c-3.31 0-6-2.69-6-6s2.69-6 6-6 6 2.69 6 6-2.69 6-6 6"}),"Brightness5"),ua=U(Q.jsx("path",{d:"M20 15.31 23.31 12 20 8.69V4h-4.69L12 .69 8.69 4H4v4.69L.69 12 4 15.31V20h4.69L12 23.31 15.31 20H20zM12 18V6c3.31 0 6 2.69 6 6s-2.69 6-6 6"}),"Brightness6"),eg=U(Q.jsx("path",{d:"M20 8.69V4h-4.69L12 .69 8.69 4H4v4.69L.69 12 4 15.31V20h4.69L12 23.31 15.31 20H20v-4.69L23.31 12zM12 18c-3.31 0-6-2.69-6-6s2.69-6 6-6 6 2.69 6 6-2.69 6-6 6m0-10c-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4-1.79-4-4-4"}),"Brightness7"),tg=U(Q.jsx("path",{d:"m22.7 19-9.1-9.1c.9-2.3.4-5-1.5-6.9-2-2-5-2.4-7.4-1.3L9 6 6 9 1.6 4.7C.4 7.1.9 10.1 2.9 12.1c1.9 1.9 4.6 2.4 6.9 1.5l9.1 9.1c.4.4 1 .4 1.4 0l2.3-2.3c.5-.4.5-1.1.1-1.4"}),"Build"),sg=U(Q.jsx("path",{d:"M20 3h-1V1h-2v2H7V1H5v2H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m0 18H4V8h16z"}),"CalendarToday"),la=U(Q.jsx("path",{d:"M9.4 16.6 4.8 12l4.6-4.6L8 6l-6 6 6 6zm5.2 0 4.6-4.6-4.6-4.6L16 6l6 6-6 6z"}),"Code"),ig=U(Q.jsx("path",{d:"m20.71 5.63-2.34-2.34a.996.996 0 0 0-1.41 0l-3.12 3.12-1.93-1.91-1.41 1.41 1.42 1.42L3 16.25V21h4.75l8.92-8.92 1.42 1.42 1.41-1.41-1.92-1.92 3.12-3.12c.4-.4.4-1.03.01-1.42M6.92 19 5 17.08l8.06-8.06 1.92 1.92z"}),"Colorize"),rg=U(Q.jsx("path",{d:"m13.7826 15.1719 2.1213-2.1213 5.9963 5.9962-2.1213 2.1213zM17.5 10c1.93 0 3.5-1.57 3.5-3.5 0-.58-.16-1.12-.41-1.6l-2.7 2.7-1.49-1.49 2.7-2.7c-.48-.25-1.02-.41-1.6-.41C15.57 3 14 4.57 14 6.5c0 .41.08.8.21 1.16l-1.85 1.85-1.78-1.78.71-.71-1.41-1.41L12 3.49c-1.17-1.17-3.07-1.17-4.24 0L4.22 7.03l1.41 1.41H2.81l-.71.71 3.54 3.54.71-.71V9.15l1.41 1.41.71-.71 1.78 1.78-7.41 7.41 2.12 2.12L16.34 9.79c.36.13.75.21 1.16.21"}),"Construction"),og=U(Q.jsx("path",{d:"M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2m0 16H8V7h11z"}),"ContentCopy"),yN=U(Q.jsx("path",{d:"M20 6h-8l-2-2H4c-1.11 0-1.99.89-1.99 2L2 18c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2V8c0-1.11-.89-2-2-2m-1 8h-3v3h-2v-3h-3v-2h3V9h2v3h3z"}),"CreateNewFolder"),ng=U(Q.jsx("path",{d:"M17 15h2V7c0-1.1-.9-2-2-2H9v2h8zM7 17V1H5v4H1v2h4v10c0 1.1.9 2 2 2h10v4h2v-4h4v-2z"}),"Crop"),ag=U(Q.jsx("path",{d:"M4 7v2c0 .55-.45 1-1 1H2v4h1c.55 0 1 .45 1 1v2c0 1.65 1.35 3 3 3h3v-2H7c-.55 0-1-.45-1-1v-2c0-1.3-.84-2.42-2-2.83v-.34C5.16 11.42 6 10.3 6 9V7c0-.55.45-1 1-1h3V4H7C5.35 4 4 5.35 4 7m17 3c-.55 0-1-.45-1-1V7c0-1.65-1.35-3-3-3h-3v2h3c.55 0 1 .45 1 1v2c0 1.3.84 2.42 2 2.83v.34c-1.16.41-2 1.52-2 2.83v2c0 .55-.45 1-1 1h-3v2h3c1.65 0 3-1.35 3-3v-2c0-.55.45-1 1-1h1v-4z"}),"DataObject"),Kr=U(Q.jsx("path",{d:"M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8zm2 16H8v-2h8zm0-4H8v-2h8zm-3-5V3.5L18.5 9z"}),"Description"),Mg=U(Q.jsx("path",{d:"M18.41 5.8 17.2 4.59c-.78-.78-2.05-.78-2.83 0l-2.68 2.68L3 15.96V20h4.04l8.74-8.74 2.63-2.63c.79-.78.79-2.05 0-2.83M6.21 18H5v-1.21l8.66-8.66 1.21 1.21zM11 20l4-4h6v4z"}),"DriveFileRenameOutline"),mi=U(Q.jsx("path",{d:"M3 17.25V21h3.75L17.81 9.94l-3.75-3.75zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34a.996.996 0 0 0-1.41 0l-1.83 1.83 3.75 3.75z"}),"Edit"),cg=U(Q.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m1 15h-2v-2h2zm0-4h-2V7h2z"}),"Error"),ug=U(Q.jsx("path",{d:"M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z"}),"ExpandMore"),lg=U(Q.jsx("path",{d:"M20 19.59V8l-6-6H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c.45 0 .85-.15 1.19-.4l-4.43-4.43c-.8.52-1.74.83-2.76.83-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5c0 1.02-.31 1.96-.83 2.75zM9 13c0 1.66 1.34 3 3 3s3-1.34 3-3-1.34-3-3-3-3 1.34-3 3"}),"FindInPage"),Ng=U(Q.jsx("path",{d:"M20 6h-8l-2-2H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2m0 12H4V8h16z"}),"FolderOpen"),Lg=U(Q.jsx("path",{d:"M20 6h-8l-2-2H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2m-2.06 11L15 15.28 12.06 17l.78-3.33-2.59-2.24 3.41-.29L15 8l1.34 3.14 3.41.29-2.59 2.24z"}),"FolderSpecial"),gg=U(Q.jsx("path",{d:"M9.93 13.5h4.14L12 7.98zM20 2H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2m-4.05 16.5-1.14-3H9.17l-1.12 3H5.96l5.11-13h1.86l5.11 13z"}),"FontDownload"),jg=U(Q.jsx("path",{d:"M10 4v3h2.21l-3.42 8H6v3h8v-3h-2.21l3.42-8H18V4z"}),"FormatItalic"),yg=U(Q.jsx("path",{d:"M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2M8.5 13.5l2.5 3.01L14.5 12l4.5 6H5z"}),"Image"),Na=U(Q.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m1 15h-2v-6h2zm0-8h-2V7h2z"}),"Info"),TN=U(Q.jsx("path",{d:"M6 2c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm7 7V3.5L18.5 9z"}),"InsertDriveFile"),Tg=U(Q.jsx("path",{d:"M19 7v4H5.83l3.58-3.59L8 6l-6 6 6 6 1.41-1.41L5.83 13H21V7z"}),"KeyboardReturn"),dN=U(Q.jsx("path",{d:"M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1M8 13h8v-2H8zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5"}),"Link"),dg=U(Q.jsx("path",{d:"M3 13h2v-2H3zm0 4h2v-2H3zm0-8h2V7H3zm4 4h14v-2H7zm0 4h14v-2H7zM7 7v2h14V7z"}),"List"),Dg=U(Q.jsx("path",{d:"M19 5v14H5V5zm1.1-2H3.9c-.5 0-.9.4-.9.9v16.2c0 .4.4.9.9.9h16.2c.4 0 .9-.5.9-.9V3.9c0-.5-.5-.9-.9-.9M11 7h6v2h-6zm0 4h6v2h-6zm0 4h6v2h-6zM7 7h2v2H7zm0 4h2v2H7zm0 4h2v2H7z"}),"ListAlt"),hg=U(Q.jsx("path",{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m-5 14h-2V9h-2V7h4z"}),"LooksOne"),zg=U(Q.jsx("path",{d:"M12 3v10.55c-.59-.34-1.27-.55-2-.55-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4V7h4V3z"}),"MusicNote"),wg=U(Q.jsx("path",{d:"M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"}),"NavigateNext"),La=U(Q.jsx("path",{d:"M12 6c1.1 0 2 .9 2 2s-.9 2-2 2-2-.9-2-2 .9-2 2-2m0 10c2.7 0 5.8 1.29 6 2H6c.23-.72 3.31-2 6-2m0-12C9.79 4 8 5.79 8 8s1.79 4 4 4 4-1.79 4-4-1.79-4-4-4m0 10c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4"}),"PersonOutlined"),Cg=U(Q.jsx("path",{d:"M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2M8.5 13.5l2.5 3.01L14.5 12l4.5 6H5z"}),"Photo"),Sr=U(Q.jsx("path",{d:"M5 4v2h14V4zm0 10h4v6h6v-6h4l-7-7z"}),"Publish"),DN=U(Q.jsx("path",{d:"M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4z"}),"Refresh"),ga=U(Q.jsx("path",{d:"m20.2 5.9.8-.8C19.6 3.7 17.8 3 16 3s-3.6.7-5 2.1l.8.8C13 4.8 14.5 4.2 16 4.2s3 .6 4.2 1.7m-.9.8c-.9-.9-2.1-1.4-3.3-1.4s-2.4.5-3.3 1.4l.8.8c.7-.7 1.6-1 2.5-1s1.8.3 2.5 1zM19 13h-2V9h-2v4H5c-1.1 0-2 .9-2 2v4c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-4c0-1.1-.9-2-2-2M8 18H6v-2h2zm3.5 0h-2v-2h2zm3.5 0h-2v-2h2z"}),"Router"),Ig=U(Q.jsx("path",{d:"M19 12v7H5v-7H3v7c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-7zm-6 .67 2.59-2.58L17 11.5l-5 5-5-5 1.41-1.41L11 12.67V3h2z"}),"SaveAlt"),Nn=U(Q.jsx("path",{d:"M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58c.18-.14.23-.41.12-.61l-1.92-3.32c-.12-.22-.37-.29-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54c-.04-.24-.24-.41-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.05.3-.09.63-.09.94s.02.64.07.94l-2.03 1.58c-.18.14-.23.41-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6"}),"Settings"),kr=U(Q.jsx("path",{d:"M12 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m7-7H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2m-1.75 9c0 .23-.02.46-.05.68l1.48 1.16c.13.11.17.3.08.45l-1.4 2.42c-.09.15-.27.21-.43.15l-1.74-.7c-.36.28-.76.51-1.18.69l-.26 1.85c-.03.17-.18.3-.35.3h-2.8c-.17 0-.32-.13-.35-.29l-.26-1.85c-.43-.18-.82-.41-1.18-.69l-1.74.7c-.16.06-.34 0-.43-.15l-1.4-2.42c-.09-.15-.05-.34.08-.45l1.48-1.16c-.03-.23-.05-.46-.05-.69s.02-.46.05-.68l-1.48-1.16c-.13-.11-.17-.3-.08-.45l1.4-2.42c.09-.15.27-.21.43-.15l1.74.7c.36-.28.76-.51 1.18-.69l.26-1.85c.03-.17.18-.3.35-.3h2.8c.17 0 .32.13.35.29l.26 1.85c.43.18.82.41 1.18.69l1.74-.7c.16-.06.34 0 .43.15l1.4 2.42c.09.15.05.34-.08.45l-1.48 1.16c.03.23.05.46.05.69"}),"SettingsApplications"),pg=U(Q.jsx("path",{d:"m3.5 18.49 6-6.01 4 4L22 6.92l-1.41-1.41-7.09 7.97-4-4L2 16.99z"}),"ShowChart"),ja=U(Q.jsx("path",{d:"M11.99 2c-5.52 0-10 4.48-10 10s4.48 10 10 10 10-4.48 10-10-4.48-10-10-10m3.61 6.34c1.07 0 1.93.86 1.93 1.93s-.86 1.93-1.93 1.93-1.93-.86-1.93-1.93c-.01-1.07.86-1.93 1.93-1.93m-6-1.58c1.3 0 2.36 1.06 2.36 2.36s-1.06 2.36-2.36 2.36-2.36-1.06-2.36-2.36c0-1.31 1.05-2.36 2.36-2.36m0 9.13v3.75c-2.4-.75-4.3-2.6-5.14-4.96 1.05-1.12 3.67-1.69 5.14-1.69.53 0 1.2.08 1.9.22-1.64.87-1.9 2.02-1.9 2.68M11.99 20c-.27 0-.53-.01-.79-.04v-4.07c0-1.42 2.94-2.13 4.4-2.13 1.07 0 2.92.39 3.84 1.15-1.17 2.97-4.06 5.09-7.45 5.09"}),"SupervisedUserCircle"),Ag=U(Q.jsx("path",{d:"M2.5 4v3h5v12h3V7h5V4zm19 5h-9v3h3v7h3v-7h3z"}),"TextFields"),mg=U(Q.jsx("path",{d:"M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8zm4 18H6V4h7v5h5zM8 15.01l1.41 1.41L11 14.84V19h2v-4.16l1.59 1.59L16 15.01 12.01 11z"}),"UploadFileOutlined"),Og=U(Q.jsx("path",{d:"M16 13h-3V3h-2v10H8l4 4zM4 19v2h16v-2z"}),"VerticalAlignBottom"),Eg=U(Q.jsx("path",{d:"M8 11h3v10h2V11h3l-4-4zM4 3v2h16V3z"}),"VerticalAlignTop"),fg=U(Q.jsx("path",{d:"M17 10.5V7c0-.55-.45-1-1-1H4c-.55 0-1 .45-1 1v10c0 .55.45 1 1 1h12c.55 0 1-.45 1-1v-3.5l4 4v-11z"}),"Videocam"),xg=U(Q.jsx("path",{d:"M14.67 5v14H9.33V5zm1 14H21V5h-5.33zm-7.34 0V5H3v14z"}),"ViewColumn"),_g=U(Q.jsx("path",{d:"M4 15h16v-2H4zm0 4h16v-2H4zm0-8h16V9H4zm0-6v2h16V5z"}),"ViewHeadline"),Sg=U(Q.jsx("path",{d:"M14.67 5v6.5H9.33V5zm1 6.5H21V5h-5.33zm-1 7.5v-6.5H9.33V19zm1-6.5V19H21v-6.5zm-7.34 0H3V19h5.33zm0-1V5H3v6.5z"}),"ViewModule"),kg=U(Q.jsx("path",{d:"M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5M12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5m0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3"}),"Visibility"),Yg=U(Q.jsx("path",{d:"M1 21h22L12 2zm12-3h-2v-2h2zm0-4h-2v-4h2z"}),"Warning"),Qs=U(Q.jsx("path",{d:"m1 9 2 2c4.97-4.97 13.03-4.97 18 0l2-2C16.93 2.93 7.08 2.93 1 9m8 8 3 3 3-3c-1.65-1.66-4.34-1.66-6 0m-4-4 2 2c2.76-2.76 7.24-2.76 10 0l2-2C15.14 9.14 8.87 9.14 5 13"}),"Wifi"),rr=U(Q.jsx("path",{d:"M22.99 9C19.15 5.16 13.8 3.76 8.84 4.78l2.52 2.52c3.47-.17 6.99 1.05 9.63 3.7zm-4 4c-1.29-1.29-2.84-2.13-4.49-2.56l3.53 3.53zM2 3.05 5.07 6.1C3.6 6.82 2.22 7.78 1 9l1.99 2c1.24-1.24 2.67-2.16 4.2-2.77l2.24 2.24C7.81 10.89 6.27 11.73 5 13v.01L6.99 15c1.36-1.36 3.14-2.04 4.92-2.06L18.98 20l1.27-1.26L3.29 1.79zM9 17l3 3 3-3c-1.65-1.66-4.34-1.66-6 0"}),"WifiOff"),Oo=11/23/100;function RM(s){const e={r:0,g:0,b:0};if(s.length===7)e.r=parseInt(s.substring(1,3),16),e.g=parseInt(s.substring(3,5),16),e.b=parseInt(s.substring(5,7),16);else if(s.length===4){const t=s[1],i=s[2],r=s[3];e.r=parseInt(t+t,16),e.g=parseInt(i+i,16),e.b=parseInt(r+r,16)}return e}function vg(s){return`#${Math.round(s.r).toString(16)}${Math.round(s.g).toString(16)}${Math.round(s.b).toString(16)}`}function bg(s,e,t){const i=RM(s),r=RM(e);return i.r+=r.r*(.05+Oo*(t-1)),i.g+=r.g*(.05+Oo*(t-1)),i.b+=r.b*(.05+Oo*(t-1)),vg(i)}function FM(s,e){const t={};for(let i=1;i<=24;i++)t[`elevation${i}`]={backgroundColor:bg(s,e,i)};return t}function Qg(s,e){var n,a,c,l,N,u,L,g,y,T,d;let t,i;s==="dark"?(i={MuiAppBar:{colorDefault:{backgroundColor:"#272727"}},MuiLink:{root:{textTransform:"uppercase",transition:"color .3s ease",color:Pe[200],"&:hover":{color:Pe[100]}}},MuiPaper:FM("#121212","#fff")},t={name:s,palette:{mode:"dark",background:{paper:"#121212",default:"#121212"},primary:{main:"#4dabf5"},secondary:{main:"#436a93"},expert:"#14bb00",text:{primary:"#ffffff",secondary:"#ffffff"}}}):s==="blue"?(i={MuiAppBar:{colorDefault:{backgroundColor:"#3399CC"}},MuiLink:{root:{textTransform:"uppercase",transition:"color .3s ease",color:Pe[400],"&:hover":{color:Pe[300]}}}},t={name:s,palette:{mode:"dark",background:{paper:"#151d21",default:"#151d21"},primary:{main:"#4dabf5"},secondary:{main:"#436a93"},expert:"#14bb00",text:{primary:"#ffffff",secondary:"#ffffff"}}}):s==="colored"?(i={MuiAppBar:{colorDefault:{backgroundColor:"#2a3135"}},MuiLink:{root:{textTransform:"uppercase",transition:"color .3s ease",color:Pe[200],"&:hover":{color:Pe[100]}}},MuiPaper:FM("#151d21","#fff")},t={name:s,palette:{mode:"light",primary:{main:"#3399CC"},secondary:{main:"#164477"},expert:"#96fc96"}}):s==="PT"?(i={MuiAppBar:{colorDefault:{backgroundColor:"#0F99DE"}},MuiLink:{root:{textTransform:"uppercase",transition:"color .3s ease",color:Pe[400],"&:hover":{color:Pe[300]}}}},t={name:s,palette:{mode:"light",primary:{main:"#0F99DE"},secondary:{main:"#88A536"},expert:"#BD1B24"}}):s==="DX"?(i={MuiAppBar:{colorDefault:{backgroundColor:"#a9a9a9"}},MuiLink:{root:{textTransform:"uppercase",transition:"color .3s ease",color:Pe[400],"&:hover":{color:Pe[300]}}}},t={name:s,palette:{mode:"light",primary:{main:"#F5F5F7"},secondary:{main:"#a9a9a9"},expert:"#BD1B24",text:{primary:"#007AFE",secondary:"#007AFE",disabled:"#007AFEAA"}}}):(i={MuiLink:{root:{textTransform:"uppercase",transition:"color .3s ease",color:Pe[400],"&:hover":{color:Pe[300]}}}},t={name:s,palette:{mode:"light",primary:{main:"#3399CC",dark:"#256c97",light:"#76d0fd"},secondary:{main:"#164477"},expert:"#14bb00"}}),t.toolbar={height:48},t.saveToolbar={background:(a=(n=t.palette)==null?void 0:n.primary)==null?void 0:a.main,button:{borderRadius:3,height:32}},t.palette&&(t.palette.grey={main:vM[300],dark:vM[400]});const r=bM(t),o=r.palette;return bM(r,{...e||void 0,components:{...i,MuiButton:{variants:[{props:{variant:"contained",color:"grey"},style:{backgroundColor:(c=o.grey)==null?void 0:c[300],color:o.getContrastText&&((l=o.grey)!=null&&l[300])?o.getContrastText(o.grey[300]):void 0}},{props:{variant:"outlined",color:"grey"},style:{color:(N=o.text)==null?void 0:N.primary,borderColor:o.mode==="light"?"rgba(0, 0, 0, 0.23)":"rgba(255, 255, 255, 0.23)","&.Mui-disabled":{border:`1px solid ${(u=o.action)==null?void 0:u.disabledBackground}`},"&:hover":{borderColor:o.mode==="light"?"rgba(0, 0, 0, 0.23)":"rgba(255, 255, 255, 0.23)",backgroundColor:QM(((L=o.text)==null?void 0:L.primary)||"",((g=o.action)==null?void 0:g.hoverOpacity)||.04)}}},{props:{variant:"text",color:"grey"},style:{color:(y=o.text)==null?void 0:y.primary,"&:hover":{backgroundColor:QM(((T=o.text)==null?void 0:T.primary)||"",((d=o.action)==null?void 0:d.hoverOpacity)||.04)}}}]},...(e==null?void 0:e.components)||void 0}})}function Ug(){let s,e;const t=new Promise((i,r)=>{s=i,e=r});return t.resolve=s,t.reject=e,t}function Ln(s){return(s==null?void 0:s.rows.map(e=>e.value).filter(e=>!!e))??[]}function Tt(s){return s!=null&&s.startsWith("system.host.")||(s=`system.host.${s}`),s}function ui(s){return s!=null&&s.startsWith("system.host.")&&(s=s.substring(12)),s}function GM(s){return new Promise(e=>{setTimeout(e,s)})}function or(s){s=(s||"").toString();const e=s[0]==="*",t=s[s.length-1]==="*";return s=s.replace(/[-/\\^$+?.()|[\]{}]/g,"\\$&").replace(/\*/g,".*"),(e?"":"^")+s+(t?"":"$")}var rt;(function(s){s[s.CONNECTING=0]="CONNECTING",s[s.CONNECTED=1]="CONNECTED",s[s.OBJECTS_LOADED=2]="OBJECTS_LOADED",s[s.READY=3]="READY"})(rt||(rt={}));var Ie;(function(s){s.PERMISSION_ERROR="permissionError",s.NOT_CONNECTED="notConnectedError",s.TIMEOUT="timeout",s.NOT_ADMIN="Allowed only in admin",s.NOT_SUPPORTED="Not supported"})(Ie||(Ie={}));const F3e=Ie.PERMISSION_ERROR;Ie.NOT_CONNECTED;const $g=["material","echarts","vis"];class ze{constructor(e){this.props=this.applyDefaultProps(e),this.connId=`${this.props.name?`${this.props.name}-`:""}${Math.round(Math.random()*1e6).toString().padStart(6,"0")}`,this.waitForSocketLib().then(()=>this.startSocket()).catch(t=>{alert(`Socket connection could not be initialized: ${t}`)})}applyDefaultProps(e){return{...e,protocol:e.protocol||window.location.protocol,host:e.host||window.location.hostname,port:e.port||(window.location.port==="3000"?8081:window.location.port),ioTimeout:Math.max(e.ioTimeout||2e4,2e4),cmdTimeout:Math.max(e.cmdTimeout||5e3,5e3),admin5only:e.admin5only||!1,autoSubscribes:e.autoSubscribes??[],autoSubscribeLog:e.autoSubscribeLog??!1,doNotLoadACL:e.doNotLoadACL??!0,doNotLoadAllObjects:e.doNotLoadAllObjects??!0}}props;connId;lastAccessToken=null;ignoreState="";connected=!1;subscribed=!1;firstConnect=!0;waitForRestart=!1;loaded=!1;simStates={};statesSubscribes={};filesSubscribes={};objectsSubscribes={};objects={};states={};acl=null;isSecure=!1;onReadyDone=!1;onConnectionHandlers=[];onLogHandlers=[];onCmdStdoutHandler;onCmdStderrHandler;onCmdExitHandler;onError(e){(this.props.onError??console.error)(e)}_socket;_waitForSocketPromise;_waitForFirstConnectionPromise=Ug();_instanceSubscriptions={};_promises={};_authTimer=null;_refreshTimer=null;_systemConfig;get systemConfig(){return this._systemConfig}systemLang="en";static isWeb(){return window.socketUrl!==void 0}waitForSocketLib(){return this._waitForSocketPromise?this._waitForSocketPromise:(this._waitForSocketPromise=new Promise(async(e,t)=>{if(typeof window.io>"u"&&typeof window.iob>"u")if(typeof window.registerSocketOnLoad=="function")window.registerSocketOnLoad(()=>e());else{for(let i=1;i<=30;i++){if(window.io||window.iob)return e();await GM(100)}t(new Error("Socket library could not be loaded!"))}else e()}),this._waitForSocketPromise)}async startSocket(){if(this._socket)return;let e=this.props.host,t=this.props.port,i=(this.props.protocol||window.location.protocol).replace(":",""),r=window.location.pathname;if(window.location.hostname==="iobroker.net"||window.location.hostname==="iobroker.pro")r="";else{if(window.socketUrl){const a=new URL(window.socketUrl);e=a.hostname,t=a.port,i=a.protocol.replace(":","")}const n=r.lastIndexOf("/");if(n!==-1&&(r=r.substring(0,n+1)),ze.isWeb()){const a=r.split("/");a.length>2&&(a.pop(),a.pop(),$g.includes(a[a.length-1])&&a.pop(),r=a.join("/"),r.endsWith("/")||(r+="/"))}}const o=t?`${i}://${e}:${t}`:`${i}://${e}`;return this._socket=(window.io||window.iob).connect(o,{path:r.endsWith("/")?`${r}socket.io`:`${r}/socket.io`,query:"ws=true",name:this.props.name,timeout:this.props.ioTimeout,uuid:this.props.uuid,token:this.props.token}),this._socket.on("connect",n=>{window.addEventListener("storage",this.onAccessTokenUpdated);const a=ze.readTokens();if(a&&!a.owner){const c=Date.now();this.saveTokens({access_token:a.access_token,refresh_token:a.refresh_token,expires_in:Math.round((a.expires_in.getTime()-c)/1e3),refresh_token_expires_in:Math.round((a.refresh_token_expires_in.getTime()-c)/1e3),token_type:"Bearer"},a.stayLoggedIn)}this.onReadyDone=!1,n!==!0?(this.connected=!0,setTimeout(()=>this.getVersion().then(c=>{const[l,N,u]=c.version.split(".");parseInt(l,10)*1e4+parseInt(N,10)*100+parseInt(u,10)<40102?(this._authTimer=null,this.onPreConnect(!1,!1)):this._socket.emit("authenticate",(g,y)=>this.onPreConnect(g,y))}).catch(c=>this.onError({message:c.toString(),operation:"getVersion"})),500)):this._socket.emit("authenticate",(c,l)=>{this.onPreConnect(c,l)})}),this._socket.on("reconnect",()=>{var n,a;this.onReadyDone=!1,(a=(n=this.props).onProgress)==null||a.call(n,rt.READY),this.connected=!0,this.waitForRestart?window.location.reload():(this._subscribe(!0),this.onConnectionHandlers.forEach(c=>c(!0)))}),this._socket.on("disconnect",()=>{var n,a;this.onReadyDone=!1,this.connected=!1,this.subscribed=!1,(a=(n=this.props).onProgress)==null||a.call(n,rt.CONNECTING),this.onConnectionHandlers.forEach(c=>c(!1))}),this._socket.on("reauthenticate",()=>this.authenticate()),this._socket.on("log",n=>{var a,c;(c=(a=this.props).onLog)==null||c.call(a,n),this.onLogHandlers.forEach(l=>l(n))}),this._socket.on("error",n=>{let a;n==null?a="":typeof n.toString=="function"?a=n.toString():(a=JSON.stringify(n),console.error(`Received strange error: ${a}`)),a.includes("User not authorized")?this.authenticate():a.includes("websocket error")?(console.error(`Socket Error => reload: ${n}`),window.location.reload()):console.error(`Socket Error: ${n}`)}),this._socket.on("connect_error",n=>console.error(`Connect error: ${n}`)),this._socket.on("permissionError",n=>this.onError({message:"no permission",operation:n.operation,type:n.type,id:n.id||""})),this._socket.on("objectChange",(n,a)=>{setTimeout(()=>this.objectChange(n,a),0)}),this._socket.on("stateChange",(n,a)=>{setTimeout(()=>this.stateChange(n,a),0)}),this._socket.on("im",(n,a,c)=>{setTimeout(()=>this.instanceMessage(n,a,c),0)}),this._socket.on("fileChange",(n,a,c)=>{setTimeout(()=>this.fileChange(n,a,c),0)}),this._socket.on("cmdStdout",(n,a)=>{var c;(c=this.onCmdStdoutHandler)==null||c.call(this,n,a)}),this._socket.on("cmdStderr",(n,a)=>{var c;(c=this.onCmdStderrHandler)==null||c.call(this,n,a)}),this._socket.on("cmdExit",(n,a)=>{var c;(c=this.onCmdExitHandler)==null||c.call(this,n,a)}),Promise.resolve()}onPreConnect(e,t){var i,r;this._authTimer&&(clearTimeout(this._authTimer),this._authTimer=null),this.connected=!0,this.isSecure=t,this.waitForRestart?window.location.reload():(this.firstConnect?this.loadData().catch(o=>console.error(`Cannot load data: ${o}`)):(r=(i=this.props).onProgress)==null||r.call(i,rt.READY),this._subscribe(!0),this.onConnectionHandlers.forEach(o=>o(!0)),this.checkAccessTokenExpire()),this._waitForFirstConnectionPromise.resolve()}static readTokens(){let e=window.sessionStorage.getItem("iob_tokens");const t=!e;if(e||(e=window.localStorage.getItem("iob_tokens")),!e)return null;const[i,r,o,n,a]=e.split(";"),c=new Date(r);return c.getTime()<Date.now()?null:{refresh_token:i,refresh_token_expires_in:c,access_token:o,expires_in:new Date(n),owner:a,stayLoggedIn:t}}static saveTokensStatic(e,t,i){const r=`${e.refresh_token};${new Date(Date.now()+e.refresh_token_expires_in*1e3).toISOString()};${e.access_token};${new Date(Date.now()+e.expires_in*1e3).toISOString()}${i?`;${i}`:""}`;t?window.localStorage.setItem("iob_tokens",r):window.sessionStorage.setItem("iob_tokens",r)}saveTokens(e,t){ze.saveTokensStatic(e,t,this.connId)}static deleteTokensStatic(){window.localStorage.removeItem("iob_tokens"),window.sessionStorage.removeItem("iob_tokens")}deleteTokens(e,t){const i=ze.readTokens();i&&(t?ze.deleteTokensStatic():i.stayLoggedIn===e&&i.owner===this.connId&&(i.stayLoggedIn?window.localStorage.removeItem("iob_tokens"):window.sessionStorage.removeItem("iob_tokens")))}onAccessTokenUpdated=e=>{if(e.key==="iob_tokens"){const t=ze.readTokens();t&&(console.log(`Tab ${this.connId} received updated token: ${t.access_token}`),this.updateTokenExpiration(t.access_token))}};updateTokenExpiration(e){this.lastAccessToken!==e&&(this.lastAccessToken=e,this._socket.emit("updateTokenExpiration",e,(t,i)=>{t?(console.error(`[UPDATE/${new Date().toISOString()}] cannot say to server about new token: ${t}`),window.location.reload()):i?console.log(`[UPDATE/${new Date().toISOString()}] server accepted new token: ${e}`):(console.error(`[UPDATE/${new Date().toISOString()}] cannot say to server about new token`),window.location.reload())})),this.checkAccessTokenExpire()}refreshTokens(e,t){if(!e){console.log(`[REFRESH/${new Date().toISOString()}] No token structure found => reloading the page`),setTimeout(()=>window.location.reload(),500);return}t||!e.owner||e.owner===this.connId?(console.log(`[REFRESH/${new Date().toISOString()}] claim ownership of the token`),this.acquireTokenLock()?(console.log(`[REFRESH/${new Date().toISOString()}] refreshing token`),fetch("./oauth/token",{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:`grant_type=refresh_token&refresh_token=${e.refresh_token}&client_id=ioBroker&stayloggedin=${e.stayLoggedIn}`}).then(i=>{if(i.ok)return i.json();throw new Error("Cannot refresh access token")}).then(i=>{if(i.access_token)console.log(`[REFRESH/${new Date().toISOString()}] received new token: ${i.access_token}`),this.saveTokens(i,e.stayLoggedIn),this.releaseTokenLock(),this.updateTokenExpiration(i.access_token);else throw new Error("Cannot get access token")}).catch(i=>{console.warn(`[REFRESH/${new Date().toISOString()}] cannot refresh token: ${i}`),this.releaseTokenLock(),this.deleteTokens(e.stayLoggedIn),console.error(i),window.location.reload()})):(console.log(`[REFRESH/${new Date().toISOString()}] Someone else is updating the token, so wait for the next check`),this.checkAccessTokenExpire())):this.lastAccessToken!==e.access_token&&this.updateTokenExpiration(e.access_token)}acquireTokenLock(){const e=Date.now(),t=localStorage.getItem("iob_token_semaphore");if(t)try{const r=JSON.parse(t);if(e<r.expiry)return!1}catch{}const i={connId:this.connId,expiry:e+10*1e3};return localStorage.setItem("iob_token_semaphore",JSON.stringify(i)),!0}releaseTokenLock(){const e=localStorage.getItem("iob_token_semaphore");if(e)try{JSON.parse(e).connId===this.connId&&localStorage.removeItem("iob_token_semaphore")}catch{localStorage.removeItem("iob_token_semaphore")}}checkAccessTokenExpire(){if(this._refreshTimer&&(clearTimeout(this._refreshTimer),this._refreshTimer=null),this.isSecure){const e=ze.readTokens();if(e){const t=e.expires_in.getTime();if(t<Date.now()+3e4){const i=t<Date.now()+5500;console.log(`[TOKEN/${new Date().toISOString()}] Updating refresh token ${e.access_token}`),e.refresh_token?e.owner===this.connId||i?(e.owner===this.connId?console.log(`[TOKEN/${new Date().toISOString()}] We are the owner of the token`):console.log(`[TOKEN/${new Date().toISOString()}] We are not the owner of the token, but we will take ownership`),this.props.tokenTimeoutHandler?(console.log(`[TOKEN/${new Date().toISOString()}] Asking GUI if we should prolong the token`),this.props.tokenTimeoutHandler(t).then(r=>{r?(console.log(`[TOKEN/${new Date().toISOString()}] Token will be prolonged`),this.refreshTokens(e,i)):(console.log(`[TOKEN/${new Date().toISOString()}] Token will not be prolonged. Reloading the page`),setTimeout(()=>window.location.reload(),Date.now()>t?500:t-Date.now()))})):(console.log(`[TOKEN/${new Date().toISOString()}] No tokenTimeoutHandler defined. Prolonging the token`),this.refreshTokens(e,i))):this.lastAccessToken!==e.access_token?(console.log(`[TOKEN/${new Date().toISOString()}] We are not the owner of the token, but we will inform the server about new token`),this.refreshTokens(e)):(console.log(`[TOKEN/${new Date().toISOString()}] We are not the owner of the token and the token did not change. Check in 3 seconds if the owner updated the token`),this._refreshTimer=setTimeout(()=>{this._refreshTimer=null,this.checkAccessTokenExpire()},3e3)):(console.log(`[TOKEN/${new Date().toISOString()}] We do not have a refresh token, so we need to reauthenticate`),setTimeout(()=>window.location.reload(),Date.now()>t?500:t-Date.now()))}else this._refreshTimer=setTimeout(()=>{this._refreshTimer=null,this.checkAccessTokenExpire()},t-Date.now()-3e4>12e4?12e4:t-Date.now()-3e4)}}}static isCloud(){return window.location.hostname.includes("amazonaws.com")||window.location.hostname.includes("iobroker.in")?!0:typeof window.socketUrl>"u"?!1:window.socketUrl.includes("iobroker.in")||window.socketUrl.includes("amazonaws")}isConnected(){return this.connected}waitForFirstConnection(){return this._waitForFirstConnectionPromise}async getUserPermissions(){return this.request({commandTimeout:!1,executor:(e,t)=>{this._socket.emit("getUserPermissions",(i,r)=>{i?t(i):e(r||null)})}})}async loadData(){if(this.loaded)return;const e=10;for(let t=1;t<=e;t++){if(this.doLoadData().catch(i=>console.error(`Cannot load data: ${i}`)),this.loaded)return;await GM(ze.isCloud()?5e3:1e3)}}async doLoadData(){var e,t,i,r,o,n,a,c,l;if(!this.loaded){if(!this.props.doNotLoadACL)try{this.acl=await this.getUserPermissions()}catch(N){this.onError(`Cannot read user permissions: ${N}`);return}try{this.props.admin5only&&!ze.isWeb()&&(!window.vendorPrefix||window.vendorPrefix==="@@vendorPrefix@@")?this._systemConfig=await this.getCompactSystemConfig():this._systemConfig=await this.getSystemConfig()}catch(N){this.onError(`Cannot read system config: ${N}`);return}this._systemConfig&&(this.systemLang=(e=this._systemConfig.common)==null?void 0:e.language,this.systemLang||(this.systemLang=window.navigator.userLanguage||window.navigator.language,/^(en|de|ru|pt|nl|fr|it|es|pl|uk)-?/.test(this.systemLang)?this.systemLang=this.systemLang.substring(0,2):/^(en|de|ru|pt|nl|fr|it|es|pl|uk|zh-cn)$/.test(this.systemLang)||(this.systemLang="en"),this._systemConfig.common.language=this.systemLang)),(i=(t=this.props).onLanguage)==null||i.call(t,this.systemLang),this.loaded=!0,(o=(r=this.props).onProgress)==null||o.call(r,rt.CONNECTED),this.firstConnect=!1,this.props.doNotLoadAllObjects?this.props.admin5only?this.objects={}:this.objects={"system.config":this._systemConfig}:this.objects=await this.getObjects(),(a=(n=this.props).onProgress)==null||a.call(n,rt.READY),this.onReadyDone||(this.onReadyDone=!0,(l=(c=this.props).onReady)==null||l.call(c,this.objects))}}authenticate(){window.location.search.includes("&href=")?window.location.href=`${window.location.protocol}//${window.location.host}${window.location.pathname}${window.location.search}`:window.location.href=`${window.location.protocol}//${window.location.host}${window.location.pathname}?login&href=${encodeURIComponent(window.location.search+window.location.hash)}`}async subscribeState(...e){let t,i,r;e.length===3?[t,i,r]=e:([t,r]=e,i=!1);let o;if(Array.isArray(t)?o=t:o=[t],typeof r!="function")throw new Error("The state change handler must be a function!");const n=[];for(let a=0;a<o.length;a++){const c=o[a];this.statesSubscribes[c]?!this.statesSubscribes[c].cbs.includes(r)&&this.statesSubscribes[c].cbs.push(r):(this.statesSubscribes[c]={reg:new RegExp(or(c)),cbs:[r]},t!==this.ignoreState&&n.push(c))}if(this.connected)if(n.length&&this._socket.emit("subscribe",n),i){let a;for(let c=0;c<o.length;c++){try{a=await this.getBinaryState(o[c])}catch(l){console.error(`Cannot getBinaryState "${o[c]}": ${JSON.stringify(l)}`),a=void 0}a!=null&&r(o[c],a)}}else if(o.find(a=>a.includes("*"))){let a;for(let c=0;c<o.length;c++){try{a=await this.getForeignStates(o[c])}catch(l){console.error(`Cannot getForeignStates "${o[c]}": ${JSON.stringify(l)}`);return}if(a)for(const[l,N]of Object.entries(a)){const u=r(l,N);u instanceof Promise&&u.catch(L=>console.error(`Cannot call state change handler: ${L}`))}}}else try{const a=await(ze.isWeb()?this.getStates(o):this.getForeignStates(o));if(a)for(const[c,l]of Object.entries(a)){const N=r(c,l);N instanceof Promise&&N.catch(u=>console.error(`Cannot call state change handler: ${u}`))}}catch(a){console.error(`Cannot getState "${o.join(", ")}": ${a.message}`);return}}async subscribeStateAsync(e,t){return this.subscribeState(e,t)}unsubscribeState(e,t){var o;let i;Array.isArray(e)?i=e:i=[e];const r=[];for(let n=0;n<i.length;n++){const a=i[n];if(this.statesSubscribes[a]){const c=this.statesSubscribes[a];if(t){const l=c.cbs.indexOf(t);l!==-1&&c.cbs.splice(l,1)}else c.cbs=[];(o=c.cbs)!=null&&o.length||(delete this.statesSubscribes[a],a!==this.ignoreState&&r.push(a))}}this.connected&&r.length&&this._socket.emit("unsubscribe",i)}subscribeObject(e,t){let i;if(Array.isArray(e)?i=e:i=[e],typeof t!="function")throw new Error("The object change handler must be a function!");const r=[];for(let o=0;o<i.length;o++){const n=i[o];this.objectsSubscribes[n]?!this.objectsSubscribes[n].cbs.includes(t)&&this.objectsSubscribes[n].cbs.push(t):(this.objectsSubscribes[n]={reg:new RegExp(or(n)),cbs:[t]},r.push(n))}return this.connected&&r.length&&this._socket.emit("subscribeObjects",r),Promise.resolve()}unsubscribeObject(e,t){var o;let i;Array.isArray(e)?i=e:i=[e];const r=[];for(let n=0;n<i.length;n++){const a=i[n];if(this.objectsSubscribes[a]){const c=this.objectsSubscribes[a];if(t){const l=c.cbs.indexOf(t);l!==-1&&c.cbs.splice(l,1)}else c.cbs=[];(o=c.cbs)!=null&&o.length||(delete this.objectsSubscribes[a],r.push(a))}}return this.connected&&r.length&&this._socket.emit("unsubscribeObjects",r),Promise.resolve()}objectChange(e,t){var o,n;let i;this.objects[e]&&(i={_id:e,type:this.objects[e].type});let r=!1;t?(t._rev&&this.objects[e]&&(this.objects[e]._rev=t._rev),(!this.objects[e]||JSON.stringify(this.objects[e])!==JSON.stringify(t))&&(this.objects[e]=t,r=!0)):this.objects[e]&&(delete this.objects[e],r=!0);for(const[a,c]of Object.entries(this.objectsSubscribes))(a===e||c.reg.test(e))&&c.cbs.forEach(l=>{try{const N=l(e,t,i);N instanceof Promise&&N.catch(u=>console.error(`Cannot call object change handler: ${u}`))}catch(N){console.error(`Error by callback of objectChange: ${N}`)}});if(r){const a=(n=(o=this.props).onObjectChange)==null?void 0:n.call(o,e,t);a instanceof Promise&&a.catch(c=>console.error(`Cannot call object change handler: ${c}`))}}stateChange(e,t){for(const i of Object.values(this.statesSubscribes))if(i.reg.test(e))for(const r of i.cbs)try{const o=r(e,t??null);o instanceof Promise&&o.catch(n=>console.error(`Cannot call state change handler: ${n}`))}catch(o){console.error(`Error by callback of stateChanged: ${o}`)}}instanceMessage(e,t,i){var r;(r=this._instanceSubscriptions[t])==null||r.forEach(o=>{if(o.messageType===e){const n=o.callback(i,t,e);n instanceof Promise&&n.catch(a=>console.error(`Cannot call instance message handler: ${a}`))}})}fileChange(e,t,i){for(const r of Object.values(this.filesSubscribes))if(r.regId.test(e)&&r.regFilePattern.test(t))for(const o of r.cbs)try{o(e,t,i)}catch(n){console.error(`Error by callback of fileChange: ${n}`)}}async subscribeFiles(e,t,i){if(typeof i!="function")throw new Error("The state change handler must be a function!");let r;Array.isArray(t)?r=t:r=[t];const o=[];for(let n=0;n<r.length;n++){const a=r[n],c=`${e}$%$${a}`;this.filesSubscribes[c]?!this.filesSubscribes[c].cbs.includes(i)&&this.filesSubscribes[c].cbs.push(i):(this.filesSubscribes[c]={regId:new RegExp(or(e)),regFilePattern:new RegExp(or(a)),cbs:[i]},o.push(a))}return this.connected&&o.length&&this._socket.emit("subscribeFiles",e,o),Promise.resolve()}unsubscribeFiles(e,t,i){var n;let r;Array.isArray(t)?r=t:r=[t];const o=[];for(let a=0;a<r.length;a++){const c=r[a],l=`${e}$%$${c}`;if(this.filesSubscribes[l]){const N=this.filesSubscribes[l];if(i){const u=N.cbs.indexOf(i);u!==-1&&N.cbs.splice(u,1)}else N.cbs=[];(n=N.cbs)!=null&&n.length||(delete this.filesSubscribes[l],o.push(c))}}this.connected&&o.length&&this._socket.emit("unsubscribeFiles",e,o)}async request({cacheKey:e,forceUpdate:t,commandTimeout:i,onTimeout:r,requireAdmin:o,requireFeatures:n,executor:a}){if(o&&ze.isWeb())return Promise.reject(new Error(Ie.NOT_ADMIN));if(e&&!t&&e in this._promises)return this._promises[e];if(!this.connected)return Promise.reject(new Error(Ie.NOT_CONNECTED));if(n!=null&&n.length){for(const l of n)if(!await this.checkFeatureSupported(l))throw new Error(Ie.NOT_SUPPORTED)}const c=new Promise(async(l,N)=>{const u={elapsed:!1,clearTimeout:()=>{}};let L;i!==!1&&(L=setTimeout(()=>{u.elapsed=!0,r==null||r(),e&&this._promises[e]instanceof Promise&&delete this._promises[e],N(new Error(Ie.TIMEOUT))},i??this.props.cmdTimeout),u.clearTimeout=()=>{clearTimeout(L)});try{await a(l,N,u)}catch(g){e&&this._promises[e]instanceof Promise&&delete this._promises[e],N(new Error(g.toString()))}});return e&&(this._promises[e]=c),c}resetCache(e,t){t?Object.keys(this._promises).filter(i=>i.startsWith(e)).forEach(i=>{delete this._promises[i]}):delete this._promises[e]}getStates(e){return this.request({commandTimeout:!1,executor:(t,i)=>{this._socket.emit("getStates",e,(r,o)=>{this.states=o??{},r?i(r):t(this.states)})}})}getState(e){return this.request({commandTimeout:!1,executor:(t,i)=>{if(e&&e===this.ignoreState){t(this.simStates[e]||{val:null,ack:!0});return}this._socket.emit("getState",e,(r,o)=>{r?i(r):t(o)})}})}getBinaryState(e){return this.request({commandTimeout:!1,executor:(t,i)=>{this._socket.emit("getBinaryState",e,(r,o)=>{r?i(r):t(o)})}})}setBinaryState(e,t){return this.request({commandTimeout:!1,executor:(i,r)=>{this._socket.emit("setBinaryState",e,t,o=>{o?r(o):i()})}})}setState(e,t,i){return typeof i=="boolean"&&(t={val:t,ack:i}),this.request({commandTimeout:!1,executor:(r,o)=>{if(e&&e===this.ignoreState){let n;if(typeof i=="boolean"||typeof t=="object"&&t.val!==void 0?n=t:n={val:t,ack:!1,ts:Date.now(),lc:Date.now(),from:"system.adapter.vis.0"},this.simStates[e]=n,this.statesSubscribes[e])for(const a of this.statesSubscribes[e].cbs)try{const c=a(e,n);c instanceof Promise&&c.catch(l=>console.error(`Cannot call state change handler: ${l}`))}catch(c){console.error(`Error by callback of stateChanged: ${c}`)}r();return}this._socket.emit("setState",e,t,n=>{n?o(n):r()})}})}getObjects(e,t){return this.request({commandTimeout:!1,executor:(i,r)=>{if(!e&&this.objects){i(this.objects);return}this._socket.emit(ze.isWeb()?"getObjects":"getAllObjects",(o,n)=>{var a,c;t||(c=(a=this.props).onProgress)==null||c.call(a,rt.OBJECTS_LOADED),o?r(o):(this.objects=n??{},i(this.objects))})}})}getObjectsById(e){return this.request({commandTimeout:!1,executor:(t,i)=>{this._socket.emit("getObjects",e,(r,o)=>{r?i(r):t(o)})}})}_subscribe(e){var t,i;if(e&&!this.subscribed){this.subscribed=!0,(t=this.props.autoSubscribes)!=null&&t.length&&this._socket.emit("subscribeObjects",this.props.autoSubscribes);const r=Object.keys(this.objectsSubscribes);r.length&&this._socket.emit("subscribeObjects",r),Object.keys(this.objectsSubscribes).forEach(o=>this._socket.emit("subscribeObjects",o)),this.props.autoSubscribeLog&&this._socket.emit("requireLog",!0),Object.keys(this.statesSubscribes).forEach(o=>this._socket.emit("subscribe",o)),Object.keys(this.filesSubscribes).forEach(o=>{const[n,a]=o.split("$%$");this._socket.emit("subscribeFiles",n,a)})}else if(!e&&this.subscribed){this.subscribed=!1,(i=this.props.autoSubscribes)!=null&&i.length&&this._socket.emit("unsubscribeObjects",this.props.autoSubscribes);const r=Object.keys(this.objectsSubscribes);r.length&&this._socket.emit("unsubscribeObjects",r),this.props.autoSubscribeLog&&this._socket.emit("requireLog",!1),Object.keys(this.statesSubscribes).forEach(o=>this._socket.emit("unsubscribe",o)),Object.keys(this.filesSubscribes).forEach(o=>{const[n,a]=o.split("$%$");this._socket.emit("unsubscribeFiles",n,a)})}}requireLog(e){return this.request({commandTimeout:!1,executor:(t,i)=>{this._socket.emit("requireLog",e,r=>{r?i(r):t()})}})}delObject(e,t=!1){return this.request({commandTimeout:!1,executor:(i,r)=>{this._socket.emit("delObject",e,{maintenance:t},o=>{o?r(o):i()})}})}delObjects(e,t){return this.request({commandTimeout:!1,executor:(i,r)=>{this._socket.emit("delObjects",e,{maintenance:t},o=>{o?r(o):i()})}})}setObject(e,t){return t?(t=JSON.parse(JSON.stringify(t)),delete t.from,delete t.user,delete t.ts,this.request({commandTimeout:!1,executor:(i,r)=>{this._socket.emit("setObject",e,t,o=>{o?r(o):i()})}})):Promise.reject(new Error("Null object is not allowed"))}getObject(e){return this.request({commandTimeout:!1,executor:(t,i)=>{if(e&&e===this.ignoreState){t({_id:this.ignoreState,type:"state",common:{name:"ignored state",type:"mixed"}});return}this._socket.emit("getObject",e,(r,o)=>{r?i(r):t(o)})}})}sendTo(e,t,i){return this.request({commandTimeout:!1,executor:r=>{this._socket.emit("sendTo",e,t,i,o=>{r(o)})}})}extendObject(e,t){return t?(t=JSON.parse(JSON.stringify(t)),delete t.from,delete t.user,delete t.ts,this.request({commandTimeout:!1,executor:(i,r)=>{this._socket.emit("extendObject",e,t,o=>{o?r(o):i()})}})):Promise.reject(new Error("Null object is not allowed"))}registerLogHandler(e){this.onLogHandlers.includes(e)||this.onLogHandlers.push(e)}unregisterLogHandler(e){const t=this.onLogHandlers.indexOf(e);t!==-1&&this.onLogHandlers.splice(t,1)}registerConnectionHandler(e){this.onConnectionHandlers.includes(e)||this.onConnectionHandlers.push(e)}unregisterConnectionHandler(e){const t=this.onConnectionHandlers.indexOf(e);t!==-1&&this.onConnectionHandlers.splice(t,1)}registerCmdStdoutHandler(e){this.onCmdStdoutHandler=e}unregisterCmdStdoutHandler(){this.onCmdStdoutHandler=void 0}registerCmdStderrHandler(e){this.onCmdStderrHandler=e}unregisterCmdStderrHandler(){this.onCmdStderrHandler=void 0}registerCmdExitHandler(e){this.onCmdExitHandler=e}unregisterCmdExitHandler(){this.onCmdExitHandler=void 0}getEnums(e,t){return this.request({cacheKey:`enums_${e||"all"}`,forceUpdate:t,commandTimeout:!1,executor:(i,r)=>{this._socket.emit("getObjectView","system","enum",{startkey:`enum.${e||""}`,endkey:e?`enum.${e}.香`:"enum.香"},(o,n)=>{if(o)r(o);else{const a={};if(n)for(let c=0;c<n.rows.length;c++)e&&n.rows[c].id===`enum.${e}`||(a[n.rows[c].id]=n.rows[c].value);i(a)}})}})}getObjectView(e,t,i){return this.getObjectViewCustom("system",i,e,t)}getObjectViewSystem(e,t,i){return this.getObjectViewCustom("system",e,t,i)}getObjectViewCustom(e,t,i,r){return this.request({commandTimeout:!1,executor:(o,n)=>{i=i||"",r=r||"香",this._socket.emit("getObjectView",e,t,{startkey:i,endkey:r},(a,c)=>{if(a)n(a);else{const l={};if(c&&c.rows)for(let N=0;N<c.rows.length;N++)l[c.rows[N].id]=c.rows[N].value;o(l)}})}})}readMetaItems(){return this.request({commandTimeout:!1,executor:(e,t)=>{this._socket.emit("getObjectView","system","meta",{startkey:"",endkey:"香"},(i,r)=>{var o;i?t(i):e((o=r.rows)==null?void 0:o.map(n=>n.value).filter(n=>!!n))})}})}readDir(e,t){return this.request({commandTimeout:!1,executor:(i,r)=>{this._socket.emit("readDir",e,t,(o,n)=>{o?r(o):i(n)})}})}readFile(e,t,i){return this.request({commandTimeout:!1,executor:(r,o)=>{this._socket.emit(i?"readFile64":"readFile",e,t,(n,a,c)=>{n?o(n):r({file:a,mimeType:c})})}})}writeFile64(e,t,i){return this.request({commandTimeout:!1,executor:(r,o)=>{if(typeof i=="string")this._socket.emit("writeFile",e,t,i,n=>{n?o(n):r()});else{const n=btoa(new Uint8Array(i).reduce((a,c)=>a+String.fromCharCode(c),""));this._socket.emit("writeFile64",e,t,n,a=>{a?o(a):r()})}}})}deleteFile(e,t){return this.request({commandTimeout:!1,executor:(i,r)=>{this._socket.emit("deleteFile",e,t,o=>{o?r(o):i()})}})}deleteFolder(e,t){return this.request({commandTimeout:!1,executor:(i,r)=>{this._socket.emit("deleteFolder",e,t,o=>{o?r(o):i()})}})}rename(e,t,i){return this.request({commandTimeout:!1,executor:(r,o)=>{this._socket.emit("rename",e,t,i,n=>{n?o(n):r()})}})}renameFile(e,t,i){return this.request({commandTimeout:!1,executor:(r,o)=>{this._socket.emit("renameFile",e,t,i,n=>{n?o(n):r()})}})}cmdExec(e,t,i,r){return this.request({commandTimeout:r,executor:(o,n,a)=>{e=Tt(e),this._socket.emit("cmdExec",e,i,t,c=>{a.elapsed||(a.clearTimeout(),c?n(c):o())})}})}getSystemConfig(e){return this.request({cacheKey:"systemConfig",forceUpdate:e,commandTimeout:!1,executor:async t=>{let i=await this.getObject("system.config");i??={},i.common??={},i.native??={},t(i)}})}getCompactSystemConfig(e){return this.request({cacheKey:"systemConfigCommon",forceUpdate:e,commandTimeout:!1,requireAdmin:!0,executor:(t,i)=>{this._socket.emit("getCompactSystemConfig",(r,o)=>{r?i(r):(o??={},o.common??={},o.native??={},t(o))})}})}getForeignStates(e){return this.request({commandTimeout:!1,executor:(t,i)=>{this._socket.emit("getForeignStates",e||"*",(r,o)=>{r?i(r):t(o??{})})}})}getForeignObjects(e,t){return this.request({commandTimeout:!1,executor:(i,r)=>{this._socket.emit("getForeignObjects",e||"*",t,(o,n)=>{o?r(o):i(n)})}})}setSystemConfig(e){return this.setObject("system.config",e)}getRawSocket(){return this._socket}getHistory(e,t){return this.request({commandTimeout:!1,executor:(i,r)=>{this._socket.emit("getHistory",e,t,(o,n)=>{o?r(o):i(n)})}})}getHistoryEx(e,t){return this.request({commandTimeout:!1,executor:(i,r)=>{this._socket.emit("getHistory",e,t,(o,n,a,c)=>{o?r(o):i({values:n,sessionId:c,step:a})})}})}getIpAddresses(e,t){return e=Tt(e),this.request({cacheKey:`IPs_${e}`,forceUpdate:t,commandTimeout:!1,executor:async i=>{const r=await this.getObject(e);i((r==null?void 0:r.common.address)??[])}})}getVersion(e){return this.request({cacheKey:"version",forceUpdate:e,commandTimeout:!1,executor:(t,i)=>{this._socket.emit("getVersion",(r,o,n)=>{r&&!o&&typeof r=="string"&&r.match(/\d+\.\d+\.\d+/)?t({version:r,serverName:"socketio"}):r?i(r):t({version:o,serverName:n})})}})}getWebServerName(){return this.request({cacheKey:"webName",commandTimeout:!1,executor:(e,t)=>{this._socket.emit("getAdapterName",(i,r)=>{i?t(i):e(r)})}})}fileExists(e,t){return this.request({commandTimeout:!1,executor:(i,r)=>{this._socket.emit("fileExists",e,t,(o,n)=>{o?r(o):i(!!n)})}})}getCurrentUser(){return this.request({commandTimeout:!1,executor:e=>{this._socket.emit("authEnabled",(t,i)=>{e(i)})}})}getUuid(){return this.request({cacheKey:"uuid",commandTimeout:!1,executor:async e=>{var i;const t=await this.getObject("system.meta.uuid");e((i=t==null?void 0:t.native)==null?void 0:i.uuid)}})}checkFeatureSupported(e,t){return this.request({cacheKey:`supportedFeatures_${e}`,forceUpdate:t,commandTimeout:!1,executor:(i,r)=>{this._socket.emit("checkFeatureSupported",e,(o,n)=>{o?r(o):i(n)})}})}getAdapterInstances(e,t){return typeof e=="boolean"&&(t=e,e=""),e=e||"",this.request({cacheKey:`instances_${e}`,forceUpdate:t,commandTimeout:!1,executor:async i=>{const r=e?`system.adapter.${e}.`:"system.adapter.",o=`${r}香`,n=await this.getObjectViewSystem("instance",r,o),a=Object.values(n);i(e?a.filter(c=>c.common.name===e):a)}})}getAdapters(e,t){return typeof e=="boolean"&&(t=e,e=""),e=e||"",this.request({cacheKey:`adapter_${e}`,forceUpdate:t,commandTimeout:!1,executor:async i=>{const r=await this.getObjectViewSystem("adapter",`system.adapter.${e||""}`,`system.adapter.${e||"香"}`),o=Object.values(r);i(e?o.filter(n=>n.common.name===e):o)}})}getGroups(e){return this.request({cacheKey:"groups",forceUpdate:e,commandTimeout:!1,executor:(t,i)=>{this._socket.emit("getObjectView","system","group",{startkey:"system.group.",endkey:"system.group.香"},(r,o)=>{r?i(r):t(Ln(o))})}})}logout(){return this.request({commandTimeout:!1,executor:(e,t)=>{this._socket.emit("logout",i=>{i?t(i):e(null)})}})}subscribeOnInstance(e,t,i,r){return this.request({commandTimeout:!1,executor:(o,n)=>{this._socket.emit("clientSubscribe",e,t,i,(a,c)=>{a?n(a):c&&(c.error?n(c.error):(e.startsWith("system.adapter.")||(e=`system.adapter.${e}`),this._instanceSubscriptions[e]=this._instanceSubscriptions[e]||[],this._instanceSubscriptions[e].find(l=>l.messageType===t&&l.callback===r)||this._instanceSubscriptions[e].push({messageType:t,callback:r}),o(c)))})}})}unsubscribeFromInstance(e,t,i){var n;e.startsWith("system.adapter.")||(e=`system.adapter.${e}`);let r;const o=[];do{r=!1;const a=(n=this._instanceSubscriptions[e])==null?void 0:n.findIndex(c=>(!t||c.messageType===t)&&(!i||c.callback===i));if(a!=null&&a!==-1){r=!0;const c=this._instanceSubscriptions[e][a].messageType;this._instanceSubscriptions[e].splice(a,1),this._instanceSubscriptions[e].length||delete this._instanceSubscriptions[e],this._instanceSubscriptions[e]&&this._instanceSubscriptions[e].find(N=>N.messageType===c)||o.push(this.request({commandTimeout:!1,executor:(N,u)=>{this._socket.emit("clientUnsubscribe",e,t,(L,g)=>L?u(L):N(g))}}))}}while(r&&(!i||!t));return o.length?Promise.all(o).then(a=>!!a.find(c=>c)):Promise.resolve(!1)}log(e,t){return e?this.request({commandTimeout:!1,executor:i=>(this._socket.emit("log",e,t),i(null))}):Promise.resolve(null)}setStateToIgnore(e){this.ignoreState=e}}function Pg(s,e){if(!e)return;let t;if(e.length<700&&(e.indexOf("/")!==-1||e.indexOf("\\")!==-1))if(s.toLowerCase().includes("private"))t="private";else if(e.toLowerCase().includes("private"))t="private";else if(s.toLowerCase().includes("public"))t="public";else if(e.toLowerCase().includes("public"))t="public";else if(s.toLowerCase().includes("chain"))t="chained";else if(e.toLowerCase().includes("chain"))t="chained";else return;else t=e.substring(0,26)==="-----BEGIN RSA PRIVATE KEY"||e.substring(0,22)==="-----BEGIN PRIVATE KEY"?"private":"public",t==="public"&&e.split("-----END CERTIFICATE-----").filter(r=>r.replace(/\r\n|\r|\n/,"").trim()).length>1&&(t="chained");return{name:s,type:t}}function Wg(s){var i,r,o,n;const e=[{name:"[IPv4] 0.0.0.0 - Listen on all IPs",address:"0.0.0.0",family:"ipv4"}],t=[{name:"[IPv6] :: - Listen on all IPs",address:"::",family:"ipv6"}];if((r=(i=s.native)==null?void 0:i.hardware)!=null&&r.networkInterfaces){const a=(n=(o=s.native)==null?void 0:o.hardware)==null?void 0:n.networkInterfaces;Object.keys(a).forEach(c=>{a[c].forEach(l=>{l.family!=="IPv6"?e.push({name:`[${l.family}] ${l.address} - ${c}`,address:l.address,family:"ipv4"}):t.push({name:`[${l.family}] ${l.address} - ${c}`,address:l.address,family:"ipv6"})})})}return{IPs4:e,IPs6:t}}class G3e extends ze{constructor(e){super(e)}request(e){return super.request({requireAdmin:!0,...e})}getCertificates(e){return this.request({cacheKey:"cert",forceUpdate:e,commandTimeout:!1,executor:async t=>{var r;const i=await this.getObject("system.certificates");(r=i==null?void 0:i.native)!=null&&r.certificates?t(Object.entries(i.native.certificates).map(([o,n])=>Pg(o,n)).filter(o=>!!o)):t([])}})}getLogs(e,t=200){return this.request({commandTimeout:!1,executor:i=>{this._socket.emit("sendToHost",e,"getLogs",t||200,r=>{i(r)})}})}upgradeAdapterWithWebserver(e,t){return this.request({commandTimeout:!1,executor:i=>{this._socket.emit("sendToHost",e,"upgradeAdapterWithWebserver",t,r=>{i(r)})}})}upgradeController(e,t,i){return this.request({commandTimeout:!1,executor:(r,o)=>{this._socket.emit("sendToHost",e,"upgradeController",{version:t,adminInstance:i},n=>{const a=n;a.error?o(a.error):r(a.result)})}})}updateLicenses(e,t){return this.request({commandTimeout:!1,executor:(i,r)=>{this._socket.emit("updateLicenses",e,t,(o,n)=>{o?r(o):i(n)})}})}upgradeOsPackages(e,t,i){return this.request({commandTimeout:!1,executor:r=>{this._socket.emit("sendToHost",e,"upgradeOsPackages",{packages:t,restart:!!i},o=>{r(o)})}})}getLogsFiles(e){return this.request({commandTimeout:!1,executor:(t,i)=>{this._socket.emit("readLogs",e,(r,o)=>{r&&i(r),t(o)})}})}delLogs(e){return this.request({commandTimeout:!1,executor:(t,i)=>{this._socket.emit("sendToHost",e,"delLogs",null,r=>{r&&i(r),t()})}})}deleteFile(e,t){return this.request({commandTimeout:!1,executor:(i,r)=>{this._socket.emit("deleteFile",e,t,o=>{o&&r(o),i()})}})}deleteFolder(e,t){return this.request({commandTimeout:!1,executor:(i,r)=>{this._socket.emit("deleteFolder",e,t,o=>{o&&r(o),i()})}})}rename(e,t,i){return this.request({commandTimeout:!1,executor:(r,o)=>{this._socket.emit("rename",e,t,i,n=>{n&&o(n),r()})}})}renameFile(e,t,i){return this.request({commandTimeout:!1,executor:(r,o)=>{this._socket.emit("renameFile",e,t,i,n=>{n&&o(n),r()})}})}getHosts(e){return this.request({cacheKey:"hosts",forceUpdate:e,commandTimeout:!1,executor:(t,i)=>{this._socket.emit("getObjectView","system","host",{startkey:"system.host.",endkey:"system.host.香"},(r,o)=>{r?i(r):t(Ln(o))})}})}getUsers(e){return this.request({cacheKey:"users",forceUpdate:e,commandTimeout:!1,executor:(t,i)=>{this._socket.emit("getObjectView","system","user",{startkey:"system.user.",endkey:"system.user.香"},(r,o)=>{r?i(r):t(Ln(o))})}})}renameGroup(e,t,i){return this.request({commandTimeout:!1,executor:async r=>{const o=await this.getGroups(!0),n=o.filter(c=>c._id.startsWith(`${e}.`));for(const c of n){const l=c._id,N=t+c._id.substring(e.length);c._id=N,await this.setObject(N,c),await this.delObject(l)}const a=o.find(c=>c._id===e);if(a){const c=a._id;a._id=t,i!==void 0&&(a.common??={},a.common.name=i),await this.setObject(t,a),await this.delObject(c)}r()}})}getHostInfo(e,t,i){return e=Tt(e),this.request({cacheKey:`hostInfo_${e}`,forceUpdate:t,commandTimeout:i,executor:(r,o,n)=>{this._socket.emit("sendToHost",e,"getHostInfo",null,a=>{n.elapsed||(n.clearTimeout(),a===Ie.PERMISSION_ERROR?o('May not read "getHostInfo"'):a?r(a):o('Cannot read "getHostInfo"'))})}})}getHostInfoShort(e,t,i){return e=Tt(e),this.request({cacheKey:`hostInfoShort_${e}`,forceUpdate:t,commandTimeout:i,executor:(r,o,n)=>{this._socket.emit("sendToHost",e,"getHostInfoShort",null,a=>{n.elapsed||(n.clearTimeout(),a===Ie.PERMISSION_ERROR?o('May not read "getHostInfoShort"'):a?r(a):o('Cannot read "getHostInfoShort"'))})}})}getRepository(e,t,i,r){return this.request({cacheKey:`repository_${e}`,forceUpdate:i,commandTimeout:r,executor:(o,n,a)=>{this._socket.emit("sendToHost",e,"getRepository",t,c=>{a.elapsed||(a.clearTimeout(),c===Ie.PERMISSION_ERROR?n('May not read "getRepository"'):c?o(c):n('Cannot read "getRepository"'))})}})}getInstalled(e,t,i){return e=Tt(e),this.request({cacheKey:`installed_${e}`,forceUpdate:t,commandTimeout:i,executor:(r,o,n)=>{this._socket.emit("sendToHost",e,"getInstalled",null,a=>{n.elapsed||(n.clearTimeout(),a===Ie.PERMISSION_ERROR?o('May not read "getInstalled"'):a?r(a):o('Cannot read "getInstalled"'))})}})}cmdExec(e,t,i,r){return this.request({commandTimeout:r,executor:(o,n,a)=>{e=Tt(e),this._socket.emit("cmdExec",e,i,t,c=>{a.elapsed||(a.clearTimeout(),c&&n(c),o())})}})}readBaseSettings(e){return e=ui(e),this.request({requireFeatures:["CONTROLLER_READWRITE_BASE_SETTINGS"],executor:(t,i,r)=>{this._socket.emit("sendToHost",e,"readBaseSettings",null,o=>{r.elapsed||(r.clearTimeout(),o===Ie.PERMISSION_ERROR?i('May not read "BaseSettings"'):o?o.error?i(new Error(o.error)):t(o):i('Cannot read "BaseSettings"'))})}})}writeBaseSettings(e,t){return e=ui(e),this.request({requireFeatures:["CONTROLLER_READWRITE_BASE_SETTINGS"],executor:(i,r,o)=>{this._socket.emit("sendToHost",e,"writeBaseSettings",t,n=>{o.elapsed||(o.clearTimeout(),n===Ie.PERMISSION_ERROR?r('May not write "BaseSettings"'):n?i(n):r('Cannot write "BaseSettings"'))})}})}restartController(e){return e=ui(e),this.request({executor:(t,i,r)=>{this._socket.emit("sendToHost",e,"restartController",null,()=>{r.elapsed||(r.clearTimeout(),t(!0))})}})}getDiagData(e,t){return e=ui(e),this.request({executor:(i,r,o)=>{this._socket.emit("sendToHost",e,"getDiagData",t,n=>{o.elapsed||(o.clearTimeout(),i(n||null))})}})}changePassword(e,t){return this.request({executor:(i,r,o)=>{this._socket.emit("changePassword",e,t,n=>{o.elapsed||(o.clearTimeout(),n&&r(n),i())})}})}getIpAddresses(e,t){return e=Tt(e),this.request({cacheKey:`IPs_${e}`,forceUpdate:t,commandTimeout:!1,executor:async i=>{const r=await this.getObject(e);i((r==null?void 0:r.common.address)??[])}})}getHostByIp(e,t){return e=ui(e),this.request({cacheKey:`rIPs_${e}`,forceUpdate:t,executor:(i,r,o)=>{this._socket.emit("getHostByIp",e,(n,a)=>{if(o.elapsed)return;o.clearTimeout();const{IPs4:c,IPs6:l}=Wg(a);i([...c,...l])})}})}encrypt(e){return this.request({executor:(t,i,r)=>{this._socket.emit("encrypt",e,(o,n)=>{r.elapsed||(r.clearTimeout(),o&&i(o),t(n))})}})}decrypt(e){return this.request({executor:(t,i,r)=>{this._socket.emit("decrypt",e,(o,n)=>{r.elapsed||(r.clearTimeout(),o&&i(o),t(n))})}})}chmodFile(e,t,i){return this.request({executor:(r,o,n)=>{this._socket.emit("chmodFile",e,t,i,(a,c)=>{n.elapsed||(n.clearTimeout(),a&&o(a),r(c))})}})}chownFile(e,t,i){return this.request({executor:(r,o,n)=>{this._socket.emit("chownFile",e,t,i,(a,c)=>{n.elapsed||(n.clearTimeout(),a&&o(a),r(c))})}})}getNotifications(e,t){return this.request({executor:(i,r,o)=>{this._socket.emit("sendToHost",e,"getNotifications",{category:t},n=>{o.elapsed||(o.clearTimeout(),i(n))})}})}clearNotifications(e,t){return this.request({executor:(i,r,o)=>{this._socket.emit("sendToHost",e,"clearNotifications",{category:t},n=>{o.elapsed||(o.clearTimeout(),i(n))})}})}getIsEasyModeStrict(){return this.request({executor:(e,t,i)=>{this._socket.emit("getIsEasyModeStrict",(r,o)=>{i.elapsed||(i.clearTimeout(),r&&t(r),e(!!o))})}})}getEasyMode(){return this.request({executor:(e,t,i)=>{this._socket.emit("getEasyMode",(r,o)=>{i.elapsed||(i.clearTimeout(),r?t(new Error(r)):e(o))})}})}getRatings(e){return this.request({executor:(t,i,r)=>{this._socket.emit("getRatings",!!e,(o,n)=>{r.elapsed||(r.clearTimeout(),o?i(new Error(o)):t(n))})}})}getCurrentSession(e){const t=new AbortController;return this.request({commandTimeout:e||5e3,onTimeout:()=>{t.abort()},executor:async(i,r,o)=>{try{const n=await fetch("./session",{signal:t.signal});if(o.elapsed)return;o.clearTimeout();const a=await n.json();i(a)}catch(n){r(`getCurrentSession: ${n}`)}}})}getCurrentInstance(){return this.request({cacheKey:"currentInstance",executor:(e,t,i)=>{this._socket.emit("getCurrentInstance",(r,o)=>{i.elapsed||(i.clearTimeout(),r?t(r):e(o))})}})}getAdapterInstances(e,t){let i;return typeof e=="boolean"?(t=e,i=""):i=e||"",this.request({cacheKey:`instances_${i}`,forceUpdate:t,executor:(r,o,n)=>{this._socket.emit("getAdapterInstances",i,(a,c)=>{n.elapsed||(n.clearTimeout(),a&&o(a),r(c))})}})}getAdapters(e,t){let i;return typeof e=="boolean"?(t=e,i=""):i=e||"",this.request({cacheKey:`adapter_${i}`,forceUpdate:t,executor:(r,o,n)=>{this._socket.emit("getAdapters",i,(a,c)=>{n.elapsed||(n.clearTimeout(),a&&o(a),r(c))})}})}getCompactAdapters(e){return this.request({cacheKey:"compactAdapters",forceUpdate:e,executor:(t,i,r)=>{this._socket.emit("getCompactAdapters",(o,n)=>{r.elapsed||(r.clearTimeout(),o&&i(o),t(n))})}})}getAdaptersResetCache(e){e=e??"",this.resetCache(`adapter_${e}`),this.resetCache("compactAdapters")}getCompactInstances(e){return this.request({cacheKey:"compactInstances",forceUpdate:e,executor:(t,i,r)=>{this._socket.emit("getCompactInstances",(o,n)=>{r.elapsed||(r.clearTimeout(),o&&i(o),t(n))})}})}getAdapterInstancesResetCache(e){e=e??"",this.resetCache(`instances_${e}`),this.resetCache("compactInstances")}getCompactInstalled(e,t,i){return e=Tt(e),this.request({cacheKey:`installedCompact_${e}`,forceUpdate:t,commandTimeout:i,executor:(r,o,n)=>{this._socket.emit("getCompactInstalled",e,a=>{n.elapsed||(n.clearTimeout(),a===Ie.PERMISSION_ERROR?o('May not read "getCompactInstalled"'):a?r(a):o('Cannot read "getCompactInstalled"'))})}})}getInstalledResetCache(e){e?(this.resetCache(`installedCompact_${e}`),this.resetCache(`installed_${e}`)):(this.resetCache("installedCompact_",!0),this.resetCache("installed_",!0))}getCompactRepository(e,t,i){return e=Tt(e),this.request({cacheKey:`repositoryCompact_${e}`,forceUpdate:t,commandTimeout:i,executor:(r,o,n)=>{this._socket.emit("getCompactRepository",e,a=>{n.elapsed||(n.clearTimeout(),a===Ie.PERMISSION_ERROR?o('May not read "getCompactRepository"'):a?r(a):o('Cannot read "getCompactRepository"'))})}})}getRepositoryResetCache(e){e?(this.resetCache(`repositoryCompact_${e}`),this.resetCache(`repository_${e}`)):(this.resetCache("repositoryCompact_",!0),this.resetCache("repository_",!0))}getCompactHosts(e){return this.request({cacheKey:"hostsCompact",forceUpdate:e,executor:(t,i,r)=>{this._socket.emit("getCompactHosts",(o,n)=>{r.elapsed||(r.clearTimeout(),o&&i(o),t(n))})}})}getCompactSystemRepositories(e){return this.request({cacheKey:"repositoriesCompact",forceUpdate:e,executor:(t,i,r)=>{this._socket.emit("getCompactSystemRepositories",(o,n)=>{r.elapsed||(r.clearTimeout(),o&&i(o),t(n))})}})}}const X=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,Xt="9.30.0",ie=globalThis;function qr(){return eo(ie),ie}function eo(s){const e=s.__SENTRY__=s.__SENTRY__||{};return e.version=e.version||Xt,e[Xt]=e[Xt]||{}}function to(s,e,t=ie){const i=t.__SENTRY__=t.__SENTRY__||{},r=i[Xt]=i[Xt]||{};return r[s]||(r[s]=e())}const hN=Object.prototype.toString;function ya(s){switch(hN.call(s)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return bt(s,Error)}}function Vs(s,e){return hN.call(s)===`[object ${e}]`}function zN(s){return Vs(s,"ErrorEvent")}function HM(s){return Vs(s,"DOMError")}function Bg(s){return Vs(s,"DOMException")}function ht(s){return Vs(s,"String")}function Ta(s){return typeof s=="object"&&s!==null&&"__sentry_template_string__"in s&&"__sentry_template_values__"in s}function da(s){return s===null||Ta(s)||typeof s!="object"&&typeof s!="function"}function _i(s){return Vs(s,"Object")}function so(s){return typeof Event<"u"&&bt(s,Event)}function Jg(s){return typeof Element<"u"&&bt(s,Element)}function Rg(s){return Vs(s,"RegExp")}function io(s){return!!(s!=null&&s.then&&typeof s.then=="function")}function Fg(s){return _i(s)&&"nativeEvent"in s&&"preventDefault"in s&&"stopPropagation"in s}function bt(s,e){try{return s instanceof e}catch{return!1}}function wN(s){return!!(typeof s=="object"&&s!==null&&(s.__isVue||s._isVue))}function Gg(s){return typeof Request<"u"&&bt(s,Request)}const Da=ie,Hg=80;function CN(s,e={}){if(!s)return"<unknown>";try{let t=s;const i=5,r=[];let o=0,n=0;const a=" > ",c=a.length;let l;const N=Array.isArray(e)?e:e.keyAttrs,u=!Array.isArray(e)&&e.maxStringLength||Hg;for(;t&&o++<i&&(l=Vg(t,N),!(l==="html"||o>1&&n+r.length*c+l.length>=u));)r.push(l),n+=l.length,t=t.parentNode;return r.reverse().join(a)}catch{return"<unknown>"}}function Vg(s,e){const t=s,i=[];if(!(t!=null&&t.tagName))return"";if(Da.HTMLElement&&t instanceof HTMLElement&&t.dataset){if(t.dataset.sentryComponent)return t.dataset.sentryComponent;if(t.dataset.sentryElement)return t.dataset.sentryElement}i.push(t.tagName.toLowerCase());const r=e!=null&&e.length?e.filter(n=>t.getAttribute(n)).map(n=>[n,t.getAttribute(n)]):null;if(r!=null&&r.length)r.forEach(n=>{i.push(`[${n[0]}="${n[1]}"]`)});else{t.id&&i.push(`#${t.id}`);const n=t.className;if(n&&ht(n)){const a=n.split(/\s+/);for(const c of a)i.push(`.${c}`)}}const o=["aria-label","type","name","title","alt"];for(const n of o){const a=t.getAttribute(n);a&&i.push(`[${n}="${a}"]`)}return i.join("")}function ha(){try{return Da.document.location.href}catch{return""}}function Zg(s){if(!Da.HTMLElement)return null;let e=s;const t=5;for(let i=0;i<t;i++){if(!e)return null;if(e instanceof HTMLElement){if(e.dataset.sentryComponent)return e.dataset.sentryComponent;if(e.dataset.sentryElement)return e.dataset.sentryElement}e=e.parentNode}return null}const Xg="Sentry Logger ",gn=["debug","info","warn","error","log","assert","trace"],Yr={};function Zs(s){if(!("console"in ie))return s();const e=ie.console,t={},i=Object.keys(Yr);i.forEach(r=>{const o=Yr[r];t[r]=e[r],e[r]=o});try{return s()}finally{i.forEach(r=>{e[r]=t[r]})}}function Kg(){let s=!1;const e={enable:()=>{s=!0},disable:()=>{s=!1},isEnabled:()=>s};return X?gn.forEach(t=>{e[t]=(...i)=>{s&&Zs(()=>{ie.console[t](`${Xg}[${t}]:`,...i)})}}):gn.forEach(t=>{e[t]=()=>{}}),e}const R=to("logger",Kg);function vr(s,e=0){return typeof s!="string"||e===0||s.length<=e?s:`${s.slice(0,e)}...`}function VM(s,e){if(!Array.isArray(s))return"";const t=[];for(let i=0;i<s.length;i++){const r=s[i];try{wN(r)?t.push("[VueViewModel]"):t.push(String(r))}catch{t.push("[value cannot be serialized]")}}return t.join(e)}function qg(s,e,t=!1){return ht(s)?Rg(e)?e.test(s):ht(e)?t?s===e:s.includes(e):!1:!1}function ro(s,e=[],t=!1){return e.some(i=>qg(s,i,t))}function Ue(s,e,t){if(!(e in s))return;const i=s[e];if(typeof i!="function")return;const r=t(i);typeof r=="function"&&IN(r,i);try{s[e]=r}catch{X&&R.log(`Failed to replace method "${e}" in object`,s)}}function Kt(s,e,t){try{Object.defineProperty(s,e,{value:t,writable:!0,configurable:!0})}catch{X&&R.log(`Failed to add non-enumerable property "${e}" to object`,s)}}function IN(s,e){try{const t=e.prototype||{};s.prototype=e.prototype=t,Kt(s,"__sentry_original__",e)}catch{}}function za(s){return s.__sentry_original__}function pN(s){if(ya(s))return{message:s.message,name:s.name,stack:s.stack,...XM(s)};if(so(s)){const e={type:s.type,target:ZM(s.target),currentTarget:ZM(s.currentTarget),...XM(s)};return typeof CustomEvent<"u"&&bt(s,CustomEvent)&&(e.detail=s.detail),e}else return s}function ZM(s){try{return Jg(s)?CN(s):Object.prototype.toString.call(s)}catch{return"<unknown>"}}function XM(s){if(typeof s=="object"&&s!==null){const e={};for(const t in s)Object.prototype.hasOwnProperty.call(s,t)&&(e[t]=s[t]);return e}else return{}}function ej(s,e=40){const t=Object.keys(pN(s));t.sort();const i=t[0];if(!i)return"[object has no keys]";if(i.length>=e)return vr(i,e);for(let r=t.length;r>0;r--){const o=t.slice(0,r).join(", ");if(!(o.length>e))return r===t.length?o:vr(o,e)}return""}function tj(){const s=ie;return s.crypto||s.msCrypto}function Je(s=tj()){let e=()=>Math.random()*16;try{if(s!=null&&s.randomUUID)return s.randomUUID().replace(/-/g,"");s!=null&&s.getRandomValues&&(e=()=>{const t=new Uint8Array(1);return s.getRandomValues(t),t[0]})}catch{}return("10000000100040008000"+1e11).replace(/[018]/g,t=>(t^(e()&15)>>t/4).toString(16))}function AN(s){var e,t;return(t=(e=s.exception)==null?void 0:e.values)==null?void 0:t[0]}function Vt(s){const{message:e,event_id:t}=s;if(e)return e;const i=AN(s);return i?i.type&&i.value?`${i.type}: ${i.value}`:i.type||i.value||t||"<unknown>":t||"<unknown>"}function jn(s,e,t){const i=s.exception=s.exception||{},r=i.values=i.values||[],o=r[0]=r[0]||{};o.value||(o.value=e||""),o.type||(o.type="Error")}function Rs(s,e){const t=AN(s);if(!t)return;const i={type:"generic",handled:!0},r=t.mechanism;if(t.mechanism={...i,...r,...e},e&&"data"in e){const o={...r==null?void 0:r.data,...e.data};t.mechanism.data=o}}function KM(s){if(sj(s))return!0;try{Kt(s,"__sentry_captured__",!0)}catch{}return!1}function sj(s){try{return s.__sentry_captured__}catch{}}const mN=1e3;function Wi(){return Date.now()/mN}function ij(){const{performance:s}=ie;if(!(s!=null&&s.now))return Wi;const e=Date.now()-s.now(),t=s.timeOrigin==null?e:s.timeOrigin;return()=>(t+s.now())/mN}const zt=ij();function rj(s){const e=zt(),t={sid:Je(),init:!0,timestamp:e,started:e,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>nj(t)};return s&&Fs(t,s),t}function Fs(s,e={}){if(e.user&&(!s.ipAddress&&e.user.ip_address&&(s.ipAddress=e.user.ip_address),!s.did&&!e.did&&(s.did=e.user.id||e.user.email||e.user.username)),s.timestamp=e.timestamp||zt(),e.abnormal_mechanism&&(s.abnormal_mechanism=e.abnormal_mechanism),e.ignoreDuration&&(s.ignoreDuration=e.ignoreDuration),e.sid&&(s.sid=e.sid.length===32?e.sid:Je()),e.init!==void 0&&(s.init=e.init),!s.did&&e.did&&(s.did=`${e.did}`),typeof e.started=="number"&&(s.started=e.started),s.ignoreDuration)s.duration=void 0;else if(typeof e.duration=="number")s.duration=e.duration;else{const t=s.timestamp-s.started;s.duration=t>=0?t:0}e.release&&(s.release=e.release),e.environment&&(s.environment=e.environment),!s.ipAddress&&e.ipAddress&&(s.ipAddress=e.ipAddress),!s.userAgent&&e.userAgent&&(s.userAgent=e.userAgent),typeof e.errors=="number"&&(s.errors=e.errors),e.status&&(s.status=e.status)}function oj(s,e){let t={};s.status==="ok"&&(t={status:"exited"}),Fs(s,t)}function nj(s){return{sid:`${s.sid}`,init:s.init,started:new Date(s.started*1e3).toISOString(),timestamp:new Date(s.timestamp*1e3).toISOString(),status:s.status,errors:s.errors,did:typeof s.did=="number"||typeof s.did=="string"?`${s.did}`:void 0,duration:s.duration,abnormal_mechanism:s.abnormal_mechanism,attrs:{release:s.release,environment:s.environment,ip_address:s.ipAddress,user_agent:s.userAgent}}}function Bi(s,e,t=2){if(!e||typeof e!="object"||t<=0)return e;if(s&&Object.keys(e).length===0)return s;const i={...s};for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(i[r]=Bi(i[r],e[r],t-1));return i}const yn="_sentrySpan";function qM(s,e){e?Kt(s,yn,e):delete s[yn]}function ec(s){return s[yn]}function tc(){return Je()}function ON(){return Je().substring(16)}const aj=100;class wt{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext={traceId:tc(),sampleRand:Math.random()}}clone(){const e=new wt;return e._breadcrumbs=[...this._breadcrumbs],e._tags={...this._tags},e._extra={...this._extra},e._contexts={...this._contexts},this._contexts.flags&&(e._contexts.flags={values:[...this._contexts.flags.values]}),e._user=this._user,e._level=this._level,e._session=this._session,e._transactionName=this._transactionName,e._fingerprint=this._fingerprint,e._eventProcessors=[...this._eventProcessors],e._attachments=[...this._attachments],e._sdkProcessingMetadata={...this._sdkProcessingMetadata},e._propagationContext={...this._propagationContext},e._client=this._client,e._lastEventId=this._lastEventId,qM(e,ec(this)),e}setClient(e){this._client=e}setLastEventId(e){this._lastEventId=e}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(e){this._scopeListeners.push(e)}addEventProcessor(e){return this._eventProcessors.push(e),this}setUser(e){return this._user=e||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&Fs(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}setTags(e){return this._tags={...this._tags,...e},this._notifyScopeListeners(),this}setTag(e,t){return this._tags={...this._tags,[e]:t},this._notifyScopeListeners(),this}setExtras(e){return this._extra={...this._extra,...e},this._notifyScopeListeners(),this}setExtra(e,t){return this._extra={...this._extra,[e]:t},this._notifyScopeListeners(),this}setFingerprint(e){return this._fingerprint=e,this._notifyScopeListeners(),this}setLevel(e){return this._level=e,this._notifyScopeListeners(),this}setTransactionName(e){return this._transactionName=e,this._notifyScopeListeners(),this}setContext(e,t){return t===null?delete this._contexts[e]:this._contexts[e]=t,this._notifyScopeListeners(),this}setSession(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(e){if(!e)return this;const t=typeof e=="function"?e(this):e,i=t instanceof wt?t.getScopeData():_i(t)?e:void 0,{tags:r,extra:o,user:n,contexts:a,level:c,fingerprint:l=[],propagationContext:N}=i||{};return this._tags={...this._tags,...r},this._extra={...this._extra,...o},this._contexts={...this._contexts,...a},n&&Object.keys(n).length&&(this._user=n),c&&(this._level=c),l.length&&(this._fingerprint=l),N&&(this._propagationContext=N),this}clear(){return this._breadcrumbs=[],this._tags={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._session=void 0,qM(this,void 0),this._attachments=[],this.setPropagationContext({traceId:tc(),sampleRand:Math.random()}),this._notifyScopeListeners(),this}addBreadcrumb(e,t){var o;const i=typeof t=="number"?t:aj;if(i<=0)return this;const r={timestamp:Wi(),...e,message:e.message?vr(e.message,2048):e.message};return this._breadcrumbs.push(r),this._breadcrumbs.length>i&&(this._breadcrumbs=this._breadcrumbs.slice(-i),(o=this._client)==null||o.recordDroppedEvent("buffer_overflow","log_item")),this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(e){return this._attachments.push(e),this}clearAttachments(){return this._attachments=[],this}getScopeData(){return{breadcrumbs:this._breadcrumbs,attachments:this._attachments,contexts:this._contexts,tags:this._tags,extra:this._extra,user:this._user,level:this._level,fingerprint:this._fingerprint||[],eventProcessors:this._eventProcessors,propagationContext:this._propagationContext,sdkProcessingMetadata:this._sdkProcessingMetadata,transactionName:this._transactionName,span:ec(this)}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=Bi(this._sdkProcessingMetadata,e,2),this}setPropagationContext(e){return this._propagationContext=e,this}getPropagationContext(){return this._propagationContext}captureException(e,t){const i=(t==null?void 0:t.event_id)||Je();if(!this._client)return R.warn("No client configured on scope - will not capture exception!"),i;const r=new Error("Sentry syntheticException");return this._client.captureException(e,{originalException:e,syntheticException:r,...t,event_id:i},this),i}captureMessage(e,t,i){const r=(i==null?void 0:i.event_id)||Je();if(!this._client)return R.warn("No client configured on scope - will not capture message!"),r;const o=new Error(e);return this._client.captureMessage(e,t,{originalException:e,syntheticException:o,...i,event_id:r},this),r}captureEvent(e,t){const i=(t==null?void 0:t.event_id)||Je();return this._client?(this._client.captureEvent(e,{...t,event_id:i},this),i):(R.warn("No client configured on scope - will not capture event!"),i)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach(e=>{e(this)}),this._notifyingListeners=!1)}}function Mj(){return to("defaultCurrentScope",()=>new wt)}function cj(){return to("defaultIsolationScope",()=>new wt)}class uj{constructor(e,t){let i;e?i=e:i=new wt;let r;t?r=t:r=new wt,this._stack=[{scope:i}],this._isolationScope=r}withScope(e){const t=this._pushScope();let i;try{i=e(t)}catch(r){throw this._popScope(),r}return io(i)?i.then(r=>(this._popScope(),r),r=>{throw this._popScope(),r}):(this._popScope(),i)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){const e=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:e}),e}_popScope(){return this._stack.length<=1?!1:!!this._stack.pop()}}function Gs(){const s=qr(),e=eo(s);return e.stack=e.stack||new uj(Mj(),cj())}function lj(s){return Gs().withScope(s)}function Nj(s,e){const t=Gs();return t.withScope(()=>(t.getStackTop().scope=s,e(s)))}function sc(s){return Gs().withScope(()=>s(Gs().getIsolationScope()))}function Lj(){return{withIsolationScope:sc,withScope:lj,withSetScope:Nj,withSetIsolationScope:(s,e)=>sc(e),getCurrentScope:()=>Gs().getScope(),getIsolationScope:()=>Gs().getIsolationScope()}}function wa(s){const e=eo(s);return e.acs?e.acs:Lj()}function Ct(){const s=qr();return wa(s).getCurrentScope()}function Ji(){const s=qr();return wa(s).getIsolationScope()}function gj(){return to("globalScope",()=>new wt)}function jj(...s){const e=qr(),t=wa(e);if(s.length===2){const[i,r]=s;return i?t.withSetScope(i,r):t.withScope(r)}return t.withScope(s[0])}function Ee(){return Ct().getClient()}function yj(s){const e=s.getPropagationContext(),{traceId:t,parentSpanId:i,propagationSpanId:r}=e,o={trace_id:t,span_id:r||ON()};return i&&(o.parent_span_id=i),o}const Tj="sentry.source",dj="sentry.sample_rate",Dj="sentry.previous_trace_sample_rate",hj="sentry.op",zj="sentry.origin",EN="sentry.profile_id",fN="sentry.exclusive_time",wj=0,Cj=1,Ij="_sentryScope",pj="_sentryIsolationScope";function xN(s){return{scope:s[Ij],isolationScope:s[pj]}}function Aj(s){if(typeof s=="boolean")return Number(s);const e=typeof s=="string"?parseFloat(s):s;if(!(typeof e!="number"||isNaN(e)||e<0||e>1))return e}const mj="sentry-",Oj=/^sentry-/;function Ej(s){const e=fj(s);if(!e)return;const t=Object.entries(e).reduce((i,[r,o])=>{if(r.match(Oj)){const n=r.slice(mj.length);i[n]=o}return i},{});if(Object.keys(t).length>0)return t}function fj(s){if(!(!s||!ht(s)&&!Array.isArray(s)))return Array.isArray(s)?s.reduce((e,t)=>{const i=ic(t);return Object.entries(i).forEach(([r,o])=>{e[r]=o}),e},{}):ic(s)}function ic(s){return s.split(",").map(e=>e.split("=").map(t=>{try{return decodeURIComponent(t.trim())}catch{return}})).reduce((e,[t,i])=>(t&&i&&(e[t]=i),e),{})}const _N=1;let rc=!1;function xj(s){const{spanId:e,traceId:t,isRemote:i}=s.spanContext(),r=i?e:Ca(s).parent_span_id,o=xN(s).scope,n=i?(o==null?void 0:o.getPropagationContext().propagationSpanId)||ON():e;return{parent_span_id:r,span_id:n,trace_id:t}}function _j(s){if(s&&s.length>0)return s.map(({context:{spanId:e,traceId:t,traceFlags:i,...r},attributes:o})=>({span_id:e,trace_id:t,sampled:i===_N,attributes:o,...r}))}function oc(s){return typeof s=="number"?nc(s):Array.isArray(s)?s[0]+s[1]/1e9:s instanceof Date?nc(s.getTime()):zt()}function nc(s){return s>9999999999?s/1e3:s}function Ca(s){var i;if(kj(s))return s.getSpanJSON();const{spanId:e,traceId:t}=s.spanContext();if(Sj(s)){const{attributes:r,startTime:o,name:n,endTime:a,status:c,links:l}=s,N="parentSpanId"in s?s.parentSpanId:"parentSpanContext"in s?(i=s.parentSpanContext)==null?void 0:i.spanId:void 0;return{span_id:e,trace_id:t,data:r,description:n,parent_span_id:N,start_timestamp:oc(o),timestamp:oc(a)||void 0,status:vj(c),op:r[hj],origin:r[zj],links:_j(l)}}return{span_id:e,trace_id:t,start_timestamp:0,data:{}}}function Sj(s){const e=s;return!!e.attributes&&!!e.startTime&&!!e.name&&!!e.endTime&&!!e.status}function kj(s){return typeof s.getSpanJSON=="function"}function Yj(s){const{traceFlags:e}=s.spanContext();return e===_N}function vj(s){if(!(!s||s.code===wj))return s.code===Cj?"ok":s.message||"unknown_error"}const bj="_sentryRootSpan";function SN(s){return s[bj]||s}function ac(){rc||(Zs(()=>{console.warn("[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly.")}),rc=!0)}const kN=50,qt="?",Mc=/\(error: (.*)\)/,cc=/captureMessage|captureException/;function YN(...s){const e=s.sort((t,i)=>t[0]-i[0]).map(t=>t[1]);return(t,i=0,r=0)=>{const o=[],n=t.split(`
2
- `);for(let a=i;a<n.length;a++){const c=n[a];if(c.length>1024)continue;const l=Mc.test(c)?c.replace(Mc,"$1"):c;if(!l.match(/\S*Error: /)){for(const N of e){const u=N(l);if(u){o.push(u);break}}if(o.length>=kN+r)break}}return Uj(o.slice(r))}}function Qj(s){return Array.isArray(s)?YN(...s):s}function Uj(s){if(!s.length)return[];const e=Array.from(s);return/sentryWrapped/.test(nr(e).function||"")&&e.pop(),e.reverse(),cc.test(nr(e).function||"")&&(e.pop(),cc.test(nr(e).function||"")&&e.pop()),e.slice(0,kN).map(t=>({...t,filename:t.filename||nr(e).filename,function:t.function||qt}))}function nr(s){return s[s.length-1]||{}}const Eo="<anonymous>";function Qt(s){try{return!s||typeof s!="function"?Eo:s.name||Eo}catch{return Eo}}function uc(s){const e=s.exception;if(e){const t=[];try{return e.values.forEach(i=>{i.stacktrace.frames&&t.push(...i.stacktrace.frames)}),t}catch{return}}}const Ar={},lc={};function rs(s,e){Ar[s]=Ar[s]||[],Ar[s].push(e)}function os(s,e){if(!lc[s]){lc[s]=!0;try{e()}catch(t){X&&R.error(`Error while instrumenting ${s}`,t)}}}function Ke(s,e){const t=s&&Ar[s];if(t)for(const i of t)try{i(e)}catch(r){X&&R.error(`Error while triggering instrumentation handler.
1
+ import{c as U,j as Q,o as Pe,a as vM,b as bM,d as QM,P as S}from"./createSvgIcon-Dtl7HhPO.js";import{i as f,R as M}from"./iobroker_javascript__loadShare__react__loadShare__-BiJPUKBK.js";import{i as j,c as Ne,C as Oe,a as nt,S as lL,Q as gN,b as jN,Y as NL,Z,$ as LL,a0 as gL,a1 as jL,a2 as yL,a3 as UM,a4 as TL,a5 as dL,a6 as DL,a7 as hL,a8 as zL,a9 as $M,aa as wL,ab as CL,ac as IL,ad as pL,ae as AL,af as mL,ag as OL,ah as EL,ai as fL,aj as xL,ak as _L,al as SL,am as PM,an as WM,ao as kL,ap as BM,D as YL,aq as vL,ar as bL,as as QL,at as JM,au as UL,av as $L,aw as PL,T as WL,I as Pi}from"./index-C5V5CZI4.js";import{I as un}from"./Save-DgI3b32B.js";import{c as ir,g as BL}from"./_commonjsHelpers-Cpj98o6Y.js";import{u as JL}from"./useTheme-g_P2Itm2.js";import{t as B}from"./index-Dm1jc4t6.js";import"./iobroker_javascript__mf_v__runtimeInit__mf_v__-CBQgOKij.js";const ln=U(Q.jsx("path",{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6z"}),"Add"),RL=U(Q.jsx("path",{d:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20z"}),"ArrowBack"),FL=U(Q.jsx("path",{d:"m10 17 5-5-5-5z"}),"ArrowRight"),GL=U(Q.jsx("path",{d:"M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8zm2 11h-3v3.75c0 1.24-1.01 2.25-2.25 2.25S8.5 17.99 8.5 16.75s1.01-2.25 2.25-2.25c.46 0 .89.14 1.25.38V11h4zm-3-4V3.5L18.5 9z"}),"AudioFile"),HL=U([Q.jsx("path",{d:"M16.5 12h-9c-.55 0-1 .45-1 1v1h11v-1c0-.55-.45-1-1-1M7.25 8.5h4v2h-4zm5.5 0h4v2h-4z"},"0"),Q.jsx("path",{d:"M20 2H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2m-1 15h-1.5v-1.5h-11V17H5v-3.83c0-.66.25-1.26.65-1.72V9c0-1.1.9-2 2-2H11c.37 0 .72.12 1 .32.28-.2.63-.32 1-.32h3.35c1.1 0 2 .9 2 2v2.45c.4.46.65 1.06.65 1.72z"},"1")],"BedroomParent"),VL=U(Q.jsx("path",{d:"M17 3H7c-1.1 0-1.99.9-1.99 2L5 21l7-3 7 3V5c0-1.1-.9-2-2-2"}),"Bookmark"),ZL=U(Q.jsx("path",{d:"M17 3H7c-1.1 0-1.99.9-1.99 2L5 21l7-3 7 3V5c0-1.1-.9-2-2-2m0 15-5-2.18L7 18V5h10z"}),"BookmarkBorder"),XL=U(Q.jsx("path",{d:"M22 24H2v-4h20zM13.06 5.19l3.75 3.75L7.75 18H4v-3.75zm4.82 2.68-3.75-3.75 1.83-1.83c.39-.39 1.02-.39 1.41 0l2.34 2.34c.39.39.39 1.02 0 1.41z"}),"BorderColor"),KL=U(Q.jsx("path",{d:"M20 8.69V4h-4.69L12 .69 8.69 4H4v4.69L.69 12 4 15.31V20h4.69L12 23.31 15.31 20H20v-4.69L23.31 12zM12 18c-.89 0-1.74-.2-2.5-.55C11.56 16.5 13 14.42 13 12s-1.44-4.5-3.5-5.45C10.26 6.2 11.11 6 12 6c3.31 0 6 2.69 6 6s-2.69 6-6 6"}),"Brightness4"),qL=U(Q.jsx("path",{d:"M20 15.31 23.31 12 20 8.69V4h-4.69L12 .69 8.69 4H4v4.69L.69 12 4 15.31V20h4.69L12 23.31 15.31 20H20zM12 18c-3.31 0-6-2.69-6-6s2.69-6 6-6 6 2.69 6 6-2.69 6-6 6"}),"Brightness5"),ua=U(Q.jsx("path",{d:"M20 15.31 23.31 12 20 8.69V4h-4.69L12 .69 8.69 4H4v4.69L.69 12 4 15.31V20h4.69L12 23.31 15.31 20H20zM12 18V6c3.31 0 6 2.69 6 6s-2.69 6-6 6"}),"Brightness6"),eg=U(Q.jsx("path",{d:"M20 8.69V4h-4.69L12 .69 8.69 4H4v4.69L.69 12 4 15.31V20h4.69L12 23.31 15.31 20H20v-4.69L23.31 12zM12 18c-3.31 0-6-2.69-6-6s2.69-6 6-6 6 2.69 6 6-2.69 6-6 6m0-10c-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4-1.79-4-4-4"}),"Brightness7"),tg=U(Q.jsx("path",{d:"m22.7 19-9.1-9.1c.9-2.3.4-5-1.5-6.9-2-2-5-2.4-7.4-1.3L9 6 6 9 1.6 4.7C.4 7.1.9 10.1 2.9 12.1c1.9 1.9 4.6 2.4 6.9 1.5l9.1 9.1c.4.4 1 .4 1.4 0l2.3-2.3c.5-.4.5-1.1.1-1.4"}),"Build"),sg=U(Q.jsx("path",{d:"M20 3h-1V1h-2v2H7V1H5v2H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m0 18H4V8h16z"}),"CalendarToday"),la=U(Q.jsx("path",{d:"M9.4 16.6 4.8 12l4.6-4.6L8 6l-6 6 6 6zm5.2 0 4.6-4.6-4.6-4.6L16 6l6 6-6 6z"}),"Code"),ig=U(Q.jsx("path",{d:"m20.71 5.63-2.34-2.34a.996.996 0 0 0-1.41 0l-3.12 3.12-1.93-1.91-1.41 1.41 1.42 1.42L3 16.25V21h4.75l8.92-8.92 1.42 1.42 1.41-1.41-1.92-1.92 3.12-3.12c.4-.4.4-1.03.01-1.42M6.92 19 5 17.08l8.06-8.06 1.92 1.92z"}),"Colorize"),rg=U(Q.jsx("path",{d:"m13.7826 15.1719 2.1213-2.1213 5.9963 5.9962-2.1213 2.1213zM17.5 10c1.93 0 3.5-1.57 3.5-3.5 0-.58-.16-1.12-.41-1.6l-2.7 2.7-1.49-1.49 2.7-2.7c-.48-.25-1.02-.41-1.6-.41C15.57 3 14 4.57 14 6.5c0 .41.08.8.21 1.16l-1.85 1.85-1.78-1.78.71-.71-1.41-1.41L12 3.49c-1.17-1.17-3.07-1.17-4.24 0L4.22 7.03l1.41 1.41H2.81l-.71.71 3.54 3.54.71-.71V9.15l1.41 1.41.71-.71 1.78 1.78-7.41 7.41 2.12 2.12L16.34 9.79c.36.13.75.21 1.16.21"}),"Construction"),og=U(Q.jsx("path",{d:"M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2m0 16H8V7h11z"}),"ContentCopy"),yN=U(Q.jsx("path",{d:"M20 6h-8l-2-2H4c-1.11 0-1.99.89-1.99 2L2 18c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2V8c0-1.11-.89-2-2-2m-1 8h-3v3h-2v-3h-3v-2h3V9h2v3h3z"}),"CreateNewFolder"),ng=U(Q.jsx("path",{d:"M17 15h2V7c0-1.1-.9-2-2-2H9v2h8zM7 17V1H5v4H1v2h4v10c0 1.1.9 2 2 2h10v4h2v-4h4v-2z"}),"Crop"),ag=U(Q.jsx("path",{d:"M4 7v2c0 .55-.45 1-1 1H2v4h1c.55 0 1 .45 1 1v2c0 1.65 1.35 3 3 3h3v-2H7c-.55 0-1-.45-1-1v-2c0-1.3-.84-2.42-2-2.83v-.34C5.16 11.42 6 10.3 6 9V7c0-.55.45-1 1-1h3V4H7C5.35 4 4 5.35 4 7m17 3c-.55 0-1-.45-1-1V7c0-1.65-1.35-3-3-3h-3v2h3c.55 0 1 .45 1 1v2c0 1.3.84 2.42 2 2.83v.34c-1.16.41-2 1.52-2 2.83v2c0 .55-.45 1-1 1h-3v2h3c1.65 0 3-1.35 3-3v-2c0-.55.45-1 1-1h1v-4z"}),"DataObject"),Kr=U(Q.jsx("path",{d:"M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8zm2 16H8v-2h8zm0-4H8v-2h8zm-3-5V3.5L18.5 9z"}),"Description"),Mg=U(Q.jsx("path",{d:"M18.41 5.8 17.2 4.59c-.78-.78-2.05-.78-2.83 0l-2.68 2.68L3 15.96V20h4.04l8.74-8.74 2.63-2.63c.79-.78.79-2.05 0-2.83M6.21 18H5v-1.21l8.66-8.66 1.21 1.21zM11 20l4-4h6v4z"}),"DriveFileRenameOutline"),mi=U(Q.jsx("path",{d:"M3 17.25V21h3.75L17.81 9.94l-3.75-3.75zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34a.996.996 0 0 0-1.41 0l-1.83 1.83 3.75 3.75z"}),"Edit"),cg=U(Q.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m1 15h-2v-2h2zm0-4h-2V7h2z"}),"Error"),ug=U(Q.jsx("path",{d:"M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z"}),"ExpandMore"),lg=U(Q.jsx("path",{d:"M20 19.59V8l-6-6H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c.45 0 .85-.15 1.19-.4l-4.43-4.43c-.8.52-1.74.83-2.76.83-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5c0 1.02-.31 1.96-.83 2.75zM9 13c0 1.66 1.34 3 3 3s3-1.34 3-3-1.34-3-3-3-3 1.34-3 3"}),"FindInPage"),Ng=U(Q.jsx("path",{d:"M20 6h-8l-2-2H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2m0 12H4V8h16z"}),"FolderOpen"),Lg=U(Q.jsx("path",{d:"M20 6h-8l-2-2H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2m-2.06 11L15 15.28 12.06 17l.78-3.33-2.59-2.24 3.41-.29L15 8l1.34 3.14 3.41.29-2.59 2.24z"}),"FolderSpecial"),gg=U(Q.jsx("path",{d:"M9.93 13.5h4.14L12 7.98zM20 2H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2m-4.05 16.5-1.14-3H9.17l-1.12 3H5.96l5.11-13h1.86l5.11 13z"}),"FontDownload"),jg=U(Q.jsx("path",{d:"M10 4v3h2.21l-3.42 8H6v3h8v-3h-2.21l3.42-8H18V4z"}),"FormatItalic"),yg=U(Q.jsx("path",{d:"M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2M8.5 13.5l2.5 3.01L14.5 12l4.5 6H5z"}),"Image"),Na=U(Q.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m1 15h-2v-6h2zm0-8h-2V7h2z"}),"Info"),TN=U(Q.jsx("path",{d:"M6 2c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm7 7V3.5L18.5 9z"}),"InsertDriveFile"),Tg=U(Q.jsx("path",{d:"M19 7v4H5.83l3.58-3.59L8 6l-6 6 6 6 1.41-1.41L5.83 13H21V7z"}),"KeyboardReturn"),dN=U(Q.jsx("path",{d:"M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1M8 13h8v-2H8zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5"}),"Link"),dg=U(Q.jsx("path",{d:"M3 13h2v-2H3zm0 4h2v-2H3zm0-8h2V7H3zm4 4h14v-2H7zm0 4h14v-2H7zM7 7v2h14V7z"}),"List"),Dg=U(Q.jsx("path",{d:"M19 5v14H5V5zm1.1-2H3.9c-.5 0-.9.4-.9.9v16.2c0 .4.4.9.9.9h16.2c.4 0 .9-.5.9-.9V3.9c0-.5-.5-.9-.9-.9M11 7h6v2h-6zm0 4h6v2h-6zm0 4h6v2h-6zM7 7h2v2H7zm0 4h2v2H7zm0 4h2v2H7z"}),"ListAlt"),hg=U(Q.jsx("path",{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m-5 14h-2V9h-2V7h4z"}),"LooksOne"),zg=U(Q.jsx("path",{d:"M12 3v10.55c-.59-.34-1.27-.55-2-.55-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4V7h4V3z"}),"MusicNote"),wg=U(Q.jsx("path",{d:"M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"}),"NavigateNext"),La=U(Q.jsx("path",{d:"M12 6c1.1 0 2 .9 2 2s-.9 2-2 2-2-.9-2-2 .9-2 2-2m0 10c2.7 0 5.8 1.29 6 2H6c.23-.72 3.31-2 6-2m0-12C9.79 4 8 5.79 8 8s1.79 4 4 4 4-1.79 4-4-1.79-4-4-4m0 10c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4"}),"PersonOutlined"),Cg=U(Q.jsx("path",{d:"M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2M8.5 13.5l2.5 3.01L14.5 12l4.5 6H5z"}),"Photo"),Sr=U(Q.jsx("path",{d:"M5 4v2h14V4zm0 10h4v6h6v-6h4l-7-7z"}),"Publish"),DN=U(Q.jsx("path",{d:"M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4z"}),"Refresh"),ga=U(Q.jsx("path",{d:"m20.2 5.9.8-.8C19.6 3.7 17.8 3 16 3s-3.6.7-5 2.1l.8.8C13 4.8 14.5 4.2 16 4.2s3 .6 4.2 1.7m-.9.8c-.9-.9-2.1-1.4-3.3-1.4s-2.4.5-3.3 1.4l.8.8c.7-.7 1.6-1 2.5-1s1.8.3 2.5 1zM19 13h-2V9h-2v4H5c-1.1 0-2 .9-2 2v4c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-4c0-1.1-.9-2-2-2M8 18H6v-2h2zm3.5 0h-2v-2h2zm3.5 0h-2v-2h2z"}),"Router"),Ig=U(Q.jsx("path",{d:"M19 12v7H5v-7H3v7c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-7zm-6 .67 2.59-2.58L17 11.5l-5 5-5-5 1.41-1.41L11 12.67V3h2z"}),"SaveAlt"),Nn=U(Q.jsx("path",{d:"M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58c.18-.14.23-.41.12-.61l-1.92-3.32c-.12-.22-.37-.29-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54c-.04-.24-.24-.41-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.05.3-.09.63-.09.94s.02.64.07.94l-2.03 1.58c-.18.14-.23.41-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6"}),"Settings"),kr=U(Q.jsx("path",{d:"M12 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m7-7H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2m-1.75 9c0 .23-.02.46-.05.68l1.48 1.16c.13.11.17.3.08.45l-1.4 2.42c-.09.15-.27.21-.43.15l-1.74-.7c-.36.28-.76.51-1.18.69l-.26 1.85c-.03.17-.18.3-.35.3h-2.8c-.17 0-.32-.13-.35-.29l-.26-1.85c-.43-.18-.82-.41-1.18-.69l-1.74.7c-.16.06-.34 0-.43-.15l-1.4-2.42c-.09-.15-.05-.34.08-.45l1.48-1.16c-.03-.23-.05-.46-.05-.69s.02-.46.05-.68l-1.48-1.16c-.13-.11-.17-.3-.08-.45l1.4-2.42c.09-.15.27-.21.43-.15l1.74.7c.36-.28.76-.51 1.18-.69l.26-1.85c.03-.17.18-.3.35-.3h2.8c.17 0 .32.13.35.29l.26 1.85c.43.18.82.41 1.18.69l1.74-.7c.16-.06.34 0 .43.15l1.4 2.42c.09.15.05.34-.08.45l-1.48 1.16c.03.23.05.46.05.69"}),"SettingsApplications"),pg=U(Q.jsx("path",{d:"m3.5 18.49 6-6.01 4 4L22 6.92l-1.41-1.41-7.09 7.97-4-4L2 16.99z"}),"ShowChart"),ja=U(Q.jsx("path",{d:"M11.99 2c-5.52 0-10 4.48-10 10s4.48 10 10 10 10-4.48 10-10-4.48-10-10-10m3.61 6.34c1.07 0 1.93.86 1.93 1.93s-.86 1.93-1.93 1.93-1.93-.86-1.93-1.93c-.01-1.07.86-1.93 1.93-1.93m-6-1.58c1.3 0 2.36 1.06 2.36 2.36s-1.06 2.36-2.36 2.36-2.36-1.06-2.36-2.36c0-1.31 1.05-2.36 2.36-2.36m0 9.13v3.75c-2.4-.75-4.3-2.6-5.14-4.96 1.05-1.12 3.67-1.69 5.14-1.69.53 0 1.2.08 1.9.22-1.64.87-1.9 2.02-1.9 2.68M11.99 20c-.27 0-.53-.01-.79-.04v-4.07c0-1.42 2.94-2.13 4.4-2.13 1.07 0 2.92.39 3.84 1.15-1.17 2.97-4.06 5.09-7.45 5.09"}),"SupervisedUserCircle"),Ag=U(Q.jsx("path",{d:"M2.5 4v3h5v12h3V7h5V4zm19 5h-9v3h3v7h3v-7h3z"}),"TextFields"),mg=U(Q.jsx("path",{d:"M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8zm4 18H6V4h7v5h5zM8 15.01l1.41 1.41L11 14.84V19h2v-4.16l1.59 1.59L16 15.01 12.01 11z"}),"UploadFileOutlined"),Og=U(Q.jsx("path",{d:"M16 13h-3V3h-2v10H8l4 4zM4 19v2h16v-2z"}),"VerticalAlignBottom"),Eg=U(Q.jsx("path",{d:"M8 11h3v10h2V11h3l-4-4zM4 3v2h16V3z"}),"VerticalAlignTop"),fg=U(Q.jsx("path",{d:"M17 10.5V7c0-.55-.45-1-1-1H4c-.55 0-1 .45-1 1v10c0 .55.45 1 1 1h12c.55 0 1-.45 1-1v-3.5l4 4v-11z"}),"Videocam"),xg=U(Q.jsx("path",{d:"M14.67 5v14H9.33V5zm1 14H21V5h-5.33zm-7.34 0V5H3v14z"}),"ViewColumn"),_g=U(Q.jsx("path",{d:"M4 15h16v-2H4zm0 4h16v-2H4zm0-8h16V9H4zm0-6v2h16V5z"}),"ViewHeadline"),Sg=U(Q.jsx("path",{d:"M14.67 5v6.5H9.33V5zm1 6.5H21V5h-5.33zm-1 7.5v-6.5H9.33V19zm1-6.5V19H21v-6.5zm-7.34 0H3V19h5.33zm0-1V5H3v6.5z"}),"ViewModule"),kg=U(Q.jsx("path",{d:"M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5M12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5m0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3"}),"Visibility"),Yg=U(Q.jsx("path",{d:"M1 21h22L12 2zm12-3h-2v-2h2zm0-4h-2v-4h2z"}),"Warning"),Qs=U(Q.jsx("path",{d:"m1 9 2 2c4.97-4.97 13.03-4.97 18 0l2-2C16.93 2.93 7.08 2.93 1 9m8 8 3 3 3-3c-1.65-1.66-4.34-1.66-6 0m-4-4 2 2c2.76-2.76 7.24-2.76 10 0l2-2C15.14 9.14 8.87 9.14 5 13"}),"Wifi"),rr=U(Q.jsx("path",{d:"M22.99 9C19.15 5.16 13.8 3.76 8.84 4.78l2.52 2.52c3.47-.17 6.99 1.05 9.63 3.7zm-4 4c-1.29-1.29-2.84-2.13-4.49-2.56l3.53 3.53zM2 3.05 5.07 6.1C3.6 6.82 2.22 7.78 1 9l1.99 2c1.24-1.24 2.67-2.16 4.2-2.77l2.24 2.24C7.81 10.89 6.27 11.73 5 13v.01L6.99 15c1.36-1.36 3.14-2.04 4.92-2.06L18.98 20l1.27-1.26L3.29 1.79zM9 17l3 3 3-3c-1.65-1.66-4.34-1.66-6 0"}),"WifiOff"),Oo=11/23/100;function RM(s){const e={r:0,g:0,b:0};if(s.length===7)e.r=parseInt(s.substring(1,3),16),e.g=parseInt(s.substring(3,5),16),e.b=parseInt(s.substring(5,7),16);else if(s.length===4){const t=s[1],i=s[2],r=s[3];e.r=parseInt(t+t,16),e.g=parseInt(i+i,16),e.b=parseInt(r+r,16)}return e}function vg(s){return`#${Math.round(s.r).toString(16)}${Math.round(s.g).toString(16)}${Math.round(s.b).toString(16)}`}function bg(s,e,t){const i=RM(s),r=RM(e);return i.r+=r.r*(.05+Oo*(t-1)),i.g+=r.g*(.05+Oo*(t-1)),i.b+=r.b*(.05+Oo*(t-1)),vg(i)}function FM(s,e){const t={};for(let i=1;i<=24;i++)t[`elevation${i}`]={backgroundColor:bg(s,e,i)};return t}function Qg(s,e){var n,a,c,l,N,u,L,g,y,T,d;let t,i;s==="dark"?(i={MuiAppBar:{colorDefault:{backgroundColor:"#272727"}},MuiLink:{root:{textTransform:"uppercase",transition:"color .3s ease",color:Pe[200],"&:hover":{color:Pe[100]}}},MuiPaper:FM("#121212","#fff")},t={name:s,palette:{mode:"dark",background:{paper:"#121212",default:"#121212"},primary:{main:"#4dabf5"},secondary:{main:"#436a93"},expert:"#14bb00",text:{primary:"#ffffff",secondary:"#ffffff"}}}):s==="blue"?(i={MuiAppBar:{colorDefault:{backgroundColor:"#3399CC"}},MuiLink:{root:{textTransform:"uppercase",transition:"color .3s ease",color:Pe[400],"&:hover":{color:Pe[300]}}}},t={name:s,palette:{mode:"dark",background:{paper:"#151d21",default:"#151d21"},primary:{main:"#4dabf5"},secondary:{main:"#436a93"},expert:"#14bb00",text:{primary:"#ffffff",secondary:"#ffffff"}}}):s==="colored"?(i={MuiAppBar:{colorDefault:{backgroundColor:"#2a3135"}},MuiLink:{root:{textTransform:"uppercase",transition:"color .3s ease",color:Pe[200],"&:hover":{color:Pe[100]}}},MuiPaper:FM("#151d21","#fff")},t={name:s,palette:{mode:"light",primary:{main:"#3399CC"},secondary:{main:"#164477"},expert:"#96fc96"}}):s==="PT"?(i={MuiAppBar:{colorDefault:{backgroundColor:"#0F99DE"}},MuiLink:{root:{textTransform:"uppercase",transition:"color .3s ease",color:Pe[400],"&:hover":{color:Pe[300]}}}},t={name:s,palette:{mode:"light",primary:{main:"#0F99DE"},secondary:{main:"#88A536"},expert:"#BD1B24"}}):s==="DX"?(i={MuiAppBar:{colorDefault:{backgroundColor:"#a9a9a9"}},MuiLink:{root:{textTransform:"uppercase",transition:"color .3s ease",color:Pe[400],"&:hover":{color:Pe[300]}}}},t={name:s,palette:{mode:"light",primary:{main:"#F5F5F7"},secondary:{main:"#a9a9a9"},expert:"#BD1B24",text:{primary:"#007AFE",secondary:"#007AFE",disabled:"#007AFEAA"}}}):(i={MuiLink:{root:{textTransform:"uppercase",transition:"color .3s ease",color:Pe[400],"&:hover":{color:Pe[300]}}}},t={name:s,palette:{mode:"light",primary:{main:"#3399CC",dark:"#256c97",light:"#76d0fd"},secondary:{main:"#164477"},expert:"#14bb00"}}),t.toolbar={height:48},t.saveToolbar={background:(a=(n=t.palette)==null?void 0:n.primary)==null?void 0:a.main,button:{borderRadius:3,height:32}},t.palette&&(t.palette.grey={main:vM[300],dark:vM[400]});const r=bM(t),o=r.palette;return bM(r,{...e||void 0,components:{...i,MuiButton:{variants:[{props:{variant:"contained",color:"grey"},style:{backgroundColor:(c=o.grey)==null?void 0:c[300],color:o.getContrastText&&((l=o.grey)!=null&&l[300])?o.getContrastText(o.grey[300]):void 0}},{props:{variant:"outlined",color:"grey"},style:{color:(N=o.text)==null?void 0:N.primary,borderColor:o.mode==="light"?"rgba(0, 0, 0, 0.23)":"rgba(255, 255, 255, 0.23)","&.Mui-disabled":{border:`1px solid ${(u=o.action)==null?void 0:u.disabledBackground}`},"&:hover":{borderColor:o.mode==="light"?"rgba(0, 0, 0, 0.23)":"rgba(255, 255, 255, 0.23)",backgroundColor:QM(((L=o.text)==null?void 0:L.primary)||"",((g=o.action)==null?void 0:g.hoverOpacity)||.04)}}},{props:{variant:"text",color:"grey"},style:{color:(y=o.text)==null?void 0:y.primary,"&:hover":{backgroundColor:QM(((T=o.text)==null?void 0:T.primary)||"",((d=o.action)==null?void 0:d.hoverOpacity)||.04)}}}]},...(e==null?void 0:e.components)||void 0}})}function Ug(){let s,e;const t=new Promise((i,r)=>{s=i,e=r});return t.resolve=s,t.reject=e,t}function Ln(s){return(s==null?void 0:s.rows.map(e=>e.value).filter(e=>!!e))??[]}function Tt(s){return s!=null&&s.startsWith("system.host.")||(s=`system.host.${s}`),s}function ui(s){return s!=null&&s.startsWith("system.host.")&&(s=s.substring(12)),s}function GM(s){return new Promise(e=>{setTimeout(e,s)})}function or(s){s=(s||"").toString();const e=s[0]==="*",t=s[s.length-1]==="*";return s=s.replace(/[-/\\^$+?.()|[\]{}]/g,"\\$&").replace(/\*/g,".*"),(e?"":"^")+s+(t?"":"$")}var rt;(function(s){s[s.CONNECTING=0]="CONNECTING",s[s.CONNECTED=1]="CONNECTED",s[s.OBJECTS_LOADED=2]="OBJECTS_LOADED",s[s.READY=3]="READY"})(rt||(rt={}));var Ie;(function(s){s.PERMISSION_ERROR="permissionError",s.NOT_CONNECTED="notConnectedError",s.TIMEOUT="timeout",s.NOT_ADMIN="Allowed only in admin",s.NOT_SUPPORTED="Not supported"})(Ie||(Ie={}));const F3e=Ie.PERMISSION_ERROR;Ie.NOT_CONNECTED;const $g=["material","echarts","vis"];class ze{constructor(e){this.props=this.applyDefaultProps(e),this.connId=`${this.props.name?`${this.props.name}-`:""}${Math.round(Math.random()*1e6).toString().padStart(6,"0")}`,this.waitForSocketLib().then(()=>this.startSocket()).catch(t=>{alert(`Socket connection could not be initialized: ${t}`)})}applyDefaultProps(e){return{...e,protocol:e.protocol||window.location.protocol,host:e.host||window.location.hostname,port:e.port||(window.location.port==="3000"?8081:window.location.port),ioTimeout:Math.max(e.ioTimeout||2e4,2e4),cmdTimeout:Math.max(e.cmdTimeout||5e3,5e3),admin5only:e.admin5only||!1,autoSubscribes:e.autoSubscribes??[],autoSubscribeLog:e.autoSubscribeLog??!1,doNotLoadACL:e.doNotLoadACL??!0,doNotLoadAllObjects:e.doNotLoadAllObjects??!0}}props;connId;lastAccessToken=null;ignoreState="";connected=!1;subscribed=!1;firstConnect=!0;waitForRestart=!1;loaded=!1;simStates={};statesSubscribes={};filesSubscribes={};objectsSubscribes={};objects={};states={};acl=null;isSecure=!1;onReadyDone=!1;onConnectionHandlers=[];onLogHandlers=[];onCmdStdoutHandler;onCmdStderrHandler;onCmdExitHandler;onError(e){(this.props.onError??console.error)(e)}_socket;_waitForSocketPromise;_waitForFirstConnectionPromise=Ug();_instanceSubscriptions={};_promises={};_authTimer=null;_refreshTimer=null;_systemConfig;get systemConfig(){return this._systemConfig}systemLang="en";static isWeb(){return window.socketUrl!==void 0}waitForSocketLib(){return this._waitForSocketPromise?this._waitForSocketPromise:(this._waitForSocketPromise=new Promise(async(e,t)=>{if(typeof window.io>"u"&&typeof window.iob>"u")if(typeof window.registerSocketOnLoad=="function")window.registerSocketOnLoad(()=>e());else{for(let i=1;i<=30;i++){if(window.io||window.iob)return e();await GM(100)}t(new Error("Socket library could not be loaded!"))}else e()}),this._waitForSocketPromise)}async startSocket(){if(this._socket)return;let e=this.props.host,t=this.props.port,i=(this.props.protocol||window.location.protocol).replace(":",""),r=window.location.pathname;if(window.location.hostname==="iobroker.net"||window.location.hostname==="iobroker.pro")r="";else{if(window.socketUrl){const a=new URL(window.socketUrl);e=a.hostname,t=a.port,i=a.protocol.replace(":","")}const n=r.lastIndexOf("/");if(n!==-1&&(r=r.substring(0,n+1)),ze.isWeb()){const a=r.split("/");a.length>2&&(a.pop(),a.pop(),$g.includes(a[a.length-1])&&a.pop(),r=a.join("/"),r.endsWith("/")||(r+="/"))}}const o=t?`${i}://${e}:${t}`:`${i}://${e}`;return this._socket=(window.io||window.iob).connect(o,{path:r.endsWith("/")?`${r}socket.io`:`${r}/socket.io`,query:"ws=true",name:this.props.name,timeout:this.props.ioTimeout,uuid:this.props.uuid,token:this.props.token}),this._socket.on("connect",n=>{window.addEventListener("storage",this.onAccessTokenUpdated);const a=ze.readTokens();if(a&&!a.owner){const c=Date.now();this.saveTokens({access_token:a.access_token,refresh_token:a.refresh_token,expires_in:Math.round((a.expires_in.getTime()-c)/1e3),refresh_token_expires_in:Math.round((a.refresh_token_expires_in.getTime()-c)/1e3),token_type:"Bearer"},a.stayLoggedIn)}this.onReadyDone=!1,n!==!0?(this.connected=!0,setTimeout(()=>this.getVersion().then(c=>{const[l,N,u]=c.version.split(".");parseInt(l,10)*1e4+parseInt(N,10)*100+parseInt(u,10)<40102?(this._authTimer=null,this.onPreConnect(!1,!1)):this._socket.emit("authenticate",(g,y)=>this.onPreConnect(g,y))}).catch(c=>this.onError({message:c.toString(),operation:"getVersion"})),500)):this._socket.emit("authenticate",(c,l)=>{this.onPreConnect(c,l)})}),this._socket.on("reconnect",()=>{var n,a;this.onReadyDone=!1,(a=(n=this.props).onProgress)==null||a.call(n,rt.READY),this.connected=!0,this.waitForRestart?window.location.reload():(this._subscribe(!0),this.onConnectionHandlers.forEach(c=>c(!0)))}),this._socket.on("disconnect",()=>{var n,a;this.onReadyDone=!1,this.connected=!1,this.subscribed=!1,(a=(n=this.props).onProgress)==null||a.call(n,rt.CONNECTING),this.onConnectionHandlers.forEach(c=>c(!1))}),this._socket.on("reauthenticate",()=>this.authenticate()),this._socket.on("log",n=>{var a,c;(c=(a=this.props).onLog)==null||c.call(a,n),this.onLogHandlers.forEach(l=>l(n))}),this._socket.on("error",n=>{let a;n==null?a="":typeof n.toString=="function"?a=n.toString():(a=JSON.stringify(n),console.error(`Received strange error: ${a}`)),a.includes("User not authorized")?this.authenticate():a.includes("websocket error")?(console.error(`Socket Error => reload: ${n}`),window.location.reload()):console.error(`Socket Error: ${n}`)}),this._socket.on("connect_error",n=>console.error(`Connect error: ${n}`)),this._socket.on("permissionError",n=>this.onError({message:"no permission",operation:n.operation,type:n.type,id:n.id||""})),this._socket.on("objectChange",(n,a)=>{setTimeout(()=>this.objectChange(n,a),0)}),this._socket.on("stateChange",(n,a)=>{setTimeout(()=>this.stateChange(n,a),0)}),this._socket.on("im",(n,a,c)=>{setTimeout(()=>this.instanceMessage(n,a,c),0)}),this._socket.on("fileChange",(n,a,c)=>{setTimeout(()=>this.fileChange(n,a,c),0)}),this._socket.on("cmdStdout",(n,a)=>{var c;(c=this.onCmdStdoutHandler)==null||c.call(this,n,a)}),this._socket.on("cmdStderr",(n,a)=>{var c;(c=this.onCmdStderrHandler)==null||c.call(this,n,a)}),this._socket.on("cmdExit",(n,a)=>{var c;(c=this.onCmdExitHandler)==null||c.call(this,n,a)}),Promise.resolve()}onPreConnect(e,t){var i,r;this._authTimer&&(clearTimeout(this._authTimer),this._authTimer=null),this.connected=!0,this.isSecure=t,this.waitForRestart?window.location.reload():(this.firstConnect?this.loadData().catch(o=>console.error(`Cannot load data: ${o}`)):(r=(i=this.props).onProgress)==null||r.call(i,rt.READY),this._subscribe(!0),this.onConnectionHandlers.forEach(o=>o(!0)),this.checkAccessTokenExpire()),this._waitForFirstConnectionPromise.resolve()}static readTokens(){let e=window.sessionStorage.getItem("iob_tokens");const t=!e;if(e||(e=window.localStorage.getItem("iob_tokens")),!e)return null;const[i,r,o,n,a]=e.split(";"),c=new Date(r);return c.getTime()<Date.now()?null:{refresh_token:i,refresh_token_expires_in:c,access_token:o,expires_in:new Date(n),owner:a,stayLoggedIn:t}}static saveTokensStatic(e,t,i){const r=`${e.refresh_token};${new Date(Date.now()+e.refresh_token_expires_in*1e3).toISOString()};${e.access_token};${new Date(Date.now()+e.expires_in*1e3).toISOString()}${i?`;${i}`:""}`;t?window.localStorage.setItem("iob_tokens",r):window.sessionStorage.setItem("iob_tokens",r)}saveTokens(e,t){ze.saveTokensStatic(e,t,this.connId)}static deleteTokensStatic(){window.localStorage.removeItem("iob_tokens"),window.sessionStorage.removeItem("iob_tokens")}deleteTokens(e,t){const i=ze.readTokens();i&&(t?ze.deleteTokensStatic():i.stayLoggedIn===e&&i.owner===this.connId&&(i.stayLoggedIn?window.localStorage.removeItem("iob_tokens"):window.sessionStorage.removeItem("iob_tokens")))}onAccessTokenUpdated=e=>{if(e.key==="iob_tokens"){const t=ze.readTokens();t&&(console.log(`Tab ${this.connId} received updated token: ${t.access_token}`),this.updateTokenExpiration(t.access_token))}};updateTokenExpiration(e){this.lastAccessToken!==e&&(this.lastAccessToken=e,this._socket.emit("updateTokenExpiration",e,(t,i)=>{t?(console.error(`[UPDATE/${new Date().toISOString()}] cannot say to server about new token: ${t}`),window.location.reload()):i?console.log(`[UPDATE/${new Date().toISOString()}] server accepted new token: ${e}`):(console.error(`[UPDATE/${new Date().toISOString()}] cannot say to server about new token`),window.location.reload())})),this.checkAccessTokenExpire()}refreshTokens(e,t){if(!e){console.log(`[REFRESH/${new Date().toISOString()}] No token structure found => reloading the page`),setTimeout(()=>window.location.reload(),500);return}t||!e.owner||e.owner===this.connId?(console.log(`[REFRESH/${new Date().toISOString()}] claim ownership of the token`),this.acquireTokenLock()?(console.log(`[REFRESH/${new Date().toISOString()}] refreshing token`),fetch("./oauth/token",{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:`grant_type=refresh_token&refresh_token=${e.refresh_token}&client_id=ioBroker&stayloggedin=${e.stayLoggedIn}`}).then(i=>{if(i.ok)return i.json();throw new Error("Cannot refresh access token")}).then(i=>{if(i.access_token)console.log(`[REFRESH/${new Date().toISOString()}] received new token: ${i.access_token}`),this.saveTokens(i,e.stayLoggedIn),this.releaseTokenLock(),this.updateTokenExpiration(i.access_token);else throw new Error("Cannot get access token")}).catch(i=>{console.warn(`[REFRESH/${new Date().toISOString()}] cannot refresh token: ${i}`),this.releaseTokenLock(),this.deleteTokens(e.stayLoggedIn),console.error(i),window.location.reload()})):(console.log(`[REFRESH/${new Date().toISOString()}] Someone else is updating the token, so wait for the next check`),this.checkAccessTokenExpire())):this.lastAccessToken!==e.access_token&&this.updateTokenExpiration(e.access_token)}acquireTokenLock(){const e=Date.now(),t=localStorage.getItem("iob_token_semaphore");if(t)try{const r=JSON.parse(t);if(e<r.expiry)return!1}catch{}const i={connId:this.connId,expiry:e+10*1e3};return localStorage.setItem("iob_token_semaphore",JSON.stringify(i)),!0}releaseTokenLock(){const e=localStorage.getItem("iob_token_semaphore");if(e)try{JSON.parse(e).connId===this.connId&&localStorage.removeItem("iob_token_semaphore")}catch{localStorage.removeItem("iob_token_semaphore")}}checkAccessTokenExpire(){if(this._refreshTimer&&(clearTimeout(this._refreshTimer),this._refreshTimer=null),this.isSecure){const e=ze.readTokens();if(e){const t=e.expires_in.getTime();if(t<Date.now()+3e4){const i=t<Date.now()+5500;console.log(`[TOKEN/${new Date().toISOString()}] Updating refresh token ${e.access_token}`),e.refresh_token?e.owner===this.connId||i?(e.owner===this.connId?console.log(`[TOKEN/${new Date().toISOString()}] We are the owner of the token`):console.log(`[TOKEN/${new Date().toISOString()}] We are not the owner of the token, but we will take ownership`),this.props.tokenTimeoutHandler?(console.log(`[TOKEN/${new Date().toISOString()}] Asking GUI if we should prolong the token`),this.props.tokenTimeoutHandler(t).then(r=>{r?(console.log(`[TOKEN/${new Date().toISOString()}] Token will be prolonged`),this.refreshTokens(e,i)):(console.log(`[TOKEN/${new Date().toISOString()}] Token will not be prolonged. Reloading the page`),setTimeout(()=>window.location.reload(),Date.now()>t?500:t-Date.now()))})):(console.log(`[TOKEN/${new Date().toISOString()}] No tokenTimeoutHandler defined. Prolonging the token`),this.refreshTokens(e,i))):this.lastAccessToken!==e.access_token?(console.log(`[TOKEN/${new Date().toISOString()}] We are not the owner of the token, but we will inform the server about new token`),this.refreshTokens(e)):(console.log(`[TOKEN/${new Date().toISOString()}] We are not the owner of the token and the token did not change. Check in 3 seconds if the owner updated the token`),this._refreshTimer=setTimeout(()=>{this._refreshTimer=null,this.checkAccessTokenExpire()},3e3)):(console.log(`[TOKEN/${new Date().toISOString()}] We do not have a refresh token, so we need to reauthenticate`),setTimeout(()=>window.location.reload(),Date.now()>t?500:t-Date.now()))}else this._refreshTimer=setTimeout(()=>{this._refreshTimer=null,this.checkAccessTokenExpire()},t-Date.now()-3e4>12e4?12e4:t-Date.now()-3e4)}}}static isCloud(){return window.location.hostname.includes("amazonaws.com")||window.location.hostname.includes("iobroker.in")?!0:typeof window.socketUrl>"u"?!1:window.socketUrl.includes("iobroker.in")||window.socketUrl.includes("amazonaws")}isConnected(){return this.connected}waitForFirstConnection(){return this._waitForFirstConnectionPromise}async getUserPermissions(){return this.request({commandTimeout:!1,executor:(e,t)=>{this._socket.emit("getUserPermissions",(i,r)=>{i?t(i):e(r||null)})}})}async loadData(){if(this.loaded)return;const e=10;for(let t=1;t<=e;t++){if(this.doLoadData().catch(i=>console.error(`Cannot load data: ${i}`)),this.loaded)return;await GM(ze.isCloud()?5e3:1e3)}}async doLoadData(){var e,t,i,r,o,n,a,c,l;if(!this.loaded){if(!this.props.doNotLoadACL)try{this.acl=await this.getUserPermissions()}catch(N){this.onError(`Cannot read user permissions: ${N}`);return}try{this.props.admin5only&&!ze.isWeb()&&(!window.vendorPrefix||window.vendorPrefix==="@@vendorPrefix@@")?this._systemConfig=await this.getCompactSystemConfig():this._systemConfig=await this.getSystemConfig()}catch(N){this.onError(`Cannot read system config: ${N}`);return}this._systemConfig&&(this.systemLang=(e=this._systemConfig.common)==null?void 0:e.language,this.systemLang||(this.systemLang=window.navigator.userLanguage||window.navigator.language,/^(en|de|ru|pt|nl|fr|it|es|pl|uk)-?/.test(this.systemLang)?this.systemLang=this.systemLang.substring(0,2):/^(en|de|ru|pt|nl|fr|it|es|pl|uk|zh-cn)$/.test(this.systemLang)||(this.systemLang="en"),this._systemConfig.common.language=this.systemLang)),(i=(t=this.props).onLanguage)==null||i.call(t,this.systemLang),this.loaded=!0,(o=(r=this.props).onProgress)==null||o.call(r,rt.CONNECTED),this.firstConnect=!1,this.props.doNotLoadAllObjects?this.props.admin5only?this.objects={}:this.objects={"system.config":this._systemConfig}:this.objects=await this.getObjects(),(a=(n=this.props).onProgress)==null||a.call(n,rt.READY),this.onReadyDone||(this.onReadyDone=!0,(l=(c=this.props).onReady)==null||l.call(c,this.objects))}}authenticate(){window.location.search.includes("&href=")?window.location.href=`${window.location.protocol}//${window.location.host}${window.location.pathname}${window.location.search}`:window.location.href=`${window.location.protocol}//${window.location.host}${window.location.pathname}?login&href=${encodeURIComponent(window.location.search+window.location.hash)}`}async subscribeState(...e){let t,i,r;e.length===3?[t,i,r]=e:([t,r]=e,i=!1);let o;if(Array.isArray(t)?o=t:o=[t],typeof r!="function")throw new Error("The state change handler must be a function!");const n=[];for(let a=0;a<o.length;a++){const c=o[a];this.statesSubscribes[c]?!this.statesSubscribes[c].cbs.includes(r)&&this.statesSubscribes[c].cbs.push(r):(this.statesSubscribes[c]={reg:new RegExp(or(c)),cbs:[r]},t!==this.ignoreState&&n.push(c))}if(this.connected)if(n.length&&this._socket.emit("subscribe",n),i){let a;for(let c=0;c<o.length;c++){try{a=await this.getBinaryState(o[c])}catch(l){console.error(`Cannot getBinaryState "${o[c]}": ${JSON.stringify(l)}`),a=void 0}a!=null&&r(o[c],a)}}else if(o.find(a=>a.includes("*"))){let a;for(let c=0;c<o.length;c++){try{a=await this.getForeignStates(o[c])}catch(l){console.error(`Cannot getForeignStates "${o[c]}": ${JSON.stringify(l)}`);return}if(a)for(const[l,N]of Object.entries(a)){const u=r(l,N);u instanceof Promise&&u.catch(L=>console.error(`Cannot call state change handler: ${L}`))}}}else try{const a=await(ze.isWeb()?this.getStates(o):this.getForeignStates(o));if(a)for(const[c,l]of Object.entries(a)){const N=r(c,l);N instanceof Promise&&N.catch(u=>console.error(`Cannot call state change handler: ${u}`))}}catch(a){console.error(`Cannot getState "${o.join(", ")}": ${a.message}`);return}}async subscribeStateAsync(e,t){return this.subscribeState(e,t)}unsubscribeState(e,t){var o;let i;Array.isArray(e)?i=e:i=[e];const r=[];for(let n=0;n<i.length;n++){const a=i[n];if(this.statesSubscribes[a]){const c=this.statesSubscribes[a];if(t){const l=c.cbs.indexOf(t);l!==-1&&c.cbs.splice(l,1)}else c.cbs=[];(o=c.cbs)!=null&&o.length||(delete this.statesSubscribes[a],a!==this.ignoreState&&r.push(a))}}this.connected&&r.length&&this._socket.emit("unsubscribe",i)}subscribeObject(e,t){let i;if(Array.isArray(e)?i=e:i=[e],typeof t!="function")throw new Error("The object change handler must be a function!");const r=[];for(let o=0;o<i.length;o++){const n=i[o];this.objectsSubscribes[n]?!this.objectsSubscribes[n].cbs.includes(t)&&this.objectsSubscribes[n].cbs.push(t):(this.objectsSubscribes[n]={reg:new RegExp(or(n)),cbs:[t]},r.push(n))}return this.connected&&r.length&&this._socket.emit("subscribeObjects",r),Promise.resolve()}unsubscribeObject(e,t){var o;let i;Array.isArray(e)?i=e:i=[e];const r=[];for(let n=0;n<i.length;n++){const a=i[n];if(this.objectsSubscribes[a]){const c=this.objectsSubscribes[a];if(t){const l=c.cbs.indexOf(t);l!==-1&&c.cbs.splice(l,1)}else c.cbs=[];(o=c.cbs)!=null&&o.length||(delete this.objectsSubscribes[a],r.push(a))}}return this.connected&&r.length&&this._socket.emit("unsubscribeObjects",r),Promise.resolve()}objectChange(e,t){var o,n;let i;this.objects[e]&&(i={_id:e,type:this.objects[e].type});let r=!1;t?(t._rev&&this.objects[e]&&(this.objects[e]._rev=t._rev),(!this.objects[e]||JSON.stringify(this.objects[e])!==JSON.stringify(t))&&(this.objects[e]=t,r=!0)):this.objects[e]&&(delete this.objects[e],r=!0);for(const[a,c]of Object.entries(this.objectsSubscribes))(a===e||c.reg.test(e))&&c.cbs.forEach(l=>{try{const N=l(e,t,i);N instanceof Promise&&N.catch(u=>console.error(`Cannot call object change handler: ${u}`))}catch(N){console.error(`Error by callback of objectChange: ${N}`)}});if(r){const a=(n=(o=this.props).onObjectChange)==null?void 0:n.call(o,e,t);a instanceof Promise&&a.catch(c=>console.error(`Cannot call object change handler: ${c}`))}}stateChange(e,t){for(const i of Object.values(this.statesSubscribes))if(i.reg.test(e))for(const r of i.cbs)try{const o=r(e,t??null);o instanceof Promise&&o.catch(n=>console.error(`Cannot call state change handler: ${n}`))}catch(o){console.error(`Error by callback of stateChanged: ${o}`)}}instanceMessage(e,t,i){var r;(r=this._instanceSubscriptions[t])==null||r.forEach(o=>{if(o.messageType===e){const n=o.callback(i,t,e);n instanceof Promise&&n.catch(a=>console.error(`Cannot call instance message handler: ${a}`))}})}fileChange(e,t,i){for(const r of Object.values(this.filesSubscribes))if(r.regId.test(e)&&r.regFilePattern.test(t))for(const o of r.cbs)try{o(e,t,i)}catch(n){console.error(`Error by callback of fileChange: ${n}`)}}async subscribeFiles(e,t,i){if(typeof i!="function")throw new Error("The state change handler must be a function!");let r;Array.isArray(t)?r=t:r=[t];const o=[];for(let n=0;n<r.length;n++){const a=r[n],c=`${e}$%$${a}`;this.filesSubscribes[c]?!this.filesSubscribes[c].cbs.includes(i)&&this.filesSubscribes[c].cbs.push(i):(this.filesSubscribes[c]={regId:new RegExp(or(e)),regFilePattern:new RegExp(or(a)),cbs:[i]},o.push(a))}return this.connected&&o.length&&this._socket.emit("subscribeFiles",e,o),Promise.resolve()}unsubscribeFiles(e,t,i){var n;let r;Array.isArray(t)?r=t:r=[t];const o=[];for(let a=0;a<r.length;a++){const c=r[a],l=`${e}$%$${c}`;if(this.filesSubscribes[l]){const N=this.filesSubscribes[l];if(i){const u=N.cbs.indexOf(i);u!==-1&&N.cbs.splice(u,1)}else N.cbs=[];(n=N.cbs)!=null&&n.length||(delete this.filesSubscribes[l],o.push(c))}}this.connected&&o.length&&this._socket.emit("unsubscribeFiles",e,o)}async request({cacheKey:e,forceUpdate:t,commandTimeout:i,onTimeout:r,requireAdmin:o,requireFeatures:n,executor:a}){if(o&&ze.isWeb())return Promise.reject(new Error(Ie.NOT_ADMIN));if(e&&!t&&e in this._promises)return this._promises[e];if(!this.connected)return Promise.reject(new Error(Ie.NOT_CONNECTED));if(n!=null&&n.length){for(const l of n)if(!await this.checkFeatureSupported(l))throw new Error(Ie.NOT_SUPPORTED)}const c=new Promise(async(l,N)=>{const u={elapsed:!1,clearTimeout:()=>{}};let L;i!==!1&&(L=setTimeout(()=>{u.elapsed=!0,r==null||r(),e&&this._promises[e]instanceof Promise&&delete this._promises[e],N(new Error(Ie.TIMEOUT))},i??this.props.cmdTimeout),u.clearTimeout=()=>{clearTimeout(L)});try{await a(l,N,u)}catch(g){e&&this._promises[e]instanceof Promise&&delete this._promises[e],N(new Error(g.toString()))}});return e&&(this._promises[e]=c),c}resetCache(e,t){t?Object.keys(this._promises).filter(i=>i.startsWith(e)).forEach(i=>{delete this._promises[i]}):delete this._promises[e]}getStates(e){return this.request({commandTimeout:!1,executor:(t,i)=>{this._socket.emit("getStates",e,(r,o)=>{this.states=o??{},r?i(r):t(this.states)})}})}getState(e){return this.request({commandTimeout:!1,executor:(t,i)=>{if(e&&e===this.ignoreState){t(this.simStates[e]||{val:null,ack:!0});return}this._socket.emit("getState",e,(r,o)=>{r?i(r):t(o)})}})}getBinaryState(e){return this.request({commandTimeout:!1,executor:(t,i)=>{this._socket.emit("getBinaryState",e,(r,o)=>{r?i(r):t(o)})}})}setBinaryState(e,t){return this.request({commandTimeout:!1,executor:(i,r)=>{this._socket.emit("setBinaryState",e,t,o=>{o?r(o):i()})}})}setState(e,t,i){return typeof i=="boolean"&&(t={val:t,ack:i}),this.request({commandTimeout:!1,executor:(r,o)=>{if(e&&e===this.ignoreState){let n;if(typeof i=="boolean"||typeof t=="object"&&t.val!==void 0?n=t:n={val:t,ack:!1,ts:Date.now(),lc:Date.now(),from:"system.adapter.vis.0"},this.simStates[e]=n,this.statesSubscribes[e])for(const a of this.statesSubscribes[e].cbs)try{const c=a(e,n);c instanceof Promise&&c.catch(l=>console.error(`Cannot call state change handler: ${l}`))}catch(c){console.error(`Error by callback of stateChanged: ${c}`)}r();return}this._socket.emit("setState",e,t,n=>{n?o(n):r()})}})}getObjects(e,t){return this.request({commandTimeout:!1,executor:(i,r)=>{if(!e&&this.objects){i(this.objects);return}this._socket.emit(ze.isWeb()?"getObjects":"getAllObjects",(o,n)=>{var a,c;t||(c=(a=this.props).onProgress)==null||c.call(a,rt.OBJECTS_LOADED),o?r(o):(this.objects=n??{},i(this.objects))})}})}getObjectsById(e){return this.request({commandTimeout:!1,executor:(t,i)=>{this._socket.emit("getObjects",e,(r,o)=>{r?i(r):t(o)})}})}_subscribe(e){var t,i;if(e&&!this.subscribed){this.subscribed=!0,(t=this.props.autoSubscribes)!=null&&t.length&&this._socket.emit("subscribeObjects",this.props.autoSubscribes);const r=Object.keys(this.objectsSubscribes);r.length&&this._socket.emit("subscribeObjects",r),Object.keys(this.objectsSubscribes).forEach(o=>this._socket.emit("subscribeObjects",o)),this.props.autoSubscribeLog&&this._socket.emit("requireLog",!0),Object.keys(this.statesSubscribes).forEach(o=>this._socket.emit("subscribe",o)),Object.keys(this.filesSubscribes).forEach(o=>{const[n,a]=o.split("$%$");this._socket.emit("subscribeFiles",n,a)})}else if(!e&&this.subscribed){this.subscribed=!1,(i=this.props.autoSubscribes)!=null&&i.length&&this._socket.emit("unsubscribeObjects",this.props.autoSubscribes);const r=Object.keys(this.objectsSubscribes);r.length&&this._socket.emit("unsubscribeObjects",r),this.props.autoSubscribeLog&&this._socket.emit("requireLog",!1),Object.keys(this.statesSubscribes).forEach(o=>this._socket.emit("unsubscribe",o)),Object.keys(this.filesSubscribes).forEach(o=>{const[n,a]=o.split("$%$");this._socket.emit("unsubscribeFiles",n,a)})}}requireLog(e){return this.request({commandTimeout:!1,executor:(t,i)=>{this._socket.emit("requireLog",e,r=>{r?i(r):t()})}})}delObject(e,t=!1){return this.request({commandTimeout:!1,executor:(i,r)=>{this._socket.emit("delObject",e,{maintenance:t},o=>{o?r(o):i()})}})}delObjects(e,t){return this.request({commandTimeout:!1,executor:(i,r)=>{this._socket.emit("delObjects",e,{maintenance:t},o=>{o?r(o):i()})}})}setObject(e,t){return t?(t=JSON.parse(JSON.stringify(t)),delete t.from,delete t.user,delete t.ts,this.request({commandTimeout:!1,executor:(i,r)=>{this._socket.emit("setObject",e,t,o=>{o?r(o):i()})}})):Promise.reject(new Error("Null object is not allowed"))}getObject(e){return this.request({commandTimeout:!1,executor:(t,i)=>{if(e&&e===this.ignoreState){t({_id:this.ignoreState,type:"state",common:{name:"ignored state",type:"mixed"}});return}this._socket.emit("getObject",e,(r,o)=>{r?i(r):t(o)})}})}sendTo(e,t,i){return this.request({commandTimeout:!1,executor:r=>{this._socket.emit("sendTo",e,t,i,o=>{r(o)})}})}extendObject(e,t){return t?(t=JSON.parse(JSON.stringify(t)),delete t.from,delete t.user,delete t.ts,this.request({commandTimeout:!1,executor:(i,r)=>{this._socket.emit("extendObject",e,t,o=>{o?r(o):i()})}})):Promise.reject(new Error("Null object is not allowed"))}registerLogHandler(e){this.onLogHandlers.includes(e)||this.onLogHandlers.push(e)}unregisterLogHandler(e){const t=this.onLogHandlers.indexOf(e);t!==-1&&this.onLogHandlers.splice(t,1)}registerConnectionHandler(e){this.onConnectionHandlers.includes(e)||this.onConnectionHandlers.push(e)}unregisterConnectionHandler(e){const t=this.onConnectionHandlers.indexOf(e);t!==-1&&this.onConnectionHandlers.splice(t,1)}registerCmdStdoutHandler(e){this.onCmdStdoutHandler=e}unregisterCmdStdoutHandler(){this.onCmdStdoutHandler=void 0}registerCmdStderrHandler(e){this.onCmdStderrHandler=e}unregisterCmdStderrHandler(){this.onCmdStderrHandler=void 0}registerCmdExitHandler(e){this.onCmdExitHandler=e}unregisterCmdExitHandler(){this.onCmdExitHandler=void 0}getEnums(e,t){return this.request({cacheKey:`enums_${e||"all"}`,forceUpdate:t,commandTimeout:!1,executor:(i,r)=>{this._socket.emit("getObjectView","system","enum",{startkey:`enum.${e||""}`,endkey:e?`enum.${e}.香`:"enum.香"},(o,n)=>{if(o)r(o);else{const a={};if(n)for(let c=0;c<n.rows.length;c++)e&&n.rows[c].id===`enum.${e}`||(a[n.rows[c].id]=n.rows[c].value);i(a)}})}})}getObjectView(e,t,i){return this.getObjectViewCustom("system",i,e,t)}getObjectViewSystem(e,t,i){return this.getObjectViewCustom("system",e,t,i)}getObjectViewCustom(e,t,i,r){return this.request({commandTimeout:!1,executor:(o,n)=>{i=i||"",r=r||"香",this._socket.emit("getObjectView",e,t,{startkey:i,endkey:r},(a,c)=>{if(a)n(a);else{const l={};if(c&&c.rows)for(let N=0;N<c.rows.length;N++)l[c.rows[N].id]=c.rows[N].value;o(l)}})}})}readMetaItems(){return this.request({commandTimeout:!1,executor:(e,t)=>{this._socket.emit("getObjectView","system","meta",{startkey:"",endkey:"香"},(i,r)=>{var o;i?t(i):e((o=r.rows)==null?void 0:o.map(n=>n.value).filter(n=>!!n))})}})}readDir(e,t){return this.request({commandTimeout:!1,executor:(i,r)=>{this._socket.emit("readDir",e,t,(o,n)=>{o?r(o):i(n)})}})}readFile(e,t,i){return this.request({commandTimeout:!1,executor:(r,o)=>{this._socket.emit(i?"readFile64":"readFile",e,t,(n,a,c)=>{n?o(n):r({file:a,mimeType:c})})}})}writeFile64(e,t,i){return this.request({commandTimeout:!1,executor:(r,o)=>{if(typeof i=="string")this._socket.emit("writeFile",e,t,i,n=>{n?o(n):r()});else{const n=btoa(new Uint8Array(i).reduce((a,c)=>a+String.fromCharCode(c),""));this._socket.emit("writeFile64",e,t,n,a=>{a?o(a):r()})}}})}deleteFile(e,t){return this.request({commandTimeout:!1,executor:(i,r)=>{this._socket.emit("deleteFile",e,t,o=>{o?r(o):i()})}})}deleteFolder(e,t){return this.request({commandTimeout:!1,executor:(i,r)=>{this._socket.emit("deleteFolder",e,t,o=>{o?r(o):i()})}})}rename(e,t,i){return this.request({commandTimeout:!1,executor:(r,o)=>{this._socket.emit("rename",e,t,i,n=>{n?o(n):r()})}})}renameFile(e,t,i){return this.request({commandTimeout:!1,executor:(r,o)=>{this._socket.emit("renameFile",e,t,i,n=>{n?o(n):r()})}})}cmdExec(e,t,i,r){return this.request({commandTimeout:r,executor:(o,n,a)=>{e=Tt(e),this._socket.emit("cmdExec",e,i,t,c=>{a.elapsed||(a.clearTimeout(),c?n(c):o())})}})}getSystemConfig(e){return this.request({cacheKey:"systemConfig",forceUpdate:e,commandTimeout:!1,executor:async t=>{let i=await this.getObject("system.config");i??={},i.common??={},i.native??={},t(i)}})}getCompactSystemConfig(e){return this.request({cacheKey:"systemConfigCommon",forceUpdate:e,commandTimeout:!1,requireAdmin:!0,executor:(t,i)=>{this._socket.emit("getCompactSystemConfig",(r,o)=>{r?i(r):(o??={},o.common??={},o.native??={},t(o))})}})}getForeignStates(e){return this.request({commandTimeout:!1,executor:(t,i)=>{this._socket.emit("getForeignStates",e||"*",(r,o)=>{r?i(r):t(o??{})})}})}getForeignObjects(e,t){return this.request({commandTimeout:!1,executor:(i,r)=>{this._socket.emit("getForeignObjects",e||"*",t,(o,n)=>{o?r(o):i(n)})}})}setSystemConfig(e){return this.setObject("system.config",e)}getRawSocket(){return this._socket}getHistory(e,t){return this.request({commandTimeout:!1,executor:(i,r)=>{this._socket.emit("getHistory",e,t,(o,n)=>{o?r(o):i(n)})}})}getHistoryEx(e,t){return this.request({commandTimeout:!1,executor:(i,r)=>{this._socket.emit("getHistory",e,t,(o,n,a,c)=>{o?r(o):i({values:n,sessionId:c,step:a})})}})}getIpAddresses(e,t){return e=Tt(e),this.request({cacheKey:`IPs_${e}`,forceUpdate:t,commandTimeout:!1,executor:async i=>{const r=await this.getObject(e);i((r==null?void 0:r.common.address)??[])}})}getVersion(e){return this.request({cacheKey:"version",forceUpdate:e,commandTimeout:!1,executor:(t,i)=>{this._socket.emit("getVersion",(r,o,n)=>{r&&!o&&typeof r=="string"&&r.match(/\d+\.\d+\.\d+/)?t({version:r,serverName:"socketio"}):r?i(r):t({version:o,serverName:n})})}})}getWebServerName(){return this.request({cacheKey:"webName",commandTimeout:!1,executor:(e,t)=>{this._socket.emit("getAdapterName",(i,r)=>{i?t(i):e(r)})}})}fileExists(e,t){return this.request({commandTimeout:!1,executor:(i,r)=>{this._socket.emit("fileExists",e,t,(o,n)=>{o?r(o):i(!!n)})}})}getCurrentUser(){return this.request({commandTimeout:!1,executor:e=>{this._socket.emit("authEnabled",(t,i)=>{e(i)})}})}getUuid(){return this.request({cacheKey:"uuid",commandTimeout:!1,executor:async e=>{var i;const t=await this.getObject("system.meta.uuid");e((i=t==null?void 0:t.native)==null?void 0:i.uuid)}})}checkFeatureSupported(e,t){return this.request({cacheKey:`supportedFeatures_${e}`,forceUpdate:t,commandTimeout:!1,executor:(i,r)=>{this._socket.emit("checkFeatureSupported",e,(o,n)=>{o?r(o):i(n)})}})}getAdapterInstances(e,t){return typeof e=="boolean"&&(t=e,e=""),e=e||"",this.request({cacheKey:`instances_${e}`,forceUpdate:t,commandTimeout:!1,executor:async i=>{const r=e?`system.adapter.${e}.`:"system.adapter.",o=`${r}香`,n=await this.getObjectViewSystem("instance",r,o),a=Object.values(n);i(e?a.filter(c=>c.common.name===e):a)}})}getAdapters(e,t){return typeof e=="boolean"&&(t=e,e=""),e=e||"",this.request({cacheKey:`adapter_${e}`,forceUpdate:t,commandTimeout:!1,executor:async i=>{const r=await this.getObjectViewSystem("adapter",`system.adapter.${e||""}`,`system.adapter.${e||"香"}`),o=Object.values(r);i(e?o.filter(n=>n.common.name===e):o)}})}getGroups(e){return this.request({cacheKey:"groups",forceUpdate:e,commandTimeout:!1,executor:(t,i)=>{this._socket.emit("getObjectView","system","group",{startkey:"system.group.",endkey:"system.group.香"},(r,o)=>{r?i(r):t(Ln(o))})}})}logout(){return this.request({commandTimeout:!1,executor:(e,t)=>{this._socket.emit("logout",i=>{i?t(i):e(null)})}})}subscribeOnInstance(e,t,i,r){return this.request({commandTimeout:!1,executor:(o,n)=>{this._socket.emit("clientSubscribe",e,t,i,(a,c)=>{a?n(a):c&&(c.error?n(c.error):(e.startsWith("system.adapter.")||(e=`system.adapter.${e}`),this._instanceSubscriptions[e]=this._instanceSubscriptions[e]||[],this._instanceSubscriptions[e].find(l=>l.messageType===t&&l.callback===r)||this._instanceSubscriptions[e].push({messageType:t,callback:r}),o(c)))})}})}unsubscribeFromInstance(e,t,i){var n;e.startsWith("system.adapter.")||(e=`system.adapter.${e}`);let r;const o=[];do{r=!1;const a=(n=this._instanceSubscriptions[e])==null?void 0:n.findIndex(c=>(!t||c.messageType===t)&&(!i||c.callback===i));if(a!=null&&a!==-1){r=!0;const c=this._instanceSubscriptions[e][a].messageType;this._instanceSubscriptions[e].splice(a,1),this._instanceSubscriptions[e].length||delete this._instanceSubscriptions[e],this._instanceSubscriptions[e]&&this._instanceSubscriptions[e].find(N=>N.messageType===c)||o.push(this.request({commandTimeout:!1,executor:(N,u)=>{this._socket.emit("clientUnsubscribe",e,t,(L,g)=>L?u(L):N(g))}}))}}while(r&&(!i||!t));return o.length?Promise.all(o).then(a=>!!a.find(c=>c)):Promise.resolve(!1)}log(e,t){return e?this.request({commandTimeout:!1,executor:i=>(this._socket.emit("log",e,t),i(null))}):Promise.resolve(null)}setStateToIgnore(e){this.ignoreState=e}}function Pg(s,e){if(!e)return;let t;if(e.length<700&&(e.indexOf("/")!==-1||e.indexOf("\\")!==-1))if(s.toLowerCase().includes("private"))t="private";else if(e.toLowerCase().includes("private"))t="private";else if(s.toLowerCase().includes("public"))t="public";else if(e.toLowerCase().includes("public"))t="public";else if(s.toLowerCase().includes("chain"))t="chained";else if(e.toLowerCase().includes("chain"))t="chained";else return;else t=e.substring(0,26)==="-----BEGIN RSA PRIVATE KEY"||e.substring(0,22)==="-----BEGIN PRIVATE KEY"?"private":"public",t==="public"&&e.split("-----END CERTIFICATE-----").filter(r=>r.replace(/\r\n|\r|\n/,"").trim()).length>1&&(t="chained");return{name:s,type:t}}function Wg(s){var i,r,o,n;const e=[{name:"[IPv4] 0.0.0.0 - Listen on all IPs",address:"0.0.0.0",family:"ipv4"}],t=[{name:"[IPv6] :: - Listen on all IPs",address:"::",family:"ipv6"}];if((r=(i=s.native)==null?void 0:i.hardware)!=null&&r.networkInterfaces){const a=(n=(o=s.native)==null?void 0:o.hardware)==null?void 0:n.networkInterfaces;Object.keys(a).forEach(c=>{a[c].forEach(l=>{l.family!=="IPv6"?e.push({name:`[${l.family}] ${l.address} - ${c}`,address:l.address,family:"ipv4"}):t.push({name:`[${l.family}] ${l.address} - ${c}`,address:l.address,family:"ipv6"})})})}return{IPs4:e,IPs6:t}}class G3e extends ze{constructor(e){super(e)}request(e){return super.request({requireAdmin:!0,...e})}getCertificates(e){return this.request({cacheKey:"cert",forceUpdate:e,commandTimeout:!1,executor:async t=>{var r;const i=await this.getObject("system.certificates");(r=i==null?void 0:i.native)!=null&&r.certificates?t(Object.entries(i.native.certificates).map(([o,n])=>Pg(o,n)).filter(o=>!!o)):t([])}})}getLogs(e,t=200){return this.request({commandTimeout:!1,executor:i=>{this._socket.emit("sendToHost",e,"getLogs",t||200,r=>{i(r)})}})}upgradeAdapterWithWebserver(e,t){return this.request({commandTimeout:!1,executor:i=>{this._socket.emit("sendToHost",e,"upgradeAdapterWithWebserver",t,r=>{i(r)})}})}upgradeController(e,t,i){return this.request({commandTimeout:!1,executor:(r,o)=>{this._socket.emit("sendToHost",e,"upgradeController",{version:t,adminInstance:i},n=>{const a=n;a.error?o(a.error):r(a.result)})}})}updateLicenses(e,t){return this.request({commandTimeout:!1,executor:(i,r)=>{this._socket.emit("updateLicenses",e,t,(o,n)=>{o?r(o):i(n)})}})}upgradeOsPackages(e,t,i){return this.request({commandTimeout:!1,executor:r=>{this._socket.emit("sendToHost",e,"upgradeOsPackages",{packages:t,restart:!!i},o=>{r(o)})}})}getLogsFiles(e){return this.request({commandTimeout:!1,executor:(t,i)=>{this._socket.emit("readLogs",e,(r,o)=>{r&&i(r),t(o)})}})}delLogs(e){return this.request({commandTimeout:!1,executor:(t,i)=>{this._socket.emit("sendToHost",e,"delLogs",null,r=>{r&&i(r),t()})}})}deleteFile(e,t){return this.request({commandTimeout:!1,executor:(i,r)=>{this._socket.emit("deleteFile",e,t,o=>{o&&r(o),i()})}})}deleteFolder(e,t){return this.request({commandTimeout:!1,executor:(i,r)=>{this._socket.emit("deleteFolder",e,t,o=>{o&&r(o),i()})}})}rename(e,t,i){return this.request({commandTimeout:!1,executor:(r,o)=>{this._socket.emit("rename",e,t,i,n=>{n&&o(n),r()})}})}renameFile(e,t,i){return this.request({commandTimeout:!1,executor:(r,o)=>{this._socket.emit("renameFile",e,t,i,n=>{n&&o(n),r()})}})}getHosts(e){return this.request({cacheKey:"hosts",forceUpdate:e,commandTimeout:!1,executor:(t,i)=>{this._socket.emit("getObjectView","system","host",{startkey:"system.host.",endkey:"system.host.香"},(r,o)=>{r?i(r):t(Ln(o))})}})}getUsers(e){return this.request({cacheKey:"users",forceUpdate:e,commandTimeout:!1,executor:(t,i)=>{this._socket.emit("getObjectView","system","user",{startkey:"system.user.",endkey:"system.user.香"},(r,o)=>{r?i(r):t(Ln(o))})}})}renameGroup(e,t,i){return this.request({commandTimeout:!1,executor:async r=>{const o=await this.getGroups(!0),n=o.filter(c=>c._id.startsWith(`${e}.`));for(const c of n){const l=c._id,N=t+c._id.substring(e.length);c._id=N,await this.setObject(N,c),await this.delObject(l)}const a=o.find(c=>c._id===e);if(a){const c=a._id;a._id=t,i!==void 0&&(a.common??={},a.common.name=i),await this.setObject(t,a),await this.delObject(c)}r()}})}getHostInfo(e,t,i){return e=Tt(e),this.request({cacheKey:`hostInfo_${e}`,forceUpdate:t,commandTimeout:i,executor:(r,o,n)=>{this._socket.emit("sendToHost",e,"getHostInfo",null,a=>{n.elapsed||(n.clearTimeout(),a===Ie.PERMISSION_ERROR?o('May not read "getHostInfo"'):a?r(a):o('Cannot read "getHostInfo"'))})}})}getHostInfoShort(e,t,i){return e=Tt(e),this.request({cacheKey:`hostInfoShort_${e}`,forceUpdate:t,commandTimeout:i,executor:(r,o,n)=>{this._socket.emit("sendToHost",e,"getHostInfoShort",null,a=>{n.elapsed||(n.clearTimeout(),a===Ie.PERMISSION_ERROR?o('May not read "getHostInfoShort"'):a?r(a):o('Cannot read "getHostInfoShort"'))})}})}getRepository(e,t,i,r){return this.request({cacheKey:`repository_${e}`,forceUpdate:i,commandTimeout:r,executor:(o,n,a)=>{this._socket.emit("sendToHost",e,"getRepository",t,c=>{a.elapsed||(a.clearTimeout(),c===Ie.PERMISSION_ERROR?n('May not read "getRepository"'):c?o(c):n('Cannot read "getRepository"'))})}})}getInstalled(e,t,i){return e=Tt(e),this.request({cacheKey:`installed_${e}`,forceUpdate:t,commandTimeout:i,executor:(r,o,n)=>{this._socket.emit("sendToHost",e,"getInstalled",null,a=>{n.elapsed||(n.clearTimeout(),a===Ie.PERMISSION_ERROR?o('May not read "getInstalled"'):a?r(a):o('Cannot read "getInstalled"'))})}})}cmdExec(e,t,i,r){return this.request({commandTimeout:r,executor:(o,n,a)=>{e=Tt(e),this._socket.emit("cmdExec",e,i,t,c=>{a.elapsed||(a.clearTimeout(),c&&n(c),o())})}})}readBaseSettings(e){return e=ui(e),this.request({requireFeatures:["CONTROLLER_READWRITE_BASE_SETTINGS"],executor:(t,i,r)=>{this._socket.emit("sendToHost",e,"readBaseSettings",null,o=>{r.elapsed||(r.clearTimeout(),o===Ie.PERMISSION_ERROR?i('May not read "BaseSettings"'):o?o.error?i(new Error(o.error)):t(o):i('Cannot read "BaseSettings"'))})}})}writeBaseSettings(e,t){return e=ui(e),this.request({requireFeatures:["CONTROLLER_READWRITE_BASE_SETTINGS"],executor:(i,r,o)=>{this._socket.emit("sendToHost",e,"writeBaseSettings",t,n=>{o.elapsed||(o.clearTimeout(),n===Ie.PERMISSION_ERROR?r('May not write "BaseSettings"'):n?i(n):r('Cannot write "BaseSettings"'))})}})}restartController(e){return e=ui(e),this.request({executor:(t,i,r)=>{this._socket.emit("sendToHost",e,"restartController",null,()=>{r.elapsed||(r.clearTimeout(),t(!0))})}})}getDiagData(e,t){return e=ui(e),this.request({executor:(i,r,o)=>{this._socket.emit("sendToHost",e,"getDiagData",t,n=>{o.elapsed||(o.clearTimeout(),i(n||null))})}})}changePassword(e,t){return this.request({executor:(i,r,o)=>{this._socket.emit("changePassword",e,t,n=>{o.elapsed||(o.clearTimeout(),n&&r(n),i())})}})}getIpAddresses(e,t){return e=Tt(e),this.request({cacheKey:`IPs_${e}`,forceUpdate:t,commandTimeout:!1,executor:async i=>{const r=await this.getObject(e);i((r==null?void 0:r.common.address)??[])}})}getHostByIp(e,t){return e=ui(e),this.request({cacheKey:`rIPs_${e}`,forceUpdate:t,executor:(i,r,o)=>{this._socket.emit("getHostByIp",e,(n,a)=>{if(o.elapsed)return;o.clearTimeout();const{IPs4:c,IPs6:l}=Wg(a);i([...c,...l])})}})}encrypt(e){return this.request({executor:(t,i,r)=>{this._socket.emit("encrypt",e,(o,n)=>{r.elapsed||(r.clearTimeout(),o&&i(o),t(n))})}})}decrypt(e){return this.request({executor:(t,i,r)=>{this._socket.emit("decrypt",e,(o,n)=>{r.elapsed||(r.clearTimeout(),o&&i(o),t(n))})}})}chmodFile(e,t,i){return this.request({executor:(r,o,n)=>{this._socket.emit("chmodFile",e,t,i,(a,c)=>{n.elapsed||(n.clearTimeout(),a&&o(a),r(c))})}})}chownFile(e,t,i){return this.request({executor:(r,o,n)=>{this._socket.emit("chownFile",e,t,i,(a,c)=>{n.elapsed||(n.clearTimeout(),a&&o(a),r(c))})}})}getNotifications(e,t){return this.request({executor:(i,r,o)=>{this._socket.emit("sendToHost",e,"getNotifications",{category:t},n=>{o.elapsed||(o.clearTimeout(),i(n))})}})}clearNotifications(e,t){return this.request({executor:(i,r,o)=>{this._socket.emit("sendToHost",e,"clearNotifications",{category:t},n=>{o.elapsed||(o.clearTimeout(),i(n))})}})}getIsEasyModeStrict(){return this.request({executor:(e,t,i)=>{this._socket.emit("getIsEasyModeStrict",(r,o)=>{i.elapsed||(i.clearTimeout(),r&&t(r),e(!!o))})}})}getEasyMode(){return this.request({executor:(e,t,i)=>{this._socket.emit("getEasyMode",(r,o)=>{i.elapsed||(i.clearTimeout(),r?t(new Error(r)):e(o))})}})}getRatings(e){return this.request({executor:(t,i,r)=>{this._socket.emit("getRatings",!!e,(o,n)=>{r.elapsed||(r.clearTimeout(),o?i(new Error(o)):t(n))})}})}getCurrentSession(e){const t=new AbortController;return this.request({commandTimeout:e||5e3,onTimeout:()=>{t.abort()},executor:async(i,r,o)=>{try{const n=await fetch("./session",{signal:t.signal});if(o.elapsed)return;o.clearTimeout();const a=await n.json();i(a)}catch(n){r(`getCurrentSession: ${n}`)}}})}getCurrentInstance(){return this.request({cacheKey:"currentInstance",executor:(e,t,i)=>{this._socket.emit("getCurrentInstance",(r,o)=>{i.elapsed||(i.clearTimeout(),r?t(r):e(o))})}})}getAdapterInstances(e,t){let i;return typeof e=="boolean"?(t=e,i=""):i=e||"",this.request({cacheKey:`instances_${i}`,forceUpdate:t,executor:(r,o,n)=>{this._socket.emit("getAdapterInstances",i,(a,c)=>{n.elapsed||(n.clearTimeout(),a&&o(a),r(c))})}})}getAdapters(e,t){let i;return typeof e=="boolean"?(t=e,i=""):i=e||"",this.request({cacheKey:`adapter_${i}`,forceUpdate:t,executor:(r,o,n)=>{this._socket.emit("getAdapters",i,(a,c)=>{n.elapsed||(n.clearTimeout(),a&&o(a),r(c))})}})}getCompactAdapters(e){return this.request({cacheKey:"compactAdapters",forceUpdate:e,executor:(t,i,r)=>{this._socket.emit("getCompactAdapters",(o,n)=>{r.elapsed||(r.clearTimeout(),o&&i(o),t(n))})}})}getAdaptersResetCache(e){e=e??"",this.resetCache(`adapter_${e}`),this.resetCache("compactAdapters")}getCompactInstances(e){return this.request({cacheKey:"compactInstances",forceUpdate:e,executor:(t,i,r)=>{this._socket.emit("getCompactInstances",(o,n)=>{r.elapsed||(r.clearTimeout(),o&&i(o),t(n))})}})}getAdapterInstancesResetCache(e){e=e??"",this.resetCache(`instances_${e}`),this.resetCache("compactInstances")}getCompactInstalled(e,t,i){return e=Tt(e),this.request({cacheKey:`installedCompact_${e}`,forceUpdate:t,commandTimeout:i,executor:(r,o,n)=>{this._socket.emit("getCompactInstalled",e,a=>{n.elapsed||(n.clearTimeout(),a===Ie.PERMISSION_ERROR?o('May not read "getCompactInstalled"'):a?r(a):o('Cannot read "getCompactInstalled"'))})}})}getInstalledResetCache(e){e?(this.resetCache(`installedCompact_${e}`),this.resetCache(`installed_${e}`)):(this.resetCache("installedCompact_",!0),this.resetCache("installed_",!0))}getCompactRepository(e,t,i){return e=Tt(e),this.request({cacheKey:`repositoryCompact_${e}`,forceUpdate:t,commandTimeout:i,executor:(r,o,n)=>{this._socket.emit("getCompactRepository",e,a=>{n.elapsed||(n.clearTimeout(),a===Ie.PERMISSION_ERROR?o('May not read "getCompactRepository"'):a?r(a):o('Cannot read "getCompactRepository"'))})}})}getRepositoryResetCache(e){e?(this.resetCache(`repositoryCompact_${e}`),this.resetCache(`repository_${e}`)):(this.resetCache("repositoryCompact_",!0),this.resetCache("repository_",!0))}getCompactHosts(e){return this.request({cacheKey:"hostsCompact",forceUpdate:e,executor:(t,i,r)=>{this._socket.emit("getCompactHosts",(o,n)=>{r.elapsed||(r.clearTimeout(),o&&i(o),t(n))})}})}getCompactSystemRepositories(e){return this.request({cacheKey:"repositoriesCompact",forceUpdate:e,executor:(t,i,r)=>{this._socket.emit("getCompactSystemRepositories",(o,n)=>{r.elapsed||(r.clearTimeout(),o&&i(o),t(n))})}})}}const X=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,ie=globalThis,Xt="9.33.0";function qr(){return eo(ie),ie}function eo(s){const e=s.__SENTRY__=s.__SENTRY__||{};return e.version=e.version||Xt,e[Xt]=e[Xt]||{}}function to(s,e,t=ie){const i=t.__SENTRY__=t.__SENTRY__||{},r=i[Xt]=i[Xt]||{};return r[s]||(r[s]=e())}const Bg="Sentry Logger ",gn=["debug","info","warn","error","log","assert","trace"],Yr={};function Vs(s){if(!("console"in ie))return s();const e=ie.console,t={},i=Object.keys(Yr);i.forEach(r=>{const o=Yr[r];t[r]=e[r],e[r]=o});try{return s()}finally{i.forEach(r=>{e[r]=t[r]})}}function Jg(){let s=!1;const e={enable:()=>{s=!0},disable:()=>{s=!1},isEnabled:()=>s};return X?gn.forEach(t=>{e[t]=(...i)=>{s&&Vs(()=>{ie.console[t](`${Bg}[${t}]:`,...i)})}}):gn.forEach(t=>{e[t]=()=>{}}),e}const R=to("logger",Jg),hN=50,Kt="?",HM=/\(error: (.*)\)/,VM=/captureMessage|captureException/;function zN(...s){const e=s.sort((t,i)=>t[0]-i[0]).map(t=>t[1]);return(t,i=0,r=0)=>{const o=[],n=t.split(`
2
+ `);for(let a=i;a<n.length;a++){const c=n[a];if(c.length>1024)continue;const l=HM.test(c)?c.replace(HM,"$1"):c;if(!l.match(/\S*Error: /)){for(const N of e){const u=N(l);if(u){o.push(u);break}}if(o.length>=hN+r)break}}return Fg(o.slice(r))}}function Rg(s){return Array.isArray(s)?zN(...s):s}function Fg(s){if(!s.length)return[];const e=Array.from(s);return/sentryWrapped/.test(nr(e).function||"")&&e.pop(),e.reverse(),VM.test(nr(e).function||"")&&(e.pop(),VM.test(nr(e).function||"")&&e.pop()),e.slice(0,hN).map(t=>({...t,filename:t.filename||nr(e).filename,function:t.function||Kt}))}function nr(s){return s[s.length-1]||{}}const Eo="<anonymous>";function bt(s){try{return!s||typeof s!="function"?Eo:s.name||Eo}catch{return Eo}}function ZM(s){const e=s.exception;if(e){const t=[];try{return e.values.forEach(i=>{i.stacktrace.frames&&t.push(...i.stacktrace.frames)}),t}catch{return}}}const Ar={},XM={};function rs(s,e){Ar[s]=Ar[s]||[],Ar[s].push(e)}function os(s,e){if(!XM[s]){XM[s]=!0;try{e()}catch(t){X&&R.error(`Error while instrumenting ${s}`,t)}}}function Ke(s,e){const t=s&&Ar[s];if(t)for(const i of t)try{i(e)}catch(r){X&&R.error(`Error while triggering instrumentation handler.
3
3
  Type: ${s}
4
- Name: ${Qt(i)}
5
- Error:`,r)}}let fo=null;function $j(s){const e="error";rs(e,s),os(e,Pj)}function Pj(){fo=ie.onerror,ie.onerror=function(s,e,t,i,r){return Ke("error",{column:i,error:r,line:t,msg:s,url:e}),fo?fo.apply(this,arguments):!1},ie.onerror.__SENTRY_INSTRUMENTED__=!0}let xo=null;function Wj(s){const e="unhandledrejection";rs(e,s),os(e,Bj)}function Bj(){xo=ie.onunhandledrejection,ie.onunhandledrejection=function(s){return Ke("unhandledrejection",s),xo?xo.apply(this,arguments):!0},ie.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}function Jj(s){var t;if(typeof __SENTRY_TRACING__=="boolean"&&!__SENTRY_TRACING__)return!1;const e=s||((t=Ee())==null?void 0:t.getOptions());return!!e&&(e.tracesSampleRate!=null||!!e.tracesSampler)}const Ia="production",Rj=/^o(\d+)\./,Fj=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function Gj(s){return s==="http"||s==="https"}function oo(s,e=!1){const{host:t,path:i,pass:r,port:o,projectId:n,protocol:a,publicKey:c}=s;return`${a}://${c}${e&&r?`:${r}`:""}@${t}${o?`:${o}`:""}/${i&&`${i}/`}${n}`}function Hj(s){const e=Fj.exec(s);if(!e){Zs(()=>{console.error(`Invalid Sentry Dsn: ${s}`)});return}const[t,i,r="",o="",n="",a=""]=e.slice(1);let c="",l=a;const N=l.split("/");if(N.length>1&&(c=N.slice(0,-1).join("/"),l=N.pop()),l){const u=l.match(/^\d+/);u&&(l=u[0])}return vN({host:o,pass:r,path:c,projectId:l,port:n,protocol:t,publicKey:i})}function vN(s){return{protocol:s.protocol,publicKey:s.publicKey||"",pass:s.pass||"",host:s.host,port:s.port||"",path:s.path||"",projectId:s.projectId}}function Vj(s){if(!X)return!0;const{port:e,projectId:t,protocol:i}=s;return["protocol","publicKey","host","projectId"].find(n=>s[n]?!1:(R.error(`Invalid Sentry Dsn: ${n} missing`),!0))?!1:t.match(/^\d+$/)?Gj(i)?e&&isNaN(parseInt(e,10))?(R.error(`Invalid Sentry Dsn: Invalid port ${e}`),!1):!0:(R.error(`Invalid Sentry Dsn: Invalid protocol ${i}`),!1):(R.error(`Invalid Sentry Dsn: Invalid projectId ${t}`),!1)}function Zj(s){const e=s.match(Rj);return e==null?void 0:e[1]}function Xj(s){const e=typeof s=="string"?Hj(s):vN(s);if(!(!e||!Vj(e)))return e}const Kj="_frozenDsc";function bN(s,e){const t=e.getOptions(),{publicKey:i,host:r}=e.getDsn()||{};let o;t.orgId?o=String(t.orgId):r&&(o=Zj(r));const n={environment:t.environment||Ia,release:t.release,public_key:i,trace_id:s,org_id:o};return e.emit("createDsc",n),n}function qj(s,e){const t=e.getPropagationContext();return t.dsc||bN(t.traceId,s)}function ey(s){var y;const e=Ee();if(!e)return{};const t=SN(s),i=Ca(t),r=i.data,o=t.spanContext().traceState,n=(o==null?void 0:o.get("sentry.sample_rate"))??r[dj]??r[Dj];function a(T){return(typeof n=="number"||typeof n=="string")&&(T.sample_rate=`${n}`),T}const c=t[Kj];if(c)return a(c);const l=o==null?void 0:o.get("sentry.dsc"),N=l&&Ej(l);if(N)return a(N);const u=bN(s.spanContext().traceId,e),L=r[Tj],g=i.description;return L!=="url"&&g&&(u.transaction=g),Jj()&&(u.sampled=String(Yj(t)),u.sample_rand=(o==null?void 0:o.get("sentry.sample_rand"))??((y=xN(t).scope)==null?void 0:y.getPropagationContext().sampleRand.toString())),a(u),e.emit("createDsc",u,t),u}function dt(s,e=100,t=1/0){try{return Tn("",s,e,t)}catch(i){return{ERROR:`**non-serializable** (${i})`}}}function QN(s,e=3,t=100*1024){const i=dt(s,e);return ry(i)>t?QN(s,e-1,t):i}function Tn(s,e,t=1/0,i=1/0,r=oy()){const[o,n]=r;if(e==null||["boolean","string"].includes(typeof e)||typeof e=="number"&&Number.isFinite(e))return e;const a=ty(s,e);if(!a.startsWith("[object "))return a;if(e.__sentry_skip_normalization__)return e;const c=typeof e.__sentry_override_normalization_depth__=="number"?e.__sentry_override_normalization_depth__:t;if(c===0)return a.replace("object ","");if(o(e))return"[Circular ~]";const l=e;if(l&&typeof l.toJSON=="function")try{const g=l.toJSON();return Tn("",g,c-1,i,r)}catch{}const N=Array.isArray(e)?[]:{};let u=0;const L=pN(e);for(const g in L){if(!Object.prototype.hasOwnProperty.call(L,g))continue;if(u>=i){N[g]="[MaxProperties ~]";break}const y=L[g];N[g]=Tn(g,y,c-1,i,r),u++}return n(e),N}function ty(s,e){try{if(s==="domain"&&e&&typeof e=="object"&&e._events)return"[Domain]";if(s==="domainEmitter")return"[DomainEmitter]";if(typeof global<"u"&&e===global)return"[Global]";if(typeof window<"u"&&e===window)return"[Window]";if(typeof document<"u"&&e===document)return"[Document]";if(wN(e))return"[VueViewModel]";if(Fg(e))return"[SyntheticEvent]";if(typeof e=="number"&&!Number.isFinite(e))return`[${e}]`;if(typeof e=="function")return`[Function: ${Qt(e)}]`;if(typeof e=="symbol")return`[${String(e)}]`;if(typeof e=="bigint")return`[BigInt: ${String(e)}]`;const t=sy(e);return/^HTML(\w*)Element$/.test(t)?`[HTMLElement: ${t}]`:`[object ${t}]`}catch(t){return`**non-serializable** (${t})`}}function sy(s){const e=Object.getPrototypeOf(s);return e!=null&&e.constructor?e.constructor.name:"null prototype"}function iy(s){return~-encodeURI(s).split(/%..|./).length}function ry(s){return iy(JSON.stringify(s))}function oy(){const s=new WeakSet;function e(i){return s.has(i)?!0:(s.add(i),!1)}function t(i){s.delete(i)}return[e,t]}function Ri(s,e=[]){return[s,e]}function ny(s,e){const[t,i]=s;return[t,[...i,e]]}function Nc(s,e){const t=s[1];for(const i of t){const r=i[0].type;if(e(i,r))return!0}return!1}function dn(s){const e=eo(ie);return e.encodePolyfill?e.encodePolyfill(s):new TextEncoder().encode(s)}function ay(s){const[e,t]=s;let i=JSON.stringify(e);function r(o){typeof i=="string"?i=typeof o=="string"?i+o:[dn(i),o]:i.push(typeof o=="string"?dn(o):o)}for(const o of t){const[n,a]=o;if(r(`
4
+ Name: ${bt(i)}
5
+ Error:`,r)}}let fo=null;function Gg(s){const e="error";rs(e,s),os(e,Hg)}function Hg(){fo=ie.onerror,ie.onerror=function(s,e,t,i,r){return Ke("error",{column:i,error:r,line:t,msg:s,url:e}),fo?fo.apply(this,arguments):!1},ie.onerror.__SENTRY_INSTRUMENTED__=!0}let xo=null;function Vg(s){const e="unhandledrejection";rs(e,s),os(e,Zg)}function Zg(){xo=ie.onunhandledrejection,ie.onunhandledrejection=function(s){return Ke("unhandledrejection",s),xo?xo.apply(this,arguments):!0},ie.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}const wN=Object.prototype.toString;function ya(s){switch(wN.call(s)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return Qt(s,Error)}}function Zs(s,e){return wN.call(s)===`[object ${e}]`}function CN(s){return Zs(s,"ErrorEvent")}function KM(s){return Zs(s,"DOMError")}function Xg(s){return Zs(s,"DOMException")}function ht(s){return Zs(s,"String")}function Ta(s){return typeof s=="object"&&s!==null&&"__sentry_template_string__"in s&&"__sentry_template_values__"in s}function da(s){return s===null||Ta(s)||typeof s!="object"&&typeof s!="function"}function _i(s){return Zs(s,"Object")}function so(s){return typeof Event<"u"&&Qt(s,Event)}function Kg(s){return typeof Element<"u"&&Qt(s,Element)}function qg(s){return Zs(s,"RegExp")}function io(s){return!!(s!=null&&s.then&&typeof s.then=="function")}function ej(s){return _i(s)&&"nativeEvent"in s&&"preventDefault"in s&&"stopPropagation"in s}function Qt(s,e){try{return s instanceof e}catch{return!1}}function IN(s){return!!(typeof s=="object"&&s!==null&&(s.__isVue||s._isVue))}function tj(s){return typeof Request<"u"&&Qt(s,Request)}const Da=ie,sj=80;function pN(s,e={}){if(!s)return"<unknown>";try{let t=s;const i=5,r=[];let o=0,n=0;const a=" > ",c=a.length;let l;const N=Array.isArray(e)?e:e.keyAttrs,u=!Array.isArray(e)&&e.maxStringLength||sj;for(;t&&o++<i&&(l=ij(t,N),!(l==="html"||o>1&&n+r.length*c+l.length>=u));)r.push(l),n+=l.length,t=t.parentNode;return r.reverse().join(a)}catch{return"<unknown>"}}function ij(s,e){const t=s,i=[];if(!(t!=null&&t.tagName))return"";if(Da.HTMLElement&&t instanceof HTMLElement&&t.dataset){if(t.dataset.sentryComponent)return t.dataset.sentryComponent;if(t.dataset.sentryElement)return t.dataset.sentryElement}i.push(t.tagName.toLowerCase());const r=e!=null&&e.length?e.filter(n=>t.getAttribute(n)).map(n=>[n,t.getAttribute(n)]):null;if(r!=null&&r.length)r.forEach(n=>{i.push(`[${n[0]}="${n[1]}"]`)});else{t.id&&i.push(`#${t.id}`);const n=t.className;if(n&&ht(n)){const a=n.split(/\s+/);for(const c of a)i.push(`.${c}`)}}const o=["aria-label","type","name","title","alt"];for(const n of o){const a=t.getAttribute(n);a&&i.push(`[${n}="${a}"]`)}return i.join("")}function ha(){try{return Da.document.location.href}catch{return""}}function rj(s){if(!Da.HTMLElement)return null;let e=s;const t=5;for(let i=0;i<t;i++){if(!e)return null;if(e instanceof HTMLElement){if(e.dataset.sentryComponent)return e.dataset.sentryComponent;if(e.dataset.sentryElement)return e.dataset.sentryElement}e=e.parentNode}return null}function vr(s,e=0){return typeof s!="string"||e===0||s.length<=e?s:`${s.slice(0,e)}...`}function qM(s,e){if(!Array.isArray(s))return"";const t=[];for(let i=0;i<s.length;i++){const r=s[i];try{IN(r)?t.push("[VueViewModel]"):t.push(String(r))}catch{t.push("[value cannot be serialized]")}}return t.join(e)}function oj(s,e,t=!1){return ht(s)?qg(e)?e.test(s):ht(e)?t?s===e:s.includes(e):!1:!1}function ro(s,e=[],t=!1){return e.some(i=>oj(s,i,t))}function Ue(s,e,t){if(!(e in s))return;const i=s[e];if(typeof i!="function")return;const r=t(i);typeof r=="function"&&AN(r,i);try{s[e]=r}catch{X&&R.log(`Failed to replace method "${e}" in object`,s)}}function qt(s,e,t){try{Object.defineProperty(s,e,{value:t,writable:!0,configurable:!0})}catch{X&&R.log(`Failed to add non-enumerable property "${e}" to object`,s)}}function AN(s,e){try{const t=e.prototype||{};s.prototype=e.prototype=t,qt(s,"__sentry_original__",e)}catch{}}function za(s){return s.__sentry_original__}function mN(s){if(ya(s))return{message:s.message,name:s.name,stack:s.stack,...tc(s)};if(so(s)){const e={type:s.type,target:ec(s.target),currentTarget:ec(s.currentTarget),...tc(s)};return typeof CustomEvent<"u"&&Qt(s,CustomEvent)&&(e.detail=s.detail),e}else return s}function ec(s){try{return Kg(s)?pN(s):Object.prototype.toString.call(s)}catch{return"<unknown>"}}function tc(s){if(typeof s=="object"&&s!==null){const e={};for(const t in s)Object.prototype.hasOwnProperty.call(s,t)&&(e[t]=s[t]);return e}else return{}}function nj(s,e=40){const t=Object.keys(mN(s));t.sort();const i=t[0];if(!i)return"[object has no keys]";if(i.length>=e)return vr(i,e);for(let r=t.length;r>0;r--){const o=t.slice(0,r).join(", ");if(!(o.length>e))return r===t.length?o:vr(o,e)}return""}function aj(){const s=ie;return s.crypto||s.msCrypto}function Je(s=aj()){let e=()=>Math.random()*16;try{if(s!=null&&s.randomUUID)return s.randomUUID().replace(/-/g,"");s!=null&&s.getRandomValues&&(e=()=>{const t=new Uint8Array(1);return s.getRandomValues(t),t[0]})}catch{}return("10000000100040008000"+1e11).replace(/[018]/g,t=>(t^(e()&15)>>t/4).toString(16))}function ON(s){var e,t;return(t=(e=s.exception)==null?void 0:e.values)==null?void 0:t[0]}function Vt(s){const{message:e,event_id:t}=s;if(e)return e;const i=ON(s);return i?i.type&&i.value?`${i.type}: ${i.value}`:i.type||i.value||t||"<unknown>":t||"<unknown>"}function jn(s,e,t){const i=s.exception=s.exception||{},r=i.values=i.values||[],o=r[0]=r[0]||{};o.value||(o.value=e||""),o.type||(o.type="Error")}function Rs(s,e){const t=ON(s);if(!t)return;const i={type:"generic",handled:!0},r=t.mechanism;if(t.mechanism={...i,...r,...e},e&&"data"in e){const o={...r==null?void 0:r.data,...e.data};t.mechanism.data=o}}function sc(s){if(Mj(s))return!0;try{qt(s,"__sentry_captured__",!0)}catch{}return!1}function Mj(s){try{return s.__sentry_captured__}catch{}}const EN=1e3;function Wi(){return Date.now()/EN}function cj(){const{performance:s}=ie;if(!(s!=null&&s.now))return Wi;const e=Date.now()-s.now(),t=s.timeOrigin==null?e:s.timeOrigin;return()=>(t+s.now())/EN}const zt=cj();function uj(s){const e=zt(),t={sid:Je(),init:!0,timestamp:e,started:e,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>Nj(t)};return s&&Fs(t,s),t}function Fs(s,e={}){if(e.user&&(!s.ipAddress&&e.user.ip_address&&(s.ipAddress=e.user.ip_address),!s.did&&!e.did&&(s.did=e.user.id||e.user.email||e.user.username)),s.timestamp=e.timestamp||zt(),e.abnormal_mechanism&&(s.abnormal_mechanism=e.abnormal_mechanism),e.ignoreDuration&&(s.ignoreDuration=e.ignoreDuration),e.sid&&(s.sid=e.sid.length===32?e.sid:Je()),e.init!==void 0&&(s.init=e.init),!s.did&&e.did&&(s.did=`${e.did}`),typeof e.started=="number"&&(s.started=e.started),s.ignoreDuration)s.duration=void 0;else if(typeof e.duration=="number")s.duration=e.duration;else{const t=s.timestamp-s.started;s.duration=t>=0?t:0}e.release&&(s.release=e.release),e.environment&&(s.environment=e.environment),!s.ipAddress&&e.ipAddress&&(s.ipAddress=e.ipAddress),!s.userAgent&&e.userAgent&&(s.userAgent=e.userAgent),typeof e.errors=="number"&&(s.errors=e.errors),e.status&&(s.status=e.status)}function lj(s,e){let t={};s.status==="ok"&&(t={status:"exited"}),Fs(s,t)}function Nj(s){return{sid:`${s.sid}`,init:s.init,started:new Date(s.started*1e3).toISOString(),timestamp:new Date(s.timestamp*1e3).toISOString(),status:s.status,errors:s.errors,did:typeof s.did=="number"||typeof s.did=="string"?`${s.did}`:void 0,duration:s.duration,abnormal_mechanism:s.abnormal_mechanism,attrs:{release:s.release,environment:s.environment,ip_address:s.ipAddress,user_agent:s.userAgent}}}function Bi(s,e,t=2){if(!e||typeof e!="object"||t<=0)return e;if(s&&Object.keys(e).length===0)return s;const i={...s};for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(i[r]=Bi(i[r],e[r],t-1));return i}function ic(){return Je()}function fN(){return Je().substring(16)}const yn="_sentrySpan";function rc(s,e){e?qt(s,yn,e):delete s[yn]}function oc(s){return s[yn]}const Lj=100;class wt{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext={traceId:ic(),sampleRand:Math.random()}}clone(){const e=new wt;return e._breadcrumbs=[...this._breadcrumbs],e._tags={...this._tags},e._extra={...this._extra},e._contexts={...this._contexts},this._contexts.flags&&(e._contexts.flags={values:[...this._contexts.flags.values]}),e._user=this._user,e._level=this._level,e._session=this._session,e._transactionName=this._transactionName,e._fingerprint=this._fingerprint,e._eventProcessors=[...this._eventProcessors],e._attachments=[...this._attachments],e._sdkProcessingMetadata={...this._sdkProcessingMetadata},e._propagationContext={...this._propagationContext},e._client=this._client,e._lastEventId=this._lastEventId,rc(e,oc(this)),e}setClient(e){this._client=e}setLastEventId(e){this._lastEventId=e}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(e){this._scopeListeners.push(e)}addEventProcessor(e){return this._eventProcessors.push(e),this}setUser(e){return this._user=e||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&Fs(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}setTags(e){return this._tags={...this._tags,...e},this._notifyScopeListeners(),this}setTag(e,t){return this._tags={...this._tags,[e]:t},this._notifyScopeListeners(),this}setExtras(e){return this._extra={...this._extra,...e},this._notifyScopeListeners(),this}setExtra(e,t){return this._extra={...this._extra,[e]:t},this._notifyScopeListeners(),this}setFingerprint(e){return this._fingerprint=e,this._notifyScopeListeners(),this}setLevel(e){return this._level=e,this._notifyScopeListeners(),this}setTransactionName(e){return this._transactionName=e,this._notifyScopeListeners(),this}setContext(e,t){return t===null?delete this._contexts[e]:this._contexts[e]=t,this._notifyScopeListeners(),this}setSession(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(e){if(!e)return this;const t=typeof e=="function"?e(this):e,i=t instanceof wt?t.getScopeData():_i(t)?e:void 0,{tags:r,extra:o,user:n,contexts:a,level:c,fingerprint:l=[],propagationContext:N}=i||{};return this._tags={...this._tags,...r},this._extra={...this._extra,...o},this._contexts={...this._contexts,...a},n&&Object.keys(n).length&&(this._user=n),c&&(this._level=c),l.length&&(this._fingerprint=l),N&&(this._propagationContext=N),this}clear(){return this._breadcrumbs=[],this._tags={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._session=void 0,rc(this,void 0),this._attachments=[],this.setPropagationContext({traceId:ic(),sampleRand:Math.random()}),this._notifyScopeListeners(),this}addBreadcrumb(e,t){var o;const i=typeof t=="number"?t:Lj;if(i<=0)return this;const r={timestamp:Wi(),...e,message:e.message?vr(e.message,2048):e.message};return this._breadcrumbs.push(r),this._breadcrumbs.length>i&&(this._breadcrumbs=this._breadcrumbs.slice(-i),(o=this._client)==null||o.recordDroppedEvent("buffer_overflow","log_item")),this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(e){return this._attachments.push(e),this}clearAttachments(){return this._attachments=[],this}getScopeData(){return{breadcrumbs:this._breadcrumbs,attachments:this._attachments,contexts:this._contexts,tags:this._tags,extra:this._extra,user:this._user,level:this._level,fingerprint:this._fingerprint||[],eventProcessors:this._eventProcessors,propagationContext:this._propagationContext,sdkProcessingMetadata:this._sdkProcessingMetadata,transactionName:this._transactionName,span:oc(this)}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=Bi(this._sdkProcessingMetadata,e,2),this}setPropagationContext(e){return this._propagationContext=e,this}getPropagationContext(){return this._propagationContext}captureException(e,t){const i=(t==null?void 0:t.event_id)||Je();if(!this._client)return R.warn("No client configured on scope - will not capture exception!"),i;const r=new Error("Sentry syntheticException");return this._client.captureException(e,{originalException:e,syntheticException:r,...t,event_id:i},this),i}captureMessage(e,t,i){const r=(i==null?void 0:i.event_id)||Je();if(!this._client)return R.warn("No client configured on scope - will not capture message!"),r;const o=new Error(e);return this._client.captureMessage(e,t,{originalException:e,syntheticException:o,...i,event_id:r},this),r}captureEvent(e,t){const i=(t==null?void 0:t.event_id)||Je();return this._client?(this._client.captureEvent(e,{...t,event_id:i},this),i):(R.warn("No client configured on scope - will not capture event!"),i)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach(e=>{e(this)}),this._notifyingListeners=!1)}}function gj(){return to("defaultCurrentScope",()=>new wt)}function jj(){return to("defaultIsolationScope",()=>new wt)}class yj{constructor(e,t){let i;e?i=e:i=new wt;let r;t?r=t:r=new wt,this._stack=[{scope:i}],this._isolationScope=r}withScope(e){const t=this._pushScope();let i;try{i=e(t)}catch(r){throw this._popScope(),r}return io(i)?i.then(r=>(this._popScope(),r),r=>{throw this._popScope(),r}):(this._popScope(),i)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){const e=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:e}),e}_popScope(){return this._stack.length<=1?!1:!!this._stack.pop()}}function Gs(){const s=qr(),e=eo(s);return e.stack=e.stack||new yj(gj(),jj())}function Tj(s){return Gs().withScope(s)}function dj(s,e){const t=Gs();return t.withScope(()=>(t.getStackTop().scope=s,e(s)))}function nc(s){return Gs().withScope(()=>s(Gs().getIsolationScope()))}function Dj(){return{withIsolationScope:nc,withScope:Tj,withSetScope:dj,withSetIsolationScope:(s,e)=>nc(e),getCurrentScope:()=>Gs().getScope(),getIsolationScope:()=>Gs().getIsolationScope()}}function wa(s){const e=eo(s);return e.acs?e.acs:Dj()}function Ct(){const s=qr();return wa(s).getCurrentScope()}function Ji(){const s=qr();return wa(s).getIsolationScope()}function hj(){return to("globalScope",()=>new wt)}function zj(...s){const e=qr(),t=wa(e);if(s.length===2){const[i,r]=s;return i?t.withSetScope(i,r):t.withScope(r)}return t.withScope(s[0])}function Ee(){return Ct().getClient()}function wj(s){const e=s.getPropagationContext(),{traceId:t,parentSpanId:i,propagationSpanId:r}=e,o={trace_id:t,span_id:r||fN()};return i&&(o.parent_span_id=i),o}const Cj="sentry.source",Ij="sentry.sample_rate",pj="sentry.previous_trace_sample_rate",Aj="sentry.op",mj="sentry.origin",xN="sentry.profile_id",_N="sentry.exclusive_time",Oj=0,Ej=1,fj="_sentryScope",xj="_sentryIsolationScope";function SN(s){return{scope:s[fj],isolationScope:s[xj]}}const _j="sentry-",Sj=/^sentry-/;function kj(s){const e=Yj(s);if(!e)return;const t=Object.entries(e).reduce((i,[r,o])=>{if(r.match(Sj)){const n=r.slice(_j.length);i[n]=o}return i},{});if(Object.keys(t).length>0)return t}function Yj(s){if(!(!s||!ht(s)&&!Array.isArray(s)))return Array.isArray(s)?s.reduce((e,t)=>{const i=ac(t);return Object.entries(i).forEach(([r,o])=>{e[r]=o}),e},{}):ac(s)}function ac(s){return s.split(",").map(e=>e.split("=").map(t=>{try{return decodeURIComponent(t.trim())}catch{return}})).reduce((e,[t,i])=>(t&&i&&(e[t]=i),e),{})}function vj(s){if(typeof s=="boolean")return Number(s);const e=typeof s=="string"?parseFloat(s):s;if(!(typeof e!="number"||isNaN(e)||e<0||e>1))return e}const kN=1;let Mc=!1;function bj(s){const{spanId:e,traceId:t,isRemote:i}=s.spanContext(),r=i?e:Ca(s).parent_span_id,o=SN(s).scope,n=i?(o==null?void 0:o.getPropagationContext().propagationSpanId)||fN():e;return{parent_span_id:r,span_id:n,trace_id:t}}function Qj(s){if(s&&s.length>0)return s.map(({context:{spanId:e,traceId:t,traceFlags:i,...r},attributes:o})=>({span_id:e,trace_id:t,sampled:i===kN,attributes:o,...r}))}function cc(s){return typeof s=="number"?uc(s):Array.isArray(s)?s[0]+s[1]/1e9:s instanceof Date?uc(s.getTime()):zt()}function uc(s){return s>9999999999?s/1e3:s}function Ca(s){var i;if($j(s))return s.getSpanJSON();const{spanId:e,traceId:t}=s.spanContext();if(Uj(s)){const{attributes:r,startTime:o,name:n,endTime:a,status:c,links:l}=s,N="parentSpanId"in s?s.parentSpanId:"parentSpanContext"in s?(i=s.parentSpanContext)==null?void 0:i.spanId:void 0;return{span_id:e,trace_id:t,data:r,description:n,parent_span_id:N,start_timestamp:cc(o),timestamp:cc(a)||void 0,status:Wj(c),op:r[Aj],origin:r[mj],links:Qj(l)}}return{span_id:e,trace_id:t,start_timestamp:0,data:{}}}function Uj(s){const e=s;return!!e.attributes&&!!e.startTime&&!!e.name&&!!e.endTime&&!!e.status}function $j(s){return typeof s.getSpanJSON=="function"}function Pj(s){const{traceFlags:e}=s.spanContext();return e===kN}function Wj(s){if(!(!s||s.code===Oj))return s.code===Ej?"ok":s.message||"unknown_error"}const Bj="_sentryRootSpan";function YN(s){return s[Bj]||s}function lc(){Mc||(Vs(()=>{console.warn("[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly.")}),Mc=!0)}function Jj(s){var t;if(typeof __SENTRY_TRACING__=="boolean"&&!__SENTRY_TRACING__)return!1;const e=s||((t=Ee())==null?void 0:t.getOptions());return!!e&&(e.tracesSampleRate!=null||!!e.tracesSampler)}const Ia="production",Rj=/^o(\d+)\./,Fj=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function Gj(s){return s==="http"||s==="https"}function oo(s,e=!1){const{host:t,path:i,pass:r,port:o,projectId:n,protocol:a,publicKey:c}=s;return`${a}://${c}${e&&r?`:${r}`:""}@${t}${o?`:${o}`:""}/${i&&`${i}/`}${n}`}function Hj(s){const e=Fj.exec(s);if(!e){Vs(()=>{console.error(`Invalid Sentry Dsn: ${s}`)});return}const[t,i,r="",o="",n="",a=""]=e.slice(1);let c="",l=a;const N=l.split("/");if(N.length>1&&(c=N.slice(0,-1).join("/"),l=N.pop()),l){const u=l.match(/^\d+/);u&&(l=u[0])}return vN({host:o,pass:r,path:c,projectId:l,port:n,protocol:t,publicKey:i})}function vN(s){return{protocol:s.protocol,publicKey:s.publicKey||"",pass:s.pass||"",host:s.host,port:s.port||"",path:s.path||"",projectId:s.projectId}}function Vj(s){if(!X)return!0;const{port:e,projectId:t,protocol:i}=s;return["protocol","publicKey","host","projectId"].find(n=>s[n]?!1:(R.error(`Invalid Sentry Dsn: ${n} missing`),!0))?!1:t.match(/^\d+$/)?Gj(i)?e&&isNaN(parseInt(e,10))?(R.error(`Invalid Sentry Dsn: Invalid port ${e}`),!1):!0:(R.error(`Invalid Sentry Dsn: Invalid protocol ${i}`),!1):(R.error(`Invalid Sentry Dsn: Invalid projectId ${t}`),!1)}function Zj(s){const e=s.match(Rj);return e==null?void 0:e[1]}function Xj(s){const e=typeof s=="string"?Hj(s):vN(s);if(!(!e||!Vj(e)))return e}const Kj="_frozenDsc";function bN(s,e){const t=e.getOptions(),{publicKey:i,host:r}=e.getDsn()||{};let o;t.orgId?o=String(t.orgId):r&&(o=Zj(r));const n={environment:t.environment||Ia,release:t.release,public_key:i,trace_id:s,org_id:o};return e.emit("createDsc",n),n}function qj(s,e){const t=e.getPropagationContext();return t.dsc||bN(t.traceId,s)}function ey(s){var y;const e=Ee();if(!e)return{};const t=YN(s),i=Ca(t),r=i.data,o=t.spanContext().traceState,n=(o==null?void 0:o.get("sentry.sample_rate"))??r[Ij]??r[pj];function a(T){return(typeof n=="number"||typeof n=="string")&&(T.sample_rate=`${n}`),T}const c=t[Kj];if(c)return a(c);const l=o==null?void 0:o.get("sentry.dsc"),N=l&&kj(l);if(N)return a(N);const u=bN(s.spanContext().traceId,e),L=r[Cj],g=i.description;return L!=="url"&&g&&(u.transaction=g),Jj()&&(u.sampled=String(Pj(t)),u.sample_rand=(o==null?void 0:o.get("sentry.sample_rand"))??((y=SN(t).scope)==null?void 0:y.getPropagationContext().sampleRand.toString())),a(u),e.emit("createDsc",u,t),u}function dt(s,e=100,t=1/0){try{return Tn("",s,e,t)}catch(i){return{ERROR:`**non-serializable** (${i})`}}}function QN(s,e=3,t=100*1024){const i=dt(s,e);return ry(i)>t?QN(s,e-1,t):i}function Tn(s,e,t=1/0,i=1/0,r=oy()){const[o,n]=r;if(e==null||["boolean","string"].includes(typeof e)||typeof e=="number"&&Number.isFinite(e))return e;const a=ty(s,e);if(!a.startsWith("[object "))return a;if(e.__sentry_skip_normalization__)return e;const c=typeof e.__sentry_override_normalization_depth__=="number"?e.__sentry_override_normalization_depth__:t;if(c===0)return a.replace("object ","");if(o(e))return"[Circular ~]";const l=e;if(l&&typeof l.toJSON=="function")try{const g=l.toJSON();return Tn("",g,c-1,i,r)}catch{}const N=Array.isArray(e)?[]:{};let u=0;const L=mN(e);for(const g in L){if(!Object.prototype.hasOwnProperty.call(L,g))continue;if(u>=i){N[g]="[MaxProperties ~]";break}const y=L[g];N[g]=Tn(g,y,c-1,i,r),u++}return n(e),N}function ty(s,e){try{if(s==="domain"&&e&&typeof e=="object"&&e._events)return"[Domain]";if(s==="domainEmitter")return"[DomainEmitter]";if(typeof global<"u"&&e===global)return"[Global]";if(typeof window<"u"&&e===window)return"[Window]";if(typeof document<"u"&&e===document)return"[Document]";if(IN(e))return"[VueViewModel]";if(ej(e))return"[SyntheticEvent]";if(typeof e=="number"&&!Number.isFinite(e))return`[${e}]`;if(typeof e=="function")return`[Function: ${bt(e)}]`;if(typeof e=="symbol")return`[${String(e)}]`;if(typeof e=="bigint")return`[BigInt: ${String(e)}]`;const t=sy(e);return/^HTML(\w*)Element$/.test(t)?`[HTMLElement: ${t}]`:`[object ${t}]`}catch(t){return`**non-serializable** (${t})`}}function sy(s){const e=Object.getPrototypeOf(s);return e!=null&&e.constructor?e.constructor.name:"null prototype"}function iy(s){return~-encodeURI(s).split(/%..|./).length}function ry(s){return iy(JSON.stringify(s))}function oy(){const s=new WeakSet;function e(i){return s.has(i)?!0:(s.add(i),!1)}function t(i){s.delete(i)}return[e,t]}function Ri(s,e=[]){return[s,e]}function ny(s,e){const[t,i]=s;return[t,[...i,e]]}function Nc(s,e){const t=s[1];for(const i of t){const r=i[0].type;if(e(i,r))return!0}return!1}function dn(s){const e=eo(ie);return e.encodePolyfill?e.encodePolyfill(s):new TextEncoder().encode(s)}function ay(s){const[e,t]=s;let i=JSON.stringify(e);function r(o){typeof i=="string"?i=typeof o=="string"?i+o:[dn(i),o]:i.push(typeof o=="string"?dn(o):o)}for(const o of t){const[n,a]=o;if(r(`
6
6
  ${JSON.stringify(n)}
7
- `),typeof a=="string"||a instanceof Uint8Array)r(a);else{let c;try{c=JSON.stringify(a)}catch{c=JSON.stringify(dt(a))}r(c)}}return typeof i=="string"?i:My(i)}function My(s){const e=s.reduce((r,o)=>r+o.length,0),t=new Uint8Array(e);let i=0;for(const r of s)t.set(r,i),i+=r.length;return t}function cy(s){const e=typeof s.data=="string"?dn(s.data):s.data;return[{type:"attachment",length:e.length,filename:s.filename,content_type:s.contentType,attachment_type:s.attachmentType},e]}const uy={session:"session",sessions:"session",attachment:"attachment",transaction:"transaction",event:"error",client_report:"internal",user_report:"default",profile:"profile",profile_chunk:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",feedback:"feedback",span:"span",raw_security:"security",log:"log_item"};function Lc(s){return uy[s]}function UN(s){if(!(s!=null&&s.sdk))return;const{name:e,version:t}=s.sdk;return{name:e,version:t}}function ly(s,e,t,i){var o;const r=(o=s.sdkProcessingMetadata)==null?void 0:o.dynamicSamplingContext;return{event_id:s.event_id,sent_at:new Date().toISOString(),...e&&{sdk:e},...!!t&&i&&{dsn:oo(i)},...r&&{trace:r}}}function Ny(s,e){return e&&(s.sdk=s.sdk||{},s.sdk.name=s.sdk.name||e.name,s.sdk.version=s.sdk.version||e.version,s.sdk.integrations=[...s.sdk.integrations||[],...e.integrations||[]],s.sdk.packages=[...s.sdk.packages||[],...e.packages||[]]),s}function Ly(s,e,t,i){const r=UN(t),o={sent_at:new Date().toISOString(),...r&&{sdk:r},...!!i&&e&&{dsn:oo(e)}},n="aggregates"in s?[{type:"sessions"},s]:[{type:"session"},s.toJSON()];return Ri(o,[n])}function gy(s,e,t,i){const r=UN(t),o=s.type&&s.type!=="replay_event"?s.type:"event";Ny(s,t==null?void 0:t.sdk);const n=ly(s,r,i,e);return delete s.sdkProcessingMetadata,Ri(n,[[{type:o},s]])}var Dt;(function(s){s[s.PENDING=0]="PENDING";const t=1;s[s.RESOLVED=t]="RESOLVED";const i=2;s[s.REJECTED=i]="REJECTED"})(Dt||(Dt={}));function es(s){return new Ut(e=>{e(s)})}function br(s){return new Ut((e,t)=>{t(s)})}class Ut{constructor(e){this._state=Dt.PENDING,this._handlers=[],this._runExecutor(e)}then(e,t){return new Ut((i,r)=>{this._handlers.push([!1,o=>{if(!e)i(o);else try{i(e(o))}catch(n){r(n)}},o=>{if(!t)r(o);else try{i(t(o))}catch(n){r(n)}}]),this._executeHandlers()})}catch(e){return this.then(t=>t,e)}finally(e){return new Ut((t,i)=>{let r,o;return this.then(n=>{o=!1,r=n,e&&e()},n=>{o=!0,r=n,e&&e()}).then(()=>{if(o){i(r);return}t(r)})})}_executeHandlers(){if(this._state===Dt.PENDING)return;const e=this._handlers.slice();this._handlers=[],e.forEach(t=>{t[0]||(this._state===Dt.RESOLVED&&t[1](this._value),this._state===Dt.REJECTED&&t[2](this._value),t[0]=!0)})}_runExecutor(e){const t=(o,n)=>{if(this._state===Dt.PENDING){if(io(n)){n.then(i,r);return}this._state=o,this._value=n,this._executeHandlers()}},i=o=>{t(Dt.RESOLVED,o)},r=o=>{t(Dt.REJECTED,o)};try{e(i,r)}catch(o){r(o)}}}function Dn(s,e,t,i=0){return new Ut((r,o)=>{const n=s[i];if(e===null||typeof n!="function")r(e);else{const a=n({...e},t);X&&n.id&&a===null&&R.log(`Event processor "${n.id}" dropped event`),io(a)?a.then(c=>Dn(s,c,t,i+1).then(r)).then(null,o):Dn(s,a,t,i+1).then(r).then(null,o)}})}let ar,gc,Mr;function jy(s){const e=ie._sentryDebugIds;if(!e)return{};const t=Object.keys(e);return Mr&&t.length===gc||(gc=t.length,Mr=t.reduce((i,r)=>{ar||(ar={});const o=ar[r];if(o)i[o[0]]=o[1];else{const n=s(r);for(let a=n.length-1;a>=0;a--){const c=n[a],l=c==null?void 0:c.filename,N=e[r];if(l&&N){i[l]=N,ar[r]=[l,N];break}}}return i},{})),Mr}function yy(s,e){const{fingerprint:t,span:i,breadcrumbs:r,sdkProcessingMetadata:o}=e;Ty(s,e),i&&hy(s,i),zy(s,t),dy(s,r),Dy(s,o)}function jc(s,e){const{extra:t,tags:i,user:r,contexts:o,level:n,sdkProcessingMetadata:a,breadcrumbs:c,fingerprint:l,eventProcessors:N,attachments:u,propagationContext:L,transactionName:g,span:y}=e;cr(s,"extra",t),cr(s,"tags",i),cr(s,"user",r),cr(s,"contexts",o),s.sdkProcessingMetadata=Bi(s.sdkProcessingMetadata,a,2),n&&(s.level=n),g&&(s.transactionName=g),y&&(s.span=y),c.length&&(s.breadcrumbs=[...s.breadcrumbs,...c]),l.length&&(s.fingerprint=[...s.fingerprint,...l]),N.length&&(s.eventProcessors=[...s.eventProcessors,...N]),u.length&&(s.attachments=[...s.attachments,...u]),s.propagationContext={...s.propagationContext,...L}}function cr(s,e,t){s[e]=Bi(s[e],t,1)}function Ty(s,e){const{extra:t,tags:i,user:r,contexts:o,level:n,transactionName:a}=e;Object.keys(t).length&&(s.extra={...t,...s.extra}),Object.keys(i).length&&(s.tags={...i,...s.tags}),Object.keys(r).length&&(s.user={...r,...s.user}),Object.keys(o).length&&(s.contexts={...o,...s.contexts}),n&&(s.level=n),a&&s.type!=="transaction"&&(s.transaction=a)}function dy(s,e){const t=[...s.breadcrumbs||[],...e];s.breadcrumbs=t.length?t:void 0}function Dy(s,e){s.sdkProcessingMetadata={...s.sdkProcessingMetadata,...e}}function hy(s,e){s.contexts={trace:xj(e),...s.contexts},s.sdkProcessingMetadata={dynamicSamplingContext:ey(e),...s.sdkProcessingMetadata};const t=SN(e),i=Ca(t).description;i&&!s.transaction&&s.type==="transaction"&&(s.transaction=i)}function zy(s,e){s.fingerprint=s.fingerprint?Array.isArray(s.fingerprint)?s.fingerprint:[s.fingerprint]:[],e&&(s.fingerprint=s.fingerprint.concat(e)),s.fingerprint.length||delete s.fingerprint}function wy(s,e,t,i,r,o){const{normalizeDepth:n=3,normalizeMaxBreadth:a=1e3}=s,c={...e,event_id:e.event_id||t.event_id||Je(),timestamp:e.timestamp||Wi()},l=t.integrations||s.integrations.map(d=>d.name);Cy(c,s),Ay(c,l),r&&r.emit("applyFrameMetadata",e),e.type===void 0&&Iy(c,s.stackParser);const N=Oy(i,t.captureContext);t.mechanism&&Rs(c,t.mechanism);const u=r?r.getEventProcessors():[],L=gj().getScopeData();if(o){const d=o.getScopeData();jc(L,d)}if(N){const d=N.getScopeData();jc(L,d)}const g=[...t.attachments||[],...L.attachments];g.length&&(t.attachments=g),yy(c,L);const y=[...u,...L.eventProcessors];return Dn(y,c,t).then(d=>(d&&py(d),typeof n=="number"&&n>0?my(d,n,a):d))}function Cy(s,e){const{environment:t,release:i,dist:r,maxValueLength:o=250}=e;s.environment=s.environment||t||Ia,!s.release&&i&&(s.release=i),!s.dist&&r&&(s.dist=r);const n=s.request;n!=null&&n.url&&(n.url=vr(n.url,o))}function Iy(s,e){var i,r;const t=jy(e);(r=(i=s.exception)==null?void 0:i.values)==null||r.forEach(o=>{var n,a;(a=(n=o.stacktrace)==null?void 0:n.frames)==null||a.forEach(c=>{c.filename&&(c.debug_id=t[c.filename])})})}function py(s){var i,r;const e={};if((r=(i=s.exception)==null?void 0:i.values)==null||r.forEach(o=>{var n,a;(a=(n=o.stacktrace)==null?void 0:n.frames)==null||a.forEach(c=>{c.debug_id&&(c.abs_path?e[c.abs_path]=c.debug_id:c.filename&&(e[c.filename]=c.debug_id),delete c.debug_id)})}),Object.keys(e).length===0)return;s.debug_meta=s.debug_meta||{},s.debug_meta.images=s.debug_meta.images||[];const t=s.debug_meta.images;Object.entries(e).forEach(([o,n])=>{t.push({type:"sourcemap",code_file:o,debug_id:n})})}function Ay(s,e){e.length>0&&(s.sdk=s.sdk||{},s.sdk.integrations=[...s.sdk.integrations||[],...e])}function my(s,e,t){var r,o;if(!s)return null;const i={...s,...s.breadcrumbs&&{breadcrumbs:s.breadcrumbs.map(n=>({...n,...n.data&&{data:dt(n.data,e,t)}}))},...s.user&&{user:dt(s.user,e,t)},...s.contexts&&{contexts:dt(s.contexts,e,t)},...s.extra&&{extra:dt(s.extra,e,t)}};return(r=s.contexts)!=null&&r.trace&&i.contexts&&(i.contexts.trace=s.contexts.trace,s.contexts.trace.data&&(i.contexts.trace.data=dt(s.contexts.trace.data,e,t))),s.spans&&(i.spans=s.spans.map(n=>({...n,...n.data&&{data:dt(n.data,e,t)}}))),(o=s.contexts)!=null&&o.flags&&i.contexts&&(i.contexts.flags=dt(s.contexts.flags,3,t)),i}function Oy(s,e){if(!e)return s;const t=s?s.clone():new wt;return t.update(e),t}function Ey(s,e){return Ct().captureException(s,void 0)}function $N(s,e){return Ct().captureEvent(s,e)}function yc(s){const e=Ji(),t=Ct(),{userAgent:i}=ie.navigator||{},r=rj({user:t.getUser()||e.getUser(),...i&&{userAgent:i},...s}),o=e.getSession();return(o==null?void 0:o.status)==="ok"&&Fs(o,{status:"exited"}),PN(),e.setSession(r),r}function PN(){const s=Ji(),t=Ct().getSession()||s.getSession();t&&oj(t),WN(),s.setSession()}function WN(){const s=Ji(),e=Ee(),t=s.getSession();t&&e&&e.captureSession(t)}function Tc(s=!1){if(s){PN();return}WN()}const fy="7";function xy(s){const e=s.protocol?`${s.protocol}:`:"",t=s.port?`:${s.port}`:"";return`${e}//${s.host}${t}${s.path?`/${s.path}`:""}/api/`}function _y(s){return`${xy(s)}${s.projectId}/envelope/`}function Sy(s,e){const t={sentry_version:fy};return s.publicKey&&(t.sentry_key=s.publicKey),e&&(t.sentry_client=`${e.name}/${e.version}`),new URLSearchParams(t).toString()}function ky(s,e,t){return e||`${_y(s)}?${Sy(s,t)}`}const dc=[];function Yy(s){const e={};return s.forEach(t=>{const{name:i}=t,r=e[i];r&&!r.isDefaultInstance&&t.isDefaultInstance||(e[i]=t)}),Object.values(e)}function vy(s){const e=s.defaultIntegrations||[],t=s.integrations;e.forEach(r=>{r.isDefaultInstance=!0});let i;if(Array.isArray(t))i=[...e,...t];else if(typeof t=="function"){const r=t(e);i=Array.isArray(r)?r:[r]}else i=e;return Yy(i)}function by(s,e){const t={};return e.forEach(i=>{i&&BN(s,i,t)}),t}function Dc(s,e){for(const t of e)t!=null&&t.afterAllSetup&&t.afterAllSetup(s)}function BN(s,e,t){if(t[e.name]){X&&R.log(`Integration skipped because it was already installed: ${e.name}`);return}if(t[e.name]=e,dc.indexOf(e.name)===-1&&typeof e.setupOnce=="function"&&(e.setupOnce(),dc.push(e.name)),e.setup&&typeof e.setup=="function"&&e.setup(s),typeof e.preprocessEvent=="function"){const i=e.preprocessEvent.bind(e);s.on("preprocessEvent",(r,o)=>i(r,o,s))}if(typeof e.processEvent=="function"){const i=e.processEvent.bind(e),r=Object.assign((o,n)=>i(o,n,s),{id:e.name});s.addEventProcessor(r)}X&&R.log(`Integration installed: ${e.name}`)}function JN(s){const e=[];s.message&&e.push(s.message);try{const t=s.exception.values[s.exception.values.length-1];t!=null&&t.value&&(e.push(t.value),t.type&&e.push(`${t.type}: ${t.value}`))}catch{}return e}function Qy(s){var c;const{trace_id:e,parent_span_id:t,span_id:i,status:r,origin:o,data:n,op:a}=((c=s.contexts)==null?void 0:c.trace)??{};return{data:n??{},description:s.transaction,op:a,parent_span_id:t,span_id:i??"",start_timestamp:s.start_timestamp??0,status:r,timestamp:s.timestamp,trace_id:e??"",origin:o,profile_id:n==null?void 0:n[EN],exclusive_time:n==null?void 0:n[fN],measurements:s.measurements,is_segment:!0}}function Uy(s){return{type:"transaction",timestamp:s.timestamp,start_timestamp:s.start_timestamp,transaction:s.description,contexts:{trace:{trace_id:s.trace_id,span_id:s.span_id,parent_span_id:s.parent_span_id,op:s.op,status:s.status,origin:s.origin,data:{...s.data,...s.profile_id&&{[EN]:s.profile_id},...s.exclusive_time&&{[fN]:s.exclusive_time}}}},measurements:s.measurements}}function $y(s,e,t){const i=[{type:"client_report"},{timestamp:Wi(),discarded_events:s}];return Ri(e?{dsn:e}:{},[i])}const hc="Not capturing exception because it's already been captured.",zc="Discarded session because of missing or non-string release",RN=Symbol.for("SentryInternalError"),FN=Symbol.for("SentryDoNotSendEventError");function mr(s){return{message:s,[RN]:!0}}function _o(s){return{message:s,[FN]:!0}}function wc(s){return!!s&&typeof s=="object"&&RN in s}function Cc(s){return!!s&&typeof s=="object"&&FN in s}class Py{constructor(e){if(this._options=e,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],e.dsn?this._dsn=Xj(e.dsn):X&&R.warn("No DSN provided, client will not send events."),this._dsn){const t=ky(this._dsn,e.tunnel,e._metadata?e._metadata.sdk:void 0);this._transport=e.transport({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),...e.transportOptions,url:t})}}captureException(e,t,i){const r=Je();if(KM(e))return X&&R.log(hc),r;const o={event_id:r,...t};return this._process(this.eventFromException(e,o).then(n=>this._captureEvent(n,o,i))),o.event_id}captureMessage(e,t,i,r){const o={event_id:Je(),...i},n=Ta(e)?e:String(e),a=da(e)?this.eventFromMessage(n,t,o):this.eventFromException(e,o);return this._process(a.then(c=>this._captureEvent(c,o,r))),o.event_id}captureEvent(e,t,i){const r=Je();if(t!=null&&t.originalException&&KM(t.originalException))return X&&R.log(hc),r;const o={event_id:r,...t},n=e.sdkProcessingMetadata||{},a=n.capturedSpanScope,c=n.capturedSpanIsolationScope;return this._process(this._captureEvent(e,o,a||i,c)),o.event_id}captureSession(e){this.sendSession(e),Fs(e,{init:!1})}getDsn(){return this._dsn}getOptions(){return this._options}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}flush(e){const t=this._transport;return t?(this.emit("flush"),this._isClientDoneProcessing(e).then(i=>t.flush(e).then(r=>i&&r))):es(!0)}close(e){return this.flush(e).then(t=>(this.getOptions().enabled=!1,this.emit("close"),t))}getEventProcessors(){return this._eventProcessors}addEventProcessor(e){this._eventProcessors.push(e)}init(){(this._isEnabled()||this._options.integrations.some(({name:e})=>e.startsWith("Spotlight")))&&this._setupIntegrations()}getIntegrationByName(e){return this._integrations[e]}addIntegration(e){const t=this._integrations[e.name];BN(this,e,this._integrations),t||Dc(this,[e])}sendEvent(e,t={}){this.emit("beforeSendEvent",e,t);let i=gy(e,this._dsn,this._options._metadata,this._options.tunnel);for(const o of t.attachments||[])i=ny(i,cy(o));const r=this.sendEnvelope(i);r&&r.then(o=>this.emit("afterSendEvent",e,o),null)}sendSession(e){const{release:t,environment:i=Ia}=this._options;if("aggregates"in e){const o=e.attrs||{};if(!o.release&&!t){X&&R.warn(zc);return}o.release=o.release||t,o.environment=o.environment||i,e.attrs=o}else{if(!e.release&&!t){X&&R.warn(zc);return}e.release=e.release||t,e.environment=e.environment||i}this.emit("beforeSendSession",e);const r=Ly(e,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(r)}recordDroppedEvent(e,t,i=1){if(this._options.sendClientReports){const r=`${e}:${t}`;X&&R.log(`Recording outcome: "${r}"${i>1?` (${i} times)`:""}`),this._outcomes[r]=(this._outcomes[r]||0)+i}}on(e,t){const i=this._hooks[e]=this._hooks[e]||[];return i.push(t),()=>{const r=i.indexOf(t);r>-1&&i.splice(r,1)}}emit(e,...t){const i=this._hooks[e];i&&i.forEach(r=>r(...t))}sendEnvelope(e){return this.emit("beforeEnvelope",e),this._isEnabled()&&this._transport?this._transport.send(e).then(null,t=>(X&&R.error("Error while sending envelope:",t),t)):(X&&R.error("Transport disabled"),es({}))}_setupIntegrations(){const{integrations:e}=this._options;this._integrations=by(this,e),Dc(this,e)}_updateSessionFromEvent(e,t){var c;let i=t.level==="fatal",r=!1;const o=(c=t.exception)==null?void 0:c.values;if(o){r=!0;for(const l of o){const N=l.mechanism;if((N==null?void 0:N.handled)===!1){i=!0;break}}}const n=e.status==="ok";(n&&e.errors===0||n&&i)&&(Fs(e,{...i&&{status:"crashed"},errors:e.errors||Number(r||i)}),this.captureSession(e))}_isClientDoneProcessing(e){return new Ut(t=>{let i=0;const r=1,o=setInterval(()=>{this._numProcessing==0?(clearInterval(o),t(!0)):(i+=r,e&&i>=e&&(clearInterval(o),t(!1)))},r)})}_isEnabled(){return this.getOptions().enabled!==!1&&this._transport!==void 0}_prepareEvent(e,t,i,r){const o=this.getOptions(),n=Object.keys(this._integrations);return!t.integrations&&(n!=null&&n.length)&&(t.integrations=n),this.emit("preprocessEvent",e,t),e.type||r.setLastEventId(e.event_id||t.event_id),wy(o,e,t,i,this,r).then(a=>{if(a===null)return a;this.emit("postprocessEvent",a,t),a.contexts={trace:yj(i),...a.contexts};const c=qj(this,i);return a.sdkProcessingMetadata={dynamicSamplingContext:c,...a.sdkProcessingMetadata},a})}_captureEvent(e,t={},i=Ct(),r=Ji()){return X&&hn(e)&&R.log(`Captured error event \`${JN(e)[0]||"<unknown>"}\``),this._processEvent(e,t,i,r).then(o=>o.event_id,o=>{X&&(Cc(o)?R.log(o.message):wc(o)?R.warn(o.message):R.warn(o))})}_processEvent(e,t,i,r){const o=this.getOptions(),{sampleRate:n}=o,a=GN(e),c=hn(e),l=e.type||"error",N=`before send for type \`${l}\``,u=typeof n>"u"?void 0:Aj(n);if(c&&typeof u=="number"&&Math.random()>u)return this.recordDroppedEvent("sample_rate","error"),br(_o(`Discarding event because it's not included in the random sample (sampling rate = ${n})`));const L=l==="replay_event"?"replay":l;return this._prepareEvent(e,t,i,r).then(g=>{if(g===null)throw this.recordDroppedEvent("event_processor",L),_o("An event processor returned `null`, will not send event.");if(t.data&&t.data.__sentry__===!0)return g;const T=By(this,o,g,t);return Wy(T,N)}).then(g=>{var d;if(g===null){if(this.recordDroppedEvent("before_send",L),a){const I=1+(e.spans||[]).length;this.recordDroppedEvent("before_send","span",I)}throw _o(`${N} returned \`null\`, will not send event.`)}const y=i.getSession()||r.getSession();if(c&&y&&this._updateSessionFromEvent(y,g),a){const z=((d=g.sdkProcessingMetadata)==null?void 0:d.spanCountBeforeProcessing)||0,I=g.spans?g.spans.length:0,C=z-I;C>0&&this.recordDroppedEvent("before_send","span",C)}const T=g.transaction_info;if(a&&T&&g.transaction!==e.transaction){const z="custom";g.transaction_info={...T,source:z}}return this.sendEvent(g,t),g}).then(null,g=>{throw Cc(g)||wc(g)?g:(this.captureException(g,{data:{__sentry__:!0},originalException:g}),mr(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.
8
- Reason: ${g}`))})}_process(e){this._numProcessing++,e.then(t=>(this._numProcessing--,t),t=>(this._numProcessing--,t))}_clearOutcomes(){const e=this._outcomes;return this._outcomes={},Object.entries(e).map(([t,i])=>{const[r,o]=t.split(":");return{reason:r,category:o,quantity:i}})}_flushOutcomes(){X&&R.log("Flushing outcomes...");const e=this._clearOutcomes();if(e.length===0){X&&R.log("No outcomes to send");return}if(!this._dsn){X&&R.log("No dsn provided, will not send outcomes");return}X&&R.log("Sending outcomes:",e);const t=$y(e,this._options.tunnel&&oo(this._dsn));this.sendEnvelope(t)}}function Wy(s,e){const t=`${e} must return \`null\` or a valid event.`;if(io(s))return s.then(i=>{if(!_i(i)&&i!==null)throw mr(t);return i},i=>{throw mr(`${e} rejected with ${i}`)});if(!_i(s)&&s!==null)throw mr(t);return s}function By(s,e,t,i){const{beforeSend:r,beforeSendTransaction:o,beforeSendSpan:n}=e;let a=t;if(hn(a)&&r)return r(a,i);if(GN(a)){if(n){const c=n(Qy(a));if(c?a=Bi(t,Uy(c)):ac(),a.spans){const l=[];for(const N of a.spans){const u=n(N);u?l.push(u):(ac(),l.push(N))}a.spans=l}}if(o){if(a.spans){const c=a.spans.length;a.sdkProcessingMetadata={...t.sdkProcessingMetadata,spanCountBeforeProcessing:c}}return o(a,i)}}return a}function hn(s){return s.type===void 0}function GN(s){return s.type==="transaction"}function Jy(s){return[{type:"log",item_count:s.length,content_type:"application/vnd.sentry.items.log+json"},{items:s}]}function Ry(s,e,t,i){const r={};return e!=null&&e.sdk&&(r.sdk={name:e.sdk.name,version:e.sdk.version}),t&&i&&(r.dsn=oo(i)),Ri(r,[Jy(s)])}ie._sentryClientToLogBufferMap=new WeakMap;function So(s,e){var o;const t=Fy(s)??[];if(t.length===0)return;const i=s.getOptions(),r=Ry(t,i._metadata,i.tunnel,s.getDsn());(o=ie._sentryClientToLogBufferMap)==null||o.set(s,[]),s.emit("flushLogs"),s.sendEnvelope(r)}function Fy(s){var e;return(e=ie._sentryClientToLogBufferMap)==null?void 0:e.get(s)}function Gy(s,e){e.debug===!0&&(X?R.enable():Zs(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")})),Ct().update(e.initialScope);const i=new s(e);return Hy(i),i.init(),i}function Hy(s){Ct().setClient(s)}const HN=Symbol.for("SentryBufferFullError");function Vy(s){const e=[];function t(){return s===void 0||e.length<s}function i(n){return e.splice(e.indexOf(n),1)[0]||Promise.resolve(void 0)}function r(n){if(!t())return br(HN);const a=n();return e.indexOf(a)===-1&&e.push(a),a.then(()=>i(a)).then(null,()=>i(a).then(null,()=>{})),a}function o(n){return new Ut((a,c)=>{let l=e.length;if(!l)return a(!0);const N=setTimeout(()=>{n&&n>0&&a(!1)},n);e.forEach(u=>{es(u).then(()=>{--l||(clearTimeout(N),a(!0))},c)})})}return{$:e,add:r,drain:o}}const Zy=60*1e3;function Xy(s,e=Date.now()){const t=parseInt(`${s}`,10);if(!isNaN(t))return t*1e3;const i=Date.parse(`${s}`);return isNaN(i)?Zy:i-e}function Ky(s,e){return s[e]||s.all||0}function qy(s,e,t=Date.now()){return Ky(s,e)>t}function eT(s,{statusCode:e,headers:t},i=Date.now()){const r={...s},o=t==null?void 0:t["x-sentry-rate-limits"],n=t==null?void 0:t["retry-after"];if(o)for(const a of o.trim().split(",")){const[c,l,,,N]=a.split(":",5),u=parseInt(c,10),L=(isNaN(u)?60:u)*1e3;if(!l)r.all=i+L;else for(const g of l.split(";"))g==="metric_bucket"?(!N||N.split(";").includes("custom"))&&(r[g]=i+L):r[g]=i+L}else n?r.all=i+Xy(n,i):e===429&&(r.all=i+60*1e3);return r}const tT=64;function sT(s,e,t=Vy(s.bufferSize||tT)){let i={};const r=n=>t.drain(n);function o(n){const a=[];if(Nc(n,(u,L)=>{const g=Lc(L);qy(i,g)?s.recordDroppedEvent("ratelimit_backoff",g):a.push(u)}),a.length===0)return es({});const c=Ri(n[0],a),l=u=>{Nc(c,(L,g)=>{s.recordDroppedEvent(u,Lc(g))})},N=()=>e({body:ay(c)}).then(u=>(u.statusCode!==void 0&&(u.statusCode<200||u.statusCode>=300)&&X&&R.warn(`Sentry responded with status code ${u.statusCode} to sent event.`),i=eT(i,u),u),u=>{throw l("network_error"),X&&R.error("Encountered error running transport request:",u),u});return t.add(N).then(u=>u,u=>{if(u===HN)return X&&R.error("Skipped sending event because buffer is full."),l("queue_overflow"),es({});throw u})}return{send:o,flush:r}}function iT(s){var e;((e=s.user)==null?void 0:e.ip_address)===void 0&&(s.user={...s.user,ip_address:"{{auto}}"})}function rT(s){var e;"aggregates"in s?((e=s.attrs)==null?void 0:e.ip_address)===void 0&&(s.attrs={...s.attrs,ip_address:"{{auto}}"}):s.ipAddress===void 0&&(s.ipAddress="{{auto}}")}function oT(s,e,t=[e],i="npm"){const r=s._metadata||{};r.sdk||(r.sdk={name:`sentry.javascript.${e}`,packages:t.map(o=>({name:`${i}:@sentry/${o}`,version:Xt})),version:Xt}),s._metadata=r}const nT=100;function ts(s,e){const t=Ee(),i=Ji();if(!t)return;const{beforeBreadcrumb:r=null,maxBreadcrumbs:o=nT}=t.getOptions();if(o<=0)return;const a={timestamp:Wi(),...s},c=r?Zs(()=>r(a,e)):a;c!==null&&(t.emit&&t.emit("beforeAddBreadcrumb",c,e),i.addBreadcrumb(c,o))}let Ic;const aT="FunctionToString",pc=new WeakMap,MT=()=>({name:aT,setupOnce(){Ic=Function.prototype.toString;try{Function.prototype.toString=function(...s){const e=za(this),t=pc.has(Ee())&&e!==void 0?e:this;return Ic.apply(t,s)}}catch{}},setup(s){pc.set(s,!0)}}),cT=MT,uT=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/,/^ResizeObserver loop completed with undelivered notifications.$/,/^Cannot redefine property: googletag$/,/^Can't find variable: gmo$/,/^undefined is not an object \(evaluating 'a\.[A-Z]'\)$/,`can't redefine non-configurable property "solana"`,"vv().getRestrictions is not a function. (In 'vv().getRestrictions(1,a)', 'vv().getRestrictions' is undefined)","Can't find variable: _AutofillCallbackHandler",/^Non-Error promise rejection captured with value: Object Not Found Matching Id:\d+, MethodName:simulateEvent, ParamCount:\d+$/,/^Java exception was raised during method invocation$/],lT="EventFilters",NT=(s={})=>{let e;return{name:lT,setup(t){const i=t.getOptions();e=Ac(s,i)},processEvent(t,i,r){if(!e){const o=r.getOptions();e=Ac(s,o)}return gT(t,e)?null:t}}},LT=(s={})=>({...NT(s),name:"InboundFilters"});function Ac(s={},e={}){return{allowUrls:[...s.allowUrls||[],...e.allowUrls||[]],denyUrls:[...s.denyUrls||[],...e.denyUrls||[]],ignoreErrors:[...s.ignoreErrors||[],...e.ignoreErrors||[],...s.disableErrorDefaults?[]:uT],ignoreTransactions:[...s.ignoreTransactions||[],...e.ignoreTransactions||[]]}}function gT(s,e){if(s.type){if(s.type==="transaction"&&yT(s,e.ignoreTransactions))return X&&R.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.
7
+ `),typeof a=="string"||a instanceof Uint8Array)r(a);else{let c;try{c=JSON.stringify(a)}catch{c=JSON.stringify(dt(a))}r(c)}}return typeof i=="string"?i:My(i)}function My(s){const e=s.reduce((r,o)=>r+o.length,0),t=new Uint8Array(e);let i=0;for(const r of s)t.set(r,i),i+=r.length;return t}function cy(s){const e=typeof s.data=="string"?dn(s.data):s.data;return[{type:"attachment",length:e.length,filename:s.filename,content_type:s.contentType,attachment_type:s.attachmentType},e]}const uy={session:"session",sessions:"session",attachment:"attachment",transaction:"transaction",event:"error",client_report:"internal",user_report:"default",profile:"profile",profile_chunk:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",feedback:"feedback",span:"span",raw_security:"security",log:"log_item"};function Lc(s){return uy[s]}function UN(s){if(!(s!=null&&s.sdk))return;const{name:e,version:t}=s.sdk;return{name:e,version:t}}function ly(s,e,t,i){var o;const r=(o=s.sdkProcessingMetadata)==null?void 0:o.dynamicSamplingContext;return{event_id:s.event_id,sent_at:new Date().toISOString(),...e&&{sdk:e},...!!t&&i&&{dsn:oo(i)},...r&&{trace:r}}}function Ny(s,e){return e&&(s.sdk=s.sdk||{},s.sdk.name=s.sdk.name||e.name,s.sdk.version=s.sdk.version||e.version,s.sdk.integrations=[...s.sdk.integrations||[],...e.integrations||[]],s.sdk.packages=[...s.sdk.packages||[],...e.packages||[]]),s}function Ly(s,e,t,i){const r=UN(t),o={sent_at:new Date().toISOString(),...r&&{sdk:r},...!!i&&e&&{dsn:oo(e)}},n="aggregates"in s?[{type:"sessions"},s]:[{type:"session"},s.toJSON()];return Ri(o,[n])}function gy(s,e,t,i){const r=UN(t),o=s.type&&s.type!=="replay_event"?s.type:"event";Ny(s,t==null?void 0:t.sdk);const n=ly(s,r,i,e);return delete s.sdkProcessingMetadata,Ri(n,[[{type:o},s]])}var Dt;(function(s){s[s.PENDING=0]="PENDING";const t=1;s[s.RESOLVED=t]="RESOLVED";const i=2;s[s.REJECTED=i]="REJECTED"})(Dt||(Dt={}));function es(s){return new Ut(e=>{e(s)})}function br(s){return new Ut((e,t)=>{t(s)})}class Ut{constructor(e){this._state=Dt.PENDING,this._handlers=[],this._runExecutor(e)}then(e,t){return new Ut((i,r)=>{this._handlers.push([!1,o=>{if(!e)i(o);else try{i(e(o))}catch(n){r(n)}},o=>{if(!t)r(o);else try{i(t(o))}catch(n){r(n)}}]),this._executeHandlers()})}catch(e){return this.then(t=>t,e)}finally(e){return new Ut((t,i)=>{let r,o;return this.then(n=>{o=!1,r=n,e&&e()},n=>{o=!0,r=n,e&&e()}).then(()=>{if(o){i(r);return}t(r)})})}_executeHandlers(){if(this._state===Dt.PENDING)return;const e=this._handlers.slice();this._handlers=[],e.forEach(t=>{t[0]||(this._state===Dt.RESOLVED&&t[1](this._value),this._state===Dt.REJECTED&&t[2](this._value),t[0]=!0)})}_runExecutor(e){const t=(o,n)=>{if(this._state===Dt.PENDING){if(io(n)){n.then(i,r);return}this._state=o,this._value=n,this._executeHandlers()}},i=o=>{t(Dt.RESOLVED,o)},r=o=>{t(Dt.REJECTED,o)};try{e(i,r)}catch(o){r(o)}}}function Dn(s,e,t,i=0){return new Ut((r,o)=>{const n=s[i];if(e===null||typeof n!="function")r(e);else{const a=n({...e},t);X&&n.id&&a===null&&R.log(`Event processor "${n.id}" dropped event`),io(a)?a.then(c=>Dn(s,c,t,i+1).then(r)).then(null,o):Dn(s,a,t,i+1).then(r).then(null,o)}})}function jy(s,e){const{fingerprint:t,span:i,breadcrumbs:r,sdkProcessingMetadata:o}=e;yy(s,e),i&&Dy(s,i),hy(s,t),Ty(s,r),dy(s,o)}function gc(s,e){const{extra:t,tags:i,user:r,contexts:o,level:n,sdkProcessingMetadata:a,breadcrumbs:c,fingerprint:l,eventProcessors:N,attachments:u,propagationContext:L,transactionName:g,span:y}=e;ar(s,"extra",t),ar(s,"tags",i),ar(s,"user",r),ar(s,"contexts",o),s.sdkProcessingMetadata=Bi(s.sdkProcessingMetadata,a,2),n&&(s.level=n),g&&(s.transactionName=g),y&&(s.span=y),c.length&&(s.breadcrumbs=[...s.breadcrumbs,...c]),l.length&&(s.fingerprint=[...s.fingerprint,...l]),N.length&&(s.eventProcessors=[...s.eventProcessors,...N]),u.length&&(s.attachments=[...s.attachments,...u]),s.propagationContext={...s.propagationContext,...L}}function ar(s,e,t){s[e]=Bi(s[e],t,1)}function yy(s,e){const{extra:t,tags:i,user:r,contexts:o,level:n,transactionName:a}=e;Object.keys(t).length&&(s.extra={...t,...s.extra}),Object.keys(i).length&&(s.tags={...i,...s.tags}),Object.keys(r).length&&(s.user={...r,...s.user}),Object.keys(o).length&&(s.contexts={...o,...s.contexts}),n&&(s.level=n),a&&s.type!=="transaction"&&(s.transaction=a)}function Ty(s,e){const t=[...s.breadcrumbs||[],...e];s.breadcrumbs=t.length?t:void 0}function dy(s,e){s.sdkProcessingMetadata={...s.sdkProcessingMetadata,...e}}function Dy(s,e){s.contexts={trace:bj(e),...s.contexts},s.sdkProcessingMetadata={dynamicSamplingContext:ey(e),...s.sdkProcessingMetadata};const t=YN(e),i=Ca(t).description;i&&!s.transaction&&s.type==="transaction"&&(s.transaction=i)}function hy(s,e){s.fingerprint=s.fingerprint?Array.isArray(s.fingerprint)?s.fingerprint:[s.fingerprint]:[],e&&(s.fingerprint=s.fingerprint.concat(e)),s.fingerprint.length||delete s.fingerprint}let Mr,jc,cr;function zy(s){const e=ie._sentryDebugIds;if(!e)return{};const t=Object.keys(e);return cr&&t.length===jc||(jc=t.length,cr=t.reduce((i,r)=>{Mr||(Mr={});const o=Mr[r];if(o)i[o[0]]=o[1];else{const n=s(r);for(let a=n.length-1;a>=0;a--){const c=n[a],l=c==null?void 0:c.filename,N=e[r];if(l&&N){i[l]=N,Mr[r]=[l,N];break}}}return i},{})),cr}function wy(s,e,t,i,r,o){const{normalizeDepth:n=3,normalizeMaxBreadth:a=1e3}=s,c={...e,event_id:e.event_id||t.event_id||Je(),timestamp:e.timestamp||Wi()},l=t.integrations||s.integrations.map(d=>d.name);Cy(c,s),Ay(c,l),r&&r.emit("applyFrameMetadata",e),e.type===void 0&&Iy(c,s.stackParser);const N=Oy(i,t.captureContext);t.mechanism&&Rs(c,t.mechanism);const u=r?r.getEventProcessors():[],L=hj().getScopeData();if(o){const d=o.getScopeData();gc(L,d)}if(N){const d=N.getScopeData();gc(L,d)}const g=[...t.attachments||[],...L.attachments];g.length&&(t.attachments=g),jy(c,L);const y=[...u,...L.eventProcessors];return Dn(y,c,t).then(d=>(d&&py(d),typeof n=="number"&&n>0?my(d,n,a):d))}function Cy(s,e){const{environment:t,release:i,dist:r,maxValueLength:o=250}=e;s.environment=s.environment||t||Ia,!s.release&&i&&(s.release=i),!s.dist&&r&&(s.dist=r);const n=s.request;n!=null&&n.url&&(n.url=vr(n.url,o))}function Iy(s,e){var i,r;const t=zy(e);(r=(i=s.exception)==null?void 0:i.values)==null||r.forEach(o=>{var n,a;(a=(n=o.stacktrace)==null?void 0:n.frames)==null||a.forEach(c=>{c.filename&&(c.debug_id=t[c.filename])})})}function py(s){var i,r;const e={};if((r=(i=s.exception)==null?void 0:i.values)==null||r.forEach(o=>{var n,a;(a=(n=o.stacktrace)==null?void 0:n.frames)==null||a.forEach(c=>{c.debug_id&&(c.abs_path?e[c.abs_path]=c.debug_id:c.filename&&(e[c.filename]=c.debug_id),delete c.debug_id)})}),Object.keys(e).length===0)return;s.debug_meta=s.debug_meta||{},s.debug_meta.images=s.debug_meta.images||[];const t=s.debug_meta.images;Object.entries(e).forEach(([o,n])=>{t.push({type:"sourcemap",code_file:o,debug_id:n})})}function Ay(s,e){e.length>0&&(s.sdk=s.sdk||{},s.sdk.integrations=[...s.sdk.integrations||[],...e])}function my(s,e,t){var r,o;if(!s)return null;const i={...s,...s.breadcrumbs&&{breadcrumbs:s.breadcrumbs.map(n=>({...n,...n.data&&{data:dt(n.data,e,t)}}))},...s.user&&{user:dt(s.user,e,t)},...s.contexts&&{contexts:dt(s.contexts,e,t)},...s.extra&&{extra:dt(s.extra,e,t)}};return(r=s.contexts)!=null&&r.trace&&i.contexts&&(i.contexts.trace=s.contexts.trace,s.contexts.trace.data&&(i.contexts.trace.data=dt(s.contexts.trace.data,e,t))),s.spans&&(i.spans=s.spans.map(n=>({...n,...n.data&&{data:dt(n.data,e,t)}}))),(o=s.contexts)!=null&&o.flags&&i.contexts&&(i.contexts.flags=dt(s.contexts.flags,3,t)),i}function Oy(s,e){if(!e)return s;const t=s?s.clone():new wt;return t.update(e),t}function Ey(s,e){return Ct().captureException(s,void 0)}function $N(s,e){return Ct().captureEvent(s,e)}function yc(s){const e=Ji(),t=Ct(),{userAgent:i}=ie.navigator||{},r=uj({user:t.getUser()||e.getUser(),...i&&{userAgent:i},...s}),o=e.getSession();return(o==null?void 0:o.status)==="ok"&&Fs(o,{status:"exited"}),PN(),e.setSession(r),r}function PN(){const s=Ji(),t=Ct().getSession()||s.getSession();t&&lj(t),WN(),s.setSession()}function WN(){const s=Ji(),e=Ee(),t=s.getSession();t&&e&&e.captureSession(t)}function Tc(s=!1){if(s){PN();return}WN()}const fy="7";function xy(s){const e=s.protocol?`${s.protocol}:`:"",t=s.port?`:${s.port}`:"";return`${e}//${s.host}${t}${s.path?`/${s.path}`:""}/api/`}function _y(s){return`${xy(s)}${s.projectId}/envelope/`}function Sy(s,e){const t={sentry_version:fy};return s.publicKey&&(t.sentry_key=s.publicKey),e&&(t.sentry_client=`${e.name}/${e.version}`),new URLSearchParams(t).toString()}function ky(s,e,t){return e||`${_y(s)}?${Sy(s,t)}`}const dc=[];function Yy(s){const e={};return s.forEach(t=>{const{name:i}=t,r=e[i];r&&!r.isDefaultInstance&&t.isDefaultInstance||(e[i]=t)}),Object.values(e)}function vy(s){const e=s.defaultIntegrations||[],t=s.integrations;e.forEach(r=>{r.isDefaultInstance=!0});let i;if(Array.isArray(t))i=[...e,...t];else if(typeof t=="function"){const r=t(e);i=Array.isArray(r)?r:[r]}else i=e;return Yy(i)}function by(s,e){const t={};return e.forEach(i=>{i&&BN(s,i,t)}),t}function Dc(s,e){for(const t of e)t!=null&&t.afterAllSetup&&t.afterAllSetup(s)}function BN(s,e,t){if(t[e.name]){X&&R.log(`Integration skipped because it was already installed: ${e.name}`);return}if(t[e.name]=e,dc.indexOf(e.name)===-1&&typeof e.setupOnce=="function"&&(e.setupOnce(),dc.push(e.name)),e.setup&&typeof e.setup=="function"&&e.setup(s),typeof e.preprocessEvent=="function"){const i=e.preprocessEvent.bind(e);s.on("preprocessEvent",(r,o)=>i(r,o,s))}if(typeof e.processEvent=="function"){const i=e.processEvent.bind(e),r=Object.assign((o,n)=>i(o,n,s),{id:e.name});s.addEventProcessor(r)}X&&R.log(`Integration installed: ${e.name}`)}function Qy(s,e,t){const i=[{type:"client_report"},{timestamp:Wi(),discarded_events:s}];return Ri(e?{dsn:e}:{},[i])}function JN(s){const e=[];s.message&&e.push(s.message);try{const t=s.exception.values[s.exception.values.length-1];t!=null&&t.value&&(e.push(t.value),t.type&&e.push(`${t.type}: ${t.value}`))}catch{}return e}function Uy(s){var c;const{trace_id:e,parent_span_id:t,span_id:i,status:r,origin:o,data:n,op:a}=((c=s.contexts)==null?void 0:c.trace)??{};return{data:n??{},description:s.transaction,op:a,parent_span_id:t,span_id:i??"",start_timestamp:s.start_timestamp??0,status:r,timestamp:s.timestamp,trace_id:e??"",origin:o,profile_id:n==null?void 0:n[xN],exclusive_time:n==null?void 0:n[_N],measurements:s.measurements,is_segment:!0}}function $y(s){return{type:"transaction",timestamp:s.timestamp,start_timestamp:s.start_timestamp,transaction:s.description,contexts:{trace:{trace_id:s.trace_id,span_id:s.span_id,parent_span_id:s.parent_span_id,op:s.op,status:s.status,origin:s.origin,data:{...s.data,...s.profile_id&&{[xN]:s.profile_id},...s.exclusive_time&&{[_N]:s.exclusive_time}}}},measurements:s.measurements}}const hc="Not capturing exception because it's already been captured.",zc="Discarded session because of missing or non-string release",RN=Symbol.for("SentryInternalError"),FN=Symbol.for("SentryDoNotSendEventError");function mr(s){return{message:s,[RN]:!0}}function _o(s){return{message:s,[FN]:!0}}function wc(s){return!!s&&typeof s=="object"&&RN in s}function Cc(s){return!!s&&typeof s=="object"&&FN in s}class Py{constructor(e){if(this._options=e,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],e.dsn?this._dsn=Xj(e.dsn):X&&R.warn("No DSN provided, client will not send events."),this._dsn){const t=ky(this._dsn,e.tunnel,e._metadata?e._metadata.sdk:void 0);this._transport=e.transport({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),...e.transportOptions,url:t})}}captureException(e,t,i){const r=Je();if(sc(e))return X&&R.log(hc),r;const o={event_id:r,...t};return this._process(this.eventFromException(e,o).then(n=>this._captureEvent(n,o,i))),o.event_id}captureMessage(e,t,i,r){const o={event_id:Je(),...i},n=Ta(e)?e:String(e),a=da(e)?this.eventFromMessage(n,t,o):this.eventFromException(e,o);return this._process(a.then(c=>this._captureEvent(c,o,r))),o.event_id}captureEvent(e,t,i){const r=Je();if(t!=null&&t.originalException&&sc(t.originalException))return X&&R.log(hc),r;const o={event_id:r,...t},n=e.sdkProcessingMetadata||{},a=n.capturedSpanScope,c=n.capturedSpanIsolationScope;return this._process(this._captureEvent(e,o,a||i,c)),o.event_id}captureSession(e){this.sendSession(e),Fs(e,{init:!1})}getDsn(){return this._dsn}getOptions(){return this._options}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}flush(e){const t=this._transport;return t?(this.emit("flush"),this._isClientDoneProcessing(e).then(i=>t.flush(e).then(r=>i&&r))):es(!0)}close(e){return this.flush(e).then(t=>(this.getOptions().enabled=!1,this.emit("close"),t))}getEventProcessors(){return this._eventProcessors}addEventProcessor(e){this._eventProcessors.push(e)}init(){(this._isEnabled()||this._options.integrations.some(({name:e})=>e.startsWith("Spotlight")))&&this._setupIntegrations()}getIntegrationByName(e){return this._integrations[e]}addIntegration(e){const t=this._integrations[e.name];BN(this,e,this._integrations),t||Dc(this,[e])}sendEvent(e,t={}){this.emit("beforeSendEvent",e,t);let i=gy(e,this._dsn,this._options._metadata,this._options.tunnel);for(const o of t.attachments||[])i=ny(i,cy(o));const r=this.sendEnvelope(i);r&&r.then(o=>this.emit("afterSendEvent",e,o),null)}sendSession(e){const{release:t,environment:i=Ia}=this._options;if("aggregates"in e){const o=e.attrs||{};if(!o.release&&!t){X&&R.warn(zc);return}o.release=o.release||t,o.environment=o.environment||i,e.attrs=o}else{if(!e.release&&!t){X&&R.warn(zc);return}e.release=e.release||t,e.environment=e.environment||i}this.emit("beforeSendSession",e);const r=Ly(e,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(r)}recordDroppedEvent(e,t,i=1){if(this._options.sendClientReports){const r=`${e}:${t}`;X&&R.log(`Recording outcome: "${r}"${i>1?` (${i} times)`:""}`),this._outcomes[r]=(this._outcomes[r]||0)+i}}on(e,t){const i=this._hooks[e]=this._hooks[e]||[];return i.push(t),()=>{const r=i.indexOf(t);r>-1&&i.splice(r,1)}}emit(e,...t){const i=this._hooks[e];i&&i.forEach(r=>r(...t))}sendEnvelope(e){return this.emit("beforeEnvelope",e),this._isEnabled()&&this._transport?this._transport.send(e).then(null,t=>(X&&R.error("Error while sending envelope:",t),t)):(X&&R.error("Transport disabled"),es({}))}_setupIntegrations(){const{integrations:e}=this._options;this._integrations=by(this,e),Dc(this,e)}_updateSessionFromEvent(e,t){var c;let i=t.level==="fatal",r=!1;const o=(c=t.exception)==null?void 0:c.values;if(o){r=!0;for(const l of o){const N=l.mechanism;if((N==null?void 0:N.handled)===!1){i=!0;break}}}const n=e.status==="ok";(n&&e.errors===0||n&&i)&&(Fs(e,{...i&&{status:"crashed"},errors:e.errors||Number(r||i)}),this.captureSession(e))}_isClientDoneProcessing(e){return new Ut(t=>{let i=0;const r=1,o=setInterval(()=>{this._numProcessing==0?(clearInterval(o),t(!0)):(i+=r,e&&i>=e&&(clearInterval(o),t(!1)))},r)})}_isEnabled(){return this.getOptions().enabled!==!1&&this._transport!==void 0}_prepareEvent(e,t,i,r){const o=this.getOptions(),n=Object.keys(this._integrations);return!t.integrations&&(n!=null&&n.length)&&(t.integrations=n),this.emit("preprocessEvent",e,t),e.type||r.setLastEventId(e.event_id||t.event_id),wy(o,e,t,i,this,r).then(a=>{if(a===null)return a;this.emit("postprocessEvent",a,t),a.contexts={trace:wj(i),...a.contexts};const c=qj(this,i);return a.sdkProcessingMetadata={dynamicSamplingContext:c,...a.sdkProcessingMetadata},a})}_captureEvent(e,t={},i=Ct(),r=Ji()){return X&&hn(e)&&R.log(`Captured error event \`${JN(e)[0]||"<unknown>"}\``),this._processEvent(e,t,i,r).then(o=>o.event_id,o=>{X&&(Cc(o)?R.log(o.message):wc(o)?R.warn(o.message):R.warn(o))})}_processEvent(e,t,i,r){const o=this.getOptions(),{sampleRate:n}=o,a=GN(e),c=hn(e),l=e.type||"error",N=`before send for type \`${l}\``,u=typeof n>"u"?void 0:vj(n);if(c&&typeof u=="number"&&Math.random()>u)return this.recordDroppedEvent("sample_rate","error"),br(_o(`Discarding event because it's not included in the random sample (sampling rate = ${n})`));const L=l==="replay_event"?"replay":l;return this._prepareEvent(e,t,i,r).then(g=>{if(g===null)throw this.recordDroppedEvent("event_processor",L),_o("An event processor returned `null`, will not send event.");if(t.data&&t.data.__sentry__===!0)return g;const T=By(this,o,g,t);return Wy(T,N)}).then(g=>{var d;if(g===null){if(this.recordDroppedEvent("before_send",L),a){const I=1+(e.spans||[]).length;this.recordDroppedEvent("before_send","span",I)}throw _o(`${N} returned \`null\`, will not send event.`)}const y=i.getSession()||r.getSession();if(c&&y&&this._updateSessionFromEvent(y,g),a){const z=((d=g.sdkProcessingMetadata)==null?void 0:d.spanCountBeforeProcessing)||0,I=g.spans?g.spans.length:0,C=z-I;C>0&&this.recordDroppedEvent("before_send","span",C)}const T=g.transaction_info;if(a&&T&&g.transaction!==e.transaction){const z="custom";g.transaction_info={...T,source:z}}return this.sendEvent(g,t),g}).then(null,g=>{throw Cc(g)||wc(g)?g:(this.captureException(g,{data:{__sentry__:!0},originalException:g}),mr(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.
8
+ Reason: ${g}`))})}_process(e){this._numProcessing++,e.then(t=>(this._numProcessing--,t),t=>(this._numProcessing--,t))}_clearOutcomes(){const e=this._outcomes;return this._outcomes={},Object.entries(e).map(([t,i])=>{const[r,o]=t.split(":");return{reason:r,category:o,quantity:i}})}_flushOutcomes(){X&&R.log("Flushing outcomes...");const e=this._clearOutcomes();if(e.length===0){X&&R.log("No outcomes to send");return}if(!this._dsn){X&&R.log("No dsn provided, will not send outcomes");return}X&&R.log("Sending outcomes:",e);const t=Qy(e,this._options.tunnel&&oo(this._dsn));this.sendEnvelope(t)}}function Wy(s,e){const t=`${e} must return \`null\` or a valid event.`;if(io(s))return s.then(i=>{if(!_i(i)&&i!==null)throw mr(t);return i},i=>{throw mr(`${e} rejected with ${i}`)});if(!_i(s)&&s!==null)throw mr(t);return s}function By(s,e,t,i){const{beforeSend:r,beforeSendTransaction:o,beforeSendSpan:n}=e;let a=t;if(hn(a)&&r)return r(a,i);if(GN(a)){if(n){const c=n(Uy(a));if(c?a=Bi(t,$y(c)):lc(),a.spans){const l=[];for(const N of a.spans){const u=n(N);u?l.push(u):(lc(),l.push(N))}a.spans=l}}if(o){if(a.spans){const c=a.spans.length;a.sdkProcessingMetadata={...t.sdkProcessingMetadata,spanCountBeforeProcessing:c}}return o(a,i)}}return a}function hn(s){return s.type===void 0}function GN(s){return s.type==="transaction"}function Jy(s){return[{type:"log",item_count:s.length,content_type:"application/vnd.sentry.items.log+json"},{items:s}]}function Ry(s,e,t,i){const r={};return e!=null&&e.sdk&&(r.sdk={name:e.sdk.name,version:e.sdk.version}),t&&i&&(r.dsn=oo(i)),Ri(r,[Jy(s)])}ie._sentryClientToLogBufferMap=new WeakMap;function So(s,e){var o;const t=Fy(s)??[];if(t.length===0)return;const i=s.getOptions(),r=Ry(t,i._metadata,i.tunnel,s.getDsn());(o=ie._sentryClientToLogBufferMap)==null||o.set(s,[]),s.emit("flushLogs"),s.sendEnvelope(r)}function Fy(s){var e;return(e=ie._sentryClientToLogBufferMap)==null?void 0:e.get(s)}function Gy(s,e){e.debug===!0&&(X?R.enable():Vs(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")})),Ct().update(e.initialScope);const i=new s(e);return Hy(i),i.init(),i}function Hy(s){Ct().setClient(s)}const HN=Symbol.for("SentryBufferFullError");function Vy(s){const e=[];function t(){return s===void 0||e.length<s}function i(n){return e.splice(e.indexOf(n),1)[0]||Promise.resolve(void 0)}function r(n){if(!t())return br(HN);const a=n();return e.indexOf(a)===-1&&e.push(a),a.then(()=>i(a)).then(null,()=>i(a).then(null,()=>{})),a}function o(n){return new Ut((a,c)=>{let l=e.length;if(!l)return a(!0);const N=setTimeout(()=>{n&&n>0&&a(!1)},n);e.forEach(u=>{es(u).then(()=>{--l||(clearTimeout(N),a(!0))},c)})})}return{$:e,add:r,drain:o}}const Zy=60*1e3;function Xy(s,e=Date.now()){const t=parseInt(`${s}`,10);if(!isNaN(t))return t*1e3;const i=Date.parse(`${s}`);return isNaN(i)?Zy:i-e}function Ky(s,e){return s[e]||s.all||0}function qy(s,e,t=Date.now()){return Ky(s,e)>t}function eT(s,{statusCode:e,headers:t},i=Date.now()){const r={...s},o=t==null?void 0:t["x-sentry-rate-limits"],n=t==null?void 0:t["retry-after"];if(o)for(const a of o.trim().split(",")){const[c,l,,,N]=a.split(":",5),u=parseInt(c,10),L=(isNaN(u)?60:u)*1e3;if(!l)r.all=i+L;else for(const g of l.split(";"))g==="metric_bucket"?(!N||N.split(";").includes("custom"))&&(r[g]=i+L):r[g]=i+L}else n?r.all=i+Xy(n,i):e===429&&(r.all=i+60*1e3);return r}const tT=64;function sT(s,e,t=Vy(s.bufferSize||tT)){let i={};const r=n=>t.drain(n);function o(n){const a=[];if(Nc(n,(u,L)=>{const g=Lc(L);qy(i,g)?s.recordDroppedEvent("ratelimit_backoff",g):a.push(u)}),a.length===0)return es({});const c=Ri(n[0],a),l=u=>{Nc(c,(L,g)=>{s.recordDroppedEvent(u,Lc(g))})},N=()=>e({body:ay(c)}).then(u=>(u.statusCode!==void 0&&(u.statusCode<200||u.statusCode>=300)&&X&&R.warn(`Sentry responded with status code ${u.statusCode} to sent event.`),i=eT(i,u),u),u=>{throw l("network_error"),X&&R.error("Encountered error running transport request:",u),u});return t.add(N).then(u=>u,u=>{if(u===HN)return X&&R.error("Skipped sending event because buffer is full."),l("queue_overflow"),es({});throw u})}return{send:o,flush:r}}function iT(s){var e;((e=s.user)==null?void 0:e.ip_address)===void 0&&(s.user={...s.user,ip_address:"{{auto}}"})}function rT(s){var e;"aggregates"in s?((e=s.attrs)==null?void 0:e.ip_address)===void 0&&(s.attrs={...s.attrs,ip_address:"{{auto}}"}):s.ipAddress===void 0&&(s.ipAddress="{{auto}}")}function oT(s,e,t=[e],i="npm"){const r=s._metadata||{};r.sdk||(r.sdk={name:`sentry.javascript.${e}`,packages:t.map(o=>({name:`${i}:@sentry/${o}`,version:Xt})),version:Xt}),s._metadata=r}const nT=100;function ts(s,e){const t=Ee(),i=Ji();if(!t)return;const{beforeBreadcrumb:r=null,maxBreadcrumbs:o=nT}=t.getOptions();if(o<=0)return;const a={timestamp:Wi(),...s},c=r?Vs(()=>r(a,e)):a;c!==null&&(t.emit&&t.emit("beforeAddBreadcrumb",c,e),i.addBreadcrumb(c,o))}let Ic;const aT="FunctionToString",pc=new WeakMap,MT=()=>({name:aT,setupOnce(){Ic=Function.prototype.toString;try{Function.prototype.toString=function(...s){const e=za(this),t=pc.has(Ee())&&e!==void 0?e:this;return Ic.apply(t,s)}}catch{}},setup(s){pc.set(s,!0)}}),cT=MT,uT=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/,/^ResizeObserver loop completed with undelivered notifications.$/,/^Cannot redefine property: googletag$/,/^Can't find variable: gmo$/,/^undefined is not an object \(evaluating 'a\.[A-Z]'\)$/,`can't redefine non-configurable property "solana"`,"vv().getRestrictions is not a function. (In 'vv().getRestrictions(1,a)', 'vv().getRestrictions' is undefined)","Can't find variable: _AutofillCallbackHandler",/^Non-Error promise rejection captured with value: Object Not Found Matching Id:\d+, MethodName:simulateEvent, ParamCount:\d+$/,/^Java exception was raised during method invocation$/],lT="EventFilters",NT=(s={})=>{let e;return{name:lT,setup(t){const i=t.getOptions();e=Ac(s,i)},processEvent(t,i,r){if(!e){const o=r.getOptions();e=Ac(s,o)}return gT(t,e)?null:t}}},LT=(s={})=>({...NT(s),name:"InboundFilters"});function Ac(s={},e={}){return{allowUrls:[...s.allowUrls||[],...e.allowUrls||[]],denyUrls:[...s.denyUrls||[],...e.denyUrls||[]],ignoreErrors:[...s.ignoreErrors||[],...e.ignoreErrors||[],...s.disableErrorDefaults?[]:uT],ignoreTransactions:[...s.ignoreTransactions||[],...e.ignoreTransactions||[]]}}function gT(s,e){if(s.type){if(s.type==="transaction"&&yT(s,e.ignoreTransactions))return X&&R.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.
9
9
  Event: ${Vt(s)}`),!0}else{if(jT(s,e.ignoreErrors))return X&&R.warn(`Event dropped due to being matched by \`ignoreErrors\` option.
10
10
  Event: ${Vt(s)}`),!0;if(hT(s))return X&&R.warn(`Event dropped due to not having an error message, error type or stacktrace.
11
11
  Event: ${Vt(s)}`),!0;if(TT(s,e.denyUrls))return X&&R.warn(`Event dropped due to being matched by \`denyUrls\` option.
12
12
  Event: ${Vt(s)}.
13
13
  Url: ${Qr(s)}`),!0;if(!dT(s,e.allowUrls))return X&&R.warn(`Event dropped due to not being matched by \`allowUrls\` option.
14
14
  Event: ${Vt(s)}.
15
- Url: ${Qr(s)}`),!0}return!1}function jT(s,e){return e!=null&&e.length?JN(s).some(t=>ro(t,e)):!1}function yT(s,e){if(!(e!=null&&e.length))return!1;const t=s.transaction;return t?ro(t,e):!1}function TT(s,e){if(!(e!=null&&e.length))return!1;const t=Qr(s);return t?ro(t,e):!1}function dT(s,e){if(!(e!=null&&e.length))return!0;const t=Qr(s);return t?ro(t,e):!0}function DT(s=[]){for(let e=s.length-1;e>=0;e--){const t=s[e];if(t&&t.filename!=="<anonymous>"&&t.filename!=="[native code]")return t.filename||null}return null}function Qr(s){var e,t;try{const i=[...((e=s.exception)==null?void 0:e.values)??[]].reverse().find(o=>{var n,a,c;return((n=o.mechanism)==null?void 0:n.parent_id)===void 0&&((c=(a=o.stacktrace)==null?void 0:a.frames)==null?void 0:c.length)}),r=(t=i==null?void 0:i.stacktrace)==null?void 0:t.frames;return r?DT(r):null}catch{return X&&R.error(`Cannot extract url for event ${Vt(s)}`),null}}function hT(s){var e,t;return(t=(e=s.exception)==null?void 0:e.values)!=null&&t.length?!s.message&&!s.exception.values.some(i=>i.stacktrace||i.type&&i.type!=="Error"||i.value):!1}function zT(s,e,t,i,r,o){var a;if(!((a=r.exception)!=null&&a.values)||!o||!bt(o.originalException,Error))return;const n=r.exception.values.length>0?r.exception.values[r.exception.values.length-1]:void 0;n&&(r.exception.values=zn(s,e,i,o.originalException,t,r.exception.values,n,0))}function zn(s,e,t,i,r,o,n,a){if(o.length>=t+1)return o;let c=[...o];if(bt(i[r],Error)){mc(n,a);const l=s(e,i[r]),N=c.length;Oc(l,r,N,a),c=zn(s,e,t,i[r],r,[l,...c],l,N)}return Array.isArray(i.errors)&&i.errors.forEach((l,N)=>{if(bt(l,Error)){mc(n,a);const u=s(e,l),L=c.length;Oc(u,`errors[${N}]`,L,a),c=zn(s,e,t,l,r,[u,...c],u,L)}}),c}function mc(s,e){s.mechanism=s.mechanism||{type:"generic",handled:!0},s.mechanism={...s.mechanism,...s.type==="AggregateError"&&{is_exception_group:!0},exception_id:e}}function Oc(s,e,t,i){s.mechanism=s.mechanism||{type:"generic",handled:!0},s.mechanism={...s.mechanism,type:"chained",source:e,exception_id:t,parent_id:i}}function wT(s){const e="console";rs(e,s),os(e,CT)}function CT(){"console"in ie&&gn.forEach(function(s){s in ie.console&&Ue(ie.console,s,function(e){return Yr[s]=e,function(...t){Ke("console",{args:t,level:s});const r=Yr[s];r==null||r.apply(ie.console,t)}})})}function IT(s){return s==="warn"?"warning":["fatal","error","warning","log","info","debug"].includes(s)?s:"log"}const pT="Dedupe",AT=()=>{let s;return{name:pT,processEvent(e){if(e.type)return e;try{if(mT(e,s))return X&&R.warn("Event dropped due to being a duplicate of previously captured event."),null}catch{}return s=e}}},VN=AT;function mT(s,e){return e?!!(OT(s,e)||ET(s,e)):!1}function OT(s,e){const t=s.message,i=e.message;return!(!t&&!i||t&&!i||!t&&i||t!==i||!XN(s,e)||!ZN(s,e))}function ET(s,e){const t=Ec(e),i=Ec(s);return!(!t||!i||t.type!==i.type||t.value!==i.value||!XN(s,e)||!ZN(s,e))}function ZN(s,e){let t=uc(s),i=uc(e);if(!t&&!i)return!0;if(t&&!i||!t&&i||(t=t,i=i,i.length!==t.length))return!1;for(let r=0;r<i.length;r++){const o=i[r],n=t[r];if(o.filename!==n.filename||o.lineno!==n.lineno||o.colno!==n.colno||o.function!==n.function)return!1}return!0}function XN(s,e){let t=s.fingerprint,i=e.fingerprint;if(!t&&!i)return!0;if(t&&!i||!t&&i)return!1;t=t,i=i;try{return t.join("")===i.join("")}catch{return!1}}function Ec(s){var e;return((e=s.exception)==null?void 0:e.values)&&s.exception.values[0]}function ko(s){if(!s)return{};const e=s.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!e)return{};const t=e[6]||"",i=e[8]||"";return{host:e[4],path:e[5],protocol:e[2],search:t,hash:i,relative:e[5]+t+i}}function KN(s){if(s!==void 0)return s>=400&&s<500?"warning":s>=500?"error":void 0}const Si=ie;function fT(){return"history"in Si&&!!Si.history}function xT(){if(!("fetch"in Si))return!1;try{return new Headers,new Request("http://www.example.com"),new Response,!0}catch{return!1}}function wn(s){return s&&/^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(s.toString())}function _T(){var t;if(typeof EdgeRuntime=="string")return!0;if(!xT())return!1;if(wn(Si.fetch))return!0;let s=!1;const e=Si.document;if(e&&typeof e.createElement=="function")try{const i=e.createElement("iframe");i.hidden=!0,e.head.appendChild(i),(t=i.contentWindow)!=null&&t.fetch&&(s=wn(i.contentWindow.fetch)),e.head.removeChild(i)}catch(i){X&&R.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",i)}return s}function ST(s,e){const t="fetch";rs(t,s),os(t,()=>kT(void 0,e))}function kT(s,e=!1){e&&!_T()||Ue(ie,"fetch",function(t){return function(...i){const r=new Error,{method:o,url:n}=YT(i),a={args:i,fetchData:{method:o,url:n},startTimestamp:zt()*1e3,virtualError:r,headers:vT(i)};return Ke("fetch",{...a}),t.apply(ie,i).then(async c=>(Ke("fetch",{...a,endTimestamp:zt()*1e3,response:c}),c),c=>{if(Ke("fetch",{...a,endTimestamp:zt()*1e3,error:c}),ya(c)&&c.stack===void 0&&(c.stack=r.stack,Kt(c,"framesToPop",1)),c instanceof TypeError&&(c.message==="Failed to fetch"||c.message==="Load failed"||c.message==="NetworkError when attempting to fetch resource."))try{const l=new URL(a.fetchData.url);c.message=`${c.message} (${l.host})`}catch{}throw c})}})}function Cn(s,e){return!!s&&typeof s=="object"&&!!s[e]}function fc(s){return typeof s=="string"?s:s?Cn(s,"url")?s.url:s.toString?s.toString():"":""}function YT(s){if(s.length===0)return{method:"GET",url:""};if(s.length===2){const[t,i]=s;return{url:fc(t),method:Cn(i,"method")?String(i.method).toUpperCase():"GET"}}const e=s[0];return{url:fc(e),method:Cn(e,"method")?String(e.method).toUpperCase():"GET"}}function vT(s){const[e,t]=s;try{if(typeof t=="object"&&t!==null&&"headers"in t&&t.headers)return new Headers(t.headers);if(Gg(e))return new Headers(e.headers)}catch{}}function bT(){return"npm"}const Le=ie;let In=0;function qN(){return In>0}function QT(){In++,setTimeout(()=>{In--})}function Hs(s,e={}){function t(r){return typeof r=="function"}if(!t(s))return s;try{const r=s.__sentry_wrapped__;if(r)return typeof r=="function"?r:s;if(za(s))return s}catch{return s}const i=function(...r){try{const o=r.map(n=>Hs(n,e));return s.apply(this,o)}catch(o){throw QT(),jj(n=>{n.addEventProcessor(a=>(e.mechanism&&(jn(a,void 0),Rs(a,e.mechanism)),a.extra={...a.extra,arguments:r},a)),Ey(o)}),o}};try{for(const r in s)Object.prototype.hasOwnProperty.call(s,r)&&(i[r]=s[r])}catch{}IN(i,s),Kt(s,"__sentry_wrapped__",i);try{Object.getOwnPropertyDescriptor(i,"name").configurable&&Object.defineProperty(i,"name",{get(){return s.name}})}catch{}return i}function UT(){const s=ha(),{referrer:e}=Le.document||{},{userAgent:t}=Le.navigator||{},i={...e&&{Referer:e},...t&&{"User-Agent":t}};return{url:s,headers:i}}function pa(s,e){const t=Aa(s,e),i={type:JT(e),value:RT(e)};return t.length&&(i.stacktrace={frames:t}),i.type===void 0&&i.value===""&&(i.value="Unrecoverable error caught"),i}function $T(s,e,t,i){const r=Ee(),o=r==null?void 0:r.getOptions().normalizeDepth,n=ZT(e),a={__serialized__:QN(e,o)};if(n)return{exception:{values:[pa(s,n)]},extra:a};const c={exception:{values:[{type:so(e)?e.constructor.name:i?"UnhandledRejection":"Error",value:HT(e,{isUnhandledRejection:i})}]},extra:a};if(t){const l=Aa(s,t);l.length&&(c.exception.values[0].stacktrace={frames:l})}return c}function Yo(s,e){return{exception:{values:[pa(s,e)]}}}function Aa(s,e){const t=e.stacktrace||e.stack||"",i=WT(e),r=BT(e);try{return s(t,i,r)}catch{}return[]}const PT=/Minified React error #\d+;/i;function WT(s){return s&&PT.test(s.message)?1:0}function BT(s){return typeof s.framesToPop=="number"?s.framesToPop:0}function e0(s){return typeof WebAssembly<"u"&&typeof WebAssembly.Exception<"u"?s instanceof WebAssembly.Exception:!1}function JT(s){const e=s==null?void 0:s.name;return!e&&e0(s)?s.message&&Array.isArray(s.message)&&s.message.length==2?s.message[0]:"WebAssembly.Exception":e}function RT(s){const e=s==null?void 0:s.message;return e0(s)?Array.isArray(s.message)&&s.message.length==2?s.message[1]:"wasm exception":e?e.error&&typeof e.error.message=="string"?e.error.message:e:"No error message"}function FT(s,e,t,i){const r=(t==null?void 0:t.syntheticException)||void 0,o=ma(s,e,r,i);return Rs(o),o.level="error",t!=null&&t.event_id&&(o.event_id=t.event_id),es(o)}function GT(s,e,t="info",i,r){const o=(i==null?void 0:i.syntheticException)||void 0,n=pn(s,e,o,r);return n.level=t,i!=null&&i.event_id&&(n.event_id=i.event_id),es(n)}function ma(s,e,t,i,r){let o;if(zN(e)&&e.error)return Yo(s,e.error);if(HM(e)||Bg(e)){const n=e;if("stack"in e)o=Yo(s,e);else{const a=n.name||(HM(n)?"DOMError":"DOMException"),c=n.message?`${a}: ${n.message}`:a;o=pn(s,c,t,i),jn(o,c)}return"code"in n&&(o.tags={...o.tags,"DOMException.code":`${n.code}`}),o}return ya(e)?Yo(s,e):_i(e)||so(e)?(o=$T(s,e,t,r),Rs(o,{synthetic:!0}),o):(o=pn(s,e,t,i),jn(o,`${e}`),Rs(o,{synthetic:!0}),o)}function pn(s,e,t,i){const r={};if(i&&t){const o=Aa(s,t);o.length&&(r.exception={values:[{value:e,stacktrace:{frames:o}}]}),Rs(r,{synthetic:!0})}if(Ta(e)){const{__sentry_template_string__:o,__sentry_template_values__:n}=e;return r.logentry={message:o,params:n},r}return r.message=e,r}function HT(s,{isUnhandledRejection:e}){const t=ej(s),i=e?"promise rejection":"exception";return zN(s)?`Event \`ErrorEvent\` captured as ${i} with message \`${s.message}\``:so(s)?`Event \`${VT(s)}\` (type=${s.type}) captured as ${i}`:`Object captured as ${i} with keys: ${t}`}function VT(s){try{const e=Object.getPrototypeOf(s);return e?e.constructor.name:void 0}catch{}}function ZT(s){for(const e in s)if(Object.prototype.hasOwnProperty.call(s,e)){const t=s[e];if(t instanceof Error)return t}}const XT=5e3;class KT extends Py{constructor(e){const t=qT(e),i=Le.SENTRY_SDK_SOURCE||bT();oT(t,"browser",["browser"],i),super(t);const{sendDefaultPii:r,sendClientReports:o,_experiments:n}=this._options,a=n==null?void 0:n.enableLogs;Le.document&&(o||a)&&Le.document.addEventListener("visibilitychange",()=>{Le.document.visibilityState==="hidden"&&(o&&this._flushOutcomes(),a&&So(this))}),a&&(this.on("flush",()=>{So(this)}),this.on("afterCaptureLog",()=>{this._logFlushIdleTimeout&&clearTimeout(this._logFlushIdleTimeout),this._logFlushIdleTimeout=setTimeout(()=>{So(this)},XT)})),r&&(this.on("postprocessEvent",iT),this.on("beforeSendSession",rT))}eventFromException(e,t){return FT(this._options.stackParser,e,t,this._options.attachStacktrace)}eventFromMessage(e,t="info",i){return GT(this._options.stackParser,e,t,i,this._options.attachStacktrace)}_prepareEvent(e,t,i,r){return e.platform=e.platform||"javascript",super._prepareEvent(e,t,i,r)}}function qT(s){var e;return{release:typeof __SENTRY_RELEASE__=="string"?__SENTRY_RELEASE__:(e=Le.SENTRY_RELEASE)==null?void 0:e.id,sendClientReports:!0,parentSpanIsAlwaysRootSpan:!0,...s}}const ed=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,Ae=ie,td=1e3;let xc,An,mn;function sd(s){const e="dom";rs(e,s),os(e,id)}function id(){if(!Ae.document)return;const s=Ke.bind(null,"dom"),e=_c(s,!0);Ae.document.addEventListener("click",e,!1),Ae.document.addEventListener("keypress",e,!1),["EventTarget","Node"].forEach(t=>{var o,n;const r=(o=Ae[t])==null?void 0:o.prototype;(n=r==null?void 0:r.hasOwnProperty)!=null&&n.call(r,"addEventListener")&&(Ue(r,"addEventListener",function(a){return function(c,l,N){if(c==="click"||c=="keypress")try{const u=this.__sentry_instrumentation_handlers__=this.__sentry_instrumentation_handlers__||{},L=u[c]=u[c]||{refCount:0};if(!L.handler){const g=_c(s);L.handler=g,a.call(this,c,g,N)}L.refCount++}catch{}return a.call(this,c,l,N)}}),Ue(r,"removeEventListener",function(a){return function(c,l,N){if(c==="click"||c=="keypress")try{const u=this.__sentry_instrumentation_handlers__||{},L=u[c];L&&(L.refCount--,L.refCount<=0&&(a.call(this,c,L.handler,N),L.handler=void 0,delete u[c]),Object.keys(u).length===0&&delete this.__sentry_instrumentation_handlers__)}catch{}return a.call(this,c,l,N)}}))})}function rd(s){if(s.type!==An)return!1;try{if(!s.target||s.target._sentryId!==mn)return!1}catch{}return!0}function od(s,e){return s!=="keypress"?!1:e!=null&&e.tagName?!(e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.isContentEditable):!0}function _c(s,e=!1){return t=>{if(!t||t._sentryCaptured)return;const i=nd(t);if(od(t.type,i))return;Kt(t,"_sentryCaptured",!0),i&&!i._sentryId&&Kt(i,"_sentryId",Je());const r=t.type==="keypress"?"input":t.type;rd(t)||(s({event:t,name:r,global:e}),An=t.type,mn=i?i._sentryId:void 0),clearTimeout(xc),xc=Ae.setTimeout(()=>{mn=void 0,An=void 0},td)}}function nd(s){try{return s.target}catch{return null}}let ur;function t0(s){const e="history";rs(e,s),os(e,ad)}function ad(){if(Ae.addEventListener("popstate",()=>{const e=Ae.location.href,t=ur;if(ur=e,t===e)return;Ke("history",{from:t,to:e})}),!fT())return;function s(e){return function(...t){const i=t.length>2?t[2]:void 0;if(i){const r=ur,o=Md(String(i));if(ur=o,r===o)return e.apply(this,t);Ke("history",{from:r,to:o})}return e.apply(this,t)}}Ue(Ae.history,"pushState",s),Ue(Ae.history,"replaceState",s)}function Md(s){try{return new URL(s,Ae.location.origin).toString()}catch{return s}}const Or={};function cd(s){const e=Or[s];if(e)return e;let t=Ae[s];if(wn(t))return Or[s]=t.bind(Ae);const i=Ae.document;if(i&&typeof i.createElement=="function")try{const r=i.createElement("iframe");r.hidden=!0,i.head.appendChild(r);const o=r.contentWindow;o!=null&&o[s]&&(t=o[s]),i.head.removeChild(r)}catch(r){ed&&R.warn(`Could not create sandbox iframe for ${s} check, bailing to window.${s}: `,r)}return t&&(Or[s]=t.bind(Ae))}function Sc(s){Or[s]=void 0}const hi="__sentry_xhr_v3__";function ud(s){const e="xhr";rs(e,s),os(e,ld)}function ld(){if(!Ae.XMLHttpRequest)return;const s=XMLHttpRequest.prototype;s.open=new Proxy(s.open,{apply(e,t,i){const r=new Error,o=zt()*1e3,n=ht(i[0])?i[0].toUpperCase():void 0,a=Nd(i[1]);if(!n||!a)return e.apply(t,i);t[hi]={method:n,url:a,request_headers:{}},n==="POST"&&a.match(/sentry_key/)&&(t.__sentry_own_request__=!0);const c=()=>{const l=t[hi];if(l&&t.readyState===4){try{l.status_code=t.status}catch{}const N={endTimestamp:zt()*1e3,startTimestamp:o,xhr:t,virtualError:r};Ke("xhr",N)}};return"onreadystatechange"in t&&typeof t.onreadystatechange=="function"?t.onreadystatechange=new Proxy(t.onreadystatechange,{apply(l,N,u){return c(),l.apply(N,u)}}):t.addEventListener("readystatechange",c),t.setRequestHeader=new Proxy(t.setRequestHeader,{apply(l,N,u){const[L,g]=u,y=N[hi];return y&&ht(L)&&ht(g)&&(y.request_headers[L.toLowerCase()]=g),l.apply(N,u)}}),e.apply(t,i)}}),s.send=new Proxy(s.send,{apply(e,t,i){const r=t[hi];if(!r)return e.apply(t,i);i[0]!==void 0&&(r.body=i[0]);const o={startTimestamp:zt()*1e3,xhr:t};return Ke("xhr",o),e.apply(t,i)}})}function Nd(s){if(ht(s))return s;try{return s.toString()}catch{}}function Ld(s,e=cd("fetch")){let t=0,i=0;function r(o){const n=o.body.length;t+=n,i++;const a={body:o.body,method:"POST",referrerPolicy:"strict-origin",headers:s.headers,keepalive:t<=6e4&&i<15,...s.fetchOptions};if(!e)return Sc("fetch"),br("No fetch implementation available");try{return e(s.url,a).then(c=>(t-=n,i--,{statusCode:c.status,headers:{"x-sentry-rate-limits":c.headers.get("X-Sentry-Rate-Limits"),"retry-after":c.headers.get("Retry-After")}}))}catch(c){return Sc("fetch"),t-=n,i--,br(c)}}return sT(s,r)}const gd=30,jd=50;function On(s,e,t,i){const r={filename:s,function:e==="<anonymous>"?qt:e,in_app:!0};return t!==void 0&&(r.lineno=t),i!==void 0&&(r.colno=i),r}const yd=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Td=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,dd=/\((\S*)(?::(\d+))(?::(\d+))\)/,Dd=s=>{const e=yd.exec(s);if(e){const[,i,r,o]=e;return On(i,qt,+r,+o)}const t=Td.exec(s);if(t){if(t[2]&&t[2].indexOf("eval")===0){const n=dd.exec(t[2]);n&&(t[2]=n[1],t[3]=n[2],t[4]=n[3])}const[r,o]=s0(t[1]||qt,t[2]);return On(o,r,t[3]?+t[3]:void 0,t[4]?+t[4]:void 0)}},hd=[gd,Dd],zd=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,wd=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Cd=s=>{const e=zd.exec(s);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){const o=wd.exec(e[3]);o&&(e[1]=e[1]||"eval",e[3]=o[1],e[4]=o[2],e[5]="")}let i=e[3],r=e[1]||qt;return[r,i]=s0(r,i),On(i,r,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}},Id=[jd,Cd],pd=[hd,Id],Ad=YN(...pd),s0=(s,e)=>{const t=s.indexOf("safari-extension")!==-1,i=s.indexOf("safari-web-extension")!==-1;return t||i?[s.indexOf("@")!==-1?s.split("@")[0]:qt,t?`safari-extension:${e}`:`safari-web-extension:${e}`]:[s,e]},no=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,lr=1024,md="Breadcrumbs",Od=(s={})=>{const e={console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0,...s};return{name:md,setup(t){e.console&&wT(_d(t)),e.dom&&sd(xd(t,e.dom)),e.xhr&&ud(Sd(t)),e.fetch&&ST(kd(t)),e.history&&t0(Yd(t)),e.sentry&&t.on("beforeSendEvent",fd(t))}}},Ed=Od;function fd(s){return function(t){Ee()===s&&ts({category:`sentry.${t.type==="transaction"?"transaction":"event"}`,event_id:t.event_id,level:t.level,message:Vt(t)},{event:t})}}function xd(s,e){return function(i){if(Ee()!==s)return;let r,o,n=typeof e=="object"?e.serializeAttribute:void 0,a=typeof e=="object"&&typeof e.maxStringLength=="number"?e.maxStringLength:void 0;a&&a>lr&&(no&&R.warn(`\`dom.maxStringLength\` cannot exceed ${lr}, but a value of ${a} was configured. Sentry will use ${lr} instead.`),a=lr),typeof n=="string"&&(n=[n]);try{const l=i.event,N=vd(l)?l.target:l;r=CN(N,{keyAttrs:n,maxStringLength:a}),o=Zg(N)}catch{r="<unknown>"}if(r.length===0)return;const c={category:`ui.${i.name}`,message:r};o&&(c.data={"ui.component_name":o}),ts(c,{event:i.event,name:i.name,global:i.global})}}function _d(s){return function(t){if(Ee()!==s)return;const i={category:"console",data:{arguments:t.args,logger:"console"},level:IT(t.level),message:VM(t.args," ")};if(t.level==="assert")if(t.args[0]===!1)i.message=`Assertion failed: ${VM(t.args.slice(1)," ")||"console.assert"}`,i.data.arguments=t.args.slice(1);else return;ts(i,{input:t.args,level:t.level})}}function Sd(s){return function(t){if(Ee()!==s)return;const{startTimestamp:i,endTimestamp:r}=t,o=t.xhr[hi];if(!i||!r||!o)return;const{method:n,url:a,status_code:c,body:l}=o,N={method:n,url:a,status_code:c},u={xhr:t.xhr,input:l,startTimestamp:i,endTimestamp:r},L={category:"xhr",data:N,type:"http",level:KN(c)};s.emit("beforeOutgoingRequestBreadcrumb",L,u),ts(L,u)}}function kd(s){return function(t){if(Ee()!==s)return;const{startTimestamp:i,endTimestamp:r}=t;if(r&&!(t.fetchData.url.match(/sentry_key/)&&t.fetchData.method==="POST"))if(t.fetchData.method,t.fetchData.url,t.error){const o=t.fetchData,n={data:t.error,input:t.args,startTimestamp:i,endTimestamp:r},a={category:"fetch",data:o,level:"error",type:"http"};s.emit("beforeOutgoingRequestBreadcrumb",a,n),ts(a,n)}else{const o=t.response,n={...t.fetchData,status_code:o==null?void 0:o.status};t.fetchData.request_body_size,t.fetchData.response_body_size,o==null||o.status;const a={input:t.args,response:o,startTimestamp:i,endTimestamp:r},c={category:"fetch",data:n,type:"http",level:KN(n.status_code)};s.emit("beforeOutgoingRequestBreadcrumb",c,a),ts(c,a)}}}function Yd(s){return function(t){if(Ee()!==s)return;let i=t.from,r=t.to;const o=ko(Le.location.href);let n=i?ko(i):void 0;const a=ko(r);n!=null&&n.path||(n=o),o.protocol===a.protocol&&o.host===a.host&&(r=a.relative),o.protocol===n.protocol&&o.host===n.host&&(i=n.relative),ts({category:"navigation",data:{from:i,to:r}})}}function vd(s){return!!s&&!!s.target}const bd=["EventTarget","Window","Node","ApplicationCache","AudioTrackList","BroadcastChannel","ChannelMergerNode","CryptoOperation","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","KeyOperation","MediaController","MessagePort","ModalWindow","Notification","SVGElementInstance","Screen","SharedWorker","TextTrack","TextTrackCue","TextTrackList","WebSocket","WebSocketWorker","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"],Qd="BrowserApiErrors",Ud=(s={})=>{const e={XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,unregisterOriginalCallbacks:!1,...s};return{name:Qd,setupOnce(){e.setTimeout&&Ue(Le,"setTimeout",kc),e.setInterval&&Ue(Le,"setInterval",kc),e.requestAnimationFrame&&Ue(Le,"requestAnimationFrame",Pd),e.XMLHttpRequest&&"XMLHttpRequest"in Le&&Ue(XMLHttpRequest.prototype,"send",Wd);const t=e.eventTarget;t&&(Array.isArray(t)?t:bd).forEach(r=>Bd(r,e))}}},$d=Ud;function kc(s){return function(...e){const t=e[0];return e[0]=Hs(t,{mechanism:{data:{function:Qt(s)},handled:!1,type:"instrument"}}),s.apply(this,e)}}function Pd(s){return function(e){return s.apply(this,[Hs(e,{mechanism:{data:{function:"requestAnimationFrame",handler:Qt(s)},handled:!1,type:"instrument"}})])}}function Wd(s){return function(...e){const t=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(r=>{r in t&&typeof t[r]=="function"&&Ue(t,r,function(o){const n={mechanism:{data:{function:r,handler:Qt(o)},handled:!1,type:"instrument"}},a=za(o);return a&&(n.mechanism.data.handler=Qt(a)),Hs(o,n)})}),s.apply(this,e)}}function Bd(s,e){var r,o;const i=(r=Le[s])==null?void 0:r.prototype;(o=i==null?void 0:i.hasOwnProperty)!=null&&o.call(i,"addEventListener")&&(Ue(i,"addEventListener",function(n){return function(a,c,l){try{Jd(c)&&(c.handleEvent=Hs(c.handleEvent,{mechanism:{data:{function:"handleEvent",handler:Qt(c),target:s},handled:!1,type:"instrument"}}))}catch{}return e.unregisterOriginalCallbacks&&Rd(this,a,c),n.apply(this,[a,Hs(c,{mechanism:{data:{function:"addEventListener",handler:Qt(c),target:s},handled:!1,type:"instrument"}}),l])}}),Ue(i,"removeEventListener",function(n){return function(a,c,l){try{const N=c.__sentry_wrapped__;N&&n.call(this,a,N,l)}catch{}return n.call(this,a,c,l)}}))}function Jd(s){return typeof s.handleEvent=="function"}function Rd(s,e,t){s&&typeof s=="object"&&"removeEventListener"in s&&typeof s.removeEventListener=="function"&&s.removeEventListener(e,t)}const Fd=()=>({name:"BrowserSession",setupOnce(){if(typeof Le.document>"u"){no&&R.warn("Using the `browserSessionIntegration` in non-browser environments is not supported.");return}yc({ignoreDuration:!0}),Tc(),t0(({from:s,to:e})=>{s!==void 0&&s!==e&&(yc({ignoreDuration:!0}),Tc())})}}),Gd="GlobalHandlers",Hd=(s={})=>{const e={onerror:!0,onunhandledrejection:!0,...s};return{name:Gd,setupOnce(){Error.stackTraceLimit=50},setup(t){e.onerror&&(Zd(t),Yc("onerror")),e.onunhandledrejection&&(Xd(t),Yc("onunhandledrejection"))}}},Vd=Hd;function Zd(s){$j(e=>{const{stackParser:t,attachStacktrace:i}=i0();if(Ee()!==s||qN())return;const{msg:r,url:o,line:n,column:a,error:c}=e,l=eD(ma(t,c||r,void 0,i,!1),o,n,a);l.level="error",$N(l,{originalException:c,mechanism:{handled:!1,type:"onerror"}})})}function Xd(s){Wj(e=>{const{stackParser:t,attachStacktrace:i}=i0();if(Ee()!==s||qN())return;const r=Kd(e),o=da(r)?qd(r):ma(t,r,void 0,i,!0);o.level="error",$N(o,{originalException:r,mechanism:{handled:!1,type:"onunhandledrejection"}})})}function Kd(s){if(da(s))return s;try{if("reason"in s)return s.reason;if("detail"in s&&"reason"in s.detail)return s.detail.reason}catch{}return s}function qd(s){return{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(s)}`}]}}}function eD(s,e,t,i){const r=s.exception=s.exception||{},o=r.values=r.values||[],n=o[0]=o[0]||{},a=n.stacktrace=n.stacktrace||{},c=a.frames=a.frames||[],l=i,N=t,u=ht(e)&&e.length>0?e:ha();return c.length===0&&c.push({colno:l,filename:u,function:qt,in_app:!0,lineno:N}),s}function Yc(s){no&&R.log(`Global Handler attached: ${s}`)}function i0(){const s=Ee();return(s==null?void 0:s.getOptions())||{stackParser:()=>[],attachStacktrace:!1}}const tD=()=>({name:"HttpContext",preprocessEvent(s){var i;if(!Le.navigator&&!Le.location&&!Le.document)return;const e=UT(),t={...e.headers,...(i=s.request)==null?void 0:i.headers};s.request={...e,...s.request,headers:t}}}),sD="cause",iD=5,rD="LinkedErrors",oD=(s={})=>{const e=s.limit||iD,t=s.key||sD;return{name:rD,preprocessEvent(i,r,o){const n=o.getOptions();zT(pa,n.stackParser,t,e,i,r)}}},nD=oD;function aD(){return MD()?(no&&Zs(()=>{console.error("[Sentry] You cannot use Sentry.init() in a browser extension, see: https://docs.sentry.io/platforms/javascript/best-practices/browser-extensions/")}),!0):!1}function MD(){var o;if(typeof Le.window>"u")return!1;const s=Le;if(s.nw)return!1;const e=s.chrome||s.browser;if(!((o=e==null?void 0:e.runtime)!=null&&o.id))return!1;const t=ha(),i=["chrome-extension","moz-extension","ms-browser-extension","safari-web-extension"];return!(Le===Le.top&&i.some(n=>t.startsWith(`${n}://`)))}function cD(s){return[LT(),cT(),$d(),Ed(),Vd(),nD(),VN(),tD(),Fd()]}function uD(s={}){const e=!s.skipBrowserExtensionCheck&&aD(),t={...s,enabled:e?!1:s.enabled,stackParser:Qj(s.stackParser||Ad),integrations:vy({integrations:s.integrations,defaultIntegrations:s.defaultIntegrations==null?cD():s.defaultIntegrations}),transport:s.transport||Ld};return Gy(KT,t)}function lD(){console.log(`
15
+ Url: ${Qr(s)}`),!0}return!1}function jT(s,e){return e!=null&&e.length?JN(s).some(t=>ro(t,e)):!1}function yT(s,e){if(!(e!=null&&e.length))return!1;const t=s.transaction;return t?ro(t,e):!1}function TT(s,e){if(!(e!=null&&e.length))return!1;const t=Qr(s);return t?ro(t,e):!1}function dT(s,e){if(!(e!=null&&e.length))return!0;const t=Qr(s);return t?ro(t,e):!0}function DT(s=[]){for(let e=s.length-1;e>=0;e--){const t=s[e];if(t&&t.filename!=="<anonymous>"&&t.filename!=="[native code]")return t.filename||null}return null}function Qr(s){var e,t;try{const i=[...((e=s.exception)==null?void 0:e.values)??[]].reverse().find(o=>{var n,a,c;return((n=o.mechanism)==null?void 0:n.parent_id)===void 0&&((c=(a=o.stacktrace)==null?void 0:a.frames)==null?void 0:c.length)}),r=(t=i==null?void 0:i.stacktrace)==null?void 0:t.frames;return r?DT(r):null}catch{return X&&R.error(`Cannot extract url for event ${Vt(s)}`),null}}function hT(s){var e,t;return(t=(e=s.exception)==null?void 0:e.values)!=null&&t.length?!s.message&&!s.exception.values.some(i=>i.stacktrace||i.type&&i.type!=="Error"||i.value):!1}function zT(s,e,t,i,r,o){var a;if(!((a=r.exception)!=null&&a.values)||!o||!Qt(o.originalException,Error))return;const n=r.exception.values.length>0?r.exception.values[r.exception.values.length-1]:void 0;n&&(r.exception.values=zn(s,e,i,o.originalException,t,r.exception.values,n,0))}function zn(s,e,t,i,r,o,n,a){if(o.length>=t+1)return o;let c=[...o];if(Qt(i[r],Error)){mc(n,a);const l=s(e,i[r]),N=c.length;Oc(l,r,N,a),c=zn(s,e,t,i[r],r,[l,...c],l,N)}return Array.isArray(i.errors)&&i.errors.forEach((l,N)=>{if(Qt(l,Error)){mc(n,a);const u=s(e,l),L=c.length;Oc(u,`errors[${N}]`,L,a),c=zn(s,e,t,l,r,[u,...c],u,L)}}),c}function mc(s,e){s.mechanism=s.mechanism||{type:"generic",handled:!0},s.mechanism={...s.mechanism,...s.type==="AggregateError"&&{is_exception_group:!0},exception_id:e}}function Oc(s,e,t,i){s.mechanism=s.mechanism||{type:"generic",handled:!0},s.mechanism={...s.mechanism,type:"chained",source:e,exception_id:t,parent_id:i}}function wT(s){const e="console";rs(e,s),os(e,CT)}function CT(){"console"in ie&&gn.forEach(function(s){s in ie.console&&Ue(ie.console,s,function(e){return Yr[s]=e,function(...t){Ke("console",{args:t,level:s});const r=Yr[s];r==null||r.apply(ie.console,t)}})})}function IT(s){return s==="warn"?"warning":["fatal","error","warning","log","info","debug"].includes(s)?s:"log"}const pT="Dedupe",AT=()=>{let s;return{name:pT,processEvent(e){if(e.type)return e;try{if(mT(e,s))return X&&R.warn("Event dropped due to being a duplicate of previously captured event."),null}catch{}return s=e}}},VN=AT;function mT(s,e){return e?!!(OT(s,e)||ET(s,e)):!1}function OT(s,e){const t=s.message,i=e.message;return!(!t&&!i||t&&!i||!t&&i||t!==i||!XN(s,e)||!ZN(s,e))}function ET(s,e){const t=Ec(e),i=Ec(s);return!(!t||!i||t.type!==i.type||t.value!==i.value||!XN(s,e)||!ZN(s,e))}function ZN(s,e){let t=ZM(s),i=ZM(e);if(!t&&!i)return!0;if(t&&!i||!t&&i||(t=t,i=i,i.length!==t.length))return!1;for(let r=0;r<i.length;r++){const o=i[r],n=t[r];if(o.filename!==n.filename||o.lineno!==n.lineno||o.colno!==n.colno||o.function!==n.function)return!1}return!0}function XN(s,e){let t=s.fingerprint,i=e.fingerprint;if(!t&&!i)return!0;if(t&&!i||!t&&i)return!1;t=t,i=i;try{return t.join("")===i.join("")}catch{return!1}}function Ec(s){var e;return((e=s.exception)==null?void 0:e.values)&&s.exception.values[0]}function ko(s){if(!s)return{};const e=s.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!e)return{};const t=e[6]||"",i=e[8]||"";return{host:e[4],path:e[5],protocol:e[2],search:t,hash:i,relative:e[5]+t+i}}function KN(s){if(s!==void 0)return s>=400&&s<500?"warning":s>=500?"error":void 0}const Si=ie;function fT(){return"history"in Si&&!!Si.history}function xT(){if(!("fetch"in Si))return!1;try{return new Headers,new Request("http://www.example.com"),new Response,!0}catch{return!1}}function wn(s){return s&&/^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(s.toString())}function _T(){var t;if(typeof EdgeRuntime=="string")return!0;if(!xT())return!1;if(wn(Si.fetch))return!0;let s=!1;const e=Si.document;if(e&&typeof e.createElement=="function")try{const i=e.createElement("iframe");i.hidden=!0,e.head.appendChild(i),(t=i.contentWindow)!=null&&t.fetch&&(s=wn(i.contentWindow.fetch)),e.head.removeChild(i)}catch(i){X&&R.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",i)}return s}function ST(s,e){const t="fetch";rs(t,s),os(t,()=>kT(void 0,e))}function kT(s,e=!1){e&&!_T()||Ue(ie,"fetch",function(t){return function(...i){const r=new Error,{method:o,url:n}=YT(i),a={args:i,fetchData:{method:o,url:n},startTimestamp:zt()*1e3,virtualError:r,headers:vT(i)};return Ke("fetch",{...a}),t.apply(ie,i).then(async c=>(Ke("fetch",{...a,endTimestamp:zt()*1e3,response:c}),c),c=>{if(Ke("fetch",{...a,endTimestamp:zt()*1e3,error:c}),ya(c)&&c.stack===void 0&&(c.stack=r.stack,qt(c,"framesToPop",1)),c instanceof TypeError&&(c.message==="Failed to fetch"||c.message==="Load failed"||c.message==="NetworkError when attempting to fetch resource."))try{const l=new URL(a.fetchData.url);c.message=`${c.message} (${l.host})`}catch{}throw c})}})}function Cn(s,e){return!!s&&typeof s=="object"&&!!s[e]}function fc(s){return typeof s=="string"?s:s?Cn(s,"url")?s.url:s.toString?s.toString():"":""}function YT(s){if(s.length===0)return{method:"GET",url:""};if(s.length===2){const[t,i]=s;return{url:fc(t),method:Cn(i,"method")?String(i.method).toUpperCase():"GET"}}const e=s[0];return{url:fc(e),method:Cn(e,"method")?String(e.method).toUpperCase():"GET"}}function vT(s){const[e,t]=s;try{if(typeof t=="object"&&t!==null&&"headers"in t&&t.headers)return new Headers(t.headers);if(tj(e))return new Headers(e.headers)}catch{}}function bT(){return"npm"}const Le=ie;let In=0;function qN(){return In>0}function QT(){In++,setTimeout(()=>{In--})}function Hs(s,e={}){function t(r){return typeof r=="function"}if(!t(s))return s;try{const r=s.__sentry_wrapped__;if(r)return typeof r=="function"?r:s;if(za(s))return s}catch{return s}const i=function(...r){try{const o=r.map(n=>Hs(n,e));return s.apply(this,o)}catch(o){throw QT(),zj(n=>{n.addEventProcessor(a=>(e.mechanism&&(jn(a,void 0),Rs(a,e.mechanism)),a.extra={...a.extra,arguments:r},a)),Ey(o)}),o}};try{for(const r in s)Object.prototype.hasOwnProperty.call(s,r)&&(i[r]=s[r])}catch{}AN(i,s),qt(s,"__sentry_wrapped__",i);try{Object.getOwnPropertyDescriptor(i,"name").configurable&&Object.defineProperty(i,"name",{get(){return s.name}})}catch{}return i}function UT(){const s=ha(),{referrer:e}=Le.document||{},{userAgent:t}=Le.navigator||{},i={...e&&{Referer:e},...t&&{"User-Agent":t}};return{url:s,headers:i}}function pa(s,e){const t=Aa(s,e),i={type:JT(e),value:RT(e)};return t.length&&(i.stacktrace={frames:t}),i.type===void 0&&i.value===""&&(i.value="Unrecoverable error caught"),i}function $T(s,e,t,i){const r=Ee(),o=r==null?void 0:r.getOptions().normalizeDepth,n=ZT(e),a={__serialized__:QN(e,o)};if(n)return{exception:{values:[pa(s,n)]},extra:a};const c={exception:{values:[{type:so(e)?e.constructor.name:i?"UnhandledRejection":"Error",value:HT(e,{isUnhandledRejection:i})}]},extra:a};if(t){const l=Aa(s,t);l.length&&(c.exception.values[0].stacktrace={frames:l})}return c}function Yo(s,e){return{exception:{values:[pa(s,e)]}}}function Aa(s,e){const t=e.stacktrace||e.stack||"",i=WT(e),r=BT(e);try{return s(t,i,r)}catch{}return[]}const PT=/Minified React error #\d+;/i;function WT(s){return s&&PT.test(s.message)?1:0}function BT(s){return typeof s.framesToPop=="number"?s.framesToPop:0}function e0(s){return typeof WebAssembly<"u"&&typeof WebAssembly.Exception<"u"?s instanceof WebAssembly.Exception:!1}function JT(s){const e=s==null?void 0:s.name;return!e&&e0(s)?s.message&&Array.isArray(s.message)&&s.message.length==2?s.message[0]:"WebAssembly.Exception":e}function RT(s){const e=s==null?void 0:s.message;return e0(s)?Array.isArray(s.message)&&s.message.length==2?s.message[1]:"wasm exception":e?e.error&&typeof e.error.message=="string"?e.error.message:e:"No error message"}function FT(s,e,t,i){const r=(t==null?void 0:t.syntheticException)||void 0,o=ma(s,e,r,i);return Rs(o),o.level="error",t!=null&&t.event_id&&(o.event_id=t.event_id),es(o)}function GT(s,e,t="info",i,r){const o=(i==null?void 0:i.syntheticException)||void 0,n=pn(s,e,o,r);return n.level=t,i!=null&&i.event_id&&(n.event_id=i.event_id),es(n)}function ma(s,e,t,i,r){let o;if(CN(e)&&e.error)return Yo(s,e.error);if(KM(e)||Xg(e)){const n=e;if("stack"in e)o=Yo(s,e);else{const a=n.name||(KM(n)?"DOMError":"DOMException"),c=n.message?`${a}: ${n.message}`:a;o=pn(s,c,t,i),jn(o,c)}return"code"in n&&(o.tags={...o.tags,"DOMException.code":`${n.code}`}),o}return ya(e)?Yo(s,e):_i(e)||so(e)?(o=$T(s,e,t,r),Rs(o,{synthetic:!0}),o):(o=pn(s,e,t,i),jn(o,`${e}`),Rs(o,{synthetic:!0}),o)}function pn(s,e,t,i){const r={};if(i&&t){const o=Aa(s,t);o.length&&(r.exception={values:[{value:e,stacktrace:{frames:o}}]}),Rs(r,{synthetic:!0})}if(Ta(e)){const{__sentry_template_string__:o,__sentry_template_values__:n}=e;return r.logentry={message:o,params:n},r}return r.message=e,r}function HT(s,{isUnhandledRejection:e}){const t=nj(s),i=e?"promise rejection":"exception";return CN(s)?`Event \`ErrorEvent\` captured as ${i} with message \`${s.message}\``:so(s)?`Event \`${VT(s)}\` (type=${s.type}) captured as ${i}`:`Object captured as ${i} with keys: ${t}`}function VT(s){try{const e=Object.getPrototypeOf(s);return e?e.constructor.name:void 0}catch{}}function ZT(s){for(const e in s)if(Object.prototype.hasOwnProperty.call(s,e)){const t=s[e];if(t instanceof Error)return t}}const XT=5e3;class KT extends Py{constructor(e){const t=qT(e),i=Le.SENTRY_SDK_SOURCE||bT();oT(t,"browser",["browser"],i),super(t);const{sendDefaultPii:r,sendClientReports:o,_experiments:n}=this._options,a=n==null?void 0:n.enableLogs;Le.document&&(o||a)&&Le.document.addEventListener("visibilitychange",()=>{Le.document.visibilityState==="hidden"&&(o&&this._flushOutcomes(),a&&So(this))}),a&&(this.on("flush",()=>{So(this)}),this.on("afterCaptureLog",()=>{this._logFlushIdleTimeout&&clearTimeout(this._logFlushIdleTimeout),this._logFlushIdleTimeout=setTimeout(()=>{So(this)},XT)})),r&&(this.on("postprocessEvent",iT),this.on("beforeSendSession",rT))}eventFromException(e,t){return FT(this._options.stackParser,e,t,this._options.attachStacktrace)}eventFromMessage(e,t="info",i){return GT(this._options.stackParser,e,t,i,this._options.attachStacktrace)}_prepareEvent(e,t,i,r){return e.platform=e.platform||"javascript",super._prepareEvent(e,t,i,r)}}function qT(s){var e;return{release:typeof __SENTRY_RELEASE__=="string"?__SENTRY_RELEASE__:(e=Le.SENTRY_RELEASE)==null?void 0:e.id,sendClientReports:!0,parentSpanIsAlwaysRootSpan:!0,...s}}const ed=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,Ae=ie,td=1e3;let xc,An,mn;function sd(s){const e="dom";rs(e,s),os(e,id)}function id(){if(!Ae.document)return;const s=Ke.bind(null,"dom"),e=_c(s,!0);Ae.document.addEventListener("click",e,!1),Ae.document.addEventListener("keypress",e,!1),["EventTarget","Node"].forEach(t=>{var o,n;const r=(o=Ae[t])==null?void 0:o.prototype;(n=r==null?void 0:r.hasOwnProperty)!=null&&n.call(r,"addEventListener")&&(Ue(r,"addEventListener",function(a){return function(c,l,N){if(c==="click"||c=="keypress")try{const u=this.__sentry_instrumentation_handlers__=this.__sentry_instrumentation_handlers__||{},L=u[c]=u[c]||{refCount:0};if(!L.handler){const g=_c(s);L.handler=g,a.call(this,c,g,N)}L.refCount++}catch{}return a.call(this,c,l,N)}}),Ue(r,"removeEventListener",function(a){return function(c,l,N){if(c==="click"||c=="keypress")try{const u=this.__sentry_instrumentation_handlers__||{},L=u[c];L&&(L.refCount--,L.refCount<=0&&(a.call(this,c,L.handler,N),L.handler=void 0,delete u[c]),Object.keys(u).length===0&&delete this.__sentry_instrumentation_handlers__)}catch{}return a.call(this,c,l,N)}}))})}function rd(s){if(s.type!==An)return!1;try{if(!s.target||s.target._sentryId!==mn)return!1}catch{}return!0}function od(s,e){return s!=="keypress"?!1:e!=null&&e.tagName?!(e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.isContentEditable):!0}function _c(s,e=!1){return t=>{if(!t||t._sentryCaptured)return;const i=nd(t);if(od(t.type,i))return;qt(t,"_sentryCaptured",!0),i&&!i._sentryId&&qt(i,"_sentryId",Je());const r=t.type==="keypress"?"input":t.type;rd(t)||(s({event:t,name:r,global:e}),An=t.type,mn=i?i._sentryId:void 0),clearTimeout(xc),xc=Ae.setTimeout(()=>{mn=void 0,An=void 0},td)}}function nd(s){try{return s.target}catch{return null}}let ur;function t0(s){const e="history";rs(e,s),os(e,ad)}function ad(){if(Ae.addEventListener("popstate",()=>{const e=Ae.location.href,t=ur;if(ur=e,t===e)return;Ke("history",{from:t,to:e})}),!fT())return;function s(e){return function(...t){const i=t.length>2?t[2]:void 0;if(i){const r=ur,o=Md(String(i));if(ur=o,r===o)return e.apply(this,t);Ke("history",{from:r,to:o})}return e.apply(this,t)}}Ue(Ae.history,"pushState",s),Ue(Ae.history,"replaceState",s)}function Md(s){try{return new URL(s,Ae.location.origin).toString()}catch{return s}}const Or={};function cd(s){const e=Or[s];if(e)return e;let t=Ae[s];if(wn(t))return Or[s]=t.bind(Ae);const i=Ae.document;if(i&&typeof i.createElement=="function")try{const r=i.createElement("iframe");r.hidden=!0,i.head.appendChild(r);const o=r.contentWindow;o!=null&&o[s]&&(t=o[s]),i.head.removeChild(r)}catch(r){ed&&R.warn(`Could not create sandbox iframe for ${s} check, bailing to window.${s}: `,r)}return t&&(Or[s]=t.bind(Ae))}function Sc(s){Or[s]=void 0}const hi="__sentry_xhr_v3__";function ud(s){const e="xhr";rs(e,s),os(e,ld)}function ld(){if(!Ae.XMLHttpRequest)return;const s=XMLHttpRequest.prototype;s.open=new Proxy(s.open,{apply(e,t,i){const r=new Error,o=zt()*1e3,n=ht(i[0])?i[0].toUpperCase():void 0,a=Nd(i[1]);if(!n||!a)return e.apply(t,i);t[hi]={method:n,url:a,request_headers:{}},n==="POST"&&a.match(/sentry_key/)&&(t.__sentry_own_request__=!0);const c=()=>{const l=t[hi];if(l&&t.readyState===4){try{l.status_code=t.status}catch{}const N={endTimestamp:zt()*1e3,startTimestamp:o,xhr:t,virtualError:r};Ke("xhr",N)}};return"onreadystatechange"in t&&typeof t.onreadystatechange=="function"?t.onreadystatechange=new Proxy(t.onreadystatechange,{apply(l,N,u){return c(),l.apply(N,u)}}):t.addEventListener("readystatechange",c),t.setRequestHeader=new Proxy(t.setRequestHeader,{apply(l,N,u){const[L,g]=u,y=N[hi];return y&&ht(L)&&ht(g)&&(y.request_headers[L.toLowerCase()]=g),l.apply(N,u)}}),e.apply(t,i)}}),s.send=new Proxy(s.send,{apply(e,t,i){const r=t[hi];if(!r)return e.apply(t,i);i[0]!==void 0&&(r.body=i[0]);const o={startTimestamp:zt()*1e3,xhr:t};return Ke("xhr",o),e.apply(t,i)}})}function Nd(s){if(ht(s))return s;try{return s.toString()}catch{}}function Ld(s,e=cd("fetch")){let t=0,i=0;function r(o){const n=o.body.length;t+=n,i++;const a={body:o.body,method:"POST",referrerPolicy:"strict-origin",headers:s.headers,keepalive:t<=6e4&&i<15,...s.fetchOptions};if(!e)return Sc("fetch"),br("No fetch implementation available");try{return e(s.url,a).then(c=>(t-=n,i--,{statusCode:c.status,headers:{"x-sentry-rate-limits":c.headers.get("X-Sentry-Rate-Limits"),"retry-after":c.headers.get("Retry-After")}}))}catch(c){return Sc("fetch"),t-=n,i--,br(c)}}return sT(s,r)}const gd=30,jd=50;function On(s,e,t,i){const r={filename:s,function:e==="<anonymous>"?Kt:e,in_app:!0};return t!==void 0&&(r.lineno=t),i!==void 0&&(r.colno=i),r}const yd=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Td=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,dd=/\((\S*)(?::(\d+))(?::(\d+))\)/,Dd=s=>{const e=yd.exec(s);if(e){const[,i,r,o]=e;return On(i,Kt,+r,+o)}const t=Td.exec(s);if(t){if(t[2]&&t[2].indexOf("eval")===0){const n=dd.exec(t[2]);n&&(t[2]=n[1],t[3]=n[2],t[4]=n[3])}const[r,o]=s0(t[1]||Kt,t[2]);return On(o,r,t[3]?+t[3]:void 0,t[4]?+t[4]:void 0)}},hd=[gd,Dd],zd=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,wd=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Cd=s=>{const e=zd.exec(s);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){const o=wd.exec(e[3]);o&&(e[1]=e[1]||"eval",e[3]=o[1],e[4]=o[2],e[5]="")}let i=e[3],r=e[1]||Kt;return[r,i]=s0(r,i),On(i,r,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}},Id=[jd,Cd],pd=[hd,Id],Ad=zN(...pd),s0=(s,e)=>{const t=s.indexOf("safari-extension")!==-1,i=s.indexOf("safari-web-extension")!==-1;return t||i?[s.indexOf("@")!==-1?s.split("@")[0]:Kt,t?`safari-extension:${e}`:`safari-web-extension:${e}`]:[s,e]},no=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,lr=1024,md="Breadcrumbs",Od=(s={})=>{const e={console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0,...s};return{name:md,setup(t){e.console&&wT(_d(t)),e.dom&&sd(xd(t,e.dom)),e.xhr&&ud(Sd(t)),e.fetch&&ST(kd(t)),e.history&&t0(Yd(t)),e.sentry&&t.on("beforeSendEvent",fd(t))}}},Ed=Od;function fd(s){return function(t){Ee()===s&&ts({category:`sentry.${t.type==="transaction"?"transaction":"event"}`,event_id:t.event_id,level:t.level,message:Vt(t)},{event:t})}}function xd(s,e){return function(i){if(Ee()!==s)return;let r,o,n=typeof e=="object"?e.serializeAttribute:void 0,a=typeof e=="object"&&typeof e.maxStringLength=="number"?e.maxStringLength:void 0;a&&a>lr&&(no&&R.warn(`\`dom.maxStringLength\` cannot exceed ${lr}, but a value of ${a} was configured. Sentry will use ${lr} instead.`),a=lr),typeof n=="string"&&(n=[n]);try{const l=i.event,N=vd(l)?l.target:l;r=pN(N,{keyAttrs:n,maxStringLength:a}),o=rj(N)}catch{r="<unknown>"}if(r.length===0)return;const c={category:`ui.${i.name}`,message:r};o&&(c.data={"ui.component_name":o}),ts(c,{event:i.event,name:i.name,global:i.global})}}function _d(s){return function(t){if(Ee()!==s)return;const i={category:"console",data:{arguments:t.args,logger:"console"},level:IT(t.level),message:qM(t.args," ")};if(t.level==="assert")if(t.args[0]===!1)i.message=`Assertion failed: ${qM(t.args.slice(1)," ")||"console.assert"}`,i.data.arguments=t.args.slice(1);else return;ts(i,{input:t.args,level:t.level})}}function Sd(s){return function(t){if(Ee()!==s)return;const{startTimestamp:i,endTimestamp:r}=t,o=t.xhr[hi];if(!i||!r||!o)return;const{method:n,url:a,status_code:c,body:l}=o,N={method:n,url:a,status_code:c},u={xhr:t.xhr,input:l,startTimestamp:i,endTimestamp:r},L={category:"xhr",data:N,type:"http",level:KN(c)};s.emit("beforeOutgoingRequestBreadcrumb",L,u),ts(L,u)}}function kd(s){return function(t){if(Ee()!==s)return;const{startTimestamp:i,endTimestamp:r}=t;if(r&&!(t.fetchData.url.match(/sentry_key/)&&t.fetchData.method==="POST"))if(t.fetchData.method,t.fetchData.url,t.error){const o=t.fetchData,n={data:t.error,input:t.args,startTimestamp:i,endTimestamp:r},a={category:"fetch",data:o,level:"error",type:"http"};s.emit("beforeOutgoingRequestBreadcrumb",a,n),ts(a,n)}else{const o=t.response,n={...t.fetchData,status_code:o==null?void 0:o.status};t.fetchData.request_body_size,t.fetchData.response_body_size,o==null||o.status;const a={input:t.args,response:o,startTimestamp:i,endTimestamp:r},c={category:"fetch",data:n,type:"http",level:KN(n.status_code)};s.emit("beforeOutgoingRequestBreadcrumb",c,a),ts(c,a)}}}function Yd(s){return function(t){if(Ee()!==s)return;let i=t.from,r=t.to;const o=ko(Le.location.href);let n=i?ko(i):void 0;const a=ko(r);n!=null&&n.path||(n=o),o.protocol===a.protocol&&o.host===a.host&&(r=a.relative),o.protocol===n.protocol&&o.host===n.host&&(i=n.relative),ts({category:"navigation",data:{from:i,to:r}})}}function vd(s){return!!s&&!!s.target}const bd=["EventTarget","Window","Node","ApplicationCache","AudioTrackList","BroadcastChannel","ChannelMergerNode","CryptoOperation","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","KeyOperation","MediaController","MessagePort","ModalWindow","Notification","SVGElementInstance","Screen","SharedWorker","TextTrack","TextTrackCue","TextTrackList","WebSocket","WebSocketWorker","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"],Qd="BrowserApiErrors",Ud=(s={})=>{const e={XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,unregisterOriginalCallbacks:!1,...s};return{name:Qd,setupOnce(){e.setTimeout&&Ue(Le,"setTimeout",kc),e.setInterval&&Ue(Le,"setInterval",kc),e.requestAnimationFrame&&Ue(Le,"requestAnimationFrame",Pd),e.XMLHttpRequest&&"XMLHttpRequest"in Le&&Ue(XMLHttpRequest.prototype,"send",Wd);const t=e.eventTarget;t&&(Array.isArray(t)?t:bd).forEach(r=>Bd(r,e))}}},$d=Ud;function kc(s){return function(...e){const t=e[0];return e[0]=Hs(t,{mechanism:{data:{function:bt(s)},handled:!1,type:"instrument"}}),s.apply(this,e)}}function Pd(s){return function(e){return s.apply(this,[Hs(e,{mechanism:{data:{function:"requestAnimationFrame",handler:bt(s)},handled:!1,type:"instrument"}})])}}function Wd(s){return function(...e){const t=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(r=>{r in t&&typeof t[r]=="function"&&Ue(t,r,function(o){const n={mechanism:{data:{function:r,handler:bt(o)},handled:!1,type:"instrument"}},a=za(o);return a&&(n.mechanism.data.handler=bt(a)),Hs(o,n)})}),s.apply(this,e)}}function Bd(s,e){var r,o;const i=(r=Le[s])==null?void 0:r.prototype;(o=i==null?void 0:i.hasOwnProperty)!=null&&o.call(i,"addEventListener")&&(Ue(i,"addEventListener",function(n){return function(a,c,l){try{Jd(c)&&(c.handleEvent=Hs(c.handleEvent,{mechanism:{data:{function:"handleEvent",handler:bt(c),target:s},handled:!1,type:"instrument"}}))}catch{}return e.unregisterOriginalCallbacks&&Rd(this,a,c),n.apply(this,[a,Hs(c,{mechanism:{data:{function:"addEventListener",handler:bt(c),target:s},handled:!1,type:"instrument"}}),l])}}),Ue(i,"removeEventListener",function(n){return function(a,c,l){try{const N=c.__sentry_wrapped__;N&&n.call(this,a,N,l)}catch{}return n.call(this,a,c,l)}}))}function Jd(s){return typeof s.handleEvent=="function"}function Rd(s,e,t){s&&typeof s=="object"&&"removeEventListener"in s&&typeof s.removeEventListener=="function"&&s.removeEventListener(e,t)}const Fd=()=>({name:"BrowserSession",setupOnce(){if(typeof Le.document>"u"){no&&R.warn("Using the `browserSessionIntegration` in non-browser environments is not supported.");return}yc({ignoreDuration:!0}),Tc(),t0(({from:s,to:e})=>{s!==void 0&&s!==e&&(yc({ignoreDuration:!0}),Tc())})}}),Gd="GlobalHandlers",Hd=(s={})=>{const e={onerror:!0,onunhandledrejection:!0,...s};return{name:Gd,setupOnce(){Error.stackTraceLimit=50},setup(t){e.onerror&&(Zd(t),Yc("onerror")),e.onunhandledrejection&&(Xd(t),Yc("onunhandledrejection"))}}},Vd=Hd;function Zd(s){Gg(e=>{const{stackParser:t,attachStacktrace:i}=i0();if(Ee()!==s||qN())return;const{msg:r,url:o,line:n,column:a,error:c}=e,l=eD(ma(t,c||r,void 0,i,!1),o,n,a);l.level="error",$N(l,{originalException:c,mechanism:{handled:!1,type:"onerror"}})})}function Xd(s){Vg(e=>{const{stackParser:t,attachStacktrace:i}=i0();if(Ee()!==s||qN())return;const r=Kd(e),o=da(r)?qd(r):ma(t,r,void 0,i,!0);o.level="error",$N(o,{originalException:r,mechanism:{handled:!1,type:"onunhandledrejection"}})})}function Kd(s){if(da(s))return s;try{if("reason"in s)return s.reason;if("detail"in s&&"reason"in s.detail)return s.detail.reason}catch{}return s}function qd(s){return{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(s)}`}]}}}function eD(s,e,t,i){const r=s.exception=s.exception||{},o=r.values=r.values||[],n=o[0]=o[0]||{},a=n.stacktrace=n.stacktrace||{},c=a.frames=a.frames||[],l=i,N=t,u=ht(e)&&e.length>0?e:ha();return c.length===0&&c.push({colno:l,filename:u,function:Kt,in_app:!0,lineno:N}),s}function Yc(s){no&&R.log(`Global Handler attached: ${s}`)}function i0(){const s=Ee();return(s==null?void 0:s.getOptions())||{stackParser:()=>[],attachStacktrace:!1}}const tD=()=>({name:"HttpContext",preprocessEvent(s){var i;if(!Le.navigator&&!Le.location&&!Le.document)return;const e=UT(),t={...e.headers,...(i=s.request)==null?void 0:i.headers};s.request={...e,...s.request,headers:t}}}),sD="cause",iD=5,rD="LinkedErrors",oD=(s={})=>{const e=s.limit||iD,t=s.key||sD;return{name:rD,preprocessEvent(i,r,o){const n=o.getOptions();zT(pa,n.stackParser,t,e,i,r)}}},nD=oD;function aD(){return MD()?(no&&Vs(()=>{console.error("[Sentry] You cannot use Sentry.init() in a browser extension, see: https://docs.sentry.io/platforms/javascript/best-practices/browser-extensions/")}),!0):!1}function MD(){var o;if(typeof Le.window>"u")return!1;const s=Le;if(s.nw)return!1;const e=s.chrome||s.browser;if(!((o=e==null?void 0:e.runtime)!=null&&o.id))return!1;const t=ha(),i=["chrome-extension","moz-extension","ms-browser-extension","safari-web-extension"];return!(Le===Le.top&&i.some(n=>t.startsWith(`${n}://`)))}function cD(s){return[LT(),cT(),$d(),Ed(),Vd(),nD(),VN(),tD(),Fd()]}function uD(s={}){const e=!s.skipBrowserExtensionCheck&&aD(),t={...s,enabled:e?!1:s.enabled,stackParser:Rg(s.stackParser||Ad),integrations:vy({integrations:s.integrations,defaultIntegrations:s.defaultIntegrations==null?cD():s.defaultIntegrations}),transport:s.transport||Ld};return Gy(KT,t)}function lD(){console.log(`
16
16
  ██╗ ██████╗ ██████╗ ██████╗ ██████╗ ██╗ ██╗███████╗██████╗
17
17
  ██║██╔═══██╗██╔══██╗██╔══██╗██╔═══██╗██║ ██╔╝██╔════╝██╔══██╗
18
18
  ██║██║ ██║██████╔╝██████╔╝██║ ██║█████╔╝ █████╗ ██████╔╝
@@ -445,7 +445,7 @@ body {
445
445
  C231.591,212.679,237.828,191.414,234.21,169.856z`})))}function Ko(s){return M.createElement("svg",{viewBox:"1 -10 511.99999 511",...s},M.createElement("g",{fill:"currentColor"},M.createElement("path",{d:"M 405.5 150 C 405.5 232.566406 338.566406 299.5 256 299.5 C 173.433594 299.5 106.5 232.566406 106.5 150 C 106.5 67.433594 173.433594 0.5 256 0.5 C 338.566406 0.5 405.5 67.433594 405.5 150 Z M 405.5 150 ",style:{stroke:"none",fillRule:"nonzero",fill:"rgb(25.882353%,75.294118%,88.627451%)",fillOpacity:1}}),M.createElement("path",{d:"M 512 342.921875 C 512 425.488281 445.066406 492.421875 362.5 492.421875 C 279.933594 492.421875 213 425.488281 213 342.921875 C 213 260.355469 279.933594 193.421875 362.5 193.421875 C 445.066406 193.421875 512 260.355469 512 342.921875 Z M 512 342.921875 ",style:{stroke:"none",fillRule:"nonzero",fill:"rgb(100%,81.568627%,38.039216%)",fillOpacity:1}}),M.createElement("path",{d:"M 220.746094 295.308594 C 232.050781 298.039062 243.855469 299.5 256 299.5 C 321.917969 299.5 377.871094 256.835938 397.753906 197.613281 C 386.449219 194.878906 374.644531 193.421875 362.5 193.421875 C 296.582031 193.421875 240.628906 236.085938 220.746094 295.308594 Z M 220.746094 295.308594 ",style:{stroke:"none",fillRule:"nonzero",fill:"rgb(28.627451%,74.117647%,56.470588%)",fillOpacity:1}}),M.createElement("path",{d:"M 299 342.921875 C 299 425.488281 232.066406 492.421875 149.5 492.421875 C 66.933594 492.421875 0 425.488281 0 342.921875 C 0 260.355469 66.933594 193.421875 149.5 193.421875 C 232.066406 193.421875 299 260.355469 299 342.921875 Z M 299 342.921875 ",style:{stroke:"none",fillRule:"nonzero",fill:"rgb(98.039216%,43.921569%,69.803922%)",fillOpacity:1}}),M.createElement("path",{d:"M 114.246094 197.613281 C 134.128906 256.835938 190.082031 299.5 256 299.5 C 268.144531 299.5 279.949219 298.039062 291.253906 295.308594 C 271.371094 236.085938 215.417969 193.421875 149.5 193.421875 C 137.355469 193.421875 125.550781 194.878906 114.246094 197.613281 Z M 114.246094 197.613281 ",style:{stroke:"none",fillRule:"nonzero",fill:"rgb(68.627451%,48.235294%,77.647059%)",fillOpacity:1}}),M.createElement("path",{d:"M 213 342.921875 C 213 383.800781 229.414062 420.839844 256 447.828125 C 282.585938 420.839844 299 383.800781 299 342.921875 C 299 302.042969 282.585938 265.003906 256 238.015625 C 229.414062 265.003906 213 302.042969 213 342.921875 Z M 213 342.921875 ",style:{stroke:"none",fillRule:"nonzero",fill:"rgb(93.72549%,38.039216%,13.333333%)",fillOpacity:1}}),M.createElement("path",{d:"M 291.253906 295.320312 C 279.949219 298.046875 268.140625 299.5 256 299.5 C 243.859375 299.5 232.050781 298.046875 220.746094 295.320312 C 228.058594 273.542969 240.242188 254.015625 256 238.015625 C 271.757812 254.015625 283.941406 273.542969 291.253906 295.320312 Z M 291.253906 295.320312 ",style:{stroke:"none",fillRule:"nonzero",fill:"rgb(100%,100%,100%)",fillOpacity:1}})))}function I_e(s){return M.createElement("svg",{width:32,height:32,viewBox:"0 0 365.445 365.445",...s},M.createElement("g",{fill:"currentColor"},M.createElement("path",{d:"M146.7 162.775h-26.8a6.655 6.655 0 0 0-6.647 6.647v26.602a6.653 6.653 0 0 0 6.647 6.646h26.8a6.654 6.654 0 0 0 6.647-6.646v-26.602a6.655 6.655 0 0 0-6.647-6.647zM245.547 162.775h-26.801a6.653 6.653 0 0 0-6.646 6.647v26.602a6.652 6.652 0 0 0 6.646 6.646h26.801a6.654 6.654 0 0 0 6.646-6.646v-26.602a6.655 6.655 0 0 0-6.646-6.647z"})),M.createElement("path",{d:"M345.445 1.204H20c-11.046 0-20 8.954-20 20v323.037c0 11.045 8.954 20 20 20h325.445c11.045 0 20-8.955 20-20V21.204c0-11.045-8.953-20-20-20zM182.723 287.66c-57.955 0-104.937-46.981-104.937-104.937 0-57.957 46.982-104.938 104.937-104.938S287.66 124.767 287.66 182.723 240.678 287.66 182.723 287.66z",fill:"currentColor"}))}function p_e(s){return M.createElement("svg",{width:32,height:32,viewBox:"0 0 45.659 45.659",...s},M.createElement("path",{fill:"currentColor",d:"M30.619 27.309V7.781C30.619 3.49 27.124 0 22.833 0c-4.29 0-7.785 3.491-7.785 7.78v19.528a10.722 10.722 0 0 0-3.05 7.522c0 5.972 4.857 10.828 10.829 10.828 5.97 0 10.834-4.856 10.834-10.828 0-2.918-1.141-5.572-3.042-7.521zM22.825 42.66c-4.316 0-7.824-3.512-7.824-7.828 0-2.527 1.174-4.779 3.077-6.211V16.237h3.372c.552 0 1-.47 1-1.022 0-.553-.448-1.021-1-1.021h-3.372v-2.466h3.372c.552 0 1-.434 1-.986a.989.989 0 0 0-1-.986h-3.372V7.78c0-2.636 2.119-4.78 4.754-4.78 2.637 0 4.756 2.144 4.756 4.781v20.871c1.903 1.434 3.047 3.671 3.047 6.18 0 4.316-3.494 7.828-7.81 7.828z"}),M.createElement("path",{fill:"currentColor",d:"M25.334 30.463V18.632h-5.002v11.831a4.973 4.973 0 0 0-2.537 4.369 5.038 5.038 0 0 0 5.038 5.046 5.034 5.034 0 0 0 5.034-5.046c0-1.866-.982-3.495-2.533-4.369z"}))}function A_e(s){return M.createElement("svg",{viewBox:"0 0 297 297",...s},M.createElement("g",null,M.createElement("path",{fill:"currentColor",d:"m243.404,138.042c-5.775,0-10.458,4.683-10.458,10.458 0,46.564-37.883,84.446-84.446,84.446s-84.446-37.882-84.446-84.446 37.883-84.446 84.446-84.446c5.775,0 10.458-4.683 10.458-10.458s-4.683-10.457-10.458-10.457c-58.097,0-105.361,47.265-105.361,105.361s47.264,105.361 105.361,105.361 105.361-47.264 105.361-105.361c0-5.775-4.681-10.458-10.457-10.458z"}),M.createElement("path",{fill:"currentColor",d:"m142.963,121.344l-20.272-30.41c-3.203-4.807-9.695-6.104-14.502-2.9-4.805,3.202-6.104,9.695-2.9,14.502l20.279,30.422c-3.015,4.436-4.78,9.787-4.78,15.543 0,15.281 12.432,27.713 27.713,27.713 15.281,0 27.713-12.432 27.713-27.713 0-15.281-12.432-27.713-27.713-27.713-1.897-0.001-3.749,0.191-5.538,0.556zm12.335,27.156c0,3.748-3.05,6.798-6.798,6.798s-6.798-3.05-6.798-6.798 3.05-6.798 6.798-6.798 6.798,3.05 6.798,6.798z"}),M.createElement("path",{fill:"currentColor",d:"M148.5,0C66.617,0,0,66.617,0,148.5S66.617,297,148.5,297S297,230.383,297,148.5S230.383,0,148.5,0z M158.958,275.653 v-6.366c0-5.775-4.683-10.458-10.458-10.458c-5.775,0-10.458,4.683-10.458,10.458v6.366 c-62.027-5.056-111.64-54.668-116.695-116.695h6.366c5.775,0,10.458-4.683,10.458-10.458s-4.683-10.458-10.458-10.458h-6.366 c5.056-62.027,54.668-111.64,116.695-116.695v6.366c0,5.775,4.683,10.458,10.458,10.458c5.775,0,10.458-4.683,10.458-10.458v-6.366 c62.027,5.056,111.64,54.668,116.695,116.695h-6.366c-5.775,0-10.458,4.683-10.458,10.458s4.683,10.458,10.458,10.458h6.366 C270.598,220.985,220.985,270.598,158.958,275.653z"})))}function m_e(s){return M.createElement("svg",{viewBox:"0 0 361 361",...s},M.createElement("path",{d:"M267.826 263.303c0 3.91-3.156 7.082-7.05 7.082l-157.885.021c-3.894 0-7.05-3.171-7.05-7.083v-157.5c0-3.911 3.156-7.083 7.05-7.083l157.885-.021c3.894 0 7.05 3.172 7.05 7.083v157.501z",fill:"none",stroke:"currentColor",strokeWidth:10,strokeMiterlimit:10}),M.createElement("path",{d:"M228.5 205.584h6.639c2.726 0 5-2.274 5-5s-2.274-5-5-5H228.5c-2.726 0-5 2.274-5 5s2.274 5 5 5z",fill:"currentColor"}),M.createElement("path",{d:"M267.826 103.208c0 2.485-2.711 4.5-6.053 4.5l-159.88.021c-3.342 0-6.052-2.015-6.052-4.5v-9c0-2.485 2.71-4.5 6.052-4.5l159.88-.021c3.342 0 6.053 2.015 6.053 4.5v9z",fill:"none",stroke:"currentColor",strokeWidth:10,strokeMiterlimit:10}),M.createElement("path",{d:"M232.826 280.905c-.339 3.356-18.813-.782-20.919-1.06l-45.073-5.94-45.074-5.94-14.507-1.912c-1.456-.192-6.201-.055-6.412-2.147-.621-6.157 0-12.699 0-18.878v-43.5-82.076-5.13c0-2.551 5.184-1.015 6.412-.853l35.438 4.67 83.723 11.035c1.457.192 6.201.055 6.412 2.147.169 1.673 0 3.451 0 5.13v144.454c0 6.448 10 6.448 10 0V136.451v-5.13c0-7.619-6.137-10.793-12.673-11.655l-28.531-3.76-88.411-11.652-9.897-1.304c-6.555-.864-12.473 4.9-12.473 11.38v144.832c0 2.023-.071 4.04.132 6.053.717 7.111 6.606 9.563 12.759 10.374l76.827 10.125 39.896 5.259 9.697 1.278c7.063.931 12.011-4.778 12.673-11.346.648-6.415-9.358-6.352-9.999 0z",fill:"currentColor"}))}function p4(s){return M.createElement("svg",{width:361,height:361,viewBox:"0 0 361 361",...s},M.createElement("path",{d:"M267.826 263.303c0 3.91-3.156 7.082-7.05 7.082l-157.885.021c-3.894 0-7.05-3.171-7.05-7.083v-157.5c0-3.911 3.156-7.083 7.05-7.083l157.885-.021c3.894 0 7.05 3.172 7.05 7.083v157.501z",fill:"none",stroke:"currentColor",strokeWidth:10,strokeMiterlimit:10}),M.createElement("path",{d:"M267.826 103.208c0 2.485-2.711 4.5-6.053 4.5l-159.88.021c-3.342 0-6.052-2.015-6.052-4.5v-9c0-2.485 2.71-4.5 6.052-4.5l159.88-.021c3.342 0 6.053 2.015 6.053 4.5v9zM265.732 265.178c.584 2.887-1.629 5.228-4.942 5.228H103.457c-3.313 0-6.474-2.341-7.058-5.228L75.24 130.633c-.584-2.887 1.628-5.228 4.942-5.228h157.333c3.313 0 6.474 2.34 7.058 5.228l21.159 134.545z",fill:"none",stroke:"currentColor",strokeWidth:10,strokeMiterlimit:10}),M.createElement("path",{d:"M247.194 199.667h6.639c2.726 0 5-2.274 5-5s-2.274-5-5-5h-6.639c-2.726 0-5 2.274-5 5s2.275 5 5 5z",fill:"currentColor"}))}const O_e={"type-Device type":"Device type","type-airCondition":"Air conditioner","type-blind":"Blinds","type-blindButtons":"Blind controlled by buttons","type-button":"Button","type-buttonSensor":"Button with feedback","type-camera":"Camera","type-chart":"Chart","type-cie":"CIE color light","type-ct":"Color temperature","type-dimmer":"Dimmer","type-door":"Door","type-fireAlarm":"Fire alarm","type-floodAlarm":"Flood alarm","type-gate":"Gate","type-hue":"HUE light","type-humidity":"Humidity","type-illuminance":"Illuminance","type-image":"Image","type-info":"Information","type-instance":"Instance","type-light":"Light","type-location":"Position","type-locationOne":"Position as one state","type-lock":"Lock","type-media":"Media-player","type-motion":"Motion sensor","type-rgb":"RGB light","type-rgbSingle":"R,G,B light - single states","type-rgbwSingle":"R,G,B,W light - single states","type-slider":"Slider","type-socket":"Socket","type-temperature":"Temperature","type-thermostat":"Thermostat","type-url":"URL","type-vacuumCleaner":"Vacuum cleaner","type-valve":"Valve","type-volume":"Volume","type-volumeGroup":"Volume group","type-warning":"Warning","type-weatherCurrent":"Current weather","type-weatherForecast":"Weather forecast","type-window":"Window sensor","type-windowTilt":"Window tilt sensor"},E_e={"type-Device type":"Gerätetyp","type-airCondition":"Klimaanlage","type-blind":"Jalousien","type-blindButtons":"Jalousie über Tasten gesteuert","type-button":"Taste","type-buttonSensor":"Taste mit Rückmeldung","type-camera":"Kamera","type-chart":"Diagramm","type-cie":"CIE Farblicht","type-ct":"Farbtemperatur","type-dimmer":"Dimmer","type-door":"Türsensor","type-fireAlarm":"Feueralarm","type-floodAlarm":"Wasseralarm","type-gate":"Tor-Steuerung","type-hue":"HUE-Licht","type-humidity":"Feuchtigkeit","type-illuminance":"Beleuchtungsstärke","type-image":"Bild","type-info":"Information","type-instance":"Instanz","type-light":"Licht","type-location":"Position","type-locationOne":"Position als ein Zustand","type-lock":"Schloss","type-media":"Mediaplayer","type-motion":"Bewegungssensor","type-rgb":"RGB-Licht","type-rgbSingle":"R,G,B-Licht Einzelwerte","type-rgbwSingle":"R,G,B,W-Licht Einzelwerte","type-slider":"Schieberegler","type-socket":"Steckdose","type-temperature":"Temperatur","type-thermostat":"Thermostat","type-url":"URL","type-vacuumCleaner":"Staubsauger","type-valve":"Ventil","type-volume":"Lautstärke","type-volumeGroup":"Lautstärke-Gruppe","type-warning":"Warnung","type-weatherCurrent":"Aktuelle Wetterlage","type-weatherForecast":"Wettervorhersage","type-window":"Fenstersensor","type-windowTilt":"Fensterkippung-Sensor"},f_e={"type-Device type":"Тип устройства","type-airCondition":"Кондиционер","type-blind":"Рольставни/Жалюзи","type-blindButtons":"Жалюзи управляющиеся кнопками","type-button":"Кнопка","type-buttonSensor":"Кнопка с обратной связью","type-camera":"Камера","type-chart":"Диаграмма","type-cie":"CIE свет","type-ct":"Цветовая температура","type-dimmer":"Диммер","type-door":"Датчик положения двери","type-fireAlarm":"Датчик дыма","type-floodAlarm":"Датчик затопления","type-gate":"Ворота","type-hue":"HUE свет","type-humidity":"Влажность","type-illuminance":"Освещенность","type-image":"Изображение","type-info":"Информация","type-instance":"Инстанция","type-light":"Свет","type-location":"Местоположение","type-locationOne":"Позиция в одном состоянии","type-lock":"Замок","type-media":"Медиа-плейер","type-motion":"Датчик движения","type-rgb":"RGB свет","type-rgbSingle":"R,G,B как отдельные значение","type-rgbwSingle":"R,G,B,W как отдельные значение","type-slider":"Ползунок","type-socket":"Розетка","type-temperature":"Температура","type-thermostat":"Термостат","type-url":"URL","type-vacuumCleaner":"Пылесос","type-valve":"Вентиль","type-volume":"Громкость","type-volumeGroup":"Группа громкости","type-warning":"Предупреждение","type-weatherCurrent":"Актуальная погода","type-weatherForecast":"Прогноз погоды","type-window":"Датчик открытия окна","type-windowTilt":"Датчик наклона окна"},x_e={"type-Device type":"Tipo de dispositivo","type-airCondition":"Ar condicionado","type-blind":"persianas","type-blindButtons":"Persiana controlada por botões","type-button":"botão","type-buttonSensor":"Sensor de botão","type-camera":"câmera","type-chart":"Gráfico","type-cie":"Luz colorida CIE","type-ct":"Temperatura de cor","type-dimmer":"dimmer","type-door":"porta","type-fireAlarm":"alarme de incêndio","type-floodAlarm":"alarme de inundação","type-gate":"portão","type-hue":"Luz HUE","type-humidity":"umidade","type-illuminance":"Iluminância","type-image":"imagem","type-info":"informação","type-instance":"exemplo","type-light":"luz","type-location":"localização","type-locationOne":"Posição como um estado","type-lock":"trancar","type-media":"mídia","type-motion":"movimento","type-rgb":"Luz RGB","type-rgbSingle":"Luz RGB única","type-rgbwSingle":"RGBW como valor único","type-slider":"controle deslizante","type-socket":"soquete","type-temperature":"temperatura","type-thermostat":"termostato","type-url":"URL","type-vacuumCleaner":"Aspirador de pó","type-valve":"válvula","type-volume":"volume","type-volumeGroup":"grupo de volume","type-warning":"aviso","type-weatherCurrent":"clima atual","type-weatherForecast":"previsão do tempo","type-window":"janela","type-windowTilt":"inclinação da janela"},__e={"type-Device type":"Typ urządzenia","type-airCondition":"Klimatyzator","type-blind":"żaluzje","type-blindButtons":"Roleta sterowana przyciskami","type-button":"przycisk","type-buttonSensor":"Czujnik przycisku","type-camera":"kamera","type-chart":"Wykres","type-cie":"Światło kolorowe CIE","type-ct":"Temperatura barwowa","type-dimmer":"opornik","type-door":"drzwi","type-fireAlarm":"alarm pożarowy","type-floodAlarm":"alarm przeciwpowodziowy","type-gate":"brama","type-hue":"Światło HUE","type-humidity":"wilgotność","type-illuminance":"Natężenie oświetlenia","type-image":"obraz","type-info":"Informacje","type-instance":"przykład","type-light":"światło","type-location":"lokalizacja","type-locationOne":"Pozycja jako państwa","type-lock":"zamek","type-media":"głoska bezdźwięczna","type-motion":"ruch","type-rgb":"Światło RGB","type-rgbSingle":"Pojedyncze światło RGB","type-rgbwSingle":"RGBW jako pojedyncza wartość","type-slider":"suwak","type-socket":"gniazdo","type-temperature":"temperatura","type-thermostat":"termostat","type-url":"Adres URL","type-vacuumCleaner":"Odkurzacz","type-valve":"zawór","type-volume":"tom","type-volumeGroup":"grupa woluminów","type-warning":"ostrzeżenie","type-weatherCurrent":"aktualna pogoda","type-weatherForecast":"prognoza pogody","type-window":"okno","type-windowTilt":"pochylenie okna"},S_e={"type-Device type":"Type d'appareil","type-airCondition":"Climatiseur","type-blind":"stores","type-blindButtons":"Store commandé par boutons","type-button":"bouton","type-buttonSensor":"Capteur de bouton","type-camera":"caméra","type-chart":"Graphique","type-cie":"lumière colorée CIE","type-ct":"Température de couleur","type-dimmer":"variateur","type-door":"porte","type-fireAlarm":"alarme incendie","type-floodAlarm":"alarme d'inondation","type-gate":"grille","type-hue":"Lumière HUE","type-humidity":"humidité","type-illuminance":"Éclairement","type-image":"image","type-info":"informations","type-instance":"exemple","type-light":"lumière","type-location":"emplacement","type-locationOne":"Position en tant qu'État","type-lock":"verrouillage","type-media":"médias","type-motion":"mouvement","type-rgb":"lumière RVB","type-rgbSingle":"Lumière RVB simple","type-rgbwSingle":"RGBW comme valeur unique","type-slider":"curseur","type-socket":"douille","type-temperature":"température","type-thermostat":"thermostat","type-url":"URL","type-vacuumCleaner":"Aspirateur","type-valve":"soupape","type-volume":"volume","type-volumeGroup":"groupe de volumes","type-warning":"avertissement","type-weatherCurrent":"météo actuelle","type-weatherForecast":"prévisions météorologiques","type-window":"fenêtre","type-windowTilt":"inclinaison de la fenêtre"},k_e={"type-Device type":"Tipo di dispositivo","type-airCondition":"Condizionatore d'aria","type-blind":"tende","type-blindButtons":"Tenda controllata da pulsanti","type-button":"pulsante","type-buttonSensor":"Sensore del pulsante","type-camera":"telecamera","type-chart":"Grafico","type-cie":"Luce colorata CIE","type-ct":"Temperatura del colore","type-dimmer":"dimmer","type-door":"porta","type-fireAlarm":"allarme antincendio","type-floodAlarm":"allarme allagamento","type-gate":"cancello","type-hue":"Luce HUE","type-humidity":"umidità","type-illuminance":"Illuminamento","type-image":"immagine","type-info":"informazioni","type-instance":"esempio","type-light":"leggero","type-location":"posizione","type-locationOne":"Posizione come stato","type-lock":"serratura","type-media":"media","type-motion":"movimento","type-rgb":"luce RGB","type-rgbSingle":"Luce RGB singola","type-rgbwSingle":"RGBW come valore singolo","type-slider":"cursore","type-socket":"PRESA","type-temperature":"temperatura","type-thermostat":"termostato","type-url":"URL","type-vacuumCleaner":"Aspirapolvere","type-valve":"valvola","type-volume":"volume","type-volumeGroup":"gruppo di volumi","type-warning":"avvertimento","type-weatherCurrent":"meteo attuale","type-weatherForecast":"previsioni del tempo","type-window":"finestra","type-windowTilt":"inclinazione della finestra"},Y_e={"type-Device type":"Apparaattype","type-airCondition":"Airconditioner","type-blind":"jaloezieën","type-blindButtons":"Jaloezie bediend door knoppen","type-button":"knop","type-buttonSensor":"Knopsensor","type-camera":"camera","type-chart":"Grafiek","type-cie":"CIE-kleurenlicht","type-ct":"Kleurtemperatuur","type-dimmer":"dimmer","type-door":"deur","type-fireAlarm":"brandalarm","type-floodAlarm":"overstromingsalarm","type-gate":"hek","type-hue":"HUE-licht","type-humidity":"vochtigheid","type-illuminance":"Verlichtingssterkte","type-image":"afbeelding","type-info":"informatie","type-instance":"aanleg","type-light":"licht","type-location":"locatie","type-locationOne":"Positie als staat","type-lock":"slot","type-media":"media","type-motion":"beweging","type-rgb":"RGB-licht","type-rgbSingle":"RGB-licht enkel","type-rgbwSingle":"RGBW als enkele waarde","type-slider":"schuifregelaar","type-socket":"stopcontact","type-temperature":"temperatuur","type-thermostat":"thermostaat","type-url":"URL","type-vacuumCleaner":"Stofzuiger","type-valve":"ventiel","type-volume":"volume","type-volumeGroup":"volumegroep","type-warning":"waarschuwing","type-weatherCurrent":"huidige weersomstandigheden","type-weatherForecast":"weersvoorspelling","type-window":"raam","type-windowTilt":"raamkanteling"},v_e={"type-Device type":"Тип пристрою","type-airCondition":"Кондиціонер","type-blind":"жалюзі","type-blindButtons":"Штора керується кнопками","type-button":"кнопку","type-buttonSensor":"Датчик кнопки","type-camera":"камера","type-chart":"Діаграма","type-cie":"Кольорове світло CIE","type-ct":"Колірна температура","type-dimmer":"диммер","type-door":"двері","type-fireAlarm":"пожежна сигналізація","type-floodAlarm":"сигналізація про повінь","type-gate":"ворота","type-hue":"світло HUE","type-humidity":"вологість","type-illuminance":"Освітленість","type-image":"зображення","type-info":"інформація","type-instance":"екземпляр","type-light":"світло","type-location":"розташування","type-locationOne":"Позиція як держави","type-lock":"замок","type-media":"ЗМІ","type-motion":"руху","type-rgb":"RGB світло","type-rgbSingle":"Одиночне світло RGB","type-rgbwSingle":"RGBW як одне значення","type-slider":"повзунок","type-socket":"гніздо","type-temperature":"температура","type-thermostat":"термостат","type-url":"URL","type-vacuumCleaner":"Пилосос","type-valve":"клапан","type-volume":"обсяг","type-volumeGroup":"група обсягів","type-warning":"УВАГА","type-weatherCurrent":"поточна погода","type-weatherForecast":"прогноз погоди","type-window":"вікно","type-windowTilt":"нахил вікна"},b_e={"type-Device type":"设备类型","type-airCondition":"空调","type-blind":"百叶窗","type-blindButtons":"按钮控制百叶窗","type-button":"按钮","type-buttonSensor":"按钮传感器","type-camera":"相机","type-chart":"图表","type-cie":"CIE色光","type-ct":"色温","type-dimmer":"调光器","type-door":"门","type-fireAlarm":"火灾报警","type-floodAlarm":"洪水警报","type-gate":"门","type-hue":"色调灯","type-humidity":"湿度","type-illuminance":"照度","type-image":"图像","type-info":"信息","type-instance":"实例","type-light":"光","type-location":"地点","type-locationOne":"作为一个国家的地位","type-lock":"锁","type-media":"媒体","type-motion":"运动","type-rgb":"RGB灯","type-rgbSingle":"RGB灯单","type-rgbwSingle":"RGBW 作为单一值","type-slider":"滑块","type-socket":"插座","type-temperature":"温度","type-thermostat":"恒温器","type-url":"网址","type-vacuumCleaner":"吸尘器","type-valve":"阀门","type-volume":"体积","type-volumeGroup":"卷组","type-warning":"警告","type-weatherCurrent":"当前天气","type-weatherForecast":"天气预报","type-window":"窗户","type-windowTilt":"窗户倾斜"};let Yl=!1;function A4(){Yl||(Yl=!0,h.extendTranslations({en:O_e,de:E_e,ru:f_e,pt:x_e,pl:__e,fr:S_e,it:k_e,nl:Y_e,uk:v_e,"zh-cn":b_e}))}const vl={[B.Types.airCondition]:fL,[B.Types.blind]:kl,[B.Types.blindButtons]:kl,[B.Types.button]:C_e,[B.Types.buttonSensor]:j_e,[B.Types.camera]:M_e,[B.Types.chart]:r_e,[B.Types.image]:EL,[B.Types.dimmer]:OL,[B.Types.door]:D_e,[B.Types.fireAlarm]:_l,"sensor.alarm.fire":_l,[B.Types.floodAlarm]:Sl,"sensor.alarm.flood":Sl,[B.Types.gate]:h_e,[B.Types.humidity]:z_e,[B.Types.illuminance]:y_e,[B.Types.info]:mL,[B.Types.light]:AL,[B.Types.lock]:pL,[B.Types.location]:IL,[B.Types.locationOne]:CL,[B.Types.media]:wL,[B.Types.motion]:w_e,[B.Types.ct]:$M,[B.Types.rgb]:Ko,[B.Types.rgbSingle]:Ko,[B.Types.rgbwSingle]:T_e,[B.Types.hue]:$M,[B.Types.cie]:Ko,[B.Types.slider]:zL,[B.Types.socket]:I_e,[B.Types.temperature]:p_e,[B.Types.thermostat]:A_e,[B.Types.vacuumCleaner]:d_e,[B.Types.volume]:hL,[B.Types.volumeGroup]:DL,[B.Types.window]:m_e,[B.Types.windowTilt]:p4,[B.Types.weatherCurrent]:fl,[B.Types.weatherForecast]:fl,[B.Types.warning]:UM,[B.Types.unknown]:dL,[B.Types.instance]:TL,invalid:UM,hub3:yL,node:jL,hub5:gL,controller:LL},Dr={width:32,height:32};function Q_e(s){const[e,t]=M.useState(!1);if(f.useEffect(()=>{s.title&&!e&&(A4(),t(!0))},[s.title,e]),!e&&s.title)return M.createElement(j.Box,{style:{...Dr,...s.style||void 0},className:s.className,sx:s.sx});const i=s.type||(s.src?Object.keys(vl).find(n=>s.src===n):void 0);if(!i&&s.src)return M.createElement(me,{style:Dr,...s,title:s.title===!0?void 0:s.title,src:s.src});const r=i&&vl[i];if(!r)return i?M.createElement("span",{style:{...Dr,...s.style||void 0}},i[0].toUpperCase()):null;const o=M.createElement(r,{style:{...Dr,...s.style||void 0},onClick:s.onClick,className:s.className,sx:s.sx});return s.title?M.createElement(j.Tooltip,{slotProps:{popper:{sx:{pointerEvents:"none"}}},title:s.title===!0?h.t(`type-${i}`):s.title},M.createElement("div",{style:{display:"flex"}},o)):o}const Et={itemChildrenWrapper:{display:"flex",width:"100%",justifyContent:"space-between"},type:{marginTop:10},selectIcon:{paddingRight:8,verticalAlign:"middle",width:20,height:20},selectText:{verticalAlign:"middle"},iconWrapper:{display:"flex",alignItems:"center"},iconStyle:{width:16,height:16,margin:"0 3px"},emptyIcon:{width:16,height:16,margin:"0 3px"}};function K3e(s){const[e,t]=M.useState({}),[i,r]=M.useState([]);return f.useEffect(()=>{const o={};Object.keys(B.Types).filter(a=>{var c,l;return(!s.supportedDevices||((c=s.supportedDevices)==null?void 0:c.includes(a)))&&!((l=s.unsupportedDevices)!=null&&l.includes(a))}).forEach(a=>o[a]=h.t(`type-${B.Types[a]}`));const n=Object.keys(o);n.sort((a,c)=>o[a]===o[c]?0:o[a].localeCompare(o[c],"de")),A4(),r(n),t(o)},[s.supportedDevices,s.unsupportedDevices]),i?M.createElement(j.FormControl,{style:{...Et.type,...s.style},sx:s.sx,variant:"standard",error:!!s.error},M.createElement(j.InputLabel,null,s.label||h.t("type-Device type")),M.createElement(j.Select,{variant:"standard",disabled:!!s.disabled,value:s.value,onChange:o=>s.onChange(o.target.value)},i.map(o=>{var n;return M.createElement(j.MenuItem,{key:B.Types[o],value:B.Types[o]},M.createElement("div",{style:Et.itemChildrenWrapper},M.createElement("div",null,M.createElement(Q_e,{type:B.Types[o],style:{...Et.selectIcon,color:s.themeType==="dark"?"#FFFFFF":"#000"}}),M.createElement("span",{style:Et.selectText},e[o])),(n=s.showApplications)!=null&&n.TYPE_OPTIONS[o]?M.createElement("div",{style:Et.iconWrapper},Object.keys(s.showApplications.TYPE_OPTIONS[o]).map(a=>s.showApplications.TYPE_OPTIONS[o][a]?M.createElement(me,{key:a,style:Et.iconStyle,src:s.showApplications.ICONS_TYPE[a]}):M.createElement("div",{key:a,style:Et.emptyIcon}))):null))}))):M.createElement(j.Box,{style:{...Et.type,...s.style},sx:s.sx})}function U_e(s){return Z({attr:{version:"1",viewBox:"0 0 48 48",enableBackground:"new 0 0 48 48"},child:[{tag:"circle",attr:{fill:"#B2EBF2",cx:"32",cy:"24",r:"9"},child:[]},{tag:"path",attr:{fill:"#4DD0E1",d:"M32,12c-6.6,0-12,5.4-12,12c0,6.6,5.4,12,12,12s12-5.4,12-12C44,17.4,38.6,12,32,12z M32,32 c-4.4,0-8-3.6-8-8s3.6-8,8-8s8,3.6,8,8S36.4,32,32,32z"},child:[]},{tag:"g",attr:{fill:"#3F51B5"},child:[{tag:"polygon",attr:{points:"25.4,22 19.8,5.1 13.6,27.7 11.4,22 4,22 4,26 8.6,26 14.4,40.3 20.2,18.9 22.6,26 30,26 30,22"},child:[]},{tag:"circle",attr:{cx:"32",cy:"24",r:"4"},child:[]}]}]})(s)}function $_e(s){return Z({attr:{role:"img",viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M4.428 2.727l3.335 3.335c-.486.07-.903.276-1.32.624L.886 12.383c-1.181 1.18-1.181 3.194 0 4.375a2.41 2.41 0 0 0 1.598.834l17.088 3.681-3.335-3.333c.486-.07.903-.278 1.32-.626l5.557-5.695c1.181-1.181 1.181-3.196 0-4.377a2.411 2.411 0 0 0-1.598-.833zM11.653 6.2c.694 0 1.25.486 1.25 1.18 0 .695-.486 1.251-1.181 1.251-.695 0-1.25-.485-1.25-1.18s.555-1.251 1.18-1.251zm1.51 3.792c.049-.006.088.046.088.098-.139.694-.695 1.181-1.39 1.181-.694 0-1.32-.487-1.46-1.112 0 0 .002-.07.071 0 .487.278.972.348 1.32.278.346 0 .833-.07 1.32-.416a.092.092 0 0 1 .05-.029zm.723 2.511c.058.013.06.106.06.158-.209.903-.973 1.666-1.946 1.666a2.167 2.167 0 0 1-2.084-1.528c-.07-.07 0-.138.138-.138.695.347 1.39.416 1.877.416.486 0 1.18-.14 1.875-.556.035-.017.06-.022.08-.018zm.597 3.018c.049-.013.087.09.087.195-.278 1.181-1.25 2.085-2.5 2.155-1.251 0-2.293-.835-2.57-1.946 0-.139.068-.278.207-.209.834.486 1.737.556 2.362.556s1.529-.208 2.362-.694c.018-.035.036-.053.052-.057z"},child:[]}]})(s)}function P_e(s){return Z({attr:{version:"1.2",baseProfile:"tiny",viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M13 5l.855 3.42 3.389-.971 1.501 2.6-2.535 2.449 2.535 2.451-1.5 2.6-3.39-.971-.855 3.422h-3l-.855-3.422-3.39.971-1.501-2.6 2.535-2.451-2.534-2.449 1.5-2.6 3.39.971.855-3.42h3m0-2h-3c-.918 0-1.718.625-1.939 1.516l-.354 1.412-1.4-.4c-.184-.053-.369-.078-.552-.078-.7 0-1.368.37-1.731 1l-1.5 2.6c-.459.796-.317 1.802.342 2.438l1.047 1.011-1.048 1.015c-.66.637-.802 1.643-.343 2.438l1.502 2.6c.363.631 1.031 1 1.731 1 .183 0 .368-.025.552-.076l1.399-.401.354 1.415c.222.885 1.022 1.51 1.94 1.51h3c.918 0 1.718-.625 1.939-1.516l.354-1.414 1.399.4c.184.053.369.077.552.077.7 0 1.368-.37 1.731-1l1.5-2.6c.459-.796.317-1.8-.342-2.438l-1.047-1.013 1.047-1.013c.66-.637.801-1.644.342-2.438l-1.5-2.6c-.365-.631-1.031-1-1.732-1-.184 0-.368.025-.551.076l-1.4.401-.354-1.413c-.22-.884-1.02-1.509-1.938-1.509zM11.5 10.5c1.104 0 2 .895 2 2 0 1.104-.896 2-2 2s-2-.896-2-2c0-1.105.896-2 2-2m0-1c-1.654 0-3 1.346-3 3s1.346 3 3 3 3-1.346 3-3-1.346-3-3-3z"},child:[]}]})(s)}function W_e(s){return Z({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M7.707 17.707 13.414 12 7.707 6.293 6.293 7.707 10.586 12l-4.293 4.293zM15 6h2v12h-2z"},child:[]}]})(s)}function B_e(s){return Z({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M376 211H256V16L136 301h120v195z"},child:[]}]})(s)}function J_e(s){return Z({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 32l-64 96 80 16-16 80 64-96-80-16 16-80zm-96 217c-1.9 0-9.8 3-15.8 6.7-2.8 1.7-5.3 3.5-7.2 4.8v119c1.9 1.3 4.4 3.1 7.2 4.8 6 3.7 13.9 6.7 15.8 6.7 1.9 0 9.8-3 15.8-6.7 5.9-3.7 10.6-7.3 10.6-7.3l2.5-2H201V265h-12.1l-2.5-2s-4.7-3.6-10.6-7.3c-6-3.7-13.9-6.7-15.8-6.7zm192 0c-1.9 0-9.8 3-15.8 6.7-5.9 3.7-10.6 7.3-10.6 7.3l-2.5 2H311v110h12.1l2.5 2s4.7 3.6 10.6 7.3c6 3.7 13.9 6.7 15.8 6.7 1.9 0 9.8-3 15.8-6.7 2.8-1.7 5.3-3.5 7.2-4.8v-119c-1.9-1.3-4.4-3.1-7.2-4.8-6-3.7-13.9-6.7-15.8-6.7zm-133 16v110h14V265h-14zm32 0v110h42V265h-42zM95.5 311c-18.8 0-36.6 9.2-49.94 22.7C32.22 347.1 23 365 23 384v106h18V384c0-13 6.78-27.1 17.32-37.7C68.85 335.8 82.8 329 95.5 329H119v-18H95.5zm297.5 0v18h22.9c13.1 0 27.1 6.8 37.7 17.4C464.2 357 471 371 471 384v106h18V384c0-19-9.2-37-22.7-50.4-13.4-13.4-31.4-22.6-50.4-22.6H393z"},child:[]}]})(s)}function R_e(s){return Z({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M20.127 52.803v58.986L250.46 245.153c26.367-28.823 70.087-36.533 105.313-16.195 35.29 20.374 50.465 62.207 38.567 99.503l101.648 58.855-64.728-74.65 35.638-37.352-57.27-7.687 84.72-86.92-125.71 33.186 12.995-120.208-66.578 96.363-27.448-80.593-16.353 88.77L20.127 52.803zm0 105.12l-.008.018.007.005v-.02zm0 .022l-.002 87.582 155.344 89.95-89.94 33.287h135.493l-63.658 99.87 116.22-70.083 15.77 85.852 38.543-80.01 63.66 87.018-5.853-87.047 90.54 17.268-102.4-59.198c-26.546 26.964-68.89 33.744-103.183 13.945-34.322-19.816-49.62-59.928-39.49-96.424L20.127 157.945zm316.6 119.442c-.938-.003-1.874.027-2.805.092-12.42.86-24.164 7.707-30.9 19.375-10.78 18.67-4.455 42.27 14.214 53.047 18.67 10.78 42.27 4.455 53.047-14.214 10.78-18.67 4.454-42.27-14.215-53.047-6.125-3.536-12.78-5.23-19.34-5.253z"},child:[]}]})(s)}function F_e(s){return Z({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M33.125 19.406L135.5 128.22l81-23.157 18.72-5.344-7.564 17.936-46.125 109.78 134.282-70 26.157-13.655L328.436 170 256.5 309.25l91.25-57.125 22.97-14.375-9.22 25.47-34.625 95.624 71-36.375 21.188-10.845L410.906 334l-33.937 93.063 45.124-6.688 4.53-.656 3.313 3.155 64.313 61.47-30.5-80.5 23.313-46.908-72.5 39.532 51.062-141.158-91.188 47.47 72.344-142.813-128.217 82.81L421.875 70.063 239.03 168.69l30.44-99.563-103.845 25.25-132.5-74.97zM18.155 30.78l77.876 108.25-31.124 75.532 94.125-46.78-98.905 166.812 190.25-99.656-101.03 185.406 140.25-79.063-46.94 102.22 106.5-53-45.655 92.28 86.5-14.467 93.47 31.562-63.158-60.344-56.125 8.314-15.53 2.312 5.374-14.75 31.158-85.437-70.907 36.31-21.124 10.814 8.094-22.313 33.47-92.436-97.22 60.875-28.938 18.092L224.22 331l74.06-143.344-131.06 68.313-22.97 12 10.03-23.908 48.626-115.687-67.75 19.375-5.5 1.563-3.875-4.157L18.157 30.78z"},child:[]}]})(s)}function G_e(s){return Z({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M288.3 13.4c-12.3-.01-23 6.49-27.3 15.31l-2.9 5.95-6.6-1.01c-5.5-.85-11.3-1.32-17.1-1.32-18.8 0-35.7 4.5-47.3 11.14-11.5 6.64-16.9 14.59-16.9 22 0 7.42 5.4 15.37 16.9 22 11.6 6.64 28.5 11.13 47.3 11.13 7.5-.02 14.9-.74 21.8-2.13l6.3-1.23 3.2 5.46c5.6 9.2 23.7 18.2 44.7 18.2 13.9 0 26.4-3.6 34.8-8.8 8.4-5.2 12.2-11.23 12.2-16.9 0-5.09-3-10.48-10-15.44-6.9-4.97-17.6-8.87-30-9.95l-18.3-1.59 12.5-13.49c4.1-4.41 6.1-9.6 6.1-14.87 0-12.88-12.4-24.46-29.4-24.46zM152.2 65.46C84.8 102.3 39 173.9 39 256c0 32.1 7 62.6 19.54 90 5.95-7.9 10.48-13.4 12.67-16C62.05 307.2 57 282.2 57 256c0-74 40.27-138.5 100.1-172.78-3.1-5.39-4.9-11.34-4.9-17.74v-.02zm210.7 1.75c7.5 6.93 12.5 15.9 12.5 25.99 0 1.14-.1 2.27-.2 3.38C423.7 132.9 455 190.7 455 256c0 23.7-4.2 46.5-11.8 67.6l18.3 2.2c7.4-21.9 11.5-45.4 11.5-69.8 0-80.8-44.4-151.5-110.1-188.79zm58.6 270.49c-11.1.2-23 1.1-35.9 3.1l-.5.1-.5.1c-25.8 7.3-37.1 15.2-46.4 24.7l-2.2 2.2-.3 3.1c-3.4 29.6-5.8 60 0 91.8l1.3 6.8 6.8.6c30.6 2.6 58.7 1.4 86.2 0l1-.1.9-.2c18.5-5.2 34.4-12.8 46.4-24.6l1.7-1.6.6-2.2c10-33.4 3.4-63.8.4-92.7l-.8-7.4-7.3-.7c-16.2-1.5-32.8-3.2-51.4-3zM79.62 348.2c-4.94 6.1-11.43 14.5-18.58 25.6-12.29 18.9-22.53 42.4-20.51 54.9 1.43 8.8 6.97 19.6 14.51 27.6 7.54 7.9 16.69 12.8 24.58 12.8 7.87 0 17.03-4.9 24.58-12.8 7.5-8 13.1-18.8 14.5-27.6 2-12.5-8.2-36-20.5-54.9-7.15-11-13.64-19.5-18.58-25.6zM427 355.7c1.7 0 3.3 0 5 .1 5.4.1 10.7.4 16 .8-5.9 3.4-12.1 6.8-19.5 9.9l-2.4.2c-19.5 1.4-37.7.3-55.4-2 4.7-2 10.5-4 18.3-6.2 13.8-2.2 26.3-2.9 38-2.8zm38 11.6c2.8 22.9 5 44.5-1 66.6-7 6.3-16 11.4-27 15.4 3-22.5 2-44.8-.5-66.6 11.3-5 20.2-10.2 28.5-15.4zm-112.2 13.1c20.7 3.2 42.3 5.4 65.8 4.5 2.5 23 3.5 45.6-.4 67.8-21.5 1-43.1 1.5-65.8-.1-3.5-24-2.2-47.9.4-72.2zm-216.4 34.7c.9 5.5 1 11 .1 16.4-.3 1.6-.6 3.3-1 4.9C170 459.5 211.4 473 256 473c21.6 0 42.5-3.2 62.3-9.1l-2-18.2c-19 6-39.3 9.3-60.3 9.3-44.9 0-86.3-14.8-119.6-39.9z"},child:[]}]})(s)}function bl(s){return Z({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M140 29.92c-31.4 0-59.89 3.25-79.89 8.25-9.9 2.5-17.8 5.51-22.4 8.25-3.2 1.87-4.1 3.15-4.5 3.58.4.43 1.3 1.71 4.5 3.58 4.6 2.74 12.5 5.75 22.4 8.25 20 5 48.49 8.25 79.89 8.25h5.7c5.3-2 11.1-3.78 17.6-5.4 20.3-5.08 46.5-8.42 75.8-9.36 1.2-.57 2.3-1.14 3.2-1.7 3.1-1.87 4.1-3.15 4.5-3.58-.4-.43-1.4-1.71-4.5-3.58-4.6-2.74-12.5-5.75-22.5-8.25-19.9-5-48.4-8.25-79.8-8.25zm232 0c-31.4 0-59.9 3.25-79.8 8.25-10 2.5-17.9 5.51-22.5 8.25-3.1 1.87-4.1 3.15-4.5 3.58.4.43 1.4 1.71 4.5 3.58.9.56 2 1.13 3.2 1.7 29.3.94 55.5 4.28 75.8 9.36 6.5 1.62 12.3 3.4 17.6 5.4h5.7c31.4 0 59.9-3.25 79.8-8.25 10-2.5 17.9-5.51 22.5-8.25 3.1-1.87 4.1-3.15 4.5-3.58-.4-.43-1.4-1.71-4.5-3.58-4.6-2.74-12.5-5.75-22.5-8.25-19.9-5-48.4-8.25-79.8-8.25zM33.01 71.44V369.9c0 4.3 1.8 8 6.8 12.3 5 4.3 13.1 8.5 23.3 11.9 15.3 5.1 35 8.5 55.89 9.8V278.3l-16.5 28.6-7.79-4.5c-27.4-15.9-44.3-45.3-44.4-77v-9h52.59c-.6 2.6-.9 5.3-.9 8.1 0 13.1 6.8 24.8 17 31.7v-63.4c-1.9 1.3-3.6 2.7-5.2 4.2l-25.99-45.1 7.8-4.5c7.49-4.2 15.29-7.3 23.39-9.3V87.61c-24.19-1.08-45.99-4.01-63.19-8.32-8.9-2.21-16.5-4.76-22.8-7.85zm445.99 0c-6.3 3.09-14 5.63-22.8 7.84-17.2 4.31-39 7.24-63.2 8.32v50.6c8.1 2 16 5.1 23.4 9.3l7.7 4.5-4.4 7.8-21.5 37.2c-1.6-1.5-3.3-2.9-5.2-4.2v63.4c10.2-6.9 17-18.6 17-31.7 0-2.8-.3-5.5-.9-8.1h50.8v9c0 31.8-17 61.1-44.4 77l-7.8 4.5-14.7-25.5v122.5c20.9-1.3 40.7-4.7 55.9-9.8 10.2-3.4 18.3-7.6 23.3-11.9 5-4.3 6.8-8 6.8-12.3zM256 73c-34.7 0-66.2 3.57-88.3 9.1-11.1 2.77-19.8 6.09-25.1 9.19-4.3 2.58-5.3 4.42-5.5 4.71.2.29 1.2 2.12 5.5 4.7 5.3 3.1 14 6.4 25.1 9.2 22.1 5.5 53.6 9.1 88.3 9.1 34.7 0 66.2-3.6 88.3-9.1 11.1-2.8 19.8-6.1 25.1-9.2 4.3-2.58 5.3-4.41 5.5-4.7-.2-.29-1.2-2.13-5.5-4.71-5.3-3.1-14-6.42-25.1-9.19-22.1-5.53-53.6-9.1-88.3-9.1zm118.9 23c.1.1.1.1.1 0s0-.1-.1 0zm-237.8 0c-.1-.1-.1-.1-.1 0s0 .1.1 0zm-.1 22.1V448c0 5 2.2 9.3 7.9 14.2 5.6 4.8 14.7 9.5 25.9 13.3 22.6 7.5 54 11.5 85.2 11.5 31.2 0 62.6-4 85.2-11.5 11.2-3.8 20.3-8.5 25.9-13.3 5.7-4.9 7.9-9.2 7.9-14.2V118.1c-7.2 3.7-16 6.6-26.3 9.3-24.2 6-56.7 9.6-92.7 9.6s-68.5-3.6-92.7-9.6c-10.3-2.7-19.1-5.6-26.3-9.3zM256 191c16.8 0 33.5 4.4 48.5 13l7.8 4.5-4.5 7.8-24.1 41.6c-7.3-6.7-17-10.9-27.7-10.9s-20.4 4.2-27.7 10.9l-28.6-49.4 7.8-4.5c15-8.7 31.7-13 48.5-13zm0 74c12.8 0 23 10.2 23 23s-10.2 23-23 23-23-10.2-23-23 10.2-23 23-23zm-98 15h57.8c-.5 2.6-.8 5.3-.8 8 0 18.1 12 33.7 28.5 39l-29.2 50.5-7.8-4.5c-30-17.3-48.5-49.4-48.5-84zm138.2 0H352v9c0 34.6-18.5 66.7-48.5 84l-7.8 4.5-28.8-50c17.3-4.8 30.1-20.8 30.1-39.5 0-2.7-.3-5.4-.8-8z"},child:[]}]})(s)}function H_e(s){return Z({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 54.28c-124.603 0-226 101.398-226 226 0 47.864 14.975 92.293 40.465 128.876l29.79-19.86c-17.188-24.545-28.708-53.362-32.696-84.577H96v-18H66.115c-.07-2.14-.115-4.284-.115-6.44 0-45.378 15.816-86.97 42.236-119.598l17.4 17.4 12.727-12.727-18.133-18.132C152.735 114.057 197.335 92.8 247 90.498v29.22h18V90.5c49.665 2.302 94.265 23.56 126.77 56.725l-18.133 18.132 12.726 12.727 17.4-17.4c26.42 32.63 42.237 74.22 42.237 119.6 0 2.154-.044 4.3-.115 6.437H416v18h28.44c-3.987 31.214-15.507 60.03-32.694 84.575l29.79 19.86C467.025 372.574 482 328.146 482 280.282c0-124.602-101.397-226-226-226zm15.83 66.23a144 160 0 0 1 74.608 100.062l49.966-17.568a160 160 0 0 0-4.3-7.012l-5.135 5.153-30.368-30.29-5.76-5.746 7.85-7.874a160 160 0 0 0-86.862-36.726zm156.15 89.844l-175.332 60.6C240.505 272.618 231 283.155 231 295.72c0 13.7 11.3 25 25 25 6.77 0 12.95-2.764 17.473-7.208L427.98 210.354zm-16.513 32.322l-60.713 40.72a144 160 0 0 1-56.6 108.323h76.057a160 160 0 0 0 39.763-68.572H398.48v-52.515h17.022a160 160 0 0 0-4.035-27.957zM128 421.72v36h256v-36H128z"},child:[]}]})(s)}function V_e(s){return Z({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M352.7 21.04l-194.4.41L21.04 159.3l.41 194.4L159.3 491l194.4-.4L491 352.7l-.4-194.4L352.7 21.04zm-8 19.66l126.2 125.7.4 178.3-123.1 123.6-2.6 2.6-178.3.4L41.08 345.6l-.38-178.3L166.4 41.08l178.3-.38zm-7.5 18.01l-163.3.34L58.71 174.8l.34 163.3L174.8 453.3l163.3-.3 115.2-115.8-.3-163.3L337.2 58.71zM108.4 210.4c5.3 0 10.8.5 16.4 1.3 5.7.8 11.5 2 17.5 3.6v20.5c-5.3-2.4-10.5-4.2-15.6-5.4-5.1-1.2-9.9-1.8-14.4-1.8-6 0-10.4.8-13.25 2.5-2.87 1.6-4.3 4.2-4.3 7.7 0 2.6.96 4.6 2.87 6.1 1.95 1.4 5.48 2.7 10.58 3.7l10.6 2.1c10.8 2.2 18.5 5.5 23.1 9.9 4.5 4.5 6.8 10.8 6.8 18.9 0 10.7-3.2 18.7-9.5 24-6.4 5.2-16.1 7.8-29.2 7.8-6.1 0-12.3-.6-18.51-1.8-6.2-1.1-12.41-2.9-18.61-5.2v-21.1c6.2 3.3 12.19 5.8 17.96 7.5 5.82 1.6 11.46 2.4 16.76 2.4 5.5 0 9.7-.9 12.6-2.7 2.9-1.8 4.4-4.4 4.4-7.8 0-3.1-1-5.4-3-7.1-2-1.6-5.9-3.1-11.8-4.4l-9.7-2.1c-9.73-2.1-16.85-5.4-21.37-10-4.47-4.5-6.7-10.7-6.7-18.4 0-9.7 3.12-17.1 9.37-22.3 6.25-5.3 15.24-7.9 27-7.9zm187.7 0c15.6 0 27.8 4.5 36.7 13.5 8.9 8.9 13.3 21.2 13.3 37 0 15.7-4.4 28-13.3 37-8.9 8.9-21.1 13.4-36.7 13.4-15.6 0-27.8-4.5-36.7-13.4-8.9-9-13.3-21.3-13.3-37 0-15.8 4.4-28.1 13.3-37 8.9-9 21.1-13.5 36.7-13.5zm-141.9 1.8h89.6v18.9h-32.2v78.3h-25.1v-78.3h-32.3v-18.9zm205.8 0h41.6c12.3 0 21.8 2.8 28.4 8.3 6.7 5.4 10 13.2 10 23.4s-3.3 18.1-10 23.6c-6.6 5.4-16.1 8.2-28.4 8.2H385v33.7h-25v-97.2zm-63.9 16.4c-7.7 0-13.6 2.8-17.8 8.5-4.2 5.6-6.3 13.6-6.3 23.8 0 10.2 2.1 18.1 6.3 23.8 4.2 5.6 10.1 8.4 17.8 8.4 7.7 0 13.6-2.8 17.8-8.4 4.2-5.7 6.3-13.6 6.3-23.8 0-10.2-2.1-18.2-6.3-23.8-4.2-5.7-10.1-8.5-17.8-8.5zm88.9 1.8v27.1h13.9c4.9 0 8.6-1.2 11.3-3.5 2.6-2.4 3.9-5.8 3.9-10.1s-1.3-7.7-3.9-10c-2.7-2.4-6.4-3.5-11.3-3.5H385z"},child:[]}]})(s)}function Z_e(s){return Z({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M327.467 19.992c.748 14.94 2.317 51.268 2.59 98.76 3.474-.286 6.557-.381 9.72 1.08 18.04 8.345 27.243 29.326 27.026 50.506-.217 21.18-11.283 44.136-36.104 54.307a41.62 41.62 0 0 1-2.486.923c-3.408 80.504-12.307 166.37-33.754 225.5-6.876 15.831-17.029 29.217-26.828 40.94l55.27.422c20.676-12.19 32.041-27.395 36.32-46.407l17.558 3.954c-3.67 16.312-11.99 30.662-24.511 42.677l143.052 1.094c-5.13-14.524-16.16-46.501-20.357-70.217C451.89 293.171 450.15 45 450.025 19.992zM18.279 38.984l.881 18.725c17.856 12.047 32.035 23.91 45.969 35.527 12.887-11.156 2.404-29.725-5.82-39.091-13.668-5.346-27.335-10.467-41.03-15.16zM86.723 65.13c4.77 14.56 3.347 29.656-7.477 39.746 24.105 19.479 50.832 38.151 97.1 55.635 13.836-22.588 12.08-43.852-3.338-60.739-29.03-10.9-57.703-22.997-86.285-34.642zm-31.721 42.988V400h17.996V122.723c-6.187-4.856-12.114-9.73-17.996-14.606zm145.264 1.434c3.253 8.283 4.54 16.754 3.982 25.043-.765 11.35-4.673 22.135-10.545 32.095 16.926 5.691 36.192 11.248 58.451 16.655l2.604.633 1.834 1.953c9.223 9.826 22.535 17.206 35.469 21.006 12.933 3.8 25.473 3.655 31.814 1.056 18.024-7.385 24.773-22.363 24.932-37.84.152-14.822-7.069-28.554-15.479-33.306-45.88-1.699-89.948-12.607-133.062-27.295zm-33.264 66.476V400h17.996V182.605a502.784 502.784 0 0 1-17.996-6.578zM32 419.002v17.996h176v-17.996z"},child:[]}]})(s)}function X_e(s){return Z({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M18.36 6.64a9 9 0 1 1-12.73 0"},child:[]},{tag:"line",attr:{x1:"12",y1:"2",x2:"12",y2:"12"},child:[]}]})(s)}function K_e(s){return Z({attr:{fill:"none",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor","aria-hidden":"true"},child:[{tag:"path",attr:{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.663 17h4.673M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z"},child:[]}]})(s)}function q_e(s){return Z({attr:{version:"1.1",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M6 0l-6 8h6l-4 8 14-10h-8l6-6z"},child:[]}]})(s)}const q3e={SET:t_e,WORKING:PM,UNREACH:JM,LOWBAT:WM,MAINTAIN:PL,ERROR:$L,DIRECTION:UL,CONNECTED:JM,ACTUAL:P_e,SECOND:W_e,PRESS_LONG:QL,PRESS:bL,MUTE:vL,ACCURACY:R_e,RADIUS:n_e,ELEVATION:s_e,LATITUDE:i_e,LONGITUDE:a_e,GPS:YL,ON_ACTUAL:BM,ON_SET:BM,OPEN:kL,STOP:V_e,WATER_ALARM:xl,WASTE_ALARM:bl,PAUSE:e_e,STATE:G_e,BATTERY:WM,WASTE:bl,WATER:xl,WORK_MODE:PM,MODE:SL,POWER:o_e,BOOST:$_e,HUMIDITY:l_e,TEMPERATURE:L_e,BRIGHTNESS:c_e,MOTION:_L,FIRE:u_e,WINDOW:p4,SMOKE:N_e,SWING:Z_e,SPEED:H_e,DIMMER:K_e,ON:X_e,COLOR_TEMP:xL,ELECTRIC_POWER:q_e,CURRENT:B_e,VOLTAGE:J_e,CONSUMPTION:U_e,FREQUENCY:F_e,HUE:g_e};class m4 extends M.Component{static generateFile(e,t){const i=window.document.createElement("a");i.setAttribute("href",`data:application/json;charset=utf-8,${encodeURIComponent(JSON.stringify(t,null,2))}`),i.setAttribute("download",e),i.style.display="none",window.document.body.appendChild(i),i.click(),window.document.body.removeChild(i)}handleFileSelect=e=>{const t=e.target,i=t==null?void 0:t.files;if(!i||!i.length){console.error("No files found. Please report to developers");return}const r=i[0];if(r){const o=new window.FileReader;o.onload=()=>{var a;const n=((a=o.result)==null?void 0:a.toString())||"";try{const c=JSON.parse(n);c.native&&c.common?c.common.name!==this.props.common.name?this.props.onError&&this.props.onError(h.t("ra_otherConfig",c.common.name)):this.props.onLoad&&this.props.onLoad(c.native):this.props.onError&&this.props.onError(h.t("ra_invalidConfig"))}catch(c){this.props.onError&&this.props.onError(c==null?void 0:c.toString())}},o.readAsText(r)}else alert("Failed to open JSON File")};download(){const e={_id:`system.adapter.${this.props.common.name}.${this.props.instance}`,common:JSON.parse(JSON.stringify(this.props.common)),native:this.props.native};e.common.news&&delete e.common.news,e.common.titleLang&&delete e.common.titleLang,e.common.desc&&delete e.common.desc,m4.generateFile(`${e._id}.json`,e)}upload(){const e=window.document.createElement("input");e.setAttribute("type","file"),e.setAttribute("id","files"),e.setAttribute("opacity","0"),e.addEventListener("change",this.handleFileSelect,!1),e.click()}render(){return M.createElement("div",{className:this.props.className,style:this.props.style},this.props.common.icon?M.createElement(me,{src:this.props.common.icon,style:{padding:8,width:64},alt:"logo"}):null,this.props.common.readme?M.createElement(j.Fab,{size:"small",color:"primary","aria-label":"Help",style:{marginRight:5,marginTop:5,float:"right"},onClick:()=>{const e=window.open(this.props.common.readme,"_blank");e==null||e.focus()}},M.createElement(WL,null)):null,M.createElement(j.Fab,{size:"small",color:"primary","aria-label":"Load config",style:{marginRight:5,marginTop:5,float:"right"},title:h.t("ra_Load configuration from file"),onClick:()=>this.upload()},M.createElement(Eg,null)),M.createElement(j.Fab,{size:"small",color:"primary","aria-label":"Save config",style:{marginRight:5,marginTop:5,float:"right"},title:h.t("ra_Save configuration to file"),onClick:()=>this.download()},M.createElement(Og,null)))}}class O4{static text2link(e){const t=e.match(/\d+\.\)\s/);return t&&(e=e.replace(t[0],t[0].replace(/\s/,"&nbsp;"))),e.replace(/[^a-zA-Zа-яА-Я0-9]/g,"").trim().replace(/\s/g,"").toLowerCase()}static openLink(e,t){e=e.replace(/\/\/([0-9a-f]*:[0-9a-f]*:[0-9a-f]*:[0-9a-f]*:[0-9a-f]*:[0-9a-f]*)(:\d+)?\//i,"//[$1]$2/"),t==="this"?window.location.href=e:window.open(e,t||"_blank")}static getTitle(e){const t=O4.extractHeader(e);let i=t.body;const r=t.header;if(!r.title){i=i.replace(/{[^}]*}/g,""),i=i.trim();const o=i.replace(/\r/g,"").split(`
446
446
  `);for(let n=0;n<o.length;n++)if(o[n].startsWith("# "))return o[n].substring(2).trim();return""}return r.title.toString()}static extractHeader(e){const t={};if(e.substring(0,3)==="---"){const i=e.substring(3).indexOf(`
447
447
  ---`);i!==-1&&(e.substring(3,i+3).replace(/\r/g,"").split(`
448
- `).forEach(n=>{if(!n.trim())return;const a=n.indexOf(":");if(a!==-1){const c=n.substring(0,a).trim();let l=n.substring(a+1).trim();l=l.replace(/^['"]|['"]$/g,""),l==="true"?t[c]=!0:l==="false"?t[c]=!1:parseFloat(l).toString()===l?t[c]=parseFloat(l):t[c]=l}else t[n.trim()]=!0}),e=e.substring(i+7))}return{header:t,body:e}}static removeDocsify(e){const t=e.match(/{docsify-[^}]*}/g);return t&&t.forEach(i=>e=e.replace(i,"")),e}static onCopy(e,t){r0(t),e&&e.stopPropagation(),e&&e.preventDefault()}}function eSe(s){return M.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",onClick:e=>s.onClick&&s.onClick(e),viewBox:"0 0 512 512",width:s.width||(s.fontSize==="small"?16:20),height:s.height||s.width||(s.fontSize==="small"?16:20),className:s.className,style:s.style},M.createElement("path",{fill:"currentColor",d:"M448 0L320 96v62.06l-83.03 83.03c6.79 4.25 13.27 9.06 19.07 14.87 5.8 5.8 10.62 12.28 14.87 19.07L353.94 192H416l96-128-64-64zM128 278.59L10.92 395.67c-14.55 14.55-14.55 38.15 0 52.71l52.7 52.7c14.56 14.56 38.15 14.56 52.71 0L233.41 384c29.11-29.11 29.11-76.3 0-105.41s-76.3-29.11-105.41 0z"}))}function E4(s){return M.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",onClick:e=>s.onClick&&s.onClick(e),viewBox:"0 0 320 320",width:s.width||(s.fontSize==="small"?16:20),height:s.height||s.width||(s.fontSize==="small"?16:20),className:s.className,style:s.style},M.createElement("g",{fill:"currentColor"},M.createElement("rect",{rx:"32",height:"272",width:"267",y:"25",x:"25",strokeWidth:"15",stroke:"currentColor",fill:"none"}),M.createElement("ellipse",{stroke:"currentColor",ry:"26",rx:"26",cy:"248",cx:"160",fill:"none",strokeWidth:"15"}),M.createElement("line",{y2:"201.94531",x2:"159.5",y1:"46.94531",x1:"159.5",fillOpacity:"null",strokeOpacity:"null",strokeWidth:"15",stroke:"currentColor",fill:"none"}),M.createElement("rect",{height:"27",width:"50",y:"79.7979",x:"133.5",fillOpacity:"null",strokeOpacity:"null",strokeWidth:"15",stroke:"currentColor",fill:"#fff"})))}function Ts(s){return M.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",onClick:e=>s.onClick&&s.onClick(e),viewBox:"0 0 512 512",width:s.width||(s.fontSize==="small"?16:20),height:s.height||s.width||(s.fontSize==="small"?16:20),className:s.className,style:s.style},M.createElement("path",{fill:"currentColor",d:"M433.941 65.941l-51.882-51.882A48 48 0 0 0 348.118 0H176c-26.51 0-48 21.49-48 48v48H48c-26.51 0-48 21.49-48 48v320c0 26.51 21.49 48 48 48h224c26.51 0 48-21.49 48-48v-48h80c26.51 0 48-21.49 48-48V99.882a48 48 0 0 0-14.059-33.941zM266 464H54a6 6 0 0 1-6-6V150a6 6 0 0 1 6-6h74v224c0 26.51 21.49 48 48 48h96v42a6 6 0 0 1-6 6zm128-96H182a6 6 0 0 1-6-6V54a6 6 0 0 1 6-6h106v88c0 13.255 10.745 24 24 24h88v202a6 6 0 0 1-6 6zm6-256h-64V48h9.632c1.591 0 3.117.632 4.243 1.757l48.368 48.368a6 6 0 0 1 1.757 4.243V112z"}))}function f4(s){return M.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",onClick:e=>s.onClick&&s.onClick(e),viewBox:"0 0 320 320",width:s.width||(s.fontSize==="small"?16:20),height:s.height||s.width||(s.fontSize==="small"?16:20),className:s.className,style:s.style},M.createElement("g",{fill:"currentColor"},M.createElement("rect",{rx:"32",height:"272",width:"267",y:"25",x:"25",strokeWidth:"15",stroke:"currentColor",fill:"none"}),M.createElement("ellipse",{stroke:"currentColor",ry:"26",rx:"26",cy:"252",cx:"160",fillOpacity:"null",strokeOpacity:"null",strokeWidth:"15",fill:"#fff"}),M.createElement("line",{y2:"201.94531",x2:"159.5",y1:"46.94531",x1:"159.5",fillOpacity:"null",strokeOpacity:"null",strokeWidth:"15",stroke:"currentColor",fill:"none"}),M.createElement("rect",{height:"27",width:"50",y:"140.83068",x:"133.5",fillOpacity:"null",strokeOpacity:"null",strokeWidth:"15",stroke:"currentColor",fill:"#fff"}),M.createElement("ellipse",{stroke:"currentColor",ry:"26",rx:"26",cy:"251",cx:"241",fillOpacity:"null",strokeOpacity:"null",strokeWidth:"15",fill:"#fff"}),M.createElement("line",{y2:"200.94531",x2:"240.5",y1:"45.94531",x1:"240.5",fillOpacity:"null",strokeOpacity:"null",strokeWidth:"15",stroke:"currentColor",fill:"none"}),M.createElement("rect",{height:"27",width:"50",y:"78.7979",x:"214.5",strokeWidth:"15",stroke:"currentColor",fill:"#fff"}),M.createElement("ellipse",{stroke:"currentColor",ry:"26",rx:"26",cy:"252",cx:"84",fillOpacity:"null",strokeOpacity:"null",strokeWidth:"15",fill:"#fff"}),M.createElement("line",{y2:"201.94531",x2:"83.5",y1:"46.94531",x1:"83.5",fillOpacity:"null",strokeOpacity:"null",strokeWidth:"15",stroke:"currentColor",fill:"none"}),M.createElement("rect",{height:"27",width:"50",y:"79.7979",x:"57.5",fillOpacity:"null",strokeOpacity:"null",strokeWidth:"15",stroke:"currentColor",fill:"#fff"})))}function tSe(s){return M.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",onClick:e=>s.onClick&&s.onClick(e),width:s.width||(s.fontSize==="small"?16:20),height:s.height||s.width||(s.fontSize==="small"?16:20),className:s.className,style:s.style},M.createElement("path",{fill:"currentColor",d:"M369.9 97.9L286 14C277 5 264.8-.1 252.1-.1H48C21.5 0 0 21.5 0 48v416c0 26.5 21.5 48 48 48h288c26.5 0 48-21.5 48-48V131.9c0-12.7-5.1-25-14.1-34zM332.1 128H256V51.9l76.1 76.1zM48 464V48h160v104c0 13.3 10.7 24 24 24h104v288H48z"}))}function sSe(s){return M.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",onClick:e=>s.onClick&&s.onClick(e),viewBox:"0 0 512 512",width:s.width||(s.fontSize==="small"?16:20),height:s.height||s.width||(s.fontSize==="small"?16:20),className:s.className,style:s.style},M.createElement("path",{fill:"currentColor",d:"M369.9 97.9L286 14C277 5 264.8-.1 252.1-.1H48C21.5 0 0 21.5 0 48v416c0 26.5 21.5 48 48 48h288c26.5 0 48-21.5 48-48V131.9c0-12.7-5.1-25-14.1-34zM332.1 128H256V51.9l76.1 76.1zM48 464V48h160v104c0 13.3 10.7 24 24 24h104v288H48z"}),M.createElement("path",{fill:"currentColor",stroke:"null",d:"m261,270l-12,0l0,-24c0,-33.12 -26.88,-60 -60,-60s-60,26.88 -60,60l0,24l-12,0c-13.2,0 -24,10.8 -24,24l0,120c0,13.2 10.8,24 24,24l144,0c13.2,0 24,-10.8 24,-24l0,-120c0,-13.2 -10.8,-24 -24,-24zm-72,108c-13.2,0 -24,-10.8 -24,-24s10.8,-24 24,-24s24,10.8 24,24s-10.8,24 -24,24zm37.2,-108l-74.4,0l0,-24c0,-20.52 16.68,-37.2 37.2,-37.2c20.52,0 37.2,16.68 37.2,37.2l0,24z"}))}function iSe(s){return M.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",onClick:e=>s.onClick&&s.onClick(e),viewBox:"0 0 512 512",width:s.width||(s.fontSize==="small"?16:20),height:s.height||s.width||(s.fontSize==="small"?16:20),className:s.className,style:s.style},M.createElement("path",{fill:"currentColor",d:"M448 0L320 96v62.06l-83.03 83.03c6.79 4.25 13.27 9.06 19.07 14.87 5.8 5.8 10.62 12.28 14.87 19.07L353.94 192H416l96-128-64-64zM128 278.59L10.92 395.67c-14.55 14.55-14.55 38.15 0 52.71l52.7 52.7c14.56 14.56 38.15 14.56 52.71 0L233.41 384c29.11-29.11 29.11-76.3 0-105.41s-76.3-29.11-105.41 0z"}))}function Ai(s){return M.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",onClick:e=>s.onClick&&s.onClick(e),viewBox:"0 0 320 320",width:s.width||(s.fontSize==="small"?16:20),height:s.height||s.width||(s.fontSize==="small"?16:20),className:s.className,style:s.style},M.createElement("rect",{fill:"none",rx:"32",height:"272",width:"267",y:"25",x:"25",strokeWidth:"15",stroke:"currentColor"}),M.createElement("ellipse",{fill:"none",ry:"54",rx:"54",cy:"160",cx:"160",fillOpacity:"null",strokeOpacity:"null",strokeWidth:"15",stroke:"currentColor"}))}function rSe(s){return M.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",onClick:e=>s.onClick&&s.onClick(e),viewBox:"0 0 24 24",width:s.width||(s.fontSize==="small"?16:20),height:s.height||s.width||(s.fontSize==="small"?16:20),className:s.className,style:s.style},M.createElement("path",{fill:"currentColor",stroke:"currentColor",d:"M4.25 5.61C6.27 8.2 10 13 10 13v6c0 .55.45 1 1 1h2c.55 0 1-.45 1-1v-6s3.72-4.8 5.74-7.39A.998.998 0 0 0 18.95 4H5.04c-.83 0-1.3.95-.79 1.61z"}))}const qo={root:{width:"100%",height:"100%"},overflowHidden:{overflow:"hidden"},container:{height:"100%"}};function oSe(s){var e;return M.createElement(j.Paper,{elevation:Number.isNaN(s.elevation)?1:s.elevation,style:{...qo.root,...((e=s.styles)==null?void 0:e.root)||void 0,...s.overflow!=="visible"?qo.overflowHidden:void 0},onKeyDown:s.onKeyDown,tabIndex:s.tabIndex},M.createElement(j.Grid2,{container:!0,direction:"column",wrap:"nowrap",sx:qo.container},s.children))}const Ql={root:{height:"100%",overflow:"hidden"},overflowAuto:{overflow:"auto"}};function nSe(s){return M.createElement(j.Grid2,{sx:{...Ql.root,...(s==null?void 0:s.style)||void 0,...s.overflow==="auto"?Ql.overflowAuto:void 0},ref:s.ref},s.children)}function aSe(s){return M.createElement(j.Grid2,{container:!0,alignItems:"center"},s.children)}const ds=24,pe=32,MSe=16,ge=20,x4=s=>s==="dark"?"#62ff25":"#37c400",_4=s=>s==="dark"?"#ee56ff":"#a204b4",cSe=s=>s==="dark"?"#fff46e":"#b89101",S4=s=>"#ff6d69",k4=s=>"#5773ff",Y4="#ff413c",v4="#86211f",Bn="#57ff45",Jn="#098c04",Rn="#f3ad11",Fn="#6c5008",w={toolbar:{minHeight:38},toolbarButtons:{padding:4,marginLeft:4},switchColumnAuto:{marginLeft:16},dialogColumns:{transition:"opacity 1s"},dialogColumnsLabel:{fontSize:12,paddingTop:8},columnCustom:{width:"100%",display:"inline-block"},columnCustomEditable:{cursor:"text"},columnCustom_center:{textAlign:"center"},columnCustom_left:{textAlign:"left"},columnCustom_right:{textAlign:"right"},width100:{width:"100%"},transparent_10:{opacity:.1},transparent_20:{opacity:.2},transparent_30:{opacity:.3},transparent_40:{opacity:.4},transparent_50:{opacity:.5},transparent_60:{opacity:.6},transparent_70:{opacity:.7},transparent_80:{opacity:.8},transparent_90:{opacity:.9},transparent_100:{opacity:1},headerRow:{paddingLeft:8,height:38,whiteSpace:"nowrap",userSelect:"none"},buttonClearFilter:{position:"relative",float:"right",padding:0},buttonClearFilterIcon:{zIndex:2,position:"absolute",top:0,left:0,color:"#FF0000",opacity:.7},tableDiv:{paddingTop:0,paddingLeft:0,width:"calc(100% - 8px)",height:"calc(100% - 38px)",overflow:"auto"},tableRow:s=>({pl:1,height:pe,lineHeight:`${pe}px`,verticalAlign:"top",userSelect:"none",position:"relative",width:"100%","&:hover":{background:`${s.palette.mode==="dark"?s.palette.primary.dark:s.palette.primary.light} !important`,color:O.invertColor(s.palette.primary.main,!0)},whiteSpace:"nowrap",flexWrap:"nowrap"}),tableRowLines:s=>({borderBottom:`1px solid ${s.palette.mode==="dark","#8888882e"}`,"& > div":{borderRight:`1px solid ${s.palette.mode==="dark","#8888882e"}`}}),tableRowNoDragging:{cursor:"pointer"},tableRowAlias:{height:pe+10},tableRowAliasReadWrite:{height:pe+22},tableRowFocused:s=>({"&:after":{content:'""',position:"absolute",top:1,left:1,right:1,bottom:1,border:s.palette.mode?"1px dotted #000":"1px dotted #FFF"}}),checkBox:{padding:0},cellId:{position:"relative",fontSize:"1rem",overflow:"hidden",textOverflow:"ellipsis","& .copyButton":{display:"none"},"&:hover .copyButton":{display:"block"},"& .iconOwn":{display:"block",width:pe-4,height:pe-4,mt:"2px",float:"right"},"&:hover .iconOwn":{display:"none"},"& *":{width:"initial"}},cellIdSpan:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},cellIdIconFolder:s=>({marginRight:8,width:pe-4,height:pe-4,cursor:"pointer",color:s.palette.secondary.main||"#fbff7d",verticalAlign:"top"}),cellIdIconDocument:{verticalAlign:"middle",marginLeft:(pe-ge)/2,marginRight:8,width:ge,height:ge},cellIdIconOwn:{},cellIdTooltip:{fontSize:14},cellIdTooltipLink:{color:"#7ec2fd","&:hover":{color:"#7ec2fd"},"&:visited":{color:"#7ec2fd"}},cellCopyButton:{width:ge,height:ge,top:(pe-ge)/2,opacity:.8,position:"absolute",right:3},cellCopyButtonInDetails:{width:ge,height:ge,top:(pe-ge)/2,opacity:.8},cellEditButton:{width:ge,height:ge,color:"white",position:"absolute",top:(pe-ge)/2,right:ge+3,opacity:.7,"&:hover":{opacity:1}},cellName:{display:"inline-block",verticalAlign:"top",fontSize:14,ml:"5px",overflow:"hidden",textOverflow:"ellipsis",position:"relative","& .copyButton":{display:"none"},"&:hover .copyButton":{display:"block"}},cellNameWithDesc:{lineHeight:"normal"},cellNameDivDiv:{},cellDescription:{fontSize:10,opacity:.5,fontStyle:"italic"},cellIdAlias:s=>({fontStyle:"italic",fontSize:12,opacity:.7,"&:hover":{color:s.palette.mode==="dark"?"#009900":"#007700"}}),cellIdAliasReadWriteDiv:{height:24,marginTop:-5},cellIdAliasAlone:{lineHeight:0},cellIdAliasReadWrite:{lineHeight:"12px"},cellType:{display:"inline-block",verticalAlign:"top","& .itemIcon":{verticalAlign:"middle",width:ds,height:ds,display:"inline-block"},"& .itemIconFolder":{marginLeft:3}},cellRole:{display:"inline-block",verticalAlign:"top",textOverflow:"ellipsis",overflow:"hidden"},cellRoom:{display:"inline-block",verticalAlign:"top",textOverflow:"ellipsis",overflow:"hidden"},cellEnumParent:{opacity:.4},cellFunc:{display:"inline-block",verticalAlign:"top",textOverflow:"ellipsis",overflow:"hidden"},cellValue:{display:"inline-block",verticalAlign:"top",textOverflow:"ellipsis",overflow:"hidden"},cellValueButton:{marginTop:5},cellValueButtonFalse:{opacity:.3},cellAdapter:{display:"inline-block",verticalAlign:"top"},cellValueTooltip:{fontSize:12},cellValueText:{width:"100%",height:pe,fontSize:16,display:"flex",overflow:"hidden",textOverflow:"ellipsis",position:"relative",verticalAlign:"top","& .copyButton":{display:"none"},"&:hover .copyButton":{display:"block"}},cellValueFile:{color:"#2837b9"},cellValueTooltipTitle:{fontStyle:"italic",width:100,display:"inline-block"},cellValueTooltipValue:{width:120,display:"inline-block",whiteSpace:"nowrap",textOverflow:"ellipsis"},cellValueTooltipImage:{width:100,height:"auto"},cellValueTooltipBoth:{width:220,display:"inline-block",whiteSpace:"nowrap"},cellValueTooltipBox:{width:250,overflow:"hidden",pointerEvents:"none"},tooltip:{pointerEvents:"none"},cellValueTextUnit:{marginLeft:4,opacity:.8,display:"inline-block"},cellValueTextState:{opacity:.7},cellValueTooltipCopy:{position:"absolute",bottom:3,right:3},cellValueTooltipEdit:{position:"absolute",bottom:3,right:15},cellButtons:{display:"inline-block",verticalAlign:"top"},cellButtonsButton:{display:"inline-block",opacity:.5,width:ge+4,height:ge+4,"&:hover":{opacity:1},p:0,mt:"-2px"},cellButtonsEmptyButton:{fontSize:12},cellButtonMinWidth:{minWidth:40},cellButtonsButtonAlone:{ml:`${ge+6}px`,pt:0,mt:"-2px"},cellButtonsButtonWithCustoms:s=>({color:s.palette.mode==="dark"?s.palette.primary.main:s.palette.secondary.main}),cellButtonsButtonWithoutCustoms:{opacity:.2},cellButtonsValueButton:s=>({position:"absolute",top:ge/2-2,opacity:.7,width:ge-2,height:ge-2,color:s.palette.action.active,"&:hover":{opacity:1}}),cellButtonsValueButtonCopy:{right:8,cursor:"pointer"},cellButtonsValueButtonEdit:{right:ge/2+16},cellDetailsLine:{display:"flex",alignItems:"center",width:"100%",height:32,fontSize:16},cellDetailsName:{fontWeight:"bold",marginRight:8,minWidth:80},filteredOut:{opacity:.5},filteredParentOut:{opacity:.3},filterInput:{mt:0,mb:0},selectIcon:{width:24,height:24,marginRight:4},selectNone:{opacity:.5},itemSelected:s=>({background:`${s.palette.primary.main} !important`,color:`${O.invertColor(s.palette.primary.main,!0)} !important`}),header:{width:"100%"},headerCell:{display:"inline-block",verticalAlign:"top"},headerCellValue:{paddingTop:4,fontSize:16},headerCellInput:{width:"calc(100% - 5px)",height:pe,pt:0,"& .itemIcon":{verticalAlign:"middle",width:ds,height:ds,display:"inline-block"}},headerCellSelectItem:{"& .itemIcon":{width:ds,height:ds,mr:"5px",display:"inline-block"}},visibleButtons:{color:"#2196f3",opacity:.7},grow:{flexGrow:1},enumIconDiv:{marginRight:8,width:32,height:32,borderRadius:8,background:"#FFFFFF"},enumIcon:{marginTop:4,marginLeft:4,width:24,height:24},enumDialog:{overflow:"hidden"},enumList:{minWidth:250,height:"calc(100% - 50px)",overflow:"auto"},enumCheckbox:{minWidth:0},buttonDiv:{display:"flex",height:"100%",alignItems:"center"},aclText:{fontSize:13,marginTop:6},rightsObject:{color:"#55ff55",paddingLeft:3},rightsState:{color:"#86b6ff",paddingLeft:3},textCenter:{padding:12,textAlign:"center"},tooltipAccessControl:{display:"flex",flexDirection:"column"},fontSizeTitle:{"@media screen and (max-width: 465px)":{"& *":{fontSize:12}}},draggable:{cursor:"copy"},nonDraggable:{cursor:"no-drop"},selectClearButton:{position:"absolute",top:0,right:0,borderRadius:5,backgroundColor:"background.default"},iconDeviceConnected:s=>({color:s.palette.mode==="dark"?Bn:Jn,opacity:.8,position:"absolute",top:4,right:32,width:20}),iconDeviceDisconnected:s=>({color:s.palette.mode==="dark"?Rn:Fn,opacity:.8,position:"absolute",top:4,right:32,width:20}),iconDeviceError:s=>({color:s.palette.mode==="dark"?Y4:v4,opacity:.8,position:"absolute",top:4,right:50,width:20}),resizeHandle:{display:"block",position:"absolute",cursor:"col-resize",width:7,top:2,bottom:2,zIndex:1},resizeHandleRight:{right:3,borderRight:"2px dotted #888","&:hover":{borderColor:"#ccc",borderRightStyle:"solid"},"&.active":{borderColor:"#517ea5",borderRightStyle:"solid"}},invertedBackground:s=>({backgroundColor:s.palette.mode==="dark"?"#9a9a9a":"#565656",padding:"0 3px",borderRadius:"2px 0 0 2px"}),invertedBackgroundFlex:s=>({backgroundColor:s.palette.mode==="dark"?"#9a9a9a":"#565656",borderRadius:"0 2px 2px 0"}),contextMenuEdit:s=>({color:s.palette.mode==="dark"?"#ffee48":"#cbb801"}),contextMenuEditValue:s=>({color:s.palette.mode==="dark"?"#5dff45":"#1cd301"}),contextMenuView:s=>({color:s.palette.mode==="dark"?"#FFF":"#000"}),contextMenuCustom:s=>({color:s.palette.mode==="dark"?"#42eaff":"#01bbc2"}),contextMenuACL:s=>({color:s.palette.mode==="dark"?"#e079ff":"#500070"}),contextMenuRoom:s=>({color:s.palette.mode==="dark"?"#ff9a33":"#642a00"}),contextMenuRole:s=>({color:s.palette.mode==="dark"?"#ffdb43":"#562d00"}),contextMenuDelete:s=>({color:s.palette.mode==="dark"?"#ff4f4f":"#cf0000"}),contextMenuKeys:{marginLeft:8,opacity:.7,fontSize:"smaller"},contextMenuWithSubMenu:{display:"flex"}};function uSe(s){return M.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 436 436",style:s==null?void 0:s.style,width:"24",height:"24",className:"admin-button"},M.createElement("g",{fill:"currentColor"},M.createElement("path",{d:"m195.23077,24.30769c-36,3 -67,12 -96,26c-49,24 -82,61 -93,104l-3,11l-1,50c0,46 0,49 2,59l5,20c21,58 84,103 165,116c16,3 53,4 70,2c60,-6 111,-28 147,-64c21,-21 36,-49 40,-74a866,866 0 0 0 1,-104c-3,-18 -6,-28 -13,-43c-26,-52 -87,-90 -162,-101c-16,-2 -48,-3 -63,-2l1,0zm60,23c36,5 70,18 95,35c31,20 51,47 59,77c2,7 2,11 2,25c1,15 0,18 -2,26c-19,69 -104,117 -200,114c-47,-2 -90,-15 -124,-38c-31,-20 -51,-47 -59,-77c-3,-11 -4,-32 -2,-43c8,-42 41,-78 91,-101a260,260 0 0 1 140,-19l0,1zm-221,222c21,26 57,49 95,62c81,27 174,14 239,-32c14,-10 31,-27 41,-41c2,-2 2,-2 2,7c-1,23 -16,50 -38,72c-78,74 -233,74 -311,-1a121,121 0 0 1 -39,-76l0,-6l3,4l8,11z"}),M.createElement("path",{d:"m201.23077,47.30769c-40,3 -79,19 -104,44c-55,55 -38,133 37,171c52,26 122,24 172,-5c30,-17 51,-42 58,-71c3,-11 3,-34 0,-45c-6,-23 -21,-44 -40,-60l-27,-16a184,184 0 0 0 -96,-18zm30,21c56,5 100,35 112,75c4,11 4,30 0,41c-8,25 -26,45 -54,59a166,166 0 0 1 -160,-8a98,98 0 0 1 -41,-53c-5,-18 -2,-39 8,-57c23,-39 79,-62 135,-57z"})))}function Ul(s){s=(s||"").toString();const e=s[0]==="*",t=s[s.length-1]==="*";return s=s.replace(/[-/\\^$+?.()|[\]{}]/g,"\\$&").replace(/\*/g,".*"),(e?"":"^")+s+(t?"":"$")}function lSe(s,e){const t=[];for(let i=0;i<s.length;i++)e(t,s[i],i);return t}function NSe(s,e){const t={};for(const i in s)Object.prototype.hasOwnProperty.call(s,i)&&e(t,s[i],i);return t}function Gn(s,e,t){return Array.isArray(s)?lSe(s,(i,r,o)=>{if(r==null)return;const n=typeof r=="object";if(t&&n&&typeof r.en=="string"&&typeof r.de=="string"){i[o]=r.en;return}i[o]=n?Gn(r,e,t):r}):NSe(s,(i,r,o)=>{if(r==null||e.includes(o))return;const n=typeof r=="object";if(t&&n&&typeof r.en=="string"&&typeof r.de=="string"){i[o]=r.en;return}i[o]=n?Gn(r,e,t):r})}function $l(s,e,t){const i=document.createElement("a"),r=[];t.excludeSystemRepositories&&r.push("system.repositories");const o=r.length>0||t.excludeTranslations?Gn(e,r,t.excludeTranslations):e,n=t.beautify?JSON.stringify(o,null,2):JSON.stringify(o);i.setAttribute("href",`data:application/json;charset=utf-8,${encodeURIComponent(n)}`),i.setAttribute("download",s),i.style.display="none",document.body.appendChild(i),i.click(),document.body.removeChild(i)}function vi(s,e,t,i){if(t||=0,i===void 0&&(i=s.length-1,!i))return s[0]===e;const r=Math.floor((t+i)/2);return e===s[r]?!0:i-1===t?s[t]===e||s[i]===e:e>s[r]?vi(s,e,r,i):e<s[r]?vi(s,e,t,r):!1}function Ye(s,e){return typeof s=="object"?s?(s[e]||s.en||"").toString():"":s?s.toString():""}function Zr(s,e,t,i){var a,c;i||=".";let r="";const o=`system.adapter.${e}`,n=e&&((c=(a=s[o])==null?void 0:a.common)==null?void 0:c.icon);if(n)if(n.startsWith("data:image/"))n.startsWith("data:image/svg")?r=M.createElement(Wn,{className:"iconOwn",src:n,width:28,height:28}):r=n;else if(n.includes(".")){const l=s[o].common.name;typeof l=="object"?r=`${i}/adapter/${l[t]||l.en}/${n}`:r=`${i}/adapter/${l}/${n}`}else return n&&n.length<3?n:null;else{const l=s[e]&&s[e].common;if(l){const N=l.icon;if(N)if(N.startsWith("data:image/"))N.startsWith("data:image/svg")?r=M.createElement(Wn,{className:"iconOwn",src:N,width:28,height:28}):r=N;else if(N.includes(".")){let u;s[e].type==="instance"||s[e].type==="adapter"?typeof l.name=="object"?r=`${i}/adapter/${l.name[t]||l.name.en}/${N}`:r=`${i}/adapter/${l.name}/${N}`:e&&e.startsWith("system.adapter.")?(u=e.split(".",3),N[0]==="/"?u[2]+=N:u[2]+=`/${N}`,r=`${i}/adapter/${u[2]}`):(u=e.split(".",2),N[0]==="/"?u[0]+=N:u[0]+=`/${N}`,r=`${i}/adapter/${u[0]}`)}else return n&&n.length<3?n:null}}return r||null}function Hn(s,e,t,i,r,o,n,a,c){var u,L,g,y,T,d,z,I,C,m,A;c||=0;let l=!1;if(!r){if(r={},e.id){const D=e.id.toLowerCase();D.includes("*")?r.idRx=new RegExp(Ul(e.id),"i"):r.id=D}if(e.name){const D=e.name.toLowerCase();D.includes("*")?r.nameRx=new RegExp(Ul(D),"i"):r.name=D}e.type&&(r.type=e.type.toLowerCase()),e.custom&&(r.custom=e.custom.toLowerCase()),e.role&&(r.role=e.role.toLowerCase()),e.room&&(r.room=((L=(u=i[e.room])==null?void 0:u.common)==null?void 0:L.members)||[]),e.func&&(r.func=((y=(g=i[e.func])==null?void 0:g.common)==null?void 0:y.members)||[])}const N=s.data;if(N&&N.id){const D=(T=N.obj)==null?void 0:T.common;if(n){if(n.type&&(typeof n.type=="string"?(!N.obj||n.type!==N.obj.type)&&(l=!0):Array.isArray(n.type)&&(!N.obj||!n.type.includes(N.obj.type))&&(l=!0)),!l&&((d=n.common)!=null&&d.type)&&(D!=null&&D.type?typeof n.common.type=="string"?n.common.type!==D.type&&(l=!0):Array.isArray(n.common.type)&&(n.common.type.includes(D.type)||(l=!0)):l=!0),!l&&((z=n.common)!=null&&z.role)&&(D!=null&&D.role?typeof n.common.role=="string"?D.role.startsWith(n.common.role)&&(l=!0):Array.isArray(n.common.role)&&(n.common.role.find(p=>D.role.startsWith(p))||(l=!0)):l=!0),!l&&((I=n.common)==null?void 0:I.custom)==="_"&&(D!=null&&D.custom))l=!0;else if(!l&&((C=n.common)!=null&&C.custom)&&((m=n.common)==null?void 0:m.custom)!=="_"){const p=n.common.custom;if(!(D!=null&&D.custom))l=!0;else if(p==="_dataSources")Object.keys(D.custom).find(_=>_.startsWith("history.")||_.startsWith("sql.")||_.startsWith("influxdb."))||(l=!0);else if(Array.isArray(p)){const _=Object.keys(D.custom);p.find(x=>_.find(P=>P.startsWith(x)))&&(l=!0)}else p!==!0&&!Object.keys(D.custom).find(_=>_.startsWith(p))&&(l=!0)}}!l&&!e.expertMode&&(l=N.id==="system"||N.id==="enum"||N.id.startsWith("system.")||N.id.startsWith("enum.")||N.id.startsWith("_design/")||N.id.endsWith(".admin")||!!(D!=null&&D.expert)),!l&&r.id&&(N.fID===void 0&&(N.fID=N.id.toLowerCase()),l=!N.fID.includes(r.id)),!l&&r.idRx&&(l=!r.idRx.test(N.id)),!l&&r.name&&(D?(N.fName===void 0&&(N.fName=Ye(D.name,t)||"",N.fName=N.fName.toLowerCase()),l=!N.fName.includes(r.name)):l=!0),!l&&r.nameRx&&D&&(N.fName===void 0&&(N.fName=Ye(D.name,t)||"",N.fName=N.fName.toLowerCase()),l=!r.nameRx.test(N.fName)),!l&&e.role&&D&&(D?l=!(typeof D.role=="string"&&D.role.startsWith(r.role)):l=!0),!l&&r.room&&(l=!r.room.find(p=>p===N.id||N.id.startsWith(`${p}.`))),!l&&r.func&&(l=!r.func.find(p=>p===N.id||N.id.startsWith(`${p}.`))),!l&&r.type&&(l=!(N.obj&&N.obj.type&&N.obj.type===r.type)),!l&&a&&(l=!(N.obj&&N.obj.type&&a.includes(N.obj.type))),!l&&r.custom&&(D?r.custom==="_"?l=!!D.custom:l=!((A=D.custom)!=null&&A[r.custom]):l=!0)}return N.visible=!l,N.hasVisibleChildren=!1,s.children&&c<20&&s.children.forEach(D=>{Hn(D,e,t,i,r,o,n,a,c+1)&&(N.hasVisibleChildren=!0)}),N.sumVisibility=N.visible||N.hasVisibleChildren,o&&N.sumVisibility&&o.count++,N.id&&N.sumVisibility&&s.children&&s.children.forEach(D=>D.data.hasVisibleParent=!0),N.visible||N.hasVisibleChildren}function b4(s,e,t,i){var o;i||=[];const r=s.data;return r.sumVisibility&&(r.id&&t[r.id]&&t[r.id].type===e&&i.push(r.id),(o=s.children)==null||o.forEach(n=>b4(n,e,t,i))),i}function Pl(s,e,t,i,r,o){let n;return e==="alias"||e==="alias.0"?n=M.createElement(dN,{className:"iconOwn",style:{color:_4(i)}}):e==="0_userdata"||e==="0_userdata.0"?n=M.createElement(ag,{className:"iconOwn",style:{color:x4(i)}}):e.startsWith("_design/")||e==="system"?n=M.createElement(kr,{className:"iconOwn",style:{color:S4(i)}}):e==="system.adapter"?n=M.createElement(kr,{className:"iconOwn",style:{color:k4(i)}}):e==="system.group"?n=M.createElement(ja,{className:"iconOwn"}):e==="system.user"?n=M.createElement(La,{className:"iconOwn"}):e==="system.host"?n=M.createElement(ga,{className:"iconOwn"}):e.endsWith(".connection")||e.endsWith(".connected")?n=M.createElement(Qs,{className:"iconOwn"}):e.endsWith(".info")?n=M.createElement(Na,{className:"iconOwn"}):s[e]&&s[e].type==="meta"?n=M.createElement(Kr,{className:"iconOwn"}):t<2&&s[`system.adapter.${e}`]&&(n=Zr(s,`system.adapter.${e}`,r,o)),n||null}function Q4(s,e){var t,i;return(i=(t=s==null?void 0:s.obj)==null?void 0:t.common)!=null&&i.desc&&Ye(s.obj.common.desc,e)||null}function LSe(s,e){const t=Q4(s,e);return t!=null&&t.startsWith("http")?M.createElement(j.Box,{component:"a",sx:w.cellIdTooltipLink,href:t,target:"_blank",rel:"noreferrer"},t):M.createElement("span",{style:w.cellIdTooltip},t||s.id||"")}function Wl(s,e){var N,u,L,g,y,T,d,z,I,C;const t=e.imagePrefix||".";let i=Object.keys(s);i.sort((m,A)=>m===A?0:(m=m.replace(/\./g,"!!!"),A=A.replace(/\./g,"!!!"),m>A?1:-1)),e.root&&(i=i.filter(m=>m===e.root||m.startsWith(`${e.root}.`)));let r=[],o="",n=0;const a={data:{name:"",id:""},children:[]},c={funcEnums:[],roomEnums:[],roles:[],ids:[],types:[],objects:s,customs:["_"],enums:[],hasSomeCustoms:!1,aliasesMap:{}};let l=a;for(let m=0;m<i.length;m++){const A=i[m];if(!A)continue;const D=s[A],p=A.split(".");if(D.type&&!c.types.includes(D.type)&&c.types.push(D.type),D){const x=D.common,P=x==null?void 0:x.role;if(P&&!c.roles.find(v=>v.role===P)?typeof P!="string"?console.warn(`Invalid role type "${typeof P}" in "${D._id}"`):c.roles.push({role:P,type:x.type}):A.startsWith("enum.rooms.")?(c.roomEnums.push(A),c.enums.push(A)):A.startsWith("enum.functions.")?(c.funcEnums.push(A),c.enums.push(A)):D.type==="enum"?c.enums.push(A):D.type==="instance"&&x&&(x.supportCustoms||(N=x.adminUI)!=null&&N.custom)&&(c.hasSomeCustoms=!0,c.customs.push(A.substring(15))),A.startsWith("alias.")&&((u=D.common.alias)!=null&&u.id))if(typeof D.common.alias.id=="string"){const v=D.common.alias.id;c.aliasesMap[v]?c.aliasesMap[v].includes(A)||c.aliasesMap[v].push(A):c.aliasesMap[v]=[A]}else{const v=D.common.alias.id.read;v&&(c.aliasesMap[v]?c.aliasesMap[v].includes(A)||c.aliasesMap[v].push(A):c.aliasesMap[v]=[A]);const ee=D.common.alias.id.write;ee&&(c.aliasesMap[ee]?c.aliasesMap[ee].includes(A)||c.aliasesMap[ee].push(A):c.aliasesMap[ee]=[A])}}c.ids.push(A);let _;do if(_=!1,!o||A.startsWith(`${o}.`)){if(p.length-n>1){let P=o;for(let v=n;v<p.length-1;v++)if(P+=(P?".":"")+p[v],vi(c.ids,P))l.children&&(l=l.children.find(ee=>ee.data.name===p[v]));else{const ee={data:{name:p[v],parent:l,id:P,obj:s[P],level:v,icon:Pl(s,P,v,e.themeType,e.lang,t),generated:!0}};l.children||=[],l.children.push(ee),l=ee,c.ids.push(P)}}const x={data:{name:p[p.length-1],title:Ye((L=D==null?void 0:D.common)==null?void 0:L.name,e.lang),obj:D,parent:l,icon:Zr(s,A,e.lang,t)||Pl(s,A,0,e.themeType,e.lang,t),id:A,hasCustoms:!!((g=D.common)!=null&&g.custom&&Object.keys(D.common.custom).length),level:p.length-1,generated:!1,button:D.type==="state"&&!!((y=D.common)!=null&&y.role)&&typeof D.common.role=="string"&&D.common.role.startsWith("button")&&((T=D.common)==null?void 0:T.write)!==!1,switch:D.type==="state"&&((d=D.common)==null?void 0:d.type)==="boolean"&&((z=D.common)==null?void 0:z.write)!==!1&&((I=D.common)==null?void 0:I.read)!==!1,url:!!((C=D.common)!=null&&C.role)&&typeof D.common.role=="string"&&D.common.role.startsWith("url")}};l.children||=[],l.children.push(x),l=x,n=p.length,r=p,o=A}else{let x=0;for(;r[x]===p[x];)x++;if(x>0){let P=r.length;for(r=r.splice(0,x),n=x,o=r.join(".");P>x;)l.data.parent?l=l.data.parent:console.error(`Parent is null for ${A} ${o} ${r.join(".")}`),P--}else l=a,r=[],o="",n=0;_=!0}while(_)}return c.roomEnums.sort((m,A)=>{var _,x,P,v;const D=Ye((x=(_=s[m])==null?void 0:_.common)==null?void 0:x.name,e.lang)||m.split(".").pop(),p=Ye((v=(P=s[A])==null?void 0:P.common)==null?void 0:v.name,e.lang)||A.split(".").pop();return D>p?1:D<p?-1:0}),c.funcEnums.sort((m,A)=>{var _,x,P,v;const D=Ye((x=(_=s[m])==null?void 0:_.common)==null?void 0:x.name,e.lang)||m.split(".").pop(),p=Ye((v=(P=s[A])==null?void 0:P.common)==null?void 0:v.name,e.lang)||A.split(".").pop();return D>p?1:D<p?-1:0}),c.roles.sort((m,A)=>m.role.localeCompare(A.role)),c.types.sort(),{info:c,root:a}}function U4(s,e,t,i,r){if(s.data.id===e)return s;if(t||(t=e.split("."),r=0,i=t[r]),!s.children&&s.data.id!==e)return null;let o;if(s.children)for(let n=0;n<s.children.length;n++){const a=s.children[n].data.id;if(a===i){o=s.children[n];break}else if(a>i)break}return o?(r||=0,U4(o,e,t,`${i}.${t[r+1]}`,r+1)):null}function $4(s,e,t,i){var n,a;if(!e)return{rooms:[],per:!1};i||=[];for(const c of s.roomEnums){const l=(n=s.objects[c])==null?void 0:n.common;if(!l)continue;const N=Ye(l.name,t);(a=l.members)!=null&&a.includes(e)&&!i.includes(N)&&i.push(N)}let r;const o=e.split(".");return o.pop(),e=o.join("."),s.objects[e]&&(r=i.length,$4(s,e,t,i)),{rooms:i,per:!r}}function Ds(s,e,t,i){var r,o;if(!e)return[];i||=[];for(let n=0;n<s[t].length;n++){const a=(r=s.objects[s[t][n]])==null?void 0:r.common;(o=a==null?void 0:a.members)!=null&&o.includes(e)&&!i.includes(s[t][n])&&i.push(s[t][n])}return i.sort(),i}function P4(s,e,t,i){var n,a;if(!e)return{funcs:[],pef:!1};i||=[];for(let c=0;c<s.funcEnums.length;c++){const l=(n=s.objects[s.funcEnums[c]])==null?void 0:n.common;if(!l)continue;const N=Ye(l.name,t);(a=l.members)!=null&&a.includes(e)&&!i.includes(N)&&i.push(N)}let r;const o=e.split(".");return o.pop(),e=o.join("."),s.objects[e]&&(r=i.length,P4(s,e,t,i)),{funcs:i,pef:!r}}function en(s){var g;const{dateFormat:e,state:t,isFloatComma:i,texts:r,obj:o}=s,n=O.getStates(o),a=o.common;let c,l=(a==null?void 0:a.type)==="file"?"[file]":!t||t.val===null?"(null)":t.val===void 0?"[undef]":t.val;const N=typeof l;if(a!=null&&a.role&&typeof a.role=="string"&&a.role.match(/^value\.time|^date/))if(l&&typeof l=="string")if(O.isStringInteger(l))l=new Date(parseInt(l,10)).toString();else try{const y=new Date(l);O.isValidDate(y)&&(l=y.toString())}catch{}else l>946681200&&l<9466812e5&&(l*=1e3),l=l&&new Date(l).toString();else N==="number"?Number.isInteger(l)||(l=Math.round(l*1e8)/1e8,i&&(l=l.toString().replace(".",","))):N==="object"?l=JSON.stringify(l):N!=="string"?l=l.toString():l.startsWith("data:image/")&&(c="image"),typeof l!="string"&&(l=l.toString());const u={v:l};n&&n[l]!==void 0&&l!==n[l]&&(u.s=l,l=n[l],u.v=l),((g=u.v)==null?void 0:g.length)>40&&(u.c=u.v,u.v=`${u.v.substring(0,40)}...`),a!=null&&a.unit&&(u.u=a.unit);let L;if(s.full&&(typeof l=="string"&&l.length>100?L=[{t:r.value,v:`${l.substring(0,100)}...`}]:L=[{t:r.value,v:l}],t)){if(t.ack!==void 0&&t.ack!==null&&L.push({t:r.ack,v:t.ack.toString()}),t.ts&&L.push({t:r.ts,v:t.ts?O.formatDate(new Date(t.ts),e):""}),t.lc&&L.push({t:r.lc,v:t.lc?O.formatDate(new Date(t.lc),e):""}),t.from){let y=t.from.toString();y.startsWith("system.adapter.")&&(y=y.substring(15)),L.push({t:r.from,v:y})}if(t.user){let y=t.user.toString();y.startsWith("system.user.")&&(y=y.substring(12)),L.push({t:r.user,v:y})}t.c&&L.push({t:r.c,v:t.c}),L.push({t:r.quality,v:O.quality2text(t.q||0).join(", "),nbr:!0})}return{valText:u,valFull:L,fileViewer:c}}function gSe(s){const{state:e}=s;return{color:e!=null&&e.ack?e.q?"#ffa500":"":"#ff2222c9"}}function jSe(s,e){let t=e,i=1;const r=[];for(;i<s.length&&t<e+25*36e5;){for(;s[i-1].ts<t&&t<=s[i].ts&&i<s.length;)i++;if(i===1&&s[i-1].ts>=t)r.push(0);else if(i<s.length)if(typeof s[i].val=="boolean"||typeof s[i-1].val=="boolean")r.push(s[i].val?1:0);else{s[i-1].val||=0,s[i].val||=0;const o=s[i-1].val,n=s[i].val,a=o+(n-o)*(t-s[i-1].ts)/(s[i].ts-s[i-1].ts);r.push(a)}t+=36e5}return r}const Bl={state:M.createElement(Ai,{className:"itemIcon",style:{verticalAlign:"middle"}}),channel:M.createElement(E4,{className:"itemIcon",style:{verticalAlign:"middle"}}),device:M.createElement(f4,{className:"itemIcon",style:{verticalAlign:"middle"}}),adapter:M.createElement(eSe,{className:"itemIcon",style:{verticalAlign:"middle"}}),meta:M.createElement(Kr,{className:"itemIcon",style:{verticalAlign:"middle"}}),instance:M.createElement(iSe,{className:"itemIcon",style:{color:"#7da7ff",verticalAlign:"middle"}}),enum:M.createElement(Dg,{className:"itemIcon",style:{verticalAlign:"middle"}}),chart:M.createElement(pg,{className:"itemIcon",style:{verticalAlign:"middle"}}),config:M.createElement(Nn,{className:"itemIcon",style:{verticalAlign:"middle"}}),group:M.createElement(ja,{className:"itemIcon",style:{verticalAlign:"middle"}}),user:M.createElement(La,{className:"itemIcon",style:{verticalAlign:"middle"}}),host:M.createElement(ga,{className:"itemIcon",style:{verticalAlign:"middle"}}),schedule:M.createElement(sg,{className:"itemIcon",style:{verticalAlign:"middle"}}),script:M.createElement(la,{className:"itemIcon",style:{verticalAlign:"middle"}}),folder:M.createElement(Ws,{className:"itemIcon itemIconFolder",style:{verticalAlign:"middle"}})},le={xs:{idWidth:"100%",fields:[],widths:{}},sm:{idWidth:300,fields:["room","val"],widths:{room:100,val:200}},md:{idWidth:300,fields:["room","func","val","buttons"],widths:{name:200,room:150,func:150,val:120,buttons:120}},lg:{idWidth:300,fields:["name","type","role","room","func","val","buttons","changedFrom","qualityCode","timestamp","lastChange"],widths:{name:300,type:80,role:120,room:180,func:180,val:140,buttons:120,changedFrom:120,qualityCode:100,timestamp:165,lastChange:165}},xl:{idWidth:550,fields:["name","type","role","room","func","val","buttons","changedFrom","qualityCode","timestamp","lastChange"],widths:{name:400,type:80,role:120,room:180,func:180,val:140,buttons:120,changedFrom:120,qualityCode:100,timestamp:170,lastChange:170}}};let Jl=!1;const hr={id:"",name:"",room:"",func:"",role:"",type:"",custom:"",expertMode:!1};class it extends f.Component{info={funcEnums:[],roomEnums:[],roles:[],ids:[],types:[],objects:{},customs:[],enums:[],hasSomeCustoms:!1,aliasesMap:{}};localStorage=window._localStorage||window.localStorage;lastAppliedFilter=null;tableRef;filterRefs;pausedSubscribes=!1;selectFirst;root=null;states={};subscribes=[];unsubscribeTimer=null;statesUpdateTimer=null;objectsUpdateTimer=null;filterTimer=null;visibleCols;texts;possibleCols;imagePrefix;adapterColumns=[];styleTheme="";edit={id:"",val:"",q:0,ack:!1};levelPadding;customWidth=!1;resizeTimeout=null;resizerNextName=null;resizerActiveName=null;resizerCurrentWidths={};resizeLeft=!1;resizerOldWidth=0;resizerMin=0;resizerNextMin=0;resizerOldWidthNext=0;resizerPosition=0;resizerActiveDiv=null;resizerNextDiv=null;storedWidths=null;systemConfig;objects;defaultHistory="";cltrPressed=!1;columnsVisibility={};changedIds=null;contextMenu=null;recordStates=[];styles={};customColumnDialog=null;static#e=["0_userdata.0.","alias.0."];constructor(e){super(e);const t=this.localStorage.getItem(`${e.dialogName||"App"}.objectSelected`)||"";if(this.selectFirst="",t.startsWith("["))try{const d=JSON.parse(t);this.selectFirst=d[0]||""}catch{}else this.selectFirst=t;let i;const r=this.localStorage.getItem(`${e.dialogName||"App"}.objectExpanded`)||"[]";try{i=JSON.parse(r)}catch{i=[]}let o;const n=e.defaultFilters?"":this.localStorage.getItem(`${e.dialogName||"App"}.objectFilter`)||"";if(n)try{o=JSON.parse(n)}catch{o={...hr}}else e.defaultFilters&&typeof e.defaultFilters=="object"?o={...e.defaultFilters}:o={...hr};if(o.expertMode=e.expertMode!==void 0?e.expertMode:(window._sessionStorage||window.sessionStorage).getItem("App.expertMode")==="true",this.tableRef=f.createRef(),this.filterRefs={},Object.keys(hr).forEach(d=>this.filterRefs[d]=f.createRef()),this.visibleCols=e.columns||le[e.width||"lg"].fields,e.types&&e.types.length===1){const d=this.visibleCols.indexOf("type");d!==-1&&this.visibleCols.splice(d,1)}this.possibleCols=le.xl.fields;let a=null;if(e.router){const d=e.router.getLocation();d.id&&d.dialog==="customs"&&(a=[d.id],this.pauseSubscribe(!0))}let c;Array.isArray(e.selected)?c=e.selected:c=[e.selected||""],c=c.map(d=>d.replace(/["']/g,"")).filter(d=>d),this.selectFirst=c.length&&c[0]?c[0]:this.selectFirst;const l=this.localStorage.getItem(`${e.dialogName||"App"}.columns`);let N;try{N=l?JSON.parse(l):null}catch{N=null}let u=null;try{u=u?JSON.parse(u):{}}catch{u={}}this.imagePrefix=e.imagePrefix||".";let L;const g=this.localStorage.getItem(`${e.dialogName||"App"}.foldersFirst`);g==="false"?L=!1:g==="true"?L=!0:L=e.foldersFirst===void 0?!0:e.foldersFirst;let y=!1;try{y=this.props.objectStatesView&&JSON.parse(this.localStorage.getItem(`${e.dialogName||"App"}.objectStatesView`)||"")||!1}catch{}this.state={loaded:!1,foldersFirst:L,selected:c,selectedNonObject:this.localStorage.getItem(`${e.dialogName||"App"}.selectedNonObject`)||"",filter:o,filterKey:0,focused:this.localStorage.getItem(`${e.dialogName||"App"}.focused`)||"",depth:0,expandAllVisible:!1,expanded:i,toast:"",scrollBarWidth:16,customDialog:a,editObjectDialog:"",editObjectAlias:!1,viewFileDialog:"",showAliasEditor:"",enumDialog:null,roleDialog:null,statesView:y,columns:N,columnsForAdmin:null,columnsSelectorShow:!1,columnsAuto:this.localStorage.getItem(`${e.dialogName||"App"}.columnsAuto`)!=="false",columnsWidths:u,columnsDialogTransparent:100,columnsEditCustomDialog:null,customColumnDialogValueChanged:!1,showExportDialog:!1,showAllExportOptions:!1,linesEnabled:this.localStorage.getItem(`${e.dialogName||"App"}.lines`)==="true",showDescription:this.localStorage.getItem(`${e.dialogName||"App"}.desc`)!=="false",showContextMenu:null,noStatesByExportImport:!1,beautifyJsonExport:!0,excludeSystemRepositoriesFromExport:!0,excludeTranslations:!1,tooltipInfo:null,aliasMenu:"",showRenameDialog:null},this.texts={name:e.t("ra_Name"),categories:e.t("ra_Categories"),value:e.t("ra_tooltip_value"),ack:e.t("ra_tooltip_ack"),ts:e.t("ra_tooltip_ts"),lc:e.t("ra_tooltip_lc"),from:e.t("ra_tooltip_from"),user:e.t("ra_tooltip_user"),c:e.t("ra_tooltip_comment"),quality:e.t("ra_tooltip_quality"),editObject:e.t("ra_tooltip_editObject"),deleteObject:e.t("ra_tooltip_deleteObject"),customConfig:e.t("ra_tooltip_customConfig"),copyState:e.t("ra_tooltip_copyState"),editState:e.t("ra_tooltip_editState"),ctrlForLink:e.t("ra_tooltip_ctrlForLink"),close:e.t("ra_Close"),filter_id:e.t("ra_filter_id"),filter_name:e.t("ra_filter_name"),filter_type:e.t("ra_filter_type"),filter_role:e.t("ra_filter_role"),filter_room:e.t("ra_filter_room"),filter_func:e.t("ra_filter_func"),filter_custom:e.t("ra_filter_customs"),filterCustomsWithout:e.t("ra_filter_customs_without"),objectChangedByUser:e.t("ra_object_changed_by_user"),objectChangedBy:e.t("ra_object_changed_by"),objectChangedFrom:e.t("ra_state_changed_from"),stateChangedBy:e.t("ra_state_changed_by"),stateChangedFrom:e.t("ra_state_changed_from"),ownerGroup:e.t("ra_Owner group"),ownerUser:e.t("ra_Owner user"),showAll:e.t("ra_show_all"),deviceError:e.t("ra_Error"),deviceDisconnected:e.t("ra_Disconnected"),deviceConnected:e.t("ra_Connected"),aclOwner_read_object:e.t("ra_aclOwner_read_object"),aclOwner_read_state:e.t("ra_aclOwner_read_state"),aclOwner_write_object:e.t("ra_aclOwner_write_object"),aclOwner_write_state:e.t("ra_aclOwner_write_state"),aclGroup_read_object:e.t("ra_aclGroup_read_object"),aclGroup_read_state:e.t("ra_aclGroup_read_state"),aclGroup_write_object:e.t("ra_aclGroup_write_object"),aclGroup_write_state:e.t("ra_aclGroup_write_state"),aclEveryone_read_object:e.t("ra_aclEveryone_read_object"),aclEveryone_read_state:e.t("ra_aclEveryone_read_state"),aclEveryone_write_object:e.t("ra_aclEveryone_write_object"),aclEveryone_write_state:e.t("ra_aclEveryone_write_state"),create:e.t("ra_Create"),createBooleanState:e.t("ra_create_boolean_state"),createNumberState:e.t("ra_create_number_state"),createStringState:e.t("ra_create_string_state"),createState:e.t("ra_create_state"),createChannel:e.t("ra_create_channel"),createDevice:e.t("ra_create_device"),createFolder:e.t("ra_Create folder")},this.levelPadding=e.levelPadding||MSe;const T=this.localStorage.getItem(`${this.props.dialogName||"App"}.table`);if(T)try{const d=JSON.parse(T),z=this.props.width||"lg";this.storedWidths=JSON.parse(JSON.stringify(le[z])),Object.keys(d).forEach(I=>{I==="id"?le[z].idWidth=d.id:I==="nameHeader"?le[z].widths.name=d[I]:le[z].widths[I]!==void 0&&(le[z].widths[I]=d[I])}),this.customWidth=!0}catch{}this.calculateColumnsVisibility()}async loadAllObjects(e){var i;const t=this.props;try{await new Promise(l=>{this.setState({updating:!0},()=>l())});const r=(this.props.objectsWorker?await this.props.objectsWorker.getObjects(e):await t.socket.getObjects(e,!0))||{};if(t.types&&ze.isWeb())for(let l=0;l<t.types.length;l++){if(t.types[l]==="state"||t.types[l]==="channel"||t.types[l]==="device"||t.types[l]==="enum")continue;const N=await t.socket.getObjectViewSystem(t.types[l]);Object.assign(r||{},N)}if(this.systemConfig=this.systemConfig||(r==null?void 0:r["system.config"])||await t.socket.getObject("system.config"),this.systemConfig.common=this.systemConfig.common||{},this.systemConfig.common.defaultNewAcl=this.systemConfig.common.defaultNewAcl||{object:0,state:0,file:0,owner:"system.user.admin",ownerGroup:"system.group.administrator"},this.systemConfig.common.defaultNewAcl.owner=this.systemConfig.common.defaultNewAcl.owner||"system.user.admin",this.systemConfig.common.defaultNewAcl.ownerGroup=this.systemConfig.common.defaultNewAcl.ownerGroup||"system.group.administrator",typeof this.systemConfig.common.defaultNewAcl.state!="number"&&(this.systemConfig.common.defaultNewAcl.state=1636),typeof this.systemConfig.common.defaultNewAcl.object!="number"&&(this.systemConfig.common.defaultNewAcl.state=1636),typeof t.filterFunc=="function"){this.objects={};const l=t.filterFunc;Object.keys(r).forEach(N=>{try{if(l(r[N]))this.objects[N]=r[N];else{const u=r[N]&&r[N].type;u&&(u==="channel"||u==="device"||u==="folder"||u==="adapter"||u==="instance")&&(this.objects[N]=r[N])}}catch(u){console.log(`Error by filtering of "${N}": ${u}`)}})}else if(t.types){this.objects={};const l=t.types;Object.keys(r).forEach(N=>{var L;const u=(L=r[N])==null?void 0:L.type;u&&(u==="channel"||u==="device"||u==="enum"||u==="folder"||u==="adapter"||u==="instance"||l.includes(u))&&(this.objects[N]=r[N])})}else this.objects=r;t.setObjectsReference&&t.setObjectsReference(this.objects),this.defaultHistory=this.systemConfig.common.defaultHistory,this.defaultHistory&&t.socket.getState(`system.adapter.${this.defaultHistory}.alive`).then(l=>{l!=null&&l.val||(this.defaultHistory="")}).catch(l=>window.alert(`Cannot get state: ${l}`));const o=await this.getAdditionalColumns();this.calculateColumnsVisibility(null,null,o);const{info:n,root:a}=Wl(this.objects,{imagePrefix:this.props.imagePrefix,root:this.props.root,lang:this.props.lang,themeType:this.props.themeType});this.root=a,this.info=n;const c=((i=this.state.selected)==null?void 0:i.length)&&U4(this.root,this.state.selected[0]);this.lastAppliedFilter=null,c&&!Hn(c,this.state.filter,this.props.lang,this.objects,void 0,void 0,t.customFilter,t.types)?this.setState({filter:{...hr},columnsForAdmin:o},()=>{this.setState({loaded:!0,updating:!1},()=>this.expandAllSelected(()=>this.onAfterSelect()))}):this.setState({loaded:!0,updating:!1,columnsForAdmin:o},()=>this.expandAllSelected(()=>this.onAfterSelect()))}catch(r){this.showError(r)}}static isNonExpertId(e){return!!it.#e.find(t=>e.startsWith(t))}expandAllSelected(e){const t=[...this.state.expanded];let i=!1;this.state.selected.forEach(r=>{const o=r.split("."),n=[];for(let a=0;a<o.length-1;a++)n.push(o[a]),t.includes(n.join("."))||(t.push(n.join(".")),i=!0)}),i?(t.sort(),this.localStorage.setItem(`${this.props.dialogName||"App"}.objectExpanded`,JSON.stringify(t)),this.setState({expanded:t},e)):e&&e()}onAfterSelect(e){var t,i,r,o,n;if((t=this.state.selected)!=null&&t.length&&this.state.selected[0]){this.localStorage.setItem(`${this.props.dialogName||"App"}.objectSelected`,this.state.selected[0]),this.selectFirst&&this.selectFirst!==this.state.selected[0]&&(this.selectFirst="");const a=this.findItem(this.state.selected[0]);if(a!=null&&a.data&&!a.data.visible&&this.clearFilter(),this.state.selected.length===1&&this.objects[this.state.selected[0]]){const c=O.getObjectName(this.objects,this.state.selected[0],null,{language:this.props.lang});(r=(i=this.props).onSelect)==null||r.call(i,this.state.selected,c,e)}else this.state.selected.length===1&&this.props.allowNonObjects&&((n=(o=this.props).onSelect)==null||n.call(o,this.state.selected,null,e))}else this.localStorage.removeItem(`${this.props.dialogName||"App"}.objectSelected`),this.state.selected.length?this.setState({selected:[]},()=>{this.props.onSelect&&(this.state.focused&&this.props.allowNonObjects?(this.selectFirst&&this.selectFirst!==this.state.selected[0]&&(this.selectFirst=""),this.props.onSelect([this.state.focused],null,e)):this.props.onSelect([],""))}):this.props.onSelect&&(this.state.focused&&this.props.allowNonObjects?(this.selectFirst&&this.selectFirst!==this.state.selected[0]&&(this.selectFirst=""),this.props.onSelect([this.state.focused],null,e)):this.props.onSelect([],""))}static getDerivedStateFromProps(e,t){const i={};let r=!1;return e.expertMode!==void 0&&e.expertMode!==t.filter.expertMode&&(r=!0,i.filter={...t.filter},i.filter.expertMode=e.expertMode),r?i:null}async componentDidMount(){await this.loadAllObjects(!Jl),this.props.objectsWorker?this.props.objectsWorker.registerHandler(this.onObjectChangeFromWorker):await this.props.socket.subscribeObject("*",this.onObjectChange),Jl=!0,window.addEventListener("contextmenu",this.onContextMenu,!0),window.addEventListener("keydown",this.onKeyPress,!0),window.addEventListener("keyup",this.onKeyPress,!0)}onKeyPress=e=>{e.type==="keydown"&&e.ctrlKey&&!this.cltrPressed?(this.cltrPressed=!0,this.tableRef.current&&(this.tableRef.current.className="highlight-link")):e.type==="keyup"&&!e.ctrlKey&&this.cltrPressed&&(this.cltrPressed=!1,this.tableRef.current&&(this.tableRef.current.className=""))};componentWillUnmount(){this.filterTimer&&(clearTimeout(this.filterTimer),this.filterTimer=null),window.removeEventListener("contextmenu",this.onContextMenu,!0),window.removeEventListener("keydown",this.onKeyPress,!0),window.removeEventListener("keyup",this.onKeyPress,!0),this.props.objectsWorker?this.props.objectsWorker.unregisterHandler(this.onObjectChangeFromWorker,!0):this.props.socket.unsubscribeObject("*",this.onObjectChange).catch(e=>console.error(`Cannot unsubscribe *: ${e}`)),this.subscribes.forEach(e=>{console.log(`- unsubscribe ${e}`),this.props.socket.unsubscribeState(e,this.onStateChange)}),this.subscribes=[],this.objects={}}showDeleteDialog(e){var c,l,N,u;const{id:t,obj:i,item:r}=e,o=Object.keys(this.objects);o.sort();let n=0;const a=`${t}.`;for(let L=0;L<o.length;L++)if(o[L].startsWith(a))n++;else if(o[L]>a)break;(u=(N=this.props).onObjectDelete)==null||u.call(N,t,!!((c=r.children)!=null&&c.length),!((l=i.common)!=null&&l.dontDelete),n+1)}onContextMenu=e=>{this.contextMenu&&Date.now()-this.contextMenu.ts<2e3?(e.preventDefault(),this.setState({showContextMenu:{item:this.contextMenu.item,position:{left:e.clientX+2,top:e.clientY-6}}})):this.state.showContextMenu&&(e.preventDefault(),this.setState({showContextMenu:null})),this.contextMenu=null};refreshComponent(){this.subscribes.forEach(e=>{console.log(`- unsubscribe ${e}`),this.props.socket.unsubscribeState(e,this.onStateChange)}),this.subscribes=[],this.loadAllObjects(!0).then(()=>console.log("updated!")).catch(e=>this.showError(e))}renderErrorDialog(){return this.state.error?M.createElement(j.Dialog,{open:!0,maxWidth:"sm",fullWidth:!0,onClose:()=>this.setState({error:""}),"aria-labelledby":"error-dialog-title","aria-describedby":"error-dialog-description"},M.createElement(j.DialogTitle,{id:"alert-dialog-title"},this.props.t("ra_Error")),M.createElement(j.DialogContent,null,M.createElement(j.DialogContentText,{id:"alert-dialog-description"},this.state.error)),M.createElement(j.DialogActions,null,M.createElement(j.Button,{variant:"contained",onClick:()=>this.setState({error:""}),color:"primary",autoFocus:!0,startIcon:M.createElement(Oe,null)},this.props.t("ra_Ok")))):null}showError(e){this.setState({error:typeof e=="object"?e&&typeof e.toString=="function"?e.toString():JSON.stringify(e):e})}onSelect(e,t,i){if(this.localStorage.setItem(`${this.props.dialogName||"App"}.focused`,e),!this.props.multiSelect)this.objects[e]&&(!this.props.types||this.props.types.includes(this.objects[e].type))?(this.localStorage.removeItem(`${this.props.dialogName||"App"}.selectedNonObject`),this.state.selected[0]!==e?this.setState({selected:[e],selectedNonObject:"",focused:e},()=>{this.onAfterSelect(t),i&&i()}):t&&this.props.onSelect&&this.onAfterSelect(t)):(this.localStorage.setItem(`${this.props.dialogName||"App"}.selectedNonObject`,e),this.setState({selected:[],selectedNonObject:e,focused:e},()=>{this.onAfterSelect(),i&&i()}));else if(this.objects[e]&&(!this.props.types||this.props.types.includes(this.objects[e].type))){this.localStorage.removeItem(`${this.props.dialogName||"App"}.selectedNonObject`);const r=[...this.state.selected],o=r.indexOf(e);o===-1?(r.push(e),r.sort()):t||r.splice(o,1),this.setState({selected:r,selectedNonObject:"",focused:e},()=>{this.onAfterSelect(t),i&&i()})}}_renderDefinedList(e){const t=[...this.possibleCols];if(t.unshift("id"),this.props.columns&&!this.props.columns.includes("buttons")){const i=t.indexOf("buttons");i!==-1&&t.splice(i,1)}return t.filter(i=>e&&(i==="val"||i==="buttons")||!e&&i!=="val"&&i!=="buttons").map(i=>{var r;return M.createElement(j.ListItemButton,{onClick:()=>{if(!this.state.columnsAuto&&i!=="id"){const o=[...this.state.columns||[]],n=o.indexOf(i);n===-1?(o.push(i),o.sort()):o.splice(n,1),this.localStorage.setItem(`${this.props.dialogName||"App"}.columns`,JSON.stringify(o)),this.calculateColumnsVisibility(null,o),this.setState({columns:o})}},key:i},M.createElement(j.Checkbox,{edge:"start",disabled:i==="id"||this.state.columnsAuto,checked:i==="id"||!!(this.state.columnsAuto?this.visibleCols.includes(i):(r=this.state.columns)!=null&&r.includes(i)),disableRipple:!0}),M.createElement(j.ListItemText,{primary:this.texts[`filter_${i}`]||this.props.t(`ra_${i}`)}))})}renderColumnsSelectorDialog(){return this.state.columnsSelectorShow?M.createElement(j.Dialog,{onClose:()=>this.setState({columnsSelectorShow:!1}),open:!0,sx:{"& .MuiPaper-root":O.getStyle(this.props.theme,w.dialogColumns,w[`transparent_${this.state.columnsDialogTransparent}`])}},M.createElement(j.DialogTitle,{sx:w.fontSizeTitle},this.props.t("ra_Configure")),M.createElement(j.DialogContent,{sx:w.fontSizeTitle},M.createElement(j.FormControlLabel,{style:w.switchColumnAuto,control:M.createElement(j.Switch,{checked:this.state.foldersFirst,onChange:()=>{this.localStorage.setItem(`${this.props.dialogName||"App"}.foldersFirst`,this.state.foldersFirst?"false":"true"),this.setState({foldersFirst:!this.state.foldersFirst})}}),label:this.props.t("ra_Folders always first")}),M.createElement(j.FormControlLabel,{style:w.switchColumnAuto,control:M.createElement(j.Switch,{checked:this.state.linesEnabled,onChange:()=>{this.localStorage.setItem(`${this.props.dialogName||"App"}.lines`,this.state.linesEnabled?"false":"true"),this.setState({linesEnabled:!this.state.linesEnabled})}}),label:this.props.t("ra_Show lines between rows")}),M.createElement(j.FormControlLabel,{style:w.switchColumnAuto,control:M.createElement(j.Switch,{checked:this.state.columnsAuto,onChange:()=>{this.localStorage.setItem(`${this.props.dialogName||"App"}.columnsAuto`,this.state.columnsAuto?"false":"true"),this.state.columnsAuto?this.state.columns?(this.calculateColumnsVisibility(!1),this.setState({columnsAuto:!1})):(this.calculateColumnsVisibility(!1,[...this.visibleCols]),this.setState({columnsAuto:!1,columns:[...this.visibleCols]})):(this.calculateColumnsVisibility(!0),this.setState({columnsAuto:!0}))}}),label:this.props.t("ra_Auto (no custom columns)")}),M.createElement(j.List,null,this._renderDefinedList(!1),this.state.columnsForAdmin&&Object.keys(this.state.columnsForAdmin).sort().map(e=>{var t;return(t=this.state.columnsForAdmin)==null?void 0:t[e].map(i=>{var r;return M.createElement(j.ListItemButton,{onClick:()=>{if(!this.state.columnsAuto){const o=[...this.state.columns||[]],n=`_${e}_${i.path}`,a=o.indexOf(n);a===-1?(o.push(n),o.sort()):o.splice(a,1),this.calculateColumnsVisibility(null,o),this.localStorage.setItem(`${this.props.dialogName||"App"}.columns`,JSON.stringify(o)),this.setState({columns:o})}},key:`${e}_${i.name}`},M.createElement(j.ListItemIcon,null,M.createElement(j.Checkbox,{disabled:this.state.columnsAuto,edge:"start",checked:!this.state.columnsAuto&&((r=this.state.columns)==null?void 0:r.includes(`_${e}_${i.path}`)),disableRipple:!0})),M.createElement(j.ListItemText,{primary:`${i.name} (${e})`}))})}),this._renderDefinedList(!0))),M.createElement(j.DialogActions,null,M.createElement(j.Button,{variant:"contained",onClick:()=>this.setState({columnsSelectorShow:!1}),color:"primary",startIcon:M.createElement(Ne,null)},this.texts.close))):null}async getAdditionalColumns(){try{const e=await this.props.socket.getAdapters();let t=null;return e.forEach(i=>t=this.parseObjectForAdmins(t,i)),t}catch(e){return console.error(`Cannot get adapters: ${e}`),null}}checkUnsubscribes(){for(let e=this.subscribes.length-1;e>=0;e--)this.recordStates.includes(this.subscribes[e])||this.unsubscribe(this.subscribes[e]);this.recordStates=[]}findItem(e,t,i,r){if(t||=e.split("."),i||=this.root,!i||!t.length)return null;if(r=(r?`${r}.`:"")+t.shift(),i.children){const o=i.children.find(n=>n.data.id===r);if(o){if(o.data.id===e)return o;if(t.length)return this.findItem(e,t,o,r)}else return null}return null}onStateChange=(e,t)=>{if(console.log(`> stateChange ${e}`),this.states[e]){const i=this.findItem(e);i!=null&&i.data.state&&(i.data.state=void 0)}t?this.states[e]=t:delete this.states[e],this.pausedSubscribes?this.statesUpdateTimer&&(clearTimeout(this.statesUpdateTimer),this.statesUpdateTimer=null):this.statesUpdateTimer||(this.statesUpdateTimer=setTimeout(()=>{this.statesUpdateTimer=null,this.forceUpdate()},300))};parseObjectForAdmins(e,t){var i;if((i=t.common)!=null&&i.adminColumns&&t.common.name){const r=t.common.adminColumns;let o;r&&typeof r!="object"?o=[r]:r&&(o=r);let n;r?n=o.map(a=>{if(typeof a!="object")return{path:a,name:a.split(".").pop()};const c=a;return c.objTypes&&typeof c.objTypes!="object"?c.objTypes=[c.objTypes]:c.objTypes||(c.objTypes=void 0),!c.name&&c.path?{path:c.path,name:c.path.split(".").pop(),width:c.width,edit:!!c.edit,type:c.type,objTypes:c.objTypes}:c.path?{path:c.path,name:Ye(c.name||"",this.props.lang),width:c.width,edit:!!c.edit,type:c.type,objTypes:c.objTypes}:(console.warn(`Admin columns for ${t._id} ignored, because path not found`),null)}).filter(a=>a):n=null,n!=null&&n.length&&(e||={},e[t.common.name]=n.sort((a,c)=>a.path>c.path?-1:a.path<c.path?1:0))}else t.common&&t.common.name&&e&&e[t.common.name]&&delete e[t.common.name];return e}onObjectChangeFromWorker=e=>{if(Array.isArray(e)){let t=null;e.forEach(i=>{const{newInnerState:r,filtered:o}=this.processOnObjectChangeElement(i.id,i.obj);o||(r&&t?Object.assign(t,r):t=r)}),t&&this.setState(t),this.afterObjectUpdated()}};onObjectChange=(e,t)=>{const{newInnerState:i,filtered:r}=this.processOnObjectChangeElement(e,t);r||(i&&this.setState(i),this.afterObjectUpdated())};afterObjectUpdated(){!this.objectsUpdateTimer&&this.objects&&(this.objectsUpdateTimer=setTimeout(()=>{this.objectsUpdateTimer=null;const{info:e,root:t}=Wl(this.objects,{imagePrefix:this.props.imagePrefix,root:this.props.root,lang:this.props.lang,themeType:this.props.themeType});this.root=t,this.info=e,this.lastAppliedFilter=null,this.pausedSubscribes||this.forceUpdate()},500))}updateAliases(e){var i,r,o;if(!this.objects||!((i=this.info)!=null&&i.aliasesMap)||!(e!=null&&e.startsWith("alias.")))return;const t=Object.keys(this.objects).filter(n=>n.startsWith("alias.0"));this.info.aliasesMap={};for(const n of t){const a=this.objects[n];if((o=(r=a==null?void 0:a.common)==null?void 0:r.alias)!=null&&o.id)if(typeof a.common.alias.id=="string"){const c=a.common.alias.id;this.info.aliasesMap[c]?this.info.aliasesMap[c].includes(n)||this.info.aliasesMap[c].push(n):this.info.aliasesMap[c]=[n]}else{const c=a.common.alias.id.read;c&&(this.info.aliasesMap[c]?this.info.aliasesMap[c].includes(n)||this.info.aliasesMap[c].push(n):this.info.aliasesMap[c]=[n]);const l=a.common.alias.id.write;l&&(this.info.aliasesMap[l]?this.info.aliasesMap[l].includes(n)||this.info.aliasesMap[l].push(n):this.info.aliasesMap[l]=[n])}}}processOnObjectChangeElement(e,t){console.log(`> objectChange ${e}`);const i=t==null?void 0:t.type;if(t&&typeof this.props.filterFunc=="function"&&!this.props.filterFunc(t)&&i!=="channel"&&i!=="device"&&i!=="folder"&&i!=="adapter"&&i!=="instance")return{newInnerState:null,filtered:!0};let r=null;if(e.startsWith("system.adapter.")&&(t==null?void 0:t.type)==="adapter"){const o=JSON.parse(JSON.stringify(this.state.columnsForAdmin));this.parseObjectForAdmins(o,t),JSON.stringify(this.state.columnsForAdmin)!==JSON.stringify(o)&&(r={columnsForAdmin:o})}return this.objects||={},t?this.objects[e]=t:this.objects[e]&&delete this.objects[e],this.updateAliases(e),{newInnerState:r,filtered:!1}}subscribe(e){this.subscribes.includes(e)||(this.subscribes.push(e),console.log(`+ subscribe ${e}`),this.pausedSubscribes||this.props.socket.subscribeState(e,this.onStateChange).catch(t=>console.error(`Cannot subscribe on state ${e}: ${t}`)))}unsubscribe(e){const t=this.subscribes.indexOf(e);t!==-1&&(this.subscribes.splice(t,1),this.states[e]&&delete this.states[e],console.log(`- unsubscribe ${e}`),this.props.socket.unsubscribeState(e,this.onStateChange),this.pausedSubscribes&&console.warn("Unsubscribe during pause?"))}pauseSubscribe(e){!this.pausedSubscribes&&e?(this.pausedSubscribes=!0,this.subscribes.forEach(t=>this.props.socket.unsubscribeState(t,this.onStateChange))):this.pausedSubscribes&&!e&&(this.pausedSubscribes=!1,this.subscribes.forEach(t=>this.props.socket.subscribeState(t,this.onStateChange)))}onFilter(e,t){this.filterTimer=null;const i={...this.state.filter};Object.keys(this.filterRefs).forEach(r=>{var o;if((o=this.filterRefs[r])!=null&&o.current){const n=this.filterRefs[r].current;for(let a=0;a<n.children.length;a++)if(n.children[a].tagName==="INPUT"){i[r]=n.children[a].value;break}}}),e&&(i[e]=t,e==="expertMode"&&(window._sessionStorage||window.sessionStorage).setItem("App.expertMode",t?"true":"false")),JSON.stringify(this.state.filter)!==JSON.stringify(i)&&(this.localStorage.setItem(`${this.props.dialogName||"App"}.objectFilter`,JSON.stringify(i)),this.setState({filter:i},()=>this.props.onFilterChanged&&this.props.onFilterChanged(i)))}clearFilter(){const e={...this.state.filter};Object.keys(this.filterRefs).forEach(t=>{var i;if((i=this.filterRefs[t])!=null&&i.current){const r=this.filterRefs[t].current;for(let o=0;o<r.childNodes.length;o++){const n=r.childNodes[o];if(n.tagName==="INPUT"){e[t]="",n.value="";break}}}}),JSON.stringify(this.state.filter)!==JSON.stringify(e)&&(this.localStorage.setItem(`${this.props.dialogName||"App"}.objectFilter`,JSON.stringify(e)),this.setState({filter:e,filterKey:this.state.filterKey+1},()=>{var t,i;return(i=(t=this.props).onFilterChanged)==null?void 0:i.call(t,e)}))}isFilterEmpty(){return!Object.keys(this.state.filter).find(t=>t!=="expertMode"&&this.state.filter[t])}getFilterInput(e){var t,i,r;return M.createElement(j.FormControl,{sx:this.styles.filterInput,key:`${e}_${this.state.filterKey}`,title:e==="name"||e==="id"?this.props.t("ra_You can use * as wildcard"):void 0,margin:"dense"},M.createElement(j.Input,{ref:this.filterRefs[e],classes:{underline:"no-underline"},id:e,placeholder:this.texts[`filter_${e}`],defaultValue:this.state.filter[e]||"",onChange:()=>{this.filterTimer&&clearTimeout(this.filterTimer),this.filterTimer=setTimeout(()=>this.onFilter(),400)},autoComplete:"off"}),(r=(i=(t=this.filterRefs[e])==null?void 0:t.current)==null?void 0:i.firstChild)!=null&&r.value?M.createElement("div",{style:{position:"absolute",right:0}},M.createElement(j.IconButton,{size:"small",onClick:()=>{var o;((o=this.filterRefs[e].current)==null?void 0:o.firstChild).value="",this.onFilter(e,"")}},M.createElement(Ne,null))):null)}getFilterSelect(e,t){var r,o,n;const i=!!(t!=null&&t.find(a=>a.icon));return M.createElement("div",{style:{position:"relative"}},M.createElement(j.Select,{variant:"standard",key:`${e}_${this.state.filterKey}`,ref:this.filterRefs[e],sx:w.headerCellInput,className:"no-underline",onChange:()=>{this.filterTimer&&clearTimeout(this.filterTimer),this.filterTimer=setTimeout(()=>this.onFilter(),400)},defaultValue:this.state.filter[e]||"",inputProps:{name:e,id:e},displayEmpty:!0},M.createElement(j.MenuItem,{key:"empty",value:""},M.createElement("span",{style:w.selectNone},e==="custom"?this.texts.showAll:this.texts[`filter_${e}`])),t==null?void 0:t.map(a=>{let c,l,N;return typeof a=="object"?(c=a.value,l=a.name,N=a.icon):(c=a,l=a),M.createElement(j.MenuItem,{sx:w.headerCellSelectItem,key:c,value:c},N||(i?M.createElement("div",{className:"itemIcon"}):null),l)})),(n=(o=(r=this.filterRefs[e])==null?void 0:r.current)==null?void 0:o.childNodes[1])!=null&&n.value?M.createElement(j.Box,{component:"div",sx:w.selectClearButton},M.createElement(j.IconButton,{size:"small",onClick:()=>{var c;const a={...this.state.filter};a[e]="",((c=this.filterRefs[e].current)==null?void 0:c.childNodes[1]).value="",this.localStorage.setItem(`${this.props.dialogName||"App"}.objectFilter`,JSON.stringify(a)),this.setState({filter:a,filterKey:this.state.filterKey+1},()=>this.props.onFilterChanged&&this.props.onFilterChanged(a))}},M.createElement(Ne,null))):null)}getFilterSelectRole(){return this.getFilterSelect("role",this.info.roles.map(e=>e.role))}getFilterSelectRoom(){const e=this.info.roomEnums.map(t=>{var i,r,o,n;return{name:Ye((r=(i=this.objects[t])==null?void 0:i.common)==null?void 0:r.name,this.props.lang)||t.split(".").pop(),value:t,icon:M.createElement(me,{src:((n=(o=this.objects[t])==null?void 0:o.common)==null?void 0:n.icon)||"",style:w.selectIcon})}});return this.getFilterSelect("room",e)}getFilterSelectFunction(){const e=this.info.funcEnums.map(t=>{var i,r,o,n;return{name:Ye((r=(i=this.objects[t])==null?void 0:i.common)==null?void 0:r.name,this.props.lang)||t.split(".").pop(),value:t,icon:M.createElement(me,{src:((n=(o=this.objects[t])==null?void 0:o.common)==null?void 0:n.icon)||"",style:w.selectIcon})}});return this.getFilterSelect("func",e)}getFilterSelectType(){const e=this.info.types.map(t=>({name:t,value:t,icon:Bl[t]||null}));return this.getFilterSelect("type",e)}getFilterSelectCustoms(){if(this.info.customs.length>1){const e=this.info.customs.map(t=>({name:t==="_"?this.texts.filterCustomsWithout:t,value:t,icon:t==="_"?null:M.createElement(me,{src:Zr(this.objects,t,this.props.lang,this.imagePrefix)||"",style:w.selectIcon})}));return this.getFilterSelect("custom",e)}return null}onExpandAll(e,t){var r;const i=e||this.root;t||=[],(r=i==null?void 0:i.children)==null||r.forEach(o=>{o.data.sumVisibility&&(t.push(o.data.id),this.onExpandAll(o,t))}),i===this.root&&(t.sort(),this.localStorage.setItem(`${this.props.dialogName||"App"}.objectExpanded`,JSON.stringify(t)),this.setState({expanded:t}))}onCollapseAll(){this.localStorage.setItem(`${this.props.dialogName||"App"}.objectExpanded`,JSON.stringify([])),this.localStorage.setItem(`${this.props.dialogName||"App"}.objectSelected`,"[]"),this.setState({expanded:[],depth:0,selected:[]},()=>this.onAfterSelect())}expandDepth(e,t,i){var r;e||=this.root,t>0&&((r=e.children)==null||r.forEach(o=>{o.data.sumVisibility&&(vi(i,o.data.id)||(i.push(o.data.id),i.sort()),t-1>0&&this.expandDepth(o,t-1,i))}))}static collapseDepth(e,t){return t.filter(i=>i.split(".").length<=e)}onExpandVisible(){if(this.state.depth<9){const e=this.state.depth+1,t=[...this.state.expanded];this.root&&this.expandDepth(this.root,e,t),this.localStorage.setItem(`${this.props.dialogName||"App"}.objectExpanded`,JSON.stringify(t)),this.setState({depth:e,expanded:t})}}onStatesViewVisible(){const e=!this.state.statesView;this.localStorage.setItem(`${this.props.dialogName||"App"}.objectStatesView`,JSON.stringify(e)),this.setState({statesView:e})}onCollapseVisible(){if(this.state.depth>0){const e=this.state.depth-1,t=it.collapseDepth(e,this.state.expanded);this.localStorage.setItem(`${this.props.dialogName||"App"}.objectExpanded`,JSON.stringify(t)),this.setState({depth:e,expanded:t})}}getEnumsForId=e=>{const t=[];return this.info.enums.forEach(i=>{var r,o,n;if((n=(o=(r=this.objects[i])==null?void 0:r.common)==null?void 0:o.members)!=null&&n.includes(e)){const a={_id:this.objects[i]._id,common:JSON.parse(JSON.stringify(this.objects[i].common)),native:this.objects[i].native,type:"enum"};a.common&&(delete a.common.members,delete a.common.custom,delete a.common.mobile),t.push(a)}}),t.length?t:void 0};_createAllEnums=async(e,t)=>{var i,r;for(let o=0;o<e.length;o++){const n=e[o];let a,c;typeof n=="object"?(c=n,a=c._id):a=n;let l=this.objects[a];l?(r=(i=l.common)==null?void 0:i.members)!=null&&r.includes(t)||(l.common||={},l.type="enum",l.common.members||=[],l.common.members.push(t),l.common.members.sort(),await this.props.socket.setObject(a,l)):(l=c||{_id:a,common:{name:a.split(".").pop(),members:[]},native:{},type:"enum"},l.common||={},l.common.members=[t],l.type="enum",await this.props.socket.setObject(a,l))}};async loadObjects(e){var t;if(e)for(const i in e){if(!Object.prototype.hasOwnProperty.call(e,i)||!e[i])continue;const r=e[i];let o=null,n,a;(t=r==null?void 0:r.common)!=null&&t.enums?(o=r.common.enums,delete r.common.enums):o=null,(r.val||r.val===0)&&(n=r.val,delete r.val),r.ack!==void 0&&(a=r.ack,delete r.ack);try{if(await this.props.socket.setObject(i,r),o&&await this._createAllEnums(o,r._id),r.type==="state")if(n!=null)try{await this.props.socket.setState(r._id,n,a!==void 0?a:!0)}catch(c){window.alert(`Cannot set state "${r._id} with ${n}": ${c}`)}else try{const c=await this.props.socket.getState(r._id);if(!c||c.val===null)try{await this.props.socket.setState(r._id,!r.common||r.common.def===void 0?null:r.common.def,!0)}catch(l){window.alert(`Cannot set state "${r._id}": ${l}`)}}catch(c){window.alert(`Cannot read state "${r._id}": ${c}`)}}catch(c){window.alert(c)}}}_getSelectedIdsForExport(){if(this.state.selected.length||this.state.selectedNonObject){const e=[],t=Object.keys(this.objects);t.sort();const i=this.state.selected[0]||this.state.selectedNonObject,r=`${i}.`,o=r.length;for(let n=0;n<t.length;n++){const a=t[n];if((i===a||a.startsWith(r))&&e.push(a),a.substring(0,o)>r)break}return e}return[]}async _exportObjects(e){var o;if(e.isAll){$l("allObjects.json",this.objects,e);return}if(!(this.state.selected.length||this.state.selectedNonObject)){window.alert(this.props.t("ra_Save of objects-tree is not possible"));return}const t={},i=this.state.selected[0]||this.state.selectedNonObject,r=this._getSelectedIdsForExport();for(const n of r){if(t[n]=JSON.parse(JSON.stringify(this.objects[n])),((o=t[n])==null?void 0:o.type)==="state"&&!e.noStatesByExportImport){const a=await this.props.socket.getState(n);a&&(t[n].val=a.val,t[n].ack=a.ack)}if(t[n].common){const a=this.getEnumsForId(n);a&&(t[n].common.enums=a)}}$l(`${i}.json`,t,e)}renderExportDialog(){return this.state.showExportDialog===!1?null:M.createElement(j.Dialog,{open:!0,maxWidth:"lg"},M.createElement(j.DialogTitle,null,this.props.t("ra_Select type of export")),M.createElement(j.DialogContent,null,M.createElement(j.DialogContentText,null,this.state.filter.expertMode||this.state.showAllExportOptions?M.createElement(M.Fragment,null,this.props.t("ra_You can export all objects or just the selected branch."),M.createElement("br",null),this.props.t("ra_Selected %s object(s)",this.state.showExportDialog),M.createElement("br",null),M.createElement(j.FormControlLabel,{control:M.createElement(j.Checkbox,{checked:this.state.noStatesByExportImport,onChange:e=>this.setState({noStatesByExportImport:e.target.checked})}),label:this.props.t("ra_Do not export values of states")}),M.createElement("br",null),this.props.t("These options can reduce the size of the export file:"),M.createElement(j.FormControlLabel,{control:M.createElement(j.Checkbox,{checked:this.state.beautifyJsonExport,onChange:e=>this.setState({beautifyJsonExport:e.target.checked})}),label:this.props.t("Beautify JSON output")}),M.createElement("br",null),M.createElement(j.FormControlLabel,{control:M.createElement(j.Checkbox,{checked:this.state.excludeSystemRepositoriesFromExport,onChange:e=>this.setState({excludeSystemRepositoriesFromExport:e.target.checked})}),label:this.props.t("Exclude system repositories from export JSON")}),M.createElement(j.FormControlLabel,{control:M.createElement(j.Checkbox,{checked:this.state.excludeTranslations,onChange:e=>this.setState({excludeTranslations:e.target.checked})}),label:this.props.t("Exclude translations (except english) from export JSON")})):null)),M.createElement(j.DialogActions,null,this.state.filter.expertMode||this.state.showAllExportOptions?M.createElement(j.Button,{color:"grey",variant:"outlined",onClick:()=>this.setState({showExportDialog:!1,showAllExportOptions:!1},()=>this._exportObjects({isAll:!0,noStatesByExportImport:this.state.noStatesByExportImport,beautify:this.state.beautifyJsonExport,excludeSystemRepositories:this.state.excludeSystemRepositoriesFromExport,excludeTranslations:this.state.excludeTranslations}))},M.createElement("span",{style:{marginRight:8}},this.props.t("ra_All objects")),"(",Object.keys(this.objects).length,")"):M.createElement(j.Button,{color:"grey",variant:"outlined",startIcon:M.createElement(Pn,null),onClick:()=>this.setState({showAllExportOptions:!0})},this.props.t("ra_Advanced options")),M.createElement(j.Button,{color:"primary",variant:"contained",autoFocus:!0,onClick:()=>this.setState({showExportDialog:!1,showAllExportOptions:!1},()=>this._exportObjects({isAll:!1,noStatesByExportImport:this.state.noStatesByExportImport,beautify:this.state.beautifyJsonExport,excludeSystemRepositories:this.state.excludeSystemRepositoriesFromExport,excludeTranslations:this.state.excludeTranslations}))},M.createElement("span",{style:{marginRight:8}},this.props.t("ra_Only selected")),"(",this.state.showExportDialog,")"),M.createElement(j.Button,{color:"grey",variant:"contained",onClick:()=>this.setState({showExportDialog:!1,showAllExportOptions:!1}),startIcon:M.createElement(Ne,null)},this.props.t("ra_Cancel"))))}renderRenameDialog(){var t;if(!this.state.showRenameDialog)return null;const e=this.props.objectMoveRenameDialog;return M.createElement(e,{expertMode:this.props.expertMode,onClose:()=>this.setState({showRenameDialog:null}),id:this.state.showRenameDialog.id,childrenIds:this.state.showRenameDialog.childrenIds,theme:this.props.theme,socket:this.props.socket,t:this.props.t,objectType:(t=this.objects[this.state.showRenameDialog.id])==null?void 0:t.type})}handleJsonUpload(e){var r;const t=e.target,i=((r=t.files)==null?void 0:r.length)&&t.files[0];if(i){const o=new FileReader;o.onload=async n=>{var c;const a=(c=n.target)==null?void 0:c.result;try{const l=JSON.parse(a),N=Object.keys(l).length,u=l._id;if(u===void 0&&N)await this.loadObjects(l),window.alert(this.props.t("ra_%s object(s) processed",N));else{if(!u)return window.alert(this.props.t("ra_Invalid structure"));try{let L,g,y;if(l.common.enums&&(L=l.common.enums,delete l.common.enums),l.val&&(g=l.val,delete l.val),l.ack!==void 0&&(y=l.ack,delete l.ack),await this.props.socket.setObject(l._id,l),l.type==="state")if(g!=null)await this.props.socket.setState(l._id,g,y===void 0?!0:y);else{const T=await this.props.socket.getState(l._id);(!T||T.val===null||T.val===void 0)&&await this.props.socket.setState(l._id,l.common.def===void 0?null:l.common.def,!0)}L&&await this._createAllEnums(L,l._id),window.alert(this.props.t("ra_%s was imported",l._id))}catch(L){window.alert(L)}}}catch(l){window.alert(l)}return null},o.readAsText(i)}else window.alert(this.props.t("ra_Failed to open JSON File"))}toolTipObjectCreating=()=>{var i,r;const{t:e}=this.props;let t=[M.createElement("div",{key:1},e("ra_Only following structures of objects are available:")),M.createElement("div",{key:2},e("ra_Folder → State")),M.createElement("div",{key:3},e("ra_Folder → Channel → State")),M.createElement("div",{key:4},e("ra_Folder → Device → Channel → State")),M.createElement("div",{key:5},e("ra_Device → Channel → State")),M.createElement("div",{key:6},e("ra_Channel → State")),M.createElement("div",{key:7,style:{height:10}}),M.createElement("div",{key:8},e('ra_Non-experts may create new objects only in "0_userdata.0" or "alias.0".')),M.createElement("div",{key:9},e('ra_The experts may create objects everywhere but from second level (e.g. "vis.0" or "javascript.0").'))];if(this.state.selected.length||this.state.selectedNonObject){const o=this.state.selected[0]||this.state.selectedNonObject;if(!(o.split(".").length<2||this.objects[o]&&((i=this.objects[o])==null?void 0:i.type)==="state"))if(this.state.filter.expertMode)switch((r=this.objects[o])==null?void 0:r.type){case"device":t=[M.createElement("div",{key:1},e("ra_Only following structures of objects are available:")),M.createElement("div",{key:5},e("ra_Device → Channel → State")),M.createElement("div",{key:7,style:{height:10}}),M.createElement("div",{key:8},e('ra_Non-experts may create new objects only in "0_userdata.0" or "alias.0".')),M.createElement("div",{key:9},e('ra_The experts may create objects everywhere but from second level (e.g. "vis.0" or "javascript.0").'))];break;case"folder":t=[M.createElement("div",{key:1},e("ra_Only following structures of objects are available:")),M.createElement("div",{key:2},e("ra_Folder → State")),M.createElement("div",{key:3},e("ra_Folder → Channel → State")),M.createElement("div",{key:4},e("ra_Folder → Device → Channel → State")),M.createElement("div",{key:7,style:{height:10}}),M.createElement("div",{key:8},e('ra_Non-experts may create new objects only in "0_userdata.0" or "alias.0".')),M.createElement("div",{key:9},e('ra_The experts may create objects everywhere but from second level (e.g. "vis.0" or "javascript.0").'))];break;case"channel":t=[M.createElement("div",{key:1},e("ra_Only following structures of objects are available:")),M.createElement("div",{key:1},e("ra_Channel → State")),M.createElement("div",{key:7,style:{height:10}}),M.createElement("div",{key:8},e('ra_Non-experts may create new objects only in "0_userdata.0" or "alias.0".')),M.createElement("div",{key:9},e('ra_The experts may create objects everywhere but from second level (e.g. "vis.0" or "javascript.0").'))];break}else(o.startsWith("alias.0")||o.startsWith("0_userdata"))&&(t=[M.createElement("div",{key:1},e("ra_Only following structures of objects are available:")),M.createElement("div",{key:2},e("ra_Folder → State")),M.createElement("div",{key:3},e("ra_Folder → Channel → State")),M.createElement("div",{key:4},e("ra_Folder → Device → Channel → State")),M.createElement("div",{key:5},e("ra_Device → Channel → State")),M.createElement("div",{key:6},e("ra_Channel → State")),M.createElement("div",{key:7,style:{height:10}}),M.createElement("div",{key:7},e('ra_Non-experts may create new objects only in "0_userdata.0" or "alias.0".')),M.createElement("div",{key:8},e('ra_The experts may create objects everywhere but from second level (e.g. "vis.0" or "javascript.0").'))])}return t.length?t:e("ra_Add new child object to selected parent")};getToolbar(){let e=!1;if(this.state.selected.length||this.state.selectedNonObject){const t=this.state.selected[0]||this.state.selectedNonObject;t.split(".").length<2||this.objects[t]&&this.objects[t].type==="state"?e=!1:(this.state.filter.expertMode||t.startsWith("alias.0")||t.startsWith("0_userdata"))&&(e=!0)}return M.createElement("div",{style:{display:"flex",width:"100%",alignItems:"center",overflowX:"auto"}},M.createElement("div",{style:{display:"flex",width:"100%",alignItems:"center"}},M.createElement(j.Tooltip,{title:this.props.t("ra_Refresh tree"),slotProps:{popper:{sx:w.tooltip}}},M.createElement("div",null,M.createElement(j.IconButton,{onClick:()=>this.refreshComponent(),disabled:this.state.updating,size:"large"},M.createElement(DN,null)))),this.props.showExpertButton&&!this.props.expertMode&&M.createElement(j.Tooltip,{title:this.props.t("ra_expertMode"),slotProps:{popper:{sx:w.tooltip}}},M.createElement(j.IconButton,{key:"expertMode",color:this.state.filter.expertMode?"secondary":"default",onClick:()=>this.onFilter("expertMode",!this.state.filter.expertMode),size:"large"},M.createElement(Pn,null))),!this.props.disableColumnSelector&&this.props.width!=="xs"&&M.createElement(j.Tooltip,{title:this.props.t("ra_Configure"),slotProps:{popper:{sx:w.tooltip}}},M.createElement(j.IconButton,{key:"columnSelector",color:this.state.columnsAuto?"primary":"default",onClick:()=>this.setState({columnsSelectorShow:!0}),size:"large"},M.createElement(xg,null))),this.props.width!=="xs"&&this.state.expandAllVisible&&M.createElement(j.Tooltip,{title:this.props.t("ra_Expand all nodes"),slotProps:{popper:{sx:w.tooltip}}},M.createElement(j.IconButton,{key:"expandAll",onClick:()=>this.onExpandAll(),size:"large"},M.createElement(fr,null))),M.createElement(j.Tooltip,{title:this.props.t("ra_Collapse all nodes"),slotProps:{popper:{sx:w.tooltip}}},M.createElement(j.IconButton,{key:"collapseAll",onClick:()=>this.onCollapseAll(),size:"large"},M.createElement(Ws,null))),this.props.width!=="xs"&&M.createElement(j.Tooltip,{title:this.props.t("ra_Expand one step node"),slotProps:{popper:{sx:w.tooltip}}},M.createElement(j.IconButton,{key:"expandVisible",color:"primary",onClick:()=>this.onExpandVisible(),size:"large"},M.createElement(j.Badge,{badgeContent:this.state.depth,color:"secondary",sx:t=>({badge:{right:3,top:3,border:`2px solid ${t.palette.background.paper}`,padding:"0 4px"}})},M.createElement(fr,null)))),this.props.width!=="xs"&&M.createElement(j.Tooltip,{title:this.props.t("ra_Collapse one step node"),slotProps:{popper:{sx:w.tooltip}}},M.createElement(j.IconButton,{key:"collapseVisible",color:"primary",onClick:()=>this.onCollapseVisible(),size:"large"},M.createElement(j.Badge,{sx:t=>({badge:{right:3,top:3,border:`2px solid ${t.palette.background.paper}`,padding:"0 4px"}}),badgeContent:this.state.depth,color:"secondary"},M.createElement(Ws,null)))),this.props.objectStatesView&&M.createElement(j.Tooltip,{title:this.props.t("ra_Toggle the states view"),slotProps:{popper:{sx:w.tooltip}}},M.createElement(j.IconButton,{onClick:()=>this.onStatesViewVisible(),size:"large"},M.createElement(hg,{color:this.state.statesView?"primary":"inherit"}))),M.createElement(j.Tooltip,{title:this.props.t("ra_Show/Hide object descriptions"),slotProps:{popper:{sx:w.tooltip}}},M.createElement(j.IconButton,{onClick:()=>{this.localStorage.setItem(`${this.props.dialogName||"App"}.desc`,this.state.showDescription?"false":"true"),this.setState({showDescription:!this.state.showDescription})},size:"large"},M.createElement(Ag,{color:this.state.showDescription?"primary":"inherit"}))),this.props.objectAddBoolean?M.createElement(j.Tooltip,{title:this.toolTipObjectCreating(),slotProps:{popper:{sx:w.tooltip}}},M.createElement("div",null,M.createElement(j.IconButton,{disabled:!e,onClick:()=>this.setState({modalNewObj:{id:this.state.selected[0]||this.state.selectedNonObject}}),size:"large"},M.createElement(ln,null)))):null,this.props.objectImportExport&&M.createElement(j.Tooltip,{title:this.props.t("ra_Add objects tree from JSON file"),slotProps:{popper:{sx:w.tooltip}}},M.createElement(j.IconButton,{onClick:()=>{const t=document.createElement("input");t.setAttribute("type","file"),t.setAttribute("id","files"),t.setAttribute("opacity","0"),t.addEventListener("change",i=>this.handleJsonUpload(i),!1),t.click()},size:"large"},M.createElement(Sr,null))),this.props.objectImportExport&&(!!this.state.selected.length||this.state.selectedNonObject)&&M.createElement(j.Tooltip,{title:this.props.t("ra_Save objects tree as JSON file"),slotProps:{popper:{sx:w.tooltip}}},M.createElement(j.IconButton,{onClick:()=>this.setState({showExportDialog:this._getSelectedIdsForExport().length}),size:"large"},M.createElement(Sr,{style:{transform:"rotate(180deg)"}})))),!!this.props.objectBrowserEditObject&&this.props.width!=="xs"&&M.createElement("div",{style:{display:"flex",whiteSpace:"nowrap"}},`${this.props.t("ra_Objects")}: ${Object.keys(this.info.objects).length}, ${this.props.t("ra_States")}: ${Object.keys(this.info.objects).filter(t=>this.info.objects[t].type==="state").length}`),this.props.objectEditBoolean&&M.createElement(j.Tooltip,{title:this.props.t("ra_Edit custom config"),slotProps:{popper:{sx:w.tooltip}}},M.createElement(j.IconButton,{onClick:()=>{var i;const t=this.root?b4(this.root,"state",this.objects):[];t.length?(this.pauseSubscribe(!0),t.length===1&&(this.localStorage.setItem(`${this.props.dialogName||"App"}.objectSelected`,this.state.selected[0]),(i=this.props.router)==null||i.doNavigate(null,"custom",this.state.selected[0])),this.setState({customDialog:t,customDialogAll:!0})):this.setState({toast:this.props.t("ra_please select object")})},size:"large"},M.createElement(tg,null))))}toggleExpanded(e){const t=JSON.parse(JSON.stringify(this.state.expanded)),i=t.indexOf(e);i===-1?(t.push(e),t.sort()):t.splice(i,1),this.localStorage.setItem(`${this.props.dialogName||"App"}.objectExpanded`,JSON.stringify(t)),this.setState({expanded:t})}onCopy(e,t){e.stopPropagation(),e.preventDefault(),t&&(O.copyToClipboard(t),t.length<50?this.setState({toast:this.props.t("ra_Copied %s",t)}):this.setState({toast:this.props.t("ra_Copied")}))}renderTooltipAccessControl=e=>{if(!e)return null;const t=[{value:"0x400",valueNum:1024,title:"read",group:"Owner"},{value:"0x200",valueNum:512,title:"write",group:"Owner"},{value:"0x40",valueNum:64,title:"read",group:"Group"},{value:"0x20",valueNum:32,title:"write",group:"Group"},{value:"0x4",valueNum:4,title:"read",group:"Everyone"},{value:"0x2",valueNum:2,title:"write",group:"Everyone"}],i=[],r=o=>{const n=e[o];t.forEach((a,c)=>{n&a.valueNum&&i.push(M.createElement("span",{key:o+c},this.texts[`acl${a.group}_${a.title}_${o}`],",",M.createElement("span",{style:o==="object"?w.rightsObject:w.rightsState},a.value)))})};return i.push(M.createElement("span",{key:"group"},`${this.texts.ownerGroup}: ${(e.ownerGroup||"").replace("system.group.","")}`)),i.push(M.createElement("span",{key:"owner"},`${this.texts.ownerUser}: ${(e.owner||"").replace("system.user.","")}`)),r("object"),e.state&&r("state"),i.length?M.createElement("span",{style:w.tooltipAccessControl},i.map(o=>o)):null};renderColumnButtons(e,t){var n,a,c,l;if(!t.data.obj)return this.props.onObjectDelete||this.props.objectEditOfAccessControl?M.createElement("div",{style:w.buttonDiv},this.state.filter.expertMode&&this.props.objectEditOfAccessControl?M.createElement(j.IconButton,{sx:{...w.cellButtonsButton,...w.cellButtonsEmptyButton,...w.cellButtonMinWidth},onClick:()=>this.setState({modalEditOfAccess:!0,modalEditOfAccessObjData:t.data}),size:"large"},M.createElement("div",{style:{height:15}},"---")):null,this.props.onObjectDelete&&((n=t.children)!=null&&n.length)?M.createElement(j.IconButton,{sx:{...w.cellButtonsButton,...w.cellButtonsButtonAlone},size:"small","aria-label":"delete",title:this.texts.deleteObject,onClick:()=>{var g;const N=Object.keys(this.objects);N.sort();let u=0;const L=`${e}.`;for(let y=0;y<N.length;y++)if(N[y].startsWith(L))u++;else if(N[y]>L)break;this.props.onObjectDelete&&this.props.onObjectDelete(e,!!((g=t.children)!=null&&g.length),!1,u+1)}},M.createElement(nt,{style:w.cellButtonsButtonIcon})):null):null;t.data.aclTooltip=t.data.aclTooltip||this.renderTooltipAccessControl(t.data.obj.acl);const i=t.data.obj.acl?t.data.obj.type==="state"?t.data.obj.acl.state:t.data.obj.acl.object:0,r=t.data.obj.acl&&(t.data.obj.type==="state"?this.systemConfig.common.defaultNewAcl.state:this.systemConfig.common.defaultNewAcl.object),o=this.state.filter.expertMode||it.isNonExpertId(t.data.id);return[this.state.filter.expertMode&&this.props.objectEditOfAccessControl?M.createElement(j.Tooltip,{key:"acl",title:t.data.aclTooltip,slotProps:{popper:{sx:w.tooltip}}},M.createElement(j.IconButton,{sx:{...w.cellButtonsButton,...w.cellButtonMinWidth,opacity:1},onClick:()=>this.setState({modalEditOfAccess:!0,modalEditOfAccessObjData:t.data}),size:"large"},M.createElement("div",{style:w.aclText},Number.isNaN(Number(i))?Number(r).toString(16):Number(i).toString(16)))):M.createElement("div",{key:"aclEmpty",style:w.cellButtonMinWidth}),o?M.createElement(j.IconButton,{key:"edit",sx:{marginRight:"2px",...w.cellButtonsButton},size:"small","aria-label":"edit",title:this.texts.editObject,onClick:()=>{this.localStorage.setItem(`${this.props.dialogName||"App"}.objectSelected`,e),this.setState({editObjectDialog:e,editObjectAlias:!1})}},M.createElement(mi,{style:w.cellButtonsButtonIcon})):M.createElement(j.Box,{component:"div",key:"editDisabled",sx:w.cellButtonsButton}),this.props.onObjectDelete&&((a=t.children)!=null&&a.length||!((c=t.data.obj.common)!=null&&c.dontDelete))?M.createElement(j.IconButton,{key:"delete",sx:w.cellButtonsButton,size:"small","aria-label":"delete",onClick:()=>{var g,y,T;const N=Object.keys(this.objects);N.sort();let u=0;const L=`${e}.`;for(let d=0;d<N.length;d++)if(N[d].startsWith(L))u++;else if(N[d]>L)break;this.props.onObjectDelete&&this.props.onObjectDelete(e,!!((g=t.children)!=null&&g.length),!((T=(y=t.data.obj)==null?void 0:y.common)!=null&&T.dontDelete),u)},title:this.texts.deleteObject},M.createElement(nt,{style:w.cellButtonsButtonIcon})):null,this.props.objectCustomDialog&&this.info.hasSomeCustoms&&t.data.obj.type==="state"&&((l=t.data.obj.common)==null?void 0:l.type)!=="file"?M.createElement(j.IconButton,{sx:{...w.cellButtonsButton,...t.data.hasCustoms?this.styles.cellButtonsButtonWithCustoms:w.cellButtonsButtonWithoutCustoms},key:"custom",size:"small","aria-label":"config",title:this.texts.customConfig,onClick:()=>{var N;this.localStorage.setItem(`${this.props.dialogName||"App"}.objectSelected`,e),this.pauseSubscribe(!0),(N=this.props.router)==null||N.doNavigate(null,"customs",e),this.setState({customDialog:[e],customDialogAll:!1})}},M.createElement(Nn,{style:w.cellButtonsButtonIcon})):null]}readHistory(e){var t,i;if(window.sparkline&&this.defaultHistory&&((i=(t=this.objects[e])==null?void 0:t.common)!=null&&i.custom)&&this.objects[e].common.custom[this.defaultHistory]){const r=new Date;r.setHours(r.getHours()-24),r.setMinutes(0),r.setSeconds(0),r.setMilliseconds(0);const o=r.getTime();this.props.socket.getHistory(e,{instance:this.defaultHistory,start:o,end:Date.now(),step:36e5,from:!1,ack:!1,q:!1,addId:!1,aggregate:"minmax"}).then(n=>{const a=window.document.getElementsByClassName("sparkline");for(let c=0;c<a.length;c++)if(a[c].dataset.id===e){const l=jSe(n,o);window.sparkline.sparkline(a[c],l);break}}).catch(n=>console.warn(`Cannot read history: ${n}`))}}getTooltipInfo(e,t){var l,N,u;const i=this.objects[e],r=this.states[e],{valFull:o,fileViewer:n}=en({state:r,obj:i,texts:this.texts,dateFormat:this.props.dateFormat||this.systemConfig.common.dateFormat,isFloatComma:this.props.isFloatComma===void 0?this.systemConfig.common.isFloatComma:this.props.isFloatComma,full:!0}),a=[];o==null||o.forEach(L=>{L.t===this.texts.quality&&r.q?(a.push(M.createElement("div",{style:w.cellValueTooltipBoth,key:L.t},L.t,": ",L.v)),L.nbr||a.push(M.createElement("br",{key:`${L.t}_br`}))):(a.push(M.createElement("div",{style:w.cellValueTooltipTitle,key:L.t},L.t,": ")),a.push(M.createElement("div",{style:w.cellValueTooltipValue,key:`${L.t}_v`},L.v)),L.nbr||a.push(M.createElement("br",{key:`${L.t}_br`})))});const c=((l=i==null?void 0:i.common)==null?void 0:l.role)||"";n==="image"?a.push(M.createElement("img",{style:w.cellValueTooltipImage,src:r.val,alt:e})):c==="url"||i.common.role==="url.self"||i.common.role==="url.blank"?a.unshift(M.createElement("div",{key:"ctrl",style:{textDecoration:"underline",fontWeight:"bold"}},this.texts.ctrlForLink)):this.defaultHistory&&((u=(N=i==null?void 0:i.common)==null?void 0:N.custom)!=null&&u[this.defaultHistory])&&a.push(M.createElement("svg",{key:"sparkline",className:"sparkline","data-id":e,style:{fill:"#3d85de"},width:"200",height:"30",strokeWidth:"3"})),this.setState({tooltipInfo:{el:a,id:e}},()=>t&&t())}renderColumnValue(e,t,i){var c,l;const r=t.data.obj;if(!r||!this.states)return null;if(((c=r.common)==null?void 0:c.type)==="file")return M.createElement(j.Box,{component:"div",sx:{...w.cellValueText,...w.cellValueFile}},"[file]");if(!this.states[e])return r.type==="state"&&(this.recordStates.includes(e)||this.recordStates.push(e),this.states[e]={val:null},this.subscribe(e)),null;this.recordStates.includes(e)||this.recordStates.push(e);const o=this.states[e];let n=t.data.state;if(!n){const{valText:N}=en({state:o,obj:r,texts:this.texts,dateFormat:this.props.dateFormat||this.systemConfig.common.dateFormat,isFloatComma:this.props.isFloatComma===void 0?this.systemConfig.common.isFloatComma:this.props.isFloatComma}),u=[];if(t.data.state={valTextRx:u},u.push(M.createElement("span",{className:`newValueBrowser-${this.props.themeType||"light"}`,key:`${N.v.toString()}valText`,style:{whiteSpace:"nowrap",display:"inline-block",overflow:"hidden",textOverflow:"ellipsis"}},N.v.toString())),N.u&&u.push(M.createElement("span",{className:`newValueBrowser-${this.props.themeType||"light"}`,style:w.cellValueTextUnit,key:`${N.v.toString()}unit`},N.u)),N.s!==void 0&&u.push(M.createElement("span",{style:w.cellValueTextState,className:`newValueBrowser-${this.props.themeType||"light"}`,key:`${N.v.toString()}states`},"(",N.s,")")),!i){const L=N.c!==void 0?N.c:N.v||"";u.push(M.createElement(Ts,{className:"copyButton",style:this.styles.iconCopy,onClick:g=>this.onCopy(g,L),key:"cc"}))}n=t.data.state}n.style=gSe({state:o,isExpertMode:this.state.filter.expertMode,isButton:t.data.button});let a=n.valTextRx;return this.state.filter.expertMode||(t.data.button?a=[M.createElement(uSe,{key:"button",style:{color:n.style.color,...w.cellValueButton}})]:t.data.switch&&(a=[M.createElement(j.Switch,{key:"switch",sx:{"& .MuiSwitch-thumb":{color:n.style.color},"& .MuiSwitch-track":{backgroundColor:this.states[e].val&&this.state.selected.includes(e)?this.props.themeType==="dark"?"#FFF !important":"#111 !important":void 0}},checked:!!this.states[e].val})])),M.createElement(j.Tooltip,{key:"value",title:(l=this.state.tooltipInfo)==null?void 0:l.el,slotProps:{popper:{sx:w.cellValueTooltipBox},tooltip:{sx:w.cellValueTooltip}},onOpen:()=>this.getTooltipInfo(e,()=>this.readHistory(e)),onClose:()=>{var N;return((N=this.state.tooltipInfo)==null?void 0:N.id)===e&&this.setState({tooltipInfo:null})}},M.createElement(j.Box,{component:"div",style:n.style,className:t.data.url?"iob-link":void 0,sx:{...w.cellValueText,height:i?void 0:pe,"& .admin-button:active":{transform:"translate(0, 2px)"}}},a))}_syncEnum(e,t,i,r){var a,c,l;if(!(t!=null&&t.length)){r&&r();return}const o=t.pop()||"",n=[];if((a=this.info.objects[o])!=null&&a.common){if((c=this.info.objects[o].common.members)!=null&&c.length){const N=this.info.objects[o].common.members.indexOf(e);if(N!==-1&&!i.includes(o)){const u=JSON.parse(JSON.stringify(this.info.objects[o]));u.common.members.splice(N,1),n.push(this.props.socket.setObject(o,u).then(()=>this.info.objects[o]=u).catch(L=>this.showError(L)))}}if(i.includes(o)&&!((l=this.info.objects[o].common.members)!=null&&l.includes(e))){const N=JSON.parse(JSON.stringify(this.info.objects[o]));N.common.members||=[],N.common.members.push(e),N.common.members.sort(),n.push(this.props.socket.setObject(o,N).then(()=>this.info.objects[o]=N).catch(u=>this.showError(u)))}}Promise.all(n).then(()=>{setTimeout(()=>this._syncEnum(e,t,i,r),0)})}syncEnum(e,t,i){const r=[...this.info[t==="func"?"funcEnums":"roomEnums"]];return new Promise(o=>{this._syncEnum(e,r,i,()=>{o()})})}renderEnumDialog(){if(!this.state.enumDialog)return null;const e=this.state.enumDialog.type,t=this.state.enumDialog.item,i=this.state.enumDialogEnums,r=this.state.enumDialog.enumsOriginal,o=(e==="room"?this.info.roomEnums:this.info.funcEnums).map(n=>{var a,c;return{name:Ye(((c=(a=this.objects[n])==null?void 0:a.common)==null?void 0:c.name)||n.split(".").pop()||"",this.props.lang),value:n,icon:Zr(this.objects,n,this.props.lang,this.imagePrefix)}}).sort((n,a)=>n.name>a.name?1:-1);return o.forEach(n=>{n.icon&&typeof n.icon=="string"&&(n.icon=M.createElement(j.Box,{style:w.enumIconDiv},M.createElement("img",{src:n.icon,style:w.enumIcon,alt:n.name})))}),M.createElement(j.Dialog,{sx:{"& .MuiPaper-root":w.enumDialog},onClose:()=>this.setState({enumDialog:null}),"aria-labelledby":"enum-dialog-title",open:!0},M.createElement(j.DialogTitle,{id:"enum-dialog-title",style:{display:"flex",justifyContent:"space-between",width:"100%",flexWrap:"nowrap",gap:8,paddingRight:12}},e==="func"?this.props.t("ra_Define functions"):this.props.t("ra_Define rooms"),M.createElement(j.Fab,{color:"primary",disabled:r===JSON.stringify(i),size:"small",onClick:()=>this.syncEnum(t.data.id,e,i).then(()=>this.setState({enumDialog:null,enumDialogEnums:null}))},M.createElement(Oe,null))),M.createElement(j.List,{sx:{"&.MuiList-root":w.enumList}},o.map(n=>{let a,c,l;typeof n=="object"?(a=n.value,c=n.name,l=n.icon):(a=n,c=n);const N=`checkbox-list-label-${a}`;return M.createElement(j.ListItem,{sx:w.headerCellSelectItem,key:a,onClick:()=>{const u=i.indexOf(a),L=JSON.parse(JSON.stringify(this.state.enumDialogEnums));u===-1?(L.push(a),L.sort()):L.splice(u,1),this.setState({enumDialogEnums:L})},secondaryAction:l},M.createElement(j.ListItemIcon,{sx:{"&.MuiListItemIcon-root":w.enumCheckbox}},M.createElement(j.Checkbox,{edge:"start",checked:i.includes(a),tabIndex:-1,disableRipple:!0,inputProps:{"aria-labelledby":N}})),M.createElement(j.ListItemText,{id:N},c))})))}renderEditRoleDialog(){var e,t;if(!this.state.roleDialog||!this.props.objectBrowserEditRole)return null;if(this.state.roleDialog&&this.props.objectBrowserEditRole){const i=this.props.objectBrowserEditRole;return M.createElement(i,{key:"objectBrowserEditRole",id:this.state.roleDialog,socket:this.props.socket,t:this.props.t,roleArray:this.info.roles,commonType:(t=(e=this.info.objects[this.state.roleDialog])==null?void 0:e.common)==null?void 0:t.type,onClose:r=>{r&&(this.info.objects[this.state.roleDialog]=r),this.setState({roleDialog:null})}})}return null}onColumnsEditCustomDialogClose(e){var i,r;const t=this.customColumnDialog;if(e){let o=t.value;t.type==="boolean"?o=o==="true"||o===!0:t.type==="number"&&(o=parseFloat(o)),this.customColumnDialog=null,this.props.socket.getObject(((r=(i=this.state.columnsEditCustomDialog)==null?void 0:i.obj)==null?void 0:r._id)||"").then(n=>{var a;if(n&&it.setCustomValue(n,(a=this.state.columnsEditCustomDialog)==null?void 0:a.it,o))return this.props.socket.setObject(n._id,n);throw new Error(this.props.t("ra_Cannot update attribute, because not found in the object"))}).then(()=>this.setState({columnsEditCustomDialog:null})).catch(n=>this.showError(n))}else this.customColumnDialog=null,this.setState({columnsEditCustomDialog:null})}renderColumnsEditCustomDialog(){if(!this.state.columnsEditCustomDialog)return null;if(!this.customColumnDialog){const e=it.getCustomValue(this.state.columnsEditCustomDialog.obj,this.state.columnsEditCustomDialog.it);this.customColumnDialog={type:this.state.columnsEditCustomDialog.it.type||typeof e,initValue:(e??"").toString(),value:(e??"").toString()}}return M.createElement(j.Dialog,{onClose:()=>this.setState({columnsEditCustomDialog:null}),maxWidth:"md","aria-labelledby":"custom-dialog-title",open:!0},M.createElement(j.DialogTitle,{id:"custom-dialog-title"},`${this.props.t("ra_Edit object field")}: ${this.state.columnsEditCustomDialog.obj._id}`),M.createElement(j.DialogContent,null,M.createElement(j.DialogContentText,{id:"alert-dialog-description"},this.customColumnDialog.type==="boolean"?M.createElement(j.FormControlLabel,{control:M.createElement(j.Checkbox,{onKeyUp:e=>e.key==="Enter"&&this.onColumnsEditCustomDialogClose(!0),defaultChecked:this.customColumnDialog.value==="true",onChange:e=>{const t=this.customColumnDialog;t.value=e.target.checked.toString();const i=t.value!==t.initValue;i===!this.state.customColumnDialogValueChanged&&this.setState({customColumnDialogValueChanged:i})}}),label:`${this.state.columnsEditCustomDialog.it.name} (${this.state.columnsEditCustomDialog.it.pathText})`}):M.createElement(j.TextField,{variant:"standard",defaultValue:this.customColumnDialog.value,fullWidth:!0,onKeyUp:e=>e.key==="Enter"&&this.onColumnsEditCustomDialogClose(!0),label:`${this.state.columnsEditCustomDialog.it.name} (${this.state.columnsEditCustomDialog.it.pathText})`,onChange:e=>{const t=this.customColumnDialog;t.value=e.target.value;const i=t.value!==t.initValue;i===!this.state.customColumnDialogValueChanged&&this.setState({customColumnDialogValueChanged:i})},autoFocus:!0}))),M.createElement(j.DialogActions,null,M.createElement(j.Button,{variant:"contained",onClick:()=>this.onColumnsEditCustomDialogClose(!0),disabled:!this.state.customColumnDialogValueChanged,color:"primary",startIcon:M.createElement(Oe,null)},this.props.t("ra_Update")),M.createElement(j.Button,{color:"grey",variant:"contained",onClick:()=>this.onColumnsEditCustomDialogClose(),startIcon:M.createElement(Ne,null)},this.props.t("ra_Cancel"))))}static getCustomValue(e,t){var i;if((i=e==null?void 0:e._id)!=null&&i.startsWith(`${t.adapter}.`)&&t.path.length>1){const r=t.path;let o;const n=e;if(n[r[0]]&&typeof n[r[0]]=="object")return r.length===2?o=n[r[0]][r[1]]:r.length===3?o=n[r[0]][r[1]]&&typeof n[r[0]][r[1]]=="object"?n[r[0]][r[1]][r[2]]:null:r.length===4?o=n[r[0]][r[1]]&&typeof n[r[0]][r[1]]=="object"&&n[r[0]][r[1]][r[2]]?n[r[0]][r[1]][r[2]][r[3]]:null:r.length===5?o=n[r[0]][r[1]]&&typeof n[r[0]][r[1]]=="object"&&n[r[0]][r[1]][r[2]]&&n[r[0]][r[1]][r[2]][r[3]]?n[r[0]][r[1]][r[2]][r[3]][r[4]]:null:r.length===6&&(o=n[r[0]][r[1]]&&typeof n[r[0]][r[1]]=="object"&&n[r[0]][r[1]][r[2]]&&n[r[0]][r[1]][r[2]][r[3]]&&n[r[0]][r[1]][r[2]][r[3]][r[4]]?n[r[0]][r[1]][r[2]][r[3]][r[4]][r[5]]:null),o??null}return null}static setCustomValue(e,t,i){var r;if((r=e==null?void 0:e._id)!=null&&r.startsWith(`${t.adapter}.`)&&t.path.length>1){const o=t.path,n=e;if(n[o[0]]&&typeof n[o[0]]=="object"){if(o.length===2)return n[o[0]][o[1]]=i,!0;if(o.length===3){if(n[o[0]][o[1]]&&typeof n[o[0]][o[1]]=="object")return n[o[0]][o[1]][o[2]]=i,!0}else if(o.length===4){if(n[o[0]][o[1]]&&typeof n[o[0]][o[1]]=="object"&&n[o[0]][o[1]][o[2]]&&typeof n[o[0]][o[1]][o[2]]=="object")return n[o[0]][o[1]][o[2]][o[3]]=i,!0}else if(o.length===5){if(n[o[0]][o[1]]&&typeof n[o[0]][o[1]]=="object"&&n[o[0]][o[1]][o[2]]&&typeof n[o[0]][o[1]][o[2]]=="object"&&n[o[0]][o[1]][o[2]][o[3]]&&typeof n[o[0]][o[1]][o[2]][o[3]]=="object")return n[o[0]][o[1]][o[2]][o[3]][o[4]]=i,!0}else if(o.length===6&&n[o[0]][o[1]]&&typeof n[o[0]][o[1]]=="object"&&n[o[0]][o[1]][o[2]]&&typeof n[o[0]][o[1]][o[2]]=="object"&&n[o[0]][o[1]][o[2]][o[3]]&&typeof n[o[0]][o[1]][o[2]][o[3]]=="object"&&n[o[0]][o[1]][o[2]][o[3]][o[4]]&&typeof n[o[0]][o[1]][o[2]][o[3]][o[4]]=="object")return n[o[0]][o[1]][o[2]][o[3]][o[4]][o[5]]=i,!0}}return!1}renderCustomValue(e,t,i){const r=it.getCustomValue(e,t);return r!=null?t.edit&&!this.props.notEditable&&(!t.objTypes||t.objTypes.includes(e.type))?M.createElement(j.Box,{component:"div",style:{...w.columnCustom,...w.columnCustomEditable,...w[`columnCustom_${t.align}`]},onClick:()=>this.setState({columnsEditCustomDialog:{item:i,it:t,obj:e},customColumnDialogValueChanged:!1})},r):M.createElement(j.Box,{component:"div",style:{...w.columnCustom,...w[`columnCustom_${t.align}`]}},r):null}renderAliasLink(e,t,i){const r=t||0,o=this.objects[this.info.aliasesMap[e][r]].common.alias.id;return o?M.createElement(j.Box,{component:"div",onClick:n=>{n.stopPropagation(),n.preventDefault();const a=this.info.aliasesMap[e][r];this.info.aliasesMap[e].length>1&&this.setState({aliasMenu:""}),this.onSelect(a),setTimeout(()=>this.expandAllSelected(()=>this.scrollToItem(a)),100)},sx:i||this.styles.aliasAlone},M.createElement("span",{className:"admin-browser-arrow"},typeof o=="string"||o.read===e&&o.write===e?"↔":o.read===e?"→":"←"),this.info.aliasesMap[e][r]):null}renderLeaf(e,t,i){var ai,Mi,ci,tr,sr,mM,OM,EM,fM,xM,_M,SM,kM,YM;const r=e.data.id;i.count++,t=t===void 0?this.state.expanded.includes(r):t;let o;const n=e.data.obj,a=n==null?void 0:n.type;e.children||a==="folder"||a==="device"||a==="channel"||a==="meta"?o=t?M.createElement(fr,{style:this.styles.cellIdIconFolder,onClick:()=>this.toggleExpanded(r)}):M.createElement(Ws,{style:this.styles.cellIdIconFolder,onClick:()=>this.toggleExpanded(r)}):n&&n.common&&n.common.write===!1&&n.type==="state"?o=M.createElement(sSe,{style:this.styles.cellIdIconDocument}):o=M.createElement(tSe,{style:this.styles.cellIdIconDocument});let c=null;e.data.icon&&(typeof e.data.icon=="string"?e.data.icon.length<3?c=M.createElement("span",{className:"iconOwn",style:w.cellIdIconOwn},e.data.icon):c=M.createElement(me,{style:w.cellIdIconOwn,className:"iconOwn",src:e.data.icon,alt:""}):c=e.data.icon);const l=n==null?void 0:n.common,N=(n==null?void 0:n.type)&&Bl[n.type]||M.createElement("div",{className:"itemIcon"}),u=this.levelPadding*(e.data.level||0);if(e.data.lang!==this.props.lang){const{rooms:k,per:q}=$4(this.info,r,this.props.lang);e.data.rooms=k.join(", "),e.data.per=q;const{funcs:fe,pef:de}=P4(this.info,r,this.props.lang);e.data.funcs=fe.join(", "),e.data.pef=de,e.data.lang=this.props.lang}const L=this.props.multiSelect&&this.objects[r]&&(!this.props.types||this.props.types.includes(this.objects[r].type))?M.createElement(j.Checkbox,{style:w.checkBox,checked:this.state.selected.includes(r)}):null;let g=!this.props.notEditable&&a==="state"&&(this.state.filter.expertMode||(l==null?void 0:l.write)!==!1);this.props.objectBrowserViewFile&&(l==null?void 0:l.type)==="file"&&(g=!0);const y=!this.props.notEditable&&this.objects[r]&&(this.state.filter.expertMode||a==="state"||a==="channel"||a==="device"),T=this.state.statesView&&(a==="state"||a==="channel"||a==="device");let d="";const z=[];if(T&&(d=(ai=this.states[r])==null?void 0:ai.from,d===void 0?d="&nbsp;":(d=d?d.replace(/^system\.adapter\.|^system\./,""):"",z.push(`${this.texts.stateChangedFrom} ${d}`)),n!=null&&n.user)){const k=n.user.replace("system.user.","");d+=`/${k}`,z.push(`${this.texts.stateChangedBy} ${k}`)}n&&(n.from&&z.push(`${this.texts.objectChangedFrom} ${n.from.replace(/^system\.adapter\.|^system\./,"")}`),n.user&&z.push(`${this.texts.objectChangedBy} ${n.user.replace(/^system\.user\./,"")}`),n.ts&&z.push(`${this.texts.objectChangedByUser} ${O.formatDate(new Date(n.ts),this.props.dateFormat||this.systemConfig.common.dateFormat)}`));let I=!1,C=null;r.startsWith("alias.")&&((Mi=l==null?void 0:l.alias)!=null&&Mi.id)?(I=typeof l.alias.id=="object",I?C=M.createElement("div",{style:w.cellIdAliasReadWriteDiv},l.alias.id.read?M.createElement(j.Box,{component:"div",onClick:k=>{k.stopPropagation(),k.preventDefault(),this.onSelect(l.alias.id.read),setTimeout(()=>this.expandAllSelected(()=>this.scrollToItem(l.alias.id.read)),100)},sx:this.styles.aliasReadWrite},"←",l.alias.id.read):null,l.alias.id.write?M.createElement(j.Box,{component:"div",onClick:k=>{k.stopPropagation(),k.preventDefault(),this.onSelect(l.alias.id.write),setTimeout(()=>this.expandAllSelected(()=>this.scrollToItem(l.alias.id.write)),100)},sx:this.styles.aliasReadWrite},"→",l.alias.id.write):null):C=M.createElement(j.Box,{component:"div",onClick:k=>{k.stopPropagation(),k.preventDefault(),this.onSelect(l.alias.id),setTimeout(()=>this.expandAllSelected(()=>this.scrollToItem(l.alias.id)),100)},sx:this.styles.aliasAlone},"→",l.alias.id)):this.info.aliasesMap[r]&&(this.info.aliasesMap[r].length>1?C=M.createElement(j.Box,{component:"div",id:`alias_${r}`,onClick:k=>{k.stopPropagation(),k.preventDefault(),this.setState({aliasMenu:r})},sx:this.styles.aliasAlone},this.props.t("ra_%s links from aliases",this.info.aliasesMap[r].length)):C=this.renderAliasLink(r,0));let m=l==null?void 0:l.color,A;if(m&&!this.state.selected.includes(r)){const k=this.props.themeName==="dark"?"#1f1f1f":this.props.themeName==="blue"?"#222a2e":"#FFFFFF";O.colorDistance(m,k)<1e3&&(A=this.props.themeType==="dark"?"#9a9a9a":"#565656")}let D=!1;r==="0_userdata"?(m=x4(this.props.themeType),D=!0):r==="alias"?(m=_4(this.props.themeType),D=!0):r==="javascript"?(m=cSe(this.props.themeType),D=!0):r==="system"?(m=S4(this.props.themeType),D=!0):r==="system.adapter"?m=k4(this.props.themeType):(!m||this.state.selected.includes(r))&&(m="inherit");const p=[];if(l!=null&&l.statusStates){const k={};Object.keys(l.statusStates).forEach(fe=>{var tt;let de=l.statusStates[fe];de.split(".").length<3&&(de=`${r}.${de}`),k[fe]=de,this.states[de]?this.recordStates.includes(de)||this.recordStates.push(de):((tt=this.objects[de])==null?void 0:tt.type)==="state"&&(this.recordStates.includes(de)||this.recordStates.push(de),this.states[de]={val:null},this.subscribe(de))});let q=!1;l.statusStates.errorId&&this.states[k.errorId]&&this.states[k.errorId].val&&(m=this.props.themeType==="dark"?Y4:v4,q=!0,p.push(M.createElement(cg,{key:"error",style:this.styles.iconDeviceError}))),k.onlineId&&this.states[k.onlineId]?q?this.states[k.onlineId].val?p.push(M.createElement(Qs,{key:"conn",style:this.styles.iconDeviceConnected})):p.push(M.createElement(rr,{key:"disc",style:this.styles.iconDeviceDisconnected})):this.states[k.onlineId].val?(m=this.props.themeType==="dark"?Bn:Jn,p.push(M.createElement(Qs,{key:"conn",style:this.styles.iconDeviceConnected}))):(m=this.props.themeType==="dark"?Rn:Fn,p.push(M.createElement(rr,{key:"disc",style:this.styles.iconDeviceDisconnected}))):k.offlineId&&this.states[k.offlineId]&&(q?this.states[k.offlineId].val?p.push(M.createElement(rr,{key:"disc",style:this.styles.iconDeviceDisconnected})):p.push(M.createElement(Qs,{key:"conn",style:this.styles.iconDeviceConnected})):this.states[k.offlineId].val?(m=this.props.themeType==="dark"?Rn:Fn,p.push(M.createElement(rr,{key:"disc",style:this.styles.iconDeviceDisconnected}))):(m=this.props.themeType==="dark"?Bn:Jn,p.push(M.createElement(Qs,{key:"conn",style:this.styles.iconDeviceConnected}))))}const _=T?O.quality2text(((ci=this.states[r])==null?void 0:ci.q)||0).join(", "):null;let x=((tr=e.data)==null?void 0:tr.title)||"",P=!1;if(this.state.showDescription){const k=Q4(e.data,this.props.lang);k&&(x=[M.createElement("div",{key:"name",style:w.cellNameDivDiv},x),M.createElement("div",{key:"desc",style:w.cellDescription},k)],P=!!k)}const v=this.props.width==="xs"&&this.state.focused===r,ee=M.createElement(j.Grid2,{container:!0,wrap:"nowrap",direction:"row",sx:w.cellId,style:{width:this.columnsVisibility.id,paddingLeft:u}},M.createElement(j.Grid2,{container:!0,alignItems:"center"},L,o),M.createElement(j.Grid2,{style:{...w.cellIdSpan,...A?this.styles.invertedBackground:void 0,color:m,fontWeight:D?"bold":void 0}},M.createElement(j.Tooltip,{title:LSe(e.data,this.props.lang),slotProps:{popper:{sx:w.tooltip}}},M.createElement("div",null,e.data.name)),C,p),M.createElement("div",{style:{...w.grow,...A?this.styles.invertedBackgroundFlex:{}}}),M.createElement(j.Grid2,{container:!0,alignItems:"center"},c),this.props.width!=="xs"?M.createElement("div",null,M.createElement(Ts,{className:v?"":"copyButton",style:w.cellCopyButton,onClick:k=>this.onCopy(k,r)})):null);let ue=v&&x||this.columnsVisibility.name?M.createElement(j.Box,{component:"div",sx:{...w.cellName,...P?w.cellNameWithDesc:void 0,width:this.props.width!=="xs"?this.columnsVisibility.name:void 0,ml:v?0:"5px"}},x,!v&&((sr=e.data)!=null&&sr.title)?M.createElement(j.Box,{style:{color:m}},M.createElement(Ts,{className:"copyButton",style:w.cellCopyButton,onClick:k=>{var q;return this.onCopy(k,(q=e.data)==null?void 0:q.title)}})):null):null,G;this.state.statesView?G=[v&&T&&((mM=this.states[r])!=null&&mM.from)||this.columnsVisibility.changedFrom?{el:M.createElement("div",{key:"from",style:{...w.cellRole,width:this.props.width!=="xs"?this.columnsVisibility.changedFrom:void 0},title:z.join(`
448
+ `).forEach(n=>{if(!n.trim())return;const a=n.indexOf(":");if(a!==-1){const c=n.substring(0,a).trim();let l=n.substring(a+1).trim();l=l.replace(/^['"]|['"]$/g,""),l==="true"?t[c]=!0:l==="false"?t[c]=!1:parseFloat(l).toString()===l?t[c]=parseFloat(l):t[c]=l}else t[n.trim()]=!0}),e=e.substring(i+7))}return{header:t,body:e}}static removeDocsify(e){const t=e.match(/{docsify-[^}]*}/g);return t&&t.forEach(i=>e=e.replace(i,"")),e}static onCopy(e,t){r0(t),e&&e.stopPropagation(),e&&e.preventDefault()}}function eSe(s){return M.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",onClick:e=>s.onClick&&s.onClick(e),viewBox:"0 0 512 512",width:s.width||(s.fontSize==="small"?16:20),height:s.height||s.width||(s.fontSize==="small"?16:20),className:s.className,style:s.style},M.createElement("path",{fill:"currentColor",d:"M448 0L320 96v62.06l-83.03 83.03c6.79 4.25 13.27 9.06 19.07 14.87 5.8 5.8 10.62 12.28 14.87 19.07L353.94 192H416l96-128-64-64zM128 278.59L10.92 395.67c-14.55 14.55-14.55 38.15 0 52.71l52.7 52.7c14.56 14.56 38.15 14.56 52.71 0L233.41 384c29.11-29.11 29.11-76.3 0-105.41s-76.3-29.11-105.41 0z"}))}function E4(s){return M.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",onClick:e=>s.onClick&&s.onClick(e),viewBox:"0 0 320 320",width:s.width||(s.fontSize==="small"?16:20),height:s.height||s.width||(s.fontSize==="small"?16:20),className:s.className,style:s.style},M.createElement("g",{fill:"currentColor"},M.createElement("rect",{rx:"32",height:"272",width:"267",y:"25",x:"25",strokeWidth:"15",stroke:"currentColor",fill:"none"}),M.createElement("ellipse",{stroke:"currentColor",ry:"26",rx:"26",cy:"248",cx:"160",fill:"none",strokeWidth:"15"}),M.createElement("line",{y2:"201.94531",x2:"159.5",y1:"46.94531",x1:"159.5",fillOpacity:"null",strokeOpacity:"null",strokeWidth:"15",stroke:"currentColor",fill:"none"}),M.createElement("rect",{height:"27",width:"50",y:"79.7979",x:"133.5",fillOpacity:"null",strokeOpacity:"null",strokeWidth:"15",stroke:"currentColor",fill:"#fff"})))}function Ts(s){return M.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",onClick:e=>s.onClick&&s.onClick(e),viewBox:"0 0 512 512",width:s.width||(s.fontSize==="small"?16:20),height:s.height||s.width||(s.fontSize==="small"?16:20),className:s.className,style:s.style},M.createElement("path",{fill:"currentColor",d:"M433.941 65.941l-51.882-51.882A48 48 0 0 0 348.118 0H176c-26.51 0-48 21.49-48 48v48H48c-26.51 0-48 21.49-48 48v320c0 26.51 21.49 48 48 48h224c26.51 0 48-21.49 48-48v-48h80c26.51 0 48-21.49 48-48V99.882a48 48 0 0 0-14.059-33.941zM266 464H54a6 6 0 0 1-6-6V150a6 6 0 0 1 6-6h74v224c0 26.51 21.49 48 48 48h96v42a6 6 0 0 1-6 6zm128-96H182a6 6 0 0 1-6-6V54a6 6 0 0 1 6-6h106v88c0 13.255 10.745 24 24 24h88v202a6 6 0 0 1-6 6zm6-256h-64V48h9.632c1.591 0 3.117.632 4.243 1.757l48.368 48.368a6 6 0 0 1 1.757 4.243V112z"}))}function f4(s){return M.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",onClick:e=>s.onClick&&s.onClick(e),viewBox:"0 0 320 320",width:s.width||(s.fontSize==="small"?16:20),height:s.height||s.width||(s.fontSize==="small"?16:20),className:s.className,style:s.style},M.createElement("g",{fill:"currentColor"},M.createElement("rect",{rx:"32",height:"272",width:"267",y:"25",x:"25",strokeWidth:"15",stroke:"currentColor",fill:"none"}),M.createElement("ellipse",{stroke:"currentColor",ry:"26",rx:"26",cy:"252",cx:"160",fillOpacity:"null",strokeOpacity:"null",strokeWidth:"15",fill:"#fff"}),M.createElement("line",{y2:"201.94531",x2:"159.5",y1:"46.94531",x1:"159.5",fillOpacity:"null",strokeOpacity:"null",strokeWidth:"15",stroke:"currentColor",fill:"none"}),M.createElement("rect",{height:"27",width:"50",y:"140.83068",x:"133.5",fillOpacity:"null",strokeOpacity:"null",strokeWidth:"15",stroke:"currentColor",fill:"#fff"}),M.createElement("ellipse",{stroke:"currentColor",ry:"26",rx:"26",cy:"251",cx:"241",fillOpacity:"null",strokeOpacity:"null",strokeWidth:"15",fill:"#fff"}),M.createElement("line",{y2:"200.94531",x2:"240.5",y1:"45.94531",x1:"240.5",fillOpacity:"null",strokeOpacity:"null",strokeWidth:"15",stroke:"currentColor",fill:"none"}),M.createElement("rect",{height:"27",width:"50",y:"78.7979",x:"214.5",strokeWidth:"15",stroke:"currentColor",fill:"#fff"}),M.createElement("ellipse",{stroke:"currentColor",ry:"26",rx:"26",cy:"252",cx:"84",fillOpacity:"null",strokeOpacity:"null",strokeWidth:"15",fill:"#fff"}),M.createElement("line",{y2:"201.94531",x2:"83.5",y1:"46.94531",x1:"83.5",fillOpacity:"null",strokeOpacity:"null",strokeWidth:"15",stroke:"currentColor",fill:"none"}),M.createElement("rect",{height:"27",width:"50",y:"79.7979",x:"57.5",fillOpacity:"null",strokeOpacity:"null",strokeWidth:"15",stroke:"currentColor",fill:"#fff"})))}function tSe(s){return M.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",onClick:e=>s.onClick&&s.onClick(e),width:s.width||(s.fontSize==="small"?16:20),height:s.height||s.width||(s.fontSize==="small"?16:20),className:s.className,style:s.style},M.createElement("path",{fill:"currentColor",d:"M369.9 97.9L286 14C277 5 264.8-.1 252.1-.1H48C21.5 0 0 21.5 0 48v416c0 26.5 21.5 48 48 48h288c26.5 0 48-21.5 48-48V131.9c0-12.7-5.1-25-14.1-34zM332.1 128H256V51.9l76.1 76.1zM48 464V48h160v104c0 13.3 10.7 24 24 24h104v288H48z"}))}function sSe(s){return M.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",onClick:e=>s.onClick&&s.onClick(e),viewBox:"0 0 512 512",width:s.width||(s.fontSize==="small"?16:20),height:s.height||s.width||(s.fontSize==="small"?16:20),className:s.className,style:s.style},M.createElement("path",{fill:"currentColor",d:"M369.9 97.9L286 14C277 5 264.8-.1 252.1-.1H48C21.5 0 0 21.5 0 48v416c0 26.5 21.5 48 48 48h288c26.5 0 48-21.5 48-48V131.9c0-12.7-5.1-25-14.1-34zM332.1 128H256V51.9l76.1 76.1zM48 464V48h160v104c0 13.3 10.7 24 24 24h104v288H48z"}),M.createElement("path",{fill:"currentColor",stroke:"null",d:"m261,270l-12,0l0,-24c0,-33.12 -26.88,-60 -60,-60s-60,26.88 -60,60l0,24l-12,0c-13.2,0 -24,10.8 -24,24l0,120c0,13.2 10.8,24 24,24l144,0c13.2,0 24,-10.8 24,-24l0,-120c0,-13.2 -10.8,-24 -24,-24zm-72,108c-13.2,0 -24,-10.8 -24,-24s10.8,-24 24,-24s24,10.8 24,24s-10.8,24 -24,24zm37.2,-108l-74.4,0l0,-24c0,-20.52 16.68,-37.2 37.2,-37.2c20.52,0 37.2,16.68 37.2,37.2l0,24z"}))}function iSe(s){return M.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",onClick:e=>s.onClick&&s.onClick(e),viewBox:"0 0 512 512",width:s.width||(s.fontSize==="small"?16:20),height:s.height||s.width||(s.fontSize==="small"?16:20),className:s.className,style:s.style},M.createElement("path",{fill:"currentColor",d:"M448 0L320 96v62.06l-83.03 83.03c6.79 4.25 13.27 9.06 19.07 14.87 5.8 5.8 10.62 12.28 14.87 19.07L353.94 192H416l96-128-64-64zM128 278.59L10.92 395.67c-14.55 14.55-14.55 38.15 0 52.71l52.7 52.7c14.56 14.56 38.15 14.56 52.71 0L233.41 384c29.11-29.11 29.11-76.3 0-105.41s-76.3-29.11-105.41 0z"}))}function Ai(s){return M.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",onClick:e=>s.onClick&&s.onClick(e),viewBox:"0 0 320 320",width:s.width||(s.fontSize==="small"?16:20),height:s.height||s.width||(s.fontSize==="small"?16:20),className:s.className,style:s.style},M.createElement("rect",{fill:"none",rx:"32",height:"272",width:"267",y:"25",x:"25",strokeWidth:"15",stroke:"currentColor"}),M.createElement("ellipse",{fill:"none",ry:"54",rx:"54",cy:"160",cx:"160",fillOpacity:"null",strokeOpacity:"null",strokeWidth:"15",stroke:"currentColor"}))}function rSe(s){return M.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",onClick:e=>s.onClick&&s.onClick(e),viewBox:"0 0 24 24",width:s.width||(s.fontSize==="small"?16:20),height:s.height||s.width||(s.fontSize==="small"?16:20),className:s.className,style:s.style},M.createElement("path",{fill:"currentColor",stroke:"currentColor",d:"M4.25 5.61C6.27 8.2 10 13 10 13v6c0 .55.45 1 1 1h2c.55 0 1-.45 1-1v-6s3.72-4.8 5.74-7.39A.998.998 0 0 0 18.95 4H5.04c-.83 0-1.3.95-.79 1.61z"}))}const qo={root:{width:"100%",height:"100%"},overflowHidden:{overflow:"hidden"},container:{height:"100%"}};function oSe(s){var e;return M.createElement(j.Paper,{elevation:Number.isNaN(s.elevation)?1:s.elevation,style:{...qo.root,...((e=s.styles)==null?void 0:e.root)||void 0,...s.overflow!=="visible"?qo.overflowHidden:void 0},onKeyDown:s.onKeyDown,tabIndex:s.tabIndex},M.createElement(j.Grid2,{container:!0,direction:"column",wrap:"nowrap",sx:qo.container},s.children))}const Ql={root:{height:"100%",overflow:"hidden"},overflowAuto:{overflow:"auto"}};function nSe(s){return M.createElement(j.Grid2,{sx:{...Ql.root,...(s==null?void 0:s.style)||void 0,...s.overflow==="auto"?Ql.overflowAuto:void 0},ref:s.ref},s.children)}function aSe(s){return M.createElement(j.Grid2,{container:!0,alignItems:"center"},s.children)}const ds=24,pe=32,MSe=16,ge=20,x4=s=>s==="dark"?"#62ff25":"#37c400",_4=s=>s==="dark"?"#ee56ff":"#a204b4",cSe=s=>s==="dark"?"#fff46e":"#b89101",S4=s=>"#ff6d69",k4=s=>"#5773ff",Y4="#ff413c",v4="#86211f",Bn="#57ff45",Jn="#098c04",Rn="#f3ad11",Fn="#6c5008",w={toolbar:{minHeight:38},toolbarButtons:{padding:4,marginLeft:4},switchColumnAuto:{marginLeft:16},dialogColumns:{transition:"opacity 1s"},dialogColumnsLabel:{fontSize:12,paddingTop:8},columnCustom:{width:"100%",display:"inline-block"},columnCustomEditable:{cursor:"text"},columnCustom_center:{textAlign:"center"},columnCustom_left:{textAlign:"left"},columnCustom_right:{textAlign:"right"},width100:{width:"100%"},transparent_10:{opacity:.1},transparent_20:{opacity:.2},transparent_30:{opacity:.3},transparent_40:{opacity:.4},transparent_50:{opacity:.5},transparent_60:{opacity:.6},transparent_70:{opacity:.7},transparent_80:{opacity:.8},transparent_90:{opacity:.9},transparent_100:{opacity:1},headerRow:{paddingLeft:8,height:38,whiteSpace:"nowrap",userSelect:"none"},buttonClearFilter:{position:"relative",float:"right",padding:0},buttonClearFilterIcon:{zIndex:2,position:"absolute",top:0,left:0,color:"#FF0000",opacity:.7},tableDiv:{paddingTop:0,paddingLeft:0,width:"calc(100% - 8px)",height:"calc(100% - 38px)",overflow:"auto"},tableRow:s=>({pl:1,height:pe,lineHeight:`${pe}px`,verticalAlign:"top",userSelect:"none",position:"relative",width:"100%","&:hover":{background:`${s.palette.mode==="dark"?s.palette.primary.dark:s.palette.primary.light} !important`,color:O.invertColor(s.palette.primary.main,!0)},whiteSpace:"nowrap",flexWrap:"nowrap"}),tableRowLines:s=>({borderBottom:`1px solid ${s.palette.mode==="dark","#8888882e"}`,"& > div":{borderRight:`1px solid ${s.palette.mode==="dark","#8888882e"}`}}),tableRowNoDragging:{cursor:"pointer"},tableRowAlias:{height:pe+10},tableRowAliasReadWrite:{height:pe+22},tableRowFocused:s=>({"&:after":{content:'""',position:"absolute",top:1,left:1,right:1,bottom:1,border:s.palette.mode?"1px dotted #000":"1px dotted #FFF"}}),checkBox:{padding:0},cellId:{position:"relative",fontSize:"1rem",overflow:"hidden",textOverflow:"ellipsis","& .copyButton":{display:"none"},"&:hover .copyButton":{display:"block"},"& .iconOwn":{display:"block",width:pe-4,height:pe-4,mt:"2px",float:"right"},"&:hover .iconOwn":{display:"none"},"& *":{width:"initial"}},cellIdSpan:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},cellIdIconFolder:s=>({marginRight:8,width:pe-4,height:pe-4,cursor:"pointer",color:s.palette.secondary.main||"#fbff7d",verticalAlign:"top"}),cellIdIconDocument:{verticalAlign:"middle",marginLeft:(pe-ge)/2,marginRight:8,width:ge,height:ge},cellIdIconOwn:{},cellIdTooltip:{fontSize:14},cellIdTooltipLink:{color:"#7ec2fd","&:hover":{color:"#7ec2fd"},"&:visited":{color:"#7ec2fd"}},cellCopyButton:{width:ge,height:ge,top:(pe-ge)/2,opacity:.8,position:"absolute",right:3},cellCopyButtonInDetails:{width:ge,height:ge,top:(pe-ge)/2,opacity:.8},cellEditButton:{width:ge,height:ge,color:"white",position:"absolute",top:(pe-ge)/2,right:ge+3,opacity:.7,"&:hover":{opacity:1}},cellName:{display:"inline-block",verticalAlign:"top",fontSize:14,ml:"5px",overflow:"hidden",textOverflow:"ellipsis",position:"relative","& .copyButton":{display:"none"},"&:hover .copyButton":{display:"block"}},cellNameWithDesc:{lineHeight:"normal"},cellNameDivDiv:{},cellDescription:{fontSize:10,opacity:.5,fontStyle:"italic"},cellIdAlias:s=>({fontStyle:"italic",fontSize:12,opacity:.7,"&:hover":{color:s.palette.mode==="dark"?"#009900":"#007700"}}),cellIdAliasReadWriteDiv:{height:24,marginTop:-5},cellIdAliasAlone:{lineHeight:0},cellIdAliasReadWrite:{lineHeight:"12px"},cellType:{display:"inline-block",verticalAlign:"top","& .itemIcon":{verticalAlign:"middle",width:ds,height:ds,display:"inline-block"},"& .itemIconFolder":{marginLeft:3}},cellRole:{display:"inline-block",verticalAlign:"top",textOverflow:"ellipsis",overflow:"hidden"},cellRoom:{display:"inline-block",verticalAlign:"top",textOverflow:"ellipsis",overflow:"hidden"},cellEnumParent:{opacity:.4},cellFunc:{display:"inline-block",verticalAlign:"top",textOverflow:"ellipsis",overflow:"hidden"},cellValue:{display:"inline-block",verticalAlign:"top",textOverflow:"ellipsis",overflow:"hidden"},cellValueButton:{marginTop:5},cellValueButtonFalse:{opacity:.3},cellAdapter:{display:"inline-block",verticalAlign:"top"},cellValueTooltip:{fontSize:12},cellValueText:{width:"100%",height:pe,fontSize:16,display:"flex",overflow:"hidden",textOverflow:"ellipsis",position:"relative",verticalAlign:"top","& .copyButton":{display:"none"},"&:hover .copyButton":{display:"block"}},cellValueFile:{color:"#2837b9"},cellValueTooltipTitle:{fontStyle:"italic",width:100,display:"inline-block"},cellValueTooltipValue:{width:120,display:"inline-block",whiteSpace:"nowrap",textOverflow:"ellipsis"},cellValueTooltipImage:{width:100,height:"auto"},cellValueTooltipBoth:{width:220,display:"inline-block",whiteSpace:"nowrap"},cellValueTooltipBox:{width:250,overflow:"hidden",pointerEvents:"none"},tooltip:{pointerEvents:"none"},cellValueTextUnit:{marginLeft:4,opacity:.8,display:"inline-block"},cellValueTextState:{opacity:.7},cellValueTooltipCopy:{position:"absolute",bottom:3,right:3},cellValueTooltipEdit:{position:"absolute",bottom:3,right:15},cellButtons:{display:"inline-block",verticalAlign:"top"},cellButtonsButton:{display:"inline-block",opacity:.5,width:ge+4,height:ge+4,"&:hover":{opacity:1},p:0,mt:"-2px"},cellButtonsEmptyButton:{fontSize:12},cellButtonMinWidth:{minWidth:40},cellButtonsButtonAlone:{ml:`${ge+6}px`,pt:0,mt:"-2px"},cellButtonsButtonWithCustoms:s=>({color:s.palette.mode==="dark"?s.palette.primary.main:s.palette.secondary.main}),cellButtonsButtonWithoutCustoms:{opacity:.2},cellButtonsValueButton:s=>({position:"absolute",top:ge/2-2,opacity:.7,width:ge-2,height:ge-2,color:s.palette.action.active,"&:hover":{opacity:1}}),cellButtonsValueButtonCopy:{right:8,cursor:"pointer"},cellButtonsValueButtonEdit:{right:ge/2+16},cellDetailsLine:{display:"flex",alignItems:"center",width:"100%",height:32,fontSize:16},cellDetailsName:{fontWeight:"bold",marginRight:8,minWidth:80},filteredOut:{opacity:.5},filteredParentOut:{opacity:.3},filterInput:{mt:0,mb:0},selectIcon:{width:24,height:24,marginRight:4},selectNone:{opacity:.5},itemSelected:s=>({background:`${s.palette.primary.main} !important`,color:`${O.invertColor(s.palette.primary.main,!0)} !important`}),header:{width:"100%"},headerCell:{display:"inline-block",verticalAlign:"top"},headerCellValue:{paddingTop:4,fontSize:16},headerCellInput:{width:"calc(100% - 5px)",height:pe,pt:0,"& .itemIcon":{verticalAlign:"middle",width:ds,height:ds,display:"inline-block"}},headerCellSelectItem:{"& .itemIcon":{width:ds,height:ds,mr:"5px",display:"inline-block"}},visibleButtons:{color:"#2196f3",opacity:.7},grow:{flexGrow:1},enumIconDiv:{marginRight:8,width:32,height:32,borderRadius:8,background:"#FFFFFF"},enumIcon:{marginTop:4,marginLeft:4,width:24,height:24},enumDialog:{overflow:"hidden"},enumList:{minWidth:250,height:"calc(100% - 50px)",overflow:"auto"},enumCheckbox:{minWidth:0},buttonDiv:{display:"flex",height:"100%",alignItems:"center"},aclText:{fontSize:13,marginTop:6},rightsObject:{color:"#55ff55",paddingLeft:3},rightsState:{color:"#86b6ff",paddingLeft:3},textCenter:{padding:12,textAlign:"center"},tooltipAccessControl:{display:"flex",flexDirection:"column"},fontSizeTitle:{"@media screen and (max-width: 465px)":{"& *":{fontSize:12}}},draggable:{cursor:"copy"},nonDraggable:{cursor:"no-drop"},selectClearButton:{position:"absolute",top:0,right:0,borderRadius:5,backgroundColor:"background.default"},iconDeviceConnected:s=>({color:s.palette.mode==="dark"?Bn:Jn,opacity:.8,position:"absolute",top:4,right:32,width:20}),iconDeviceDisconnected:s=>({color:s.palette.mode==="dark"?Rn:Fn,opacity:.8,position:"absolute",top:4,right:32,width:20}),iconDeviceError:s=>({color:s.palette.mode==="dark"?Y4:v4,opacity:.8,position:"absolute",top:4,right:50,width:20}),resizeHandle:{display:"block",position:"absolute",cursor:"col-resize",width:7,top:2,bottom:2,zIndex:1},resizeHandleRight:{right:3,borderRight:"2px dotted #888","&:hover":{borderColor:"#ccc",borderRightStyle:"solid"},"&.active":{borderColor:"#517ea5",borderRightStyle:"solid"}},invertedBackground:s=>({backgroundColor:s.palette.mode==="dark"?"#9a9a9a":"#565656",padding:"0 3px",borderRadius:"2px 0 0 2px"}),invertedBackgroundFlex:s=>({backgroundColor:s.palette.mode==="dark"?"#9a9a9a":"#565656",borderRadius:"0 2px 2px 0"}),contextMenuEdit:s=>({color:s.palette.mode==="dark"?"#ffee48":"#cbb801"}),contextMenuEditValue:s=>({color:s.palette.mode==="dark"?"#5dff45":"#1cd301"}),contextMenuView:s=>({color:s.palette.mode==="dark"?"#FFF":"#000"}),contextMenuCustom:s=>({color:s.palette.mode==="dark"?"#42eaff":"#01bbc2"}),contextMenuACL:s=>({color:s.palette.mode==="dark"?"#e079ff":"#500070"}),contextMenuRoom:s=>({color:s.palette.mode==="dark"?"#ff9a33":"#642a00"}),contextMenuRole:s=>({color:s.palette.mode==="dark"?"#ffdb43":"#562d00"}),contextMenuDelete:s=>({color:s.palette.mode==="dark"?"#ff4f4f":"#cf0000"}),contextMenuKeys:{marginLeft:8,opacity:.7,fontSize:"smaller"},contextMenuWithSubMenu:{display:"flex"}};function uSe(s){return M.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 436 436",style:s==null?void 0:s.style,width:"24",height:"24",className:"admin-button"},M.createElement("g",{fill:"currentColor"},M.createElement("path",{d:"m195.23077,24.30769c-36,3 -67,12 -96,26c-49,24 -82,61 -93,104l-3,11l-1,50c0,46 0,49 2,59l5,20c21,58 84,103 165,116c16,3 53,4 70,2c60,-6 111,-28 147,-64c21,-21 36,-49 40,-74a866,866 0 0 0 1,-104c-3,-18 -6,-28 -13,-43c-26,-52 -87,-90 -162,-101c-16,-2 -48,-3 -63,-2l1,0zm60,23c36,5 70,18 95,35c31,20 51,47 59,77c2,7 2,11 2,25c1,15 0,18 -2,26c-19,69 -104,117 -200,114c-47,-2 -90,-15 -124,-38c-31,-20 -51,-47 -59,-77c-3,-11 -4,-32 -2,-43c8,-42 41,-78 91,-101a260,260 0 0 1 140,-19l0,1zm-221,222c21,26 57,49 95,62c81,27 174,14 239,-32c14,-10 31,-27 41,-41c2,-2 2,-2 2,7c-1,23 -16,50 -38,72c-78,74 -233,74 -311,-1a121,121 0 0 1 -39,-76l0,-6l3,4l8,11z"}),M.createElement("path",{d:"m201.23077,47.30769c-40,3 -79,19 -104,44c-55,55 -38,133 37,171c52,26 122,24 172,-5c30,-17 51,-42 58,-71c3,-11 3,-34 0,-45c-6,-23 -21,-44 -40,-60l-27,-16a184,184 0 0 0 -96,-18zm30,21c56,5 100,35 112,75c4,11 4,30 0,41c-8,25 -26,45 -54,59a166,166 0 0 1 -160,-8a98,98 0 0 1 -41,-53c-5,-18 -2,-39 8,-57c23,-39 79,-62 135,-57z"})))}function Ul(s){s=(s||"").toString();const e=s[0]==="*",t=s[s.length-1]==="*";return s=s.replace(/[-/\\^$+?.()|[\]{}]/g,"\\$&").replace(/\*/g,".*"),(e?"":"^")+s+(t?"":"$")}function lSe(s,e){const t=[];for(let i=0;i<s.length;i++)e(t,s[i],i);return t}function NSe(s,e){const t={};for(const i in s)Object.prototype.hasOwnProperty.call(s,i)&&e(t,s[i],i);return t}function Gn(s,e,t){return Array.isArray(s)?lSe(s,(i,r,o)=>{if(r==null)return;const n=typeof r=="object";if(t&&n&&typeof r.en=="string"&&typeof r.de=="string"){i[o]=r.en;return}i[o]=n?Gn(r,e,t):r}):NSe(s,(i,r,o)=>{if(r==null||e.includes(o))return;const n=typeof r=="object";if(t&&n&&typeof r.en=="string"&&typeof r.de=="string"){i[o]=r.en;return}i[o]=n?Gn(r,e,t):r})}function $l(s,e,t){const i=document.createElement("a"),r=[];t.excludeSystemRepositories&&r.push("system.repositories");const o=r.length>0||t.excludeTranslations?Gn(e,r,t.excludeTranslations):e,n=t.beautify?JSON.stringify(o,null,2):JSON.stringify(o);i.setAttribute("href",`data:application/json;charset=utf-8,${encodeURIComponent(n)}`),i.setAttribute("download",s),i.style.display="none",document.body.appendChild(i),i.click(),document.body.removeChild(i)}function vi(s,e,t,i){if(t||=0,i===void 0&&(i=s.length-1,!i))return s[0]===e;const r=Math.floor((t+i)/2);return e===s[r]?!0:i-1===t?s[t]===e||s[i]===e:e>s[r]?vi(s,e,r,i):e<s[r]?vi(s,e,t,r):!1}function Ye(s,e){return typeof s=="object"?s?(s[e]||s.en||"").toString():"":s?s.toString():""}function Zr(s,e,t,i){var a,c;i||=".";let r="";const o=`system.adapter.${e}`,n=e&&((c=(a=s[o])==null?void 0:a.common)==null?void 0:c.icon);if(n)if(n.startsWith("data:image/"))n.startsWith("data:image/svg")?r=M.createElement(Wn,{className:"iconOwn",src:n,width:28,height:28}):r=n;else if(n.includes(".")){const l=s[o].common.name;typeof l=="object"?r=`${i}/adapter/${l[t]||l.en}/${n}`:r=`${i}/adapter/${l}/${n}`}else return n&&n.length<3?n:null;else{const l=s[e]&&s[e].common;if(l){const N=l.icon;if(N)if(N.startsWith("data:image/"))N.startsWith("data:image/svg")?r=M.createElement(Wn,{className:"iconOwn",src:N,width:28,height:28}):r=N;else if(N.includes(".")){let u;s[e].type==="instance"||s[e].type==="adapter"?typeof l.name=="object"?r=`${i}/adapter/${l.name[t]||l.name.en}/${N}`:r=`${i}/adapter/${l.name}/${N}`:e&&e.startsWith("system.adapter.")?(u=e.split(".",3),N[0]==="/"?u[2]+=N:u[2]+=`/${N}`,r=`${i}/adapter/${u[2]}`):(u=e.split(".",2),N[0]==="/"?u[0]+=N:u[0]+=`/${N}`,r=`${i}/adapter/${u[0]}`)}else return n&&n.length<3?n:null}}return r||null}function Hn(s,e,t,i,r,o,n,a,c){var u,L,g,y,T,d,z,I,C,m,A;c||=0;let l=!1;if(!r){if(r={},e.id){const D=e.id.toLowerCase();D.includes("*")?r.idRx=new RegExp(Ul(e.id),"i"):r.id=D}if(e.name){const D=e.name.toLowerCase();D.includes("*")?r.nameRx=new RegExp(Ul(D),"i"):r.name=D}e.type&&(r.type=e.type.toLowerCase()),e.custom&&(r.custom=e.custom.toLowerCase()),e.role&&(r.role=e.role.toLowerCase()),e.room&&(r.room=((L=(u=i[e.room])==null?void 0:u.common)==null?void 0:L.members)||[]),e.func&&(r.func=((y=(g=i[e.func])==null?void 0:g.common)==null?void 0:y.members)||[])}const N=s.data;if(N&&N.id){const D=(T=N.obj)==null?void 0:T.common;if(n){if(n.type&&(typeof n.type=="string"?(!N.obj||n.type!==N.obj.type)&&(l=!0):Array.isArray(n.type)&&(!N.obj||!n.type.includes(N.obj.type))&&(l=!0)),!l&&((d=n.common)!=null&&d.type)&&(D!=null&&D.type?typeof n.common.type=="string"?n.common.type!==D.type&&(l=!0):Array.isArray(n.common.type)&&(n.common.type.includes(D.type)||(l=!0)):l=!0),!l&&((z=n.common)!=null&&z.role)&&(D!=null&&D.role?typeof n.common.role=="string"?D.role.startsWith(n.common.role)&&(l=!0):Array.isArray(n.common.role)&&(n.common.role.find(p=>D.role.startsWith(p))||(l=!0)):l=!0),!l&&((I=n.common)==null?void 0:I.custom)==="_"&&(D!=null&&D.custom))l=!0;else if(!l&&((C=n.common)!=null&&C.custom)&&((m=n.common)==null?void 0:m.custom)!=="_"){const p=n.common.custom;if(!(D!=null&&D.custom))l=!0;else if(p==="_dataSources")Object.keys(D.custom).find(_=>_.startsWith("history.")||_.startsWith("sql.")||_.startsWith("influxdb."))||(l=!0);else if(Array.isArray(p)){const _=Object.keys(D.custom);p.find(x=>_.find(P=>P.startsWith(x)))&&(l=!0)}else p!==!0&&!Object.keys(D.custom).find(_=>_.startsWith(p))&&(l=!0)}}!l&&!e.expertMode&&(l=N.id==="system"||N.id==="enum"||N.id.startsWith("system.")||N.id.startsWith("enum.")||N.id.startsWith("_design/")||N.id.endsWith(".admin")||!!(D!=null&&D.expert)),!l&&r.id&&(N.fID===void 0&&(N.fID=N.id.toLowerCase()),l=!N.fID.includes(r.id)),!l&&r.idRx&&(l=!r.idRx.test(N.id)),!l&&r.name&&(D?(N.fName===void 0&&(N.fName=Ye(D.name,t)||"",N.fName=N.fName.toLowerCase()),l=!N.fName.includes(r.name)):l=!0),!l&&r.nameRx&&D&&(N.fName===void 0&&(N.fName=Ye(D.name,t)||"",N.fName=N.fName.toLowerCase()),l=!r.nameRx.test(N.fName)),!l&&e.role&&D&&(D?l=!(typeof D.role=="string"&&D.role.startsWith(r.role)):l=!0),!l&&r.room&&(l=!r.room.find(p=>p===N.id||N.id.startsWith(`${p}.`))),!l&&r.func&&(l=!r.func.find(p=>p===N.id||N.id.startsWith(`${p}.`))),!l&&r.type&&(l=!(N.obj&&N.obj.type&&N.obj.type===r.type)),!l&&a&&(l=!(N.obj&&N.obj.type&&a.includes(N.obj.type))),!l&&r.custom&&(D?r.custom==="_"?l=!!D.custom:l=!((A=D.custom)!=null&&A[r.custom]):l=!0)}return N.visible=!l,N.hasVisibleChildren=!1,s.children&&c<20&&s.children.forEach(D=>{Hn(D,e,t,i,r,o,n,a,c+1)&&(N.hasVisibleChildren=!0)}),N.sumVisibility=N.visible||N.hasVisibleChildren,o&&N.sumVisibility&&o.count++,N.id&&N.sumVisibility&&s.children&&s.children.forEach(D=>D.data.hasVisibleParent=!0),N.visible||N.hasVisibleChildren}function b4(s,e,t,i){var o;i||=[];const r=s.data;return r.sumVisibility&&(r.id&&t[r.id]&&t[r.id].type===e&&i.push(r.id),(o=s.children)==null||o.forEach(n=>b4(n,e,t,i))),i}function Pl(s,e,t,i,r,o){let n;return e==="alias"||e==="alias.0"?n=M.createElement(dN,{className:"iconOwn",style:{color:_4(i)}}):e==="0_userdata"||e==="0_userdata.0"?n=M.createElement(ag,{className:"iconOwn",style:{color:x4(i)}}):e.startsWith("_design/")||e==="system"?n=M.createElement(kr,{className:"iconOwn",style:{color:S4(i)}}):e==="system.adapter"?n=M.createElement(kr,{className:"iconOwn",style:{color:k4(i)}}):e==="system.group"?n=M.createElement(ja,{className:"iconOwn"}):e==="system.user"?n=M.createElement(La,{className:"iconOwn"}):e==="system.host"?n=M.createElement(ga,{className:"iconOwn"}):e.endsWith(".connection")||e.endsWith(".connected")?n=M.createElement(Qs,{className:"iconOwn"}):e.endsWith(".info")?n=M.createElement(Na,{className:"iconOwn"}):s[e]&&s[e].type==="meta"?n=M.createElement(Kr,{className:"iconOwn"}):t<2&&s[`system.adapter.${e}`]&&(n=Zr(s,`system.adapter.${e}`,r,o)),n||null}function Q4(s,e){var t,i;return(i=(t=s==null?void 0:s.obj)==null?void 0:t.common)!=null&&i.desc&&Ye(s.obj.common.desc,e)||null}function LSe(s,e){const t=Q4(s,e);return t!=null&&t.startsWith("http")?M.createElement(j.Box,{component:"a",sx:w.cellIdTooltipLink,href:t,target:"_blank",rel:"noreferrer"},t):M.createElement("span",{style:w.cellIdTooltip},t||s.id||"")}function Wl(s,e){var N,u,L,g,y,T,d,z,I,C;const t=e.imagePrefix||".";let i=Object.keys(s);i.sort((m,A)=>m===A?0:(m=m.replace(/\./g,"!!!"),A=A.replace(/\./g,"!!!"),m>A?1:-1)),e.root&&(i=i.filter(m=>m===e.root||m.startsWith(`${e.root}.`)));let r=[],o="",n=0;const a={data:{name:"",id:""},children:[]},c={funcEnums:[],roomEnums:[],roles:[],ids:[],types:[],objects:s,customs:["_"],enums:[],hasSomeCustoms:!1,aliasesMap:{}};let l=a;for(let m=0;m<i.length;m++){const A=i[m];if(!A)continue;const D=s[A],p=A.split(".");if(D.type&&!c.types.includes(D.type)&&c.types.push(D.type),D){const x=D.common,P=x==null?void 0:x.role;if(P&&!c.roles.find(v=>v.role===P)?typeof P!="string"?console.warn(`Invalid role type "${typeof P}" in "${D._id}"`):c.roles.push({role:P,type:x.type}):A.startsWith("enum.rooms.")?(c.roomEnums.push(A),c.enums.push(A)):A.startsWith("enum.functions.")?(c.funcEnums.push(A),c.enums.push(A)):D.type==="enum"?c.enums.push(A):D.type==="instance"&&x&&(x.supportCustoms||(N=x.adminUI)!=null&&N.custom)&&(c.hasSomeCustoms=!0,c.customs.push(A.substring(15))),A.startsWith("alias.")&&((u=D.common.alias)!=null&&u.id))if(typeof D.common.alias.id=="string"){const v=D.common.alias.id;c.aliasesMap[v]?c.aliasesMap[v].includes(A)||c.aliasesMap[v].push(A):c.aliasesMap[v]=[A]}else{const v=D.common.alias.id.read;v&&(c.aliasesMap[v]?c.aliasesMap[v].includes(A)||c.aliasesMap[v].push(A):c.aliasesMap[v]=[A]);const ee=D.common.alias.id.write;ee&&(c.aliasesMap[ee]?c.aliasesMap[ee].includes(A)||c.aliasesMap[ee].push(A):c.aliasesMap[ee]=[A])}}c.ids.push(A);let _;do if(_=!1,!o||A.startsWith(`${o}.`)){if(p.length-n>1){let P=o;for(let v=n;v<p.length-1;v++)if(P+=(P?".":"")+p[v],vi(c.ids,P))l.children&&(l=l.children.find(ee=>ee.data.name===p[v]));else{const ee={data:{name:p[v],parent:l,id:P,obj:s[P],level:v,icon:Pl(s,P,v,e.themeType,e.lang,t),generated:!0}};l.children||=[],l.children.push(ee),l=ee,c.ids.push(P)}}const x={data:{name:p[p.length-1],title:Ye((L=D==null?void 0:D.common)==null?void 0:L.name,e.lang),obj:D,parent:l,icon:Zr(s,A,e.lang,t)||Pl(s,A,0,e.themeType,e.lang,t),id:A,hasCustoms:!!((g=D.common)!=null&&g.custom&&Object.keys(D.common.custom).length),level:p.length-1,generated:!1,button:D.type==="state"&&!!((y=D.common)!=null&&y.role)&&typeof D.common.role=="string"&&D.common.role.startsWith("button")&&((T=D.common)==null?void 0:T.write)!==!1,switch:D.type==="state"&&((d=D.common)==null?void 0:d.type)==="boolean"&&((z=D.common)==null?void 0:z.write)!==!1&&((I=D.common)==null?void 0:I.read)!==!1,url:!!((C=D.common)!=null&&C.role)&&typeof D.common.role=="string"&&D.common.role.startsWith("url")}};l.children||=[],l.children.push(x),l=x,n=p.length,r=p,o=A}else{let x=0;for(;r[x]===p[x];)x++;if(x>0){let P=r.length;for(r=r.splice(0,x),n=x,o=r.join(".");P>x;)l.data.parent?l=l.data.parent:console.error(`Parent is null for ${A} ${o} ${r.join(".")}`),P--}else l=a,r=[],o="",n=0;_=!0}while(_)}return c.roomEnums.sort((m,A)=>{var _,x,P,v;const D=Ye((x=(_=s[m])==null?void 0:_.common)==null?void 0:x.name,e.lang)||m.split(".").pop(),p=Ye((v=(P=s[A])==null?void 0:P.common)==null?void 0:v.name,e.lang)||A.split(".").pop();return D>p?1:D<p?-1:0}),c.funcEnums.sort((m,A)=>{var _,x,P,v;const D=Ye((x=(_=s[m])==null?void 0:_.common)==null?void 0:x.name,e.lang)||m.split(".").pop(),p=Ye((v=(P=s[A])==null?void 0:P.common)==null?void 0:v.name,e.lang)||A.split(".").pop();return D>p?1:D<p?-1:0}),c.roles.sort((m,A)=>m.role.localeCompare(A.role)),c.types.sort(),{info:c,root:a}}function U4(s,e,t,i,r){if(s.data.id===e)return s;if(t||(t=e.split("."),r=0,i=t[r]),!s.children&&s.data.id!==e)return null;let o;if(s.children)for(let n=0;n<s.children.length;n++){const a=s.children[n].data.id;if(a===i){o=s.children[n];break}else if(a>i)break}return o?(r||=0,U4(o,e,t,`${i}.${t[r+1]}`,r+1)):null}function $4(s,e,t,i){var n,a;if(!e)return{rooms:[],per:!1};i||=[];for(const c of s.roomEnums){const l=(n=s.objects[c])==null?void 0:n.common;if(!l)continue;const N=Ye(l.name,t);(a=l.members)!=null&&a.includes(e)&&!i.includes(N)&&i.push(N)}let r;const o=e.split(".");return o.pop(),e=o.join("."),s.objects[e]&&(r=i.length,$4(s,e,t,i)),{rooms:i,per:!r}}function Ds(s,e,t,i){var r,o;if(!e)return[];i||=[];for(let n=0;n<s[t].length;n++){const a=(r=s.objects[s[t][n]])==null?void 0:r.common;(o=a==null?void 0:a.members)!=null&&o.includes(e)&&!i.includes(s[t][n])&&i.push(s[t][n])}return i.sort(),i}function P4(s,e,t,i){var n,a;if(!e)return{funcs:[],pef:!1};i||=[];for(let c=0;c<s.funcEnums.length;c++){const l=(n=s.objects[s.funcEnums[c]])==null?void 0:n.common;if(!l)continue;const N=Ye(l.name,t);(a=l.members)!=null&&a.includes(e)&&!i.includes(N)&&i.push(N)}let r;const o=e.split(".");return o.pop(),e=o.join("."),s.objects[e]&&(r=i.length,P4(s,e,t,i)),{funcs:i,pef:!r}}function en(s){var g;const{dateFormat:e,state:t,isFloatComma:i,texts:r,obj:o}=s,n=O.getStates(o),a=o.common;let c,l=(a==null?void 0:a.type)==="file"?"[file]":!t||t.val===null?"(null)":t.val===void 0?"[undef]":t.val;const N=typeof l;if(a!=null&&a.role&&typeof a.role=="string"&&a.role.match(/^value\.time|^date/))if(l&&typeof l=="string")if(O.isStringInteger(l))l=new Date(parseInt(l,10)).toString();else try{const y=new Date(l);O.isValidDate(y)&&(l=y.toString())}catch{}else l>946681200&&l<9466812e5&&(l*=1e3),l=l&&new Date(l).toString();else N==="number"?Number.isInteger(l)||(l=Math.round(l*1e8)/1e8,i&&(l=l.toString().replace(".",","))):N==="object"?l=JSON.stringify(l):N!=="string"?l=l.toString():l.startsWith("data:image/")&&(c="image"),typeof l!="string"&&(l=l.toString());const u={v:l};n&&n[l]!==void 0&&l!==n[l]&&(u.s=l,l=n[l],u.v=l),((g=u.v)==null?void 0:g.length)>40&&(u.c=u.v,u.v=`${u.v.substring(0,40)}...`),a!=null&&a.unit&&(u.u=a.unit);let L;if(s.full&&(typeof l=="string"&&l.length>100?L=[{t:r.value,v:`${l.substring(0,100)}...`}]:L=[{t:r.value,v:l}],t)){if(t.ack!==void 0&&t.ack!==null&&L.push({t:r.ack,v:t.ack.toString()}),t.ts&&L.push({t:r.ts,v:t.ts?O.formatDate(new Date(t.ts),e):""}),t.lc&&L.push({t:r.lc,v:t.lc?O.formatDate(new Date(t.lc),e):""}),t.from){let y=t.from.toString();y.startsWith("system.adapter.")&&(y=y.substring(15)),L.push({t:r.from,v:y})}if(t.user){let y=t.user.toString();y.startsWith("system.user.")&&(y=y.substring(12)),L.push({t:r.user,v:y})}t.c&&L.push({t:r.c,v:t.c}),L.push({t:r.quality,v:O.quality2text(t.q||0).join(", "),nbr:!0})}return{valText:u,valFull:L,fileViewer:c}}function gSe(s){const{state:e}=s;return{color:e!=null&&e.ack?e.q?"#ffa500":"":"#ff2222c9"}}function jSe(s,e){let t=e,i=1;const r=[];for(;i<s.length&&t<e+25*36e5;){for(;s[i-1].ts<t&&t<=s[i].ts&&i<s.length;)i++;if(i===1&&s[i-1].ts>=t)r.push(0);else if(i<s.length)if(typeof s[i].val=="boolean"||typeof s[i-1].val=="boolean")r.push(s[i].val?1:0);else{s[i-1].val||=0,s[i].val||=0;const o=s[i-1].val,n=s[i].val,a=o+(n-o)*(t-s[i-1].ts)/(s[i].ts-s[i-1].ts);r.push(a)}t+=36e5}return r}const Bl={state:M.createElement(Ai,{className:"itemIcon",style:{verticalAlign:"middle"}}),channel:M.createElement(E4,{className:"itemIcon",style:{verticalAlign:"middle"}}),device:M.createElement(f4,{className:"itemIcon",style:{verticalAlign:"middle"}}),adapter:M.createElement(eSe,{className:"itemIcon",style:{verticalAlign:"middle"}}),meta:M.createElement(Kr,{className:"itemIcon",style:{verticalAlign:"middle"}}),instance:M.createElement(iSe,{className:"itemIcon",style:{color:"#7da7ff",verticalAlign:"middle"}}),enum:M.createElement(Dg,{className:"itemIcon",style:{verticalAlign:"middle"}}),chart:M.createElement(pg,{className:"itemIcon",style:{verticalAlign:"middle"}}),config:M.createElement(Nn,{className:"itemIcon",style:{verticalAlign:"middle"}}),group:M.createElement(ja,{className:"itemIcon",style:{verticalAlign:"middle"}}),user:M.createElement(La,{className:"itemIcon",style:{verticalAlign:"middle"}}),host:M.createElement(ga,{className:"itemIcon",style:{verticalAlign:"middle"}}),schedule:M.createElement(sg,{className:"itemIcon",style:{verticalAlign:"middle"}}),script:M.createElement(la,{className:"itemIcon",style:{verticalAlign:"middle"}}),folder:M.createElement(Ws,{className:"itemIcon itemIconFolder",style:{verticalAlign:"middle"}})},le={xs:{idWidth:"100%",fields:[],widths:{}},sm:{idWidth:300,fields:["room","val"],widths:{room:100,val:200}},md:{idWidth:300,fields:["room","func","val","buttons"],widths:{name:200,room:150,func:150,val:120,buttons:120}},lg:{idWidth:300,fields:["name","type","role","room","func","val","buttons","changedFrom","qualityCode","timestamp","lastChange"],widths:{name:300,type:80,role:120,room:180,func:180,val:140,buttons:120,changedFrom:120,qualityCode:100,timestamp:165,lastChange:165}},xl:{idWidth:550,fields:["name","type","role","room","func","val","buttons","changedFrom","qualityCode","timestamp","lastChange"],widths:{name:400,type:80,role:120,room:180,func:180,val:140,buttons:120,changedFrom:120,qualityCode:100,timestamp:170,lastChange:170}}};let Jl=!1;const hr={id:"",name:"",room:"",func:"",role:"",type:"",custom:"",expertMode:!1};class it extends f.Component{info={funcEnums:[],roomEnums:[],roles:[],ids:[],types:[],objects:{},customs:[],enums:[],hasSomeCustoms:!1,aliasesMap:{}};localStorage=window._localStorage||window.localStorage;lastAppliedFilter=null;tableRef;filterRefs;pausedSubscribes=!1;selectFirst;root=null;states={};subscribes=[];unsubscribeTimer=null;statesUpdateTimer=null;objectsUpdateTimer=null;filterTimer=null;visibleCols;texts;possibleCols;imagePrefix;adapterColumns=[];styleTheme="";edit={id:"",val:"",q:0,ack:!1};levelPadding;customWidth=!1;resizeTimeout=null;resizerNextName=null;resizerActiveName=null;resizerCurrentWidths={};resizeLeft=!1;resizerOldWidth=0;resizerMin=0;resizerNextMin=0;resizerOldWidthNext=0;resizerPosition=0;resizerActiveDiv=null;resizerNextDiv=null;storedWidths=null;systemConfig;objects;defaultHistory="";cltrPressed=!1;columnsVisibility={};changedIds=null;contextMenu=null;recordStates=[];styles={};customColumnDialog=null;static#e=["0_userdata.0.","alias.0."];constructor(e){super(e);const t=this.localStorage.getItem(`${e.dialogName||"App"}.objectSelected`)||"";if(this.selectFirst="",t.startsWith("["))try{const d=JSON.parse(t);this.selectFirst=d[0]||""}catch{}else this.selectFirst=t;let i;const r=this.localStorage.getItem(`${e.dialogName||"App"}.objectExpanded`)||"[]";try{i=JSON.parse(r)}catch{i=[]}let o;const n=e.defaultFilters?"":this.localStorage.getItem(`${e.dialogName||"App"}.objectFilter`)||"";if(n)try{o=JSON.parse(n)}catch{o={...hr}}else e.defaultFilters&&typeof e.defaultFilters=="object"?o={...e.defaultFilters}:o={...hr};if(o.expertMode=e.expertMode!==void 0?e.expertMode:(window._sessionStorage||window.sessionStorage).getItem("App.expertMode")==="true",this.tableRef=f.createRef(),this.filterRefs={},Object.keys(hr).forEach(d=>this.filterRefs[d]=f.createRef()),this.visibleCols=e.columns||le[e.width||"lg"].fields,e.types&&e.types.length===1){const d=this.visibleCols.indexOf("type");d!==-1&&this.visibleCols.splice(d,1)}this.possibleCols=le.xl.fields;let a=null;if(e.router){const d=e.router.getLocation();d.id&&d.dialog==="customs"&&(a=[d.id],this.pauseSubscribe(!0))}let c;Array.isArray(e.selected)?c=e.selected:c=[e.selected||""],c=c.map(d=>d.replace(/["']/g,"")).filter(d=>d),this.selectFirst=c.length&&c[0]?c[0]:this.selectFirst;const l=this.localStorage.getItem(`${e.dialogName||"App"}.columns`);let N;try{N=l?JSON.parse(l):null}catch{N=null}let u=null;try{u=u?JSON.parse(u):{}}catch{u={}}this.imagePrefix=e.imagePrefix||".";let L;const g=this.localStorage.getItem(`${e.dialogName||"App"}.foldersFirst`);g==="false"?L=!1:g==="true"?L=!0:L=e.foldersFirst===void 0?!0:e.foldersFirst;let y=!1;try{y=this.props.objectStatesView&&JSON.parse(this.localStorage.getItem(`${e.dialogName||"App"}.objectStatesView`)||"")||!1}catch{}this.state={loaded:!1,foldersFirst:L,selected:c,selectedNonObject:this.localStorage.getItem(`${e.dialogName||"App"}.selectedNonObject`)||"",filter:o,filterKey:0,focused:this.localStorage.getItem(`${e.dialogName||"App"}.focused`)||"",depth:0,expandAllVisible:!1,expanded:i,toast:"",scrollBarWidth:16,customDialog:a,editObjectDialog:"",editObjectAlias:!1,viewFileDialog:"",showAliasEditor:"",enumDialog:null,roleDialog:null,statesView:y,columns:N,columnsForAdmin:null,columnsSelectorShow:!1,columnsAuto:this.localStorage.getItem(`${e.dialogName||"App"}.columnsAuto`)!=="false",columnsWidths:u,columnsDialogTransparent:100,columnsEditCustomDialog:null,customColumnDialogValueChanged:!1,showExportDialog:!1,showAllExportOptions:!1,linesEnabled:this.localStorage.getItem(`${e.dialogName||"App"}.lines`)==="true",showDescription:this.localStorage.getItem(`${e.dialogName||"App"}.desc`)!=="false",showContextMenu:null,noStatesByExportImport:!1,beautifyJsonExport:!0,excludeSystemRepositoriesFromExport:!0,excludeTranslations:!1,tooltipInfo:null,aliasMenu:"",showRenameDialog:null},this.texts={name:e.t("ra_Name"),categories:e.t("ra_Categories"),value:e.t("ra_tooltip_value"),ack:e.t("ra_tooltip_ack"),ts:e.t("ra_tooltip_ts"),lc:e.t("ra_tooltip_lc"),from:e.t("ra_tooltip_from"),user:e.t("ra_tooltip_user"),c:e.t("ra_tooltip_comment"),quality:e.t("ra_tooltip_quality"),editObject:e.t("ra_tooltip_editObject"),deleteObject:e.t("ra_tooltip_deleteObject"),customConfig:e.t("ra_tooltip_customConfig"),copyState:e.t("ra_tooltip_copyState"),editState:e.t("ra_tooltip_editState"),ctrlForLink:e.t("ra_tooltip_ctrlForLink"),close:e.t("ra_Close"),filter_id:e.t("ra_filter_id"),filter_name:e.t("ra_filter_name"),filter_type:e.t("ra_filter_type"),filter_role:e.t("ra_filter_role"),filter_room:e.t("ra_filter_room"),filter_func:e.t("ra_filter_func"),filter_custom:e.t("ra_filter_customs"),filterCustomsWithout:e.t("ra_filter_customs_without"),objectChangedByUser:e.t("ra_object_changed_by_user"),objectChangedBy:e.t("ra_object_changed_by"),objectChangedFrom:e.t("ra_state_changed_from"),stateChangedBy:e.t("ra_state_changed_by"),stateChangedFrom:e.t("ra_state_changed_from"),ownerGroup:e.t("ra_Owner group"),ownerUser:e.t("ra_Owner user"),showAll:e.t("ra_show_all"),deviceError:e.t("ra_Error"),deviceDisconnected:e.t("ra_Disconnected"),deviceConnected:e.t("ra_Connected"),aclOwner_read_object:e.t("ra_aclOwner_read_object"),aclOwner_read_state:e.t("ra_aclOwner_read_state"),aclOwner_write_object:e.t("ra_aclOwner_write_object"),aclOwner_write_state:e.t("ra_aclOwner_write_state"),aclGroup_read_object:e.t("ra_aclGroup_read_object"),aclGroup_read_state:e.t("ra_aclGroup_read_state"),aclGroup_write_object:e.t("ra_aclGroup_write_object"),aclGroup_write_state:e.t("ra_aclGroup_write_state"),aclEveryone_read_object:e.t("ra_aclEveryone_read_object"),aclEveryone_read_state:e.t("ra_aclEveryone_read_state"),aclEveryone_write_object:e.t("ra_aclEveryone_write_object"),aclEveryone_write_state:e.t("ra_aclEveryone_write_state"),create:e.t("ra_Create"),createBooleanState:e.t("ra_create_boolean_state"),createNumberState:e.t("ra_create_number_state"),createStringState:e.t("ra_create_string_state"),createState:e.t("ra_create_state"),createChannel:e.t("ra_create_channel"),createDevice:e.t("ra_create_device"),createFolder:e.t("ra_Create folder")},this.levelPadding=e.levelPadding||MSe;const T=this.localStorage.getItem(`${this.props.dialogName||"App"}.table`);if(T)try{const d=JSON.parse(T),z=this.props.width||"lg";this.storedWidths=JSON.parse(JSON.stringify(le[z])),Object.keys(d).forEach(I=>{I==="id"?le[z].idWidth=d.id:I==="nameHeader"?le[z].widths.name=d[I]:le[z].widths[I]!==void 0&&(le[z].widths[I]=d[I])}),this.customWidth=!0}catch{}this.calculateColumnsVisibility()}async loadAllObjects(e){var i;const t=this.props;try{await new Promise(l=>{this.setState({updating:!0},()=>l())});const r=(this.props.objectsWorker?await this.props.objectsWorker.getObjects(e):await t.socket.getObjects(e,!0))||{};if(t.types&&ze.isWeb())for(let l=0;l<t.types.length;l++){if(t.types[l]==="state"||t.types[l]==="channel"||t.types[l]==="device"||t.types[l]==="enum")continue;const N=await t.socket.getObjectViewSystem(t.types[l]);Object.assign(r||{},N)}if(this.systemConfig=this.systemConfig||(r==null?void 0:r["system.config"])||await t.socket.getObject("system.config"),this.systemConfig.common=this.systemConfig.common||{},this.systemConfig.common.defaultNewAcl=this.systemConfig.common.defaultNewAcl||{object:0,state:0,file:0,owner:"system.user.admin",ownerGroup:"system.group.administrator"},this.systemConfig.common.defaultNewAcl.owner=this.systemConfig.common.defaultNewAcl.owner||"system.user.admin",this.systemConfig.common.defaultNewAcl.ownerGroup=this.systemConfig.common.defaultNewAcl.ownerGroup||"system.group.administrator",typeof this.systemConfig.common.defaultNewAcl.state!="number"&&(this.systemConfig.common.defaultNewAcl.state=1636),typeof this.systemConfig.common.defaultNewAcl.object!="number"&&(this.systemConfig.common.defaultNewAcl.state=1636),typeof t.filterFunc=="function"){this.objects={};const l=t.filterFunc;Object.keys(r).forEach(N=>{try{if(l(r[N]))this.objects[N]=r[N];else{const u=r[N]&&r[N].type;u&&(u==="channel"||u==="device"||u==="folder"||u==="adapter"||u==="instance")&&(this.objects[N]=r[N])}}catch(u){console.log(`Error by filtering of "${N}": ${u}`)}})}else if(t.types){this.objects={};const l=t.types;Object.keys(r).forEach(N=>{var L;const u=(L=r[N])==null?void 0:L.type;u&&(u==="channel"||u==="device"||u==="enum"||u==="folder"||u==="adapter"||u==="instance"||l.includes(u))&&(this.objects[N]=r[N])})}else this.objects=r;t.setObjectsReference&&t.setObjectsReference(this.objects),this.defaultHistory=this.systemConfig.common.defaultHistory,this.defaultHistory&&t.socket.getState(`system.adapter.${this.defaultHistory}.alive`).then(l=>{l!=null&&l.val||(this.defaultHistory="")}).catch(l=>window.alert(`Cannot get state: ${l}`));const o=await this.getAdditionalColumns();this.calculateColumnsVisibility(null,null,o);const{info:n,root:a}=Wl(this.objects,{imagePrefix:this.props.imagePrefix,root:this.props.root,lang:this.props.lang,themeType:this.props.themeType});this.root=a,this.info=n;const c=((i=this.state.selected)==null?void 0:i.length)&&U4(this.root,this.state.selected[0]);this.lastAppliedFilter=null,c&&!Hn(c,this.state.filter,this.props.lang,this.objects,void 0,void 0,t.customFilter,t.types)?this.setState({filter:{...hr},columnsForAdmin:o},()=>{this.setState({loaded:!0,updating:!1},()=>this.expandAllSelected(()=>this.onAfterSelect()))}):this.setState({loaded:!0,updating:!1,columnsForAdmin:o},()=>this.expandAllSelected(()=>this.onAfterSelect()))}catch(r){this.showError(r)}}static isNonExpertId(e){return!!it.#e.find(t=>e.startsWith(t))}expandAllSelected(e){const t=[...this.state.expanded];let i=!1;this.state.selected.forEach(r=>{const o=r.split("."),n=[];for(let a=0;a<o.length-1;a++)n.push(o[a]),t.includes(n.join("."))||(t.push(n.join(".")),i=!0)}),i?(t.sort(),this.localStorage.setItem(`${this.props.dialogName||"App"}.objectExpanded`,JSON.stringify(t)),this.setState({expanded:t},e)):e&&e()}onAfterSelect(e){var t,i,r,o,n;if((t=this.state.selected)!=null&&t.length&&this.state.selected[0]){this.localStorage.setItem(`${this.props.dialogName||"App"}.objectSelected`,this.state.selected[0]),this.selectFirst&&this.selectFirst!==this.state.selected[0]&&(this.selectFirst="");const a=this.findItem(this.state.selected[0]);if(a!=null&&a.data&&!a.data.visible&&!a.data.hasVisibleChildren&&this.clearFilter(),this.state.selected.length===1&&this.objects[this.state.selected[0]]){const c=O.getObjectName(this.objects,this.state.selected[0],null,{language:this.props.lang});(r=(i=this.props).onSelect)==null||r.call(i,this.state.selected,c,e)}else this.state.selected.length===1&&this.props.allowNonObjects&&((n=(o=this.props).onSelect)==null||n.call(o,this.state.selected,null,e))}else this.localStorage.removeItem(`${this.props.dialogName||"App"}.objectSelected`),this.state.selected.length?this.setState({selected:[]},()=>{this.props.onSelect&&(this.state.focused&&this.props.allowNonObjects?(this.selectFirst&&this.selectFirst!==this.state.selected[0]&&(this.selectFirst=""),this.props.onSelect([this.state.focused],null,e)):this.props.onSelect([],""))}):this.props.onSelect&&(this.state.focused&&this.props.allowNonObjects?(this.selectFirst&&this.selectFirst!==this.state.selected[0]&&(this.selectFirst=""),this.props.onSelect([this.state.focused],null,e)):this.props.onSelect([],""))}static getDerivedStateFromProps(e,t){const i={};let r=!1;return e.expertMode!==void 0&&e.expertMode!==t.filter.expertMode&&(r=!0,i.filter={...t.filter},i.filter.expertMode=e.expertMode),r?i:null}async componentDidMount(){await this.loadAllObjects(!Jl),this.props.objectsWorker?this.props.objectsWorker.registerHandler(this.onObjectChangeFromWorker):await this.props.socket.subscribeObject("*",this.onObjectChange),Jl=!0,window.addEventListener("contextmenu",this.onContextMenu,!0),window.addEventListener("keydown",this.onKeyPress,!0),window.addEventListener("keyup",this.onKeyPress,!0)}onKeyPress=e=>{e.type==="keydown"&&e.ctrlKey&&!this.cltrPressed?(this.cltrPressed=!0,this.tableRef.current&&(this.tableRef.current.className="highlight-link")):e.type==="keyup"&&!e.ctrlKey&&this.cltrPressed&&(this.cltrPressed=!1,this.tableRef.current&&(this.tableRef.current.className=""))};componentWillUnmount(){this.filterTimer&&(clearTimeout(this.filterTimer),this.filterTimer=null),window.removeEventListener("contextmenu",this.onContextMenu,!0),window.removeEventListener("keydown",this.onKeyPress,!0),window.removeEventListener("keyup",this.onKeyPress,!0),this.props.objectsWorker?this.props.objectsWorker.unregisterHandler(this.onObjectChangeFromWorker,!0):this.props.socket.unsubscribeObject("*",this.onObjectChange).catch(e=>console.error(`Cannot unsubscribe *: ${e}`)),this.subscribes.forEach(e=>{this.props.socket.unsubscribeState(e,this.onStateChange)}),this.subscribes=[],this.objects={}}showDeleteDialog(e){var c,l,N,u;const{id:t,obj:i,item:r}=e,o=Object.keys(this.objects);o.sort();let n=0;const a=`${t}.`;for(let L=0;L<o.length;L++)if(o[L].startsWith(a))n++;else if(o[L]>a)break;(u=(N=this.props).onObjectDelete)==null||u.call(N,t,!!((c=r.children)!=null&&c.length),!((l=i.common)!=null&&l.dontDelete),n+1)}onContextMenu=e=>{this.contextMenu&&Date.now()-this.contextMenu.ts<2e3?(e.preventDefault(),this.setState({showContextMenu:{item:this.contextMenu.item,position:{left:e.clientX+2,top:e.clientY-6}}})):this.state.showContextMenu&&(e.preventDefault(),this.setState({showContextMenu:null})),this.contextMenu=null};refreshComponent(){this.subscribes.forEach(e=>{this.props.socket.unsubscribeState(e,this.onStateChange)}),this.subscribes=[],this.loadAllObjects(!0).then(()=>console.log("updated!")).catch(e=>this.showError(e))}renderErrorDialog(){return this.state.error?M.createElement(j.Dialog,{open:!0,maxWidth:"sm",fullWidth:!0,onClose:()=>this.setState({error:""}),"aria-labelledby":"error-dialog-title","aria-describedby":"error-dialog-description"},M.createElement(j.DialogTitle,{id:"alert-dialog-title"},this.props.t("ra_Error")),M.createElement(j.DialogContent,null,M.createElement(j.DialogContentText,{id:"alert-dialog-description"},this.state.error)),M.createElement(j.DialogActions,null,M.createElement(j.Button,{variant:"contained",onClick:()=>this.setState({error:""}),color:"primary",autoFocus:!0,startIcon:M.createElement(Oe,null)},this.props.t("ra_Ok")))):null}showError(e){this.setState({error:typeof e=="object"?e&&typeof e.toString=="function"?e.toString():JSON.stringify(e):e})}onSelect(e,t,i){if(this.localStorage.setItem(`${this.props.dialogName||"App"}.focused`,e),!this.props.multiSelect)this.objects[e]&&(!this.props.types||this.props.types.includes(this.objects[e].type))?(this.localStorage.removeItem(`${this.props.dialogName||"App"}.selectedNonObject`),this.state.selected[0]!==e?this.setState({selected:[e],selectedNonObject:"",focused:e},()=>{this.onAfterSelect(t),i&&i()}):t&&this.props.onSelect&&this.onAfterSelect(t)):(this.localStorage.setItem(`${this.props.dialogName||"App"}.selectedNonObject`,e),this.setState({selected:[],selectedNonObject:e,focused:e},()=>{this.onAfterSelect(),i&&i()}));else if(this.objects[e]&&(!this.props.types||this.props.types.includes(this.objects[e].type))){this.localStorage.removeItem(`${this.props.dialogName||"App"}.selectedNonObject`);const r=[...this.state.selected],o=r.indexOf(e);o===-1?(r.push(e),r.sort()):t||r.splice(o,1),this.setState({selected:r,selectedNonObject:"",focused:e},()=>{this.onAfterSelect(t),i&&i()})}}_renderDefinedList(e){const t=[...this.possibleCols];if(t.unshift("id"),this.props.columns&&!this.props.columns.includes("buttons")){const i=t.indexOf("buttons");i!==-1&&t.splice(i,1)}return t.filter(i=>e&&(i==="val"||i==="buttons")||!e&&i!=="val"&&i!=="buttons").map(i=>{var r;return M.createElement(j.ListItemButton,{onClick:()=>{if(!this.state.columnsAuto&&i!=="id"){const o=[...this.state.columns||[]],n=o.indexOf(i);n===-1?(o.push(i),o.sort()):o.splice(n,1),this.localStorage.setItem(`${this.props.dialogName||"App"}.columns`,JSON.stringify(o)),this.calculateColumnsVisibility(null,o),this.setState({columns:o})}},key:i},M.createElement(j.Checkbox,{edge:"start",disabled:i==="id"||this.state.columnsAuto,checked:i==="id"||!!(this.state.columnsAuto?this.visibleCols.includes(i):(r=this.state.columns)!=null&&r.includes(i)),disableRipple:!0}),M.createElement(j.ListItemText,{primary:this.texts[`filter_${i}`]||this.props.t(`ra_${i}`)}))})}renderColumnsSelectorDialog(){return this.state.columnsSelectorShow?M.createElement(j.Dialog,{onClose:()=>this.setState({columnsSelectorShow:!1}),open:!0,sx:{"& .MuiPaper-root":O.getStyle(this.props.theme,w.dialogColumns,w[`transparent_${this.state.columnsDialogTransparent}`])}},M.createElement(j.DialogTitle,{sx:w.fontSizeTitle},this.props.t("ra_Configure")),M.createElement(j.DialogContent,{sx:w.fontSizeTitle},M.createElement(j.FormControlLabel,{style:w.switchColumnAuto,control:M.createElement(j.Switch,{checked:this.state.foldersFirst,onChange:()=>{this.localStorage.setItem(`${this.props.dialogName||"App"}.foldersFirst`,this.state.foldersFirst?"false":"true"),this.setState({foldersFirst:!this.state.foldersFirst})}}),label:this.props.t("ra_Folders always first")}),M.createElement(j.FormControlLabel,{style:w.switchColumnAuto,control:M.createElement(j.Switch,{checked:this.state.linesEnabled,onChange:()=>{this.localStorage.setItem(`${this.props.dialogName||"App"}.lines`,this.state.linesEnabled?"false":"true"),this.setState({linesEnabled:!this.state.linesEnabled})}}),label:this.props.t("ra_Show lines between rows")}),M.createElement(j.FormControlLabel,{style:w.switchColumnAuto,control:M.createElement(j.Switch,{checked:this.state.columnsAuto,onChange:()=>{this.localStorage.setItem(`${this.props.dialogName||"App"}.columnsAuto`,this.state.columnsAuto?"false":"true"),this.state.columnsAuto?this.state.columns?(this.calculateColumnsVisibility(!1),this.setState({columnsAuto:!1})):(this.calculateColumnsVisibility(!1,[...this.visibleCols]),this.setState({columnsAuto:!1,columns:[...this.visibleCols]})):(this.calculateColumnsVisibility(!0),this.setState({columnsAuto:!0}))}}),label:this.props.t("ra_Auto (no custom columns)")}),M.createElement(j.List,null,this._renderDefinedList(!1),this.state.columnsForAdmin&&Object.keys(this.state.columnsForAdmin).sort().map(e=>{var t;return(t=this.state.columnsForAdmin)==null?void 0:t[e].map(i=>{var r;return M.createElement(j.ListItemButton,{onClick:()=>{if(!this.state.columnsAuto){const o=[...this.state.columns||[]],n=`_${e}_${i.path}`,a=o.indexOf(n);a===-1?(o.push(n),o.sort()):o.splice(a,1),this.calculateColumnsVisibility(null,o),this.localStorage.setItem(`${this.props.dialogName||"App"}.columns`,JSON.stringify(o)),this.setState({columns:o})}},key:`${e}_${i.name}`},M.createElement(j.ListItemIcon,null,M.createElement(j.Checkbox,{disabled:this.state.columnsAuto,edge:"start",checked:!this.state.columnsAuto&&((r=this.state.columns)==null?void 0:r.includes(`_${e}_${i.path}`)),disableRipple:!0})),M.createElement(j.ListItemText,{primary:`${i.name} (${e})`}))})}),this._renderDefinedList(!0))),M.createElement(j.DialogActions,null,M.createElement(j.Button,{variant:"contained",onClick:()=>this.setState({columnsSelectorShow:!1}),color:"primary",startIcon:M.createElement(Ne,null)},this.texts.close))):null}async getAdditionalColumns(){try{const e=await this.props.socket.getAdapters();let t=null;return e.forEach(i=>t=this.parseObjectForAdmins(t,i)),t}catch(e){return console.error(`Cannot get adapters: ${e}`),null}}checkUnsubscribes(){for(let e=this.subscribes.length-1;e>=0;e--)this.recordStates.includes(this.subscribes[e])||this.unsubscribe(this.subscribes[e]);this.recordStates=[]}findItem(e,t,i,r){if(t||=e.split("."),i||=this.root,!i||!t.length)return null;if(r=(r?`${r}.`:"")+t.shift(),i.children){const o=i.children.find(n=>n.data.id===r);if(o){if(o.data.id===e)return o;if(t.length)return this.findItem(e,t,o,r)}else return null}return null}onStateChange=(e,t)=>{if(this.states[e]){const i=this.findItem(e);i!=null&&i.data.state&&(i.data.state=void 0)}t?this.states[e]=t:delete this.states[e],this.pausedSubscribes?this.statesUpdateTimer&&(clearTimeout(this.statesUpdateTimer),this.statesUpdateTimer=null):this.statesUpdateTimer||(this.statesUpdateTimer=setTimeout(()=>{this.statesUpdateTimer=null,this.forceUpdate()},300))};parseObjectForAdmins(e,t){var i;if((i=t.common)!=null&&i.adminColumns&&t.common.name){const r=t.common.adminColumns;let o;r&&typeof r!="object"?o=[r]:r&&(o=r);let n;r?n=o.map(a=>{if(typeof a!="object")return{path:a,name:a.split(".").pop()};const c=a;return c.objTypes&&typeof c.objTypes!="object"?c.objTypes=[c.objTypes]:c.objTypes||(c.objTypes=void 0),!c.name&&c.path?{path:c.path,name:c.path.split(".").pop(),width:c.width,edit:!!c.edit,type:c.type,objTypes:c.objTypes}:c.path?{path:c.path,name:Ye(c.name||"",this.props.lang),width:c.width,edit:!!c.edit,type:c.type,objTypes:c.objTypes}:(console.warn(`Admin columns for ${t._id} ignored, because path not found`),null)}).filter(a=>a):n=null,n!=null&&n.length&&(e||={},e[t.common.name]=n.sort((a,c)=>a.path>c.path?-1:a.path<c.path?1:0))}else t.common&&t.common.name&&e&&e[t.common.name]&&delete e[t.common.name];return e}onObjectChangeFromWorker=e=>{if(Array.isArray(e)){let t=null;e.forEach(i=>{const{newInnerState:r,filtered:o}=this.processOnObjectChangeElement(i.id,i.obj);o||(r&&t?Object.assign(t,r):t=r)}),t&&this.setState(t),this.afterObjectUpdated()}};onObjectChange=(e,t)=>{const{newInnerState:i,filtered:r}=this.processOnObjectChangeElement(e,t);r||(i&&this.setState(i),this.afterObjectUpdated())};afterObjectUpdated(){!this.objectsUpdateTimer&&this.objects&&(this.objectsUpdateTimer=setTimeout(()=>{this.objectsUpdateTimer=null;const{info:e,root:t}=Wl(this.objects,{imagePrefix:this.props.imagePrefix,root:this.props.root,lang:this.props.lang,themeType:this.props.themeType});this.root=t,this.info=e,this.lastAppliedFilter=null,this.pausedSubscribes||this.forceUpdate()},500))}updateAliases(e){var i,r,o;if(!this.objects||!((i=this.info)!=null&&i.aliasesMap)||!(e!=null&&e.startsWith("alias.")))return;const t=Object.keys(this.objects).filter(n=>n.startsWith("alias.0"));this.info.aliasesMap={};for(const n of t){const a=this.objects[n];if((o=(r=a==null?void 0:a.common)==null?void 0:r.alias)!=null&&o.id)if(typeof a.common.alias.id=="string"){const c=a.common.alias.id;this.info.aliasesMap[c]?this.info.aliasesMap[c].includes(n)||this.info.aliasesMap[c].push(n):this.info.aliasesMap[c]=[n]}else{const c=a.common.alias.id.read;c&&(this.info.aliasesMap[c]?this.info.aliasesMap[c].includes(n)||this.info.aliasesMap[c].push(n):this.info.aliasesMap[c]=[n]);const l=a.common.alias.id.write;l&&(this.info.aliasesMap[l]?this.info.aliasesMap[l].includes(n)||this.info.aliasesMap[l].push(n):this.info.aliasesMap[l]=[n])}}}processOnObjectChangeElement(e,t){const i=t==null?void 0:t.type;if(t&&typeof this.props.filterFunc=="function"&&!this.props.filterFunc(t)&&i!=="channel"&&i!=="device"&&i!=="folder"&&i!=="adapter"&&i!=="instance")return{newInnerState:null,filtered:!0};let r=null;if(e.startsWith("system.adapter.")&&(t==null?void 0:t.type)==="adapter"){const o=JSON.parse(JSON.stringify(this.state.columnsForAdmin));this.parseObjectForAdmins(o,t),JSON.stringify(this.state.columnsForAdmin)!==JSON.stringify(o)&&(r={columnsForAdmin:o})}return this.objects||={},t?this.objects[e]=t:this.objects[e]&&delete this.objects[e],this.updateAliases(e),{newInnerState:r,filtered:!1}}subscribe(e){this.subscribes.includes(e)||(this.subscribes.push(e),this.pausedSubscribes||this.props.socket.subscribeState(e,this.onStateChange).catch(t=>console.error(`Cannot subscribe on state ${e}: ${t}`)))}unsubscribe(e){const t=this.subscribes.indexOf(e);t!==-1&&(this.subscribes.splice(t,1),this.states[e]&&delete this.states[e],this.props.socket.unsubscribeState(e,this.onStateChange),this.pausedSubscribes&&console.warn("Unsubscribe during pause?"))}pauseSubscribe(e){!this.pausedSubscribes&&e?(this.pausedSubscribes=!0,this.subscribes.forEach(t=>this.props.socket.unsubscribeState(t,this.onStateChange))):this.pausedSubscribes&&!e&&(this.pausedSubscribes=!1,this.subscribes.forEach(t=>this.props.socket.subscribeState(t,this.onStateChange)))}onFilter(e,t){this.filterTimer=null;const i={...this.state.filter};Object.keys(this.filterRefs).forEach(r=>{var o;if((o=this.filterRefs[r])!=null&&o.current){const n=this.filterRefs[r].current;for(let a=0;a<n.children.length;a++)if(n.children[a].tagName==="INPUT"){i[r]=n.children[a].value;break}}}),e&&(i[e]=t,e==="expertMode"&&(window._sessionStorage||window.sessionStorage).setItem("App.expertMode",t?"true":"false")),JSON.stringify(this.state.filter)!==JSON.stringify(i)&&(this.localStorage.setItem(`${this.props.dialogName||"App"}.objectFilter`,JSON.stringify(i)),this.setState({filter:i},()=>this.props.onFilterChanged&&this.props.onFilterChanged(i)))}clearFilter(){const e={...this.state.filter};Object.keys(this.filterRefs).forEach(t=>{var i;if((i=this.filterRefs[t])!=null&&i.current){const r=this.filterRefs[t].current;for(let o=0;o<r.childNodes.length;o++){const n=r.childNodes[o];if(n.tagName==="INPUT"){e[t]="",n.value="";break}}}}),JSON.stringify(this.state.filter)!==JSON.stringify(e)&&(this.localStorage.setItem(`${this.props.dialogName||"App"}.objectFilter`,JSON.stringify(e)),this.setState({filter:e,filterKey:this.state.filterKey+1},()=>{var t,i;return(i=(t=this.props).onFilterChanged)==null?void 0:i.call(t,e)}))}isFilterEmpty(){return!Object.keys(this.state.filter).find(t=>t!=="expertMode"&&this.state.filter[t])}getFilterInput(e){var t,i,r;return M.createElement(j.FormControl,{sx:this.styles.filterInput,key:`${e}_${this.state.filterKey}`,title:e==="name"||e==="id"?this.props.t("ra_You can use * as wildcard"):void 0,margin:"dense"},M.createElement(j.Input,{ref:this.filterRefs[e],classes:{underline:"no-underline"},id:e,placeholder:this.texts[`filter_${e}`],defaultValue:this.state.filter[e]||"",onChange:()=>{this.filterTimer&&clearTimeout(this.filterTimer),this.filterTimer=setTimeout(()=>this.onFilter(),400)},autoComplete:"off"}),(r=(i=(t=this.filterRefs[e])==null?void 0:t.current)==null?void 0:i.firstChild)!=null&&r.value?M.createElement("div",{style:{position:"absolute",right:0}},M.createElement(j.IconButton,{size:"small",onClick:()=>{var o;((o=this.filterRefs[e].current)==null?void 0:o.firstChild).value="",this.onFilter(e,"")}},M.createElement(Ne,null))):null)}getFilterSelect(e,t){var r,o,n;const i=!!(t!=null&&t.find(a=>a.icon));return M.createElement("div",{style:{position:"relative"}},M.createElement(j.Select,{variant:"standard",key:`${e}_${this.state.filterKey}`,ref:this.filterRefs[e],sx:w.headerCellInput,className:"no-underline",onChange:()=>{this.filterTimer&&clearTimeout(this.filterTimer),this.filterTimer=setTimeout(()=>this.onFilter(),400)},defaultValue:this.state.filter[e]||"",inputProps:{name:e,id:e},displayEmpty:!0},M.createElement(j.MenuItem,{key:"empty",value:""},M.createElement("span",{style:w.selectNone},e==="custom"?this.texts.showAll:this.texts[`filter_${e}`])),t==null?void 0:t.map(a=>{let c,l,N;return typeof a=="object"?(c=a.value,l=a.name,N=a.icon):(c=a,l=a),M.createElement(j.MenuItem,{sx:w.headerCellSelectItem,key:c,value:c},N||(i?M.createElement("div",{className:"itemIcon"}):null),l)})),(n=(o=(r=this.filterRefs[e])==null?void 0:r.current)==null?void 0:o.childNodes[1])!=null&&n.value?M.createElement(j.Box,{component:"div",sx:w.selectClearButton},M.createElement(j.IconButton,{size:"small",onClick:()=>{var c;const a={...this.state.filter};a[e]="",((c=this.filterRefs[e].current)==null?void 0:c.childNodes[1]).value="",this.localStorage.setItem(`${this.props.dialogName||"App"}.objectFilter`,JSON.stringify(a)),this.setState({filter:a,filterKey:this.state.filterKey+1},()=>this.props.onFilterChanged&&this.props.onFilterChanged(a))}},M.createElement(Ne,null))):null)}getFilterSelectRole(){return this.getFilterSelect("role",this.info.roles.map(e=>e.role))}getFilterSelectRoom(){const e=this.info.roomEnums.map(t=>{var i,r,o,n;return{name:Ye((r=(i=this.objects[t])==null?void 0:i.common)==null?void 0:r.name,this.props.lang)||t.split(".").pop(),value:t,icon:M.createElement(me,{src:((n=(o=this.objects[t])==null?void 0:o.common)==null?void 0:n.icon)||"",style:w.selectIcon})}});return this.getFilterSelect("room",e)}getFilterSelectFunction(){const e=this.info.funcEnums.map(t=>{var i,r,o,n;return{name:Ye((r=(i=this.objects[t])==null?void 0:i.common)==null?void 0:r.name,this.props.lang)||t.split(".").pop(),value:t,icon:M.createElement(me,{src:((n=(o=this.objects[t])==null?void 0:o.common)==null?void 0:n.icon)||"",style:w.selectIcon})}});return this.getFilterSelect("func",e)}getFilterSelectType(){const e=this.info.types.map(t=>({name:t,value:t,icon:Bl[t]||null}));return this.getFilterSelect("type",e)}getFilterSelectCustoms(){if(this.info.customs.length>1){const e=this.info.customs.map(t=>({name:t==="_"?this.texts.filterCustomsWithout:t,value:t,icon:t==="_"?null:M.createElement(me,{src:Zr(this.objects,t,this.props.lang,this.imagePrefix)||"",style:w.selectIcon})}));return this.getFilterSelect("custom",e)}return null}onExpandAll(e,t){var r;const i=e||this.root;t||=[],(r=i==null?void 0:i.children)==null||r.forEach(o=>{o.data.sumVisibility&&(t.push(o.data.id),this.onExpandAll(o,t))}),i===this.root&&(t.sort(),this.localStorage.setItem(`${this.props.dialogName||"App"}.objectExpanded`,JSON.stringify(t)),this.setState({expanded:t}))}onCollapseAll(){this.localStorage.setItem(`${this.props.dialogName||"App"}.objectExpanded`,JSON.stringify([])),this.localStorage.setItem(`${this.props.dialogName||"App"}.objectSelected`,"[]"),this.setState({expanded:[],depth:0,selected:[]},()=>this.onAfterSelect())}expandDepth(e,t,i){var r;e||=this.root,t>0&&((r=e.children)==null||r.forEach(o=>{o.data.sumVisibility&&(vi(i,o.data.id)||(i.push(o.data.id),i.sort()),t-1>0&&this.expandDepth(o,t-1,i))}))}static collapseDepth(e,t){return t.filter(i=>i.split(".").length<=e)}onExpandVisible(){if(this.state.depth<9){const e=this.state.depth+1,t=[...this.state.expanded];this.root&&this.expandDepth(this.root,e,t),this.localStorage.setItem(`${this.props.dialogName||"App"}.objectExpanded`,JSON.stringify(t)),this.setState({depth:e,expanded:t})}}onStatesViewVisible(){const e=!this.state.statesView;this.localStorage.setItem(`${this.props.dialogName||"App"}.objectStatesView`,JSON.stringify(e)),this.setState({statesView:e})}onCollapseVisible(){if(this.state.depth>0){const e=this.state.depth-1,t=it.collapseDepth(e,this.state.expanded);this.localStorage.setItem(`${this.props.dialogName||"App"}.objectExpanded`,JSON.stringify(t)),this.setState({depth:e,expanded:t})}}getEnumsForId=e=>{const t=[];return this.info.enums.forEach(i=>{var r,o,n;if((n=(o=(r=this.objects[i])==null?void 0:r.common)==null?void 0:o.members)!=null&&n.includes(e)){const a={_id:this.objects[i]._id,common:JSON.parse(JSON.stringify(this.objects[i].common)),native:this.objects[i].native,type:"enum"};a.common&&(delete a.common.members,delete a.common.custom,delete a.common.mobile),t.push(a)}}),t.length?t:void 0};_createAllEnums=async(e,t)=>{var i,r;for(let o=0;o<e.length;o++){const n=e[o];let a,c;typeof n=="object"?(c=n,a=c._id):a=n;let l=this.objects[a];l?(r=(i=l.common)==null?void 0:i.members)!=null&&r.includes(t)||(l.common||={},l.type="enum",l.common.members||=[],l.common.members.push(t),l.common.members.sort(),await this.props.socket.setObject(a,l)):(l=c||{_id:a,common:{name:a.split(".").pop(),members:[]},native:{},type:"enum"},l.common||={},l.common.members=[t],l.type="enum",await this.props.socket.setObject(a,l))}};async loadObjects(e){var t;if(e)for(const i in e){if(!Object.prototype.hasOwnProperty.call(e,i)||!e[i])continue;const r=e[i];let o=null,n,a;(t=r==null?void 0:r.common)!=null&&t.enums?(o=r.common.enums,delete r.common.enums):o=null,(r.val||r.val===0)&&(n=r.val,delete r.val),r.ack!==void 0&&(a=r.ack,delete r.ack);try{if(await this.props.socket.setObject(i,r),o&&await this._createAllEnums(o,r._id),r.type==="state")if(n!=null)try{await this.props.socket.setState(r._id,n,a!==void 0?a:!0)}catch(c){window.alert(`Cannot set state "${r._id} with ${n}": ${c}`)}else try{const c=await this.props.socket.getState(r._id);if(!c||c.val===null)try{await this.props.socket.setState(r._id,!r.common||r.common.def===void 0?null:r.common.def,!0)}catch(l){window.alert(`Cannot set state "${r._id}": ${l}`)}}catch(c){window.alert(`Cannot read state "${r._id}": ${c}`)}}catch(c){window.alert(c)}}}_getSelectedIdsForExport(){if(this.state.selected.length||this.state.selectedNonObject){const e=[],t=Object.keys(this.objects);t.sort();const i=this.state.selected[0]||this.state.selectedNonObject,r=`${i}.`,o=r.length;for(let n=0;n<t.length;n++){const a=t[n];if((i===a||a.startsWith(r))&&e.push(a),a.substring(0,o)>r)break}return e}return[]}async _exportObjects(e){var o;if(e.isAll){$l("allObjects.json",this.objects,e);return}if(!(this.state.selected.length||this.state.selectedNonObject)){window.alert(this.props.t("ra_Save of objects-tree is not possible"));return}const t={},i=this.state.selected[0]||this.state.selectedNonObject,r=this._getSelectedIdsForExport();for(const n of r){if(t[n]=JSON.parse(JSON.stringify(this.objects[n])),((o=t[n])==null?void 0:o.type)==="state"&&!e.noStatesByExportImport){const a=await this.props.socket.getState(n);a&&(t[n].val=a.val,t[n].ack=a.ack)}if(t[n].common){const a=this.getEnumsForId(n);a&&(t[n].common.enums=a)}}$l(`${i}.json`,t,e)}renderExportDialog(){return this.state.showExportDialog===!1?null:M.createElement(j.Dialog,{open:!0,maxWidth:"lg"},M.createElement(j.DialogTitle,null,this.props.t("ra_Select type of export")),M.createElement(j.DialogContent,null,M.createElement(j.DialogContentText,null,this.state.filter.expertMode||this.state.showAllExportOptions?M.createElement(M.Fragment,null,this.props.t("ra_You can export all objects or just the selected branch."),M.createElement("br",null),this.props.t("ra_Selected %s object(s)",this.state.showExportDialog),M.createElement("br",null),M.createElement(j.FormControlLabel,{control:M.createElement(j.Checkbox,{checked:this.state.noStatesByExportImport,onChange:e=>this.setState({noStatesByExportImport:e.target.checked})}),label:this.props.t("ra_Do not export values of states")}),M.createElement("br",null),this.props.t("These options can reduce the size of the export file:"),M.createElement(j.FormControlLabel,{control:M.createElement(j.Checkbox,{checked:this.state.beautifyJsonExport,onChange:e=>this.setState({beautifyJsonExport:e.target.checked})}),label:this.props.t("Beautify JSON output")}),M.createElement("br",null),M.createElement(j.FormControlLabel,{control:M.createElement(j.Checkbox,{checked:this.state.excludeSystemRepositoriesFromExport,onChange:e=>this.setState({excludeSystemRepositoriesFromExport:e.target.checked})}),label:this.props.t("Exclude system repositories from export JSON")}),M.createElement(j.FormControlLabel,{control:M.createElement(j.Checkbox,{checked:this.state.excludeTranslations,onChange:e=>this.setState({excludeTranslations:e.target.checked})}),label:this.props.t("Exclude translations (except english) from export JSON")})):null)),M.createElement(j.DialogActions,null,this.state.filter.expertMode||this.state.showAllExportOptions?M.createElement(j.Button,{color:"grey",variant:"outlined",onClick:()=>this.setState({showExportDialog:!1,showAllExportOptions:!1},()=>this._exportObjects({isAll:!0,noStatesByExportImport:this.state.noStatesByExportImport,beautify:this.state.beautifyJsonExport,excludeSystemRepositories:this.state.excludeSystemRepositoriesFromExport,excludeTranslations:this.state.excludeTranslations}))},M.createElement("span",{style:{marginRight:8}},this.props.t("ra_All objects")),"(",Object.keys(this.objects).length,")"):M.createElement(j.Button,{color:"grey",variant:"outlined",startIcon:M.createElement(Pn,null),onClick:()=>this.setState({showAllExportOptions:!0})},this.props.t("ra_Advanced options")),M.createElement(j.Button,{color:"primary",variant:"contained",autoFocus:!0,onClick:()=>this.setState({showExportDialog:!1,showAllExportOptions:!1},()=>this._exportObjects({isAll:!1,noStatesByExportImport:this.state.noStatesByExportImport,beautify:this.state.beautifyJsonExport,excludeSystemRepositories:this.state.excludeSystemRepositoriesFromExport,excludeTranslations:this.state.excludeTranslations}))},M.createElement("span",{style:{marginRight:8}},this.props.t("ra_Only selected")),"(",this.state.showExportDialog,")"),M.createElement(j.Button,{color:"grey",variant:"contained",onClick:()=>this.setState({showExportDialog:!1,showAllExportOptions:!1}),startIcon:M.createElement(Ne,null)},this.props.t("ra_Cancel"))))}renderRenameDialog(){var t;if(!this.state.showRenameDialog)return null;const e=this.props.objectMoveRenameDialog;return M.createElement(e,{expertMode:this.props.expertMode,onClose:()=>this.setState({showRenameDialog:null}),id:this.state.showRenameDialog.id,childrenIds:this.state.showRenameDialog.childrenIds,theme:this.props.theme,socket:this.props.socket,t:this.props.t,objectType:(t=this.objects[this.state.showRenameDialog.id])==null?void 0:t.type})}handleJsonUpload(e){var r;const t=e.target,i=((r=t.files)==null?void 0:r.length)&&t.files[0];if(i){const o=new FileReader;o.onload=async n=>{var c;const a=(c=n.target)==null?void 0:c.result;try{const l=JSON.parse(a),N=Object.keys(l).length,u=l._id;if(u===void 0&&N)await this.loadObjects(l),window.alert(this.props.t("ra_%s object(s) processed",N));else{if(!u)return window.alert(this.props.t("ra_Invalid structure"));try{let L,g,y;if(l.common.enums&&(L=l.common.enums,delete l.common.enums),l.val&&(g=l.val,delete l.val),l.ack!==void 0&&(y=l.ack,delete l.ack),await this.props.socket.setObject(l._id,l),l.type==="state")if(g!=null)await this.props.socket.setState(l._id,g,y===void 0?!0:y);else{const T=await this.props.socket.getState(l._id);(!T||T.val===null||T.val===void 0)&&await this.props.socket.setState(l._id,l.common.def===void 0?null:l.common.def,!0)}L&&await this._createAllEnums(L,l._id),window.alert(this.props.t("ra_%s was imported",l._id))}catch(L){window.alert(L)}}}catch(l){window.alert(l)}return null},o.readAsText(i)}else window.alert(this.props.t("ra_Failed to open JSON File"))}toolTipObjectCreating=()=>{var i,r;const{t:e}=this.props;let t=[M.createElement("div",{key:1},e("ra_Only following structures of objects are available:")),M.createElement("div",{key:2},e("ra_Folder → State")),M.createElement("div",{key:3},e("ra_Folder → Channel → State")),M.createElement("div",{key:4},e("ra_Folder → Device → Channel → State")),M.createElement("div",{key:5},e("ra_Device → Channel → State")),M.createElement("div",{key:6},e("ra_Channel → State")),M.createElement("div",{key:7,style:{height:10}}),M.createElement("div",{key:8},e('ra_Non-experts may create new objects only in "0_userdata.0" or "alias.0".')),M.createElement("div",{key:9},e('ra_The experts may create objects everywhere but from second level (e.g. "vis.0" or "javascript.0").'))];if(this.state.selected.length||this.state.selectedNonObject){const o=this.state.selected[0]||this.state.selectedNonObject;if(!(o.split(".").length<2||this.objects[o]&&((i=this.objects[o])==null?void 0:i.type)==="state"))if(this.state.filter.expertMode)switch((r=this.objects[o])==null?void 0:r.type){case"device":t=[M.createElement("div",{key:1},e("ra_Only following structures of objects are available:")),M.createElement("div",{key:5},e("ra_Device → Channel → State")),M.createElement("div",{key:7,style:{height:10}}),M.createElement("div",{key:8},e('ra_Non-experts may create new objects only in "0_userdata.0" or "alias.0".')),M.createElement("div",{key:9},e('ra_The experts may create objects everywhere but from second level (e.g. "vis.0" or "javascript.0").'))];break;case"folder":t=[M.createElement("div",{key:1},e("ra_Only following structures of objects are available:")),M.createElement("div",{key:2},e("ra_Folder → State")),M.createElement("div",{key:3},e("ra_Folder → Channel → State")),M.createElement("div",{key:4},e("ra_Folder → Device → Channel → State")),M.createElement("div",{key:7,style:{height:10}}),M.createElement("div",{key:8},e('ra_Non-experts may create new objects only in "0_userdata.0" or "alias.0".')),M.createElement("div",{key:9},e('ra_The experts may create objects everywhere but from second level (e.g. "vis.0" or "javascript.0").'))];break;case"channel":t=[M.createElement("div",{key:1},e("ra_Only following structures of objects are available:")),M.createElement("div",{key:1},e("ra_Channel → State")),M.createElement("div",{key:7,style:{height:10}}),M.createElement("div",{key:8},e('ra_Non-experts may create new objects only in "0_userdata.0" or "alias.0".')),M.createElement("div",{key:9},e('ra_The experts may create objects everywhere but from second level (e.g. "vis.0" or "javascript.0").'))];break}else(o.startsWith("alias.0")||o.startsWith("0_userdata"))&&(t=[M.createElement("div",{key:1},e("ra_Only following structures of objects are available:")),M.createElement("div",{key:2},e("ra_Folder → State")),M.createElement("div",{key:3},e("ra_Folder → Channel → State")),M.createElement("div",{key:4},e("ra_Folder → Device → Channel → State")),M.createElement("div",{key:5},e("ra_Device → Channel → State")),M.createElement("div",{key:6},e("ra_Channel → State")),M.createElement("div",{key:7,style:{height:10}}),M.createElement("div",{key:7},e('ra_Non-experts may create new objects only in "0_userdata.0" or "alias.0".')),M.createElement("div",{key:8},e('ra_The experts may create objects everywhere but from second level (e.g. "vis.0" or "javascript.0").'))])}return t.length?t:e("ra_Add new child object to selected parent")};getToolbar(){let e=!1;if(this.state.selected.length||this.state.selectedNonObject){const t=this.state.selected[0]||this.state.selectedNonObject;t.split(".").length<2||this.objects[t]&&this.objects[t].type==="state"?e=!1:(this.state.filter.expertMode||t.startsWith("alias.0")||t.startsWith("0_userdata"))&&(e=!0)}return M.createElement("div",{style:{display:"flex",width:"100%",alignItems:"center",overflowX:"auto"}},M.createElement("div",{style:{display:"flex",width:"100%",alignItems:"center"}},M.createElement(j.Tooltip,{title:this.props.t("ra_Refresh tree"),slotProps:{popper:{sx:w.tooltip}}},M.createElement("div",null,M.createElement(j.IconButton,{onClick:()=>this.refreshComponent(),disabled:this.state.updating,size:"large"},M.createElement(DN,null)))),this.props.showExpertButton&&!this.props.expertMode&&M.createElement(j.Tooltip,{title:this.props.t("ra_expertMode"),slotProps:{popper:{sx:w.tooltip}}},M.createElement(j.IconButton,{key:"expertMode",color:this.state.filter.expertMode?"secondary":"default",onClick:()=>this.onFilter("expertMode",!this.state.filter.expertMode),size:"large"},M.createElement(Pn,null))),!this.props.disableColumnSelector&&this.props.width!=="xs"&&M.createElement(j.Tooltip,{title:this.props.t("ra_Configure"),slotProps:{popper:{sx:w.tooltip}}},M.createElement(j.IconButton,{key:"columnSelector",color:this.state.columnsAuto?"primary":"default",onClick:()=>this.setState({columnsSelectorShow:!0}),size:"large"},M.createElement(xg,null))),this.props.width!=="xs"&&this.state.expandAllVisible&&M.createElement(j.Tooltip,{title:this.props.t("ra_Expand all nodes"),slotProps:{popper:{sx:w.tooltip}}},M.createElement(j.IconButton,{key:"expandAll",onClick:()=>this.onExpandAll(),size:"large"},M.createElement(fr,null))),M.createElement(j.Tooltip,{title:this.props.t("ra_Collapse all nodes"),slotProps:{popper:{sx:w.tooltip}}},M.createElement(j.IconButton,{key:"collapseAll",onClick:()=>this.onCollapseAll(),size:"large"},M.createElement(Ws,null))),this.props.width!=="xs"&&M.createElement(j.Tooltip,{title:this.props.t("ra_Expand one step node"),slotProps:{popper:{sx:w.tooltip}}},M.createElement(j.IconButton,{key:"expandVisible",color:"primary",onClick:()=>this.onExpandVisible(),size:"large"},M.createElement(j.Badge,{badgeContent:this.state.depth,color:"secondary",sx:t=>({badge:{right:3,top:3,border:`2px solid ${t.palette.background.paper}`,padding:"0 4px"}})},M.createElement(fr,null)))),this.props.width!=="xs"&&M.createElement(j.Tooltip,{title:this.props.t("ra_Collapse one step node"),slotProps:{popper:{sx:w.tooltip}}},M.createElement(j.IconButton,{key:"collapseVisible",color:"primary",onClick:()=>this.onCollapseVisible(),size:"large"},M.createElement(j.Badge,{sx:t=>({badge:{right:3,top:3,border:`2px solid ${t.palette.background.paper}`,padding:"0 4px"}}),badgeContent:this.state.depth,color:"secondary"},M.createElement(Ws,null)))),this.props.objectStatesView&&M.createElement(j.Tooltip,{title:this.props.t("ra_Toggle the states view"),slotProps:{popper:{sx:w.tooltip}}},M.createElement(j.IconButton,{onClick:()=>this.onStatesViewVisible(),size:"large"},M.createElement(hg,{color:this.state.statesView?"primary":"inherit"}))),M.createElement(j.Tooltip,{title:this.props.t("ra_Show/Hide object descriptions"),slotProps:{popper:{sx:w.tooltip}}},M.createElement(j.IconButton,{onClick:()=>{this.localStorage.setItem(`${this.props.dialogName||"App"}.desc`,this.state.showDescription?"false":"true"),this.setState({showDescription:!this.state.showDescription})},size:"large"},M.createElement(Ag,{color:this.state.showDescription?"primary":"inherit"}))),this.props.objectAddBoolean?M.createElement(j.Tooltip,{title:this.toolTipObjectCreating(),slotProps:{popper:{sx:w.tooltip}}},M.createElement("div",null,M.createElement(j.IconButton,{disabled:!e,onClick:()=>this.setState({modalNewObj:{id:this.state.selected[0]||this.state.selectedNonObject}}),size:"large"},M.createElement(ln,null)))):null,this.props.objectImportExport&&M.createElement(j.Tooltip,{title:this.props.t("ra_Add objects tree from JSON file"),slotProps:{popper:{sx:w.tooltip}}},M.createElement(j.IconButton,{onClick:()=>{const t=document.createElement("input");t.setAttribute("type","file"),t.setAttribute("id","files"),t.setAttribute("opacity","0"),t.addEventListener("change",i=>this.handleJsonUpload(i),!1),t.click()},size:"large"},M.createElement(Sr,null))),this.props.objectImportExport&&(!!this.state.selected.length||this.state.selectedNonObject)&&M.createElement(j.Tooltip,{title:this.props.t("ra_Save objects tree as JSON file"),slotProps:{popper:{sx:w.tooltip}}},M.createElement(j.IconButton,{onClick:()=>this.setState({showExportDialog:this._getSelectedIdsForExport().length}),size:"large"},M.createElement(Sr,{style:{transform:"rotate(180deg)"}})))),!!this.props.objectBrowserEditObject&&this.props.width!=="xs"&&M.createElement("div",{style:{display:"flex",whiteSpace:"nowrap"}},`${this.props.t("ra_Objects")}: ${Object.keys(this.info.objects).length}, ${this.props.t("ra_States")}: ${Object.keys(this.info.objects).filter(t=>this.info.objects[t].type==="state").length}`),this.props.objectEditBoolean&&M.createElement(j.Tooltip,{title:this.props.t("ra_Edit custom config"),slotProps:{popper:{sx:w.tooltip}}},M.createElement(j.IconButton,{onClick:()=>{var i;const t=this.root?b4(this.root,"state",this.objects):[];t.length?(this.pauseSubscribe(!0),t.length===1&&(this.localStorage.setItem(`${this.props.dialogName||"App"}.objectSelected`,this.state.selected[0]),(i=this.props.router)==null||i.doNavigate(null,"custom",this.state.selected[0])),this.setState({customDialog:t,customDialogAll:!0})):this.setState({toast:this.props.t("ra_please select object")})},size:"large"},M.createElement(tg,null))))}toggleExpanded(e){const t=JSON.parse(JSON.stringify(this.state.expanded)),i=t.indexOf(e);i===-1?(t.push(e),t.sort()):t.splice(i,1),this.localStorage.setItem(`${this.props.dialogName||"App"}.objectExpanded`,JSON.stringify(t)),this.setState({expanded:t})}onCopy(e,t){e.stopPropagation(),e.preventDefault(),t&&(O.copyToClipboard(t),t.length<50?this.setState({toast:this.props.t("ra_Copied %s",t)}):this.setState({toast:this.props.t("ra_Copied")}))}renderTooltipAccessControl=e=>{if(!e)return null;const t=[{value:"0x400",valueNum:1024,title:"read",group:"Owner"},{value:"0x200",valueNum:512,title:"write",group:"Owner"},{value:"0x40",valueNum:64,title:"read",group:"Group"},{value:"0x20",valueNum:32,title:"write",group:"Group"},{value:"0x4",valueNum:4,title:"read",group:"Everyone"},{value:"0x2",valueNum:2,title:"write",group:"Everyone"}],i=[],r=o=>{const n=e[o];t.forEach((a,c)=>{n&a.valueNum&&i.push(M.createElement("span",{key:o+c},this.texts[`acl${a.group}_${a.title}_${o}`],",",M.createElement("span",{style:o==="object"?w.rightsObject:w.rightsState},a.value)))})};return i.push(M.createElement("span",{key:"group"},`${this.texts.ownerGroup}: ${(e.ownerGroup||"").replace("system.group.","")}`)),i.push(M.createElement("span",{key:"owner"},`${this.texts.ownerUser}: ${(e.owner||"").replace("system.user.","")}`)),r("object"),e.state&&r("state"),i.length?M.createElement("span",{style:w.tooltipAccessControl},i.map(o=>o)):null};renderColumnButtons(e,t){var n,a,c,l;if(!t.data.obj)return this.props.onObjectDelete||this.props.objectEditOfAccessControl?M.createElement("div",{style:w.buttonDiv},this.state.filter.expertMode&&this.props.objectEditOfAccessControl?M.createElement(j.IconButton,{sx:{...w.cellButtonsButton,...w.cellButtonsEmptyButton,...w.cellButtonMinWidth},onClick:()=>this.setState({modalEditOfAccess:!0,modalEditOfAccessObjData:t.data}),size:"large"},M.createElement("div",{style:{height:15}},"---")):null,this.props.onObjectDelete&&((n=t.children)!=null&&n.length)?M.createElement(j.IconButton,{sx:{...w.cellButtonsButton,...w.cellButtonsButtonAlone},size:"small","aria-label":"delete",title:this.texts.deleteObject,onClick:()=>{var g;const N=Object.keys(this.objects);N.sort();let u=0;const L=`${e}.`;for(let y=0;y<N.length;y++)if(N[y].startsWith(L))u++;else if(N[y]>L)break;this.props.onObjectDelete&&this.props.onObjectDelete(e,!!((g=t.children)!=null&&g.length),!1,u+1)}},M.createElement(nt,{style:w.cellButtonsButtonIcon})):null):null;t.data.aclTooltip=t.data.aclTooltip||this.renderTooltipAccessControl(t.data.obj.acl);const i=t.data.obj.acl?t.data.obj.type==="state"?t.data.obj.acl.state:t.data.obj.acl.object:0,r=t.data.obj.acl&&(t.data.obj.type==="state"?this.systemConfig.common.defaultNewAcl.state:this.systemConfig.common.defaultNewAcl.object),o=this.state.filter.expertMode||it.isNonExpertId(t.data.id);return[this.state.filter.expertMode&&this.props.objectEditOfAccessControl?M.createElement(j.Tooltip,{key:"acl",title:t.data.aclTooltip,slotProps:{popper:{sx:w.tooltip}}},M.createElement(j.IconButton,{sx:{...w.cellButtonsButton,...w.cellButtonMinWidth,opacity:1},onClick:()=>this.setState({modalEditOfAccess:!0,modalEditOfAccessObjData:t.data}),size:"large"},M.createElement("div",{style:w.aclText},Number.isNaN(Number(i))?Number(r).toString(16):Number(i).toString(16)))):M.createElement("div",{key:"aclEmpty",style:w.cellButtonMinWidth}),o?M.createElement(j.IconButton,{key:"edit",sx:{marginRight:"2px",...w.cellButtonsButton},size:"small","aria-label":"edit",title:this.texts.editObject,onClick:()=>{this.localStorage.setItem(`${this.props.dialogName||"App"}.objectSelected`,e),this.setState({editObjectDialog:e,editObjectAlias:!1})}},M.createElement(mi,{style:w.cellButtonsButtonIcon})):M.createElement(j.Box,{component:"div",key:"editDisabled",sx:w.cellButtonsButton}),this.props.onObjectDelete&&((a=t.children)!=null&&a.length||!((c=t.data.obj.common)!=null&&c.dontDelete))?M.createElement(j.IconButton,{key:"delete",sx:w.cellButtonsButton,size:"small","aria-label":"delete",onClick:()=>{var g,y,T;const N=Object.keys(this.objects);N.sort();let u=0;const L=`${e}.`;for(let d=0;d<N.length;d++)if(N[d].startsWith(L))u++;else if(N[d]>L)break;this.props.onObjectDelete&&this.props.onObjectDelete(e,!!((g=t.children)!=null&&g.length),!((T=(y=t.data.obj)==null?void 0:y.common)!=null&&T.dontDelete),u)},title:this.texts.deleteObject},M.createElement(nt,{style:w.cellButtonsButtonIcon})):null,this.props.objectCustomDialog&&this.info.hasSomeCustoms&&t.data.obj.type==="state"&&((l=t.data.obj.common)==null?void 0:l.type)!=="file"?M.createElement(j.IconButton,{sx:{...w.cellButtonsButton,...t.data.hasCustoms?this.styles.cellButtonsButtonWithCustoms:w.cellButtonsButtonWithoutCustoms},key:"custom",size:"small","aria-label":"config",title:this.texts.customConfig,onClick:()=>{var N;this.localStorage.setItem(`${this.props.dialogName||"App"}.objectSelected`,e),this.pauseSubscribe(!0),(N=this.props.router)==null||N.doNavigate(null,"customs",e),this.setState({customDialog:[e],customDialogAll:!1})}},M.createElement(Nn,{style:w.cellButtonsButtonIcon})):null]}readHistory(e){var t,i;if(window.sparkline&&this.defaultHistory&&((i=(t=this.objects[e])==null?void 0:t.common)!=null&&i.custom)&&this.objects[e].common.custom[this.defaultHistory]){const r=new Date;r.setHours(r.getHours()-24),r.setMinutes(0),r.setSeconds(0),r.setMilliseconds(0);const o=r.getTime();this.props.socket.getHistory(e,{instance:this.defaultHistory,start:o,end:Date.now(),step:36e5,from:!1,ack:!1,q:!1,addId:!1,aggregate:"minmax"}).then(n=>{const a=window.document.getElementsByClassName("sparkline");for(let c=0;c<a.length;c++)if(a[c].dataset.id===e){const l=jSe(n,o);window.sparkline.sparkline(a[c],l);break}}).catch(n=>console.warn(`Cannot read history: ${n}`))}}getTooltipInfo(e,t){var l,N,u;const i=this.objects[e],r=this.states[e],{valFull:o,fileViewer:n}=en({state:r,obj:i,texts:this.texts,dateFormat:this.props.dateFormat||this.systemConfig.common.dateFormat,isFloatComma:this.props.isFloatComma===void 0?this.systemConfig.common.isFloatComma:this.props.isFloatComma,full:!0}),a=[];o==null||o.forEach(L=>{L.t===this.texts.quality&&r.q?(a.push(M.createElement("div",{style:w.cellValueTooltipBoth,key:L.t},L.t,": ",L.v)),L.nbr||a.push(M.createElement("br",{key:`${L.t}_br`}))):(a.push(M.createElement("div",{style:w.cellValueTooltipTitle,key:L.t},L.t,": ")),a.push(M.createElement("div",{style:w.cellValueTooltipValue,key:`${L.t}_v`},L.v)),L.nbr||a.push(M.createElement("br",{key:`${L.t}_br`})))});const c=((l=i==null?void 0:i.common)==null?void 0:l.role)||"";n==="image"?a.push(M.createElement("img",{style:w.cellValueTooltipImage,src:r.val,alt:e})):c==="url"||i.common.role==="url.self"||i.common.role==="url.blank"?a.unshift(M.createElement("div",{key:"ctrl",style:{textDecoration:"underline",fontWeight:"bold"}},this.texts.ctrlForLink)):this.defaultHistory&&((u=(N=i==null?void 0:i.common)==null?void 0:N.custom)!=null&&u[this.defaultHistory])&&a.push(M.createElement("svg",{key:"sparkline",className:"sparkline","data-id":e,style:{fill:"#3d85de"},width:"200",height:"30",strokeWidth:"3"})),this.setState({tooltipInfo:{el:a,id:e}},()=>t&&t())}renderColumnValue(e,t,i){var c,l;const r=t.data.obj;if(!r||!this.states)return null;if(((c=r.common)==null?void 0:c.type)==="file")return M.createElement(j.Box,{component:"div",sx:{...w.cellValueText,...w.cellValueFile}},"[file]");if(!this.states[e])return r.type==="state"&&(this.recordStates.includes(e)||this.recordStates.push(e),this.states[e]={val:null},this.subscribe(e)),null;this.recordStates.includes(e)||this.recordStates.push(e);const o=this.states[e];let n=t.data.state;if(!n){const{valText:N}=en({state:o,obj:r,texts:this.texts,dateFormat:this.props.dateFormat||this.systemConfig.common.dateFormat,isFloatComma:this.props.isFloatComma===void 0?this.systemConfig.common.isFloatComma:this.props.isFloatComma}),u=[];if(t.data.state={valTextRx:u},u.push(M.createElement("span",{className:`newValueBrowser-${this.props.themeType||"light"}`,key:`${N.v.toString()}valText`,style:{whiteSpace:"nowrap",display:"inline-block",overflow:"hidden",textOverflow:"ellipsis"}},N.v.toString())),N.u&&u.push(M.createElement("span",{className:`newValueBrowser-${this.props.themeType||"light"}`,style:w.cellValueTextUnit,key:`${N.v.toString()}unit`},N.u)),N.s!==void 0&&u.push(M.createElement("span",{style:w.cellValueTextState,className:`newValueBrowser-${this.props.themeType||"light"}`,key:`${N.v.toString()}states`},"(",N.s,")")),!i){const L=N.c!==void 0?N.c:N.v||"";u.push(M.createElement(Ts,{className:"copyButton",style:this.styles.iconCopy,onClick:g=>this.onCopy(g,L),key:"cc"}))}n=t.data.state}n.style=gSe({state:o,isExpertMode:this.state.filter.expertMode,isButton:t.data.button});let a=n.valTextRx;return this.state.filter.expertMode||(t.data.button?a=[M.createElement(uSe,{key:"button",style:{color:n.style.color,...w.cellValueButton}})]:t.data.switch&&(a=[M.createElement(j.Switch,{key:"switch",sx:{"& .MuiSwitch-thumb":{color:n.style.color},"& .MuiSwitch-track":{backgroundColor:this.states[e].val&&this.state.selected.includes(e)?this.props.themeType==="dark"?"#FFF !important":"#111 !important":void 0}},checked:!!this.states[e].val})])),M.createElement(j.Tooltip,{key:"value",title:(l=this.state.tooltipInfo)==null?void 0:l.el,slotProps:{popper:{sx:w.cellValueTooltipBox},tooltip:{sx:w.cellValueTooltip}},onOpen:()=>this.getTooltipInfo(e,()=>this.readHistory(e)),onClose:()=>{var N;return((N=this.state.tooltipInfo)==null?void 0:N.id)===e&&this.setState({tooltipInfo:null})}},M.createElement(j.Box,{component:"div",style:n.style,className:t.data.url?"iob-link":void 0,sx:{...w.cellValueText,height:i?void 0:pe,"& .admin-button:active":{transform:"translate(0, 2px)"}}},a))}_syncEnum(e,t,i,r){var a,c,l;if(!(t!=null&&t.length)){r&&r();return}const o=t.pop()||"",n=[];if((a=this.info.objects[o])!=null&&a.common){if((c=this.info.objects[o].common.members)!=null&&c.length){const N=this.info.objects[o].common.members.indexOf(e);if(N!==-1&&!i.includes(o)){const u=JSON.parse(JSON.stringify(this.info.objects[o]));u.common.members.splice(N,1),n.push(this.props.socket.setObject(o,u).then(()=>this.info.objects[o]=u).catch(L=>this.showError(L)))}}if(i.includes(o)&&!((l=this.info.objects[o].common.members)!=null&&l.includes(e))){const N=JSON.parse(JSON.stringify(this.info.objects[o]));N.common.members||=[],N.common.members.push(e),N.common.members.sort(),n.push(this.props.socket.setObject(o,N).then(()=>this.info.objects[o]=N).catch(u=>this.showError(u)))}}Promise.all(n).then(()=>{setTimeout(()=>this._syncEnum(e,t,i,r),0)})}syncEnum(e,t,i){const r=[...this.info[t==="func"?"funcEnums":"roomEnums"]];return new Promise(o=>{this._syncEnum(e,r,i,()=>{o()})})}renderEnumDialog(){if(!this.state.enumDialog)return null;const e=this.state.enumDialog.type,t=this.state.enumDialog.item,i=this.state.enumDialogEnums,r=this.state.enumDialog.enumsOriginal,o=(e==="room"?this.info.roomEnums:this.info.funcEnums).map(n=>{var a,c;return{name:Ye(((c=(a=this.objects[n])==null?void 0:a.common)==null?void 0:c.name)||n.split(".").pop()||"",this.props.lang),value:n,icon:Zr(this.objects,n,this.props.lang,this.imagePrefix)}}).sort((n,a)=>n.name>a.name?1:-1);return o.forEach(n=>{n.icon&&typeof n.icon=="string"&&(n.icon=M.createElement(j.Box,{style:w.enumIconDiv},M.createElement("img",{src:n.icon,style:w.enumIcon,alt:n.name})))}),M.createElement(j.Dialog,{sx:{"& .MuiPaper-root":w.enumDialog},onClose:()=>this.setState({enumDialog:null}),"aria-labelledby":"enum-dialog-title",open:!0},M.createElement(j.DialogTitle,{id:"enum-dialog-title",style:{display:"flex",justifyContent:"space-between",width:"100%",flexWrap:"nowrap",gap:8,paddingRight:12}},e==="func"?this.props.t("ra_Define functions"):this.props.t("ra_Define rooms"),M.createElement(j.Fab,{color:"primary",disabled:r===JSON.stringify(i),size:"small",onClick:()=>this.syncEnum(t.data.id,e,i).then(()=>this.setState({enumDialog:null,enumDialogEnums:null}))},M.createElement(Oe,null))),M.createElement(j.List,{sx:{"&.MuiList-root":w.enumList}},o.map(n=>{let a,c,l;typeof n=="object"?(a=n.value,c=n.name,l=n.icon):(a=n,c=n);const N=`checkbox-list-label-${a}`;return M.createElement(j.ListItem,{sx:w.headerCellSelectItem,key:a,onClick:()=>{const u=i.indexOf(a),L=JSON.parse(JSON.stringify(this.state.enumDialogEnums));u===-1?(L.push(a),L.sort()):L.splice(u,1),this.setState({enumDialogEnums:L})},secondaryAction:l},M.createElement(j.ListItemIcon,{sx:{"&.MuiListItemIcon-root":w.enumCheckbox}},M.createElement(j.Checkbox,{edge:"start",checked:i.includes(a),tabIndex:-1,disableRipple:!0,inputProps:{"aria-labelledby":N}})),M.createElement(j.ListItemText,{id:N},c))})))}renderEditRoleDialog(){var e,t;if(!this.state.roleDialog||!this.props.objectBrowserEditRole)return null;if(this.state.roleDialog&&this.props.objectBrowserEditRole){const i=this.props.objectBrowserEditRole;return M.createElement(i,{key:"objectBrowserEditRole",id:this.state.roleDialog,socket:this.props.socket,t:this.props.t,roleArray:this.info.roles,commonType:(t=(e=this.info.objects[this.state.roleDialog])==null?void 0:e.common)==null?void 0:t.type,onClose:r=>{r&&(this.info.objects[this.state.roleDialog]=r),this.setState({roleDialog:null})}})}return null}onColumnsEditCustomDialogClose(e){var i,r;const t=this.customColumnDialog;if(e){let o=t.value;t.type==="boolean"?o=o==="true"||o===!0:t.type==="number"&&(o=parseFloat(o)),this.customColumnDialog=null,this.props.socket.getObject(((r=(i=this.state.columnsEditCustomDialog)==null?void 0:i.obj)==null?void 0:r._id)||"").then(n=>{var a;if(n&&it.setCustomValue(n,(a=this.state.columnsEditCustomDialog)==null?void 0:a.it,o))return this.props.socket.setObject(n._id,n);throw new Error(this.props.t("ra_Cannot update attribute, because not found in the object"))}).then(()=>this.setState({columnsEditCustomDialog:null})).catch(n=>this.showError(n))}else this.customColumnDialog=null,this.setState({columnsEditCustomDialog:null})}renderColumnsEditCustomDialog(){if(!this.state.columnsEditCustomDialog)return null;if(!this.customColumnDialog){const e=it.getCustomValue(this.state.columnsEditCustomDialog.obj,this.state.columnsEditCustomDialog.it);this.customColumnDialog={type:this.state.columnsEditCustomDialog.it.type||typeof e,initValue:(e??"").toString(),value:(e??"").toString()}}return M.createElement(j.Dialog,{onClose:()=>this.setState({columnsEditCustomDialog:null}),maxWidth:"md","aria-labelledby":"custom-dialog-title",open:!0},M.createElement(j.DialogTitle,{id:"custom-dialog-title"},`${this.props.t("ra_Edit object field")}: ${this.state.columnsEditCustomDialog.obj._id}`),M.createElement(j.DialogContent,null,M.createElement(j.DialogContentText,{id:"alert-dialog-description"},this.customColumnDialog.type==="boolean"?M.createElement(j.FormControlLabel,{control:M.createElement(j.Checkbox,{onKeyUp:e=>e.key==="Enter"&&this.onColumnsEditCustomDialogClose(!0),defaultChecked:this.customColumnDialog.value==="true",onChange:e=>{const t=this.customColumnDialog;t.value=e.target.checked.toString();const i=t.value!==t.initValue;i===!this.state.customColumnDialogValueChanged&&this.setState({customColumnDialogValueChanged:i})}}),label:`${this.state.columnsEditCustomDialog.it.name} (${this.state.columnsEditCustomDialog.it.pathText})`}):M.createElement(j.TextField,{variant:"standard",defaultValue:this.customColumnDialog.value,fullWidth:!0,onKeyUp:e=>e.key==="Enter"&&this.onColumnsEditCustomDialogClose(!0),label:`${this.state.columnsEditCustomDialog.it.name} (${this.state.columnsEditCustomDialog.it.pathText})`,onChange:e=>{const t=this.customColumnDialog;t.value=e.target.value;const i=t.value!==t.initValue;i===!this.state.customColumnDialogValueChanged&&this.setState({customColumnDialogValueChanged:i})},autoFocus:!0}))),M.createElement(j.DialogActions,null,M.createElement(j.Button,{variant:"contained",onClick:()=>this.onColumnsEditCustomDialogClose(!0),disabled:!this.state.customColumnDialogValueChanged,color:"primary",startIcon:M.createElement(Oe,null)},this.props.t("ra_Update")),M.createElement(j.Button,{color:"grey",variant:"contained",onClick:()=>this.onColumnsEditCustomDialogClose(),startIcon:M.createElement(Ne,null)},this.props.t("ra_Cancel"))))}static getCustomValue(e,t){var i;if((i=e==null?void 0:e._id)!=null&&i.startsWith(`${t.adapter}.`)&&t.path.length>1){const r=t.path;let o;const n=e;if(n[r[0]]&&typeof n[r[0]]=="object")return r.length===2?o=n[r[0]][r[1]]:r.length===3?o=n[r[0]][r[1]]&&typeof n[r[0]][r[1]]=="object"?n[r[0]][r[1]][r[2]]:null:r.length===4?o=n[r[0]][r[1]]&&typeof n[r[0]][r[1]]=="object"&&n[r[0]][r[1]][r[2]]?n[r[0]][r[1]][r[2]][r[3]]:null:r.length===5?o=n[r[0]][r[1]]&&typeof n[r[0]][r[1]]=="object"&&n[r[0]][r[1]][r[2]]&&n[r[0]][r[1]][r[2]][r[3]]?n[r[0]][r[1]][r[2]][r[3]][r[4]]:null:r.length===6&&(o=n[r[0]][r[1]]&&typeof n[r[0]][r[1]]=="object"&&n[r[0]][r[1]][r[2]]&&n[r[0]][r[1]][r[2]][r[3]]&&n[r[0]][r[1]][r[2]][r[3]][r[4]]?n[r[0]][r[1]][r[2]][r[3]][r[4]][r[5]]:null),o??null}return null}static setCustomValue(e,t,i){var r;if((r=e==null?void 0:e._id)!=null&&r.startsWith(`${t.adapter}.`)&&t.path.length>1){const o=t.path,n=e;if(n[o[0]]&&typeof n[o[0]]=="object"){if(o.length===2)return n[o[0]][o[1]]=i,!0;if(o.length===3){if(n[o[0]][o[1]]&&typeof n[o[0]][o[1]]=="object")return n[o[0]][o[1]][o[2]]=i,!0}else if(o.length===4){if(n[o[0]][o[1]]&&typeof n[o[0]][o[1]]=="object"&&n[o[0]][o[1]][o[2]]&&typeof n[o[0]][o[1]][o[2]]=="object")return n[o[0]][o[1]][o[2]][o[3]]=i,!0}else if(o.length===5){if(n[o[0]][o[1]]&&typeof n[o[0]][o[1]]=="object"&&n[o[0]][o[1]][o[2]]&&typeof n[o[0]][o[1]][o[2]]=="object"&&n[o[0]][o[1]][o[2]][o[3]]&&typeof n[o[0]][o[1]][o[2]][o[3]]=="object")return n[o[0]][o[1]][o[2]][o[3]][o[4]]=i,!0}else if(o.length===6&&n[o[0]][o[1]]&&typeof n[o[0]][o[1]]=="object"&&n[o[0]][o[1]][o[2]]&&typeof n[o[0]][o[1]][o[2]]=="object"&&n[o[0]][o[1]][o[2]][o[3]]&&typeof n[o[0]][o[1]][o[2]][o[3]]=="object"&&n[o[0]][o[1]][o[2]][o[3]][o[4]]&&typeof n[o[0]][o[1]][o[2]][o[3]][o[4]]=="object")return n[o[0]][o[1]][o[2]][o[3]][o[4]][o[5]]=i,!0}}return!1}renderCustomValue(e,t,i){const r=it.getCustomValue(e,t);return r!=null?t.edit&&!this.props.notEditable&&(!t.objTypes||t.objTypes.includes(e.type))?M.createElement(j.Box,{component:"div",style:{...w.columnCustom,...w.columnCustomEditable,...w[`columnCustom_${t.align}`]},onClick:()=>this.setState({columnsEditCustomDialog:{item:i,it:t,obj:e},customColumnDialogValueChanged:!1})},r):M.createElement(j.Box,{component:"div",style:{...w.columnCustom,...w[`columnCustom_${t.align}`]}},r):null}renderAliasLink(e,t,i){const r=t||0,o=this.objects[this.info.aliasesMap[e][r]].common.alias.id;return o?M.createElement(j.Box,{component:"div",onClick:n=>{n.stopPropagation(),n.preventDefault();const a=this.info.aliasesMap[e][r];this.info.aliasesMap[e].length>1&&this.setState({aliasMenu:""}),this.onSelect(a),setTimeout(()=>this.expandAllSelected(()=>this.scrollToItem(a)),100)},sx:i||this.styles.aliasAlone},M.createElement("span",{className:"admin-browser-arrow"},typeof o=="string"||o.read===e&&o.write===e?"↔":o.read===e?"→":"←"),this.info.aliasesMap[e][r]):null}renderLeaf(e,t,i){var ai,Mi,ci,tr,sr,mM,OM,EM,fM,xM,_M,SM,kM,YM;const r=e.data.id;i.count++,t=t===void 0?this.state.expanded.includes(r):t;let o;const n=e.data.obj,a=n==null?void 0:n.type;e.children||a==="folder"||a==="device"||a==="channel"||a==="meta"?o=t?M.createElement(fr,{style:this.styles.cellIdIconFolder,onClick:()=>this.toggleExpanded(r)}):M.createElement(Ws,{style:this.styles.cellIdIconFolder,onClick:()=>this.toggleExpanded(r)}):n&&n.common&&n.common.write===!1&&n.type==="state"?o=M.createElement(sSe,{style:this.styles.cellIdIconDocument}):o=M.createElement(tSe,{style:this.styles.cellIdIconDocument});let c=null;e.data.icon&&(typeof e.data.icon=="string"?e.data.icon.length<3?c=M.createElement("span",{className:"iconOwn",style:w.cellIdIconOwn},e.data.icon):c=M.createElement(me,{style:w.cellIdIconOwn,className:"iconOwn",src:e.data.icon,alt:""}):c=e.data.icon);const l=n==null?void 0:n.common,N=(n==null?void 0:n.type)&&Bl[n.type]||M.createElement("div",{className:"itemIcon"}),u=this.levelPadding*(e.data.level||0);if(e.data.lang!==this.props.lang){const{rooms:k,per:q}=$4(this.info,r,this.props.lang);e.data.rooms=k.join(", "),e.data.per=q;const{funcs:fe,pef:de}=P4(this.info,r,this.props.lang);e.data.funcs=fe.join(", "),e.data.pef=de,e.data.lang=this.props.lang}const L=this.props.multiSelect&&this.objects[r]&&(!this.props.types||this.props.types.includes(this.objects[r].type))?M.createElement(j.Checkbox,{style:w.checkBox,checked:this.state.selected.includes(r)}):null;let g=!this.props.notEditable&&a==="state"&&(this.state.filter.expertMode||(l==null?void 0:l.write)!==!1);this.props.objectBrowserViewFile&&(l==null?void 0:l.type)==="file"&&(g=!0);const y=!this.props.notEditable&&this.objects[r]&&(this.state.filter.expertMode||a==="state"||a==="channel"||a==="device"),T=this.state.statesView&&(a==="state"||a==="channel"||a==="device");let d="";const z=[];if(T&&(d=(ai=this.states[r])==null?void 0:ai.from,d===void 0?d="&nbsp;":(d=d?d.replace(/^system\.adapter\.|^system\./,""):"",z.push(`${this.texts.stateChangedFrom} ${d}`)),n!=null&&n.user)){const k=n.user.replace("system.user.","");d+=`/${k}`,z.push(`${this.texts.stateChangedBy} ${k}`)}n&&(n.from&&z.push(`${this.texts.objectChangedFrom} ${n.from.replace(/^system\.adapter\.|^system\./,"")}`),n.user&&z.push(`${this.texts.objectChangedBy} ${n.user.replace(/^system\.user\./,"")}`),n.ts&&z.push(`${this.texts.objectChangedByUser} ${O.formatDate(new Date(n.ts),this.props.dateFormat||this.systemConfig.common.dateFormat)}`));let I=!1,C=null;r.startsWith("alias.")&&((Mi=l==null?void 0:l.alias)!=null&&Mi.id)?(I=typeof l.alias.id=="object",I?C=M.createElement("div",{style:w.cellIdAliasReadWriteDiv},l.alias.id.read?M.createElement(j.Box,{component:"div",onClick:k=>{k.stopPropagation(),k.preventDefault(),this.onSelect(l.alias.id.read),setTimeout(()=>this.expandAllSelected(()=>this.scrollToItem(l.alias.id.read)),100)},sx:this.styles.aliasReadWrite},"←",l.alias.id.read):null,l.alias.id.write?M.createElement(j.Box,{component:"div",onClick:k=>{k.stopPropagation(),k.preventDefault(),this.onSelect(l.alias.id.write),setTimeout(()=>this.expandAllSelected(()=>this.scrollToItem(l.alias.id.write)),100)},sx:this.styles.aliasReadWrite},"→",l.alias.id.write):null):C=M.createElement(j.Box,{component:"div",onClick:k=>{k.stopPropagation(),k.preventDefault(),this.onSelect(l.alias.id),setTimeout(()=>this.expandAllSelected(()=>this.scrollToItem(l.alias.id)),100)},sx:this.styles.aliasAlone},"→",l.alias.id)):this.info.aliasesMap[r]&&(this.info.aliasesMap[r].length>1?C=M.createElement(j.Box,{component:"div",id:`alias_${r}`,onClick:k=>{k.stopPropagation(),k.preventDefault(),this.setState({aliasMenu:r})},sx:this.styles.aliasAlone},this.props.t("ra_%s links from aliases",this.info.aliasesMap[r].length)):C=this.renderAliasLink(r,0));let m=l==null?void 0:l.color,A;if(m&&!this.state.selected.includes(r)){const k=this.props.themeName==="dark"?"#1f1f1f":this.props.themeName==="blue"?"#222a2e":"#FFFFFF";O.colorDistance(m,k)<1e3&&(A=this.props.themeType==="dark"?"#9a9a9a":"#565656")}let D=!1;r==="0_userdata"?(m=x4(this.props.themeType),D=!0):r==="alias"?(m=_4(this.props.themeType),D=!0):r==="javascript"?(m=cSe(this.props.themeType),D=!0):r==="system"?(m=S4(this.props.themeType),D=!0):r==="system.adapter"?m=k4(this.props.themeType):(!m||this.state.selected.includes(r))&&(m="inherit");const p=[];if(l!=null&&l.statusStates){const k={};Object.keys(l.statusStates).forEach(fe=>{var tt;let de=l.statusStates[fe];de.split(".").length<3&&(de=`${r}.${de}`),k[fe]=de,this.states[de]?this.recordStates.includes(de)||this.recordStates.push(de):((tt=this.objects[de])==null?void 0:tt.type)==="state"&&(this.recordStates.includes(de)||this.recordStates.push(de),this.states[de]={val:null},this.subscribe(de))});let q=!1;l.statusStates.errorId&&this.states[k.errorId]&&this.states[k.errorId].val&&(m=this.props.themeType==="dark"?Y4:v4,q=!0,p.push(M.createElement(cg,{key:"error",style:this.styles.iconDeviceError}))),k.onlineId&&this.states[k.onlineId]?q?this.states[k.onlineId].val?p.push(M.createElement(Qs,{key:"conn",style:this.styles.iconDeviceConnected})):p.push(M.createElement(rr,{key:"disc",style:this.styles.iconDeviceDisconnected})):this.states[k.onlineId].val?(m=this.props.themeType==="dark"?Bn:Jn,p.push(M.createElement(Qs,{key:"conn",style:this.styles.iconDeviceConnected}))):(m=this.props.themeType==="dark"?Rn:Fn,p.push(M.createElement(rr,{key:"disc",style:this.styles.iconDeviceDisconnected}))):k.offlineId&&this.states[k.offlineId]&&(q?this.states[k.offlineId].val?p.push(M.createElement(rr,{key:"disc",style:this.styles.iconDeviceDisconnected})):p.push(M.createElement(Qs,{key:"conn",style:this.styles.iconDeviceConnected})):this.states[k.offlineId].val?(m=this.props.themeType==="dark"?Rn:Fn,p.push(M.createElement(rr,{key:"disc",style:this.styles.iconDeviceDisconnected}))):(m=this.props.themeType==="dark"?Bn:Jn,p.push(M.createElement(Qs,{key:"conn",style:this.styles.iconDeviceConnected}))))}const _=T?O.quality2text(((ci=this.states[r])==null?void 0:ci.q)||0).join(", "):null;let x=((tr=e.data)==null?void 0:tr.title)||"",P=!1;if(this.state.showDescription){const k=Q4(e.data,this.props.lang);k&&(x=[M.createElement("div",{key:"name",style:w.cellNameDivDiv},x),M.createElement("div",{key:"desc",style:w.cellDescription},k)],P=!!k)}const v=this.props.width==="xs"&&this.state.focused===r,ee=M.createElement(j.Grid2,{container:!0,wrap:"nowrap",direction:"row",sx:w.cellId,style:{width:this.columnsVisibility.id,paddingLeft:u}},M.createElement(j.Grid2,{container:!0,alignItems:"center"},L,o),M.createElement(j.Grid2,{style:{...w.cellIdSpan,...A?this.styles.invertedBackground:void 0,color:m,fontWeight:D?"bold":void 0}},M.createElement(j.Tooltip,{title:LSe(e.data,this.props.lang),slotProps:{popper:{sx:w.tooltip}}},M.createElement("div",null,e.data.name)),C,p),M.createElement("div",{style:{...w.grow,...A?this.styles.invertedBackgroundFlex:{}}}),M.createElement(j.Grid2,{container:!0,alignItems:"center"},c),this.props.width!=="xs"?M.createElement("div",null,M.createElement(Ts,{className:v?"":"copyButton",style:w.cellCopyButton,onClick:k=>this.onCopy(k,r)})):null);let ue=v&&x||this.columnsVisibility.name?M.createElement(j.Box,{component:"div",sx:{...w.cellName,...P?w.cellNameWithDesc:void 0,width:this.props.width!=="xs"?this.columnsVisibility.name:void 0,ml:v?0:"5px"}},x,!v&&((sr=e.data)!=null&&sr.title)?M.createElement(j.Box,{style:{color:m}},M.createElement(Ts,{className:"copyButton",style:w.cellCopyButton,onClick:k=>{var q;return this.onCopy(k,(q=e.data)==null?void 0:q.title)}})):null):null,G;this.state.statesView?G=[v&&T&&((mM=this.states[r])!=null&&mM.from)||this.columnsVisibility.changedFrom?{el:M.createElement("div",{key:"from",style:{...w.cellRole,width:this.props.width!=="xs"?this.columnsVisibility.changedFrom:void 0},title:z.join(`
449
449
  `)},T&&((OM=this.states[r])!=null&&OM.from)?d:null),type:"from"}:null,v&&_||this.columnsVisibility.qualityCode?{el:M.createElement("div",{key:"q",style:{...w.cellRole,width:this.props.width!=="xs"?this.columnsVisibility.qualityCode:void 0},title:_||""},_),type:"quality"}:null,v&&T&&((EM=this.states[r])!=null&&EM.ts)||this.columnsVisibility.timestamp?{el:M.createElement("div",{key:"ts",style:{...w.cellRole,width:this.props.width!=="xs"?this.columnsVisibility.timestamp:void 0}},T&&((fM=this.states[r])!=null&&fM.ts)?O.formatDate(new Date(this.states[r].ts),this.props.dateFormat||this.systemConfig.common.dateFormat):null),type:"ts"}:null,v&&T&&((xM=this.states[r])!=null&&xM.lc)||this.columnsVisibility.lastChange?{el:M.createElement("div",{key:"lc",style:{...w.cellRole,width:this.props.width!=="xs"?this.columnsVisibility.lastChange:void 0}},T&&((_M=this.states[r])!=null&&_M.lc)?O.formatDate(new Date(this.states[r].lc),this.props.dateFormat||this.systemConfig.common.dateFormat):null),type:"lc"}:null]:G=[v&&(n!=null&&n.type)||this.columnsVisibility.type?{el:M.createElement("div",{key:"type",style:{...w.cellType,width:this.props.width!=="xs"?this.columnsVisibility.type:void 0}},N," ",n==null?void 0:n.type),type:"filter_type"}:null,v&&l||this.columnsVisibility.role?{el:M.createElement("div",{key:"role",style:{...w.cellRole,width:this.props.width!=="xs"?this.columnsVisibility.role:"100%",cursor:this.state.filter.expertMode&&y&&this.props.objectBrowserEditRole?"text":"default"},onClick:!v&&this.state.filter.expertMode&&y&&this.props.objectBrowserEditRole?()=>this.setState({roleDialog:e.data.id}):void 0},l==null?void 0:l.role),type:"filter_role",onClick:v&&this.state.filter.expertMode&&y&&this.props.objectBrowserEditRole?()=>this.setState({roleDialog:e.data.id}):void 0}:null,v&&l||this.columnsVisibility.room?{el:M.createElement("div",{key:"room",style:{...w.cellRoom,...e.data.per?w.cellEnumParent:{},width:this.props.width!=="xs"?this.columnsVisibility.room:"100%",cursor:y?"text":"default"},onClick:!v&&y?()=>{const k=Ds(this.info,e.data.id,"roomEnums");this.setState({enumDialogEnums:k,enumDialog:{item:e,type:"room",enumsOriginal:JSON.stringify(k)}})}:void 0},e.data.rooms),type:"filter_room",onClick:v&&y?()=>{const k=Ds(this.info,e.data.id,"roomEnums");this.setState({enumDialogEnums:k,enumDialog:{item:e,type:"room",enumsOriginal:JSON.stringify(k)}})}:void 0}:null,v&&l||this.columnsVisibility.func?{el:M.createElement("div",{key:"func",style:{...w.cellFunc,...e.data.pef?w.cellEnumParent:{},width:this.props.width!=="xs"?this.columnsVisibility.func:"100%",cursor:y?"text":"default"},onClick:!v&&y?()=>{const k=Ds(this.info,e.data.id,"funcEnums");this.setState({enumDialogEnums:k,enumDialog:{item:e,type:"func",enumsOriginal:JSON.stringify(k)}})}:void 0},e.data.funcs),type:"filter_func",onClick:v&&y?()=>{const k=Ds(this.info,e.data.id,"funcEnums");this.setState({enumDialogEnums:k,enumDialog:{item:e,type:"func",enumsOriginal:JSON.stringify(k)}})}:void 0}:null];let H=((SM=this.adapterColumns)==null?void 0:SM.map(k=>M.createElement("div",{style:{...w.cellAdapter,width:this.props.width!=="xs"?this.columnsVisibility[k.id]:void 0},key:k.id,title:`${k.adapter} => ${k.pathText}`},n?this.renderCustomValue(n,k,e):null)))||null;const Te=v||this.columnsVisibility.val?this.renderColumnValue(r,e,v):null;let Fe=v&&Te||this.columnsVisibility.val?M.createElement("div",{style:{...w.cellValue,width:this.props.width!=="xs"?this.columnsVisibility.val:"calc(100% - 100px)",cursor:g?(l==null?void 0:l.type)==="file"?"zoom-in":e.data.button?"grab":"text":"default"},onClick:k=>{var q,fe,de;if(g){if(!(!n||!this.states))if((l==null?void 0:l.type)==="file")this.setState({viewFileDialog:r});else if(e.data.url&&k.ctrlKey){if((q=this.states[r])!=null&&q.val&&typeof this.states[r].val=="string")if((l==null?void 0:l.role)==="url.self")window.location.href=this.states[r].val;else{const tt=window.open(this.states[r].val,"_blank");tt==null||tt.focus()}}else!this.state.filter.expertMode&&e.data.button?this.props.socket.setState(r,!0).catch(tt=>window.alert(`Cannot write state "${r}": ${tt}`)):!this.state.filter.expertMode&&e.data.switch?this.props.socket.setState(r,!this.states[r].val).catch(tt=>window.alert(`Cannot write state "${r}": ${tt}`)):(this.edit={val:this.states[r]?this.states[r].val:"",q:this.states[r]&&this.states[r].q||0,ack:!1,id:r},this.setState({updateOpened:!0}))}else(l==null?void 0:l.role)==="url"||(l==null?void 0:l.role)==="url.blank"&&k.ctrlKey?(fe=this.states[r])!=null&&fe.val&&typeof this.states[r].val=="string"&&window.open(this.states[r].val,"_blank"):(l==null?void 0:l.role)==="url.self"&&k.ctrlKey&&(de=this.states[r])!=null&&de.val&&typeof this.states[r].val=="string"&&(window.location.href=this.states[r].val)}},Te):null,Ge=v||this.columnsVisibility.buttons?M.createElement("div",{style:{...w.cellButtons,width:this.props.width!=="xs"?this.columnsVisibility.buttons:void 0}},this.renderColumnButtons(r,e)):null,Ls=null;if(this.props.width==="xs"&&this.state.focused===r){G=G.filter(q=>q);let k;G.length?k=G.map(q=>q?M.createElement("div",{key:q.type,style:w.cellDetailsLine},M.createElement("span",{style:w.cellDetailsName},this.texts[q.type],":"),q.el,M.createElement("div",{style:{flexGrow:1}}),q.onClick?M.createElement(mi,{style:w.cellCopyButtonInDetails,onClick:()=>{q!=null&&q.onClick&&q.onClick()}}):null):null):k=null,H.length||(H=null),Ls=M.createElement(j.Paper,{style:{width:"100%",display:"flex",flexDirection:"column",padding:10,backgroundColor:this.props.theme.palette.mode==="dark"?"#333":"#ccc"}},M.createElement("div",{style:w.cellDetailsLine},M.createElement("div",{style:{flexGrow:1}}),M.createElement(Ts,{style:w.cellCopyButtonInDetails,onClick:q=>this.onCopy(q,r)})),ue&&M.createElement("div",{style:w.cellDetailsLine},M.createElement("span",{style:w.cellDetailsName},this.texts.name,":"),ue,M.createElement("div",{style:{flexGrow:1}}),(kM=e.data)!=null&&kM.title?M.createElement(Ts,{className:"copyButton",style:w.cellCopyButtonInDetails,onClick:q=>{var fe;return this.onCopy(q,(fe=e.data)==null?void 0:fe.title)}}):null),k,H&&M.createElement("div",{style:w.cellDetailsLine},H),((YM=this.objects[r])==null?void 0:YM.type)==="state"&&M.createElement("div",{style:w.cellDetailsLine},M.createElement("span",{style:w.cellDetailsName},this.texts.value,":"),Fe,M.createElement("div",{style:{flexGrow:1}}),M.createElement(Ts,{className:"copyButton",style:w.cellCopyButtonInDetails,onClick:q=>{const{valText:fe}=en({state:this.states[r],obj:this.objects[r],texts:this.texts,dateFormat:this.props.dateFormat||this.systemConfig.common.dateFormat,isFloatComma:this.props.isFloatComma===void 0?this.systemConfig.common.isFloatComma:this.props.isFloatComma});this.onCopy(q,fe.c!==void 0?fe.c:fe.v.toString())},key:"cc"})),Ge&&M.createElement("div",{style:{...w.cellDetailsLine,justifyContent:"right"}},Ge)),ue=null,G=null,H=null,Fe=null,Ge=null}return{row:M.createElement(j.Grid2,{container:!0,direction:"row",wrap:"nowrap",sx:O.getStyle(this.props.theme,w.tableRow,this.state.linesEnabled&&w.tableRowLines,!this.props.dragEnabled&&w.tableRowNoDragging,C&&w.tableRowAlias,I&&w.tableRowAliasReadWrite,this.state.focused===r&&this.props.multiSelect&&w.tableRowFocused,!e.data.visible&&w.filteredOut,e.data.hasVisibleParent&&!e.data.visible&&!e.data.hasVisibleChildren&&w.filteredParentOut,this.state.selected.includes(r)&&w.itemSelected,this.state.selectedNonObject===r&&w.itemSelected),key:r,id:r,onMouseDown:k=>{this.onSelect(r);let q;"which"in k?q=k.which===3:"button"in k&&(q=k.button===2),q?this.contextMenu={item:e,ts:Date.now()}:this.contextMenu=null},onDoubleClick:()=>{e.children?this.toggleExpanded(r):this.onSelect(r,!0)}},ee,ue,G==null?void 0:G.map(k=>k==null?void 0:k.el),H,Fe,Ge),details:Ls}}renderItem(e,t,i){const r=[];i=i||{count:0};const o=this.renderLeaf(e,t,i);let n;const a=this.props.DragWrapper;return this.props.dragEnabled&&a?e.data.sumVisibility?n=M.createElement(a,{key:e.data.id,item:e,style:w.draggable},o.row):n=M.createElement("div",{key:e.data.id,style:w.nonDraggable},o.row):n=o.row,e.data.id&&n&&r.push(n),o.details&&r.push(o.details),t=t===void 0?vi(this.state.expanded,e.data.id):t,(!e.data.id||t)&&(this.state.foldersFirst?e.children&&(r.push(e.children.map(c=>c.children&&(!this.state.columnsSelectorShow||i.count<15)&&c.data.sumVisibility?this.renderItem(c,void 0,i):null)),r.push(e.children.map(c=>!c.children&&(!this.state.columnsSelectorShow||i.count<15)&&c.data.sumVisibility?this.renderItem(c,void 0,i):null))):e.children&&r.push(e.children.map(c=>(!this.state.columnsSelectorShow||i.count<15)&&c.data.sumVisibility?this.renderItem(c,void 0,i):null))),r}calculateColumnsVisibility(e,t,i,r){let o=r||this.state.columnsWidths;const n=i||this.state.columnsForAdmin,a=t||this.state.columns||[],c=typeof e!="boolean"?this.state.columnsAuto:e;o=JSON.parse(JSON.stringify(o)),Object.keys(o).forEach(N=>{o[N]&&(o[N]=parseInt(o[N],10)||0)}),this.adapterColumns=[];const l=le[this.props.width||"lg"].widths;if(c){if(this.columnsVisibility={id:le[this.props.width||"lg"].idWidth,name:this.visibleCols.includes("name")&&l.name||0,nameHeader:this.visibleCols.includes("name")&&l.name||0,type:this.visibleCols.includes("type")&&l.type||0,role:this.visibleCols.includes("role")&&l.role||0,room:this.visibleCols.includes("room")&&l.room||0,func:this.visibleCols.includes("func")&&l.func||0,changedFrom:this.visibleCols.includes("changedFrom")&&l.changedFrom||0,qualityCode:this.visibleCols.includes("qualityCode")&&l.qualityCode||0,timestamp:this.visibleCols.includes("timestamp")&&l.timestamp||0,lastChange:this.visibleCols.includes("lastChange")&&l.lastChange||0,val:this.visibleCols.includes("val")&&l.val||0,buttons:this.visibleCols.includes("buttons")&&l.buttons||0},this.columnsVisibility.name&&!this.customWidth){let N=this.columnsVisibility.id||0;this.state.statesView?(N+=this.columnsVisibility.changedFrom||0,N+=this.columnsVisibility.qualityCode||0,N+=this.columnsVisibility.timestamp||0,N+=this.columnsVisibility.lastChange||0):(N+=this.columnsVisibility.type||0,N+=this.columnsVisibility.role||0,N+=this.columnsVisibility.room||0,N+=this.columnsVisibility.func||0),N+=this.columnsVisibility.val||0,N+=this.columnsVisibility.buttons||0,this.columnsVisibility.name=`calc(100% - ${N+5}px)`,this.columnsVisibility.nameHeader=`calc(100% - ${N+5+this.state.scrollBarWidth}px)`}else if(!this.customWidth){let N=0;this.state.statesView?(N+=this.columnsVisibility.changedFrom||0,N+=this.columnsVisibility.qualityCode||0,N+=this.columnsVisibility.timestamp||0,N+=this.columnsVisibility.lastChange||0):(N+=this.columnsVisibility.type||0,N+=this.columnsVisibility.role||0,N+=this.columnsVisibility.room||0,N+=this.columnsVisibility.func||0),N+=this.columnsVisibility.val||0,N+=this.columnsVisibility.buttons||0,this.columnsVisibility.id=`calc(100% - ${N+5}px)`}}else{const N=this.props.width||"lg";this.columnsVisibility={id:o.id||le[N].idWidth,name:a.includes("name")&&(o.name||l.name||le[N].widths.name)||0,type:a.includes("type")&&(o.type||l.type||le[N].widths.type)||0,role:a.includes("role")&&(o.role||l.role||le[N].widths.role)||0,room:a.includes("room")&&(o.room||l.room||le[N].widths.room)||0,func:a.includes("func")&&(o.func||l.func||le[N].widths.func)||0};let u=this.columnsVisibility.id;if(this.columnsVisibility.name&&(u+=this.columnsVisibility.type||0,u+=this.columnsVisibility.role||0,u+=this.columnsVisibility.room||0,u+=this.columnsVisibility.func||0),n&&a&&Object.keys(n).sort().forEach(L=>n[L].forEach(g=>{const y=`_${L}_${g.path}`;if(a.includes(y)){const T={adapter:L,id:`_${L}_${g.path}`,name:g.name,path:g.path.split("."),pathText:g.path};g.edit&&(T.edit=!0,g.type&&(T.type=g.type),g.objTypes&&(T.objTypes=g.objTypes)),this.adapterColumns.push(T),this.columnsVisibility[y]=o[T.id]||g.width||le[N].widths.func||le.xl.widths.func||0,u+=this.columnsVisibility[y]}else this.columnsVisibility[y]=0})),this.adapterColumns.sort((L,g)=>L.id>g.id?-1:L.id<g.id?1:0),this.columnsVisibility.val=a.includes("val")?o.val||l.val||le.xl.widths.val:0,(!this.props.columns||this.props.columns.includes("buttons"))&&(this.columnsVisibility.buttons=a.includes("buttons")?o.buttons||l.buttons||le.xl.widths.buttons:0,u+=this.columnsVisibility.buttons||0),this.columnsVisibility.name&&!o.name)u+=this.columnsVisibility.val||0,this.columnsVisibility.name=`calc(100% - ${u}px)`,this.columnsVisibility.nameHeader=`calc(100% - ${u+5+this.state.scrollBarWidth}px)`;else{const L=Object.keys(this.columnsVisibility).reduce((g,y)=>y==="id"||typeof this.columnsVisibility[y]=="string"||!this.columnsVisibility[y]?g:g+this.columnsVisibility[y],0);this.columnsVisibility.id=`calc(100% - ${L}px)`}}}resizerMouseMove=e=>{if(this.resizerActiveDiv){let t,i;this.resizeLeft?(t=this.resizerOldWidth-e.clientX+this.resizerPosition,i=this.resizerOldWidthNext+e.clientX-this.resizerPosition):(t=this.resizerOldWidth+e.clientX-this.resizerPosition,i=this.resizerOldWidthNext-e.clientX+this.resizerPosition),this.resizerActiveName&&this.resizerNextName&&(!this.resizerMin||t>this.resizerMin)&&(!this.resizerNextMin||i>this.resizerNextMin)&&(this.resizerCurrentWidths[this.resizerActiveName]=t,this.resizerCurrentWidths[this.resizerNextName]=i,this.resizerActiveDiv.style.width=`${t}px`,this.resizerNextDiv&&(this.resizerNextDiv.style.width=`${i}px`),this.columnsVisibility[this.resizerActiveName]=t,this.columnsVisibility[this.resizerNextName]=i,this.resizerNextName==="nameHeader"?(this.columnsVisibility.name=i-this.state.scrollBarWidth,this.resizerCurrentWidths.name=i-this.state.scrollBarWidth):this.resizerActiveName==="nameHeader"&&(this.columnsVisibility.name=t-this.state.scrollBarWidth,this.resizerCurrentWidths.name=t-this.state.scrollBarWidth),this.customWidth=!0,this.resizeTimeout&&clearTimeout(this.resizeTimeout),this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=null,this.forceUpdate()},200))}};resizerMouseUp=()=>{this.localStorage.setItem(`${this.props.dialogName||"App"}.table`,JSON.stringify(this.resizerCurrentWidths)),this.resizerActiveName=null,this.resizerNextName=null,this.resizerActiveDiv=null,this.resizerNextDiv=null,window.removeEventListener("mousemove",this.resizerMouseMove),window.removeEventListener("mouseup",this.resizerMouseUp)};resizerMouseDown=e=>{if(this.storedWidths||=JSON.parse(JSON.stringify(le[this.props.width||"lg"])),this.resizerCurrentWidths||={},this.resizerActiveDiv=e.target.parentNode,this.resizerActiveName=this.resizerActiveDiv.dataset.name||null,this.resizerActiveName){let t=0;if(e.target.dataset.left==="true"){this.resizeLeft=!0,this.resizerNextDiv=this.resizerActiveDiv.previousElementSibling;let i=this.resizerNextDiv.querySelector(".iob-ob-resize-handler");for(;this.resizerNextDiv&&!i&&t<10;)this.resizerNextDiv=this.resizerNextDiv.previousElementSibling,i=this.resizerNextDiv.querySelector(".iob-ob-resize-handler"),t++;(i==null?void 0:i.dataset.left)!=="true"&&(this.resizerNextDiv=this.resizerNextDiv.nextElementSibling)}else this.resizeLeft=!1,this.resizerNextDiv=this.resizerActiveDiv.nextElementSibling;this.resizerNextName=this.resizerNextDiv.dataset.name||null,this.resizerMin=parseInt(this.resizerActiveDiv.dataset.min,10)||0,this.resizerNextMin=parseInt(this.resizerNextDiv.dataset.min,10)||0,this.resizerPosition=e.clientX,this.resizerCurrentWidths[this.resizerActiveName]=this.resizerActiveDiv.offsetWidth,this.resizerOldWidth=this.resizerCurrentWidths[this.resizerActiveName],this.resizerNextName&&(this.resizerCurrentWidths[this.resizerNextName]=this.resizerNextDiv.offsetWidth,this.resizerOldWidthNext=this.resizerCurrentWidths[this.resizerNextName]),window.addEventListener("mousemove",this.resizerMouseMove),window.addEventListener("mouseup",this.resizerMouseUp)}};navigateKeyPress(e){var i,r;const t=this.state.selectedNonObject||this.state.selected[0];if(t){if(e.code==="ArrowUp"||e.code==="ArrowDown"){e.preventDefault();const o=[];(i=this.tableRef.current)==null||i.childNodes.forEach(l=>o.push(l.id));const n=o.indexOf(t),a=e.code==="ArrowDown"?n+1:n-1,c=o[a]||t;this.onSelect(c),this.scrollToItem(c)}if((e.code==="ArrowRight"||e.code==="ArrowLeft")&&this.toggleExpanded(t),e.code==="Delete"&&this.root&&t){const o=it.getItemFromRoot(this.root,t);if(o){const{obj:n}=o.data;n&&!((r=n.common)!=null&&r.dontDelete)&&this.showDeleteDialog({id:t,obj:n,item:o})}}}}static getItemFromRoot(e,t){const i=t.split(".");let r="",o=e;for(let n=0;n<i.length;n++){const a=i[n];r=r?`${r}.${a}`:a;let c=!1;if(o.children){for(let l=0;l<o.children.length;l++)if(o.children[l].data.id===r){o=o.children[l],c=!0;break}}if(!c)return null}return o||null}resizerReset=()=>{this.customWidth=!1,le[this.props.width||"lg"]=JSON.parse(JSON.stringify(this.storedWidths)),this.calculateColumnsVisibility(),this.localStorage.removeItem(`${this.props.dialogName||"App"}.table`),this.forceUpdate()};renderHandleRight(){return M.createElement(j.Box,{component:"div",className:"iob-ob-resize-handler",sx:{...w.resizeHandle,...w.resizeHandleRight},onMouseDown:this.resizerMouseDown,onDoubleClick:this.resizerReset,title:this.props.t("ra_Double click to reset table layout")})}renderHeader(){let e=null;return!this.columnsVisibility.buttons&&!this.isFilterEmpty()&&(e=M.createElement(j.IconButton,{onClick:()=>this.clearFilter(),style:w.buttonClearFilter,title:this.props.t("ra_Clear filter"),size:"large"},M.createElement(rSe,null),M.createElement(Ne,{style:w.buttonClearFilterIcon}))),this.props.width==="xs"?M.createElement("div",{style:w.headerRow},M.createElement("div",{style:{...w.headerCell,width:"100%"}},this.getFilterInput("id"))):M.createElement("div",{style:w.headerRow},M.createElement("div",{style:{...w.headerCell,width:this.columnsVisibility.id,position:"relative"},"data-min":240,"data-name":"id"},this.getFilterInput("id"),this.renderHandleRight()),this.columnsVisibility.name?M.createElement("div",{style:{...w.headerCell,width:this.columnsVisibility.nameHeader,position:"relative"},"data-min":100,"data-name":"nameHeader"},this.getFilterInput("name"),this.renderHandleRight()):null,!this.state.statesView&&M.createElement(M.Fragment,null,this.columnsVisibility.type?M.createElement("div",{style:{...w.headerCell,width:this.columnsVisibility.type,position:"relative"},"data-min":100,"data-name":"type"},this.getFilterSelectType(),this.renderHandleRight()):null,this.columnsVisibility.role?M.createElement("div",{style:{...w.headerCell,width:this.columnsVisibility.role,position:"relative"},"data-min":100,"data-name":"role"},this.getFilterSelectRole(),this.renderHandleRight()):null,this.columnsVisibility.room?M.createElement("div",{style:{...w.headerCell,width:this.columnsVisibility.room,position:"relative"},"data-min":100,"data-name":"room"},this.getFilterSelectRoom(),this.renderHandleRight()):null,this.columnsVisibility.func?M.createElement("div",{style:{...w.headerCell,width:this.columnsVisibility.func,position:"relative"},"data-min":100,"data-name":"func"},this.getFilterSelectFunction(),this.renderHandleRight()):null),this.state.statesView&&M.createElement(M.Fragment,null,M.createElement("div",{style:{...w.headerCell,...w.headerCellValue,width:this.columnsVisibility.changedFrom,position:"relative"},"data-min":100,"data-name":"changedFrom"},this.props.t("ra_Changed from"),this.renderHandleRight()),M.createElement("div",{style:{...w.headerCell,...w.headerCellValue,width:this.columnsVisibility.qualityCode,position:"relative"},"data-min":100,"data-name":"qualityCode"},this.props.t("ra_Quality code"),this.renderHandleRight()),M.createElement("div",{style:{...w.headerCell,...w.headerCellValue,width:this.columnsVisibility.timestamp,position:"relative"},"data-min":100,"data-name":"timestamp"},this.props.t("ra_Timestamp"),this.renderHandleRight()),M.createElement("div",{style:{...w.headerCell,...w.headerCellValue,width:this.columnsVisibility.lastChange,position:"relative"},"data-min":100,"data-name":"lastChange"},this.props.t("ra_Last change"),this.renderHandleRight())),this.adapterColumns.map(t=>M.createElement("div",{style:{...w.headerCell,...w.headerCellValue,width:this.columnsVisibility[t.id]},title:t.adapter,key:t.id,"data-min":100,"data-name":t.id},t.name)),this.columnsVisibility.val?M.createElement("div",{style:{...w.headerCell,...w.headerCellValue,width:this.columnsVisibility.val,position:"relative"},"data-min":120,"data-name":"val"},this.props.t("ra_Value"),e):null,this.columnsVisibility.buttons?M.createElement("div",{title:this.texts.filter_custom,style:{...w.headerCell,width:this.columnsVisibility.buttons}}," ",this.getFilterSelectCustoms()):null)}renderToast(){return M.createElement(j.Snackbar,{open:!!this.state.toast,autoHideDuration:3e3,onClick:()=>this.setState({toast:""}),onClose:()=>this.setState({toast:""}),message:this.state.toast,action:M.createElement(j.IconButton,{size:"small","aria-label":"close",color:"inherit",onClick:()=>this.setState({toast:""})},M.createElement(Ne,{fontSize:"small"}))})}componentDidUpdate(){if(this.tableRef.current){const e=this.tableRef.current.offsetWidth-this.tableRef.current.clientWidth;this.state.scrollBarWidth!==e?setTimeout(()=>this.setState({scrollBarWidth:e}),100):this.selectFirst&&this.scrollToItem(this.selectFirst)}}scrollToItem(e){this.selectFirst="";const t=window.document.getElementById(e);t==null||t.scrollIntoView({behavior:"auto",block:"center",inline:"center"})}renderCustomDialog(){if(this.state.customDialog&&this.props.objectCustomDialog){const e=this.props.objectCustomDialog;return M.createElement(e,{reportChangedIds:t=>this.changedIds=[...t],objectIDs:this.state.customDialog,allVisibleObjects:!!this.state.customDialogAll,expertMode:this.state.filter.expertMode,isFloatComma:this.props.isFloatComma===void 0?this.systemConfig.common.isFloatComma:this.props.isFloatComma,t:this.props.t,lang:this.props.lang,socket:this.props.socket,themeName:this.props.themeName,themeType:this.props.themeType,theme:this.props.theme,objects:this.objects,customsInstances:this.info.customs,onClose:()=>{var t;this.pauseSubscribe(!1),this.setState({customDialog:null}),this.changedIds&&(this.changedIds=null,this.forceUpdate()),(t=this.props.router)==null||t.doNavigate("tab-objects")},systemConfig:this.systemConfig})}return null}onUpdate(e){this.props.socket.setState(this.edit.id,{val:e.val,ack:e.ack,q:e.q||0,expire:e.expire||void 0}).catch(t=>this.showError(`Cannot write value: ${t}`))}renderEditObjectDialog(){if(!this.state.editObjectDialog||!this.props.objectBrowserEditObject)return null;const e=this.props.objectBrowserEditObject;return M.createElement(e,{key:this.state.editObjectDialog,obj:this.objects[this.state.editObjectDialog],roleArray:this.info.roles,objects:this.objects,dateFormat:this.props.dateFormat||this.systemConfig.common.dateFormat,isFloatComma:this.props.isFloatComma===void 0?this.systemConfig.common.isFloatComma:this.props.isFloatComma,themeType:this.props.themeType,theme:this.props.theme,socket:this.props.socket,dialogName:this.props.dialogName,aliasTab:this.state.editObjectAlias,t:this.props.t,expertMode:!!this.state.filter.expertMode,onNewObject:t=>this.props.socket.setObject(t._id,t).then(()=>this.setState({editObjectDialog:t._id,editObjectAlias:!1},()=>this.onSelect(t._id))).catch(i=>this.showError(`Cannot write object: ${i}`)),onClose:t=>{var i,r;if(t){let o;this.state.editObjectDialog.startsWith("alias.")&&JSON.stringify((i=this.objects[this.state.editObjectDialog].common)==null?void 0:i.alias)!==JSON.stringify((r=t.common)==null?void 0:r.alias)&&(o=this.state.editObjectDialog),this.props.socket.setObject(t._id,t).then(()=>{o&&this.subscribes.includes(o)&&(this.unsubscribe(o),setTimeout(()=>this.subscribe(o),100))}).catch(n=>this.showError(`Cannot write object: ${n}`))}this.setState({editObjectDialog:"",editObjectAlias:!1})},width:this.props.width})}renderViewObjectFileDialog(){if(!this.state.viewFileDialog||!this.props.objectBrowserViewFile)return null;const e=this.props.objectBrowserViewFile;return M.createElement(e,{key:"viewFile",obj:this.objects[this.state.viewFileDialog],socket:this.props.socket,t:this.props.t,onClose:()=>this.setState({viewFileDialog:""})})}renderAliasEditorDialog(){if(!this.props.objectBrowserAliasEditor||!this.state.showAliasEditor)return null;const e=this.props.objectBrowserAliasEditor;return M.createElement(e,{key:"editAlias",obj:this.objects[this.state.showAliasEditor],roleArray:this.info.roles,objects:this.objects,socket:this.props.socket,t:this.props.t,onClose:()=>this.setState({showAliasEditor:""}),onRedirect:(t,i)=>setTimeout(()=>this.onSelect(t,!1,()=>this.expandAllSelected(()=>{this.scrollToItem(t),setTimeout(()=>this.setState({editObjectDialog:t,showAliasEditor:"",editObjectAlias:!0}),300)})),i||0)})}showAddDataPointDialog(e,t,i){this.setState({showContextMenu:null,modalNewObj:{id:e,initialType:t,initialStateType:i}})}renderAliasMenu(){return this.state.aliasMenu?M.createElement(j.Menu,{key:"aliasmenu",open:!0,anchorEl:window.document.getElementById(`alias_${this.state.aliasMenu}`),onClose:()=>this.setState({aliasMenu:""})},this.info.aliasesMap[this.state.aliasMenu].map((e,t)=>M.createElement(j.MenuItem,{key:e,onClick:()=>this.onSelect(e)},M.createElement(j.ListItemText,null,this.renderAliasLink(this.state.aliasMenu,t,{"& .admin-browser-arrow":{mr:"8px"}}))))):null}renderContextMenu(){var L,g,y,T,d,z,I;if(!this.state.showContextMenu)return null;const e=this.state.showContextMenu.item,t=e.data.id,i=[],r=e.data.obj;let o="";if(this.props.objectEditOfAccessControl&&this.state.filter.expertMode)if(!r)o="---";else{const C=r.acl?r.type==="state"?r.acl.state:r.acl.object:0,m=r.acl&&(r.type==="state"?this.systemConfig.common.defaultNewAcl.state:this.systemConfig.common.defaultNewAcl.object);o=Number.isNaN(Number(C))?Number(m).toString(16):Number(C).toString(16)}const n=!this.props.notEditable&&r&&(this.state.filter.expertMode||r.type==="state"||r.type==="channel"||r.type==="device"),a=!e.data.obj||e.data.obj.type==="folder"||e.data.obj.type==="channel"||e.data.obj.type==="device"||e.data.id==="0_userdata.0"||e.data.obj.type==="meta",c=!e.data.obj||e.data.obj.type==="folder"||e.data.obj.type==="device"||e.data.id==="0_userdata.0"||e.data.obj.type==="meta",l=!e.data.obj||e.data.obj.type==="folder"||e.data.id==="0_userdata.0"||e.data.obj.type==="meta",N=!e.data.obj||e.data.obj.type==="folder"||e.data.id==="0_userdata.0"||e.data.obj.type==="meta",u={EDIT:{key:"0",visibility:!!(this.props.objectBrowserEditObject&&r&&(this.state.filter.expertMode||it.isNonExpertId(t))),icon:M.createElement(mi,{fontSize:"small",style:this.styles.contextMenuEdit}),label:this.texts.editObject,onClick:()=>this.setState({editObjectDialog:e.data.id,showContextMenu:null,editObjectAlias:!1})},EDIT_VALUE:{key:"1",visibility:!!(this.states&&!this.props.notEditable&&r&&r.type==="state"&&((L=r.common)==null?void 0:L.type)!=="file"&&(this.state.filter.expertMode||r.common.write!==!1)),icon:M.createElement(jg,{fontSize:"small",style:this.styles.contextMenuEditValue}),label:this.props.t("ra_Edit value"),onClick:()=>{var C;this.edit={val:this.states[t]?this.states[t].val:"",q:((C=this.states[t])==null?void 0:C.q)||0,ack:!1,id:t},this.setState({updateOpened:!0,showContextMenu:null})}},VIEW:{visibility:!!this.props.objectBrowserViewFile&&(r==null?void 0:r.type)==="state"&&((g=r.common)==null?void 0:g.type)==="file",icon:M.createElement(lg,{fontSize:"small",style:this.styles.contextMenuView}),label:this.props.t("ra_View file"),onClick:()=>this.setState({viewFileDialog:(r==null?void 0:r._id)||"",showContextMenu:null})},CUSTOM:{key:"2",visibility:!(this.props.objectCustomDialog&&this.info.hasSomeCustoms&&r&&r.type==="state"&&((y=r.common)==null?void 0:y.type)!=="file"),icon:M.createElement(Nn,{fontSize:"small",style:e.data.hasCustoms?this.styles.cellButtonsButtonWithCustoms:w.cellButtonsButtonWithoutCustoms}),style:this.styles.contextMenuCustom,label:this.texts.customConfig,onClick:()=>{var C;this.pauseSubscribe(!0),(C=this.props.router)==null||C.doNavigate(null,"customs",t),this.setState({customDialog:[t],showContextMenu:null})}},ACL:{key:"3",visibility:!!o,icon:o,iconStyle:{fontSize:"smaller"},listItemIconStyle:this.styles.contextMenuACL,style:this.styles.contextMenuACL,label:this.props.t("ra_Edit ACL"),onClick:()=>this.setState({showContextMenu:null,modalEditOfAccess:!0,modalEditOfAccessObjData:e.data})},ROLE:{key:"4",visibility:!!(this.state.filter.expertMode&&n&&this.props.objectBrowserEditRole),icon:M.createElement(XL,{fontSize:"small",style:this.styles.contextMenuRole}),label:this.props.t("ra_Edit role"),onClick:()=>this.setState({roleDialog:e.data.id,showContextMenu:null})},FUNCTION:{key:"5",visibility:!!n,icon:M.createElement(HL,{fontSize:"small",style:this.styles.contextMenuRole}),label:this.props.t("ra_Edit function"),onClick:()=>{const C=Ds(this.info,e.data.id,"funcEnums");this.setState({enumDialogEnums:C,enumDialog:{item:e,type:"func",enumsOriginal:JSON.stringify(C)},showContextMenu:null})}},ROOM:{key:"6",visibility:!!n,icon:M.createElement(rg,{fontSize:"small",style:this.styles.contextMenuRoom}),label:this.props.t("ra_Edit room"),onClick:()=>{const C=Ds(this.info,e.data.id,"roomEnums");this.setState({enumDialogEnums:C,enumDialog:{item:e,type:"room",enumsOriginal:JSON.stringify(C)},showContextMenu:null})}},ALIAS:{key:"7",visibility:!!(!this.props.notEditable&&this.props.objectBrowserAliasEditor&&this.props.objectBrowserEditObject&&(r==null?void 0:r.type)==="state"&&((T=r.common)==null?void 0:T.type)!=="file"),icon:M.createElement(dN,{style:(d=r==null?void 0:r.common)!=null&&d.alias?this.styles.cellButtonsButtonWithCustoms:w.cellButtonsButtonWithoutCustoms}),label:this.info.aliasesMap[e.data.id]||e.data.id.startsWith("alias.0.")?this.props.t("ra_Edit alias"):this.props.t("ra_Create alias"),onClick:()=>{var C;(C=r==null?void 0:r.common)!=null&&C.alias?this.setState({showContextMenu:null,editObjectDialog:e.data.id,editObjectAlias:!0}):this.setState({showContextMenu:null,showAliasEditor:e.data.id})}},CREATE:{key:"+",visibility:(e.data.id.startsWith("0_userdata.0")||e.data.id.startsWith("javascript."))&&(a||c||l||N),icon:M.createElement(ln,{fontSize:"small",style:this.styles.cellButtonsButtonWithCustoms}),style:w.contextMenuWithSubMenu,label:this.texts.create,subMenu:[{label:this.texts.createBooleanState,visibility:a,icon:M.createElement(Ai,{fontSize:"small"}),onClick:()=>this.showAddDataPointDialog(e.data.id,"state","boolean")},{label:this.texts.createNumberState,visibility:a,icon:M.createElement(Ai,{fontSize:"small"}),onClick:()=>this.showAddDataPointDialog(e.data.id,"state","number")},{label:this.texts.createStringState,visibility:a,icon:M.createElement(Ai,{fontSize:"small"}),onClick:()=>this.showAddDataPointDialog(e.data.id,"state","string")},{label:this.texts.createState,visibility:a,icon:M.createElement(Ai,{fontSize:"small"}),onClick:()=>this.showAddDataPointDialog(e.data.id,"state")},{label:this.texts.createChannel,visibility:c,icon:M.createElement(E4,{fontSize:"small"}),onClick:()=>this.showAddDataPointDialog(e.data.id,"channel")},{label:this.texts.createDevice,visibility:l,icon:M.createElement(f4,{fontSize:"small"}),onClick:()=>this.showAddDataPointDialog(e.data.id,"device")},{label:this.texts.createFolder,icon:M.createElement(yN,{fontSize:"small"}),visibility:N,onClick:()=>this.showAddDataPointDialog(e.data.id,"folder")}]},RENAME:{key:"8",visibility:!!(!this.props.notEditable&&this.props.objectMoveRenameDialog&&!e.data.id.startsWith("system.")&&e.data.id.split(".").length>2&&(this.props.expertMode||e.data.id.startsWith("javascript.0.")||e.data.id.startsWith("0_userdata.0."))),icon:M.createElement(Mg,null),label:this.props.t("ra_Rename_Move_Copy"),onClick:()=>{const C=Object.keys(this.objects),m=`${e.data.id}.`;this.setState({showContextMenu:null,showRenameDialog:{id:e.data.id,childrenIds:C.filter(A=>A.startsWith(m))}})}},DELETE:{key:"Delete",visibility:!!(this.props.onObjectDelete&&((z=e.children)!=null&&z.length||r&&!((I=r.common)!=null&&I.dontDelete))),icon:M.createElement(nt,{fontSize:"small",style:this.styles.contextMenuDelete}),style:this.styles.contextMenuDelete,label:this.texts.deleteObject,onClick:()=>this.setState({showContextMenu:null},()=>this.showDeleteDialog({id:t,obj:r||{},item:e}))}};return Object.keys(u).forEach(C=>{var m,A;u[C].visibility&&(u[C].subMenu?(i.push(M.createElement(j.MenuItem,{key:C,href:"",onClick:D=>this.state.showContextMenu&&this.setState({showContextMenu:{item:this.state.showContextMenu.item,position:this.state.showContextMenu.position,subItem:C,subAnchor:D.target}}),style:u[C].style},M.createElement(j.ListItemIcon,{style:{...u[C].iconStyle,...u[C].listItemIconStyle}},u[C].icon),M.createElement(j.ListItemText,null,u[C].label,"..."),M.createElement("div",{style:{...w.contextMenuKeys,opacity:1}},M.createElement(FL,null)))),((m=this.state.showContextMenu)==null?void 0:m.subItem)===C&&i.push(M.createElement(j.Menu,{key:"subContextMenu",open:!0,anchorEl:this.state.showContextMenu.subAnchor,onClose:()=>{this.state.showContextMenu&&this.setState({showContextMenu:{item:this.state.showContextMenu.item,position:this.state.showContextMenu.position}}),this.contextMenu=null}},(A=u[C].subMenu)==null?void 0:A.map(D=>D.visibility?M.createElement(j.MenuItem,{key:D.label,onClick:D.onClick,style:D.style},M.createElement(j.ListItemIcon,{style:{...D.iconStyle,...D.listItemIconStyle||void 0}},D.icon),M.createElement(j.ListItemText,null,D.label)):null)))):i.push(M.createElement(j.MenuItem,{key:C,onClick:u[C].onClick,sx:u[C].style},M.createElement(j.ListItemIcon,{style:{...u[C].iconStyle,...u[C].listItemIconStyle}},u[C].icon),M.createElement(j.ListItemText,null,u[C].label),u[C].key?M.createElement("div",{style:w.contextMenuKeys},`Alt+${u[C].key==="Delete"?this.props.t("ra_Del"):u[C].key}`):null)))}),i.length?M.createElement(j.Menu,{key:"contextMenu",open:!0,onKeyUp:C=>{C.preventDefault(),C.altKey&&Object.keys(u).forEach(m=>{C.key===u[m].key&&u[m].onClick&&u[m].onClick()})},anchorReference:"anchorPosition",anchorPosition:this.state.showContextMenu.position,onClose:()=>{this.setState({showContextMenu:null}),this.contextMenu=null}},i):(setTimeout(()=>this.setState({showContextMenu:null}),100),null)}renderEditValueDialog(){var r;if(!this.state.updateOpened||!this.props.objectBrowserValue)return null;if(!this.edit.id)return console.error(`Invalid ID for edit: ${JSON.stringify(this.edit)}`),null;if(!this.objects[this.edit.id])return console.error(`Something went wrong. Possibly the object ${this.edit.id} was deleted.`),null;const e=(r=this.objects[this.edit.id].common)!=null&&r.type?this.objects[this.edit.id].common.type:typeof this.edit.val,t=this.objects[this.edit.id].common.role,i=this.props.objectBrowserValue;return M.createElement(i,{t:this.props.t,lang:this.props.lang,type:e,role:t||"",states:O.getStates(this.objects[this.edit.id]),themeType:this.props.themeType,theme:this.props.theme,expertMode:!!this.state.filter.expertMode,value:this.edit.val,socket:this.props.socket,object:this.objects[this.edit.id],defaultHistory:this.defaultHistory,dateFormat:this.props.dateFormat||this.systemConfig.common.dateFormat,isFloatComma:this.props.isFloatComma===void 0?this.systemConfig.common.isFloatComma:this.props.isFloatComma,onClose:o=>{this.setState({updateOpened:!1}),o&&this.onUpdate(o)},width:this.props.width})}render(){this.recordStates=[],this.unsubscribeTimer&&clearTimeout(this.unsubscribeTimer),this.styleTheme!==this.props.themeType&&(this.styles={cellIdIconFolder:O.getStyle(this.props.theme,w.cellIdIconFolder),cellIdIconDocument:O.getStyle(this.props.theme,w.cellIdIconDocument),iconDeviceError:O.getStyle(this.props.theme,w.iconDeviceError),iconDeviceConnected:O.getStyle(this.props.theme,w.iconDeviceConnected),iconDeviceDisconnected:O.getStyle(this.props.theme,w.iconDeviceDisconnected),cellButtonsButtonWithCustoms:O.getStyle(this.props.theme,w.cellButtonsButtonWithCustoms),invertedBackground:O.getStyle(this.props.theme,w.invertedBackground),invertedBackgroundFlex:O.getStyle(this.props.theme,w.invertedBackgroundFlex),contextMenuEdit:O.getStyle(this.props.theme,w.contextMenuEdit),contextMenuEditValue:O.getStyle(this.props.theme,w.contextMenuEditValue),contextMenuView:O.getStyle(this.props.theme,w.contextMenuView),contextMenuCustom:O.getStyle(this.props.theme,w.contextMenuCustom),contextMenuACL:O.getStyle(this.props.theme,w.contextMenuACL),contextMenuRoom:O.getStyle(this.props.theme,w.contextMenuRoom),contextMenuRole:O.getStyle(this.props.theme,w.contextMenuRole),contextMenuDelete:O.getStyle(this.props.theme,w.contextMenuDelete),filterInput:O.getStyle(this.props.theme,w.headerCellInput,w.filterInput),iconCopy:O.getStyle(this.props.theme,w.cellButtonsValueButton,w.cellButtonsValueButtonCopy),aliasReadWrite:O.getStyle(this.props.theme,w.cellIdAlias,w.cellIdAliasReadWrite),aliasAlone:O.getStyle(this.props.theme,w.cellIdAlias,w.cellIdAliasAlone)},this.styleTheme=this.props.themeType);const e=JSON.stringify(this.state.filter);if(this.lastAppliedFilter!==e&&this.objects&&this.root){const i={count:0};Hn(this.root,this.state.filter,this.props.lang,this.objects,void 0,i,this.props.customFilter,this.props.types),i.count<500&&!this.state.expandAllVisible?setTimeout(()=>this.setState({expandAllVisible:!0})):i.count>=500&&this.state.expandAllVisible&&setTimeout(()=>this.setState({expandAllVisible:!1})),this.lastAppliedFilter=e}if(this.unsubscribeTimer=setTimeout(()=>{this.unsubscribeTimer=null,this.checkUnsubscribes()},200),!this.state.loaded)return M.createElement(j.CircularProgress,{key:`${this.props.dialogName}_c`});const t=this.root?this.renderItem(this.root,void 0):null;return M.createElement(oSe,{key:this.props.dialogName},M.createElement("style",null,`
450
450
  @keyframes newValueAnimation-light {
451
451
  0% {
@@ -479,7 +479,7 @@ body {
479
479
  text-decoration: underline;
480
480
  cursor: pointer;
481
481
  }
482
- `),M.createElement(aSe,null,this.getToolbar()),M.createElement(nSe,null,this.renderHeader(),M.createElement(j.Box,{style:w.tableDiv,ref:this.tableRef,onKeyDown:i=>this.navigateKeyPress(i)},t)),this.renderContextMenu(),this.renderAliasMenu(),this.renderToast(),this.renderColumnsEditCustomDialog(),this.renderColumnsSelectorDialog(),this.renderCustomDialog(),this.renderEditValueDialog(),this.renderEditObjectDialog(),this.renderViewObjectFileDialog(),this.renderAliasEditorDialog(),this.renderEditRoleDialog(),this.renderEnumDialog(),this.renderErrorDialog(),this.renderExportDialog(),this.renderRenameDialog(),this.state.modalNewObj&&this.props.modalNewObject&&this.props.modalNewObject(this),this.state.modalEditOfAccess&&this.state.modalEditOfAccessObjData&&this.props.modalEditOfAccessControl&&this.props.modalEditOfAccessControl(this,this.state.modalEditOfAccessObjData))}}const ySe=Io()(it);class e5e extends M.Component{refTypo;height;width;constructor(e){super(e),this.state={closed:this.props.storeId?window.localStorage.getItem(this.props.storeId)==="true":!1},this.height=0,this.width=0,this.refTypo=M.createRef()}componentDidMount(){this.detectHeight()}onClick(){this.props.storeId&&this.props.closed===void 0&&(this.state.closed?window.localStorage.removeItem(this.props.storeId):window.localStorage.setItem(this.props.storeId,"true")),this.props.closed===void 0?this.setState({closed:!this.state.closed},()=>{this.props.onClose&&this.props.onClose(this.state.closed)}):this.props.onClose&&this.props.onClose(!this.props.closed)}detectHeight(){const e=this.props.closed!==void 0?this.props.closed:this.state.closed;this.props.closeable&&!e&&this.refTypo.current&&window.requestAnimationFrame(()=>{(this.props.closed!==void 0?this.props.closed:this.state.closed)||this.refTypo.current&&(!this.height||this.width!==this.refTypo.current.clientWidth)&&(this.height=this.refTypo.current.clientHeight,this.width=this.refTypo.current.clientWidth,this.forceUpdate())})}componentDidUpdate(){this.detectHeight()}render(){const e=this.props.closed!==void 0?this.props.closed:this.state.closed,t=e?kg:Ne;return M.createElement(j.Box,{className:"iom-info-box",style:{whiteSpace:"preserve",display:"flex",gap:8,alignItems:e||this.props.iconPosition==="top"?"flex-start":"center",borderWidth:1,borderStyle:"solid",padding:4,borderRadius:5,marginBottom:8,maxWidth:"100%",transition:"height 0.5s",height:this.props.closeable?e?30:this.height||void 0:void 0,overflow:this.props.closeable?"hidden":void 0,position:"relative",...this.props.style},sx:{borderColor:i=>this.props.type==="ok"?i.palette.info.main:i.palette[this.props.type].main}},this.props.type==="ok"?M.createElement(Oe,{style:{color:"#0F0"}}):this.props.type==="info"?M.createElement(Na,{color:"primary"}):M.createElement(Yg,{color:this.props.type}),M.createElement(j.Typography,{ref:this.refTypo},this.props.children),this.props.closeable?M.createElement(t,{sx:{color:i=>i.palette.mode==="dark"?"lightgray":"gray",cursor:"pointer",position:"absolute",top:4,right:4},onClick:()=>this.onClick()}):null,this.props.closeable?M.createElement("div",{style:{width:22}}):null,e?M.createElement(j.Box,{component:"div",sx:i=>{const r=i.palette[this.props.type==="ok"?"info":this.props.type].main;return{background:`linear-gradient(${r}00 0%, ${r}10 60%, ${r}90 100%)`}},style:{bottom:0,position:"absolute",left:0,right:0,height:10}}):null)}}const E={hr:{border:0,borderTop:"1px solid gray"},scrollWindow:{width:"100%",overflow:"auto",height:"calc(100% - 22px)"},rowDiv:{width:"100%"},modeDiv:{width:200,display:"inline-block",verticalAlign:"top"},settingsDiv:{display:"inline-block",verticalAlign:"top"},inputTime:{width:90,marginTop:0,marginLeft:5},inputDate:{width:140,marginTop:0,marginLeft:5},inputEvery:{width:40,marginLeft:5,marginRight:5},inputRadio:{padding:"4px 12px",verticalAlign:"top"},inputGroup:{maxWidth:400,display:"inline-block"},inputGroupElement:{width:120},inputDateDay:{width:60},inputDateDayCheck:{padding:4},inputSmallCheck:{padding:0},rowOnce:{},rowDays:s=>({background:s.palette.mode!=="dark"?"#ddeaff":"#4b5057"}),rowDows:s=>({background:s.palette.mode!=="dark"?"#DDFFDD":"#52646c"}),rowMonths:s=>({background:s.palette.mode!=="dark"?"#DDFFFF":"#1f5557"}),rowMonthsDates:s=>({background:s.palette.mode!=="dark"?"#EEFFFF":"#3c5737",maxWidth:600}),rowYears:s=>({background:s.palette.mode!=="dark"?"#fbffdd":"#574b33"}),rowDowsDows:s=>({background:s.palette.mode!=="dark"?"#EEFFEE":"#3d4c54",pl:"10px",pb:"10px"})},tn=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],zr=["January","February","March","April","May","June","July","August","September","October","November","December"],sn={minutes:"minutes",hours:"hours"},ji=["sunrise","sunriseEnd","goldenHourEnd","solarNoon","goldenHour","sunsetStart","sunset","dusk","nauticalDusk","night","nightEnd","nauticalDawn","dawn","nadir"];function gt(s){return s<10?`0${s}`:`${s}`}const Rl={time:{exactTime:!1,start:"00:00",end:"23:59",mode:"hours",interval:1},period:{once:"",days:1,dows:"",dates:"",weeks:0,months:"",years:0,yearMonth:0,yearDate:0},valid:{from:"",to:""}};function rn(s){const e=s.split(".");return e.length===3?`${e[2]}-${e[1]}-${e[0]}`:""}class De extends f.Component{refFrom;refTo;refOnce;timerOnce=null;timerFrom=null;timerTo=null;constructor(e){super(e);let t;if(this.props.schedule&&typeof this.props.schedule=="string"&&this.props.schedule[0]==="{")try{t=JSON.parse(this.props.schedule)}catch{}else typeof this.props.schedule=="object"&&(t=this.props.schedule);(!t||!Object.keys(t).length)&&(setTimeout(()=>this.onChange(this.state.schedule,!0),200),t=Rl),t={...Rl,...t},t.valid.from||=De.now2string(),this.refFrom=M.createRef(),this.refTo=M.createRef(),this.refOnce=M.createRef(),this.state={schedule:t,desc:De.state2text(t)},JSON.stringify(t)!==this.props.schedule&&setTimeout(()=>{var i,r;return(r=(i=this.props).onChange)==null?void 0:r.call(i,JSON.stringify(t))},100)}onChange(e,t){var r,o;const i=JSON.stringify(e)!==JSON.stringify(this.state.schedule);if(t||i){i&&this.setState({schedule:e,desc:De.state2text(e)});const n=JSON.parse(JSON.stringify(e));if(n.period.once){const a=n.period.once;delete n.period,n.period={once:a},delete n.valid}else if(n.period.days){const a=n.period.days,c=n.period.dows;delete n.period,n.period={days:a},c&&c!=="[]"&&(n.period.dows=c)}else if(n.period.weeks){const a=n.period.weeks,c=n.period.dows;delete n.period,n.period={weeks:a},c&&c!=="[]"&&(n.period.dows=c)}else if(n.period.months){const a=n.period.months,c=n.period.dates;delete n.period,n.period={months:a},c&&c!=="[]"&&(n.period.dates=c)}else if(n.period.years){const a=n.period.years,c=n.period.yearMonth,l=n.period.yearDate;delete n.period,n.period={years:a,yearDate:l},c&&(n.period.yearMonth=c)}if(n.time.exactTime?(delete n.time.end,delete n.time.mode,delete n.time.interval):delete n.time.exactTime,n.valid){if(n.valid.to||delete n.valid.to,n.period.days===1||n.period.weeks===1||n.period.months===1||n.period.years===1){const a=De.string2date(n.valid.from),c=new Date;c.setHours(0),c.setMinutes(0),c.setSeconds(0),c.setMilliseconds(0),a<=c&&delete n.valid.from}!n.valid.from&&!n.valid.to&&delete n.valid}(o=(r=this.props).onChange)==null||o.call(r,JSON.stringify(n),De.state2text(e))}}static state2text(e){if(typeof e=="string")try{e=JSON.parse(e)}catch{return""}const t=[],i=De.string2date(e.valid.from);if(e.period.once){const r=De.string2date(e.period.once),o=new Date;if(o.setMilliseconds(0),o.setSeconds(0),o.setMinutes(0),o.setHours(0),r<o)return h.t("sch_desc_onceInPast");t.push(h.t("sch_desc_once_on",e.period.once))}else if(e.period.days)if(e.period.days===1)if(e.period.dows){const r=JSON.parse(e.period.dows);if(r.length===2&&r[0]===0&&r[1]===6)t.push(h.t("sch_desc_onWeekends"));else if(r.length===5&&r[0]===1&&r[1]===2&&r[2]===3&&r[3]===4&&r[4]===5)t.push(h.t("sch_desc_onWorkdays"));else{const o=r.map(n=>h.t(tn[n]));if(o.length===1)t.push(h.t("sch_desc_onWeekday",o[0]));else if(o.length===7)t.push(h.t("sch_desc_everyDay"));else{const n=o.pop();t.push(h.t("sch_desc_onWeekdays",o.join(", "),n))}}}else t.push(h.t("sch_desc_everyDay"));else t.push(h.t("sch_desc_everyNDay",e.period.days.toString()));else if(e.period.weeks)if(e.period.weeks===1?t.push(h.t("sch_desc_everyWeek")):t.push(h.t("sch_desc_everyNWeeks",e.period.weeks.toString())),e.period.dows){const r=JSON.parse(e.period.dows);if(r.length===2&&r[0]===0&&r[1]===6)t.push(h.t("sch_desc_onWeekends"));else if(r.length===5&&r[0]===1&&r[1]===2&&r[2]===3&&r[3]===4&&r[4]===5)t.push(h.t("sch_desc_onWorkdays"));else{const o=r.map(n=>h.t(tn[n]));if(o.length===1)t.push(h.t("sch_desc_onWeekday",o[0]));else if(o.length===7)t.push(h.t("sch_desc_everyDay"));else{const n=o.pop();t.push(h.t("sch_desc_onWeekdays",o.join(", "),n))}}}else return h.t("sch_desc_never");else if(e.period.months){if(e.period.dates){const r=JSON.parse(e.period.dates);if(r.length===1)t.push(h.t("sch_desc_onDate",r[0]));else if(r.length===31)t.push(h.t("sch_desc_onEveryDate"));else if(r.length){const o=r.pop();t.push(h.t("sch_desc_onDates",r.join(", "),o))}else return h.t("sch_desc_never")}else t.push(h.t("sch_desc_onEveryDate"));if(e.period.months===1)t.push(h.t("sch_desc_everyMonth"));else if(typeof e.period.months=="number")t.push(h.t("sch_desc_everyNMonths",e.period.months.toString()));else{const o=JSON.parse(e.period.months).map(n=>h.t(zr[n-1]));if(!o.length)return h.t("sch_desc_never");if(o.length===1)t.push(h.t("sch_desc_onMonth",o[0]));else if(o.length===12)t.push(h.t("sch_desc_everyMonth"));else{const n=o.pop();t.push(h.t("sch_desc_onMonths",o.join(", "),n))}}}else e.period.years&&(e.period.years===1?t.push(h.t("sch_desc_everyYear")):t.push(h.t("sch_desc_everyNYears",e.period.years.toString())),t.push(h.t("sch_desc_onDate",e.period.yearDate.toString(),e.period.yearMonth?h.t(zr[e.period.yearMonth-1]):h.t("sch_desc_everyMonth"))));if(e.time.exactTime)ji.includes(e.time.start)?t.push(h.t("sch_desc_atTime",h.t(`sch_astro_${e.time.start}`))):t.push(h.t("sch_desc_atTime",e.time.start));else{e.time.mode===sn.minutes?e.time.interval===1?t.push(h.t("sch_desc_everyMinute")):t.push(h.t("sch_desc_everyNMinutes",e.time.interval.toString())):e.time.interval===1?t.push(h.t("sch_desc_everyHour")):t.push(h.t("sch_desc_everyNHours",e.time.interval.toString()));const r=ji.indexOf(e.time.start)!==-1?h.t(`sch_astro_${e.time.start}`):e.time.start,o=ji.indexOf(e.time.end)!==-1?h.t(`sch_astro_${e.time.end}`):e.time.end;(r!=="00:00"||o!=="24:00"&&o!=="23:59")&&t.push(h.t("sch_desc_intervalFromTo",r,o))}return e.period.once||(i.getTime()>Date.now()&&e.valid.to?t.push(h.t("sch_desc_validFromTo",e.valid.from,e.valid.to)):i.getTime()>Date.now()?t.push(h.t("sch_desc_validFrom",e.valid.from)):e.valid.to&&t.push(h.t("sch_desc_validTo",e.valid.to))),t.join(" ")}getTimePeriodElements(){const e=this.state.schedule;let t=!1,i=!1,r=!1,o=!0;return e.time.start==="00:00"&&e.time.end==="24:00"?(t=!0,o=!1):e.time.start==="sunrise"?(i=!0,o=!1):e.time.start==="sunset"&&(r=!0,o=!1),M.createElement("div",{key:"timePeriod",style:E.rowDiv},M.createElement("div",{style:E.modeDiv},M.createElement(j.FormControlLabel,{control:M.createElement(j.Radio,{style:E.inputRadio,checked:!e.time.exactTime,onClick:()=>{const n=JSON.parse(JSON.stringify(this.state.schedule));n.time.exactTime=!1,this.onChange(n)}}),label:h.t("sch_intervalTime")})),M.createElement("div",{style:E.settingsDiv},M.createElement("div",{style:E.settingsDiv},!e.time.exactTime&&M.createElement("div",null,M.createElement("div",null,M.createElement(j.FormControlLabel,{control:M.createElement(j.Radio,{style:E.inputRadio,checked:!!o,onClick:()=>{const n=JSON.parse(JSON.stringify(this.state.schedule));n.time.start="00:00",n.time.end="23:59",this.onChange(n)}}),label:o?"":h.t("sch_fromTo")}),o&&[M.createElement(j.TextField,{variant:"standard",style:{...E.inputTime,marginRight:10},key:"exactTimeFrom",type:"time",sx:n=>({'& input[type="time"]::-webkit-calendar-picker-indicator':{filter:n.palette.mode==="dark"?"invert(80%)":void 0}}),value:this.state.schedule.time.start,onChange:n=>{const a=JSON.parse(JSON.stringify(this.state.schedule));a.time.start=n.target.value,this.onChange(a)},slotProps:{inputLabel:{shrink:!0}},label:h.t("sch_from"),margin:"normal"}),M.createElement(j.TextField,{variant:"standard",style:E.inputTime,key:"exactTimeTo",type:"time",sx:n=>({'& input[type="time"]::-webkit-calendar-picker-indicator':{filter:n.palette.mode==="dark"?"invert(80%)":void 0}}),value:this.state.schedule.time.end,onChange:n=>{const a=JSON.parse(JSON.stringify(this.state.schedule));a.time.end=n.target.value,this.onChange(a)},slotProps:{inputLabel:{shrink:!0}},label:h.t("sch_to"),margin:"normal"})])),!e.time.exactTime&&M.createElement("div",null,M.createElement(j.FormControlLabel,{control:M.createElement(j.Radio,{style:E.inputRadio,checked:!!t,onClick:()=>{const n=JSON.parse(JSON.stringify(this.state.schedule));n.time.start="00:00",n.time.end="24:00",this.onChange(n)}}),label:h.t("sch_wholeDay")})),!e.time.exactTime&&M.createElement("div",null,M.createElement(j.FormControlLabel,{control:M.createElement(j.Radio,{style:E.inputRadio,checked:!!i,onClick:()=>{const n=JSON.parse(JSON.stringify(this.state.schedule));n.time.start="sunrise",n.time.end="sunset",this.onChange(n)}}),label:h.t("sch_astroDay")})),!e.time.exactTime&&M.createElement("div",null,M.createElement(j.FormControlLabel,{control:M.createElement(j.Radio,{style:E.inputRadio,checked:!!r,onClick:()=>{const n=JSON.parse(JSON.stringify(this.state.schedule));n.time.start="sunset",n.time.end="sunrise",this.onChange(n)}}),label:h.t("sch_astroNight")}))),!e.time.exactTime&&this.getPeriodSettingsMinutes(o)))}getTimeExactElements(){const e=ji.includes(this.state.schedule.time.start);return M.createElement("div",{key:"timeExact",style:E.rowDiv},M.createElement("div",{style:E.modeDiv},M.createElement(j.FormControlLabel,{control:M.createElement(j.Radio,{style:E.inputRadio,checked:!!this.state.schedule.time.exactTime,onClick:()=>{const t=JSON.parse(JSON.stringify(this.state.schedule));t.time.exactTime=!0,this.onChange(t)}}),label:h.t("sch_exactTime")})),this.state.schedule.time.exactTime&&M.createElement(j.Select,{variant:"standard",value:e?this.state.schedule.time.start:"00:00",onChange:t=>{const i=JSON.parse(JSON.stringify(this.state.schedule));i.time.start=t.target.value,this.onChange(i)}},M.createElement(j.MenuItem,{key:"specific",value:"00:00"},h.t("sch_specificTime")),ji.map(t=>M.createElement(j.MenuItem,{key:t,value:t},h.t(`sch_astro_${t}`)))),this.state.schedule.time.exactTime&&!e&&M.createElement("div",{style:E.settingsDiv},M.createElement(j.TextField,{variant:"standard",style:E.inputTime,key:"exactTimeValue",value:this.state.schedule.time.start,type:"time",sx:t=>({'& input[type="time"]::-webkit-calendar-picker-indicator':{filter:t.palette.mode==="dark"?"invert(80%)":void 0}}),onChange:t=>{const i=JSON.parse(JSON.stringify(this.state.schedule));i.time.start=t.target.value,this.onChange(i)},slotProps:{inputLabel:{shrink:!0}},margin:"normal"})))}static getDivider(){return M.createElement("hr",{style:E.hr})}getPeriodModes(){const e=this.state.schedule,t=!e.period.dows&&!e.period.months&&!e.period.dates&&!e.period.years&&!e.period.days&&!e.period.weeks;return t&&!e.period.once&&(e.period.once=De.now2string(!0)),[M.createElement("div",{key:"once",style:{...E.rowDiv,...E.rowOnce}},M.createElement("div",{style:E.modeDiv},M.createElement(j.FormControlLabel,{control:M.createElement(j.Radio,{style:E.inputRadio,checked:!!t,onClick:()=>{const i=JSON.parse(JSON.stringify(this.state.schedule));i.period.once||=De.now2string(!0),i.period.dows="",i.period.months="",i.period.dates="",i.period.years=0,i.period.yearDate=0,i.period.yearMonth=0,i.period.weeks=0,i.period.days=0,this.onChange(i)}}),label:h.t("sch_periodOnce")})),t&&M.createElement("div",{style:E.settingsDiv},M.createElement(j.TextField,{variant:"standard",style:E.inputDate,type:"date",ref:this.refOnce,key:"exactDateAt",defaultValue:rn(e.period.once),onChange:i=>{this.timerOnce&&clearTimeout(this.timerOnce),this.timerOnce=null,this.refOnce.current&&(this.refOnce.current.style.background="#ff000030"),this.timerOnce=setTimeout(r=>{this.timerOnce=null,this.refOnce.current&&(this.refOnce.current.style.background="");const o=JSON.parse(JSON.stringify(this.state.schedule)),n=De.string2date(r);n.toString()!=="Invalid Date"&&(o.period.once=`${gt(n.getDate())}.${gt(n.getMonth()+1)}.${n.getFullYear()}`,this.onChange(o))},1500,i.target.value)},slotProps:{inputLabel:{shrink:!0}},label:h.t("sch_at"),margin:"normal"}))),M.createElement(j.Box,{component:"div",key:"days",sx:O.getStyle(this.props.theme,E.rowDiv,E.rowDays)},M.createElement("div",{style:E.modeDiv},M.createElement(j.FormControlLabel,{control:M.createElement(j.Radio,{style:E.inputRadio,checked:!!e.period.days,onClick:()=>{const i=JSON.parse(JSON.stringify(this.state.schedule));i.period.days=1,i.period.dows="",i.period.months="",i.period.dates="",i.period.years=0,i.period.yearDate=0,i.period.yearMonth=0,i.period.weeks=0,i.period.once="",this.onChange(i)}}),label:h.t("sch_periodDaily")})),M.createElement("div",{style:E.settingsDiv},this.getPeriodSettingsDaily(),e.period.days?this.getPeriodSettingsWeekdays():null)),M.createElement(j.Box,{component:"div",key:"weeks",sx:O.getStyle(this.props.theme,E.rowDiv,E.rowDows)},M.createElement("div",{style:E.modeDiv},M.createElement(j.FormControlLabel,{control:M.createElement(j.Radio,{style:E.inputRadio,checked:!!e.period.weeks,onClick:()=>{const i=JSON.parse(JSON.stringify(this.state.schedule));i.period.weeks=e.period.weeks?0:1,i.period.dows||="[0]",i.period.months="",i.period.dates="",i.period.years=0,i.period.yearDate=0,i.period.yearMonth=0,i.period.days=0,i.period.once="",this.onChange(i)}}),label:h.t("sch_periodWeekly")})),M.createElement(j.Box,{component:"div",style:E.settingsDiv},M.createElement("div",{style:E.settingsDiv},this.getPeriodSettingsWeekly()),M.createElement(j.Box,{component:"div",sx:O.getStyle(this.props.theme,E.settingsDiv,E.rowDowsDows)},this.state.schedule.period.weeks?this.getPeriodSettingsWeekdays():null))),M.createElement(j.Box,{component:"div",key:"months",sx:O.getStyle(this.props.theme,E.rowDiv,E.rowMonths)},M.createElement("div",{style:E.modeDiv},M.createElement(j.FormControlLabel,{control:M.createElement(j.Radio,{style:E.inputRadio,checked:!!e.period.months,onClick:()=>{const i=JSON.parse(JSON.stringify(this.state.schedule));i.period.months=1,i.period.dows="",i.period.dates="",i.period.years=0,i.period.yearDate=0,i.period.yearMonth=0,i.period.weeks=0,i.period.days=0,i.period.once="",this.onChange(i)}}),label:h.t("sch_periodMonthly")})),M.createElement("div",{style:E.settingsDiv},this.getPeriodSettingsMonthly(),e.period.months?M.createElement(j.Box,null,M.createElement(j.Box,{component:"div",sx:O.getStyle(this.props.theme,E.settingsDiv,E.rowMonthsDates)},M.createElement(j.FormControlLabel,{control:M.createElement(j.Checkbox,{style:E.inputRadio,checked:!!e.period.dates,onClick:()=>{const i=JSON.parse(JSON.stringify(this.state.schedule));i.period.months||=1;const r=[];for(let o=1;o<=31;o++)r.push(o);i.period.dates||=JSON.stringify(r),i.period.dows="",i.period.years=0,i.period.yearDate=0,i.period.yearMonth=0,i.period.weeks=0,i.period.days=0,i.period.once="",this.onChange(i)}}),label:h.t("sch_periodDates")})),M.createElement(j.Box,{component:"div",sx:O.getStyle(this.props.theme,E.settingsDiv,E.rowMonthsDates)},this.getPeriodSettingsDates())):null)),M.createElement(j.Box,{component:"div",key:"years",sx:O.getStyle(this.props.theme,E.rowDiv,E.rowYears)},M.createElement("div",{style:E.modeDiv},M.createElement(j.FormControlLabel,{control:M.createElement(j.Radio,{style:E.inputRadio,checked:!!e.period.years,onClick:()=>{const i=JSON.parse(JSON.stringify(this.state.schedule));i.period.years=1,i.period.yearDate=1,i.period.yearMonth=1,i.period.dows="",i.period.months=0,i.period.dates="",i.period.weeks=0,i.period.days=0,i.period.once="",this.onChange(i)}}),label:h.t("sch_periodYearly")})),M.createElement("div",{style:E.settingsDiv},M.createElement("div",{style:E.settingsDiv},this.getPeriodSettingsYearly()),!!e.period.years&&M.createElement("div",{style:E.settingsDiv},M.createElement("span",null,h.t("sch_on")),M.createElement(j.Input,{key:"input",value:this.state.schedule.period.yearDate,style:E.inputEvery,type:"number",inputProps:{min:1,max:31},onChange:i=>{const r=JSON.parse(JSON.stringify(this.state.schedule));r.period.yearDate=parseInt(i.target.value,10),r.period.yearDate<1&&(r.period.yearDate=31),r.period.yearDate>31&&(r.period.yearDate=1),this.onChange(r)}}),M.createElement(j.Select,{variant:"standard",value:e.period.yearMonth,onChange:i=>{const r=JSON.parse(JSON.stringify(this.state.schedule));r.period.yearMonth=i.target.value,this.onChange(r)}},M.createElement(j.MenuItem,{key:"every",value:0},h.t("sch_yearEveryMonth")),zr.map((i,r)=>M.createElement(j.MenuItem,{key:i,value:r+1},h.t(i)))))))]}getPeriodSettingsMinutes(e){return M.createElement("div",{style:{display:"inline-block",marginTop:e?15:"inherit"}},M.createElement("label",{style:{marginLeft:4,marginRight:4}},h.t("sch_every")),M.createElement(j.Input,{value:this.state.schedule.time.interval,style:{...E.inputEvery,verticalAlign:"bottom"},type:"number",inputProps:{min:1},onChange:t=>{const i=JSON.parse(JSON.stringify(this.state.schedule));i.time.interval=parseInt(t.target.value,10),this.onChange(i)}}),M.createElement(j.Select,{variant:"standard",value:this.state.schedule.time.mode,onChange:t=>{const i=JSON.parse(JSON.stringify(this.state.schedule));i.time.mode=t.target.value,this.onChange(i)}},M.createElement(j.MenuItem,{value:sn.minutes},h.t("sch_periodMinutes")),M.createElement(j.MenuItem,{value:sn.hours},h.t("sch_periodHours"))))}getPeriodSettingsWeekdays(){const e=this.state.schedule,t=e.period.dows&&e.period.dows!=="[1, 2, 3, 4, 5]"&&e.period.dows!=="[0, 6]";return[M.createElement("div",{key:"workdays"},M.createElement(j.FormControlLabel,{control:M.createElement(j.Radio,{style:E.inputRadio,checked:e.period.dows==="[1, 2, 3, 4, 5]",onClick:()=>{const i=JSON.parse(JSON.stringify(this.state.schedule));i.period.dows="[1, 2, 3, 4, 5]",i.period.days&&(i.period.days=1),this.onChange(i)}}),label:h.t("sch_periodWorkdays")})),M.createElement("div",{key:"weekend"},M.createElement(j.FormControlLabel,{control:M.createElement(j.Radio,{style:E.inputRadio,checked:e.period.dows==="[0, 6]",onClick:()=>{const i=JSON.parse(JSON.stringify(this.state.schedule));i.period.dows="[0, 6]",i.period.days&&(i.period.days=1),this.onChange(i)}}),label:h.t("sch_periodWeekend")})),M.createElement("div",{key:"specific",style:{verticalAlign:"top"}},M.createElement(j.FormControlLabel,{style:{verticalAlign:"top"},control:M.createElement(j.Radio,{style:E.inputRadio,checked:!!t,onClick:()=>{const i=JSON.parse(JSON.stringify(this.state.schedule));i.period.dows="[0, 1, 2, 3, 4, 5, 6]",i.period.days&&(i.period.days=1),this.onChange(i)}}),label:h.t("sch_periodWeekdays")}),t&&(e.period.days===1||e.period.weeks)&&M.createElement(j.FormGroup,{row:!0,style:{...E.inputGroup,width:150}},[1,2,3,4,5,6,0].map(i=>M.createElement(j.FormControlLabel,{key:`specific_${i}`,style:E.inputGroupElement,control:M.createElement(j.Checkbox,{style:E.inputSmallCheck,checked:e.period.dows.includes(i.toString()),onChange:r=>{const o=JSON.parse(JSON.stringify(this.state.schedule));let n;try{n=JSON.parse(o.period.dows)}catch{n=[]}r.target.checked&&!n.includes(i)?n.push(i):!r.target.checked&&n.includes(i)&&n.splice(n.indexOf(i),1),n.sort((a,c)=>a-c),o.period.dows=JSON.stringify(n),o.period.days&&(o.period.days=1),this.onChange(o)}}),label:h.t(tn[i])}))))]}getPeriodSettingsDaily(){if(!this.state.schedule.period.days)return null;const e=this.state.schedule;return[M.createElement("div",{key:"every_day"},M.createElement(j.FormControlLabel,{control:M.createElement(j.Radio,{style:E.inputRadio,checked:e.period.days===1&&!e.period.dows,onClick:()=>{const t=JSON.parse(JSON.stringify(this.state.schedule));t.period.days=1,t.period.dows="",this.onChange(t)}}),label:h.t("sch_periodEveryDay")})),M.createElement("div",{key:"everyN_day"},M.createElement(j.FormControlLabel,{control:M.createElement(j.Radio,{style:E.inputRadio,checked:e.period.days>1,onClick:()=>{const t=JSON.parse(JSON.stringify(this.state.schedule));t.period.days=2,t.period.dows="",this.onChange(t)}}),label:h.t("sch_periodEvery")}),e.period.days>1&&[M.createElement(j.Input,{key:"input",value:this.state.schedule.period.days,style:E.inputEvery,type:"number",inputProps:{min:2},onChange:t=>{const i=JSON.parse(JSON.stringify(this.state.schedule));i.period.days=parseInt(t.target.value,10),i.period.dows="",this.onChange(i)}}),M.createElement("span",{key:"span",style:{paddingRight:10}},h.t("sch_periodDay"))])]}getPeriodSettingsWeekly(){if(!this.state.schedule.period.weeks)return null;const e=this.state.schedule;return[M.createElement("div",{key:"radios",style:{display:"inline-block",verticalAlign:"top"}},M.createElement("div",null,M.createElement(j.FormControlLabel,{control:M.createElement(j.Radio,{style:E.inputRadio,checked:e.period.weeks===1,onClick:()=>{const t=JSON.parse(JSON.stringify(this.state.schedule));t.period.weeks=1,this.onChange(t)}}),label:h.t("sch_periodEveryWeek")})),M.createElement("div",null,M.createElement(j.FormControlLabel,{control:M.createElement(j.Radio,{style:E.inputRadio,checked:e.period.weeks>1,onClick:()=>{const t=JSON.parse(JSON.stringify(this.state.schedule));t.period.weeks=2,this.onChange(t)}}),label:h.t("sch_periodEvery")}),e.period.weeks>1&&[M.createElement(j.Input,{key:"input",value:this.state.schedule.period.weeks,style:E.inputEvery,type:"number",inputProps:{min:2},onChange:t=>{const i=JSON.parse(JSON.stringify(this.state.schedule));i.period.weeks=parseInt(t.target.value,10),this.onChange(i)}}),M.createElement("span",{key:"text"},h.t("sch_periodWeek"))]))]}getPeriodSettingsDates(){if(!this.state.schedule.period.dates)return null;const e=this.state.schedule,t=[];for(let r=1;r<=31;r++)t.push(r);const i=JSON.parse(e.period.dates);return M.createElement(j.FormGroup,{row:!0,style:{...E.inputGroup,maxWidth:620}},M.createElement(j.FormControlLabel,{style:E.inputDateDay,control:M.createElement(j.Checkbox,{style:E.inputDateDayCheck,checked:i.length===31,onChange:()=>{const r=JSON.parse(JSON.stringify(this.state.schedule)),o=[];for(let n=1;n<=31;n++)o.push(n);r.period.dates=JSON.stringify(o),this.onChange(r)}}),label:h.t("sch_all")}),M.createElement(j.FormControlLabel,{style:E.inputDateDay,control:M.createElement(j.Checkbox,{style:E.inputDateDayCheck,checked:!i.length,onChange:()=>{const r=JSON.parse(JSON.stringify(this.state.schedule));r.period.dates="[]",this.onChange(r)}}),label:h.t("sch_no_one")}),i.length!==31&&!!i.length&&M.createElement(j.FormControlLabel,{style:E.inputDateDay,control:M.createElement(j.Checkbox,{style:E.inputDateDayCheck,checked:!1,onChange:()=>{const r=JSON.parse(JSON.stringify(this.state.schedule)),o=[],n=JSON.parse(r.period.dates);for(let a=1;a<=31;a++)n.includes(a)||o.push(a);o.sort((a,c)=>a-c),r.period.dates=JSON.stringify(o),this.onChange(r)}}),label:h.t("sch_invert")}),M.createElement("div",null),t.map(r=>M.createElement(j.FormControlLabel,{key:`date_${r}`,style:r?E.inputDateDay:{...E.inputDateDay,opacity:0,cursor:"default",userSelect:"none",pointerEvents:"none"},control:M.createElement(j.Checkbox,{style:E.inputDateDayCheck,checked:JSON.parse(e.period.dates).includes(r),onChange:o=>{const n=JSON.parse(JSON.stringify(this.state.schedule));let a;try{a=JSON.parse(n.period.dates)}catch{a=[]}o.target.checked&&!a.includes(r)?a.push(r):!o.target.checked&&a.includes(r)&&a.splice(a.indexOf(r),1),a.sort((c,l)=>c-l),n.period.dates=JSON.stringify(a),this.onChange(n)}}),label:r<10?[M.createElement("span",{key:"0",style:{opacity:0}},"0"),M.createElement("span",{key:"num"},r)]:r})))}getPeriodSettingsMonthly(){if(!this.state.schedule.period.months)return null;const e=this.state.schedule,t=typeof e.period.months=="string"?JSON.parse(e.period.months):[];return[M.createElement("div",{key:"every"},M.createElement(j.FormControlLabel,{control:M.createElement(j.Radio,{style:E.inputRadio,checked:typeof e.period.months=="number"&&e.period.months===1,onClick:()=>{const i=JSON.parse(JSON.stringify(this.state.schedule));i.period.months=1,this.onChange(e)}}),label:h.t("sch_periodEveryMonth")})),M.createElement("div",{key:"everyN"},M.createElement(j.FormControlLabel,{control:M.createElement(j.Radio,{style:E.inputRadio,checked:typeof e.period.months=="number"&&e.period.months>1,onClick:()=>{const i=JSON.parse(JSON.stringify(this.state.schedule));i.period.months=2,this.onChange(i)}}),label:h.t("sch_periodEvery")}),typeof e.period.months=="number"&&e.period.months>1&&[M.createElement(j.Input,{key:"input",value:e.period.months,style:E.inputEvery,type:"number",inputProps:{min:2},onChange:i=>{const r=JSON.parse(JSON.stringify(this.state.schedule));r.period.months=parseInt(i.target.value,10),r.period.months<1&&(r.period.months=1),this.onChange(r)}}),M.createElement("span",{key:"text"},h.t("sch_periodMonth"))]),M.createElement("div",{key:"specific",style:{verticalAlign:"top"}},M.createElement(j.FormControlLabel,{style:{verticalAlign:"top"},control:M.createElement(j.Radio,{style:E.inputRadio,checked:typeof e.period.months=="string",onClick:()=>{const i=JSON.parse(JSON.stringify(this.state.schedule));i.period.months="[1,2,3,4,5,6,7,8,9,10,11,12]",this.onChange(i)}}),label:h.t("sch_periodSpecificMonths")}),typeof e.period.months=="string"&&M.createElement(j.FormGroup,{row:!0,style:E.inputGroup},M.createElement(j.FormControlLabel,{style:E.inputDateDay,control:M.createElement(j.Checkbox,{style:E.inputDateDayCheck,checked:t.length===12,onChange:()=>{const i=JSON.parse(JSON.stringify(this.state.schedule)),r=[];for(let o=1;o<=12;o++)r.push(o);i.period.months=JSON.stringify(r),this.onChange(i)}}),label:h.t("sch_all")}),M.createElement(j.FormControlLabel,{style:E.inputDateDay,control:M.createElement(j.Checkbox,{style:E.inputDateDayCheck,checked:!t.length,onChange:()=>{const i=JSON.parse(JSON.stringify(this.state.schedule));i.period.months="[]",this.onChange(i)}}),label:h.t("sch_no_one")}),t.length!==12&&!!t.length&&M.createElement(j.FormControlLabel,{style:E.inputDateDay,control:M.createElement(j.Checkbox,{style:E.inputDateDayCheck,checked:!1,onChange:()=>{const i=JSON.parse(JSON.stringify(this.state.schedule)),r=[],o=JSON.parse(i.period.months);for(let n=1;n<=12;n++)o.includes(n)||r.push(n);r.sort((n,a)=>n-a),i.period.months=JSON.stringify(r),this.onChange(i)}}),label:h.t("sch_invert")}),M.createElement("div",null),zr.map((i,r)=>M.createElement(j.FormControlLabel,{key:`month_${r}`,style:E.inputGroupElement,control:M.createElement(j.Checkbox,{style:E.inputSmallCheck,checked:typeof e.period.months=="string"?JSON.parse(e.period.months).includes(r+1):e.period.months===r,onChange:o=>{const n=JSON.parse(JSON.stringify(this.state.schedule));let a;try{a=JSON.parse(n.period.months)}catch{a=[]}o.target.checked&&!a.includes(r+1)?a.push(r+1):!o.target.checked&&a.includes(r+1)&&a.splice(a.indexOf(r+1),1),a.sort((c,l)=>c-l),n.period.months=JSON.stringify(a),this.onChange(n)}}),label:h.t(i)}))))]}getPeriodSettingsYearly(){if(!this.state.schedule.period.years)return null;const e=this.state.schedule;return[M.createElement("div",{key:"year"},M.createElement(j.FormControlLabel,{control:M.createElement(j.Radio,{style:E.inputRadio,checked:e.period.years===1,onClick:()=>{const t=JSON.parse(JSON.stringify(this.state.schedule));t.period.years=1,this.onChange(t)}}),label:h.t("sch_periodEveryYear")})),M.createElement("div",{key:"every"},M.createElement(j.FormControlLabel,{control:M.createElement(j.Radio,{style:E.inputRadio,checked:e.period.years>1,onClick:()=>{const t=JSON.parse(JSON.stringify(this.state.schedule));t.period.years=2,this.onChange(t)}}),label:h.t("sch_periodEvery")}),e.period.years>1&&[M.createElement(j.Input,{key:"input",value:this.state.schedule.period.years,style:E.inputEvery,type:"number",inputProps:{min:2},onChange:t=>{const i=JSON.parse(JSON.stringify(this.state.schedule));i.period.years=parseInt(t.target.value,10),i.period.years<1&&(i.period.years=1),this.onChange(i)}}),M.createElement("span",{key:"text"},h.t("sch_periodYear"))])]}static now2string(e){const t=new Date;return t.setHours(0),t.setMinutes(0),t.setSeconds(0),t.setMilliseconds(0),e&&(t.setDate(t.getDate()+2),t.setMilliseconds(t.getMilliseconds()-1)),`${gt(t.getDate())}.${gt(t.getMonth()+1)}.${gt(t.getFullYear())}`}static string2date(e){let t=e.split(".");return t.length===1?(t=e.split("-"),new Date(parseInt(t[0],10),parseInt(t[1],10)-1,parseInt(t[2],10))):new Date(parseInt(t[2],10),parseInt(t[1],10)-1,parseInt(t[0],10))}getValidSettings(){const e=this.state.schedule;return M.createElement("div",{style:E.rowDiv},M.createElement("div",{style:{...E.modeDiv,verticalAlign:"middle"}},M.createElement("span",{style:{fontWeight:"bold",paddingRight:10}},h.t("sch_valid")),M.createElement("span",null,h.t("sch_validFrom"))),M.createElement("div",{style:E.settingsDiv},M.createElement(j.TextField,{variant:"standard",style:{...E.inputDate,marginRight:10},key:"exactTimeFrom",inputRef:this.refFrom,defaultValue:rn(e.valid.from),type:"date",onChange:t=>{this.timerFrom&&clearTimeout(this.timerFrom),this.refFrom.current&&(this.refFrom.current.style.background="#ff000030"),this.timerFrom=setTimeout(i=>{this.timerFrom=null,this.refFrom.current&&(this.refFrom.current.style.background="");const r=JSON.parse(JSON.stringify(this.state.schedule)),o=De.string2date(i);o.toString()!=="Invalid Date"&&(r.valid.from=`${gt(o.getDate())}.${gt(o.getMonth()+1)}.${o.getFullYear()}`,this.onChange(r))},1500,t.target.value)},slotProps:{inputLabel:{shrink:!0}},margin:"normal"}),M.createElement(j.FormControlLabel,{control:M.createElement(j.Checkbox,{style:E.inputRadio,checked:!!e.valid.to,onClick:()=>{const t=JSON.parse(JSON.stringify(this.state.schedule));t.valid.to=t.valid.to?"":De.now2string(!0),this.onChange(t)}}),label:h.t("sch_validTo")}),!!e.valid.to&&M.createElement(j.TextField,{variant:"standard",inputRef:this.refTo,style:{...E.inputDate,marginRight:10},key:"exactTimeFrom",type:"date",defaultValue:rn(e.valid.to),onChange:t=>{this.timerTo&&clearTimeout(this.timerTo),this.refTo.current&&(this.refTo.current.style.background="#ff000030"),this.timerTo=setTimeout(i=>{this.timerTo=null,this.refTo.current&&(this.refTo.current.style.background="");const r=JSON.parse(JSON.stringify(this.state.schedule)),o=De.string2date(i);o.toString()!=="Invalid Date"&&(r.valid.to=`${gt(o.getDate())}.${gt(o.getMonth()+1)}.${o.getFullYear()}`,this.onChange(r))},1500,t.target.value)},slotProps:{inputLabel:{shrink:!0}},margin:"normal"})))}render(){return M.createElement("div",{style:{height:"calc(100% - 48px)",width:"100%",overflow:"hidden"}},M.createElement("div",null,this.state.desc),M.createElement("div",{style:E.scrollWindow},M.createElement("h5",null,h.t("sch_time")),this.getTimePeriodElements(),this.getTimeExactElements(),De.getDivider(),M.createElement("h5",null,h.t("sch_period")),this.getPeriodModes(),!this.state.schedule.period.once&&De.getDivider(),!this.state.schedule.period.once&&this.getValidSettings()))}}const wr={different:{opacity:.5},icon:{width:16,height:16,marginRight:8}};class t5e extends f.Component{wordDifferent;timeout=null;constructor(e){super(e),e.different&&(this.wordDifferent=e.t("ra___different__"));let t;Array.isArray(e.list)?t=e.list.filter(i=>(i==null?void 0:i._id)&&i.common).map(i=>{var r,o;return{name:O.getObjectNameFromObj(i,e.lang).replace("system.group.","").replace("system.user.","").replace("enum.rooms.","").replace("enum.functions.",""),value:i._id,icon:(r=i.common)==null?void 0:r.icon,color:(o=i.common)==null?void 0:o.color}}):t=Object.values(e.list).filter(i=>(i==null?void 0:i._id)&&i.common).map(i=>{var r,o;return{name:O.getObjectNameFromObj(i,e.lang).replace("system.group.","").replace("system.user.","").replace("enum.rooms.","").replace("enum.functions.",""),value:i._id,icon:(r=i.common)==null?void 0:r.icon,color:(o=i.common)==null?void 0:o.color}}),e.different&&e.value===e.different&&t.unshift({value:e.different,name:this.wordDifferent||""}),e.allowNone&&t.unshift({value:"",name:h.t("ra_none")}),this.state={list:t}}render(){this.props.allowNone&&!this.state.list.find(r=>r.value==="")?this.timeout=this.timeout||setTimeout(()=>{this.timeout=null;const r=JSON.parse(JSON.stringify(this.state.list));r.unshift({value:"",name:h.t("ra_none")}),this.setState({list:r})},100):!this.props.allowNone&&this.state.list.find(r=>r.value==="")&&(this.timeout=this.timeout||setTimeout(()=>{this.timeout=null;const r=JSON.parse(JSON.stringify(this.state.list)),o=this.state.list.findIndex(n=>n.value==="");r.splice(o,1),this.setState({list:r})},100));const e=this.state.list.find(r=>r.value===this.props.value||this.props.removePrefix&&r.value.replace(this.props.removePrefix,"")===this.props.value),t=this.props.value===this.props.different?{}:{color:(e==null?void 0:e.color)||void 0,backgroundColor:O.getInvertedColor((e==null?void 0:e.color)||"",this.props.themeType)};this.props.dense&&this.props.style&&Object.assign(t,this.props.style);const i=M.createElement(j.Select,{variant:"standard",disabled:this.props.disabled,value:this.props.value,slotProps:{input:this.props.inputProps},renderValue:()=>M.createElement("span",null,e!=null&&e.icon?M.createElement(me,{src:e==null?void 0:e.icon,style:wr.icon}):null,e==null?void 0:e.name),sx:{"&.MuiSelect-root":this.props.value===this.props.different?wr.different:{}},classes:{root:this.props.dense?this.props.className:""},style:t,onChange:r=>{if(this.props.different&&r.target.value!==this.props.different){let o=null;for(let n=0;n<this.state.list.length;n++)if(this.state.list[n].value===this.props.different){o=n;break}if(o!==null){const n=O.clone(this.state.list);n.splice(o,1),this.setState({list:n},()=>this.props.onChange(r.target.value));return}}this.props.onChange(this.props.removePrefix?r.target.value.replace(this.props.removePrefix,""):r.target.value)}},this.state.list.map(r=>M.createElement(j.MenuItem,{style:this.props.different&&r.value===this.props.different?wr.different:{color:r.color||void 0,backgroundColor:O.getInvertedColor(r.color||"",this.props.themeType)},key:r.value,value:r.value},r.icon?M.createElement(me,{src:r.icon,style:wr.icon}):null,r.name)));return this.props.dense?i:M.createElement(j.FormControl,{variant:"standard",fullWidth:!!this.props.fullWidth,style:this.props.style,className:this.props.className},M.createElement(j.InputLabel,null,this.props.label),i)}}class s5e extends f.Component{resizerRefTable;resizerActiveIndex;resizerActiveDiv;resizerCurrentWidths;widthFilled=!1;installTimeout=null;resizerMin=0;resizerMinNext=0;resizerPosition=0;resizerOldWidth=0;resizerOldWidthNext=0;constructor(e){super(e),this.resizerRefTable=M.createRef(),this.resizerActiveIndex=null,this.resizerActiveDiv=null,this.resizerCurrentWidths=[]}componentDidMount(){this.resizerInstall()}componentWillUnmount(){this.resizerUninstall()}resizerInstall(){if(this.resizerRefTable.current&&!this.resizerRefTable.current._installed){this.resizerRefTable.current._installed=!0;const e=this.resizerRefTable.current.querySelectorAll("th"),t=(window._localStorage||window.localStorage).getItem(`App.${this.props.name||"history"}.table`);if(this.widthFilled=!1,t)try{this.resizerCurrentWidths=JSON.parse(t),this.widthFilled=!0}catch{}if(this.widthFilled)if(this.resizerCurrentWidths.length!==e.length)this.resizerCurrentWidths=[],this.widthFilled=!1;else{const i=this.resizerRefTable.current.offsetWidth;let r=0;for(let o=0;o<this.resizerCurrentWidths.length;o++)if(window.isFinite(this.resizerCurrentWidths[o]))r+=this.resizerCurrentWidths[o];else{r=null;break}r!==null&&Math.abs(r-i)>20&&(this.resizerCurrentWidths=[],this.widthFilled=!1)}for(let i=0;i<e.length;i++)if(!this.widthFilled&&this.resizerCurrentWidths.push(e[i].offsetWidth),i<e.length-1){const r=window.document.createElement("div");r.dataset.index=i.toString(),r.onmousedown=this.resizerMouseDown,r.ondblclick=this.resizerReset,r.title=this.props.dblTitle||"Double click to reset table layout",r.className="resize-handle",e[i].appendChild(r)}this.widthFilled&&this.resizerApplyWidths()}else this.installTimeout=setTimeout(()=>{this.installTimeout=null,this.resizerInstall()},100)}resizerReset=()=>{for(let e=0;e<this.resizerCurrentWidths.length;e++)this.resizerCurrentWidths[e]=(this.props.initialWidths||[])[e]||"auto";(window._localStorage||window.localStorage).setItem(`App.${this.props.name||"history"}.table`,JSON.stringify(this.resizerCurrentWidths)),this.resizerApplyWidths()};resizerUninstall(){if(this.installTimeout&&clearTimeout(this.installTimeout),this.installTimeout=null,this.resizerRefTable.current&&this.resizerRefTable.current._installed){this.resizerRefTable.current._installed=!1;const e=this.resizerRefTable.current.querySelectorAll("th");for(let t=0;t<e.length;t++){const i=e[t].querySelector(".resize-handle");i&&(i.onmousedown=null,i.remove())}}}resizerApplyWidths(){const e=[];if(this.resizerCurrentWidths.length)for(let t=0;t<this.resizerCurrentWidths.length;t++)this.resizerCurrentWidths[t]?e.push(this.resizerCurrentWidths[t]!=="auto"?`${this.resizerCurrentWidths[t]}px`:"auto"):this.props.initialWidths&&this.props.initialWidths[t]?e.push(this.props.initialWidths[t]!=="auto"?`${this.props.initialWidths[t]}px`:"auto"):e.push("auto");else if(this.props.initialWidths)for(let t=0;t<this.props.initialWidths.length;t++)this.props.initialWidths[t]?e.push(this.props.initialWidths[t]!=="auto"?`${this.props.initialWidths[t]}px`:"auto"):e.push("auto");return this.resizerRefTable.current&&e.length&&(this.resizerRefTable.current.style.gridTemplateColumns=e.join(" ")),e.length?e.join(" "):void 0}resizerMouseMove=e=>{if(this.resizerActiveDiv&&this.resizerActiveIndex!==null){const t=this.resizerOldWidth+e.clientX-this.resizerPosition,i=this.resizerOldWidthNext-e.clientX+this.resizerPosition;(!this.resizerMin||t>this.resizerMin)&&(!this.resizerMinNext||i>this.resizerMinNext)&&(this.resizerCurrentWidths[this.resizerActiveIndex]=t,this.resizerCurrentWidths[this.resizerActiveIndex+1]=i,this.resizerApplyWidths())}};resizerMouseUp=()=>{(window._localStorage||window.localStorage).setItem(`App.${this.props.name||"history"}.table`,JSON.stringify(this.resizerCurrentWidths)),this.resizerActiveIndex=null,this.resizerActiveDiv=null,window.removeEventListener("mousemove",this.resizerMouseMove),window.removeEventListener("mouseup",this.resizerMouseUp)};resizerMouseDown=e=>{var t,i,r,o;if(this.resizerActiveIndex===null||this.resizerActiveIndex===void 0){console.log(`Mouse down ${(t=e.target)==null?void 0:t.dataset.index}`),this.resizerActiveIndex=parseInt(((i=e.target)==null?void 0:i.dataset.index)||"0",10),this.resizerActiveDiv=e.target,this.resizerMin=this.props.minWidths?this.props.minWidths[this.resizerActiveIndex]:0,this.resizerMinNext=this.props.minWidths?this.props.minWidths[this.resizerActiveIndex+1]:0,this.resizerPosition=e.clientX;let n;this.resizerCurrentWidths[this.resizerActiveIndex]==="auto"&&(n=(r=this.resizerRefTable.current)==null?void 0:r.querySelectorAll("th"),n&&(this.resizerCurrentWidths[this.resizerActiveIndex]=n[this.resizerActiveIndex].offsetWidth)),this.resizerCurrentWidths[this.resizerActiveIndex+1]==="auto"&&(n=n||((o=this.resizerRefTable.current)==null?void 0:o.querySelectorAll("th")),n&&(this.resizerCurrentWidths[this.resizerActiveIndex+1]=n[this.resizerActiveIndex+1].offsetWidth)),this.resizerOldWidth=this.resizerCurrentWidths[this.resizerActiveIndex],this.resizerOldWidthNext=this.resizerCurrentWidths[this.resizerActiveIndex+1],window.addEventListener("mousemove",this.resizerMouseMove),window.addEventListener("mouseup",this.resizerMouseUp)}};render(){if(this.props.ready===!1)return M.createElement(j.Skeleton,null);const e={gridTemplateColumns:this.resizerApplyWidths()};return M.createElement(j.Table,{stickyHeader:this.props.stickyHeader,size:this.props.size||"small",className:this.props.className,sx:this.props.sx,ref:this.resizerRefTable,style:{...this.props.style||void 0,...e}},this.props.children)}}const on={div:{borderRadius:3,padding:"0 3px",lineHeight:"20px",whiteSpace:"nowrap",overflow:"hidden",display:"flex",alignItems:"center"},icon:{width:16,height:16,marginRight:8,verticalAlign:"middle"},text:{display:"inline-block",overflow:"hidden",textOverflow:"ellipsis"}};function i5e(s){var o,n,a,c,l,N,u,L,g;const e=s.value;let t;const i=s.removePrefix||"";if(typeof e=="string"){const y=s.list;if(y)if(Array.isArray(y)){const T=y.find(d=>(d==null?void 0:d._id)===i+e);T?t={name:O.getObjectNameFromObj(T,s.lang).replace("system.group.",""),value:T._id,icon:s.icon||((o=T.common)==null?void 0:o.icon),color:s.color||((n=T.common)==null?void 0:n.color)}:t={name:e,value:i+e}}else if(y[i+e]){const T=y[i+e];t={name:O.getObjectNameFromObj(T,s.lang).replace("system.group.",""),value:T._id,icon:s.icon||((a=T.common)==null?void 0:a.icon),color:s.color||((c=T.common)==null?void 0:c.color)}}else t={name:e,value:i+e,icon:s.icon,color:s.color};else t={name:e,value:i+e,icon:s.icon,color:s.color}}else if(!e||typeof e!="object")t={name:"",value:"",icon:s.icon,color:s.color};else{const y=e;t={name:O.getObjectNameFromObj(y,s.lang).replace("system.group.","").replace("system.user.","").replace("enum.rooms.","").replace("enum.functions.",""),value:y._id,icon:s.icon||((l=y.common)==null?void 0:l.icon),color:s.color||((N=y.common)==null?void 0:N.color)}}const r=t!=null&&t.color?{border:`1px solid ${O.invertColor(t==null?void 0:t.color)}`,color:O.getInvertedColor(t==null?void 0:t.color,s.themeType||"light",!0)||void 0,backgroundColor:t==null?void 0:t.color}:{};return M.createElement("div",{style:{...s.style||void 0,...on.div,...r||void 0},className:O.clsx(s.className,(u=s.moreClasses)==null?void 0:u.root),title:s.title||t.value},t!=null&&t.icon?M.createElement(me,{src:t==null?void 0:t.icon,className:(L=s.moreClasses)==null?void 0:L.icon,style:on.icon}):null,M.createElement("div",{style:on.text,className:(g=s.moreClasses)==null?void 0:g.text},t==null?void 0:t.name))}function r5e({themeName:s,toggleTheme:e,t,className:i,style:r,size:o}){return M.createElement("div",{className:i||void 0,style:r||void 0},M.createElement(j.Tooltip,{title:t("ra_Change color theme"),slotProps:{popper:{sx:{pointerEvents:"none"}}}},M.createElement(j.IconButton,{onClick:()=>e(),size:o||"medium"},s==="dark"&&M.createElement(KL,{className:i}),s==="blue"&&M.createElement(qL,{className:i}),s==="colored"&&M.createElement(ua,{className:i}),s!=="dark"&&s!=="blue"&&s!=="colored"&&M.createElement(eg,{className:i}))))}function po(){return(po=Object.assign||function(s){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(s[i]=t[i])}return s}).apply(this,arguments)}function W4(s,e){if(s==null)return{};var t,i,r={},o=Object.keys(s);for(i=0;i<o.length;i++)e.indexOf(t=o[i])>=0||(r[t]=s[t]);return r}function Vn(s){var e=f.useRef(s),t=f.useRef(function(i){e.current&&e.current(i)});return e.current=s,t.current}var bi=function(s,e,t){return e===void 0&&(e=0),t===void 0&&(t=1),s>t?t:s<e?e:s},fi=function(s){return"touches"in s},Zn=function(s){return s&&s.ownerDocument.defaultView||self},Fl=function(s,e,t){var i=s.getBoundingClientRect(),r=fi(e)?function(o,n){for(var a=0;a<o.length;a++)if(o[a].identifier===n)return o[a];return o[0]}(e.touches,t):e;return{left:bi((r.pageX-(i.left+Zn(s).pageXOffset))/i.width),top:bi((r.pageY-(i.top+Zn(s).pageYOffset))/i.height)}},Gl=function(s){!fi(s)&&s.preventDefault()},B4=M.memo(function(s){var e=s.onMove,t=s.onKey,i=W4(s,["onMove","onKey"]),r=f.useRef(null),o=Vn(e),n=Vn(t),a=f.useRef(null),c=f.useRef(!1),l=f.useMemo(function(){var g=function(d){Gl(d),(fi(d)?d.touches.length>0:d.buttons>0)&&r.current?o(Fl(r.current,d,a.current)):T(!1)},y=function(){return T(!1)};function T(d){var z=c.current,I=Zn(r.current),C=d?I.addEventListener:I.removeEventListener;C(z?"touchmove":"mousemove",g),C(z?"touchend":"mouseup",y)}return[function(d){var z=d.nativeEvent,I=r.current;if(I&&(Gl(z),!function(m,A){return A&&!fi(m)}(z,c.current)&&I)){if(fi(z)){c.current=!0;var C=z.changedTouches||[];C.length&&(a.current=C[0].identifier)}I.focus(),o(Fl(I,z,a.current)),T(!0)}},function(d){var z=d.which||d.keyCode;z<37||z>40||(d.preventDefault(),n({left:z===39?.05:z===37?-.05:0,top:z===40?.05:z===38?-.05:0}))},T]},[n,o]),N=l[0],u=l[1],L=l[2];return f.useEffect(function(){return L},[L]),M.createElement("div",po({},i,{onTouchStart:N,onMouseDown:N,className:"react-colorful__interactive",ref:r,onKeyDown:u,tabIndex:0,role:"slider"}))}),zM=function(s){return s.filter(Boolean).join(" ")},J4=function(s){var e=s.color,t=s.left,i=s.top,r=i===void 0?.5:i,o=zM(["react-colorful__pointer",s.className]);return M.createElement("div",{className:o,style:{top:100*r+"%",left:100*t+"%"}},M.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:e}}))},he=function(s,e,t){return e===void 0&&(e=0),t===void 0&&(t=Math.pow(10,e)),Math.round(t*s)/t},TSe=function(s){return wSe(Xn(s))},Xn=function(s){return s[0]==="#"&&(s=s.substring(1)),s.length<6?{r:parseInt(s[0]+s[0],16),g:parseInt(s[1]+s[1],16),b:parseInt(s[2]+s[2],16),a:s.length===4?he(parseInt(s[3]+s[3],16)/255,2):1}:{r:parseInt(s.substring(0,2),16),g:parseInt(s.substring(2,4),16),b:parseInt(s.substring(4,6),16),a:s.length===8?he(parseInt(s.substring(6,8),16)/255,2):1}},dSe=function(s){return zSe(hSe(s))},DSe=function(s){var e=s.s,t=s.v,i=s.a,r=(200-e)*t/100;return{h:he(s.h),s:he(r>0&&r<200?e*t/100/(r<=100?r:200-r)*100:0),l:he(r/2),a:he(i,2)}},Kn=function(s){var e=DSe(s);return"hsl("+e.h+", "+e.s+"%, "+e.l+"%)"},hSe=function(s){var e=s.h,t=s.s,i=s.v,r=s.a;e=e/360*6,t/=100,i/=100;var o=Math.floor(e),n=i*(1-t),a=i*(1-(e-o)*t),c=i*(1-(1-e+o)*t),l=o%6;return{r:he(255*[i,a,n,n,c,i][l]),g:he(255*[c,i,i,a,n,n][l]),b:he(255*[n,n,c,i,i,a][l]),a:he(r,2)}},Cr=function(s){var e=s.toString(16);return e.length<2?"0"+e:e},zSe=function(s){var e=s.r,t=s.g,i=s.b,r=s.a,o=r<1?Cr(he(255*r)):"";return"#"+Cr(e)+Cr(t)+Cr(i)+o},wSe=function(s){var e=s.r,t=s.g,i=s.b,r=s.a,o=Math.max(e,t,i),n=o-Math.min(e,t,i),a=n?o===e?(t-i)/n:o===t?2+(i-e)/n:4+(e-t)/n:0;return{h:he(60*(a<0?a+6:a)),s:he(o?n/o*100:0),v:he(o/255*100),a:r}},CSe=M.memo(function(s){var e=s.hue,t=s.onChange,i=zM(["react-colorful__hue",s.className]);return M.createElement("div",{className:i},M.createElement(B4,{onMove:function(r){t({h:360*r.left})},onKey:function(r){t({h:bi(e+360*r.left,0,360)})},"aria-label":"Hue","aria-valuenow":he(e),"aria-valuemax":"360","aria-valuemin":"0"},M.createElement(J4,{className:"react-colorful__hue-pointer",left:e/360,color:Kn({h:e,s:100,v:100,a:1})})))}),ISe=M.memo(function(s){var e=s.hsva,t=s.onChange,i={backgroundColor:Kn({h:e.h,s:100,v:100,a:1})};return M.createElement("div",{className:"react-colorful__saturation",style:i},M.createElement(B4,{onMove:function(r){t({s:100*r.left,v:100-100*r.top})},onKey:function(r){t({s:bi(e.s+100*r.left,0,100),v:bi(e.v-100*r.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+he(e.s)+"%, Brightness "+he(e.v)+"%"},M.createElement(J4,{className:"react-colorful__saturation-pointer",top:1-e.v/100,left:e.s/100,color:Kn(e)})))}),R4=function(s,e){if(s===e)return!0;for(var t in s)if(s[t]!==e[t])return!1;return!0},pSe=function(s,e){return s.toLowerCase()===e.toLowerCase()||R4(Xn(s),Xn(e))};function ASe(s,e,t){var i=Vn(t),r=f.useState(function(){return s.toHsva(e)}),o=r[0],n=r[1],a=f.useRef({color:e,hsva:o});f.useEffect(function(){if(!s.equal(e,a.current.color)){var l=s.toHsva(e);a.current={hsva:l,color:e},n(l)}},[e,s]),f.useEffect(function(){var l;R4(o,a.current.hsva)||s.equal(l=s.fromHsva(o),a.current.color)||(a.current={hsva:o,color:l},i(l))},[o,s,i]);var c=f.useCallback(function(l){n(function(N){return Object.assign({},N,l)})},[]);return[o,c]}var mSe=typeof window<"u"?f.useLayoutEffect:f.useEffect,OSe=function(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0},Hl=new Map,ESe=function(s){mSe(function(){var e=s.current?s.current.ownerDocument:document;if(e!==void 0&&!Hl.has(e)){var t=e.createElement("style");t.innerHTML=`.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill-opacity=".05"><path d="M8 0h8v8H8zM0 8h8v8H0z"/></svg>')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}`,Hl.set(e,t);var i=OSe();i&&t.setAttribute("nonce",i),e.head.appendChild(t)}},[])},fSe=function(s){var e=s.className,t=s.colorModel,i=s.color,r=i===void 0?t.defaultColor:i,o=s.onChange,n=W4(s,["className","colorModel","color","onChange"]),a=f.useRef(null);ESe(a);var c=ASe(t,r,o),l=c[0],N=c[1],u=zM(["react-colorful",e]);return M.createElement("div",po({},n,{ref:a,className:u}),M.createElement(ISe,{hsva:l,onChange:N}),M.createElement(CSe,{hue:l.h,onChange:N,className:"react-colorful__last-control"}))},xSe={defaultColor:"000",toHsva:TSe,fromHsva:function(s){return dSe({h:s.h,s:s.s,v:s.v,a:1})},equal:pSe},_Se=function(s){return M.createElement(fSe,po({},s,{colorModel:xSe}))};class SSe extends f.Component{dialogName;filters;filterFunc;constructor(e){super(e),this.dialogName=this.props.dialogName||"default",this.dialogName=`SelectID.${this.dialogName}`;const t=(window._localStorage||window.localStorage).getItem(this.dialogName)||"{}";try{this.filters=JSON.parse(t)}catch{this.filters={}}e.filters&&(this.filters={...this.filters,...e.filters||{}});let i=this.props.selected||[];if(Array.isArray(i)||(i=[i]),i=i.filter(r=>r),e.filterFunc)if(typeof e.filterFunc=="string")try{this.filterFunc=new Function("obj",e.filterFunc)}catch{console.error(`Cannot parse filter function: "obj => ${e.filterFunc}"`),this.filterFunc=void 0}else this.filterFunc=e.filterFunc;this.state={selected:i,name:"",selectionBlocked:!1}}handleCancel(){this.props.onClose()}handleOk(){this.props.onOk(this.props.multiSelect?this.state.selected:this.state.selected[0]||"",this.state.name),this.props.onClose()}render(){let e;return this.state.name||this.state.selected.length?this.state.selected.length===1?e=[M.createElement("span",{key:"selected"},h.t("ra_Selected")," "),M.createElement("span",{key:"id",style:{fontWeight:"bold",fontStyle:"italic"}},(this.state.name||this.state.selected[0])+(this.state.name?` [${this.state.selected[0]}]`:""))]:e=[M.createElement("span",{key:"selected"},h.t("ra_Selected")," "),M.createElement("span",{key:"id",style:{fontWeight:"bold",fontStyle:"italic"}},h.t("%s items",this.state.selected.length.toString()))]:e=this.props.title||h.t("ra_Please select object ID..."),M.createElement(j.Dialog,{onClose:()=>{},maxWidth:!1,sx:{"& .MuiDialog-paper":{height:"95%",p:"4px",width:"100%",maxWidth:"100%",maxHeight:"calc(100% - 16px)"}},fullWidth:!0,open:!0,"aria-labelledby":"ar_dialog_selectid_title"},M.createElement(j.DialogTitle,{id:"ar_dialog_selectid_title",style:{whiteSpace:"nowrap",width:"calc(100% - 72px)",overflow:"hidden",display:"inline-block",textOverflow:"ellipsis"}},e),M.createElement(j.DialogContent,{style:{height:"100%",overflow:"hidden",padding:"8px 4px"}},M.createElement(ySe,{foldersFirst:this.props.foldersFirst,imagePrefix:this.props.imagePrefix||this.props.prefix,dateFormat:this.props.dateFormat,defaultFilters:this.filters,dialogName:this.dialogName,isFloatComma:this.props.isFloatComma,showExpertButton:this.props.showExpertButton!==void 0?this.props.showExpertButton:!0,expertMode:this.props.expertMode,columns:this.props.columns||["name","type","role","room","func","val"],types:this.props.types?Array.isArray(this.props.types)?this.props.types:[this.props.types]:["state"],root:this.props.root,t:h.t,lang:this.props.lang||h.getLanguage(),socket:this.props.socket,selected:this.state.selected,multiSelect:this.props.multiSelect,notEditable:this.props.notEditable===void 0?!0:this.props.notEditable,themeName:this.props.themeName,themeType:this.props.themeType,theme:this.props.theme,customFilter:this.props.customFilter,allowNonObjects:this.props.allowNonObjects,onFilterChanged:t=>{this.filters=t,(window._localStorage||window.localStorage).setItem(this.dialogName,JSON.stringify(t))},onSelect:async(t,i,r)=>{let o;if(Array.isArray(t)?o=t:o=[t],JSON.stringify(o)!==JSON.stringify(this.state.selected)){let n=!0;if(this.props.onSelectConfirm){const a={};for(const c of o)try{a[c]=await this.props.socket.getObject(c)}catch{}n=await this.props.onSelectConfirm(o,a)}this.setState({selected:o,name:i,selectionBlocked:!n},()=>r&&this.handleOk())}else r&&this.handleOk()},filterFunc:this.filterFunc,title:"",classes:{}})),M.createElement(j.DialogActions,null,M.createElement(j.Button,{id:`ar_dialog_selectid_ok_${this.props.dialogName||""}`,variant:"contained",onClick:()=>this.handleOk(),startIcon:M.createElement(Oe,null),disabled:!this.state.selected.length||this.state.selectionBlocked,color:"primary"},this.props.ok||h.t("ra_Ok")),M.createElement(j.Button,{id:`ar_dialog_selectid_cancel_${this.props.dialogName||""}`,color:"grey",variant:"contained",onClick:()=>this.handleCancel(),startIcon:M.createElement(Pi,null)},this.props.cancel||h.t("ra_Cancel"))))}}function St(s,e,t){if(typeof e=="string"&&(e=e.split(".")),!s)return null;if(e.length===1)return t&&t[s[e[0]]]?t[s[e[0]]]:s[e[0]];const i=e.shift();return St(s[i],e)}function F4(s,e,t){if(typeof e=="string"&&(e=e.split(".")),e.length===1)return s[e[0]]=t;const i=e.shift();return(s[i]===null||s[i]===void 0)&&(s[i]={}),F4(s[i],e,t)}const W={tableContainer:{width:"100%",height:"100%",overflow:"auto"},table:{width:"100%",minWidth:800,maxWidth:1920},cell:{paddingTop:0,paddingBottom:0,paddingLeft:4,paddingRight:4},rowMainWithChildren:{},rowMainWithoutChildren:{},rowNoEdit:{opacity:.3},cellExpand:{width:30},cellButton:{width:30},cellHeader:{fontWeight:"bold",background:s=>(s.palette.mode==="dark","#888"),color:s=>s.palette.mode==="dark"?"#EEE":"#111",height:48,wordBreak:"break-word",whiteSpace:"pre"},width_name_nicknames:{maxWidth:150},width_ioType:{maxWidth:100},width_type:{maxWidth:100},width_displayTraits:{maxWidth:100},width_roomHint:{maxWidth:100},rowSecondary:{fontStyle:"italic"},cellSecondary:{fontSize:10},visuallyHidden:{border:0,clip:"rect(0 0 0 0)",height:1,margin:-1,overflow:"hidden",padding:0,position:"absolute",top:20,width:1},fieldEditWithButton:{width:"calc(100% - 33px)",display:"inline-block"},fieldEdit:{width:"100%",display:"inline-block",lineHeight:"50px",verticalAlign:"middle"},fieldButton:{width:30,display:"inline-block"},colorDialog:{overflow:"hidden",padding:15},subText:{fontSize:10,fontStyle:"italic"},glow:{animation:"glow 0.2s 2 alternate"}};function Vl(s,e,t,i){const r=St(s,t,i)||"",o=St(e,t,i)||"";return o<r?-1:o>r?1:0}function kSe(s,e,t){return s==="desc"?(i,r)=>Vl(i,r,e,t):(i,r)=>-Vl(i,r,e,t)}function YSe(s,e){const t=s.map((i,r)=>({e:i,i:r}));return t.sort((i,r)=>{const o=e(i.e,r.e);return o||i.i-r.i}),t.map(i=>i.e)}class qn extends f.Component{selectCallback=null;updateTimeout=null;constructor(e){super(e);let t=(window._localStorage||window.localStorage).getItem(this.props.name||"iob-table")||"[]";try{t=JSON.parse(t)||[]}catch{t=[]}Array.isArray(t)||(t=[]),this.state={opened:t,editMode:!1,deleteMode:!1,editData:null,order:"asc",update:null,orderBy:this.props.columns[0].field,showSelectColor:!1}}static getDerivedStateFromProps(e,t){if(e.glowOnChange){const i=[];let r=0;return e.data&&t.data&&e.data.forEach(o=>{var a;r++;const n=(a=t.data)==null?void 0:a.find(c=>c.id===o.id);n?JSON.stringify(n)!==JSON.stringify(o)&&i.push(o.id):i.push(o.id)}),i.length&&i.length!==r?{data:e.data,update:i}:{data:e.data}}return{data:e.data}}renderCellEdit(e,t){let i=St(e,t.field);return Array.isArray(i)&&(i=i[0]),t.lookup?this.renderCellEditSelect(t,i):t.editComponent?this.renderCellEditCustom(t,i,e):t.type==="boolean"||!t.type&&typeof i=="boolean"?this.renderCellEditBoolean(t,i):t.type==="color"?this.renderCellEditColor(t,i):t.type==="oid"?this.renderCellEditObjectID(t,i):t.type==="numeric"?this.renderCellEditNumber(t,i):this.renderCellEditString(t,i)}onChange(e,t,i){const r=this.state.editData?{...this.state.editData}:{};i===t?delete r[e.field]:r[e.field]=i,this.setState({editData:r})}renderCellEditSelect(e,t){return M.createElement(j.Select,{variant:"standard",onChange:i=>this.onChange(e,t,i.target.value),value:this.state.editData&&this.state.editData[e.field]||t},e.lookup&&Object.keys(e.lookup).map((i,r)=>{var o;return M.createElement(j.MenuItem,{key:r,value:i},(o=e.lookup)==null?void 0:o[i])}))}renderCellEditString(e,t){return M.createElement(j.TextField,{variant:"standard",style:W.fieldEdit,fullWidth:!0,value:this.state.editData&&this.state.editData[e.field]!==void 0?this.state.editData[e.field]:t,onChange:i=>this.onChange(e,t,i.target.value)})}renderCellEditNumber(e,t){return M.createElement(j.TextField,{variant:"standard",style:W.fieldEdit,type:"number",fullWidth:!0,value:this.state.editData&&this.state.editData[e.field]!==void 0?this.state.editData[e.field]:t,onChange:i=>this.onChange(e,t,i.target.value)})}renderCellEditCustom(e,t,i){const r=e.editComponent;return this.state.editData&&this.state.editData[e.field]!==void 0&&(t=this.state.editData[e.field],i=JSON.parse(JSON.stringify(i)),i[e.field]=t),r?M.createElement(r,{value:t,rowData:i,onChange:o=>this.onChange(e,t,o)}):null}renderCellEditBoolean(e,t){return M.createElement(j.Checkbox,{checked:this.state.editData&&this.state.editData[e.field]!==void 0?!!this.state.editData[e.field]:!!t,onChange:i=>this.onChange(e,!!t,i.target.checked),inputProps:{"aria-label":"checkbox"}})}renderSelectColorDialog(){return M.createElement(j.Dialog,{sx:{"& .MuiPaper-root":W.root,"& .MuiPaper-paper":W.paper},onClose:()=>{this.selectCallback=null,this.setState({showSelectColor:!1})},open:this.state.showSelectColor},M.createElement(_Se,{color:this.state.selectIdValue,onChange:e=>this.setState({selectIdValue:e},()=>{this.selectCallback&&this.selectCallback(e)})}))}renderCellEditColor(e,t){const i=this.state.editData&&this.state.editData[e.field]!==void 0?this.state.editData[e.field]:t;return M.createElement("div",{style:W.fieldEdit},M.createElement(j.TextField,{variant:"standard",fullWidth:!0,style:W.fieldEditWithButton,value:i,inputProps:{style:{backgroundColor:i,color:O.isUseBright(i)?"#FFF":"#000"}},onChange:r=>this.onChange(e,!!t,r.target.value)}),M.createElement(j.IconButton,{style:W.fieldButton,onClick:()=>{this.selectCallback=r=>this.onChange(e,t,r),this.setState({showSelectColor:!0,selectIdValue:t})},size:"large"},M.createElement(ig,null)))}renderSelectIdDialog(){return this.state.showSelectId&&this.props.socket?M.createElement(SSe,{key:"tableSelect",imagePrefix:"../..",dialogName:this.props.adapterName,themeType:this.props.themeType,theme:this.props.theme,socket:this.props.socket,selected:this.state.selectIdValue,onClose:()=>this.setState({showSelectId:!1}),onOk:e=>{this.setState({showSelectId:!1,selectIdValue:null});const t=Array.isArray(e)?e[0]:e;t&&this.selectCallback&&(this.selectCallback&&this.selectCallback(t),this.selectCallback=null)}}):null}renderCellEditObjectID(e,t){return M.createElement("div",{style:W.fieldEdit},M.createElement(j.TextField,{variant:"standard",fullWidth:!0,style:W.fieldEditWithButton,value:this.state.editData&&this.state.editData[e.field]!==void 0?this.state.editData[e.field]:t,onChange:i=>this.onChange(e,t,i.target.value)}),M.createElement(j.IconButton,{style:W.fieldButton,onClick:()=>{this.selectCallback=i=>this.onChange(e,t,i),this.setState({showSelectId:!0,selectIdValue:t})},size:"large"},M.createElement(_g,null)))}static renderCellNonEdit(e,t){let i=St(e,t.field,t.lookup);return Array.isArray(i)&&(i=i[0]),t.type==="boolean"?M.createElement(j.Checkbox,{checked:!!i,disabled:!0,inputProps:{"aria-label":"checkbox"}}):i}renderCell(e,t,i,r){return this.state.editMode===r&&t.editable!=="never"&&t.editable!==!1?M.createElement(j.TableCell,{key:t.field,style:{...W.cell,...i?W.cellSecondary:void 0,...t.cellStyle},component:"th"},this.renderCellEdit(e,t)):M.createElement(j.TableCell,{key:t.field,style:{...W.cell,...i?W.cellSecondary:void 0,...t.cellStyle},component:"th"},qn.renderCellNonEdit(e,t))}static renderCellWithSubField(e,t){const i=St(e,t.field,t.lookup);if(t.subField){const r=St(e,t.subField,t.subLookup);return M.createElement("div",null,M.createElement("div",{style:W.mainText},i),M.createElement("div",{style:{...W.subText,...t.subStyle||void 0}},r))}return M.createElement("div",null,M.createElement("div",{style:W.mainText},i))}renderLine(e,t){const i=this.props.levelShift===void 0?24:this.props.levelShift;t=t||0;const r=this.props.data.indexOf(e);if(!e||!t&&e.parentId||t&&!e.parentId)return null;const o=this.state.opened.includes(e.id),n=this.props.data.filter(c=>c.parentId===e.id),a=M.createElement(j.TableRow,{key:e.id,className:`table-row-${(e.id||"").toString().replace(/[.$]/g,"_")}`,style:{...this.state.update&&this.state.update.includes(e.id)&&W.glow||void 0,...W.row,...t?W.rowSecondary:void 0,...!t&&n.length?W.rowMainWithChildren:void 0,...!t&&!n.length?W.rowMainWithoutChildren:void 0,...this.state.editMode!==!1&&this.state.editMode!==r?W.rowNoEdit:void 0,...this.state.deleteMode!==!1&&this.state.deleteMode!==r?W.rowNoEdit:void 0}},M.createElement(j.TableCell,{style:{...W.cell,...W.cellExpand,...t?W.cellSecondary:void 0}},n.length?M.createElement(j.IconButton,{onClick:()=>{const c=[...this.state.opened],l=c.indexOf(e.id);l===-1?(c.push(e.id),c.sort()):c.splice(l,1),(window._localStorage||window.localStorage).setItem(this.props.name||"iob-table",JSON.stringify(c)),this.setState({opened:c})},size:"small"},o?M.createElement(ug,null):M.createElement(wg,null)):null),M.createElement(j.TableCell,{scope:"row",style:{...W.cell,...t?W.cellSecondary:void 0,...this.props.columns[0].cellStyle,paddingLeft:i*t}},this.props.columns[0].subField?qn.renderCellWithSubField(e,this.props.columns[0]):St(e,this.props.columns[0].field,this.props.columns[0].lookup)),this.props.columns.map((c,l)=>!l&&!c.hidden?null:this.renderCell(e,c,t,r)),this.props.onUpdate?M.createElement(j.TableCell,{style:{...W.cell,...W.cellButton}},this.state.editMode===r||this.state.deleteMode===r?M.createElement(j.IconButton,{disabled:this.state.editMode!==!1&&(!this.state.editData||!Object.keys(this.state.editData).length),onClick:()=>{if(this.state.editMode!==!1){const c=JSON.parse(JSON.stringify(e));this.state.editData&&Object.keys(this.state.editData).forEach(l=>{var N;return F4(c,l,(N=this.state.editData)==null?void 0:N[l])}),this.setState({editMode:!1},()=>this.props.onUpdate&&this.props.onUpdate(c,e))}else this.setState({deleteMode:!1},()=>this.props.onDelete&&this.props.onDelete(e))},size:"large"},M.createElement(Oe,null)):M.createElement(j.IconButton,{disabled:this.state.editMode!==!1,onClick:()=>this.setState({editMode:r,editData:null}),size:"large"},M.createElement(mi,null))):null,this.props.onDelete&&!this.props.onUpdate?M.createElement(j.TableCell,{style:{...W.cell,...W.cellButton}},this.state.deleteMode===r?M.createElement(j.IconButton,{disabled:this.state.editMode!==!1&&(!this.state.editData||!Object.keys(this.state.editData).length),onClick:()=>this.setState({deleteMode:!1},()=>this.props.onDelete&&this.props.onDelete(e)),size:"large"},M.createElement(Oe,null)):null):null,this.props.onUpdate||this.props.onDelete?M.createElement(j.TableCell,{style:{...W.cell,...W.cellButton}},this.state.editMode===r||this.state.deleteMode===r?M.createElement(j.IconButton,{onClick:()=>this.setState({editMode:!1,deleteMode:!1}),size:"large"},M.createElement(Ne,null)):this.props.onDelete?M.createElement(j.IconButton,{disabled:this.state.deleteMode!==!1,onClick:()=>this.setState({deleteMode:r}),size:"large"},M.createElement(nt,null)):null):null);if(!t&&o){const c=n.map(l=>this.renderLine(l,t+1));return c.unshift(a),c}return a}handleRequestSort(e){const t=this.state.orderBy===e&&this.state.order==="asc";this.setState({order:t?"desc":"asc",orderBy:e})}renderHead(){return M.createElement(j.TableHead,null,M.createElement(j.TableRow,{key:"headerRow"},M.createElement(j.TableCell,{component:"th",sx:O.getStyle(this.props.theme,W.cell,W.cellHeader,W.cellExpand)}),M.createElement(j.TableCell,{component:"th",sx:O.getStyle(this.props.theme,W.cell,W.cellHeader,W[`width_${this.props.columns[0].field.replace(/\./g,"_")}`]),style:this.props.columns[0].headerStyle||this.props.columns[0].cellStyle,sortDirection:this.props.noSort?!1:this.state.orderBy===this.props.columns[0].field?this.state.order:!1},this.props.noSort?null:M.createElement(j.TableSortLabel,{active:this.state.orderBy===this.props.columns[0].field,direction:this.state.orderBy===this.props.columns[0].field?this.state.order:"asc",onClick:()=>this.handleRequestSort(this.props.columns[0].field)},this.props.columns[0].title||this.props.columns[0].field,this.state.orderBy===this.props.columns[0].field?M.createElement("span",{style:W.visuallyHidden},this.state.order==="desc"?"sorted descending":"sorted ascending"):null)),this.props.columns.map((e,t)=>!t&&!e.hidden?null:M.createElement(j.TableCell,{key:e.field,sx:O.getStyle(this.props.theme,W.cell,W.cellHeader,W[`width_${e.field.replace(/\./g,"_")}`]),style:e.headerStyle||e.cellStyle,component:"th"},this.props.noSort?null:M.createElement(j.TableSortLabel,{active:this.state.orderBy===e.field,direction:this.state.orderBy===e.field?this.state.order:"asc",onClick:()=>this.handleRequestSort(e.field)},e.title||e.field,this.state.orderBy===e.field?M.createElement("span",{style:W.visuallyHidden},this.state.order==="desc"?"sorted descending":"sorted ascending"):null))),this.props.onUpdate?M.createElement(j.TableCell,{component:"th",sx:O.getStyle(this.props.theme,W.cell,W.cellHeader,W.cellButton)},this.props.noAdd?null:M.createElement(j.Fab,{color:"primary",size:"small",disabled:this.state.editMode!==!1,onClick:()=>this.props.onUpdate&&this.props.onUpdate(!0)},M.createElement(ln,null))):null,this.props.onDelete||this.props.onUpdate?M.createElement(j.TableCell,{component:"th",sx:O.getStyle(this.props.theme,W.cell,W.cellHeader,W.cellButton)}):null))}render(){const e=this.props.columns.find(t=>t.field===this.state.orderBy);if(e){const t=e.lookup,i=YSe(this.props.data,kSe(this.state.order,this.state.orderBy,t));return this.state.update&&this.state.update.length&&(this.updateTimeout&&clearTimeout(this.updateTimeout),this.updateTimeout=setTimeout(()=>{this.updateTimeout=null,this.setState({update:null})},500)),M.createElement("div",{style:W.tableContainer,className:this.props.className},M.createElement(j.Table,{style:W.table,"aria-label":"simple table",size:"small",stickyHeader:!0},this.renderHead(),M.createElement(j.TableBody,null,i.map(r=>this.renderLine(r)))),this.renderSelectIdDialog(),this.renderSelectColorDialog())}return null}}/*!
482
+ `),M.createElement(aSe,null,this.getToolbar()),M.createElement(nSe,null,this.renderHeader(),M.createElement(j.Box,{style:w.tableDiv,ref:this.tableRef,onKeyDown:i=>this.navigateKeyPress(i)},t)),this.renderContextMenu(),this.renderAliasMenu(),this.renderToast(),this.renderColumnsEditCustomDialog(),this.renderColumnsSelectorDialog(),this.renderCustomDialog(),this.renderEditValueDialog(),this.renderEditObjectDialog(),this.renderViewObjectFileDialog(),this.renderAliasEditorDialog(),this.renderEditRoleDialog(),this.renderEnumDialog(),this.renderErrorDialog(),this.renderExportDialog(),this.renderRenameDialog(),this.state.modalNewObj&&this.props.modalNewObject&&this.props.modalNewObject(this),this.state.modalEditOfAccess&&this.state.modalEditOfAccessObjData&&this.props.modalEditOfAccessControl&&this.props.modalEditOfAccessControl(this,this.state.modalEditOfAccessObjData))}}const ySe=Io()(it);class e5e extends M.Component{refTypo;height;width;constructor(e){super(e),this.state={closed:this.props.storeId?window.localStorage.getItem(this.props.storeId)==="true":!1},this.height=0,this.width=0,this.refTypo=M.createRef()}componentDidMount(){this.detectHeight()}onClick(){this.props.storeId&&this.props.closed===void 0&&(this.state.closed?window.localStorage.removeItem(this.props.storeId):window.localStorage.setItem(this.props.storeId,"true")),this.props.closed===void 0?this.setState({closed:!this.state.closed},()=>{this.props.onClose&&this.props.onClose(this.state.closed)}):this.props.onClose&&this.props.onClose(!this.props.closed)}detectHeight(){const e=this.props.closed!==void 0?this.props.closed:this.state.closed;this.props.closeable&&!e&&this.refTypo.current&&window.requestAnimationFrame(()=>{(this.props.closed!==void 0?this.props.closed:this.state.closed)||this.refTypo.current&&(!this.height||this.width!==this.refTypo.current.clientWidth)&&(this.height=this.refTypo.current.clientHeight,this.width=this.refTypo.current.clientWidth,this.forceUpdate())})}componentDidUpdate(){this.detectHeight()}render(){const e=this.props.closed!==void 0?this.props.closed:this.state.closed,t=e?kg:Ne;return M.createElement(j.Box,{className:"iom-info-box",style:{whiteSpace:"preserve",display:"flex",gap:8,alignItems:e||this.props.iconPosition==="top"?"flex-start":"center",borderWidth:1,borderStyle:"solid",padding:4,borderRadius:5,marginBottom:8,maxWidth:"100%",transition:"height 0.5s",height:this.props.closeable?e?30:this.height||void 0:void 0,overflow:this.props.closeable?"hidden":void 0,position:"relative",...this.props.style},sx:{borderColor:i=>this.props.type==="ok"?i.palette.info.main:i.palette[this.props.type].main}},this.props.type==="ok"?M.createElement(Oe,{style:{color:"#0F0"}}):this.props.type==="info"?M.createElement(Na,{color:"primary"}):M.createElement(Yg,{color:this.props.type}),M.createElement(j.Typography,{ref:this.refTypo},this.props.children),this.props.closeable?M.createElement(t,{sx:{color:i=>i.palette.mode==="dark"?"lightgray":"gray",cursor:"pointer",position:"absolute",top:4,right:4},onClick:()=>this.onClick()}):null,this.props.closeable?M.createElement("div",{style:{width:22}}):null,e?M.createElement(j.Box,{component:"div",sx:i=>{const r=i.palette[this.props.type==="ok"?"info":this.props.type].main;return{background:`linear-gradient(${r}00 0%, ${r}10 60%, ${r}90 100%)`}},style:{bottom:0,position:"absolute",left:0,right:0,height:10}}):null)}}const E={hr:{border:0,borderTop:"1px solid gray"},scrollWindow:{width:"100%",overflow:"auto",height:"calc(100% - 22px)"},rowDiv:{width:"100%"},modeDiv:{width:200,display:"inline-block",verticalAlign:"top"},settingsDiv:{display:"inline-block",verticalAlign:"top"},inputTime:{width:90,marginTop:0,marginLeft:5},inputDate:{width:140,marginTop:0,marginLeft:5},inputEvery:{width:40,marginLeft:5,marginRight:5},inputRadio:{padding:"4px 12px",verticalAlign:"top"},inputGroup:{maxWidth:400,display:"inline-block"},inputGroupElement:{width:120},inputDateDay:{width:60},inputDateDayCheck:{padding:4},inputSmallCheck:{padding:0},rowOnce:{},rowDays:s=>({background:s.palette.mode!=="dark"?"#ddeaff":"#4b5057"}),rowDows:s=>({background:s.palette.mode!=="dark"?"#DDFFDD":"#52646c"}),rowMonths:s=>({background:s.palette.mode!=="dark"?"#DDFFFF":"#1f5557"}),rowMonthsDates:s=>({background:s.palette.mode!=="dark"?"#EEFFFF":"#3c5737",maxWidth:600}),rowYears:s=>({background:s.palette.mode!=="dark"?"#fbffdd":"#574b33"}),rowDowsDows:s=>({background:s.palette.mode!=="dark"?"#EEFFEE":"#3d4c54",pl:"10px",pb:"10px"})},tn=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],zr=["January","February","March","April","May","June","July","August","September","October","November","December"],sn={minutes:"minutes",hours:"hours"},ji=["sunrise","sunriseEnd","goldenHourEnd","solarNoon","goldenHour","sunsetStart","sunset","dusk","nauticalDusk","night","nightEnd","nauticalDawn","dawn","nadir"];function gt(s){return s<10?`0${s}`:`${s}`}const Rl={time:{exactTime:!1,start:"00:00",end:"23:59",mode:"hours",interval:1},period:{once:"",days:1,dows:"",dates:"",weeks:0,months:"",years:0,yearMonth:0,yearDate:0},valid:{from:"",to:""}};function rn(s){const e=s.split(".");return e.length===3?`${e[2]}-${e[1]}-${e[0]}`:""}class De extends f.Component{refFrom;refTo;refOnce;timerOnce=null;timerFrom=null;timerTo=null;constructor(e){super(e);let t;if(this.props.schedule&&typeof this.props.schedule=="string"&&this.props.schedule[0]==="{")try{t=JSON.parse(this.props.schedule)}catch{}else typeof this.props.schedule=="object"&&(t=this.props.schedule);(!t||!Object.keys(t).length)&&(setTimeout(()=>this.onChange(this.state.schedule,!0),200),t=Rl),t={...Rl,...t},t.valid.from||=De.now2string(),this.refFrom=M.createRef(),this.refTo=M.createRef(),this.refOnce=M.createRef(),this.state={schedule:t,desc:De.state2text(t)},JSON.stringify(t)!==this.props.schedule&&setTimeout(()=>{var i,r;return(r=(i=this.props).onChange)==null?void 0:r.call(i,JSON.stringify(t))},100)}onChange(e,t){var r,o;const i=JSON.stringify(e)!==JSON.stringify(this.state.schedule);if(t||i){i&&this.setState({schedule:e,desc:De.state2text(e)});const n=JSON.parse(JSON.stringify(e));if(n.period.once){const a=n.period.once;delete n.period,n.period={once:a},delete n.valid}else if(n.period.days){const a=n.period.days,c=n.period.dows;delete n.period,n.period={days:a},c&&c!=="[]"&&(n.period.dows=c)}else if(n.period.weeks){const a=n.period.weeks,c=n.period.dows;delete n.period,n.period={weeks:a},c&&c!=="[]"&&(n.period.dows=c)}else if(n.period.months){const a=n.period.months,c=n.period.dates;delete n.period,n.period={months:a},c&&c!=="[]"&&(n.period.dates=c)}else if(n.period.years){const a=n.period.years,c=n.period.yearMonth,l=n.period.yearDate;delete n.period,n.period={years:a,yearDate:l},c&&(n.period.yearMonth=c)}if(n.time.exactTime?(delete n.time.end,delete n.time.mode,delete n.time.interval):delete n.time.exactTime,n.valid){if(n.valid.to||delete n.valid.to,n.period.days===1||n.period.weeks===1||n.period.months===1||n.period.years===1){const a=De.string2date(n.valid.from),c=new Date;c.setHours(0),c.setMinutes(0),c.setSeconds(0),c.setMilliseconds(0),a<=c&&delete n.valid.from}!n.valid.from&&!n.valid.to&&delete n.valid}(o=(r=this.props).onChange)==null||o.call(r,JSON.stringify(n),De.state2text(e))}}static state2text(e){if(typeof e=="string")try{e=JSON.parse(e)}catch{return""}const t=[],i=De.string2date(e.valid.from);if(e.period.once){const r=De.string2date(e.period.once),o=new Date;if(o.setMilliseconds(0),o.setSeconds(0),o.setMinutes(0),o.setHours(0),r<o)return h.t("sch_desc_onceInPast");t.push(h.t("sch_desc_once_on",e.period.once))}else if(e.period.days)if(e.period.days===1)if(e.period.dows){const r=JSON.parse(e.period.dows);if(r.length===2&&r[0]===0&&r[1]===6)t.push(h.t("sch_desc_onWeekends"));else if(r.length===5&&r[0]===1&&r[1]===2&&r[2]===3&&r[3]===4&&r[4]===5)t.push(h.t("sch_desc_onWorkdays"));else{const o=r.map(n=>h.t(tn[n]));if(o.length===1)t.push(h.t("sch_desc_onWeekday",o[0]));else if(o.length===7)t.push(h.t("sch_desc_everyDay"));else{const n=o.pop();t.push(h.t("sch_desc_onWeekdays",o.join(", "),n))}}}else t.push(h.t("sch_desc_everyDay"));else t.push(h.t("sch_desc_everyNDay",e.period.days.toString()));else if(e.period.weeks)if(e.period.weeks===1?t.push(h.t("sch_desc_everyWeek")):t.push(h.t("sch_desc_everyNWeeks",e.period.weeks.toString())),e.period.dows){const r=JSON.parse(e.period.dows);if(r.length===2&&r[0]===0&&r[1]===6)t.push(h.t("sch_desc_onWeekends"));else if(r.length===5&&r[0]===1&&r[1]===2&&r[2]===3&&r[3]===4&&r[4]===5)t.push(h.t("sch_desc_onWorkdays"));else{const o=r.map(n=>h.t(tn[n]));if(o.length===1)t.push(h.t("sch_desc_onWeekday",o[0]));else if(o.length===7)t.push(h.t("sch_desc_everyDay"));else{const n=o.pop();t.push(h.t("sch_desc_onWeekdays",o.join(", "),n))}}}else return h.t("sch_desc_never");else if(e.period.months){if(e.period.dates){const r=JSON.parse(e.period.dates);if(r.length===1)t.push(h.t("sch_desc_onDate",r[0]));else if(r.length===31)t.push(h.t("sch_desc_onEveryDate"));else if(r.length){const o=r.pop();t.push(h.t("sch_desc_onDates",r.join(", "),o))}else return h.t("sch_desc_never")}else t.push(h.t("sch_desc_onEveryDate"));if(e.period.months===1)t.push(h.t("sch_desc_everyMonth"));else if(typeof e.period.months=="number")t.push(h.t("sch_desc_everyNMonths",e.period.months.toString()));else{const o=JSON.parse(e.period.months).map(n=>h.t(zr[n-1]));if(!o.length)return h.t("sch_desc_never");if(o.length===1)t.push(h.t("sch_desc_onMonth",o[0]));else if(o.length===12)t.push(h.t("sch_desc_everyMonth"));else{const n=o.pop();t.push(h.t("sch_desc_onMonths",o.join(", "),n))}}}else e.period.years&&(e.period.years===1?t.push(h.t("sch_desc_everyYear")):t.push(h.t("sch_desc_everyNYears",e.period.years.toString())),t.push(h.t("sch_desc_onDate",e.period.yearDate.toString(),e.period.yearMonth?h.t(zr[e.period.yearMonth-1]):h.t("sch_desc_everyMonth"))));if(e.time.exactTime)ji.includes(e.time.start)?t.push(h.t("sch_desc_atTime",h.t(`sch_astro_${e.time.start}`))):t.push(h.t("sch_desc_atTime",e.time.start));else{e.time.mode===sn.minutes?e.time.interval===1?t.push(h.t("sch_desc_everyMinute")):t.push(h.t("sch_desc_everyNMinutes",e.time.interval.toString())):e.time.interval===1?t.push(h.t("sch_desc_everyHour")):t.push(h.t("sch_desc_everyNHours",e.time.interval.toString()));const r=ji.indexOf(e.time.start)!==-1?h.t(`sch_astro_${e.time.start}`):e.time.start,o=ji.indexOf(e.time.end)!==-1?h.t(`sch_astro_${e.time.end}`):e.time.end;(r!=="00:00"||o!=="24:00"&&o!=="23:59")&&t.push(h.t("sch_desc_intervalFromTo",r,o))}return e.period.once||(i.getTime()>Date.now()&&e.valid.to?t.push(h.t("sch_desc_validFromTo",e.valid.from,e.valid.to)):i.getTime()>Date.now()?t.push(h.t("sch_desc_validFrom",e.valid.from)):e.valid.to&&t.push(h.t("sch_desc_validTo",e.valid.to))),t.join(" ")}getTimePeriodElements(){const e=this.state.schedule;let t=!1,i=!1,r=!1,o=!0;return e.time.start==="00:00"&&e.time.end==="24:00"?(t=!0,o=!1):e.time.start==="sunrise"?(i=!0,o=!1):e.time.start==="sunset"&&(r=!0,o=!1),M.createElement("div",{key:"timePeriod",style:E.rowDiv},M.createElement("div",{style:E.modeDiv},M.createElement(j.FormControlLabel,{control:M.createElement(j.Radio,{style:E.inputRadio,checked:!e.time.exactTime,onClick:()=>{const n=JSON.parse(JSON.stringify(this.state.schedule));n.time.exactTime=!1,this.onChange(n)}}),label:h.t("sch_intervalTime")})),M.createElement("div",{style:E.settingsDiv},M.createElement("div",{style:E.settingsDiv},!e.time.exactTime&&M.createElement("div",null,M.createElement("div",null,M.createElement(j.FormControlLabel,{control:M.createElement(j.Radio,{style:E.inputRadio,checked:!!o,onClick:()=>{const n=JSON.parse(JSON.stringify(this.state.schedule));n.time.start="00:00",n.time.end="23:59",this.onChange(n)}}),label:o?"":h.t("sch_fromTo")}),o&&[M.createElement(j.TextField,{variant:"standard",style:{...E.inputTime,marginRight:10},key:"exactTimeFrom",type:"time",sx:n=>({'& input[type="time"]::-webkit-calendar-picker-indicator':{filter:n.palette.mode==="dark"?"invert(80%)":void 0}}),value:this.state.schedule.time.start,onChange:n=>{const a=JSON.parse(JSON.stringify(this.state.schedule));a.time.start=n.target.value,this.onChange(a)},slotProps:{inputLabel:{shrink:!0}},label:h.t("sch_from"),margin:"normal"}),M.createElement(j.TextField,{variant:"standard",style:E.inputTime,key:"exactTimeTo",type:"time",sx:n=>({'& input[type="time"]::-webkit-calendar-picker-indicator':{filter:n.palette.mode==="dark"?"invert(80%)":void 0}}),value:this.state.schedule.time.end,onChange:n=>{const a=JSON.parse(JSON.stringify(this.state.schedule));a.time.end=n.target.value,this.onChange(a)},slotProps:{inputLabel:{shrink:!0}},label:h.t("sch_to"),margin:"normal"})])),!e.time.exactTime&&M.createElement("div",null,M.createElement(j.FormControlLabel,{control:M.createElement(j.Radio,{style:E.inputRadio,checked:!!t,onClick:()=>{const n=JSON.parse(JSON.stringify(this.state.schedule));n.time.start="00:00",n.time.end="24:00",this.onChange(n)}}),label:h.t("sch_wholeDay")})),!e.time.exactTime&&M.createElement("div",null,M.createElement(j.FormControlLabel,{control:M.createElement(j.Radio,{style:E.inputRadio,checked:!!i,onClick:()=>{const n=JSON.parse(JSON.stringify(this.state.schedule));n.time.start="sunrise",n.time.end="sunset",this.onChange(n)}}),label:h.t("sch_astroDay")})),!e.time.exactTime&&M.createElement("div",null,M.createElement(j.FormControlLabel,{control:M.createElement(j.Radio,{style:E.inputRadio,checked:!!r,onClick:()=>{const n=JSON.parse(JSON.stringify(this.state.schedule));n.time.start="sunset",n.time.end="sunrise",this.onChange(n)}}),label:h.t("sch_astroNight")}))),!e.time.exactTime&&this.getPeriodSettingsMinutes(o)))}getTimeExactElements(){const e=ji.includes(this.state.schedule.time.start);return M.createElement("div",{key:"timeExact",style:E.rowDiv},M.createElement("div",{style:E.modeDiv},M.createElement(j.FormControlLabel,{control:M.createElement(j.Radio,{style:E.inputRadio,checked:!!this.state.schedule.time.exactTime,onClick:()=>{const t=JSON.parse(JSON.stringify(this.state.schedule));t.time.exactTime=!0,this.onChange(t)}}),label:h.t("sch_exactTime")})),this.state.schedule.time.exactTime&&M.createElement(j.Select,{variant:"standard",value:e?this.state.schedule.time.start:"00:00",onChange:t=>{const i=JSON.parse(JSON.stringify(this.state.schedule));i.time.start=t.target.value,this.onChange(i)}},M.createElement(j.MenuItem,{key:"specific",value:"00:00"},h.t("sch_specificTime")),ji.map(t=>M.createElement(j.MenuItem,{key:t,value:t},h.t(`sch_astro_${t}`)))),this.state.schedule.time.exactTime&&!e&&M.createElement("div",{style:E.settingsDiv},M.createElement(j.TextField,{variant:"standard",style:E.inputTime,key:"exactTimeValue",value:this.state.schedule.time.start,type:"time",sx:t=>({'& input[type="time"]::-webkit-calendar-picker-indicator':{filter:t.palette.mode==="dark"?"invert(80%)":void 0}}),onChange:t=>{const i=JSON.parse(JSON.stringify(this.state.schedule));i.time.start=t.target.value,this.onChange(i)},slotProps:{inputLabel:{shrink:!0}},margin:"normal"})))}static getDivider(){return M.createElement("hr",{style:E.hr})}getPeriodModes(){const e=this.state.schedule,t=!e.period.dows&&!e.period.months&&!e.period.dates&&!e.period.years&&!e.period.days&&!e.period.weeks;return t&&!e.period.once&&(e.period.once=De.now2string(!0)),[M.createElement("div",{key:"once",style:{...E.rowDiv,...E.rowOnce}},M.createElement("div",{style:E.modeDiv},M.createElement(j.FormControlLabel,{control:M.createElement(j.Radio,{style:E.inputRadio,checked:!!t,onClick:()=>{const i=JSON.parse(JSON.stringify(this.state.schedule));i.period.once||=De.now2string(!0),i.period.dows="",i.period.months="",i.period.dates="",i.period.years=0,i.period.yearDate=0,i.period.yearMonth=0,i.period.weeks=0,i.period.days=0,this.onChange(i)}}),label:h.t("sch_periodOnce")})),t&&M.createElement("div",{style:E.settingsDiv},M.createElement(j.TextField,{variant:"standard",style:E.inputDate,type:"date",ref:this.refOnce,key:"exactDateAt",defaultValue:rn(e.period.once),onChange:i=>{this.timerOnce&&clearTimeout(this.timerOnce),this.timerOnce=null,this.refOnce.current&&(this.refOnce.current.style.background="#ff000030"),this.timerOnce=setTimeout(r=>{this.timerOnce=null,this.refOnce.current&&(this.refOnce.current.style.background="");const o=JSON.parse(JSON.stringify(this.state.schedule)),n=De.string2date(r);n.toString()!=="Invalid Date"&&(o.period.once=`${gt(n.getDate())}.${gt(n.getMonth()+1)}.${n.getFullYear()}`,this.onChange(o))},1500,i.target.value)},slotProps:{inputLabel:{shrink:!0}},label:h.t("sch_at"),margin:"normal"}))),M.createElement(j.Box,{component:"div",key:"days",sx:O.getStyle(this.props.theme,E.rowDiv,E.rowDays)},M.createElement("div",{style:E.modeDiv},M.createElement(j.FormControlLabel,{control:M.createElement(j.Radio,{style:E.inputRadio,checked:!!e.period.days,onClick:()=>{const i=JSON.parse(JSON.stringify(this.state.schedule));i.period.days=1,i.period.dows="",i.period.months="",i.period.dates="",i.period.years=0,i.period.yearDate=0,i.period.yearMonth=0,i.period.weeks=0,i.period.once="",this.onChange(i)}}),label:h.t("sch_periodDaily")})),M.createElement("div",{style:E.settingsDiv},this.getPeriodSettingsDaily(),e.period.days?this.getPeriodSettingsWeekdays():null)),M.createElement(j.Box,{component:"div",key:"weeks",sx:O.getStyle(this.props.theme,E.rowDiv,E.rowDows)},M.createElement("div",{style:E.modeDiv},M.createElement(j.FormControlLabel,{control:M.createElement(j.Radio,{style:E.inputRadio,checked:!!e.period.weeks,onClick:()=>{const i=JSON.parse(JSON.stringify(this.state.schedule));i.period.weeks=e.period.weeks?0:1,i.period.dows||="[0]",i.period.months="",i.period.dates="",i.period.years=0,i.period.yearDate=0,i.period.yearMonth=0,i.period.days=0,i.period.once="",this.onChange(i)}}),label:h.t("sch_periodWeekly")})),M.createElement(j.Box,{component:"div",style:E.settingsDiv},M.createElement("div",{style:E.settingsDiv},this.getPeriodSettingsWeekly()),M.createElement(j.Box,{component:"div",sx:O.getStyle(this.props.theme,E.settingsDiv,E.rowDowsDows)},this.state.schedule.period.weeks?this.getPeriodSettingsWeekdays():null))),M.createElement(j.Box,{component:"div",key:"months",sx:O.getStyle(this.props.theme,E.rowDiv,E.rowMonths)},M.createElement("div",{style:E.modeDiv},M.createElement(j.FormControlLabel,{control:M.createElement(j.Radio,{style:E.inputRadio,checked:!!e.period.months,onClick:()=>{const i=JSON.parse(JSON.stringify(this.state.schedule));i.period.months=1,i.period.dows="",i.period.dates="",i.period.years=0,i.period.yearDate=0,i.period.yearMonth=0,i.period.weeks=0,i.period.days=0,i.period.once="",this.onChange(i)}}),label:h.t("sch_periodMonthly")})),M.createElement("div",{style:E.settingsDiv},this.getPeriodSettingsMonthly(),e.period.months?M.createElement(j.Box,null,M.createElement(j.Box,{component:"div",sx:O.getStyle(this.props.theme,E.settingsDiv,E.rowMonthsDates)},M.createElement(j.FormControlLabel,{control:M.createElement(j.Checkbox,{style:E.inputRadio,checked:!!e.period.dates,onClick:()=>{const i=JSON.parse(JSON.stringify(this.state.schedule));i.period.months||=1;const r=[];for(let o=1;o<=31;o++)r.push(o);i.period.dates||=JSON.stringify(r),i.period.dows="",i.period.years=0,i.period.yearDate=0,i.period.yearMonth=0,i.period.weeks=0,i.period.days=0,i.period.once="",this.onChange(i)}}),label:h.t("sch_periodDates")})),M.createElement(j.Box,{component:"div",sx:O.getStyle(this.props.theme,E.settingsDiv,E.rowMonthsDates)},this.getPeriodSettingsDates())):null)),M.createElement(j.Box,{component:"div",key:"years",sx:O.getStyle(this.props.theme,E.rowDiv,E.rowYears)},M.createElement("div",{style:E.modeDiv},M.createElement(j.FormControlLabel,{control:M.createElement(j.Radio,{style:E.inputRadio,checked:!!e.period.years,onClick:()=>{const i=JSON.parse(JSON.stringify(this.state.schedule));i.period.years=1,i.period.yearDate=1,i.period.yearMonth=1,i.period.dows="",i.period.months=0,i.period.dates="",i.period.weeks=0,i.period.days=0,i.period.once="",this.onChange(i)}}),label:h.t("sch_periodYearly")})),M.createElement("div",{style:E.settingsDiv},M.createElement("div",{style:E.settingsDiv},this.getPeriodSettingsYearly()),!!e.period.years&&M.createElement("div",{style:E.settingsDiv},M.createElement("span",null,h.t("sch_on")),M.createElement(j.Input,{key:"input",value:this.state.schedule.period.yearDate,style:E.inputEvery,type:"number",inputProps:{min:1,max:31},onChange:i=>{const r=JSON.parse(JSON.stringify(this.state.schedule));r.period.yearDate=parseInt(i.target.value,10),r.period.yearDate<1&&(r.period.yearDate=31),r.period.yearDate>31&&(r.period.yearDate=1),this.onChange(r)}}),M.createElement(j.Select,{variant:"standard",value:e.period.yearMonth,onChange:i=>{const r=JSON.parse(JSON.stringify(this.state.schedule));r.period.yearMonth=i.target.value,this.onChange(r)}},M.createElement(j.MenuItem,{key:"every",value:0},h.t("sch_yearEveryMonth")),zr.map((i,r)=>M.createElement(j.MenuItem,{key:i,value:r+1},h.t(i)))))))]}getPeriodSettingsMinutes(e){return M.createElement("div",{style:{display:"inline-block",marginTop:e?15:"inherit"}},M.createElement("label",{style:{marginLeft:4,marginRight:4}},h.t("sch_every")),M.createElement(j.Input,{value:this.state.schedule.time.interval,style:{...E.inputEvery,verticalAlign:"bottom"},type:"number",inputProps:{min:1},onChange:t=>{const i=JSON.parse(JSON.stringify(this.state.schedule));i.time.interval=parseInt(t.target.value,10),this.onChange(i)}}),M.createElement(j.Select,{variant:"standard",value:this.state.schedule.time.mode,onChange:t=>{const i=JSON.parse(JSON.stringify(this.state.schedule));i.time.mode=t.target.value,this.onChange(i)}},M.createElement(j.MenuItem,{value:sn.minutes},h.t("sch_periodMinutes")),M.createElement(j.MenuItem,{value:sn.hours},h.t("sch_periodHours"))))}getPeriodSettingsWeekdays(){const e=this.state.schedule,t=e.period.dows&&e.period.dows!=="[1, 2, 3, 4, 5]"&&e.period.dows!=="[0, 6]";return[M.createElement("div",{key:"workdays"},M.createElement(j.FormControlLabel,{control:M.createElement(j.Radio,{style:E.inputRadio,checked:e.period.dows==="[1, 2, 3, 4, 5]",onClick:()=>{const i=JSON.parse(JSON.stringify(this.state.schedule));i.period.dows="[1, 2, 3, 4, 5]",i.period.days&&(i.period.days=1),this.onChange(i)}}),label:h.t("sch_periodWorkdays")})),M.createElement("div",{key:"weekend"},M.createElement(j.FormControlLabel,{control:M.createElement(j.Radio,{style:E.inputRadio,checked:e.period.dows==="[0, 6]",onClick:()=>{const i=JSON.parse(JSON.stringify(this.state.schedule));i.period.dows="[0, 6]",i.period.days&&(i.period.days=1),this.onChange(i)}}),label:h.t("sch_periodWeekend")})),M.createElement("div",{key:"specific",style:{verticalAlign:"top"}},M.createElement(j.FormControlLabel,{style:{verticalAlign:"top"},control:M.createElement(j.Radio,{style:E.inputRadio,checked:!!t,onClick:()=>{const i=JSON.parse(JSON.stringify(this.state.schedule));i.period.dows="[0, 1, 2, 3, 4, 5, 6]",i.period.days&&(i.period.days=1),this.onChange(i)}}),label:h.t("sch_periodWeekdays")}),t&&(e.period.days===1||e.period.weeks)&&M.createElement(j.FormGroup,{row:!0,style:{...E.inputGroup,width:150}},[1,2,3,4,5,6,0].map(i=>M.createElement(j.FormControlLabel,{key:`specific_${i}`,style:E.inputGroupElement,control:M.createElement(j.Checkbox,{style:E.inputSmallCheck,checked:e.period.dows.includes(i.toString()),onChange:r=>{const o=JSON.parse(JSON.stringify(this.state.schedule));let n;try{n=JSON.parse(o.period.dows)}catch{n=[]}r.target.checked&&!n.includes(i)?n.push(i):!r.target.checked&&n.includes(i)&&n.splice(n.indexOf(i),1),n.sort((a,c)=>a-c),o.period.dows=JSON.stringify(n),o.period.days&&(o.period.days=1),this.onChange(o)}}),label:h.t(tn[i])}))))]}getPeriodSettingsDaily(){if(!this.state.schedule.period.days)return null;const e=this.state.schedule;return[M.createElement("div",{key:"every_day"},M.createElement(j.FormControlLabel,{control:M.createElement(j.Radio,{style:E.inputRadio,checked:e.period.days===1&&!e.period.dows,onClick:()=>{const t=JSON.parse(JSON.stringify(this.state.schedule));t.period.days=1,t.period.dows="",this.onChange(t)}}),label:h.t("sch_periodEveryDay")})),M.createElement("div",{key:"everyN_day"},M.createElement(j.FormControlLabel,{control:M.createElement(j.Radio,{style:E.inputRadio,checked:e.period.days>1,onClick:()=>{const t=JSON.parse(JSON.stringify(this.state.schedule));t.period.days=2,t.period.dows="",this.onChange(t)}}),label:h.t("sch_periodEvery")}),e.period.days>1&&[M.createElement(j.Input,{key:"input",value:this.state.schedule.period.days,style:E.inputEvery,type:"number",inputProps:{min:2},onChange:t=>{const i=JSON.parse(JSON.stringify(this.state.schedule));i.period.days=parseInt(t.target.value,10),i.period.dows="",this.onChange(i)}}),M.createElement("span",{key:"span",style:{paddingRight:10}},h.t("sch_periodDay"))])]}getPeriodSettingsWeekly(){if(!this.state.schedule.period.weeks)return null;const e=this.state.schedule;return[M.createElement("div",{key:"radios",style:{display:"inline-block",verticalAlign:"top"}},M.createElement("div",null,M.createElement(j.FormControlLabel,{control:M.createElement(j.Radio,{style:E.inputRadio,checked:e.period.weeks===1,onClick:()=>{const t=JSON.parse(JSON.stringify(this.state.schedule));t.period.weeks=1,this.onChange(t)}}),label:h.t("sch_periodEveryWeek")})),M.createElement("div",null,M.createElement(j.FormControlLabel,{control:M.createElement(j.Radio,{style:E.inputRadio,checked:e.period.weeks>1,onClick:()=>{const t=JSON.parse(JSON.stringify(this.state.schedule));t.period.weeks=2,this.onChange(t)}}),label:h.t("sch_periodEvery")}),e.period.weeks>1&&[M.createElement(j.Input,{key:"input",value:this.state.schedule.period.weeks,style:E.inputEvery,type:"number",inputProps:{min:2},onChange:t=>{const i=JSON.parse(JSON.stringify(this.state.schedule));i.period.weeks=parseInt(t.target.value,10),this.onChange(i)}}),M.createElement("span",{key:"text"},h.t("sch_periodWeek"))]))]}getPeriodSettingsDates(){if(!this.state.schedule.period.dates)return null;const e=this.state.schedule,t=[];for(let r=1;r<=31;r++)t.push(r);const i=JSON.parse(e.period.dates);return M.createElement(j.FormGroup,{row:!0,style:{...E.inputGroup,maxWidth:620}},M.createElement(j.FormControlLabel,{style:E.inputDateDay,control:M.createElement(j.Checkbox,{style:E.inputDateDayCheck,checked:i.length===31,onChange:()=>{const r=JSON.parse(JSON.stringify(this.state.schedule)),o=[];for(let n=1;n<=31;n++)o.push(n);r.period.dates=JSON.stringify(o),this.onChange(r)}}),label:h.t("sch_all")}),M.createElement(j.FormControlLabel,{style:E.inputDateDay,control:M.createElement(j.Checkbox,{style:E.inputDateDayCheck,checked:!i.length,onChange:()=>{const r=JSON.parse(JSON.stringify(this.state.schedule));r.period.dates="[]",this.onChange(r)}}),label:h.t("sch_no_one")}),i.length!==31&&!!i.length&&M.createElement(j.FormControlLabel,{style:E.inputDateDay,control:M.createElement(j.Checkbox,{style:E.inputDateDayCheck,checked:!1,onChange:()=>{const r=JSON.parse(JSON.stringify(this.state.schedule)),o=[],n=JSON.parse(r.period.dates);for(let a=1;a<=31;a++)n.includes(a)||o.push(a);o.sort((a,c)=>a-c),r.period.dates=JSON.stringify(o),this.onChange(r)}}),label:h.t("sch_invert")}),M.createElement("div",null),t.map(r=>M.createElement(j.FormControlLabel,{key:`date_${r}`,style:r?E.inputDateDay:{...E.inputDateDay,opacity:0,cursor:"default",userSelect:"none",pointerEvents:"none"},control:M.createElement(j.Checkbox,{style:E.inputDateDayCheck,checked:JSON.parse(e.period.dates).includes(r),onChange:o=>{const n=JSON.parse(JSON.stringify(this.state.schedule));let a;try{a=JSON.parse(n.period.dates)}catch{a=[]}o.target.checked&&!a.includes(r)?a.push(r):!o.target.checked&&a.includes(r)&&a.splice(a.indexOf(r),1),a.sort((c,l)=>c-l),n.period.dates=JSON.stringify(a),this.onChange(n)}}),label:r<10?[M.createElement("span",{key:"0",style:{opacity:0}},"0"),M.createElement("span",{key:"num"},r)]:r})))}getPeriodSettingsMonthly(){if(!this.state.schedule.period.months)return null;const e=this.state.schedule,t=typeof e.period.months=="string"?JSON.parse(e.period.months):[];return[M.createElement("div",{key:"every"},M.createElement(j.FormControlLabel,{control:M.createElement(j.Radio,{style:E.inputRadio,checked:typeof e.period.months=="number"&&e.period.months===1,onClick:()=>{const i=JSON.parse(JSON.stringify(this.state.schedule));i.period.months=1,this.onChange(e)}}),label:h.t("sch_periodEveryMonth")})),M.createElement("div",{key:"everyN"},M.createElement(j.FormControlLabel,{control:M.createElement(j.Radio,{style:E.inputRadio,checked:typeof e.period.months=="number"&&e.period.months>1,onClick:()=>{const i=JSON.parse(JSON.stringify(this.state.schedule));i.period.months=2,this.onChange(i)}}),label:h.t("sch_periodEvery")}),typeof e.period.months=="number"&&e.period.months>1&&[M.createElement(j.Input,{key:"input",value:e.period.months,style:E.inputEvery,type:"number",inputProps:{min:2},onChange:i=>{const r=JSON.parse(JSON.stringify(this.state.schedule));r.period.months=parseInt(i.target.value,10),r.period.months<1&&(r.period.months=1),this.onChange(r)}}),M.createElement("span",{key:"text"},h.t("sch_periodMonth"))]),M.createElement("div",{key:"specific",style:{verticalAlign:"top"}},M.createElement(j.FormControlLabel,{style:{verticalAlign:"top"},control:M.createElement(j.Radio,{style:E.inputRadio,checked:typeof e.period.months=="string",onClick:()=>{const i=JSON.parse(JSON.stringify(this.state.schedule));i.period.months="[1,2,3,4,5,6,7,8,9,10,11,12]",this.onChange(i)}}),label:h.t("sch_periodSpecificMonths")}),typeof e.period.months=="string"&&M.createElement(j.FormGroup,{row:!0,style:E.inputGroup},M.createElement(j.FormControlLabel,{style:E.inputDateDay,control:M.createElement(j.Checkbox,{style:E.inputDateDayCheck,checked:t.length===12,onChange:()=>{const i=JSON.parse(JSON.stringify(this.state.schedule)),r=[];for(let o=1;o<=12;o++)r.push(o);i.period.months=JSON.stringify(r),this.onChange(i)}}),label:h.t("sch_all")}),M.createElement(j.FormControlLabel,{style:E.inputDateDay,control:M.createElement(j.Checkbox,{style:E.inputDateDayCheck,checked:!t.length,onChange:()=>{const i=JSON.parse(JSON.stringify(this.state.schedule));i.period.months="[]",this.onChange(i)}}),label:h.t("sch_no_one")}),t.length!==12&&!!t.length&&M.createElement(j.FormControlLabel,{style:E.inputDateDay,control:M.createElement(j.Checkbox,{style:E.inputDateDayCheck,checked:!1,onChange:()=>{const i=JSON.parse(JSON.stringify(this.state.schedule)),r=[],o=JSON.parse(i.period.months);for(let n=1;n<=12;n++)o.includes(n)||r.push(n);r.sort((n,a)=>n-a),i.period.months=JSON.stringify(r),this.onChange(i)}}),label:h.t("sch_invert")}),M.createElement("div",null),zr.map((i,r)=>M.createElement(j.FormControlLabel,{key:`month_${r}`,style:E.inputGroupElement,control:M.createElement(j.Checkbox,{style:E.inputSmallCheck,checked:typeof e.period.months=="string"?JSON.parse(e.period.months).includes(r+1):e.period.months===r,onChange:o=>{const n=JSON.parse(JSON.stringify(this.state.schedule));let a;try{a=JSON.parse(n.period.months)}catch{a=[]}o.target.checked&&!a.includes(r+1)?a.push(r+1):!o.target.checked&&a.includes(r+1)&&a.splice(a.indexOf(r+1),1),a.sort((c,l)=>c-l),n.period.months=JSON.stringify(a),this.onChange(n)}}),label:h.t(i)}))))]}getPeriodSettingsYearly(){if(!this.state.schedule.period.years)return null;const e=this.state.schedule;return[M.createElement("div",{key:"year"},M.createElement(j.FormControlLabel,{control:M.createElement(j.Radio,{style:E.inputRadio,checked:e.period.years===1,onClick:()=>{const t=JSON.parse(JSON.stringify(this.state.schedule));t.period.years=1,this.onChange(t)}}),label:h.t("sch_periodEveryYear")})),M.createElement("div",{key:"every"},M.createElement(j.FormControlLabel,{control:M.createElement(j.Radio,{style:E.inputRadio,checked:e.period.years>1,onClick:()=>{const t=JSON.parse(JSON.stringify(this.state.schedule));t.period.years=2,this.onChange(t)}}),label:h.t("sch_periodEvery")}),e.period.years>1&&[M.createElement(j.Input,{key:"input",value:this.state.schedule.period.years,style:E.inputEvery,type:"number",inputProps:{min:2},onChange:t=>{const i=JSON.parse(JSON.stringify(this.state.schedule));i.period.years=parseInt(t.target.value,10),i.period.years<1&&(i.period.years=1),this.onChange(i)}}),M.createElement("span",{key:"text"},h.t("sch_periodYear"))])]}static now2string(e){const t=new Date;return t.setHours(0),t.setMinutes(0),t.setSeconds(0),t.setMilliseconds(0),e&&(t.setDate(t.getDate()+2),t.setMilliseconds(t.getMilliseconds()-1)),`${gt(t.getDate())}.${gt(t.getMonth()+1)}.${gt(t.getFullYear())}`}static string2date(e){let t=e.split(".");return t.length===1?(t=e.split("-"),new Date(parseInt(t[0],10),parseInt(t[1],10)-1,parseInt(t[2],10))):new Date(parseInt(t[2],10),parseInt(t[1],10)-1,parseInt(t[0],10))}getValidSettings(){const e=this.state.schedule;return M.createElement("div",{style:E.rowDiv},M.createElement("div",{style:{...E.modeDiv,verticalAlign:"middle"}},M.createElement("span",{style:{fontWeight:"bold",paddingRight:10}},h.t("sch_valid")),M.createElement("span",null,h.t("sch_validFrom"))),M.createElement("div",{style:E.settingsDiv},M.createElement(j.TextField,{variant:"standard",style:{...E.inputDate,marginRight:10},key:"exactTimeFrom",inputRef:this.refFrom,defaultValue:rn(e.valid.from),type:"date",onChange:t=>{this.timerFrom&&clearTimeout(this.timerFrom),this.refFrom.current&&(this.refFrom.current.style.background="#ff000030"),this.timerFrom=setTimeout(i=>{this.timerFrom=null,this.refFrom.current&&(this.refFrom.current.style.background="");const r=JSON.parse(JSON.stringify(this.state.schedule)),o=De.string2date(i);o.toString()!=="Invalid Date"&&(r.valid.from=`${gt(o.getDate())}.${gt(o.getMonth()+1)}.${o.getFullYear()}`,this.onChange(r))},1500,t.target.value)},slotProps:{inputLabel:{shrink:!0}},margin:"normal"}),M.createElement(j.FormControlLabel,{control:M.createElement(j.Checkbox,{style:E.inputRadio,checked:!!e.valid.to,onClick:()=>{const t=JSON.parse(JSON.stringify(this.state.schedule));t.valid.to=t.valid.to?"":De.now2string(!0),this.onChange(t)}}),label:h.t("sch_validTo")}),!!e.valid.to&&M.createElement(j.TextField,{variant:"standard",inputRef:this.refTo,style:{...E.inputDate,marginRight:10},key:"exactTimeFrom",type:"date",defaultValue:rn(e.valid.to),onChange:t=>{this.timerTo&&clearTimeout(this.timerTo),this.refTo.current&&(this.refTo.current.style.background="#ff000030"),this.timerTo=setTimeout(i=>{this.timerTo=null,this.refTo.current&&(this.refTo.current.style.background="");const r=JSON.parse(JSON.stringify(this.state.schedule)),o=De.string2date(i);o.toString()!=="Invalid Date"&&(r.valid.to=`${gt(o.getDate())}.${gt(o.getMonth()+1)}.${o.getFullYear()}`,this.onChange(r))},1500,t.target.value)},slotProps:{inputLabel:{shrink:!0}},margin:"normal"})))}render(){return M.createElement("div",{style:{height:"calc(100% - 48px)",width:"100%",overflow:"hidden"}},M.createElement("div",null,this.state.desc),M.createElement("div",{style:E.scrollWindow},M.createElement("h5",null,h.t("sch_time")),this.getTimePeriodElements(),this.getTimeExactElements(),De.getDivider(),M.createElement("h5",null,h.t("sch_period")),this.getPeriodModes(),!this.state.schedule.period.once&&De.getDivider(),!this.state.schedule.period.once&&this.getValidSettings()))}}const wr={different:{opacity:.5},icon:{width:16,height:16,marginRight:8}};class t5e extends f.Component{wordDifferent;timeout=null;constructor(e){super(e),e.different&&(this.wordDifferent=e.t("ra___different__"));let t;Array.isArray(e.list)?t=e.list.filter(i=>(i==null?void 0:i._id)&&i.common).map(i=>{var r,o;return{name:O.getObjectNameFromObj(i,e.lang).replace("system.group.","").replace("system.user.","").replace("enum.rooms.","").replace("enum.functions.",""),value:i._id,icon:(r=i.common)==null?void 0:r.icon,color:(o=i.common)==null?void 0:o.color}}):t=Object.values(e.list).filter(i=>(i==null?void 0:i._id)&&i.common).map(i=>{var r,o;return{name:O.getObjectNameFromObj(i,e.lang).replace("system.group.","").replace("system.user.","").replace("enum.rooms.","").replace("enum.functions.",""),value:i._id,icon:(r=i.common)==null?void 0:r.icon,color:(o=i.common)==null?void 0:o.color}}),e.different&&e.value===e.different&&t.unshift({value:e.different,name:this.wordDifferent||""}),e.allowNone&&t.unshift({value:"",name:h.t("ra_none")}),this.state={list:t}}render(){this.props.allowNone&&!this.state.list.find(r=>r.value==="")?this.timeout=this.timeout||setTimeout(()=>{this.timeout=null;const r=JSON.parse(JSON.stringify(this.state.list));r.unshift({value:"",name:h.t("ra_none")}),this.setState({list:r})},100):!this.props.allowNone&&this.state.list.find(r=>r.value==="")&&(this.timeout=this.timeout||setTimeout(()=>{this.timeout=null;const r=JSON.parse(JSON.stringify(this.state.list)),o=this.state.list.findIndex(n=>n.value==="");r.splice(o,1),this.setState({list:r})},100));const e=this.state.list.find(r=>r.value===this.props.value||this.props.removePrefix&&r.value.replace(this.props.removePrefix,"")===this.props.value),t=this.props.value===this.props.different?{}:{color:(e==null?void 0:e.color)||void 0,backgroundColor:O.getInvertedColor((e==null?void 0:e.color)||"",this.props.themeType)};this.props.dense&&this.props.style&&Object.assign(t,this.props.style);const i=M.createElement(j.Select,{variant:"standard",disabled:this.props.disabled,value:this.props.value,slotProps:{input:this.props.inputProps},renderValue:()=>M.createElement("span",null,e!=null&&e.icon?M.createElement(me,{src:e==null?void 0:e.icon,style:wr.icon}):null,e==null?void 0:e.name),sx:{"&.MuiSelect-root":this.props.value===this.props.different?wr.different:{}},classes:{root:this.props.dense?this.props.className:""},style:t,onChange:r=>{if(this.props.different&&r.target.value!==this.props.different){let o=null;for(let n=0;n<this.state.list.length;n++)if(this.state.list[n].value===this.props.different){o=n;break}if(o!==null){const n=O.clone(this.state.list);n.splice(o,1),this.setState({list:n},()=>this.props.onChange(r.target.value));return}}this.props.onChange(this.props.removePrefix?r.target.value.replace(this.props.removePrefix,""):r.target.value)}},this.state.list.map(r=>M.createElement(j.MenuItem,{style:this.props.different&&r.value===this.props.different?wr.different:{color:r.color||void 0,backgroundColor:O.getInvertedColor(r.color||"",this.props.themeType)},key:r.value,value:r.value},r.icon?M.createElement(me,{src:r.icon,style:wr.icon}):null,r.name)));return this.props.dense?i:M.createElement(j.FormControl,{variant:"standard",fullWidth:!!this.props.fullWidth,style:this.props.style,className:this.props.className},M.createElement(j.InputLabel,null,this.props.label),i)}}class s5e extends f.Component{resizerRefTable;resizerActiveIndex;resizerActiveDiv;resizerCurrentWidths;widthFilled=!1;installTimeout=null;resizerMin=0;resizerMinNext=0;resizerPosition=0;resizerOldWidth=0;resizerOldWidthNext=0;constructor(e){super(e),this.resizerRefTable=M.createRef(),this.resizerActiveIndex=null,this.resizerActiveDiv=null,this.resizerCurrentWidths=[]}componentDidMount(){this.resizerInstall()}componentWillUnmount(){this.resizerUninstall()}resizerInstall(){if(this.resizerRefTable.current&&!this.resizerRefTable.current._installed){this.resizerRefTable.current._installed=!0;const e=this.resizerRefTable.current.querySelectorAll("th"),t=(window._localStorage||window.localStorage).getItem(`App.${this.props.name||"history"}.table`);if(this.widthFilled=!1,t)try{this.resizerCurrentWidths=JSON.parse(t),this.widthFilled=!0}catch{}if(this.widthFilled)if(this.resizerCurrentWidths.length!==e.length)this.resizerCurrentWidths=[],this.widthFilled=!1;else{const i=this.resizerRefTable.current.offsetWidth;let r=0;for(let o=0;o<this.resizerCurrentWidths.length;o++)if(window.isFinite(this.resizerCurrentWidths[o]))r+=this.resizerCurrentWidths[o];else{r=null;break}r!==null&&Math.abs(r-i)>20&&(this.resizerCurrentWidths=[],this.widthFilled=!1)}for(let i=0;i<e.length;i++)if(!this.widthFilled&&this.resizerCurrentWidths.push(e[i].offsetWidth),i<e.length-1){const r=window.document.createElement("div");r.dataset.index=i.toString(),r.onmousedown=this.resizerMouseDown,r.ondblclick=this.resizerReset,r.title=this.props.dblTitle||"Double click to reset table layout",r.className="resize-handle",e[i].appendChild(r)}this.widthFilled&&this.resizerApplyWidths()}else this.installTimeout=setTimeout(()=>{this.installTimeout=null,this.resizerInstall()},100)}resizerReset=()=>{for(let e=0;e<this.resizerCurrentWidths.length;e++)this.resizerCurrentWidths[e]=(this.props.initialWidths||[])[e]||"auto";(window._localStorage||window.localStorage).setItem(`App.${this.props.name||"history"}.table`,JSON.stringify(this.resizerCurrentWidths)),this.resizerApplyWidths()};resizerUninstall(){if(this.installTimeout&&clearTimeout(this.installTimeout),this.installTimeout=null,this.resizerRefTable.current&&this.resizerRefTable.current._installed){this.resizerRefTable.current._installed=!1;const e=this.resizerRefTable.current.querySelectorAll("th");for(let t=0;t<e.length;t++){const i=e[t].querySelector(".resize-handle");i&&(i.onmousedown=null,i.remove())}}}resizerApplyWidths(){const e=[];if(this.resizerCurrentWidths.length)for(let t=0;t<this.resizerCurrentWidths.length;t++)this.resizerCurrentWidths[t]?e.push(this.resizerCurrentWidths[t]!=="auto"?`${this.resizerCurrentWidths[t]}px`:"auto"):this.props.initialWidths&&this.props.initialWidths[t]?e.push(this.props.initialWidths[t]!=="auto"?`${this.props.initialWidths[t]}px`:"auto"):e.push("auto");else if(this.props.initialWidths)for(let t=0;t<this.props.initialWidths.length;t++)this.props.initialWidths[t]?e.push(this.props.initialWidths[t]!=="auto"?`${this.props.initialWidths[t]}px`:"auto"):e.push("auto");return this.resizerRefTable.current&&e.length&&(this.resizerRefTable.current.style.gridTemplateColumns=e.join(" ")),e.length?e.join(" "):void 0}resizerMouseMove=e=>{if(this.resizerActiveDiv&&this.resizerActiveIndex!==null){const t=this.resizerOldWidth+e.clientX-this.resizerPosition,i=this.resizerOldWidthNext-e.clientX+this.resizerPosition;(!this.resizerMin||t>this.resizerMin)&&(!this.resizerMinNext||i>this.resizerMinNext)&&(this.resizerCurrentWidths[this.resizerActiveIndex]=t,this.resizerCurrentWidths[this.resizerActiveIndex+1]=i,this.resizerApplyWidths())}};resizerMouseUp=()=>{(window._localStorage||window.localStorage).setItem(`App.${this.props.name||"history"}.table`,JSON.stringify(this.resizerCurrentWidths)),this.resizerActiveIndex=null,this.resizerActiveDiv=null,window.removeEventListener("mousemove",this.resizerMouseMove),window.removeEventListener("mouseup",this.resizerMouseUp)};resizerMouseDown=e=>{var t,i,r,o;if(this.resizerActiveIndex===null||this.resizerActiveIndex===void 0){console.log(`Mouse down ${(t=e.target)==null?void 0:t.dataset.index}`),this.resizerActiveIndex=parseInt(((i=e.target)==null?void 0:i.dataset.index)||"0",10),this.resizerActiveDiv=e.target,this.resizerMin=this.props.minWidths?this.props.minWidths[this.resizerActiveIndex]:0,this.resizerMinNext=this.props.minWidths?this.props.minWidths[this.resizerActiveIndex+1]:0,this.resizerPosition=e.clientX;let n;this.resizerCurrentWidths[this.resizerActiveIndex]==="auto"&&(n=(r=this.resizerRefTable.current)==null?void 0:r.querySelectorAll("th"),n&&(this.resizerCurrentWidths[this.resizerActiveIndex]=n[this.resizerActiveIndex].offsetWidth)),this.resizerCurrentWidths[this.resizerActiveIndex+1]==="auto"&&(n=n||((o=this.resizerRefTable.current)==null?void 0:o.querySelectorAll("th")),n&&(this.resizerCurrentWidths[this.resizerActiveIndex+1]=n[this.resizerActiveIndex+1].offsetWidth)),this.resizerOldWidth=this.resizerCurrentWidths[this.resizerActiveIndex],this.resizerOldWidthNext=this.resizerCurrentWidths[this.resizerActiveIndex+1],window.addEventListener("mousemove",this.resizerMouseMove),window.addEventListener("mouseup",this.resizerMouseUp)}};render(){if(this.props.ready===!1)return M.createElement(j.Skeleton,null);const e={gridTemplateColumns:this.resizerApplyWidths()};return M.createElement(j.Table,{stickyHeader:this.props.stickyHeader,size:this.props.size||"small",className:this.props.className,sx:this.props.sx,ref:this.resizerRefTable,style:{...this.props.style||void 0,...e}},this.props.children)}}const on={div:{borderRadius:3,padding:"0 3px",lineHeight:"20px",whiteSpace:"nowrap",overflow:"hidden",display:"flex",alignItems:"center"},icon:{width:16,height:16,marginRight:8,verticalAlign:"middle"},text:{display:"inline-block",overflow:"hidden",textOverflow:"ellipsis"}};function i5e(s){var o,n,a,c,l,N,u,L,g;const e=s.value;let t;const i=s.removePrefix||"";if(typeof e=="string"){const y=s.list;if(y)if(Array.isArray(y)){const T=y.find(d=>(d==null?void 0:d._id)===i+e);T?t={name:O.getObjectNameFromObj(T,s.lang).replace("system.group.",""),value:T._id,icon:s.icon||((o=T.common)==null?void 0:o.icon),color:s.color||((n=T.common)==null?void 0:n.color)}:t={name:e,value:i+e}}else if(y[i+e]){const T=y[i+e];t={name:O.getObjectNameFromObj(T,s.lang).replace("system.group.",""),value:T._id,icon:s.icon||((a=T.common)==null?void 0:a.icon),color:s.color||((c=T.common)==null?void 0:c.color)}}else t={name:e,value:i+e,icon:s.icon,color:s.color};else t={name:e,value:i+e,icon:s.icon,color:s.color}}else if(!e||typeof e!="object")t={name:"",value:"",icon:s.icon,color:s.color};else{const y=e;t={name:O.getObjectNameFromObj(y,s.lang).replace("system.group.","").replace("system.user.","").replace("enum.rooms.","").replace("enum.functions.",""),value:y._id,icon:s.icon||((l=y.common)==null?void 0:l.icon),color:s.color||((N=y.common)==null?void 0:N.color)}}const r=t!=null&&t.color?{border:`1px solid ${O.invertColor(t==null?void 0:t.color)}`,color:O.getInvertedColor(t==null?void 0:t.color,s.themeType||"light",!0)||void 0,backgroundColor:t==null?void 0:t.color}:{};return M.createElement("div",{style:{...s.style||void 0,...on.div,...r||void 0},className:O.clsx(s.className,(u=s.moreClasses)==null?void 0:u.root),title:s.title||t.value},t!=null&&t.icon?M.createElement(me,{src:t==null?void 0:t.icon,className:(L=s.moreClasses)==null?void 0:L.icon,style:on.icon}):null,M.createElement("div",{style:on.text,className:(g=s.moreClasses)==null?void 0:g.text},t==null?void 0:t.name))}function r5e({themeName:s,toggleTheme:e,t,className:i,style:r,size:o}){return M.createElement("div",{className:i||void 0,style:r||void 0},M.createElement(j.Tooltip,{title:t("ra_Change color theme"),slotProps:{popper:{sx:{pointerEvents:"none"}}}},M.createElement(j.IconButton,{onClick:()=>e(),size:o||"medium"},s==="dark"&&M.createElement(KL,{className:i}),s==="blue"&&M.createElement(qL,{className:i}),s==="colored"&&M.createElement(ua,{className:i}),s!=="dark"&&s!=="blue"&&s!=="colored"&&M.createElement(eg,{className:i}))))}function po(){return(po=Object.assign||function(s){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(s[i]=t[i])}return s}).apply(this,arguments)}function W4(s,e){if(s==null)return{};var t,i,r={},o=Object.keys(s);for(i=0;i<o.length;i++)e.indexOf(t=o[i])>=0||(r[t]=s[t]);return r}function Vn(s){var e=f.useRef(s),t=f.useRef(function(i){e.current&&e.current(i)});return e.current=s,t.current}var bi=function(s,e,t){return e===void 0&&(e=0),t===void 0&&(t=1),s>t?t:s<e?e:s},fi=function(s){return"touches"in s},Zn=function(s){return s&&s.ownerDocument.defaultView||self},Fl=function(s,e,t){var i=s.getBoundingClientRect(),r=fi(e)?function(o,n){for(var a=0;a<o.length;a++)if(o[a].identifier===n)return o[a];return o[0]}(e.touches,t):e;return{left:bi((r.pageX-(i.left+Zn(s).pageXOffset))/i.width),top:bi((r.pageY-(i.top+Zn(s).pageYOffset))/i.height)}},Gl=function(s){!fi(s)&&s.preventDefault()},B4=M.memo(function(s){var e=s.onMove,t=s.onKey,i=W4(s,["onMove","onKey"]),r=f.useRef(null),o=Vn(e),n=Vn(t),a=f.useRef(null),c=f.useRef(!1),l=f.useMemo(function(){var g=function(d){Gl(d),(fi(d)?d.touches.length>0:d.buttons>0)&&r.current?o(Fl(r.current,d,a.current)):T(!1)},y=function(){return T(!1)};function T(d){var z=c.current,I=Zn(r.current),C=d?I.addEventListener:I.removeEventListener;C(z?"touchmove":"mousemove",g),C(z?"touchend":"mouseup",y)}return[function(d){var z=d.nativeEvent,I=r.current;if(I&&(Gl(z),!function(m,A){return A&&!fi(m)}(z,c.current)&&I)){if(fi(z)){c.current=!0;var C=z.changedTouches||[];C.length&&(a.current=C[0].identifier)}I.focus(),o(Fl(I,z,a.current)),T(!0)}},function(d){var z=d.which||d.keyCode;z<37||z>40||(d.preventDefault(),n({left:z===39?.05:z===37?-.05:0,top:z===40?.05:z===38?-.05:0}))},T]},[n,o]),N=l[0],u=l[1],L=l[2];return f.useEffect(function(){return L},[L]),M.createElement("div",po({},i,{onTouchStart:N,onMouseDown:N,className:"react-colorful__interactive",ref:r,onKeyDown:u,tabIndex:0,role:"slider"}))}),zM=function(s){return s.filter(Boolean).join(" ")},J4=function(s){var e=s.color,t=s.left,i=s.top,r=i===void 0?.5:i,o=zM(["react-colorful__pointer",s.className]);return M.createElement("div",{className:o,style:{top:100*r+"%",left:100*t+"%"}},M.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:e}}))},he=function(s,e,t){return e===void 0&&(e=0),t===void 0&&(t=Math.pow(10,e)),Math.round(t*s)/t},TSe=function(s){return wSe(Xn(s))},Xn=function(s){return s[0]==="#"&&(s=s.substring(1)),s.length<6?{r:parseInt(s[0]+s[0],16),g:parseInt(s[1]+s[1],16),b:parseInt(s[2]+s[2],16),a:s.length===4?he(parseInt(s[3]+s[3],16)/255,2):1}:{r:parseInt(s.substring(0,2),16),g:parseInt(s.substring(2,4),16),b:parseInt(s.substring(4,6),16),a:s.length===8?he(parseInt(s.substring(6,8),16)/255,2):1}},dSe=function(s){return zSe(hSe(s))},DSe=function(s){var e=s.s,t=s.v,i=s.a,r=(200-e)*t/100;return{h:he(s.h),s:he(r>0&&r<200?e*t/100/(r<=100?r:200-r)*100:0),l:he(r/2),a:he(i,2)}},Kn=function(s){var e=DSe(s);return"hsl("+e.h+", "+e.s+"%, "+e.l+"%)"},hSe=function(s){var e=s.h,t=s.s,i=s.v,r=s.a;e=e/360*6,t/=100,i/=100;var o=Math.floor(e),n=i*(1-t),a=i*(1-(e-o)*t),c=i*(1-(1-e+o)*t),l=o%6;return{r:he(255*[i,a,n,n,c,i][l]),g:he(255*[c,i,i,a,n,n][l]),b:he(255*[n,n,c,i,i,a][l]),a:he(r,2)}},Cr=function(s){var e=s.toString(16);return e.length<2?"0"+e:e},zSe=function(s){var e=s.r,t=s.g,i=s.b,r=s.a,o=r<1?Cr(he(255*r)):"";return"#"+Cr(e)+Cr(t)+Cr(i)+o},wSe=function(s){var e=s.r,t=s.g,i=s.b,r=s.a,o=Math.max(e,t,i),n=o-Math.min(e,t,i),a=n?o===e?(t-i)/n:o===t?2+(i-e)/n:4+(e-t)/n:0;return{h:he(60*(a<0?a+6:a)),s:he(o?n/o*100:0),v:he(o/255*100),a:r}},CSe=M.memo(function(s){var e=s.hue,t=s.onChange,i=zM(["react-colorful__hue",s.className]);return M.createElement("div",{className:i},M.createElement(B4,{onMove:function(r){t({h:360*r.left})},onKey:function(r){t({h:bi(e+360*r.left,0,360)})},"aria-label":"Hue","aria-valuenow":he(e),"aria-valuemax":"360","aria-valuemin":"0"},M.createElement(J4,{className:"react-colorful__hue-pointer",left:e/360,color:Kn({h:e,s:100,v:100,a:1})})))}),ISe=M.memo(function(s){var e=s.hsva,t=s.onChange,i={backgroundColor:Kn({h:e.h,s:100,v:100,a:1})};return M.createElement("div",{className:"react-colorful__saturation",style:i},M.createElement(B4,{onMove:function(r){t({s:100*r.left,v:100-100*r.top})},onKey:function(r){t({s:bi(e.s+100*r.left,0,100),v:bi(e.v-100*r.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+he(e.s)+"%, Brightness "+he(e.v)+"%"},M.createElement(J4,{className:"react-colorful__saturation-pointer",top:1-e.v/100,left:e.s/100,color:Kn(e)})))}),R4=function(s,e){if(s===e)return!0;for(var t in s)if(s[t]!==e[t])return!1;return!0},pSe=function(s,e){return s.toLowerCase()===e.toLowerCase()||R4(Xn(s),Xn(e))};function ASe(s,e,t){var i=Vn(t),r=f.useState(function(){return s.toHsva(e)}),o=r[0],n=r[1],a=f.useRef({color:e,hsva:o});f.useEffect(function(){if(!s.equal(e,a.current.color)){var l=s.toHsva(e);a.current={hsva:l,color:e},n(l)}},[e,s]),f.useEffect(function(){var l;R4(o,a.current.hsva)||s.equal(l=s.fromHsva(o),a.current.color)||(a.current={hsva:o,color:l},i(l))},[o,s,i]);var c=f.useCallback(function(l){n(function(N){return Object.assign({},N,l)})},[]);return[o,c]}var mSe=typeof window<"u"?f.useLayoutEffect:f.useEffect,OSe=function(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0},Hl=new Map,ESe=function(s){mSe(function(){var e=s.current?s.current.ownerDocument:document;if(e!==void 0&&!Hl.has(e)){var t=e.createElement("style");t.innerHTML=`.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill-opacity=".05"><path d="M8 0h8v8H8zM0 8h8v8H0z"/></svg>')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}`,Hl.set(e,t);var i=OSe();i&&t.setAttribute("nonce",i),e.head.appendChild(t)}},[])},fSe=function(s){var e=s.className,t=s.colorModel,i=s.color,r=i===void 0?t.defaultColor:i,o=s.onChange,n=W4(s,["className","colorModel","color","onChange"]),a=f.useRef(null);ESe(a);var c=ASe(t,r,o),l=c[0],N=c[1],u=zM(["react-colorful",e]);return M.createElement("div",po({},n,{ref:a,className:u}),M.createElement(ISe,{hsva:l,onChange:N}),M.createElement(CSe,{hue:l.h,onChange:N,className:"react-colorful__last-control"}))},xSe={defaultColor:"000",toHsva:TSe,fromHsva:function(s){return dSe({h:s.h,s:s.s,v:s.v,a:1})},equal:pSe},_Se=function(s){return M.createElement(fSe,po({},s,{colorModel:xSe}))};class SSe extends f.Component{dialogName;filters;filterFunc;constructor(e){super(e),this.dialogName=this.props.dialogName||"default",this.dialogName=`SelectID.${this.dialogName}`;const t=(window._localStorage||window.localStorage).getItem(this.dialogName)||"{}";try{this.filters=JSON.parse(t)}catch{this.filters={}}e.filters&&(this.filters={...this.filters,...e.filters||{}});let i=this.props.selected||[];if(Array.isArray(i)||(i=[i]),i=i.filter(r=>r),e.filterFunc)if(typeof e.filterFunc=="string")try{this.filterFunc=new Function("obj",e.filterFunc)}catch{console.error(`Cannot parse filter function: "obj => ${e.filterFunc}"`),this.filterFunc=void 0}else this.filterFunc=e.filterFunc;this.state={selected:i,name:"",selectionBlocked:!1}}handleCancel(){this.props.onClose()}handleOk(){this.props.onOk(this.props.multiSelect?this.state.selected:this.state.selected[0]||"",this.state.name),this.props.onClose()}render(){let e;return this.state.name||this.state.selected.length?this.state.selected.length===1?e=[M.createElement("span",{key:"selected"},h.t("ra_Selected")," "),M.createElement("span",{key:"id",style:{fontWeight:"bold",fontStyle:"italic"}},(this.state.name||this.state.selected[0])+(this.state.name?` [${this.state.selected[0]}]`:""))]:e=[M.createElement("span",{key:"selected"},h.t("ra_Selected")," "),M.createElement("span",{key:"id",style:{fontWeight:"bold",fontStyle:"italic"}},h.t("%s items",this.state.selected.length.toString()))]:e=this.props.title||h.t("ra_Please select object ID..."),M.createElement(j.Dialog,{onClose:()=>{},maxWidth:!1,style:{zIndex:this.props.zIndex||void 0},sx:{"& .MuiDialog-paper":{height:"95%",p:"4px",width:"100%",maxWidth:"100%",maxHeight:"calc(100% - 16px)"}},fullWidth:!0,open:!0,"aria-labelledby":"ar_dialog_selectid_title"},M.createElement(j.DialogTitle,{id:"ar_dialog_selectid_title",style:{whiteSpace:"nowrap",width:"calc(100% - 72px)",overflow:"hidden",display:"inline-block",textOverflow:"ellipsis"}},e),M.createElement(j.DialogContent,{style:{height:"100%",overflow:"hidden",padding:"8px 4px"}},M.createElement(ySe,{foldersFirst:this.props.foldersFirst,imagePrefix:this.props.imagePrefix||this.props.prefix,dateFormat:this.props.dateFormat,defaultFilters:this.filters,dialogName:this.dialogName,isFloatComma:this.props.isFloatComma,showExpertButton:this.props.showExpertButton!==void 0?this.props.showExpertButton:!0,expertMode:this.props.expertMode,columns:this.props.columns||["name","type","role","room","func","val"],types:this.props.types?Array.isArray(this.props.types)?this.props.types:[this.props.types]:["state"],root:this.props.root,t:h.t,lang:this.props.lang||h.getLanguage(),socket:this.props.socket,selected:this.state.selected,multiSelect:this.props.multiSelect,notEditable:this.props.notEditable===void 0?!0:this.props.notEditable,themeName:this.props.themeName,themeType:this.props.themeType,theme:this.props.theme,customFilter:this.props.customFilter,allowNonObjects:this.props.allowNonObjects,onFilterChanged:t=>{this.filters=t,(window._localStorage||window.localStorage).setItem(this.dialogName,JSON.stringify(t))},onSelect:async(t,i,r)=>{let o;if(Array.isArray(t)?o=t:o=[t],JSON.stringify(o)!==JSON.stringify(this.state.selected)){let n=!0;if(this.props.onSelectConfirm){const a={};for(const c of o)try{a[c]=await this.props.socket.getObject(c)}catch{}n=await this.props.onSelectConfirm(o,a)}this.setState({selected:o,name:i,selectionBlocked:!n},()=>r&&this.handleOk())}else r&&this.handleOk()},filterFunc:this.filterFunc,title:"",classes:{}})),M.createElement(j.DialogActions,null,M.createElement(j.Button,{id:`ar_dialog_selectid_ok_${this.props.dialogName||""}`,variant:"contained",onClick:()=>this.handleOk(),startIcon:M.createElement(Oe,null),disabled:!this.state.selected.length||this.state.selectionBlocked,color:"primary"},this.props.ok||h.t("ra_Ok")),M.createElement(j.Button,{id:`ar_dialog_selectid_cancel_${this.props.dialogName||""}`,color:"grey",variant:"contained",onClick:()=>this.handleCancel(),startIcon:M.createElement(Pi,null)},this.props.cancel||h.t("ra_Cancel"))))}}function St(s,e,t){if(typeof e=="string"&&(e=e.split(".")),!s)return null;if(e.length===1)return t&&t[s[e[0]]]?t[s[e[0]]]:s[e[0]];const i=e.shift();return St(s[i],e)}function F4(s,e,t){if(typeof e=="string"&&(e=e.split(".")),e.length===1)return s[e[0]]=t;const i=e.shift();return(s[i]===null||s[i]===void 0)&&(s[i]={}),F4(s[i],e,t)}const W={tableContainer:{width:"100%",height:"100%",overflow:"auto"},table:{width:"100%",minWidth:800,maxWidth:1920},cell:{paddingTop:0,paddingBottom:0,paddingLeft:4,paddingRight:4},rowMainWithChildren:{},rowMainWithoutChildren:{},rowNoEdit:{opacity:.3},cellExpand:{width:30},cellButton:{width:30},cellHeader:{fontWeight:"bold",background:s=>(s.palette.mode==="dark","#888"),color:s=>s.palette.mode==="dark"?"#EEE":"#111",height:48,wordBreak:"break-word",whiteSpace:"pre"},width_name_nicknames:{maxWidth:150},width_ioType:{maxWidth:100},width_type:{maxWidth:100},width_displayTraits:{maxWidth:100},width_roomHint:{maxWidth:100},rowSecondary:{fontStyle:"italic"},cellSecondary:{fontSize:10},visuallyHidden:{border:0,clip:"rect(0 0 0 0)",height:1,margin:-1,overflow:"hidden",padding:0,position:"absolute",top:20,width:1},fieldEditWithButton:{width:"calc(100% - 33px)",display:"inline-block"},fieldEdit:{width:"100%",display:"inline-block",lineHeight:"50px",verticalAlign:"middle"},fieldButton:{width:30,display:"inline-block"},colorDialog:{overflow:"hidden",padding:15},subText:{fontSize:10,fontStyle:"italic"},glow:{animation:"glow 0.2s 2 alternate"}};function Vl(s,e,t,i){const r=St(s,t,i)||"",o=St(e,t,i)||"";return o<r?-1:o>r?1:0}function kSe(s,e,t){return s==="desc"?(i,r)=>Vl(i,r,e,t):(i,r)=>-Vl(i,r,e,t)}function YSe(s,e){const t=s.map((i,r)=>({e:i,i:r}));return t.sort((i,r)=>{const o=e(i.e,r.e);return o||i.i-r.i}),t.map(i=>i.e)}class qn extends f.Component{selectCallback=null;updateTimeout=null;constructor(e){super(e);let t=(window._localStorage||window.localStorage).getItem(this.props.name||"iob-table")||"[]";try{t=JSON.parse(t)||[]}catch{t=[]}Array.isArray(t)||(t=[]),this.state={opened:t,editMode:!1,deleteMode:!1,editData:null,order:"asc",update:null,orderBy:this.props.columns[0].field,showSelectColor:!1}}static getDerivedStateFromProps(e,t){if(e.glowOnChange){const i=[];let r=0;return e.data&&t.data&&e.data.forEach(o=>{var a;r++;const n=(a=t.data)==null?void 0:a.find(c=>c.id===o.id);n?JSON.stringify(n)!==JSON.stringify(o)&&i.push(o.id):i.push(o.id)}),i.length&&i.length!==r?{data:e.data,update:i}:{data:e.data}}return{data:e.data}}renderCellEdit(e,t){let i=St(e,t.field);return Array.isArray(i)&&(i=i[0]),t.lookup?this.renderCellEditSelect(t,i):t.editComponent?this.renderCellEditCustom(t,i,e):t.type==="boolean"||!t.type&&typeof i=="boolean"?this.renderCellEditBoolean(t,i):t.type==="color"?this.renderCellEditColor(t,i):t.type==="oid"?this.renderCellEditObjectID(t,i):t.type==="numeric"?this.renderCellEditNumber(t,i):this.renderCellEditString(t,i)}onChange(e,t,i){const r=this.state.editData?{...this.state.editData}:{};i===t?delete r[e.field]:r[e.field]=i,this.setState({editData:r})}renderCellEditSelect(e,t){return M.createElement(j.Select,{variant:"standard",onChange:i=>this.onChange(e,t,i.target.value),value:this.state.editData&&this.state.editData[e.field]||t},e.lookup&&Object.keys(e.lookup).map((i,r)=>{var o;return M.createElement(j.MenuItem,{key:r,value:i},(o=e.lookup)==null?void 0:o[i])}))}renderCellEditString(e,t){return M.createElement(j.TextField,{variant:"standard",style:W.fieldEdit,fullWidth:!0,value:this.state.editData&&this.state.editData[e.field]!==void 0?this.state.editData[e.field]:t,onChange:i=>this.onChange(e,t,i.target.value)})}renderCellEditNumber(e,t){return M.createElement(j.TextField,{variant:"standard",style:W.fieldEdit,type:"number",fullWidth:!0,value:this.state.editData&&this.state.editData[e.field]!==void 0?this.state.editData[e.field]:t,onChange:i=>this.onChange(e,t,i.target.value)})}renderCellEditCustom(e,t,i){const r=e.editComponent;return this.state.editData&&this.state.editData[e.field]!==void 0&&(t=this.state.editData[e.field],i=JSON.parse(JSON.stringify(i)),i[e.field]=t),r?M.createElement(r,{value:t,rowData:i,onChange:o=>this.onChange(e,t,o)}):null}renderCellEditBoolean(e,t){return M.createElement(j.Checkbox,{checked:this.state.editData&&this.state.editData[e.field]!==void 0?!!this.state.editData[e.field]:!!t,onChange:i=>this.onChange(e,!!t,i.target.checked),inputProps:{"aria-label":"checkbox"}})}renderSelectColorDialog(){return M.createElement(j.Dialog,{sx:{"& .MuiPaper-root":W.root,"& .MuiPaper-paper":W.paper},onClose:()=>{this.selectCallback=null,this.setState({showSelectColor:!1})},open:this.state.showSelectColor},M.createElement(_Se,{color:this.state.selectIdValue,onChange:e=>this.setState({selectIdValue:e},()=>{this.selectCallback&&this.selectCallback(e)})}))}renderCellEditColor(e,t){const i=this.state.editData&&this.state.editData[e.field]!==void 0?this.state.editData[e.field]:t;return M.createElement("div",{style:W.fieldEdit},M.createElement(j.TextField,{variant:"standard",fullWidth:!0,style:W.fieldEditWithButton,value:i,inputProps:{style:{backgroundColor:i,color:O.isUseBright(i)?"#FFF":"#000"}},onChange:r=>this.onChange(e,!!t,r.target.value)}),M.createElement(j.IconButton,{style:W.fieldButton,onClick:()=>{this.selectCallback=r=>this.onChange(e,t,r),this.setState({showSelectColor:!0,selectIdValue:t})},size:"large"},M.createElement(ig,null)))}renderSelectIdDialog(){return this.state.showSelectId&&this.props.socket?M.createElement(SSe,{key:"tableSelect",imagePrefix:"../..",dialogName:this.props.adapterName,themeType:this.props.themeType,theme:this.props.theme,socket:this.props.socket,selected:this.state.selectIdValue,onClose:()=>this.setState({showSelectId:!1}),onOk:e=>{this.setState({showSelectId:!1,selectIdValue:null});const t=Array.isArray(e)?e[0]:e;t&&this.selectCallback&&(this.selectCallback&&this.selectCallback(t),this.selectCallback=null)}}):null}renderCellEditObjectID(e,t){return M.createElement("div",{style:W.fieldEdit},M.createElement(j.TextField,{variant:"standard",fullWidth:!0,style:W.fieldEditWithButton,value:this.state.editData&&this.state.editData[e.field]!==void 0?this.state.editData[e.field]:t,onChange:i=>this.onChange(e,t,i.target.value)}),M.createElement(j.IconButton,{style:W.fieldButton,onClick:()=>{this.selectCallback=i=>this.onChange(e,t,i),this.setState({showSelectId:!0,selectIdValue:t})},size:"large"},M.createElement(_g,null)))}static renderCellNonEdit(e,t){let i=St(e,t.field,t.lookup);return Array.isArray(i)&&(i=i[0]),t.type==="boolean"?M.createElement(j.Checkbox,{checked:!!i,disabled:!0,inputProps:{"aria-label":"checkbox"}}):i}renderCell(e,t,i,r){return this.state.editMode===r&&t.editable!=="never"&&t.editable!==!1?M.createElement(j.TableCell,{key:t.field,style:{...W.cell,...i?W.cellSecondary:void 0,...t.cellStyle},component:"th"},this.renderCellEdit(e,t)):M.createElement(j.TableCell,{key:t.field,style:{...W.cell,...i?W.cellSecondary:void 0,...t.cellStyle},component:"th"},qn.renderCellNonEdit(e,t))}static renderCellWithSubField(e,t){const i=St(e,t.field,t.lookup);if(t.subField){const r=St(e,t.subField,t.subLookup);return M.createElement("div",null,M.createElement("div",{style:W.mainText},i),M.createElement("div",{style:{...W.subText,...t.subStyle||void 0}},r))}return M.createElement("div",null,M.createElement("div",{style:W.mainText},i))}renderLine(e,t){const i=this.props.levelShift===void 0?24:this.props.levelShift;t=t||0;const r=this.props.data.indexOf(e);if(!e||!t&&e.parentId||t&&!e.parentId)return null;const o=this.state.opened.includes(e.id),n=this.props.data.filter(c=>c.parentId===e.id),a=M.createElement(j.TableRow,{key:e.id,className:`table-row-${(e.id||"").toString().replace(/[.$]/g,"_")}`,style:{...this.state.update&&this.state.update.includes(e.id)&&W.glow||void 0,...W.row,...t?W.rowSecondary:void 0,...!t&&n.length?W.rowMainWithChildren:void 0,...!t&&!n.length?W.rowMainWithoutChildren:void 0,...this.state.editMode!==!1&&this.state.editMode!==r?W.rowNoEdit:void 0,...this.state.deleteMode!==!1&&this.state.deleteMode!==r?W.rowNoEdit:void 0}},M.createElement(j.TableCell,{style:{...W.cell,...W.cellExpand,...t?W.cellSecondary:void 0}},n.length?M.createElement(j.IconButton,{onClick:()=>{const c=[...this.state.opened],l=c.indexOf(e.id);l===-1?(c.push(e.id),c.sort()):c.splice(l,1),(window._localStorage||window.localStorage).setItem(this.props.name||"iob-table",JSON.stringify(c)),this.setState({opened:c})},size:"small"},o?M.createElement(ug,null):M.createElement(wg,null)):null),M.createElement(j.TableCell,{scope:"row",style:{...W.cell,...t?W.cellSecondary:void 0,...this.props.columns[0].cellStyle,paddingLeft:i*t}},this.props.columns[0].subField?qn.renderCellWithSubField(e,this.props.columns[0]):St(e,this.props.columns[0].field,this.props.columns[0].lookup)),this.props.columns.map((c,l)=>!l&&!c.hidden?null:this.renderCell(e,c,t,r)),this.props.onUpdate?M.createElement(j.TableCell,{style:{...W.cell,...W.cellButton}},this.state.editMode===r||this.state.deleteMode===r?M.createElement(j.IconButton,{disabled:this.state.editMode!==!1&&(!this.state.editData||!Object.keys(this.state.editData).length),onClick:()=>{if(this.state.editMode!==!1){const c=JSON.parse(JSON.stringify(e));this.state.editData&&Object.keys(this.state.editData).forEach(l=>{var N;return F4(c,l,(N=this.state.editData)==null?void 0:N[l])}),this.setState({editMode:!1},()=>this.props.onUpdate&&this.props.onUpdate(c,e))}else this.setState({deleteMode:!1},()=>this.props.onDelete&&this.props.onDelete(e))},size:"large"},M.createElement(Oe,null)):M.createElement(j.IconButton,{disabled:this.state.editMode!==!1,onClick:()=>this.setState({editMode:r,editData:null}),size:"large"},M.createElement(mi,null))):null,this.props.onDelete&&!this.props.onUpdate?M.createElement(j.TableCell,{style:{...W.cell,...W.cellButton}},this.state.deleteMode===r?M.createElement(j.IconButton,{disabled:this.state.editMode!==!1&&(!this.state.editData||!Object.keys(this.state.editData).length),onClick:()=>this.setState({deleteMode:!1},()=>this.props.onDelete&&this.props.onDelete(e)),size:"large"},M.createElement(Oe,null)):null):null,this.props.onUpdate||this.props.onDelete?M.createElement(j.TableCell,{style:{...W.cell,...W.cellButton}},this.state.editMode===r||this.state.deleteMode===r?M.createElement(j.IconButton,{onClick:()=>this.setState({editMode:!1,deleteMode:!1}),size:"large"},M.createElement(Ne,null)):this.props.onDelete?M.createElement(j.IconButton,{disabled:this.state.deleteMode!==!1,onClick:()=>this.setState({deleteMode:r}),size:"large"},M.createElement(nt,null)):null):null);if(!t&&o){const c=n.map(l=>this.renderLine(l,t+1));return c.unshift(a),c}return a}handleRequestSort(e){const t=this.state.orderBy===e&&this.state.order==="asc";this.setState({order:t?"desc":"asc",orderBy:e})}renderHead(){return M.createElement(j.TableHead,null,M.createElement(j.TableRow,{key:"headerRow"},M.createElement(j.TableCell,{component:"th",sx:O.getStyle(this.props.theme,W.cell,W.cellHeader,W.cellExpand)}),M.createElement(j.TableCell,{component:"th",sx:O.getStyle(this.props.theme,W.cell,W.cellHeader,W[`width_${this.props.columns[0].field.replace(/\./g,"_")}`]),style:this.props.columns[0].headerStyle||this.props.columns[0].cellStyle,sortDirection:this.props.noSort?!1:this.state.orderBy===this.props.columns[0].field?this.state.order:!1},this.props.noSort?null:M.createElement(j.TableSortLabel,{active:this.state.orderBy===this.props.columns[0].field,direction:this.state.orderBy===this.props.columns[0].field?this.state.order:"asc",onClick:()=>this.handleRequestSort(this.props.columns[0].field)},this.props.columns[0].title||this.props.columns[0].field,this.state.orderBy===this.props.columns[0].field?M.createElement("span",{style:W.visuallyHidden},this.state.order==="desc"?"sorted descending":"sorted ascending"):null)),this.props.columns.map((e,t)=>!t&&!e.hidden?null:M.createElement(j.TableCell,{key:e.field,sx:O.getStyle(this.props.theme,W.cell,W.cellHeader,W[`width_${e.field.replace(/\./g,"_")}`]),style:e.headerStyle||e.cellStyle,component:"th"},this.props.noSort?null:M.createElement(j.TableSortLabel,{active:this.state.orderBy===e.field,direction:this.state.orderBy===e.field?this.state.order:"asc",onClick:()=>this.handleRequestSort(e.field)},e.title||e.field,this.state.orderBy===e.field?M.createElement("span",{style:W.visuallyHidden},this.state.order==="desc"?"sorted descending":"sorted ascending"):null))),this.props.onUpdate?M.createElement(j.TableCell,{component:"th",sx:O.getStyle(this.props.theme,W.cell,W.cellHeader,W.cellButton)},this.props.noAdd?null:M.createElement(j.Fab,{color:"primary",size:"small",disabled:this.state.editMode!==!1,onClick:()=>this.props.onUpdate&&this.props.onUpdate(!0)},M.createElement(ln,null))):null,this.props.onDelete||this.props.onUpdate?M.createElement(j.TableCell,{component:"th",sx:O.getStyle(this.props.theme,W.cell,W.cellHeader,W.cellButton)}):null))}render(){const e=this.props.columns.find(t=>t.field===this.state.orderBy);if(e){const t=e.lookup,i=YSe(this.props.data,kSe(this.state.order,this.state.orderBy,t));return this.state.update&&this.state.update.length&&(this.updateTimeout&&clearTimeout(this.updateTimeout),this.updateTimeout=setTimeout(()=>{this.updateTimeout=null,this.setState({update:null})},500)),M.createElement("div",{style:W.tableContainer,className:this.props.className},M.createElement(j.Table,{style:W.table,"aria-label":"simple table",size:"small",stickyHeader:!0},this.renderHead(),M.createElement(j.TableBody,null,i.map(r=>this.renderLine(r)))),this.renderSelectIdDialog(),this.renderSelectColorDialog())}return null}}/*!
483
483
  * Cropper.js v1.6.2
484
484
  * https://fengyuanchen.github.io/cropperjs
485
485
  *