iobroker.eos-admin 8.0.1 → 8.0.2
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.
- package/NEXOWATT_EOS_BUILD_INFO.json +3 -3
- package/NEXOWATT_EOS_PREBUILT_MANIFEST.json +102 -96
- package/START_HERE_8.0.2.md +41 -0
- package/adminWww/.vite/manifest.json +278 -278
- package/adminWww/NEXOWATT_EOS_FRONTEND_MANIFEST.json +333 -329
- package/adminWww/assets/{AccessTime-Dpa6PKHY.js → AccessTime-5f47qrw7.js} +1 -1
- package/adminWww/assets/{AceEditor-DTzNaeVy.js → AceEditor-CJ-_Ev2E.js} +1 -1
- package/adminWww/assets/{AdapterUpdateDialog-D3y2bGHM.js → AdapterUpdateDialog-QwlPbETd.js} +3 -3
- package/adminWww/assets/Adapters-gKngfaOu.js +7 -0
- package/adminWww/assets/{AdminUtils-DDT_kD8H.js → AdminUtils-CopxRJZ2.js} +1 -1
- package/adminWww/assets/{Apps-C8LE9l6Z.js → Apps-BKnx1gzD.js} +1 -1
- package/adminWww/assets/{Book-QmHxDaHb.js → Book-DrhneQH0.js} +1 -1
- package/adminWww/assets/{Cached-f77QQBQD.js → Cached-XJmxLN4E.js} +1 -1
- package/adminWww/assets/{Computer-DFIUq-fL.js → Computer-DDMBRY5r.js} +1 -1
- package/adminWww/assets/{Config-BZDUILCW.js → Config-BwTa1LdH.js} +1 -1
- package/adminWww/assets/{ConfigManager-BMdQoiCg.js → ConfigManager-DYwC4yq9.js} +1 -1
- package/adminWww/assets/{CustomModal-B8vdCRn1.js → CustomModal-DjI4oCb8.js} +1 -1
- package/adminWww/assets/{CustomTab-DSPqif6P.js → CustomTab-_HYUrXsZ.js} +1 -1
- package/adminWww/assets/{DeleteForever-BnEM-6_v.js → DeleteForever-Caoe64_y.js} +1 -1
- package/adminWww/assets/EasyMode-CCRqFtQq.js +1 -0
- package/adminWww/assets/Enums-BTurn3-x.js +92 -0
- package/adminWww/assets/{Extension-DU1jqvic.js → Extension-D-tNJv4S.js} +1 -1
- package/adminWww/assets/{Fields-Df7Llf6U.js → Fields-C2Bn4V04.js} +1 -1
- package/adminWww/assets/{Files-Bwbw17Fb.js → Files-XdmhxGOR.js} +1 -1
- package/adminWww/assets/Hosts-DiTMe9fw.js +120 -0
- package/adminWww/assets/{InfoOutlined-l86Si1qa.js → InfoOutlined-DIGDQvu6.js} +1 -1
- package/adminWww/assets/Instances-DA6FIgRs.js +4 -0
- package/adminWww/assets/Intro-CJpwLg8Q.js +2 -0
- package/adminWww/assets/{KeyboardArrowRight-zZUJhG9e.js → KeyboardArrowRight-DVPBjTKi.js} +1 -1
- package/adminWww/assets/Logs-CA0mEMlO.js +2 -0
- package/adminWww/assets/{MoreHoriz-CR2kD-dc.js → MoreHoriz-BYaCptH0.js} +1 -1
- package/adminWww/assets/Objects-B2IC3Bce.js +301 -0
- package/adminWww/assets/{Overview-CDvnM655.js → Overview-HG8fAMFM.js} +2 -2
- package/adminWww/assets/{Pageview-DBITLOzI.js → Pageview-DFHddrKX.js} +1 -1
- package/adminWww/assets/{PersonOff-ANdO5Nu4.js → PersonOff-BwYQLD1M.js} +1 -1
- package/adminWww/assets/{PushPinOutlined-DvxsqPHo.js → PushPinOutlined-CEBeTmNm.js} +1 -1
- package/adminWww/assets/Remove-BPxvNccW.js +1 -0
- package/adminWww/assets/{Schedule-BMMrgd7j.js → Schedule-BQlh1nhQ.js} +1 -1
- package/adminWww/assets/{Star-DNdm064z.js → Star-ChMjBwLn.js} +1 -1
- package/adminWww/assets/State-UGfoS6qW.js +1 -0
- package/adminWww/assets/Storage-DrC3j-wf.js +1 -0
- package/adminWww/assets/{TextSnippet-Bywi1YuG.js → TextSnippet-BQ4TSmvS.js} +1 -1
- package/adminWww/assets/{Timeline-IQCnSLiw.js → Timeline-CEyldmz2.js} +1 -1
- package/adminWww/assets/{Timer-Be9yF62g.js → Timer-I0twtyWh.js} +1 -1
- package/adminWww/assets/{UnfoldMore-Du7-8wYn.js → UnfoldMore-_DDSfPKk.js} +1 -1
- package/adminWww/assets/{Usb-Ca47vqRv.js → Usb-Dwk7qdYu.js} +1 -1
- package/adminWww/assets/{UsedResources-BIdU7UPm.js → UsedResources-B6HWeXGX.js} +2 -2
- package/adminWww/assets/Users-DFeYuC5y.js +1 -0
- package/adminWww/assets/{ViewCompact-C3SC0jFF.js → ViewCompact-BbfomOIi.js} +1 -1
- package/adminWww/assets/ViewList-1pB5VinA.js +1 -0
- package/adminWww/assets/{ViewSidebar-kHvah-XS.js → ViewSidebar-DdedDirX.js} +1 -1
- package/adminWww/assets/{VpnKey-iMA7KrB-.js → VpnKey-o8QeqmnU.js} +1 -1
- package/adminWww/assets/{WifiTethering-Da8nW7Do.js → WifiTethering-Cp63fmkC.js} +1 -1
- package/adminWww/assets/{_virtual_mf-localSharedImportMap___mfe_internal__iobroker_admin__mf_owner__1-CpelrCgN.js → _virtual_mf-localSharedImportMap___mfe_internal__iobroker_admin__mf_owner__1-uaKFfE5p.js} +1 -1
- package/adminWww/assets/{bootstrap-D-7xcwTc.js → bootstrap-DSDOwKWU.js} +33 -33
- package/adminWww/assets/{date-fns-Bpgjk9P-.js → date-fns-ukillHs-.js} +1 -1
- package/adminWww/assets/helpers-CDcY0YJ-.js +1 -0
- package/adminWww/assets/{hostInit-huY-0clu.js → hostInit-Cd61hJHh.js} +1 -1
- package/adminWww/assets/{icons-material-Bu1f45BT.js → icons-material-Dms1APQk.js} +1 -1
- package/adminWww/assets/{index-D8vmzGp8.js → index-D6uhIclX.js} +2 -2
- package/adminWww/assets/{installSVGRenderer-BkdptYag.js → installSVGRenderer-BR-zIijZ.js} +1 -1
- package/adminWww/assets/{lib-CE1B3iHH.js → lib-BZRGBDoe.js} +2 -2
- package/adminWww/assets/{loadShare-eager-CRNcc8D7.js → loadShare-eager-BpwDZfDr.js} +93 -93
- package/adminWww/assets/{mf-entry-bootstrap-0-f6098d8b.js → mf-entry-bootstrap-0-2d631020.js} +3 -3
- package/adminWww/assets/{pendingShares-CuQbFsaK.js → pendingShares-D1Vr_qYv.js} +2 -2
- package/adminWww/assets/{sentry-B4uGc7ut.js → sentry-BFzW-2KQ.js} +1 -1
- package/adminWww/assets/{setYear-DurmWw03.js → setYear-DhVdgUBF.js} +1 -1
- package/adminWww/css/nexowatt-native-shell.css +72 -0
- package/adminWww/index.html +21 -21
- package/adminWww/js/eos-license-link.js +9 -16
- package/adminWww/js/nexowatt-native-shell.js +2 -2
- package/adminWww/mf-manifest.json +1 -1
- package/adminWww/mf-stats.json +1 -1
- package/adminWww/{remoteEntry-eos-8.0.1.js → remoteEntry-eos-8.0.2.js} +2 -2
- package/adminWww/remoteEntry.js +1 -1
- package/build/lib/web.js +25 -5
- package/build/lib/web.js.map +1 -1
- package/docs/ADMIN8_MIGRATION_8.0.0_DE.md +2 -0
- package/docs/cra/CRA_IEC_GAP_ANALYSIS_2026-09-30.md +5 -0
- package/docs/security/admin8-2026-11-04/development-1.log +4 -4
- package/docs/security/admin8-2026-11-04/development-2.log +275 -248
- package/docs/security/admin8-2026-11-05/system-fix/BACKEND_ROLE_REVIEW_DE.md +79 -0
- package/docs/security/admin8-2026-11-05/system-fix/NAVIGATION_DE.md +30 -0
- package/docs/security/admin8-2026-11-05/system-fix/REPORT_DE.md +51 -0
- package/docs/security/admin8-2026-11-05/system-fix/REVIEW_DE.md +65 -0
- package/docs/security/admin8-2026-11-05/system-fix/SCOPE_DE.md +21 -0
- package/docs/security/admin8-2026-11-05/system-fix/SYSTEM_DE.md +44 -0
- package/docs/security/admin8-2026-11-05/system-fix/archive-scan.json +12 -0
- package/docs/security/admin8-2026-11-05/system-fix/browser/README.md +46 -0
- package/docs/security/admin8-2026-11-05/system-fix/browser/integrity.json +16 -0
- package/docs/security/admin8-2026-11-05/system-fix/browser/system-browser-result.json +3607 -0
- package/docs/security/admin8-2026-11-05/system-fix/browser/system-browser.cjs +221 -0
- package/docs/security/admin8-2026-11-05/system-fix/browser/system-fixture.cjs +60 -0
- package/docs/security/admin8-2026-11-05/system-fix/evidence-sha256.json +49 -0
- package/docs/security/admin8-2026-11-05/system-fix/license-ui-tests-node22.log +80 -0
- package/docs/security/admin8-2026-11-05/system-fix/license-ui-tests-node24.log +19 -0
- package/docs/security/admin8-2026-11-05/system-fix/navigation/lint.log +0 -0
- package/docs/security/admin8-2026-11-05/system-fix/navigation/node22-tests.log +56 -0
- package/docs/security/admin8-2026-11-05/system-fix/navigation/node24-tests.log +15 -0
- package/docs/security/admin8-2026-11-05/system-fix/navigation/source-sha256.json +11 -0
- package/docs/security/admin8-2026-11-05/system-fix/path-budget.json +7 -0
- package/docs/security/admin8-2026-11-05/system-fix/release/artifacts.log +6 -0
- package/docs/security/admin8-2026-11-05/system-fix/release/audit-root.json +22 -0
- package/docs/security/admin8-2026-11-05/system-fix/release/audit-root.stderr +1 -0
- package/docs/security/admin8-2026-11-05/system-fix/release/backend-build.log +5 -0
- package/docs/security/admin8-2026-11-05/system-fix/release/clean.log +6 -0
- package/docs/security/admin8-2026-11-05/system-fix/release/consumer-audit.json +22 -0
- package/docs/security/admin8-2026-11-05/system-fix/release/consumer-audit.stderr +2 -0
- package/docs/security/admin8-2026-11-05/system-fix/release/consumer-install.log +4 -0
- package/docs/security/admin8-2026-11-05/system-fix/release/consumer-package-lock.json +3258 -0
- package/docs/security/admin8-2026-11-05/system-fix/release/development.log +392 -0
- package/docs/security/admin8-2026-11-05/system-fix/release/frontend-build.log +149 -0
- package/docs/security/admin8-2026-11-05/system-fix/release/http-node22.json +15 -0
- package/docs/security/admin8-2026-11-05/system-fix/release/http-node24.json +15 -0
- package/docs/security/admin8-2026-11-05/system-fix/release/inventory.log +8 -0
- package/docs/security/admin8-2026-11-05/system-fix/release/overlay-journal.json +452 -0
- package/docs/security/admin8-2026-11-05/system-fix/release/overlay-publish.log +10790 -0
- package/docs/security/admin8-2026-11-05/system-fix/release/overlay-validation.json +12 -0
- package/docs/security/admin8-2026-11-05/system-fix/release/pack.json +8104 -0
- package/docs/security/admin8-2026-11-05/system-fix/release/pack.stderr +6 -0
- package/docs/security/admin8-2026-11-05/system-fix/release/retired-801.json +68 -0
- package/docs/security/admin8-2026-11-05/system-fix/release/seal.log +6 -0
- package/docs/security/admin8-2026-11-05/system-fix/review-tests.log +30 -0
- package/docs/security/admin8-2026-11-05/system-fix/role-context-before.log +86 -0
- package/docs/security/admin8-2026-11-05/system-fix/role-context-lint.log +0 -0
- package/docs/security/admin8-2026-11-05/system-fix/role-context-node22.log +44 -0
- package/docs/security/admin8-2026-11-05/system-fix/role-context-test.log +13 -0
- package/docs/security/admin8-2026-11-05/system-fix/validation.json +90 -0
- package/docs/third-party/admin8/NOTICE-PROVENANCE.json +1 -1
- package/io-package.json +9 -10
- package/package.json +3 -2
- package/release-manifests/admin8-development-validation.json +42 -32
- package/reports/security/artifact-inventory.json +561 -561
- package/reports/security/inventory-summary.json +7 -7
- package/reports/security/sbom-backend-lock.cdx.json +5 -5
- package/reports/security/sbom-frontend-lock.cdx.json +5 -5
- package/reports/security/source-runtime-manifest.json +155 -155
- package/tools/nexowatt-admin8-development-check.cjs +8 -1
- package/tools/nexowatt-installer-ems-selftest.cjs +1 -1
- package/tools/nexowatt-role-security-selftest.cjs +2 -2
- package/tools/nexowatt-user-area-selftest.cjs +1 -1
- package/tools/nexowatt-v7109-clean-core-selftest.cjs +1 -1
- package/tools/vendor/eos-retired-release-files.json +196 -1
- package/adminWww/assets/Adapters-WMGNQt7g.js +0 -7
- package/adminWww/assets/EasyMode-TwIN5yxu.js +0 -1
- package/adminWww/assets/Enums-CHm2sGa-.js +0 -92
- package/adminWww/assets/Hosts-BR0g-Wxo.js +0 -120
- package/adminWww/assets/Instances-BKydFSdw.js +0 -4
- package/adminWww/assets/Intro-Dt2GzmtW.js +0 -2
- package/adminWww/assets/Logs-hbcdBDN3.js +0 -2
- package/adminWww/assets/Objects-HPx0yuOk.js +0 -301
- package/adminWww/assets/Remove-DplJatnC.js +0 -1
- package/adminWww/assets/State-Cc-tyuqB.js +0 -1
- package/adminWww/assets/Storage-COo2RkS1.js +0 -1
- package/adminWww/assets/Users-BruHA-yU.js +0 -1
- package/adminWww/assets/ViewList-DuKCnBnc.js +0 -1
- package/adminWww/assets/helpers-DBoACUHw.js +0 -1
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import{t as e}from"./rolldown-runtime-sJBDdmOt.js";import{$a as t,$i as n,$o as r,Cr as i,Do as a,Dr as o,Ds as s,Eo as c,Es as l,Fo as u,Ga as d,Go as f,Gr as p,Ho as m,Hs as h,Js as g,Mo as _,No as ee,Oo as te,Or as v,Po as y,Qa as ne,Qi as b,Qs as re,Rr as x,Sa as S,So as C,Sr as w,Ua as ie,Us as T,Ws as E,Xa as ae,Xs as oe,Ya as se,Ys as ce,Zi as le,Zo as ue,_a as de,_o as D,ao as fe,ar as O,bo as k,br as A,bs as pe,cc as j,co as me,cr as he,cs as M,da as ge,dc as N,do as _e,ds as P,eo as ve,fc as ye,fo as be,hc as xe,ho as F,io as Se,is as Ce,jo as we,ka as Te,kr as Ee,ma as I,mc as L,mo as R,ms as De,nc as Oe,no as z,ns as B,oo as ke,os as Ae,pc as je,qa as V,qo as H,qr as Me,ro as Ne,rs as Pe,si as Fe,sr as Ie,ss as Le,tc as Re,to as ze,tr as Be,uo as Ve,wi as U,wr as He,xa as Ue,xi as We,xo as Ge,xr as Ke,yr as qe,zr as Je}from"./loadShare-eager-BpwDZfDr.js";import{a as Ye,i as Xe,n as Ze,o as Qe,r as $e,s as et,t as tt}from"./ViewSidebar-DdedDirX.js";import{n as nt,r as rt,t as it}from"./Pageview-DFHddrKX.js";import{n as at,t as ot}from"./KeyboardArrowRight-DVPBjTKi.js";import{t as st}from"./InfoOutlined-DIGDQvu6.js";import{n as ct,t as lt}from"./UnfoldMore-_DDSfPKk.js";import{t as ut}from"./AdminUtils-CopxRJZ2.js";import{B as dt,H as ft,L as pt,R as mt,Tt as ht,W as gt,yt as _t,z as vt}from"./bootstrap-DSDOwKWU.js";import{n as yt,r as bt,t as xt}from"./Fields-C2Bn4V04.js";var St=e((e=>{var t=60103,n=60106,r=60107,i=60108,a=60114,o=60109,s=60110,c=60112,l=60113,u=60120,d=60115,f=60116;if(typeof Symbol==`function`&&Symbol.for){var p=Symbol.for;t=p(`react.element`),n=p(`react.portal`),r=p(`react.fragment`),i=p(`react.strict_mode`),a=p(`react.profiler`),o=p(`react.provider`),s=p(`react.context`),c=p(`react.forward_ref`),l=p(`react.suspense`),u=p(`react.suspense_list`),d=p(`react.memo`),f=p(`react.lazy`),p(`react.block`),p(`react.server.block`),p(`react.fundamental`),p(`react.debug_trace_mode`),p(`react.legacy_hidden`)}function m(e){if(typeof e==`object`&&e){var p=e.$$typeof;switch(p){case t:switch(e=e.type,e){case r:case a:case i:case l:case u:return e;default:switch(e&&=e.$$typeof,e){case s:case c:case f:case d:case o:return e;default:return p}}case n:return p}}}e.isFragment=function(e){return m(e)===r}})),Ct=e(((e,t)=>{t.exports=St()}))();function wt(e,t){let n=getComputedStyle(t);if(!n)return;let r=e===G.Horizontal?t.clientWidth:t.clientHeight;return r===0?void 0:(e===G.Horizontal?r-=parseFloat(n.paddingLeft)+parseFloat(n.paddingRight):r-=parseFloat(n.paddingTop)+parseFloat(n.paddingBottom),r)}function Tt(e,t,n=[],r={condition:!0}){let{condition:i}=r,a=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}(r,[`condition`]);j((()=>(i&&window.addEventListener(e,t,a),()=>{i&&window.removeEventListener(e,t)})),[e,t,i,...n])}(function(e,t){t===void 0&&(t={});var n=t.insertAt;if(typeof document<`u`){var r=document.head||document.getElementsByTagName(`head`)[0],i=document.createElement(`style`);i.type=`text/css`,n===`top`&&r.firstChild?r.insertBefore(i,r.firstChild):r.appendChild(i),i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e))}})(`/* === Main Container === */
|
|
2
|
+
.__dbk__container {
|
|
3
|
+
height: 100%;
|
|
4
|
+
width: 100%;
|
|
5
|
+
|
|
6
|
+
display: flex;
|
|
7
|
+
overflow: hidden;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.__dbk__container.Horizontal {
|
|
11
|
+
flex-direction: row;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.__dbk__container.Vertical {
|
|
15
|
+
flex-direction: column;
|
|
16
|
+
}
|
|
17
|
+
/* ====== */
|
|
18
|
+
|
|
19
|
+
/* === Wrapper for each child element === */
|
|
20
|
+
.__dbk__child-wrapper {
|
|
21
|
+
height: 100%;
|
|
22
|
+
width: 100%;
|
|
23
|
+
}
|
|
24
|
+
/* ====== */
|
|
25
|
+
|
|
26
|
+
/* === Gutter === */
|
|
27
|
+
.__dbk__gutter {
|
|
28
|
+
display: flex;
|
|
29
|
+
align-items: center;
|
|
30
|
+
justify-content: center;
|
|
31
|
+
}
|
|
32
|
+
/* .__dbk__gutter > div {
|
|
33
|
+
background: red;
|
|
34
|
+
} */
|
|
35
|
+
.__dbk__gutter.Horizontal {
|
|
36
|
+
height: 100%;
|
|
37
|
+
padding: 0 2px;
|
|
38
|
+
flex-direction: column;
|
|
39
|
+
}
|
|
40
|
+
.__dbk__gutter.Horizontal:hover {
|
|
41
|
+
cursor: col-resize;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.__dbk__gutter.Vertical {
|
|
45
|
+
width: 100%;
|
|
46
|
+
padding: 2px 0;
|
|
47
|
+
flex-direction: row;
|
|
48
|
+
}
|
|
49
|
+
.__dbk__gutter.Vertical:hover {
|
|
50
|
+
cursor: row-resize;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.__dbk__gutter.Light {
|
|
54
|
+
background: #EDF0EF;
|
|
55
|
+
}
|
|
56
|
+
.__dbk__gutter.Light:hover > .__dbk__dragger {
|
|
57
|
+
background: #76747B;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.__dbk__gutter.Dark {
|
|
61
|
+
background: #020203;
|
|
62
|
+
}
|
|
63
|
+
.__dbk__gutter.Dark:hover > .__dbk__dragger {
|
|
64
|
+
background: #9995A3;
|
|
65
|
+
}
|
|
66
|
+
/* ====== */
|
|
67
|
+
|
|
68
|
+
/* === Gutter's Dragger === */
|
|
69
|
+
.__dbk__dragger {
|
|
70
|
+
border-radius: 2px;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.__dbk__dragger.Horizontal {
|
|
74
|
+
width: 4px;
|
|
75
|
+
height: 24px;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.__dbk__dragger.Vertical {
|
|
79
|
+
width: 24px;
|
|
80
|
+
height: 4px;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.__dbk__dragger.Light {
|
|
84
|
+
background: #A6ACB5;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.__dbk__dragger.Dark {
|
|
88
|
+
background: #434252;
|
|
89
|
+
}
|
|
90
|
+
/* ====== */`);var Et=g.forwardRef((({className:e,theme:t,draggerClassName:n,direction:r=G.Vertical,onDragging:i},a)=>{let o=`__dbk__gutter ${r} ${e||t}`,s=`__dbk__dragger ${r} ${n||t}`;return T(`div`,Object.assign({className:o,ref:a,dir:r,onMouseDown:i,onTouchStart:Mt?i:void 0},{children:T(`div`,{className:s},void 0)}),void 0)})),W;function Dt(e,t,n){let r,i;return t?(r=e/2,i=e):n?(r=e,i=e/2):(r=e,i=e),{aGutterSize:r,bGutterSize:i}}function Ot(e,t){switch(t.type){case W.SetIsReadyToCompute:return Object.assign(Object.assign({},e),{isReady:t.payload.isReady});case W.CreatePairs:{let{direction:n,children:r,gutters:i}=t.payload,a=r[0].parentNode;if(!a)throw Error(`Cannot create pairs - parent is undefined.`);let o=wt(n,a);if(o===void 0)throw Error(`Cannot create pairs - parent has undefined or zero size: ${o}.`);let s=[];return r.forEach(((e,t)=>{if(t>0){let e=r[t-1],o=r[t],c=i[t-1],l=n===G.Horizontal?e.getBoundingClientRect().left:e.getBoundingClientRect().top,u=n===G.Horizontal?o.getBoundingClientRect().right:o.getBoundingClientRect().bottom,d=n===G.Horizontal?e.getBoundingClientRect().width+c.getBoundingClientRect().width+o.getBoundingClientRect().width:e.getBoundingClientRect().height+c.getBoundingClientRect().height+o.getBoundingClientRect().height,f=n===G.Horizontal?c.getBoundingClientRect().width:c.getBoundingClientRect().height,p={idx:t-1,a:e,b:o,gutter:c,parent:a,start:l,end:u,size:d,gutterSize:f,aSizePct:100/r.length,bSizePct:100/r.length};s.push(p)}})),Object.assign(Object.assign({},e),{pairs:s})}case W.StartDragging:{let{gutterIdx:n}=t.payload;return Object.assign(Object.assign({},e),{isDragging:!0,draggingIdx:n})}case W.StopDragging:return Object.assign(Object.assign({},e),{isDragging:!1});case W.CalculateSizes:{let{direction:n,gutterIdx:r}=t.payload,i=e.pairs[r],a=wt(n,i.parent);if(!a)throw Error(`Cannot calculate sizes - 'pair.parent' has undefined or zero size.`);let o=i.gutter[n===G.Horizontal?`clientWidth`:`clientHeight`],{aGutterSize:s,bGutterSize:c}=Dt(o,r===0,r===e.pairs.length-1),l,u,d,f,p;return n===G.Horizontal?(l=i.a.getBoundingClientRect().left,u=i.b.getBoundingClientRect().right,f=(i.a.getBoundingClientRect().width+s)/a*100,p=(i.b.getBoundingClientRect().width+c)/a*100,d=i.a.getBoundingClientRect().width+s+c+i.b.getBoundingClientRect().width):(l=i.a.getBoundingClientRect().top,u=i.b.getBoundingClientRect().bottom,f=(i.a.getBoundingClientRect().height+s)/a*100,p=(i.b.getBoundingClientRect().height+c)/a*100,d=i.a.getBoundingClientRect().height+s+c+i.b.getBoundingClientRect().height),e.pairs[r]=Object.assign(Object.assign({},i),{start:l,end:u,size:d,aSizePct:f,bSizePct:p,gutterSize:o}),Object.assign({},e)}default:return e}}function kt(e,t=0,n=[]){return ce.toArray(e).reduce(((e,r,i)=>((0,Ct.isFragment)(r)?e.push.apply(e,kt(r.props.children,t+1,n.concat(r.key||i))):Re(r)?e.push(oe(r,{key:n.concat(String(r.key)).join(`.`)})):typeof r!=`string`&&typeof r!=`number`||e.push(r),e)),[])}(function(e){e[e.SetIsReadyToCompute=0]=`SetIsReadyToCompute`,e[e.CreatePairs=1]=`CreatePairs`,e[e.CalculateSizes=2]=`CalculateSizes`,e[e.StartDragging=3]=`StartDragging`,e[e.StopDragging=4]=`StopDragging`})(W||={});var At=e=>`changedTouches`in e,G,jt;(function(e){e.Horizontal=`Horizontal`,e.Vertical=`Vertical`})(G||={}),function(e){e.Light=`Light`,e.Dark=`Dark`}(jt||={});var Mt=typeof window<`u`&&`ontouchstart`in window;function Nt(e){return e===G.Horizontal?`col-resize`:`row-resize`}var Pt={isReady:!1,isDragging:!1,pairs:[]};function Ft({direction:e=G.Horizontal,minWidths:t=[],minHeights:n=[],initialSizes:r,gutterTheme:i=jt.Dark,gutterClassName:a,draggerClassName:o,children:s,onResizeStarted:c,onResizeFinished:l,classes:u=[]}){let d=kt(s),[f,p]=ye(Ot,Pt),m=je(null),h=je([]),_=je([]);h.current=[],_.current=[];let ee=g.useCallback((e=>{p({type:W.SetIsReadyToCompute,payload:{isReady:e}})}),[]),te=g.useCallback(((e,t)=>{p({type:W.StartDragging,payload:{gutterIdx:t}});let n=f.pairs[t];c==null||c(n.idx),n.a.style.userSelect=`none`,n.b.style.userSelect=`none`,n.gutter.style.cursor=Nt(e),n.parent.style.cursor=Nt(e),document.body.style.cursor=Nt(e)}),[f.pairs]),v=g.useCallback((()=>{p({type:W.StopDragging});let t=[];for(let n=0;n<f.pairs.length;n++){let r=f.pairs[n],i=wt(e,r.parent);if(i===void 0)throw Error(`Cannot call the 'onResizeFinished' callback - parentSize is undefined`);if(r.gutterSize===void 0)throw Error(`Cannot call 'onResizeFinished' callback - gutterSize is undefined`);let a=n===0,o=n===f.pairs.length-1,s=r.a.getBoundingClientRect()[e===G.Horizontal?`width`:`height`],{aGutterSize:c,bGutterSize:l}=Dt(r.gutterSize,a,o),u=(s+c)/i*100;if(t.push(u),o){let n=(r.b.getBoundingClientRect()[e===G.Horizontal?`width`:`height`]+l)/i*100;t.push(n)}}if(f.draggingIdx===void 0)throw Error(`Could not reset cursor and user-select because 'state.draggingIdx' is undefined`);let n=f.pairs[f.draggingIdx];l==null||l(n.idx,t),n.a.style.userSelect=``,n.b.style.userSelect=``,n.gutter.style.cursor=``,n.parent.style.cursor=``,document.body.style.cursor=``}),[f.draggingIdx,f.pairs,e]),y=g.useCallback(((e,t)=>{p({type:W.CalculateSizes,payload:{direction:e,gutterIdx:t}})}),[]),ne=g.useCallback(((e,t,n)=>{p({type:W.CreatePairs,payload:{direction:e,children:t,gutters:n}})}),[]),b=g.useCallback(((e,t,n,r)=>{let i=t[0].parentNode;if(!i)throw Error(`Cannot set initial sizes - parent is undefined`);if(wt(e,i)===void 0)throw Error(`Cannot set initial sizes - parent has undefined size`);t.forEach(((i,a)=>{let o=a===0,s=a===t.length-1,c,l=0;t.length>1&&(l=n[s?a-1:a].getBoundingClientRect()[e===G.Horizontal?`width`:`height`],l=o||s?l/2:l),c=r&&a<r.length?`calc(${r[a]}% - ${l}px)`:`calc(${100/t.length}% - ${l}px)`,e===G.Horizontal?(i.style.width=c,i.style.height=`100%`):(i.style.height=c,i.style.width=`100%`)}))}),[]),re=g.useCallback(((e,t)=>{if(f.draggingIdx===void 0)throw Error(`Cannot adjust size - 'draggingIdx' is undefined`);let n=f.pairs[f.draggingIdx];if(n.size===void 0)throw Error(`Cannot adjust size - 'pair.size' is undefined`);if(n.gutterSize===void 0)throw Error(`Cannot adjust size - 'pair.gutterSize' is undefined`);let r=n.aSizePct+n.bSizePct,i=t/n.size*r,a=r-t/n.size*r,o=f.draggingIdx===0,s=f.draggingIdx===f.pairs.length-1,{aGutterSize:c,bGutterSize:l}=Dt(n.gutterSize,o,s),u=`calc(${i}% - ${c}px)`,d=`calc(${a}% - ${l}px)`;e===G.Horizontal?(n.a.style.width=u,n.b.style.width=d):(n.a.style.height=u,n.b.style.height=d)}),[f.draggingIdx,f.pairs,e]),x=g.useCallback(((e,t,n)=>{if(!f.isDragging)return;if(f.draggingIdx===void 0)throw Error(`Cannot drag - 'draggingIdx' is undefined`);let r=f.pairs[f.draggingIdx];if(r.start===void 0)throw Error(`Cannot drag - 'pair.start' is undefined`);if(r.size===void 0)throw Error(`Cannot drag - 'pair.size' is undefined`);if(r.gutterSize===void 0)throw Error(`Cannot drag - 'pair.gutterSize' is undefined`);let i=function(e,t){let n=At(t)?t.changedTouches[0]:t;return e===G.Horizontal?n.clientX:n.clientY}(t,e)-r.start,a=16,o=16;n.length>f.draggingIdx&&(a=n[f.draggingIdx]),n.length>=f.draggingIdx+1&&(o=n[f.draggingIdx+1]),i<r.gutterSize+a&&(i=r.gutterSize+a),i>=r.size-(r.gutterSize+o)&&(i=r.size-(r.gutterSize+o)),re(t,i)}),[f.isDragging,f.draggingIdx,f.pairs,re]),S=()=>{if(f.isDragging){if(f.draggingIdx===void 0)throw Error(`Cannot calculate sizes after dragging = 'state.draggingIdx' is undefined`);y(e,f.draggingIdx),v()}},C=r=>{f.isDragging&&(At(r)&&r.preventDefault(),x(r,e,e===G.Horizontal?t:n))};function w(e,t){if(!e.current)throw Error(`Can't add element to ref object - ref isn't initialized`);t&&!e.current.includes(t)&&e.current.push(t)}return Tt(`mouseup`,S,[f.isDragging,v]),Tt(`mousemove`,C,[e,f.isDragging,x,t,n]),Tt(`touchend`,S,[f.isDragging,v],{condition:Mt}),Tt(`touchmove`,C,[e,f.isDragging,x,t,n],{condition:Mt,passive:!Mt}),j((function(){if(!m.current)return;let t=m.current.parentElement;if(!t)return;let n=new ResizeObserver((()=>{let n=getComputedStyle(t),r=e===G.Horizontal?t.clientWidth:t.clientHeight;ee(!!n&&!!r)}));return n.observe(t),()=>{n.disconnect()}}),[m.current,e]),j((function(){if(f.isReady&&(!h.current||h.current[0].offsetParent)){if(!h.current||!_.current)throw Error(`Cannot create pairs - either variable 'childRefs' or 'gutterRefs' is undefined`);d.length<=1?b(e,h.current,_.current,r):(b(e,h.current,_.current,r),ne(e,h.current,_.current))}}),[s,f.isReady,e,b,ne,r]),T(`div`,Object.assign({className:`__dbk__container ${e}`,ref:m},{children:f.isReady&&d.map(((t,n)=>E(g.Fragment,{children:[T(`div`,Object.assign({ref:e=>w(h,e),className:`__dbk__child-wrapper `+(n<u.length?u[n]:``)},{children:t}),void 0),n<d.length-1&&T(Et,{ref:e=>w(_,e),className:a,theme:i,draggerClassName:o,direction:e,onDragging:()=>{y(e,t=n),te(e,t);return;var t}},void 0)]},n)))}),void 0)}function It(e){let[,t]=dt(()=>({accept:[`enum`],drop:()=>({enumId:e.categoryData._id}),collect:e=>({isOver:e.isOver(),canDrop:e.canDrop()})})),n=p.getInvertedColor(e.categoryData.common.color,e.themeType,!0);return E(D,{component:`span`,ref:e=>{t(e)},style:{...e.styles.categoryTitle,color:n},sx:{".enum-button":{visibility:ut.isTouchDevice()?`visible`:`hidden`},"&:hover .enum-button":{visibility:`visible`}},children:[e.categoryData.common.icon?T(A,{style:e.styles.icon,src:e.categoryData.common.icon}):null,typeof e.categoryData.common.name==`string`?e.categoryData.common.name:e.categoryData.common.name[e.lang]||e.categoryData.common.name.en,T(H,{className:`enum-button`,size:`small`,style:{color:n},onClick:()=>{e.showEnumEditDialog(e.categoryData,!1)},children:T(R,{title:e.t(`Edit`),placement:`top`,slotProps:{popper:{sx:{pointerEvents:`none`}}},children:T(Ue,{})})}),e.categoryData.common.dontDelete?null:T(H,{className:`enum-button`,size:`small`,style:{color:n},onClick:()=>e.showEnumDeleteDialog(e.categoryData),children:T(R,{title:e.t(`Delete`),placement:`top`,slotProps:{popper:{sx:{pointerEvents:`none`}}},children:T(ie,{})})})]})}var K={contentRoot:{padding:`16px 24px`},dialogTitle:{borderBottom:`1px solid #00000020`,padding:0,width:`100%`},dialogActions:{borderTop:`1px solid #00000020`,width:`100%`},dialog:{},iconPreview:{height:32,width:32},colorPicker:{},formIcon:{margin:10,opacity:.6},formContainer:{display:`flex`,justifyContent:`center`,alignItems:`center`},formControl:{display:`flex`,padding:`0 0 24px 0`,flexGrow:1e3}},Lt=e=>e.replace(p.FORBIDDEN_CHARS,`_`).replace(/\s/g,`_`).replace(/\./g,`_`).replace(/,/g,`_`).replace(/__/g,`_`).replace(/__/g,`_`).toLowerCase(),Rt=e=>e.split(`.`).pop()||``,zt=(e,t)=>e&&typeof e==`object`?e[t]||e.en:e||``,Bt=(e,t)=>{let n=e.split(`.`);return n[n.length-1]=t,n.join(`.`)};function Vt(e){let t=e.enums.find(t=>t._id===e.enum._id),n=!!Rt(e.enum._id)&&!!e.getName(e.enum.common.name);return e.isNew&&t&&n&&(n=!1),E(we,{fullWidth:e.innerWidth<500,open:!0,onClose:(t,n)=>{n!==`backdropClick`&&n!==`escapeKeyDown`&&e.onClose()},children:[T(u,{style:{...K.dialogTitle,padding:12},children:e.t(`Enum parameters`)}),T(ee,{sx:{"&.MuiDialogContent-root":K.contentRoot},children:E(f,{container:!0,spacing:2,style:K.dialog,children:[T(f,{size:{xs:12,md:6},children:T(yt,{label:`Name`,t:e.t,value:e.getName(e.enum.common.name),onChange:t=>{let n=JSON.parse(JSON.stringify(e.enum));!e.enum.common.dontDelete&&Lt(e.getName(n.common.name))===Rt(n._id)&&(n._id=Bt(n._id,Lt(t))),n.common.name=t,e.onChange(n)},autoComplete:`off`,icon:We,styles:K})}),T(f,{size:{xs:12,md:6},children:T(yt,{label:`ID edit`,t:e.t,disabled:e.enum.common.dontDelete,value:e.enum._id.split(`.`)[e.enum._id.split(`.`).length-1],onChange:t=>{let n=JSON.parse(JSON.stringify(e.enum));n._id=Bt(n._id,Lt(t)),e.onChange(n)},icon:nt,styles:K})}),T(f,{size:{xs:12,md:6},children:T(yt,{label:`ID preview`,t:e.t,disabled:!0,value:e.enum._id,icon:it,styles:K})}),T(f,{size:{xs:12,md:6},children:T(yt,{label:`Description`,t:e.t,value:zt(e.enum.common.desc,e.lang),onChange:t=>{let n=JSON.parse(JSON.stringify(e.enum));n.common.desc=t,e.onChange(n)},icon:S,styles:K})}),T(f,{size:{xs:12,md:6},children:T(Ke,{label:`Icon`,onlyDevices:e.enum._id.startsWith(`enum.functions.`),onlyRooms:e.enum._id.startsWith(`enum.rooms.`),value:e.enum.common.icon,onChange:t=>{let n=JSON.parse(JSON.stringify(e.enum));n.common.icon=t,e.onChange(n)},previewStyle:K.iconPreview,icon:de,customStyles:K})}),T(f,{size:{xs:12,md:6},children:T(xt,{label:`Color`,value:e.enum.common.color||``,previewStyle:K.iconPreview,onChange:t=>{let n=JSON.parse(JSON.stringify(e.enum));n.common.color=t,e.onChange(n)},icon:rt,style:K.colorPicker,styles:K,t:e.t})})]})}),E(_,{style:K.dialogActions,children:[T(k,{variant:`contained`,color:`primary`,autoFocus:!0,onClick:()=>e.saveData(),disabled:!n||!e.changed,startIcon:T(d,{}),children:e.t(`Save`)}),T(k,{variant:`contained`,color:`grey`,onClick:e.onClose,startIcon:T(V,{}),children:e.t(`Cancel`)})]})]})}s();var Ht={icon:{width:32,height:32},customGroupButton:{},enumTemplateButton:{justifyContent:`end`,margin:4,padding:`4px 8px`},enumTemplateLabel:{textAlign:`right`,opacity:.4,overflow:`hidden`,textOverflow:`ellipsis`,flexGrow:1},fullHeight:{height:`calc(100% - 32px)`,maxHeight:900},filter:{marginLeft:16,marginTop:0,marginBottom:0},content:{display:`grid`,width:`100%`,gridTemplateColumns:`repeat(4,1fr)`},title:{lineHeight:`45px`,verticalAlign:`middle`,display:`inline-block`}},Ut=class extends Oe{constructor(e){super(e),l(this,`templates`,void 0),this.templates=w(e.prefix.startsWith(`enum.functions`)?`devices`:`rooms`),this.state={filter:``}}render(){return E(we,{maxWidth:`md`,fullWidth:!0,sx:{"& .MuiPaper-root":Ht.fullHeight},open:!0,onClose:this.props.onClose,children:[E(u,{children:[this.props.t(this.props.prefix.startsWith(`enum.functions`)?`Create new function`:`Create new room`),T(Ve,{variant:`standard`,style:Ht.filter,value:this.state.filter,onChange:e=>this.setState({filter:e.target.value.toLowerCase()}),placeholder:this.props.t(`Filter`),margin:`dense`,slotProps:{input:{endAdornment:this.state.filter?T(H,{tabIndex:-1,size:`small`,onClick:()=>this.setState({filter:``}),children:T(n,{})}):null}}})]}),T(ee,{style:{textAlign:`center`},children:T(`div`,{style:Ht.content,children:this.templates.map((e,t)=>{let n=ut.getText(e.name,this.props.lang)||e._id;return this.props.enums[`${this.props.prefix}.${e._id}`]?null:!this.state.filter||n.toLowerCase().includes(this.state.filter)?T(k,{color:`grey`,variant:`outlined`,onClick:()=>{this.props.onClose(),this.props.createEnumTemplate(this.props.prefix,{_id:`${this.props.prefix}.${e._id}`,type:`enum`,common:{name:e.name,icon:e.icon},native:{}})},style:Ht.enumTemplateButton,startIcon:T(A,{src:e.icon,style:Ht.icon}),children:T(`span`,{style:Ht.enumTemplateLabel,children:n})},t):null})})}),E(_,{children:[T(k,{variant:`contained`,color:`primary`,style:Ht.customGroupButton,onClick:()=>{this.props.onClose(),this.props.showEnumEditDialog(this.props.getEnumTemplate(this.props.prefix),!0)},startIcon:T(Qe,{}),children:this.props.prefix===`enum.rooms`?this.props.t(`Custom room`):this.props.prefix===`enum.functions`?this.props.t(`Custom function`):this.props.t(`Custom enumeration`)}),T(k,{color:`grey`,variant:`contained`,onClick:this.props.onClose,startIcon:T(V,{}),children:this.props.t(`Cancel`)})]})]})}};function Wt(e){return E(we,{open:!0,onClose:e.onClose,children:[T(u,{children:e.t(`Please confirm`)}),T(ee,{children:T(y,{children:e.t(`Do you want to delete enum "%s"?`,e.getName(e.enum.common.name))})}),E(_,{children:[T(k,{variant:`contained`,autoFocus:!0,color:`primary`,onClick:()=>e.deleteEnum(e.enum._id),startIcon:T(ie,{}),children:e.t(`Delete`)}),T(k,{variant:`contained`,color:`grey`,onClick:e.onClose,startIcon:T(V,{}),children:e.t(`Cancel`)})]})]})}var Gt=[`state`,`channel`,`device`];function Kt(e,t){var n;(n=e.children)==null||n.forEach(e=>{e.data.sumVisibility!==!1&&(e.data.obj&&Gt.includes(e.data.obj.type)?t.push(e.data.obj._id):Kt(e,t))})}var qt=e=>{let[t,n]=L({DragWrapper:null}),r=g.useRef(null);return j(()=>{n({DragWrapper:t=>{var n,i,a,o;let s={type:`object`,end:(t,n)=>{let r=n.getDropResult();if(t.data&&r){if(t.data.obj)e.addItemToEnum(t.data.obj._id,r.enumId);else{let n=[];Kt(t,n),n.length&&e.addFolderToEnum(t.data.id,n,r.enumId)}}},item:{data:t.item.data,children:t.item.children,preview:t.item.data&&t.item.data.obj?E(C,{variant:`outlined`,style:e.stylesParent.enumGroupMember,children:[(n=t.item.data.obj.common)!=null&&n.icon?T(A,{style:e.stylesParent.icon,src:r.current?v(r.current,t.item.data.obj._id,e.lang):t.item.data.obj.common.icon}):Ee[t.item.data.obj.type]||T(I,{style:e.stylesParent.icon}),E(`div`,{children:[T(`div`,{children:(i=t.item.data.obj.common)!=null&&i.name?e.getName((a=t.item.data.obj.common)==null?void 0:a.name):t.item.data.obj._id}),(o=t.item.data.obj.common)!=null&&o.name?T(`div`,{style:{fontStyle:`italic`,fontSize:`smaller`,opacity:.7},children:t.item.data.obj._id}):null]})]},t.item.data.obj._id):null},collect:e=>({isDragging:e.isDragging()})},[{isDragging:c},l,u]=ft(s);return j(()=>{u(vt(),{captureDraggingState:!0})},[u]),T(D,{sx:t.style,ref:e=>{l(e)},style:{backgroundColor:c?`rgba(100,152,255,0.1)`:void 0},children:t.children},t.item.data.id)}})},[e.stylesParent,e.addItemToEnum,e.addFolderToEnum,e.getName]),t?T(o,{t:e.t,socket:e.socket,types:[`state`,`channel`,`device`],columns:[`name`,`type`,`role`,`room`,`func`],lang:e.lang,dragEnabled:!0,theme:e.theme,themeName:e.theme.name,themeType:e.theme.palette.mode,DragWrapper:t.DragWrapper||void 0,setObjectsReference:e=>r.current=e,levelPadding:10}):null};function Jt(e,t,n){var r,i;if(!e||typeof e!=`object`)return!1;let a=e;if(a.enumId){let e=a.enumId.split(`.`).slice(0,-1).join(`.`);return a.enumId!==n&&!n.startsWith(`${a.enumId}.`)&&e!==n}if(!t)return!1;let o=a.memberId||((r=a.data)==null?void 0:r.id);return!!o&&!((i=t.common)!=null&&(i=i.members)!=null&&i.includes(o))}function Yt(e,t){let n=e=>{var n;return(t((n=e.data)==null||(n=n.common)==null?void 0:n.name)||e.id.split(`.`).pop()||``).toLowerCase()};return[...e].sort((e,t)=>n(e).localeCompare(n(t)))}var q={list:{py:.5},row:{gap:`6px`,py:`4px`,pr:1,mx:.5,my:`1px`,minHeight:40,borderRadius:`6px`},rowDropOver:e=>({outline:`2px dashed ${e.palette.primary.main}`,outlineOffset:`-2px`}),expander:{width:28,flexShrink:0,display:`flex`,justifyContent:`center`},colorStripe:{width:4,alignSelf:`stretch`,borderRadius:`2px`,flexShrink:0},iconWrapper:{display:`flex`,flexShrink:0},icon:{width:24,height:24},name:{flexGrow:1,minWidth:0},folderName:{fontStyle:`italic`,opacity:.7},count:{fontSize:12,lineHeight:`20px`,minWidth:22,px:`6px`,borderRadius:`10px`,textAlign:`center`,flexShrink:0,backgroundColor:`action.selected`},preview:e=>({px:1.5,py:.75,borderRadius:`6px`,backgroundColor:e.palette.background.paper,boxShadow:e.shadows[4],whiteSpace:`nowrap`}),empty:{p:3,textAlign:`center`,opacity:.6}};function Xt(e,t){var n;return!t.search||t.getName((n=e.data)==null||(n=n.common)==null?void 0:n.name).toLowerCase().includes(t.search)||e.id.toLowerCase().includes(t.search)||Object.values(e.children).some(e=>Xt(e,t))}function Zt(e,t){return Yt(e.filter(e=>Xt(e,t)),t.getName)}function Qt(e){var t,n,r,i;let{item:a,level:o,list:s}=e,c=a.data,l=s.getName(c==null||(t=c.common)==null?void 0:t.name)||a.id.split(`.`).pop()||a.id,u=Zt(Object.values(a.children),s),d=!s.search&&!!s.closed[a.id],f=ut.isTouchDevice(),[{isOver:m,canDrop:g},_]=dt(()=>({accept:[`object`,`enum`,`enum-member`],drop:(e,t)=>t.didDrop()?void 0:{enumId:a.id},canDrop:e=>Jt(e,c,a.id),collect:e=>({isOver:e.isOver(),canDrop:e.canDrop()})}),[c,a.id]),[{isDragging:ee},te,v]=ft(()=>{var e;return{type:`enum`,item:()=>({enumId:a.id,preview:T(D,{sx:q.preview,children:l})}),canDrag:!!c&&!((e=c.common)!=null&&e.dontDelete),end:(e,t)=>{let n=t.getDropResult();n!=null&&n.enumId&&s.moveEnum(e.enumId,n.enumId)},collect:e=>({isDragging:e.isDragging()})}},[a.id,c,l,s.moveEnum]);j(()=>{v(vt(),{captureDraggingState:!0})},[v]);let y=(c==null||(n=c.common)==null||(n=n.members)==null?void 0:n.length)||0;return E(h,{children:[E(B,{id:`enum-row-${a.id}`,ref:e=>{_(e),f||te(e)},selected:s.selectedId===a.id,onClick:()=>c?s.onSelect(a.id):s.onToggle(a.id),sx:p.getStyle(s.theme,q.row,{pl:`${4+o*20}px`},m&&g&&q.rowDropOver),style:{opacity:ee||s.updating.includes(a.id)?.5:1},children:[T(D,{sx:q.expander,children:u.length?T(H,{size:`small`,onClick:e=>{e.stopPropagation(),s.onToggle(a.id)},children:T(d?ot:$e,{fontSize:`small`})}):null}),T(D,{component:`span`,sx:q.colorStripe,style:{backgroundColor:(c==null||(r=c.common)==null?void 0:r.color)||`transparent`}}),T(`span`,{style:q.iconWrapper,ref:f?e=>{te(e)}:void 0,children:c!=null&&(i=c.common)!=null&&i.icon?T(A,{src:c.common.icon,style:q.icon}):T(I,{style:q.icon})}),T(D,{sx:q.name,children:T(F,{variant:`body2`,noWrap:!0,sx:c?void 0:q.folderName,title:a.id,children:l})}),y?T(D,{component:`span`,sx:q.count,children:y}):null]}),u.length&&!d?u.map(e=>T(Qt,{item:e,level:o+1,list:s},e.id)):null]})}function $t(e){let t=Zt(e.items,e);return t.length?T(r,{dense:!0,sx:q.list,children:t.map(t=>T(Qt,{item:t,level:0,list:e},t.id))}):T(D,{sx:q.empty,children:e.t(e.search?`No entries found`:`There are no entries in this category yet`)})}var en=!1,tn=new Set;function nn(e){en!==e&&(en=e,tn.forEach(e=>e()))}function rn(e){nn(e.shiftKey||e.ctrlKey||e.altKey)}function an(e){var t;en&&((t=e.dataTransfer)==null?void 0:t.dropEffect)===`move`&&(e.dataTransfer.dropEffect=`copy`)}function on(){nn(!1),[`dragenter`,`dragover`,`drop`].forEach(e=>window.addEventListener(e,rn,!0)),[`dragenter`,`dragover`].forEach(e=>window.addEventListener(e,an))}function sn(){[`dragenter`,`dragover`,`drop`].forEach(e=>window.removeEventListener(e,rn,!0)),[`dragenter`,`dragover`].forEach(e=>window.removeEventListener(e,an));let e=en;return nn(!1),e}function cn(e){return tn.add(e),()=>tn.delete(e)}function ln(){return xe(cn,()=>en)}var J={root:{display:`flex`,flexDirection:`column`,height:`100%`,minWidth:0,flexGrow:1},dropActive:e=>({outline:`2px dashed ${e.palette.primary.main}`,outlineOffset:`-4px`}),header:e=>({display:`flex`,alignItems:`center`,flexWrap:`wrap`,gap:1.5,px:2,py:1.5,borderBottom:`1px solid ${e.palette.divider}`,flexShrink:0}),tile:e=>({width:52,height:52,borderRadius:`10px`,border:`2px solid ${e.palette.divider}`,display:`flex`,alignItems:`center`,justifyContent:`center`,flexShrink:0}),tileIcon:{width:36,height:36},headerText:{flexGrow:1,minWidth:160},mono:{fontFamily:`monospace`,opacity:.7},headerDescription:{opacity:.8},headerActions:{display:`flex`,alignItems:`center`,flexWrap:`wrap`,gap:.5},content:{flexGrow:1,overflowY:`auto`,p:2,display:`flex`,flexDirection:`column`,gap:1.5},subEntries:{display:`flex`,flexWrap:`wrap`,alignItems:`center`,gap:1},subEntriesLabel:{opacity:.7},group:e=>({border:`1px solid ${e.palette.divider}`,borderRadius:`8px`,overflow:`hidden`,flexShrink:0}),groupHeader:e=>({display:`flex`,alignItems:`center`,gap:1.5,px:1.5,py:.75,backgroundColor:e.palette.action.hover}),row:e=>({display:`flex`,alignItems:`center`,gap:1.5,pl:5,pr:1.5,py:.5,borderTop:`1px solid ${e.palette.divider}`,"&:hover":{backgroundColor:e.palette.action.hover}}),groupName:{fontWeight:600},rowIconWrapper:{display:`flex`,flexShrink:0},rowIcon:{width:24,height:24},missingIcon:{width:24,height:24,color:`warning.main`},rowText:{flexGrow:1,minWidth:0},rowId:{fontFamily:`monospace`,opacity:.6,display:`block`},role:{fontFamily:`monospace`,opacity:.6,width:150,flexShrink:0,display:{xs:`none`,md:`block`}},value:{width:110,flexShrink:0,textAlign:`right`,fontVariantNumeric:`tabular-nums`},chips:{display:`flex`,flexWrap:`wrap`,justifyContent:`flex-end`,gap:.5,maxWidth:{xs:120,md:260}},chipIcon:{width:16,height:16},removePlaceholder:{width:30,flexShrink:0},dragHint:{display:`flex`,alignItems:`center`,gap:1,opacity:.7,flexShrink:0},dragHintIcon:{fontSize:18},emptyMembers:e=>({border:`2px dashed ${e.palette.divider}`,borderRadius:`8px`,p:4,textAlign:`center`,opacity:.7}),preview:e=>({px:1.5,py:.75,borderRadius:`6px`,backgroundColor:e.palette.background.paper,boxShadow:e.shadows[4],whiteSpace:`nowrap`}),previewHint:{display:`flex`,alignItems:`center`,gap:.5,fontSize:11,opacity:.7},previewHintCopy:{color:`primary.main`,fontWeight:600,opacity:1},previewHintIcon:{fontSize:14}};function un(e,t,n,r){let i=[],a={},o=[],s=[];for(let r of e){let e=t[r];if(!e){o.push(r);continue}let c=r;if(e.type===`state`||e.type===`channel`){let i=p.getParentId(r),a=i?t[i]||n[i]:void 0;i&&(e.type===`state`||(a==null?void 0:a.type)===`device`)&&(c=i)}let l=a[c];l||(l={id:c,obj:t[c]||n[c],isMember:!1,states:[]},a[c]=l,i.push(l)),c===r?(l.isMember=!0,l.obj=e):(l.states.push(e),e.type===`state`&&s.push(r))}let c=(e,t)=>{var n;return(r(e==null||(n=e.common)==null?void 0:n.name)||t.split(`.`).pop()||t).toLowerCase()};return i.sort((e,t)=>c(e.obj,e.id).localeCompare(c(t.obj,t.id))),i.forEach(e=>e.states.sort((e,t)=>c(e,e._id).localeCompare(c(t,t._id)))),{groups:i,missing:o,stateIds:s}}function dn(e,t){var n,r;if(!e||e.val===null||e.val===void 0)return`–`;let i=e.val;typeof i==`number`&&(i=Math.round(i*1e3)/1e3);let a=(n=t.common)==null?void 0:n.states;if(a&&typeof a==`object`&&!Array.isArray(a)){let e=a[String(i)];if(e)return e}let o=typeof i==`object`?JSON.stringify(i):String(i),s=(r=t.common)==null?void 0:r.unit;return s?`${o} ${s}`:o}function fn(e){let t=ln(),{t:n}=e,r=null;return t?r=E(D,{sx:p.getStyle(e.theme,J.previewHint,J.previewHintCopy),children:[T(U,{sx:J.previewHintIcon}),n(`Copy · stays in "%s" too`,e.enumName)]}):ut.isTouchDevice()||(r=E(D,{sx:J.previewHint,children:[T(ht,{sx:J.previewHintIcon}),n(`Move · hold Shift, Ctrl or Alt to copy`)]})),E(D,{sx:J.preview,children:[T(`div`,{children:e.name}),r]})}function pn(e){var t,n;let{obj:r,t:i}=e,o=e.isMember&&!r,s=e.getName(r==null||(t=r.common)==null?void 0:t.name)||e.memberId.split(`.`).pop()||e.memberId,c=e.isMember&&!!r,l=ut.isTouchDevice(),[{isDragging:u},d,f]=ft(()=>({type:`enum-member`,item:()=>(on(),{memberId:e.memberId,fromEnumId:e.enumId,preview:T(fn,{name:s,enumName:e.enumName,t:i,theme:e.theme})}),canDrag:c,end:(t,n)=>{let r=sn(),i=n.getDropResult();i!=null&&i.enumId&&i.enumId!==t.fromEnumId&&e.onMove(t.memberId,i.enumId,r)},collect:e=>({isDragging:e.isDragging()})}),[e.memberId,e.enumId,e.enumName,e.onMove,e.theme,s,c,i]);j(()=>{f(vt(),{captureDraggingState:!0})},[f]);let p=r&&qe(r)||e.parent&&qe(e.parent)||null,m;m=o?T(Fe,{sx:J.missingIcon}):p?T(A,{src:p,style:J.rowIcon}):!r||r.type===`channel`?T(Me,{style:J.rowIcon}):r.type===`device`?T(Be,{style:J.rowIcon}):T(O,{style:J.rowIcon});let h=(r==null?void 0:r.type)===`state`?dn(e.state,r):void 0;return E(D,{ref:e=>{l||d(e)},sx:e.header?J.groupHeader:J.row,style:{opacity:u?.4:1,cursor:c&&!l?`grab`:void 0},children:[T(`span`,{style:J.rowIconWrapper,ref:l?e=>{d(e)}:void 0,children:m}),E(D,{sx:J.rowText,children:[T(F,{variant:`body2`,noWrap:!0,sx:e.header?J.groupName:void 0,children:o?e.memberId:s}),T(F,{variant:`caption`,component:`div`,noWrap:!0,sx:J.rowId,children:o?i(`Object does not exist any more`):e.memberId})]}),r!=null&&(n=r.common)!=null&&n.role?T(F,{variant:`caption`,noWrap:!0,sx:J.role,children:r.common.role}):null,h===void 0?null:T(F,{variant:`body2`,noWrap:!0,sx:J.value,style:e.state&&!e.state.ack?{fontStyle:`italic`}:void 0,title:h,children:h}),T(D,{sx:J.chips,children:e.chips.map(t=>{var n,r;return T(a,{size:`small`,label:e.getName((n=t.common)==null?void 0:n.name)||t._id.split(`.`).pop(),icon:(r=t.common)!=null&&r.icon?T(A,{src:t.common.icon,style:J.chipIcon}):void 0,title:t._id,onClick:()=>e.onSelect(t._id)},t._id)})}),e.isMember?T(R,{title:i(`Remove`),slotProps:{popper:{sx:{pointerEvents:`none`}}},children:T(H,{size:`small`,onClick:()=>e.onRemove(e.memberId),children:T(V,{fontSize:`small`})})}):T(`span`,{style:J.removePlaceholder})]})}function mn(e){var t,n,r,i,o,s;let{enumItem:c,t:l}=e,u=((t=c.common)==null?void 0:t.members)||[],d=`${c._id.split(`.`).slice(0,2).join(`.`)}.`,f=N(()=>Object.values(e.enums).filter(e=>(e._id.startsWith(`enum.rooms.`)||e._id.startsWith(`enum.functions.`))&&!e._id.startsWith(d)),[e.enums,d]),m=e=>f.filter(t=>{var n;return(n=t.common)==null||(n=n.members)==null?void 0:n.includes(e)}),{groups:h,missing:g,stateIds:_}=N(()=>un(u,e.members,e.parents,e.getName),[u,e.members,e.parents,e.getName]),[ee,te]=L({}),v=_.join(`
|
|
91
|
+
`);j(()=>{let t=v?v.split(`
|
|
92
|
+
`):[],n=(e,t)=>te(n=>({...n,[e]:t}));return t.length&&e.socket.subscribeState(t,n).catch(e=>console.error(`Cannot subscribe on the members:`,e)),()=>{t.length&&e.socket.unsubscribeState(t,n)}},[e.socket,v]);let[{isOver:y,canDrop:ne},b]=dt(()=>({accept:[`object`,`enum-member`],drop:(e,t)=>t.didDrop()?void 0:{enumId:c._id},canDrop:e=>Jt(e,c,c._id),collect:e=>({isOver:e.isOver(),canDrop:e.canDrop()})}),[c]),x=e.getName((n=c.common)==null?void 0:n.name)||c._id.split(`.`).pop(),S=(r=c.common)!=null&&r.desc?e.getName(c.common.desc):``,C=Yt(e.subEntries,e.getName),w={enumId:c._id,enumName:x||c._id,t:l,theme:e.theme,getName:e.getName,onSelect:e.onSelect,onRemove:e.onRemoveMember,onMove:e.onMoveMember};return E(D,{ref:e=>{b(e)},sx:p.getStyle(e.theme,J.root,y&&ne&&J.dropActive),style:{opacity:e.updating?.6:1},children:[E(D,{sx:J.header,children:[e.onBack?T(R,{title:l(`Back`),slotProps:{popper:{sx:{pointerEvents:`none`}}},children:T(H,{onClick:e.onBack,children:T(Te,{})})}):null,T(D,{sx:J.tile,style:(i=c.common)!=null&&i.color?{borderColor:c.common.color}:void 0,children:(o=c.common)!=null&&o.icon?T(A,{src:c.common.icon,style:J.tileIcon}):T(I,{style:J.tileIcon})}),E(D,{sx:J.headerText,children:[T(F,{variant:`h6`,noWrap:!0,children:x}),E(F,{variant:`caption`,component:`div`,noWrap:!0,sx:J.mono,children:[c._id,` · `,l(`%s members`,u.length)]}),S?T(F,{variant:`body2`,sx:J.headerDescription,children:S}):null]}),E(D,{sx:J.headerActions,children:[T(k,{variant:`contained`,size:`small`,startIcon:T(Ze,{}),onClick:e.onAddObjects,children:l(`Add objects`)}),T(R,{title:l(`Add child`),slotProps:{popper:{sx:{pointerEvents:`none`}}},children:T(H,{onClick:e.onAddChild,children:T(U,{})})}),T(R,{title:l(`Edit`),slotProps:{popper:{sx:{pointerEvents:`none`}}},children:T(H,{onClick:e.onEdit,children:T(Ue,{})})}),T(R,{title:l(`Clone`),slotProps:{popper:{sx:{pointerEvents:`none`}}},children:T(H,{onClick:e.onClone,children:T(at,{})})}),T(R,{title:l(`Delete`),slotProps:{popper:{sx:{pointerEvents:`none`}}},children:T(`span`,{children:T(H,{disabled:!!((s=c.common)!=null&&s.dontDelete),onClick:e.onDelete,children:T(ie,{})})})})]})]}),E(D,{sx:J.content,children:[C.length?E(D,{sx:J.subEntries,children:[E(F,{variant:`body2`,sx:J.subEntriesLabel,children:[l(`Sub-entries`),`:`]}),C.map(t=>{var n,r;return T(a,{label:e.getName((n=t.data)==null||(n=n.common)==null?void 0:n.name)||t.id.split(`.`).pop(),icon:(r=t.data)!=null&&(r=r.common)!=null&&r.icon?T(A,{src:t.data.common.icon,style:J.chipIcon}):void 0,disabled:!t.data,onClick:()=>e.onSelect(t.id)},t.id)})]}):null,h.map(e=>E(D,{sx:J.group,children:[T(pn,{...w,header:!0,memberId:e.id,obj:e.obj,isMember:e.isMember,chips:m(e.id)}),e.states.map(t=>re(pn,{...w,key:t._id,memberId:t._id,obj:t,parent:e.obj,isMember:!0,state:ee[t._id],chips:m(t._id)}))]},e.id)),g.length?T(D,{sx:J.group,children:g.map(e=>re(pn,{...w,key:e,header:!0,memberId:e,isMember:!0,chips:[]}))}):null,u.length>0&&!e.onBack&&!ut.isTouchDevice()?E(F,{variant:`caption`,component:`div`,sx:J.dragHint,children:[T(st,{sx:J.dragHintIcon}),l(`Drag an object onto another entry in the list to move it there. Hold Shift, Ctrl or Alt to copy it.`)]}):null,u.length?null:T(D,{sx:J.emptyMembers,children:l(`Drag states, channels or devices from the object list here or use "Add objects"`)})]})]})}var hn=le.default||le,gn=`enum.rooms.`,_n=`enum.functions.`,vn=`enumsAssignmentOnlyDevices`;function yn(){return window._localStorage||window.localStorage}var bn=[`system`,`_design`,`enum`,`script`],xn=[`beleuchtung`,`lighting`,`licht`,`light`,`lampe`,`lamp`],Sn=[`beschattung`,`shading`,`rollladen`,`rolladen`,`jalousie`,`shutter`,`blind`,`rollo`],Cn=[`heizung`,`heating`,`thermostat`,`klima`,`climate`],wn=[`klima`,`climate`,`lüftung`,`ventilation`,`heizung`,`heating`],Tn=[`temperatur`,`temperature`,`klima`,`climate`,`wetter`,`weather`],En=[`sicherheit`,`security`,`alarm`],Dn=[`steckdose`,`socket`,`schalter`,`switch`],On=[`multimedia`,`media`,`musik`,`music`,`audio`,`unterhaltung`,`entertainment`],kn=[`taster`,`button`,`schalter`,`switch`],An={[b.light]:xn,[b.dimmer]:xn,[b.ct]:xn,[b.rgb]:xn,[b.rgbSingle]:xn,[b.rgbwSingle]:xn,[b.hue]:xn,[b.cie]:xn,[b.blind]:Sn,[b.blindButtons]:Sn,[b.thermostat]:Cn,[b.airCondition]:wn,[b.airPurifier]:wn,[b.airQuality]:wn,[b.fan]:wn,[b.temperature]:Tn,[b.humidity]:Tn,[b.socket]:Dn,[b.window]:[`fenster`,`window`],[b.windowTilt]:[`fenster`,`window`],[b.door]:[`tür`,`door`],[b.gate]:[`garagentor`,`gate`,`garage`],[b.lock]:[`schloss`,`lock`,...En],[b.motion]:En,[b.fireAlarm]:En,[b.floodAlarm]:En,[b.coAlarm]:En,[b.camera]:[`kamera`,`camera`,...En],[b.media]:On,[b.volume]:On,[b.volumeGroup]:On,[b.vacuumCleaner]:[`staubsauger`,`vacuum`,`reinigung`,`cleaning`],[b.electricity]:[`energie`,`energy`,`strom`,`verbrauch`,`consumption`],[b.weatherCurrent]:[`wetter`,`weather`],[b.weatherForecast]:[`wetter`,`weather`],[b.pump]:[`pumpe`,`pump`,`bewässerung`,`irrigation`],[b.button]:kn,[b.buttonSensor]:kn,[b.illuminance]:[`helligkeit`,`brightness`,...xn]},Y={root:{display:`flex`,flexDirection:`column`,flexGrow:1,minWidth:0,height:`100%`},toolbar:{display:`flex`,alignItems:`center`,flexWrap:`wrap`,gap:1.5,px:2,py:1},search:{minWidth:200},instance:{minWidth:160},filter:{"& .MuiToggleButton-root":{textTransform:`none`,py:.25}},bulkBar:e=>({display:`flex`,alignItems:`center`,flexWrap:`wrap`,gap:1,px:2,py:.75,backgroundColor:e.palette.action.selected}),table:{flexGrow:1,overflow:`auto`},headerCell:e=>({backgroundColor:e.palette.background.paper,whiteSpace:`nowrap`}),nameBox:{display:`flex`,alignItems:`center`,gap:1.5,minWidth:220},nameText:{minWidth:0},icon:{width:24,height:24,flexShrink:0},mono:{fontFamily:`monospace`,opacity:.6,display:`block`},type:{display:`flex`,alignItems:`center`,gap:1,whiteSpace:`nowrap`},typeIcon:{width:20,height:20},cell:{display:`flex`,alignItems:`center`,flexWrap:`wrap`,gap:.5,minWidth:180},chipIcon:{width:16,height:16},partialChip:{opacity:.6},suggestionChip:{borderStyle:`dashed`,opacity:.7},menuIcon:{width:20,height:20},empty:{p:4,textAlign:`center`,opacity:.6}};function jn(e,t,n){let r=new Set;for(let e of t)r.add(e.substring(0,e.lastIndexOf(`.`)));let i=[];for(let s of t){var a,o;let t=e[s];if((t==null?void 0:t.type)!==`device`&&(t==null?void 0:t.type)!==`channel`)continue;let c=s.split(`.`);if(c.length<3||bn.includes(c[0])||c[c.length-1]===`info`||!r.has(s))continue;let l=c.slice(0,-1).join(`.`);i.push({id:s,obj:t,instance:`${c[0]}.${c[1]}`,level:+(((a=e[l])==null?void 0:a.type)===`device`),name:n((o=t.common)==null?void 0:o.name)||c[c.length-1]})}return i}function Mn(e,t){let n=new Map,r=new Map;for(let a of Object.values(e)){var i;if(a._id.startsWith(t))for(let e of((i=a.common)==null?void 0:i.members)||[]){let t=n.get(e);t?t.includes(a._id)||t.push(a._id):n.set(e,[a._id]);let i=e.split(`.`);for(let e=2;e<i.length;e++){let t=i.slice(0,e).join(`.`),n=r.get(t);n||(n=new Set,r.set(t,n)),n.add(a._id)}}}return{direct:n,children:r}}function X(e,t){let n=t.direct.get(e)||[],r=[],i=e.split(`.`);for(let e=2;e<i.length;e++)for(let a of t.direct.get(i.slice(0,e).join(`.`))||[])!n.includes(a)&&!r.includes(a)&&r.push(a);return{direct:n,inherited:r,partial:[...t.children.get(e)||[]].filter(e=>!n.includes(e)&&!r.includes(e))}}var Nn=e=>!!(e.direct.length||e.inherited.length||e.partial.length);function Pn(e){return e.toLowerCase().replace(/[\s_.-]/g,``)}function Fn(e,t){let n=e?An[e]:void 0;if(!n)return null;for(let e of n){let n=t.find(t=>{var n;let r=[t._id.split(`.`).pop()||``],i=(n=t.common)==null?void 0:n.name;return typeof i==`string`?r.push(i):i&&r.push(...Object.values(i).filter(e=>typeof e==`string`)),r.some(t=>Pn(t).includes(e))});if(n)return n}return null}function In(e,t,n,r){e[t]||={},(e[t][n]||=[]).push(r)}function Ln(e){let{assignment:t,t:n}=e,r=t=>{var n;return(n=e.enums[t])!=null&&(n=n.common)!=null&&n.icon?T(A,{src:e.enums[t].common.icon,style:Y.chipIcon}):void 0};return E(D,{sx:Y.cell,children:[t.direct.map(t=>T(a,{size:`small`,label:e.getLabel(t),icon:r(t),onClick:e.onOpenEnum?()=>{var n;return(n=e.onOpenEnum)==null?void 0:n.call(e,t)}:void 0,onDelete:()=>e.onRemove(t)},t)),t.inherited.map(t=>T(R,{title:n(`Assigned via the device`),slotProps:{popper:{sx:{pointerEvents:`none`}}},children:T(a,{size:`small`,variant:`outlined`,color:`primary`,label:e.getLabel(t),icon:r(t),onClick:e.onOpenEnum?()=>{var n;return(n=e.onOpenEnum)==null?void 0:n.call(e,t)}:void 0})},t)),t.partial.map(t=>T(R,{title:n(`Assigned via single states`),slotProps:{popper:{sx:{pointerEvents:`none`}}},children:T(a,{size:`small`,variant:`outlined`,color:`primary`,sx:Y.partialChip,label:e.getLabel(t),icon:r(t),onClick:e.onOpenEnum?()=>{var n;return(n=e.onOpenEnum)==null?void 0:n.call(e,t)}:void 0})},t)),e.suggestion?T(R,{title:n(`Suggestion from the detected device type`),slotProps:{popper:{sx:{pointerEvents:`none`}}},children:T(a,{size:`small`,variant:`outlined`,color:`primary`,sx:Y.suggestionChip,icon:T(U,{}),label:e.getLabel(e.suggestion._id),onClick:()=>e.suggestion&&e.onAccept(e.suggestion._id)})}):null,T(H,{size:`small`,onClick:t=>e.onOpenMenu(t.currentTarget),children:T(U,{fontSize:`small`})})]})}function Rn(e){let{t,enums:r,getName:a}=e,[o,s]=L(null),[l,u]=L(0),[f,p]=L(``),[h,g]=L(``),[_,ee]=L(e.initialFilter||`all`),[v,y]=L(0),[re,x]=L(50),[S,C]=L([]),[w,ie]=L(null),[ae,oe]=L(!1),[se,ce]=L(()=>yn().getItem(vn)!==`false`),le=N(()=>new hn,[]),de=je(new Map);j(()=>{He()},[]),j(()=>{setTimeout(()=>{s(null),e.socket.getObjects(!0,!0).then(e=>{de.current.clear(),s(e)}).catch(e=>{console.error(`Cannot read the objects:`,e),s({})})},0)},[e.socket,l]);let O=N(()=>o?Object.keys(o).sort():[],[o]),pe=N(()=>o?jn(o,O,a):[],[o,O,a]),me=N(()=>[...new Set(pe.map(e=>e.instance))].sort(),[pe]),he=N(()=>Mn(r,gn),[r]),M=N(()=>Mn(r,_n),[r]),P=e=>{let t=e.split(`.`),n=[];for(let e=3;e<=t.length;e++){var i;let o=t.slice(0,e).join(`.`);n.push(a((i=r[o])==null||(i=i.common)==null?void 0:i.name)||t[e-1])}return n.join(` / `)},ye=e=>Object.values(r).filter(t=>t._id.startsWith(e)).sort((e,t)=>P(e._id).localeCompare(P(t._id))),xe=N(()=>Object.values(r).filter(e=>e._id.startsWith(_n)),[r]),we=e=>{if(!o)return null;if(de.current.has(e))return de.current.get(e)||null;let t=null;try{var n;let r=le.detect({objects:o,id:e,_keysOptional:O,_keysOptionalSorted:!0,_usedIdsOptional:[],ignoreIndicators:[`UNREACH_STICKY`],excludedTypes:[b.info,b.instance,b.chart,b.image,b.location,b.locationOne]});t=(r==null||(n=r[0])==null?void 0:n.type)||null}catch(t){console.warn(`Cannot detect the type of "${e}":`,t)}return de.current.set(e,t),t},Te=e=>Nn(X(e,M))?null:Fn(we(e),xe),Ee=f.trim().toLowerCase(),I=pe.filter(e=>(!h||e.instance===h)&&(!Ee||e.name.toLowerCase().includes(Ee)||e.id.toLowerCase().includes(Ee))&&(!se||!!we(e.id)||Nn(X(e.id,he))||Nn(X(e.id,M)))),Oe=I.filter(e=>!Nn(X(e.id,he))),B=I.filter(e=>!Nn(X(e.id,M))),V=_===`noRoom`?Oe:_===`noFunction`?B:I,Fe=Math.max(0,Math.ceil(V.length/re)-1),Ie=Math.min(v,Fe),Re=V.slice(Ie*re,(Ie+1)*re),U=async t=>{if(Object.keys(t).length){oe(!0);try{await e.onChangeMembers(t)}finally{oe(!1)}}},Ue=(e,t)=>{let n={};In(n,t,X(e,t.startsWith(gn)?he:M).direct.includes(t)?`remove`:`add`,e),U(n)},We=(e,t)=>{let n=e===gn?he:M,r={};for(let e of S){let i=X(e,n).direct;i.filter(e=>e!==t).forEach(t=>In(r,t,`remove`,e)),t&&!i.includes(t)&&In(r,t,`add`,e)}U(r)},Ge=e=>{let t={};for(let n of e){let e=Te(n);e&&In(t,e._id,`add`,n)}U(t)},Ke=()=>{if(!w)return null;let e=w.prefix===gn?he:M,r=w.rowId?X(w.rowId,e).direct:[],i=()=>ie(null);return E(Ae,{open:!0,anchorEl:w.anchor,onClose:i,children:[w.mode===`set`?E(Le,{onClick:()=>{i(),We(w.prefix,null)},children:[T(Pe,{children:T(n,{fontSize:`small`})}),T(Ce,{children:t(w.prefix===gn?`No room`:`No function`)})]}):null,ye(w.prefix).map(e=>{var t;return E(Le,{onClick:()=>{i(),w.mode===`set`?We(w.prefix,e._id):w.rowId&&Ue(w.rowId,e._id)},children:[T(Pe,{children:r.includes(e._id)?T(d,{fontSize:`small`}):(t=e.common)!=null&&t.icon?T(A,{src:e.common.icon,style:Y.menuIcon}):null}),T(Ce,{children:P(e._id)})]},e._id)})]})},Je=n=>{let a=qe(n.obj),o=we(n.id),s=S.includes(n.id);return E(ke,{hover:!0,selected:s,children:[T(z,{padding:`checkbox`,children:T(c,{size:`small`,checked:s,onChange:()=>C(s?S.filter(e=>e!==n.id):[...S,n.id])})}),T(z,{children:E(D,{sx:Y.nameBox,style:{paddingLeft:n.level*24},children:[a?T(A,{src:a,style:Y.icon}):n.obj.type===`device`?T(Be,{style:Y.icon}):T(Me,{style:Y.icon}),E(D,{sx:Y.nameText,children:[T(F,{variant:`body2`,noWrap:!0,children:n.name}),T(F,{variant:`caption`,component:`div`,noWrap:!0,sx:Y.mono,children:n.id})]})]})}),T(z,{children:o?E(D,{sx:Y.type,children:[T(i,{type:o,style:Y.typeIcon}),T(F,{variant:`body2`,children:t(`type-${o}`)})]}):`–`}),T(z,{children:T(Ln,{assignment:X(n.id,he),enums:r,getLabel:P,t,onRemove:e=>Ue(n.id,e),onAccept:e=>Ue(n.id,e),onOpenEnum:e.onOpenEnum,onOpenMenu:e=>ie({anchor:e,prefix:gn,mode:`toggle`,rowId:n.id})})}),T(z,{children:T(Ln,{assignment:X(n.id,M),suggestion:Te(n.id),enums:r,getLabel:P,t,onRemove:e=>Ue(n.id,e),onAccept:e=>Ue(n.id,e),onOpenEnum:e.onOpenEnum,onOpenMenu:e=>ie({anchor:e,prefix:_n,mode:`toggle`,rowId:n.id})})})]},n.id)},Ye=!!V.length&&V.every(e=>S.includes(e.id));return E(D,{sx:Y.root,children:[E(D,{sx:Y.toolbar,children:[T(Ve,{variant:`standard`,placeholder:t(`Filter`),sx:Y.search,value:f,onChange:e=>{p(e.target.value),y(0)},slotProps:{input:{endAdornment:f?T(H,{tabIndex:-1,size:`small`,onClick:()=>p(``),children:T(n,{})}):null}}}),E(De,{variant:`standard`,displayEmpty:!0,sx:Y.instance,value:h,onChange:e=>{g(e.target.value),y(0)},children:[T(Le,{value:``,children:t(`All instances`)}),me.map(e=>T(Le,{value:e,children:e},e))]}),E(be,{size:`small`,exclusive:!0,sx:Y.filter,value:_,onChange:(e,t)=>{t&&(ee(t),y(0))},children:[E(_e,{value:`all`,children:[t(`All`),` (`,I.length,`)`]}),E(_e,{value:`noRoom`,children:[t(`Without room`),` (`,Oe.length,`)`]}),E(_e,{value:`noFunction`,children:[t(`Without function`),` (`,B.length,`)`]})]}),T(R,{title:t(`Show only objects, which were detected as a device or which already have a room or a function`),slotProps:{popper:{sx:{pointerEvents:`none`}}},children:T(m,{label:t(`Only detected devices`),control:T(ne,{size:`small`,checked:se,onChange:e=>{ce(e.target.checked),yn().setItem(vn,e.target.checked?`true`:`false`),y(0)}})})}),T(D,{sx:{flexGrow:1}}),T(R,{title:t(`Reload`),slotProps:{popper:{sx:{pointerEvents:`none`}}},children:T(H,{onClick:()=>u(l+1),children:T(ge,{})})})]}),S.length?E(D,{sx:Y.bulkBar,children:[T(F,{variant:`body2`,children:t(`%s selected`,S.length)}),T(k,{size:`small`,variant:`outlined`,disabled:ae,onClick:e=>ie({anchor:e.currentTarget,prefix:gn,mode:`set`}),children:t(`Set room`)}),T(k,{size:`small`,variant:`outlined`,disabled:ae,onClick:e=>ie({anchor:e.currentTarget,prefix:_n,mode:`set`}),children:t(`Set function`)}),T(k,{size:`small`,variant:`contained`,disabled:ae,startIcon:ae?T(te,{size:16,color:`inherit`}):T(et,{}),onClick:()=>Ge(S),children:t(`Accept suggestions`)}),T(D,{sx:{flexGrow:1}}),T(k,{size:`small`,color:`grey`,onClick:()=>C([]),children:t(`Clear selection`)})]}):null,!o||ae?T(ue,{}):null,E(Ne,{sx:Y.table,children:[E(ve,{size:`small`,stickyHeader:!0,children:[T(Se,{children:E(ke,{children:[T(z,{padding:`checkbox`,sx:Y.headerCell,children:T(c,{size:`small`,checked:Ye,indeterminate:!Ye&&!!S.length,onChange:()=>C(Ye?[]:V.map(e=>e.id))})}),T(z,{sx:Y.headerCell,children:t(`Device or channel`)}),T(z,{sx:Y.headerCell,children:t(`Detected type`)}),T(z,{sx:Y.headerCell,children:t(`Rooms`)}),T(z,{sx:Y.headerCell,children:t(`Functions`)})]})}),T(ze,{children:Re.map(e=>Je(e))})]}),o&&!V.length?T(D,{sx:Y.empty,children:t(`No devices or channels found`)}):null]}),T(fe,{component:`div`,count:V.length,page:Ie,rowsPerPage:re,rowsPerPageOptions:[25,50,100],onPageChange:(e,t)=>y(t),onRowsPerPageChange:e=>{x(parseInt(e.target.value,10)),y(0)}}),Ke()]})}var zn=[`cellar`,`basement`,`ground_floor`,`upstairs`,`second_floor`,`attic`,`outdoors`],Bn=[`living_room`,`kitchen`,`dining_room`,`bedroom`,`nursery`,`guest_room`,`bathroom`,`wc`,`office`,`corridor`,`laundry_room`,`storeroom`,`garage`,`garden`,`terrace`,`balcony`],Vn=[`living_room`,`kitchen`,`bedroom`,`bathroom`],Hn=[`ground_floor`,`upstairs`],Un=[`lighting`,`shading`,`heating`,`climate`,`socket`,`window`,`door`,`security`,`smoke_detector`,`music`,`weather`,`temperature_sensor`,`consumption`],Wn=[`lighting`,`shading`,`heating`,`socket`,`window`,`door`],Gn=[`Floors`,`Rooms`,`Functions`,`Assign devices`,`Overview`],Kn={"enum.rooms":{en:`Rooms`,de:`Räume`,ru:`Комнаты`,pt:`Divisões`,nl:`Kamers`,fr:`Pièces`,it:`Stanze`,es:`Habitaciones`,pl:`Pomieszczenia`,uk:`Кімнати`,"zh-cn":`房间`},"enum.functions":{en:`Functions`,de:`Funktionen`,ru:`Функции`,pt:`Funções`,nl:`Functies`,fr:`Fonctions`,it:`Funzioni`,es:`Funciones`,pl:`Funkcje`,uk:`Функції`,"zh-cn":`功能`}},Z={dialogPaper:{height:`85vh`},stepper:{px:3,pb:2},content:{display:`flex`,flexDirection:`column`,gap:2},assignment:{display:`flex`,height:`100%`,minHeight:0,p:0},hint:{opacity:.8},group:{display:`flex`,flexDirection:`column`,gap:1},groupTitle:{fontWeight:600},tiles:{display:`grid`,gridTemplateColumns:`repeat(auto-fill, minmax(130px, 1fr))`,gap:1},tile:e=>({position:`relative`,display:`flex`,flexDirection:`column`,justifyContent:`center`,gap:.5,p:1,height:110,borderRadius:`8px`,border:`2px solid ${e.palette.divider}`,transition:`border-color 0.2s, background-color 0.2s`,"&:hover":{borderColor:e.palette.text.disabled}}),tileSelected:e=>({borderColor:e.palette.primary.main,backgroundColor:e.palette.action.selected,"&:hover":{borderColor:e.palette.primary.main}}),tileLocked:{opacity:.6},tileCheck:{position:`absolute`,top:6,right:6,fontSize:20},tileIcon:{width:40,height:40},tileName:{textAlign:`center`,lineHeight:1.2},addRow:{display:`flex`,alignItems:`center`,gap:1},summary:{display:`flex`,flexDirection:`column`,gap:1}};function qn(e){let t=Object.keys(e).filter(e=>e.startsWith(`enum.rooms.`)),n=new Set;for(let e of t){let t=e.split(`.`);(t.length>3||zn.includes(t[2]))&&n.add(t[2])}let r={};for(let e of t){let t=e.split(`.`);t.length===4?(r[t[2]]||=[]).push(t[3]):t.length===3&&!n.has(t[2])&&(r[``]||=[]).push(t[2])}let i=Object.keys(e).filter(e=>e.startsWith(`enum.functions.`)&&e.split(`.`).length===3).map(e=>e.split(`.`)[2]);return{floors:[...n],rooms:r,functions:i}}function Jn(e){return e.trim().toLowerCase().replace(p.FORBIDDEN_CHARS,`_`).replace(/[\s.,]+/g,`_`).replace(/_+/g,`_`).replace(/^_|_$/g,``)}function Yn(e){return e.filter((t,n)=>e.findIndex(e=>e._id===t._id)===n)}var Xn=(e,t)=>e.includes(t)?e.filter(e=>e!==t):[...e,t];function Zn(e){return E(Ge,{disabled:e.locked,onClick:e.onClick,sx:p.getStyle(e.theme,Z.tile,e.selected&&Z.tileSelected,e.locked&&Z.tileLocked),children:[e.selected?T(_t,{color:`primary`,sx:Z.tileCheck}):null,e.icon?T(A,{src:e.icon,style:Z.tileIcon}):T(I,{style:Z.tileIcon}),T(F,{variant:`body2`,sx:Z.tileName,children:e.name}),e.locked&&e.lockedText?T(F,{variant:`caption`,sx:Z.hint,children:e.lockedText}):null]})}function Qn(e){let[t,n]=L(``),r=Jn(t),i=!!r&&!e.usedIds.includes(r),a=()=>{i&&(e.onAdd({id:r,name:t.trim()}),n(``))};return E(D,{sx:Z.addRow,children:[T(Ve,{variant:`standard`,placeholder:e.placeholder,value:t,onChange:e=>n(e.target.value),onKeyDown:e=>{e.key===`Enter`&&a()}}),T(k,{size:`small`,startIcon:T(U,{}),disabled:!i,onClick:a,children:e.t(`Add`)})]})}function $n(e){let{t,enums:n,getName:r}=e,i=N(()=>Yn(w(`rooms`)),[]),a=N(()=>Yn(w(`devices`)),[]),[o,s]=L(()=>qn(n)),[c,l]=L(0),[f,p]=L(()=>o.floors.length>0),[m,g]=L(()=>o.floors.length?[]:[...Hn]),[te,v]=L([]),[y,ne]=L(()=>{var e;return!o.floors.length&&!((e=o.rooms[``])!=null&&e.length)?{"":[...Vn]}:{}}),[b,re]=L({}),[x,S]=L(()=>o.functions.length?[]:[...Wn]),[C,ie]=L([]),[oe,ce]=L(!1),[le,ue]=L(!1),[de,fe]=L(!1),[O,A]=L({floors:0,rooms:0,functions:0}),j=e=>r(e.name)||e.id,me=e=>({id:e._id,name:e.name,icon:e.icon}),he=(e,t)=>{var r,i;return{id:t,name:((r=n[e])==null||(r=r.common)==null?void 0:r.name)||t,icon:(i=n[e])==null||(i=i.common)==null?void 0:i.icon}},M=[...zn.map(e=>i.find(t=>t._id===e)).filter(e=>!!e).map(me),...o.floors.filter(e=>!zn.includes(e)).map(e=>he(`enum.rooms.${e}`,e)),...te],ge=e=>o.floors.includes(e)||m.includes(e),P=f?M.filter(e=>ge(e.id)):[{id:``,name:``}],ve=(e,t)=>e?`enum.rooms.${e}.${t}`:`enum.rooms.${t}`,ye=(e,t)=>{var n;return!!((n=o.rooms[e])!=null&&n.includes(t))},xe=(e,t)=>{var n;return ye(e,t)||!!((n=y[e])!=null&&n.includes(t))},Se=e=>e.map(e=>{var t;return r((t=n[e])==null||(t=t.common)==null?void 0:t.name).trim().toLowerCase()}).filter(e=>e),Ce=e=>{let t=Se((o.rooms[e]||[]).map(t=>ve(e,t)));return[...i.filter(n=>!zn.includes(n._id)&&(ye(e,n._id)||!t.includes(r(n.name).trim().toLowerCase()))).map(me),...(o.rooms[e]||[]).filter(e=>!i.find(t=>t._id===e)).map(t=>he(ve(e,t),t)),...b[e]||[]]},Ee=e=>{let t=Ce(e).filter(t=>oe||Bn.includes(t.id)||xe(e,t.id)||!i.find(e=>e._id===t.id)),n=e=>{let t=Bn.indexOf(e.id);return t===-1?Bn.length:t};return t.sort((e,t)=>n(e)-n(t)||j(e).localeCompare(j(t)))},I=e=>o.functions.includes(e),R=e=>I(e)||x.includes(e),De=Se(o.functions.map(e=>`enum.functions.${e}`)),Oe=[...a.filter(e=>I(e._id)||!De.includes(r(e.name).trim().toLowerCase())).map(me),...o.functions.filter(e=>!a.find(t=>t._id===e)).map(e=>he(`enum.functions.${e}`,e)),...C],z=Oe.filter(e=>le||Un.includes(e.id)||R(e.id)||!a.find(t=>t._id===e.id)).sort((e,t)=>{let n=e=>{let t=Un.indexOf(e.id);return t===-1?Un.length:t};return n(e)-n(t)||j(e).localeCompare(j(t))}),B=(()=>{let e=[],t=(t,r,i)=>{!n[t]&&!e.find(e=>e._id===t)&&e.push({_id:t,type:`enum`,common:{name:r,icon:i,members:[]},native:{}})},r=t=>{!n[t]&&!e.find(e=>e._id===t)&&e.push({_id:t,type:`enum`,common:{name:Kn[t],members:[],dontDelete:!0},native:{}})},i=0,a=0,s=0;if(f)for(let e of M)m.includes(e.id)&&!o.floors.includes(e.id)&&(r(`enum.rooms`),t(`enum.rooms.${e.id}`,e.name,e.icon),i++);for(let e of P)for(let n of y[e.id]||[]){let i=Ce(e.id).find(e=>e.id===n);i&&!ye(e.id,n)&&(r(`enum.rooms`),t(ve(e.id,n),i.name,i.icon),a++)}for(let e of x){let n=Oe.find(t=>t.id===e);n&&!I(e)&&(r(`enum.functions`),t(`enum.functions.${e}`,n.name,n.icon),s++)}return{list:e,floors:i,rooms:a,functions:s}})(),ke=async()=>{if(B.list.length){fe(!0),await e.onCreateEnums(B.list),fe(!1),A({floors:O.floors+B.floors,rooms:O.rooms+B.rooms,functions:O.functions+B.functions});let t={...n};B.list.forEach(e=>t[e._id]=e),s(qn(t)),g([]),ne({}),S([])}l(3)};return E(we,{open:!0,fullWidth:!0,maxWidth:`lg`,fullScreen:e.fullScreen,onClose:(t,n)=>{n!==`backdropClick`&&e.onClose()},sx:{"& .MuiDialog-paper":e.fullScreen?void 0:Z.dialogPaper},children:[T(u,{children:t(`Set up rooms and functions`)}),T(D,{sx:Z.stepper,children:T(ae,{activeStep:c,alternativeLabel:!0,children:Gn.map(e=>T(pe,{children:T(se,{children:t(e)})},e))})}),E(ee,{dividers:!0,sx:c===3?Z.assignment:void 0,children:[c===0?E(D,{sx:Z.content,children:[E(be,{size:`small`,exclusive:!0,value:f?`floors`:`flat`,onChange:(e,t)=>t&&p(t===`floors`),children:[T(_e,{value:`floors`,children:t(`With floors`)}),T(_e,{value:`flat`,children:t(`Without floors`)})]}),T(F,{variant:`body2`,sx:Z.hint,children:t(f?`Every floor becomes a room, which contains the rooms of this floor`:`Without floors, all rooms are on the same level`)}),f?E(h,{children:[T(D,{sx:Z.tiles,children:M.map(n=>T(Zn,{name:j(n),icon:n.icon,selected:ge(n.id),locked:o.floors.includes(n.id),lockedText:t(`Already exists`),theme:e.theme,onClick:()=>g(Xn(m,n.id))},n.id))}),T(Qn,{t,placeholder:t(`Custom floor`),usedIds:i.map(e=>e._id).concat(M.map(e=>e.id)),onAdd:e=>{v([...te,e]),g([...m,e.id])}})]}):null]}):null,c===1?(()=>{var i;return E(D,{sx:Z.content,children:[T(F,{variant:`body2`,sx:Z.hint,children:t(f?`Select the rooms of every floor. Rooms that already exist stay unchanged`:`Select the rooms. Rooms that already exist stay unchanged`)}),P.length?null:T(F,{children:t(`Select at least one floor`)}),P.map(n=>E(D,{sx:Z.group,children:[f?T(F,{variant:`subtitle1`,sx:Z.groupTitle,children:j(n)}):null,T(D,{sx:Z.tiles,children:Ee(n.id).map(r=>T(Zn,{name:j(r),icon:r.icon,selected:xe(n.id,r.id),locked:ye(n.id,r.id),lockedText:t(`Already exists`),theme:e.theme,onClick:()=>ne({...y,[n.id]:Xn(y[n.id]||[],r.id)})},r.id))}),T(Qn,{t,placeholder:t(`Custom room`),usedIds:Ce(n.id).map(e=>e.id).concat(zn),onAdd:e=>{re({...b,[n.id]:[...b[n.id]||[],e]}),ne({...y,[n.id]:[...y[n.id]||[],e.id]})}})]},n.id)),f&&(i=o.rooms[``])!=null&&i.length?E(D,{sx:Z.group,children:[T(F,{variant:`subtitle1`,sx:Z.groupTitle,children:t(`Rooms without floor`)}),T(D,{sx:Z.tiles,children:o.rooms[``].map(i=>{var a,o;return T(Zn,{name:r((a=n[`enum.rooms.${i}`])==null||(a=a.common)==null?void 0:a.name)||i,icon:(o=n[`enum.rooms.${i}`])==null||(o=o.common)==null?void 0:o.icon,selected:!0,locked:!0,lockedText:t(`Already exists`),theme:e.theme,onClick:()=>void 0},i)})})]}):null,T(D,{children:T(k,{size:`small`,onClick:()=>ce(!oe),children:t(oe?`Show less`:`Show more`)})})]})})():null,c===2?E(D,{sx:Z.content,children:[T(F,{variant:`body2`,sx:Z.hint,children:t(`Select the functions of your devices. Functions that already exist stay unchanged`)}),T(D,{sx:Z.tiles,children:z.map(n=>T(Zn,{name:j(n),icon:n.icon,selected:R(n.id),locked:I(n.id),lockedText:t(`Already exists`),theme:e.theme,onClick:()=>S(Xn(x,n.id))},n.id))}),T(Qn,{t,placeholder:t(`Custom function`),usedIds:Oe.map(e=>e.id),onAdd:e=>{ie([...C,e]),S([...x,e.id])}}),T(D,{children:T(k,{size:`small`,onClick:()=>ue(!le),children:t(le?`Show less`:`Show more`)})})]}):null,c===3?T(Rn,{socket:e.socket,enums:n,t,theme:e.theme,getName:r,initialFilter:`noRoom`,onChangeMembers:e.onChangeMembers}):null,c===4?(()=>{let e=new Set,r=new Set;for(let t of Object.values(n))if(t._id.startsWith(`enum.rooms.`)){var i;(i=t.common)==null||(i=i.members)==null||i.forEach(t=>e.add(t))}else if(t._id.startsWith(`enum.functions.`)){var a;(a=t.common)==null||(a=a.members)==null||a.forEach(e=>r.add(e))}return E(D,{sx:Z.summary,children:[T(F,{variant:`h6`,children:t(`The rooms and functions are ready`)}),T(F,{children:t(`Created: %s floors, %s rooms, %s functions`,O.floors,O.rooms,O.functions)}),T(F,{children:t(`%s objects are in a room`,e.size)}),T(F,{children:t(`%s objects have a function`,r.size)}),T(F,{variant:`body2`,sx:Z.hint,children:t(`You can change everything at any time in the categories view or in the assignment view`)})]})})():null]}),E(_,{children:[c<4?T(k,{color:`grey`,disabled:de,startIcon:T(V,{}),onClick:e.onClose,children:t(`Cancel`)}):null,T(D,{sx:{flexGrow:1}}),c>0&&c<4?T(k,{color:`grey`,variant:`outlined`,disabled:de,startIcon:T(Te,{}),onClick:()=>l(c-1),children:t(`Back`)}):null,c<2?T(k,{variant:`contained`,endIcon:T(ht,{}),disabled:c===1&&!P.length,onClick:()=>l(c+1),children:t(`Next`)}):null,c===2?T(k,{variant:`contained`,loading:de,endIcon:T(ht,{}),onClick:()=>void ke(),children:t(B.list.length?`Create and continue`:`Next`)}):null,c===3?T(k,{variant:`contained`,endIcon:T(ht,{}),onClick:()=>l(4),children:t(`Next`)}):null,c===4?T(k,{variant:`contained`,startIcon:T(d,{}),onClick:e.onClose,children:t(`Finish`)}):null]})]})}s();var er=800,tr=500,Q={root:{display:`flex`,flexDirection:`column`,height:`100%`,overflow:`hidden`},topBar:e=>({display:`flex`,alignItems:`center`,gap:1,px:1,borderBottom:`1px solid ${e.palette.divider}`,flexShrink:0}),tabs:{minWidth:0},wizardButton:{flexShrink:0,minWidth:0,my:.75,textTransform:`none`},viewToggle:{flexShrink:0,my:.75,"& .MuiToggleButton-root":{textTransform:`none`,gap:.75,py:.25}},body:{display:`flex`,flexGrow:1,minHeight:0},split:{flexGrow:1,minWidth:0,height:`100%`},main:{display:`flex`,flexGrow:1,minWidth:0,height:`100%`},listPane:e=>({width:300,flexShrink:0,display:`flex`,flexDirection:`column`,height:`100%`,borderRight:`1px solid ${e.palette.divider}`}),listPaneNarrow:{width:`100%`,borderRight:0},listToolbar:{display:`flex`,alignItems:`center`,gap:.5,px:1.5,py:1},filter:{flexGrow:1},listScroll:{flexGrow:1,overflowY:`auto`,overflowX:`hidden`},detailsEmpty:{flexGrow:1,display:`flex`,alignItems:`center`,justifyContent:`center`,textAlign:`center`,opacity:.6,p:3},objectsPane:{height:`100%`,overflow:`auto`},rail:e=>({width:40,flexShrink:0,display:`flex`,flexDirection:`column`,alignItems:`center`,gap:1.5,pt:1.5,cursor:`pointer`,color:e.palette.text.secondary,borderLeft:`1px solid ${e.palette.divider}`,"&:hover":{color:e.palette.primary.main,backgroundColor:e.palette.action.hover}}),railText:{writingMode:`vertical-rl`,transform:`rotate(180deg)`,fontSize:13,fontWeight:500,letterSpacing:`0.04em`,whiteSpace:`nowrap`},enumGroupMember:{display:`flex`,gap:8,alignItems:`center`,padding:`8px 16px`},icon:{height:32,width:32,marginRight:5,display:`inline-block`},categoryTitle:{flexDirection:`row`,alignItems:`center`,display:`inline-flex`}},nr=()=>{let e=bt(),t=e.display,{item:n,style:r}=e;return t?T(`div`,{style:{...r,zIndex:1e3},children:n.preview}):null},rr={favorites:{_id:`enum.favorites`,type:`enum`,common:{name:{en:`Favorites`,de:`Favoriten`,ru:`Избранное`,pt:`Favoritos`,nl:`Favorieten`,fr:`Favoris`,it:`Preferiti`,es:`Favoritos`,pl:`Ulubione`,uk:`Обране`,"zh-cn":`收藏夹`}},native:{}}},ir={_id:``,type:`enum`,common:{name:``,color:``,desc:``,members:[]},native:{}};function $(){return window._localStorage||window.localStorage}function ar(e,t,n){try{let t=$().getItem(e);if(t){let e=JSON.parse(t);if(n(e))return e}}catch{}return t}var or=e=>!!e&&typeof e==`object`&&!Array.isArray(e);function sr(e){return e instanceof Error?e.message:typeof e==`string`?e:JSON.stringify(e)}var cr=class e extends Oe{constructor(t){super(t),l(this,`fastUpdate`,!1),l(this,`updateTimeout`,null),l(this,`changeEnums`,null),l(this,`lastEnums`,null),l(this,`updateCounter`,0),l(this,`selectAfterUpdate`,null),l(this,`memberChangesQueue`,Promise.resolve()),l(this,`onResize`,()=>{let e=window.innerWidth<er;e!==this.state.narrow&&this.setState({narrow:e})}),l(this,`getEnumTemplate`,t=>{let n=JSON.parse(JSON.stringify(ir)),{_id:r,name:i}=e.findNewUniqueName(t,Object.values(this.state.enums||{}),this.props.t(`Enum`));return n._id=r,n.common.name=i,n}),l(this,`createEnumTemplate`,(e,t)=>{let n=this.getEnumTemplate(e);n._id=t._id,n.common={...n.common,...t.common},this.selectAfterUpdate=n._id,this.addUpdating([n._id]).then(()=>this.props.socket.setObject(n._id,n)).catch(e=>window.alert(`Cannot create enum: ${e}`))}),l(this,`onObjectChange`,(e,t)=>{let n=t,r;if(this.state.enums&&e.startsWith(`enum.`)){let t=this.changeEnums||this.lastEnums||this.state.enums;if(n){let i=t[e];if(!i||i&&JSON.stringify(i)!==JSON.stringify(n)){let i=this.changeEnums||JSON.parse(JSON.stringify(t));i[e]=n,this.changeEnums=i,r=!0}}else if(t[e]){let n=this.changeEnums||JSON.parse(JSON.stringify(t));delete n[e],this.changeEnums=n,r=!0}}r&&(this.updateTimeout&&clearTimeout(this.updateTimeout),this.updateTimeout=setTimeout(()=>{this.updateTimeout=null;let e=this.changeEnums||void 0;this.changeEnums=null,this.updateData(e).then(()=>{var e;let t=this.selectAfterUpdate;t&&(e=this.state.enums)!=null&&e[t]&&(this.selectAfterUpdate=null,this.selectEnum(t))}).catch(()=>void 0)},this.fastUpdate?0:200),this.fastUpdate=!1)}),l(this,`updateData`,async e=>{let t=++this.updateCounter,n=e||await this.props.socket.getForeignObjects(`enum.*`,`enum`);this.lastEnums=n;let r=new Set;Object.values(n).forEach(e=>{var t;return(t=e.common)==null||(t=t.members)==null?void 0:t.forEach(e=>r.add(e))});let i=await this.readObjects([...r]),a=new Set;for(let e of Object.keys(i))if(i[e].type===`state`||i[e].type===`channel`){let t=p.getParentId(e);t&&t.includes(`.`)&&!i[t]&&a.add(t)}let o=await this.readObjects([...a]);t===this.updateCounter&&this.setState({enums:n,members:i,parents:o,updating:[]},()=>this.buildTree(n))}),l(this,`setCurrentCategory`,(e,t)=>{e===this.state.currentCategory?t==null||t():(this.setState({currentCategory:e},()=>t==null?void 0:t()),$().setItem(`enumCurrentCategory`,e))}),l(this,`selectEnum`,e=>{let t=e.split(`.`)[1],n={...this.state.selected,[t]:e};$().setItem(`enumsSelected`,JSON.stringify(n));let r=this.state.enumsClosed,i=e.split(`.`);for(let e=3;e<i.length;e++){let t=i.slice(0,e).join(`.`);r[t]&&(r={...r},delete r[t])}r!==this.state.enumsClosed&&$().setItem(`enumsClosed`,JSON.stringify(r)),this.setCurrentCategory(t,()=>this.setState({selected:n,enumsClosed:r,showDetails:!0},()=>setTimeout(()=>{var t;return(t=document.getElementById(`enum-row-${e}`))==null?void 0:t.scrollIntoView({block:`nearest`})},50)))}),l(this,`addEnum`,e=>{[`functions`,`rooms`].includes(e.split(`.`)[1])?this.setState({enumTemplateDialog:e}):this.showEnumEditDialog(this.getEnumTemplate(e),!0)}),l(this,`addItemsToEnum`,(e,t)=>{var n;if(!((n=this.state.enums)!=null&&n[t]))return;let r=JSON.parse(JSON.stringify(this.state.enums[t]));r.common||={},r.common.members||=[];let i=r.common.members,a=e.filter(e=>!i.includes(e));a.length&&(i.push(...a),this.fastUpdate=!0,this.props.socket.setObject(r._id,r).catch(e=>window.alert(`Cannot set enum: ${e}`)))}),l(this,`addItemToEnum`,(e,t)=>this.addItemsToEnum([e],t)),l(this,`addFolderToEnum`,(e,t,n)=>this.setState({addFolderDialog:{folderId:e,ids:t,enumId:n}})),l(this,`removeMemberFromEnum`,(e,t)=>{var n,r;let i=(n=this.state.enums)==null?void 0:n[t];if(!(i!=null&&(r=i.common)!=null&&(r=r.members)!=null&&r.includes(e)))return;let a=JSON.parse(JSON.stringify(i));a.common.members=(a.common.members||[]).filter(t=>t!==e),this.fastUpdate=!0,this.props.socket.setObject(a._id,a).catch(e=>window.alert(`Cannot update enum: ${e}`))}),l(this,`moveMember`,async(e,t,n,r)=>{let i=this.state.enums||{};if(i[n]){this.fastUpdate=!0;try{var a,o;if(!r&&(a=i[t])!=null&&(a=a.common)!=null&&(a=a.members)!=null&&a.includes(e)){let n=JSON.parse(JSON.stringify(i[t]));n.common.members=(n.common.members||[]).filter(t=>t!==e),await this.props.socket.setObject(n._id,n)}if(!((o=i[n].common)!=null&&(o=o.members)!=null&&o.includes(e))){let t=JSON.parse(JSON.stringify(i[n]));t.common.members||=[],t.common.members.push(e),t.common.members.sort(),await this.props.socket.setObject(t._id,t)}}catch(e){window.alert(`Cannot move member: ${sr(e)}`)}}}),l(this,`moveEnum`,async(e,t)=>{let n=e.split(`.`).slice(0,-1).join(`.`);if(t===e||t.startsWith(`${e}.`)||n===t)return;let r=this.state.enums||{},i=`${t}${e.substring(n.length)}`;if(r[i]){window.alert(this.props.t(`Entry "%s" already exists`,i));return}let a=Object.keys(r).filter(t=>t===e||t.startsWith(`${e}.`)).sort((e,t)=>e.length-t.length);await this.addUpdating(a),this.selectAfterUpdate=i;try{for(let e of a){let i=`${t}${e.substring(n.length)}`,a=JSON.parse(JSON.stringify(r[e]));a._id=i,await this.props.socket.setObject(i,a),await this.props.socket.delObject(e)}}catch(e){window.alert(`Cannot move enum: ${sr(e)}`)}}),l(this,`showEnumEditDialog`,(e,t)=>{let n={changed:!1};n.newItem=JSON.parse(JSON.stringify(e)),n.originalItem=JSON.parse(JSON.stringify(e)),n.isNew=t,this.setState({enumEditDialog:n})}),l(this,`showEnumDeleteDialog`,e=>this.setState({enumDeleteDialog:e})),l(this,`saveEnum`,async()=>{var e,t,n;let r=(e=this.state.enumEditDialog)==null?void 0:e.newItem,i=(t=this.state.enumEditDialog)==null||(t=t.originalItem)==null?void 0:t._id;if(!r||!i)return;let a=this.state.enums||{};if(((n=this.state.enumEditDialog)!=null&&n.isNew||i!==r._id)&&(this.selectAfterUpdate=r._id),await this.addUpdating([i]),await this.props.socket.setObject(r._id,r),i!==r._id)try{await this.props.socket.delObject(i);for(let e of Object.keys(a))if(e.startsWith(`${i}.`)){let t=JSON.parse(JSON.stringify(a[e]));t._id=t._id.replace(`${i}.`,`${r._id}.`),await this.props.socket.setObject(t._id,t),await this.props.socket.delObject(e)}}catch(e){window.alert(`Cannot save enum: ${sr(e)}`)}this.setState({enumEditDialog:null})}),l(this,`deleteEnum`,async e=>{let t=this.state.enums||{},n=Object.keys(t).filter(t=>t===e||t.startsWith(`${e}.`));await this.addUpdating(n);try{for(let e of n)await this.props.socket.delObject(e)}catch(e){window.alert(`Cannot delete enum: ${sr(e)}`)}this.setState({enumDeleteDialog:null})}),l(this,`copyEnum`,e=>{var t,n;let r=JSON.parse(JSON.stringify((t=this.state.enums)==null?void 0:t[e])),i,a=1;do i=e+a.toString(),a++;while((n=this.state.enums)!=null&&n[i]);r._id=i,this.selectAfterUpdate=i,this.props.socket.setObject(i,r).catch(e=>window.alert(`Cannot copy enum: ${e}`))}),l(this,`toggleEnum`,e=>{let t={...this.state.enumsClosed,[e]:!this.state.enumsClosed[e]};this.setState({enumsClosed:t}),$().setItem(`enumsClosed`,JSON.stringify(t))}),l(this,`toggleAllEnums`,e=>{let t={};e&&Object.keys(this.state.enums||{}).forEach(e=>t[e]=!0),this.setState({enumsClosed:t}),$().setItem(`enumsClosed`,JSON.stringify(t))}),l(this,`toggleObjects`,()=>{let e=!this.state.showObjects;this.setState({showObjects:e}),$().setItem(`enumsShowObjects`,e?`true`:`false`)}),l(this,`changeEnumFormData`,e=>{var t;let n=JSON.parse(JSON.stringify(this.state.enumEditDialog));n.newItem=JSON.parse(JSON.stringify(e)),n.changed=JSON.stringify(n.newItem)!==JSON.stringify(((t=this.state.enums)==null?void 0:t[n.originalItem])||{}),this.setState({enumEditDialog:n})}),l(this,`getName`,e=>ut.getText(e,this.props.lang)),l(this,`setView`,e=>{this.setState({view:e}),$().setItem(`enumsView`,e)}),l(this,`openEnum`,e=>{this.setView(`categories`),this.selectEnum(e)}),l(this,`changeMembers`,e=>{let t=this.memberChangesQueue.then(()=>this.applyMemberChanges(e));return this.memberChangesQueue=t.catch(()=>void 0),t}),l(this,`createEnums`,async e=>{this.fastUpdate=!0;for(let n of[...e].sort((e,t)=>e._id.length-t._id.length)){var t;if(!((t=this.state.enums)!=null&&t[n._id]))try{await this.props.socket.setObject(n._id,n)}catch(e){window.alert(`Cannot create enum: ${sr(e)}`)}}}),this.state={enums:null,enumsTree:null,currentCategory:$().getItem(`enumCurrentCategory`)||``,filter:``,enumEditDialog:null,enumTemplateDialog:null,enumDeleteDialog:null,members:{},parents:{},categoryPopoverOpen:!1,enumsClosed:ar(`enumsClosed`,{},or),updating:[],narrow:window.innerWidth<er,splitSizes:ar(`enumsSplitSizes2`,[70,30],e=>Array.isArray(e)&&e.length===2),showObjects:$().getItem(`enumsShowObjects`)!==`false`,addObjectsDialog:null,addFolderDialog:null,selected:ar(`enumsSelected`,{},or),showDetails:!1,view:$().getItem(`enumsView`)===`assignment`?`assignment`:`categories`,wizardOpen:!1}}async componentDidMount(){window.addEventListener(`resize`,this.onResize),await this.updateData(),await this.props.socket.subscribeObject(`enum.*`,this.onObjectChange)}componentWillUnmount(){window.removeEventListener(`resize`,this.onResize),this.props.socket.unsubscribeObject(`enum.*`,this.onObjectChange),this.updateTimeout&&=(clearTimeout(this.updateTimeout),null)}addUpdating(e){let t=[...this.state.updating,...e.filter(e=>!this.state.updating.includes(e))];return new Promise(e=>this.setState({updating:t},()=>e()))}async readObjects(e){let t={};for(let n=0;n<e.length;n+=tr){let r=e.slice(n,n+tr),i;try{i=await this.props.socket.getObjectsById(r)}catch(e){console.warn(`Cannot read the objects at once, read them one by one:`,e)}for(let e of r){let n=i?i[e]:void 0;if(!i)try{n=await this.props.socket.getObject(e)}catch(t){console.error(`Cannot read the object "${e}":`,t)}n&&(t[e]=n)}}return t}buildTree(e){var t;let n={data:null,children:{},id:``};for(let t of Object.keys(e)){let r=t.split(`.`),i=n;for(let e=0;e<r.length;e++)i.children[r[e]]||={data:null,children:{},id:r.slice(0,e+1).join(`.`)},i=i.children[r[e]];i.data=e[t]}let r=((t=n.children.enum)==null?void 0:t.children)||{},i=r[this.state.currentCategory]?this.state.currentCategory:Object.keys(r)[0]||``;this.setCurrentCategory(i,()=>this.setState({enumsTree:n},()=>{!Object.keys(e).some(e=>e.startsWith(`enum.rooms.`))&&!$().getItem(`enumsWizardOffered`)&&($().setItem(`enumsWizardOffered`,`true`),this.setState({wizardOpen:!0}))}))}findTreeItem(e){let t=this.state.enumsTree;for(let n of e.split(`.`))t=(t==null?void 0:t.children[n])||null;return t}findFirstEnum(e){for(let t of Yt(Object.values(e.children),this.getName)){if(t.data)return t.id;let e=this.findFirstEnum(t);if(e)return e}return null}getSelectedId(){var e,t;let n=this.state.selected[this.state.currentCategory];if(n&&(e=this.state.enums)!=null&&e[n])return n;if(this.state.narrow)return null;let r=(t=this.state.enumsTree)==null||(t=t.children.enum)==null?void 0:t.children[this.state.currentCategory];return r?this.findFirstEnum(r):null}getEnumName(e){var t;return this.getName((t=this.state.enums)==null||(t=t[e])==null||(t=t.common)==null?void 0:t.name)||e.split(`.`).pop()||e}static _isUniqueName(e,t,n,r){return!t.find(t=>t._id===`${e}.${n.toLowerCase()}_${r}`)}static findNewUniqueName(t,n,r){let i=1;for(;!e._isUniqueName(t,n,r,i);)i++;return{_id:`${t}.${r.toLowerCase()}_${i}`,name:`${r} ${i}`}}renderEditDialog(){return this.state.enumEditDialog?T(Vt,{onClose:()=>this.setState({enumEditDialog:null}),enums:Object.values(this.state.enums||{}),enum:this.state.enumEditDialog.newItem,getName:this.getName,isNew:!!this.state.enumEditDialog.isNew,t:this.props.t,lang:this.props.lang,changed:this.state.enumEditDialog.changed,onChange:this.changeEnumFormData,saveData:this.saveEnum,innerWidth:window.innerWidth}):null}renderDeleteDialog(){return this.state.enumDeleteDialog?T(Wt,{onClose:()=>this.setState({enumDeleteDialog:null}),enum:this.state.enumDeleteDialog,getName:this.getName,t:this.props.t,deleteEnum:this.deleteEnum}):null}renderTemplateDialog(){return this.state.enumTemplateDialog?T(Ut,{prefix:this.state.enumTemplateDialog,onClose:()=>this.setState({enumTemplateDialog:null}),t:this.props.t,lang:this.props.lang,createEnumTemplate:this.createEnumTemplate,showEnumEditDialog:this.showEnumEditDialog,enums:this.state.enums||{},getEnumTemplate:this.getEnumTemplate}):null}renderAddObjectsDialog(){let e=this.state.addObjectsDialog;return e?T(he,{dialogName:`enumsAddObjects`,title:this.props.t(`Add objects to "%s"`,this.getEnumName(e)),ok:this.props.t(`Add objects`),multiSelect:!0,types:[`state`,`channel`,`device`],columns:[`name`,`type`,`role`,`room`,`func`],socket:this.props.socket,lang:this.props.lang,theme:this.props.theme,themeName:this.props.theme.name,themeType:this.props.themeType,onClose:()=>this.setState({addObjectsDialog:null}),onOk:t=>{let n=Array.isArray(t)?t:t?[t]:[];this.addItemsToEnum(n,e)}}):null}renderAddFolderDialog(){let e=this.state.addFolderDialog;return e?T(Ie,{title:this.props.t(`Add objects`),text:this.props.t(`Add %s objects from "%s" to "%s"?`,e.ids.length.toString(),e.folderId,this.getEnumName(e.enumId)),ok:this.props.t(`Add objects`),onClose:t=>this.setState({addFolderDialog:null},()=>t&&this.addItemsToEnum(e.ids,e.enumId))}):null}async applyMemberChanges(e){let t=Object.keys(e).filter(e=>{var t;return(t=this.state.enums)==null?void 0:t[e]});if(!t.length)return;await this.addUpdating(t);let n={};for(let a of t)try{var r,i;let t=await this.props.socket.getObject(a)||((r=this.state.enums)==null?void 0:r[a]);if(!t)continue;let o=((i=t.common)==null?void 0:i.members)||[],s=e[a].remove||[],c=o.filter(e=>!s.includes(e));for(let t of e[a].add||[])c.includes(t)||c.push(t);if(JSON.stringify(c)===JSON.stringify(o))continue;let l=JSON.parse(JSON.stringify(t));l.common.members=c,this.fastUpdate=!0,await this.props.socket.setObject(l._id,l),n[l._id]=l}catch(e){window.alert(`Cannot update enum: ${sr(e)}`)}Object.keys(n).length?await this.updateData({...this.state.enums||{},...n}):this.setState({updating:[]})}renderWizard(){return!this.state.wizardOpen||!this.state.enums?null:T($n,{socket:this.props.socket,enums:this.state.enums,t:this.props.t,theme:this.props.theme,getName:this.getName,fullScreen:this.state.narrow,onCreateEnums:this.createEnums,onChangeMembers:this.changeMembers,onClose:()=>this.setState({wizardOpen:!1})})}renderViewToggle(){let{t:e}=this.props;return E(be,{size:`small`,exclusive:!0,sx:Q.viewToggle,value:this.state.view,onChange:(e,t)=>t&&this.setView(t),children:[E(_e,{value:`categories`,title:e(`Categories`),children:[T(Ye,{fontSize:`small`}),this.state.narrow?null:e(`Categories`)]}),E(_e,{value:`assignment`,title:e(`Assignment`),children:[T(Xe,{fontSize:`small`}),this.state.narrow?null:e(`Assignment`)]})]})}renderTopBar(e){let{t:n}=this.props;return E(D,{sx:Q.topBar,children:[this.renderViewToggle(),T(R,{title:n(`Set up rooms and functions`),slotProps:{popper:{sx:{pointerEvents:`none`}}},children:T(k,{size:`small`,variant:`outlined`,sx:Q.wizardButton,startIcon:T(et,{}),onClick:()=>this.setState({wizardOpen:!0}),children:this.state.narrow?null:n(`Assistant`)})}),this.state.view===`categories`?E(h,{children:[T(R,{title:n(`Add enum`),slotProps:{popper:{sx:{pointerEvents:`none`}}},children:T(H,{id:`categoryPopoverButton`,size:`small`,onClick:()=>e.favorites?this.showEnumEditDialog(this.getEnumTemplate(`enum`),!0):this.setState({categoryPopoverOpen:!0}),children:T(U,{})})}),T(P,{open:this.state.categoryPopoverOpen,onClose:()=>this.setState({categoryPopoverOpen:!1}),anchorEl:()=>document.getElementById(`categoryPopoverButton`),anchorOrigin:{vertical:`bottom`,horizontal:`right`},children:E(M,{children:[e.favorites?null:T(Le,{onClick:()=>{this.setState({categoryPopoverOpen:!1}),this.createEnumTemplate(`enum`,rr.favorites)},children:n(`Favorites`)}),T(Le,{onClick:()=>{this.setState({categoryPopoverOpen:!1}),this.showEnumEditDialog(this.getEnumTemplate(`enum`),!0)},children:n(`Custom enum`)})]})}),Object.keys(e).length?T(me,{value:e[this.state.currentCategory]?this.state.currentCategory:!1,variant:`scrollable`,scrollButtons:`auto`,sx:Q.tabs,onChange:(e,t)=>this.setCurrentCategory(t,()=>this.setState({showDetails:!1})),children:Object.keys(e).map(n=>{var r;let i=e[n],a=i.data||{_id:i.id,common:{name:i.id.split(`.`).pop()||``},type:`enum`,native:{}};return T(t,{component:`span`,style:{backgroundColor:((r=a.common)==null?void 0:r.color)||void 0,borderRadius:4},label:T(It,{categoryData:a,showEnumEditDialog:this.showEnumEditDialog,showEnumDeleteDialog:this.showEnumDeleteDialog,styles:Q,...this.props}),value:n},n)})}):null]}):null,T(D,{sx:{flexGrow:1}}),this.state.narrow||this.state.view!==`categories`||!this.state.showObjects?null:T(R,{title:n(`Hide object list`),slotProps:{popper:{sx:{pointerEvents:`none`}}},children:T(H,{color:`primary`,onClick:this.toggleObjects,children:T(tt,{})})})]})}renderListPane(e,t){let{t:r}=this.props,i=e?Object.values(e.children):[],a=Object.values(this.state.enums||{}).some(e=>e._id.startsWith(`enum.${this.state.currentCategory}.`)&&e._id.split(`.`).length>3),o=Object.values(this.state.enumsClosed).some(e=>e);return E(D,{sx:p.getStyle(this.props.theme,Q.listPane,this.state.narrow&&Q.listPaneNarrow),children:[E(D,{sx:Q.listToolbar,children:[T(Ve,{variant:`standard`,placeholder:r(`Filter`),sx:Q.filter,value:this.state.filter,onChange:e=>this.setState({filter:e.target.value}),slotProps:{input:{endAdornment:this.state.filter?T(H,{tabIndex:-1,size:`small`,onClick:()=>this.setState({filter:``}),children:T(n,{})}):null}}}),a?T(R,{title:r(o?`Expand all`:`Collapse all`),slotProps:{popper:{sx:{pointerEvents:`none`}}},children:T(H,{size:`small`,onClick:()=>this.toggleAllEnums(!o),children:T(o?lt:ct,{})})}):null,T(R,{title:r(`Add group`),slotProps:{popper:{sx:{pointerEvents:`none`}}},children:T(`span`,{children:T(H,{size:`small`,disabled:!this.state.currentCategory,onClick:()=>this.addEnum(`enum.${this.state.currentCategory}`),children:T(U,{})})})})]}),T(D,{sx:Q.listScroll,children:T($t,{items:i,selectedId:t,onSelect:this.selectEnum,closed:this.state.enumsClosed,onToggle:this.toggleEnum,search:this.state.filter.trim().toLowerCase(),updating:this.state.updating,getName:this.getName,moveEnum:this.moveEnum,t:r,theme:this.props.theme})})]})}renderDetailsPane(e){var t;let n=e?(t=this.state.enums)==null?void 0:t[e]:void 0;if(!e||!n)return T(D,{sx:Q.detailsEmpty,children:this.props.t(`Select an entry on the left`)});let r=this.findTreeItem(e);return T(mn,{enumItem:n,enums:this.state.enums||{},subEntries:r?Object.values(r.children):[],members:this.state.members,parents:this.state.parents,socket:this.props.socket,t:this.props.t,theme:this.props.theme,getName:this.getName,updating:this.state.updating.includes(e),onBack:this.state.narrow?()=>this.setState({showDetails:!1}):void 0,onSelect:this.selectEnum,onEdit:()=>this.showEnumEditDialog(n,!1),onClone:()=>this.copyEnum(e),onDelete:()=>this.showEnumDeleteDialog(n),onAddChild:()=>this.addEnum(e),onAddObjects:()=>this.setState({addObjectsDialog:e}),onRemoveMember:t=>this.removeMemberFromEnum(t,e),onMoveMember:(t,n,r)=>void this.moveMember(t,e,n,r)})}renderRail(){return E(D,{sx:Q.rail,title:this.props.t(`Show object list`),onClick:this.toggleObjects,children:[T(tt,{}),T(`span`,{style:Q.railText,children:this.props.t(`Object list`)})]})}render(){var e;let t=this.state.enumsTree;if(!t)return T(ue,{});let n=((e=t.children.enum)==null?void 0:e.children)||{},r=this.getSelectedId(),i;return i=this.state.narrow?this.state.showDetails&&r?this.renderDetailsPane(r):this.renderListPane(n[this.state.currentCategory],r):E(D,{sx:Q.main,children:[this.renderListPane(n[this.state.currentCategory],r),this.renderDetailsPane(r)]}),E(h,{children:[E(gt,{backend:ut.isTouchDevice()?pt:mt,children:[T(nr,{}),E(D,{sx:Q.root,children:[this.renderTopBar(n),T(D,{sx:Q.body,children:this.state.view===`assignment`?T(Rn,{socket:this.props.socket,enums:this.state.enums||{},t:this.props.t,theme:this.props.theme,getName:this.getName,onChangeMembers:this.changeMembers,onOpenEnum:this.openEnum}):!this.state.narrow&&this.state.showObjects?T(D,{sx:Q.split,children:E(Ft,{direction:G.Horizontal,initialSizes:this.state.splitSizes,minWidths:[600,320],onResizeFinished:(e,t)=>{let n=[t[0],t[1]];this.setState({splitSizes:n}),$().setItem(`enumsSplitSizes2`,JSON.stringify(n))},gutterClassName:this.props.themeType===`dark`?`Dark visGutter`:`Light visGutter`,children:[i,T(D,{sx:Q.objectsPane,children:T(qt,{addItemToEnum:this.addItemToEnum,addFolderToEnum:this.addFolderToEnum,getName:this.getName,stylesParent:Q,t:this.props.t,socket:this.props.socket,lang:this.props.lang,theme:this.props.theme})})]})}):E(h,{children:[i,this.state.narrow?null:this.renderRail()]})})]})]}),this.renderEditDialog(),this.renderDeleteDialog(),this.renderTemplateDialog(),this.renderAddObjectsDialog(),this.renderAddFolderDialog(),this.renderWizard()]})}};function lr(e){return T(x,{children:T(Je,{style:{display:`flex`,flexDirection:`column`,overflow:`auto`},children:T(cr,{socket:e.socket,t:e.t,lang:e.lang,themeType:e.themeType,theme:e.theme})})})}export{lr as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{Os as e,Us as t}from"./loadShare-eager-BpwDZfDr.js";var n=e(t(`path`,{d:`M20.5 11H19V7c0-1.1-.9-2-2-2h-4V3.5C13 2.12 11.88 1 10.5 1S8 2.12 8 3.5V5H4c-1.1 0-1.99.9-1.99 2v3.8H3.5c1.49 0 2.7 1.21 2.7 2.7s-1.21 2.7-2.7 2.7H2V20c0 1.1.9 2 2 2h3.8v-1.5c0-1.49 1.21-2.7 2.7-2.7s2.7 1.21 2.7 2.7V22H17c1.1 0 2-.9 2-2v-4h1.5c1.38 0 2.5-1.12 2.5-2.5S21.88 11 20.5 11`}),`Extension`);export{n as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{Jo as e,Mr as t,Us as n,Vo as r,Ws as i,Zs as a,pc as o,qa as s,qo as c,uo as l}from"./loadShare-eager-BpwDZfDr.js";import{V as u}from"./bootstrap-DSDOwKWU.js";a(void 0);var d=(e,t)=>({x:e.x-t.x,y:e.y-t.y}),f=(e,t)=>({x:e.x+t.x,y:e.y+t.y}),p=e=>{let t=e.getInitialClientOffset(),n=e.getInitialSourceClientOffset();return t===null||n===null?{x:0,y:0}:d(t,n)},m=(e,t)=>{switch(e){case`left`:case`top-start`:case`bottom-start`:return 0;case`right`:case`top-end`:case`bottom-end`:return t.width;default:return t.width/2}},h=(e,t)=>{switch(e){case`top`:case`top-start`:case`top-end`:return 0;case`bottom`:case`bottom-start`:case`bottom-end`:return t.height;default:return t.height/2}},g=(e,t,n=`center`,r={x:0,y:0})=>{let i=e.getClientOffset();if(i===null)return null;if(!t.current||!t.current.getBoundingClientRect)return d(i,p(e));let a=t.current.getBoundingClientRect();return f(d(i,{x:m(n,a),y:h(n,a)}),r)},_=e=>{let t=`translate(${e.x.toFixed(1)}px, ${e.y.toFixed(1)}px)`;return{pointerEvents:`none`,position:`fixed`,top:0,left:0,transform:t,WebkitTransform:t}},v=e=>{let t=o(null),n=u(n=>({currentOffset:g(n,t,e==null?void 0:e.placement,e==null?void 0:e.padding),isDragging:n.isDragging(),itemType:n.getItemType(),item:n.getItem(),monitor:n}));return!n.isDragging||n.currentOffset===null?{display:!1}:{display:!0,itemType:n.itemType,item:n.item,style:_(n.currentOffset),monitor:n.monitor,ref:t}};function y(t){let a=t.icon;return i(`div`,{style:t.styles.formContainer,children:[a?n(a,{style:t.styles.formIcon}):null,n(r,{style:t.styles.formControl,variant:`standard`,children:n(l,{variant:`standard`,label:t.t(t.label),autoComplete:t.autoComplete,error:!!t.error,helperText:t.error||``,value:t.value,onChange:e=>{var n;return(n=t.onChange)==null?void 0:n.call(t,e.target.value)},disabled:t.disabled,type:t.type,slotProps:{inputLabel:{shrink:!0},input:{readOnly:!1,endAdornment:t.value?n(e,{position:`end`,children:n(c,{tabIndex:-1,size:`small`,onClick:()=>{var e;return(e=t.onChange)==null?void 0:e.call(t,``)},children:n(s,{})})}):null}}})})]})}function b(e){let r=e.icon;return i(`div`,{style:{width:`100%`},children:[r?n(r,{style:e.previewStyle||e.styles.formIcon}):null,n(t,{style:{...e.style||void 0,width:r?`calc(100% - 45px)`:`100%`,display:`inline-block`,verticalAlign:`top`},label:e.t(e.label),onChange:e.onChange,value:e.value||``})]})}export{y as n,v as r,b as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,t}from"./rolldown-runtime-sJBDdmOt.js";import{Eo as n,Es as r,Hs as i,Pr as a,Qa as o,Rr as s,Tr as c,Ts as l,Us as u,Zo as d,c as f,jr as p,pc as m,sc as h,tc as g,ur as _,vr as v,zr as y}from"./loadShare-eager-CRNcc8D7.js";import{t as b}from"./AdminUtils-DDT_kD8H.js";import{M as x}from"./bootstrap-D-7xcwTc.js";import{t as S}from"./CustomModal-B8vdCRn1.js";var C=t((e=>{e.byteLength=c,e.toByteArray=u,e.fromByteArray=p;for(var t=[],n=[],r=typeof Uint8Array<`u`?Uint8Array:Array,i=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,a=0,o=i.length;a<o;++a)t[a]=i[a],n[i.charCodeAt(a)]=a;n[45]=62,n[95]=63;function s(e){var t=e.length;if(t%4>0)throw Error(`Invalid string. Length must be a multiple of 4`);var n=e.indexOf(`=`);n===-1&&(n=t);var r=n===t?0:4-n%4;return[n,r]}function c(e){var t=s(e),n=t[0],r=t[1];return(n+r)*3/4-r}function l(e,t,n){return(t+n)*3/4-n}function u(e){for(var t,i=s(e),a=i[0],o=i[1],c=new r(l(e,a,o)),u=0,d=o>0?a-4:a,f=0;f<d;f+=4)t=n[e.charCodeAt(f)]<<18|n[e.charCodeAt(f+1)]<<12|n[e.charCodeAt(f+2)]<<6|n[e.charCodeAt(f+3)],c[u++]=t>>16&255,c[u++]=t>>8&255,c[u++]=t&255;return o===2&&(t=n[e.charCodeAt(f)]<<2|n[e.charCodeAt(f+1)]>>4,c[u++]=t&255),o===1&&(t=n[e.charCodeAt(f)]<<10|n[e.charCodeAt(f+1)]<<4|n[e.charCodeAt(f+2)]>>2,c[u++]=t>>8&255,c[u++]=t&255),c}function d(e){return t[e>>18&63]+t[e>>12&63]+t[e>>6&63]+t[e&63]}function f(e,t,n){for(var r,i=[],a=t;a<n;a+=3)r=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(e[a+2]&255),i.push(d(r));return i.join(``)}function p(e){for(var n,r=e.length,i=r%3,a=[],o=16383,s=0,c=r-i;s<c;s+=o)a.push(f(e,s,s+o>c?c:s+o));return i===1?(n=e[r-1],a.push(t[n>>2]+t[n<<4&63]+`==`)):i===2&&(n=(e[r-2]<<8)+e[r-1],a.push(t[n>>10]+t[n>>4&63]+t[n<<2&63]+`=`)),a.join(``)}})),w=t((e=>{e.read=function(e,t,n,r,i){var a,o,s=i*8-r-1,c=(1<<s)-1,l=c>>1,u=-7,d=n?i-1:0,f=n?-1:1,p=e[t+d];for(d+=f,a=p&(1<<-u)-1,p>>=-u,u+=s;u>0;a=a*256+e[t+d],d+=f,u-=8);for(o=a&(1<<-u)-1,a>>=-u,u+=r;u>0;o=o*256+e[t+d],d+=f,u-=8);if(a===0)a=1-l;else if(a===c)return o?NaN:(p?-1:1)*(1/0);else o+=2**r,a-=l;return(p?-1:1)*o*2**(a-r)},e.write=function(e,t,n,r,i,a){var o,s,c,l=a*8-i-1,u=(1<<l)-1,d=u>>1,f=i===23?2**-24-2**-77:0,p=r?0:a-1,m=r?1:-1,h=+(t<0||t===0&&1/t<0);for(t=Math.abs(t),isNaN(t)||t===1/0?(s=+!!isNaN(t),o=u):(o=Math.floor(Math.log(t)/Math.LN2),t*(c=2**-o)<1&&(o--,c*=2),o+d>=1?t+=f/c:t+=f*2**(1-d),t*c>=2&&(o++,c/=2),o+d>=u?(s=0,o=u):o+d>=1?(s=(t*c-1)*2**i,o+=d):(s=t*2**(d-1)*2**i,o=0));i>=8;e[n+p]=s&255,p+=m,s/=256,i-=8);for(o=o<<i|s,l+=i;l>0;e[n+p]=o&255,p+=m,o/=256,l-=8);e[n+p-m]|=h*128}})),T=t((e=>{var t=C(),n=w(),r=typeof Symbol==`function`&&typeof Symbol.for==`function`?Symbol.for(`nodejs.util.inspect.custom`):null;e.Buffer=s,e.SlowBuffer=v,e.INSPECT_MAX_BYTES=50;var i=2147483647;e.kMaxLength=i,s.TYPED_ARRAY_SUPPORT=a(),!s.TYPED_ARRAY_SUPPORT&&typeof console<`u`&&typeof console.error==`function`&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function a(){try{let e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),e.foo()===42}catch{return!1}}Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}});function o(e){if(e>i)throw RangeError(`The value "`+e+`" is invalid for option "size"`);let t=new Uint8Array(e);return Object.setPrototypeOf(t,s.prototype),t}function s(e,t,n){if(typeof e==`number`){if(typeof t==`string`)throw TypeError(`The "string" argument must be of type string. Received type number`);return d(e)}return c(e,t,n)}s.poolSize=8192;function c(e,t,n){if(typeof e==`string`)return f(e,t);if(ArrayBuffer.isView(e))return m(e);if(e==null)throw TypeError(`The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type `+typeof e);if(Q(e,ArrayBuffer)||e&&Q(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<`u`&&(Q(e,SharedArrayBuffer)||e&&Q(e.buffer,SharedArrayBuffer)))return h(e,t,n);if(typeof e==`number`)throw TypeError(`The "value" argument must not be of type number. Received type number`);let r=e.valueOf&&e.valueOf();if(r!=null&&r!==e)return s.from(r,t,n);let i=g(e);if(i)return i;if(typeof Symbol<`u`&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]==`function`)return s.from(e[Symbol.toPrimitive](`string`),t,n);throw TypeError(`The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type `+typeof e)}s.from=function(e,t,n){return c(e,t,n)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array);function l(e){if(typeof e!=`number`)throw TypeError(`"size" argument must be of type number`);if(e<0)throw RangeError(`The value "`+e+`" is invalid for option "size"`)}function u(e,t,n){return l(e),e<=0||t===void 0?o(e):typeof n==`string`?o(e).fill(t,n):o(e).fill(t)}s.alloc=function(e,t,n){return u(e,t,n)};function d(e){return l(e),o(e<0?0:_(e)|0)}s.allocUnsafe=function(e){return d(e)},s.allocUnsafeSlow=function(e){return d(e)};function f(e,t){if((typeof t!=`string`||t===``)&&(t=`utf8`),!s.isEncoding(t))throw TypeError(`Unknown encoding: `+t);let n=y(e,t)|0,r=o(n),i=r.write(e,t);return i!==n&&(r=r.slice(0,i)),r}function p(e){let t=e.length<0?0:_(e.length)|0,n=o(t);for(let r=0;r<t;r+=1)n[r]=e[r]&255;return n}function m(e){if(Q(e,Uint8Array)){let t=new Uint8Array(e);return h(t.buffer,t.byteOffset,t.byteLength)}return p(e)}function h(e,t,n){if(t<0||e.byteLength<t)throw RangeError(`"offset" is outside of buffer bounds`);if(e.byteLength<t+(n||0))throw RangeError(`"length" is outside of buffer bounds`);let r;return r=t===void 0&&n===void 0?new Uint8Array(e):n===void 0?new Uint8Array(e,t):new Uint8Array(e,t,n),Object.setPrototypeOf(r,s.prototype),r}function g(e){if(s.isBuffer(e)){let t=_(e.length)|0,n=o(t);return n.length===0||e.copy(n,0,0,t),n}if(e.length!==void 0)return typeof e.length!=`number`||ce(e.length)?o(0):p(e);if(e.type===`Buffer`&&Array.isArray(e.data))return p(e.data)}function _(e){if(e>=i)throw RangeError(`Attempt to allocate Buffer larger than maximum size: 0x`+i.toString(16)+` bytes`);return e|0}function v(e){return+e!=e&&(e=0),s.alloc(+e)}s.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==s.prototype},s.compare=function(e,t){if(Q(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),Q(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(e)||!s.isBuffer(t))throw TypeError(`The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array`);if(e===t)return 0;let n=e.length,r=t.length;for(let i=0,a=Math.min(n,r);i<a;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:+(r<n)},s.isEncoding=function(e){switch(String(e).toLowerCase()){case`hex`:case`utf8`:case`utf-8`:case`ascii`:case`latin1`:case`binary`:case`base64`:case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return!0;default:return!1}},s.concat=function(e,t){if(!Array.isArray(e))throw TypeError(`"list" argument must be an Array of Buffers`);if(e.length===0)return s.alloc(0);let n;if(t===void 0)for(t=0,n=0;n<e.length;++n)t+=e[n].length;let r=s.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){let t=e[n];if(Q(t,Uint8Array))i+t.length>r.length?(s.isBuffer(t)||(t=s.from(t)),t.copy(r,i)):Uint8Array.prototype.set.call(r,t,i);else if(s.isBuffer(t))t.copy(r,i);else throw TypeError(`"list" argument must be an Array of Buffers`);i+=t.length}return r};function y(e,t){if(s.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||Q(e,ArrayBuffer))return e.byteLength;if(typeof e!=`string`)throw TypeError(`The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type `+typeof e);let n=e.length,r=arguments.length>2&&arguments[2]===!0;if(!r&&n===0)return 0;let i=!1;for(;;)switch(t){case`ascii`:case`latin1`:case`binary`:return n;case`utf8`:case`utf-8`:return X(e).length;case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return n*2;case`hex`:return n>>>1;case`base64`:return se(e).length;default:if(i)return r?-1:X(e).length;t=(``+t).toLowerCase(),i=!0}}s.byteLength=y;function b(e,t,n){let r=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,t>>>=0,n<=t))return``;for(e||=`utf8`;;)switch(e){case`hex`:return F(this,t,n);case`utf8`:case`utf-8`:return M(this,t,n);case`ascii`:return te(this,t,n);case`latin1`:case`binary`:return P(this,t,n);case`base64`:return j(this,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return ne(this,t,n);default:if(r)throw TypeError(`Unknown encoding: `+e);e=(e+``).toLowerCase(),r=!0}}s.prototype._isBuffer=!0;function x(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}s.prototype.swap16=function(){let e=this.length;if(e%2!=0)throw RangeError(`Buffer size must be a multiple of 16-bits`);for(let t=0;t<e;t+=2)x(this,t,t+1);return this},s.prototype.swap32=function(){let e=this.length;if(e%4!=0)throw RangeError(`Buffer size must be a multiple of 32-bits`);for(let t=0;t<e;t+=4)x(this,t,t+3),x(this,t+1,t+2);return this},s.prototype.swap64=function(){let e=this.length;if(e%8!=0)throw RangeError(`Buffer size must be a multiple of 64-bits`);for(let t=0;t<e;t+=8)x(this,t,t+7),x(this,t+1,t+6),x(this,t+2,t+5),x(this,t+3,t+4);return this},s.prototype.toString=function(){let e=this.length;return e===0?``:arguments.length===0?M(this,0,e):b.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(e){if(!s.isBuffer(e))throw TypeError(`Argument must be a Buffer`);return this===e||s.compare(this,e)===0},s.prototype.inspect=function(){let t=``,n=e.INSPECT_MAX_BYTES;return t=this.toString(`hex`,0,n).replace(/(.{2})/g,`$1 `).trim(),this.length>n&&(t+=` ... `),`<Buffer `+t+`>`},r&&(s.prototype[r]=s.prototype.inspect),s.prototype.compare=function(e,t,n,r,i){if(Q(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),!s.isBuffer(e))throw TypeError(`The "target" argument must be one of type Buffer or Uint8Array. Received type `+typeof e);if(t===void 0&&(t=0),n===void 0&&(n=e?e.length:0),r===void 0&&(r=0),i===void 0&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw RangeError(`out of range index`);if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,i>>>=0,this===e)return 0;let a=i-r,o=n-t,c=Math.min(a,o),l=this.slice(r,i),u=e.slice(t,n);for(let e=0;e<c;++e)if(l[e]!==u[e]){a=l[e],o=u[e];break}return a<o?-1:+(o<a)};function S(e,t,n,r,i){if(e.length===0)return-1;if(typeof n==`string`?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,ce(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(i)n=0;else return-1}if(typeof t==`string`&&(t=s.from(t,r)),s.isBuffer(t))return t.length===0?-1:T(e,t,n,r,i);if(typeof t==`number`)return t&=255,typeof Uint8Array.prototype.indexOf==`function`?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):T(e,[t],n,r,i);throw TypeError(`val must be string, number or Buffer`)}function T(e,t,n,r,i){let a=1,o=e.length,s=t.length;if(r!==void 0&&(r=String(r).toLowerCase(),r===`ucs2`||r===`ucs-2`||r===`utf16le`||r===`utf-16le`)){if(e.length<2||t.length<2)return-1;a=2,o/=2,s/=2,n/=2}function c(e,t){return a===1?e[t]:e.readUInt16BE(t*a)}let l;if(i){let r=-1;for(l=n;l<o;l++)if(c(e,l)===c(t,r===-1?0:l-r)){if(r===-1&&(r=l),l-r+1===s)return r*a}else r!==-1&&(l-=l-r),r=-1}else for(n+s>o&&(n=o-s),l=n;l>=0;l--){let n=!0;for(let r=0;r<s;r++)if(c(e,l+r)!==c(t,r)){n=!1;break}if(n)return l}return-1}s.prototype.includes=function(e,t,n){return this.indexOf(e,t,n)!==-1},s.prototype.indexOf=function(e,t,n){return S(this,e,t,n,!0)},s.prototype.lastIndexOf=function(e,t,n){return S(this,e,t,n,!1)};function E(e,t,n,r){n=Number(n)||0;let i=e.length-n;r?(r=Number(r),r>i&&(r=i)):r=i;let a=t.length;r>a/2&&(r=a/2);let o=0;for(;o<r;++o){let r=parseInt(t.substr(o*2,2),16);if(ce(r))return o;e[n+o]=r}return o}function D(e,t,n,r){return Z(X(t,e.length-n),e,n,r)}function O(e,t,n,r){return Z(ae(t),e,n,r)}function k(e,t,n,r){return Z(se(t),e,n,r)}function A(e,t,n,r){return Z(oe(t,e.length-n),e,n,r)}s.prototype.write=function(e,t,n,r){if(t===void 0)r=`utf8`,n=this.length,t=0;else if(n===void 0&&typeof t==`string`)r=t,n=this.length,t=0;else if(isFinite(t))t>>>=0,isFinite(n)?(n>>>=0,r===void 0&&(r=`utf8`)):(r=n,n=void 0);else throw Error(`Buffer.write(string, encoding, offset[, length]) is no longer supported`);let i=this.length-t;if((n===void 0||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw RangeError(`Attempt to write outside buffer bounds`);r||=`utf8`;let a=!1;for(;;)switch(r){case`hex`:return E(this,e,t,n);case`utf8`:case`utf-8`:return D(this,e,t,n);case`ascii`:case`latin1`:case`binary`:return O(this,e,t,n);case`base64`:return k(this,e,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return A(this,e,t,n);default:if(a)throw TypeError(`Unknown encoding: `+r);r=(``+r).toLowerCase(),a=!0}},s.prototype.toJSON=function(){return{type:`Buffer`,data:Array.prototype.slice.call(this._arr||this,0)}};function j(e,n,r){return n===0&&r===e.length?t.fromByteArray(e):t.fromByteArray(e.slice(n,r))}function M(e,t,n){n=Math.min(e.length,n);let r=[],i=t;for(;i<n;){let t=e[i],a=null,o=t>239?4:t>223?3:t>191?2:1;if(i+o<=n){let n,r,s,c;switch(o){case 1:t<128&&(a=t);break;case 2:n=e[i+1],(n&192)==128&&(c=(t&31)<<6|n&63,c>127&&(a=c));break;case 3:n=e[i+1],r=e[i+2],(n&192)==128&&(r&192)==128&&(c=(t&15)<<12|(n&63)<<6|r&63,c>2047&&(c<55296||c>57343)&&(a=c));break;case 4:n=e[i+1],r=e[i+2],s=e[i+3],(n&192)==128&&(r&192)==128&&(s&192)==128&&(c=(t&15)<<18|(n&63)<<12|(r&63)<<6|s&63,c>65535&&c<1114112&&(a=c))}}a===null?(a=65533,o=1):a>65535&&(a-=65536,r.push(a>>>10&1023|55296),a=56320|a&1023),r.push(a),i+=o}return N(r)}var ee=4096;function N(e){let t=e.length;if(t<=ee)return String.fromCharCode.apply(String,e);let n=``,r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=ee));return n}function te(e,t,n){let r=``;n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]&127);return r}function P(e,t,n){let r=``;n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function F(e,t,n){let r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);let i=``;for(let r=t;r<n;++r)i+=le[e[r]];return i}function ne(e,t,n){let r=e.slice(t,n),i=``;for(let e=0;e<r.length-1;e+=2)i+=String.fromCharCode(r[e]+r[e+1]*256);return i}s.prototype.slice=function(e,t){let n=this.length;e=~~e,t=t===void 0?n:~~t,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t<e&&(t=e);let r=this.subarray(e,t);return Object.setPrototypeOf(r,s.prototype),r};function I(e,t,n){if(e%1!=0||e<0)throw RangeError(`offset is not uint`);if(e+t>n)throw RangeError(`Trying to access beyond buffer length`)}s.prototype.readUintLE=s.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||I(e,t,this.length);let r=this[e],i=1,a=0;for(;++a<t&&(i*=256);)r+=this[e+a]*i;return r},s.prototype.readUintBE=s.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||I(e,t,this.length);let r=this[e+--t],i=1;for(;t>0&&(i*=256);)r+=this[e+--t]*i;return r},s.prototype.readUint8=s.prototype.readUInt8=function(e,t){return e>>>=0,t||I(e,1,this.length),this[e]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(e,t){return e>>>=0,t||I(e,2,this.length),this[e]|this[e+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(e,t){return e>>>=0,t||I(e,2,this.length),this[e]<<8|this[e+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(e,t){return e>>>=0,t||I(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(e,t){return e>>>=0,t||I(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},s.prototype.readBigUInt64LE=$(function(e){e>>>=0,q(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&J(e,this.length-8);let r=t+this[++e]*256+this[++e]*2**16+this[++e]*2**24,i=this[++e]+this[++e]*256+this[++e]*2**16+n*2**24;return BigInt(r)+(BigInt(i)<<BigInt(32))}),s.prototype.readBigUInt64BE=$(function(e){e>>>=0,q(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&J(e,this.length-8);let r=t*2**24+this[++e]*2**16+this[++e]*256+this[++e],i=this[++e]*2**24+this[++e]*2**16+this[++e]*256+n;return(BigInt(r)<<BigInt(32))+BigInt(i)}),s.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||I(e,t,this.length);let r=this[e],i=1,a=0;for(;++a<t&&(i*=256);)r+=this[e+a]*i;return i*=128,r>=i&&(r-=2**(8*t)),r},s.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||I(e,t,this.length);let r=t,i=1,a=this[e+--r];for(;r>0&&(i*=256);)a+=this[e+--r]*i;return i*=128,a>=i&&(a-=2**(8*t)),a},s.prototype.readInt8=function(e,t){return e>>>=0,t||I(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]},s.prototype.readInt16LE=function(e,t){e>>>=0,t||I(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n},s.prototype.readInt16BE=function(e,t){e>>>=0,t||I(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n},s.prototype.readInt32LE=function(e,t){return e>>>=0,t||I(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},s.prototype.readInt32BE=function(e,t){return e>>>=0,t||I(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},s.prototype.readBigInt64LE=$(function(e){e>>>=0,q(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&J(e,this.length-8);let r=this[e+4]+this[e+5]*256+this[e+6]*2**16+(n<<24);return(BigInt(r)<<BigInt(32))+BigInt(t+this[++e]*256+this[++e]*2**16+this[++e]*2**24)}),s.prototype.readBigInt64BE=$(function(e){e>>>=0,q(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&J(e,this.length-8);let r=(t<<24)+this[++e]*2**16+this[++e]*256+this[++e];return(BigInt(r)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*256+n)}),s.prototype.readFloatLE=function(e,t){return e>>>=0,t||I(e,4,this.length),n.read(this,e,!0,23,4)},s.prototype.readFloatBE=function(e,t){return e>>>=0,t||I(e,4,this.length),n.read(this,e,!1,23,4)},s.prototype.readDoubleLE=function(e,t){return e>>>=0,t||I(e,8,this.length),n.read(this,e,!0,52,8)},s.prototype.readDoubleBE=function(e,t){return e>>>=0,t||I(e,8,this.length),n.read(this,e,!1,52,8)};function L(e,t,n,r,i,a){if(!s.isBuffer(e))throw TypeError(`"buffer" argument must be a Buffer instance`);if(t>i||t<a)throw RangeError(`"value" argument is out of bounds`);if(n+r>e.length)throw RangeError(`Index out of range`)}s.prototype.writeUintLE=s.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){let r=2**(8*n)-1;L(this,e,t,n,r,0)}let i=1,a=0;for(this[t]=e&255;++a<n&&(i*=256);)this[t+a]=e/i&255;return t+n},s.prototype.writeUintBE=s.prototype.writeUIntBE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){let r=2**(8*n)-1;L(this,e,t,n,r,0)}let i=n-1,a=1;for(this[t+i]=e&255;--i>=0&&(a*=256);)this[t+i]=e/a&255;return t+n},s.prototype.writeUint8=s.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,1,255,0),this[t]=e&255,t+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};function R(e,t,n,r,i){re(t,r,i,e,n,7);let a=Number(t&BigInt(4294967295));e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,n}function z(e,t,n,r,i){re(t,r,i,e,n,7);let a=Number(t&BigInt(4294967295));e[n+7]=a,a>>=8,e[n+6]=a,a>>=8,e[n+5]=a,a>>=8,e[n+4]=a;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=o,o>>=8,e[n+2]=o,o>>=8,e[n+1]=o,o>>=8,e[n]=o,n+8}s.prototype.writeBigUInt64LE=$(function(e,t=0){return R(this,e,t,BigInt(0),BigInt(`0xffffffffffffffff`))}),s.prototype.writeBigUInt64BE=$(function(e,t=0){return z(this,e,t,BigInt(0),BigInt(`0xffffffffffffffff`))}),s.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){let r=2**(8*n-1);L(this,e,t,n,r-1,-r)}let i=0,a=1,o=0;for(this[t]=e&255;++i<n&&(a*=256);)e<0&&o===0&&this[t+i-1]!==0&&(o=1),this[t+i]=(e/a|0)-o&255;return t+n},s.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){let r=2**(8*n-1);L(this,e,t,n,r-1,-r)}let i=n-1,a=1,o=0;for(this[t+i]=e&255;--i>=0&&(a*=256);)e<0&&o===0&&this[t+i+1]!==0&&(o=1),this[t+i]=(e/a|0)-o&255;return t+n},s.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1},s.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2},s.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2},s.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},s.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4},s.prototype.writeBigInt64LE=$(function(e,t=0){return R(this,e,t,-BigInt(`0x8000000000000000`),BigInt(`0x7fffffffffffffff`))}),s.prototype.writeBigInt64BE=$(function(e,t=0){return z(this,e,t,-BigInt(`0x8000000000000000`),BigInt(`0x7fffffffffffffff`))});function B(e,t,n,r,i,a){if(n+r>e.length||n<0)throw RangeError(`Index out of range`)}function V(e,t,r,i,a){return t=+t,r>>>=0,a||B(e,t,r,4,34028234663852886e22,-34028234663852886e22),n.write(e,t,r,i,23,4),r+4}s.prototype.writeFloatLE=function(e,t,n){return V(this,e,t,!0,n)},s.prototype.writeFloatBE=function(e,t,n){return V(this,e,t,!1,n)};function H(e,t,r,i,a){return t=+t,r>>>=0,a||B(e,t,r,8,17976931348623157e292,-17976931348623157e292),n.write(e,t,r,i,52,8),r+8}s.prototype.writeDoubleLE=function(e,t,n){return H(this,e,t,!0,n)},s.prototype.writeDoubleBE=function(e,t,n){return H(this,e,t,!1,n)},s.prototype.copy=function(e,t,n,r){if(!s.isBuffer(e))throw TypeError(`argument should be a Buffer`);if(n||=0,!r&&r!==0&&(r=this.length),t>=e.length&&(t=e.length),t||=0,r>0&&r<n&&(r=n),r===n||e.length===0||this.length===0)return 0;if(t<0)throw RangeError(`targetStart out of bounds`);if(n<0||n>=this.length)throw RangeError(`Index out of range`);if(r<0)throw RangeError(`sourceEnd out of bounds`);r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);let i=r-n;return this===e&&typeof Uint8Array.prototype.copyWithin==`function`?this.copyWithin(t,n,r):Uint8Array.prototype.set.call(e,this.subarray(n,r),t),i},s.prototype.fill=function(e,t,n,r){if(typeof e==`string`){if(typeof t==`string`?(r=t,t=0,n=this.length):typeof n==`string`&&(r=n,n=this.length),r!==void 0&&typeof r!=`string`)throw TypeError(`encoding must be a string`);if(typeof r==`string`&&!s.isEncoding(r))throw TypeError(`Unknown encoding: `+r);if(e.length===1){let t=e.charCodeAt(0);(r===`utf8`&&t<128||r===`latin1`)&&(e=t)}}else typeof e==`number`?e&=255:typeof e==`boolean`&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw RangeError(`Out of range index`);if(n<=t)return this;t>>>=0,n=n===void 0?this.length:n>>>0,e||=0;let i;if(typeof e==`number`)for(i=t;i<n;++i)this[i]=e;else{let a=s.isBuffer(e)?e:s.from(e,r),o=a.length;if(o===0)throw TypeError(`The value "`+e+`" is invalid for argument "value"`);for(i=0;i<n-t;++i)this[i+t]=a[i%o]}return this};var U={};function W(e,t,n){U[e]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}W(`ERR_BUFFER_OUT_OF_BOUNDS`,function(e){return e?`${e} is outside of buffer bounds`:`Attempt to access memory outside buffer bounds`},RangeError),W(`ERR_INVALID_ARG_TYPE`,function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),W(`ERR_OUT_OF_RANGE`,function(e,t,n){let r=`The value of "${e}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=G(String(n)):typeof n==`bigint`&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=G(i)),i+=`n`),r+=` It must be ${t}. Received ${i}`,r},RangeError);function G(e){let t=``,n=e.length,r=+(e[0]===`-`);for(;n>=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function K(e,t,n){q(t,`offset`),(e[t]===void 0||e[t+n]===void 0)&&J(t,e.length-(n+1))}function re(e,t,n,r,i,a){if(e>n||e<t){let r=typeof t==`bigint`?`n`:``,i;throw i=a>3?t===0||t===BigInt(0)?`>= 0${r} and < 2${r} ** ${(a+1)*8}${r}`:`>= -(2${r} ** ${(a+1)*8-1}${r}) and < 2 ** ${(a+1)*8-1}${r}`:`>= ${t}${r} and <= ${n}${r}`,new U.ERR_OUT_OF_RANGE(`value`,i,e)}K(r,i,a)}function q(e,t){if(typeof e!=`number`)throw new U.ERR_INVALID_ARG_TYPE(t,`number`,e)}function J(e,t,n){throw Math.floor(e)===e?t<0?new U.ERR_BUFFER_OUT_OF_BOUNDS:new U.ERR_OUT_OF_RANGE(n||`offset`,`>= ${+!!n} and <= ${t}`,e):(q(e,n),new U.ERR_OUT_OF_RANGE(n||`offset`,`an integer`,e))}var Y=/[^+/0-9A-Za-z-_]/g;function ie(e){if(e=e.split(`=`)[0],e=e.trim().replace(Y,``),e.length<2)return``;for(;e.length%4!=0;)e+=`=`;return e}function X(e,t){t||=1/0;let n,r=e.length,i=null,a=[];for(let o=0;o<r;++o){if(n=e.charCodeAt(o),n>55295&&n<57344){if(!i){if(n>56319||o+1===r){(t-=3)>-1&&a.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&a.push(239,191,189),i=n;continue}n=(i-55296<<10|n-56320)+65536}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,n<128){if(--t<0)break;a.push(n)}else if(n<2048){if((t-=2)<0)break;a.push(n>>6|192,n&63|128)}else if(n<65536){if((t-=3)<0)break;a.push(n>>12|224,n>>6&63|128,n&63|128)}else if(n<1114112){if((t-=4)<0)break;a.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else throw Error(`Invalid code point`)}return a}function ae(e){let t=[];for(let n=0;n<e.length;++n)t.push(e.charCodeAt(n)&255);return t}function oe(e,t){let n,r,i,a=[];for(let o=0;o<e.length&&!((t-=2)<0);++o)n=e.charCodeAt(o),r=n>>8,i=n%256,a.push(i),a.push(r);return a}function se(e){return t.toByteArray(ie(e))}function Z(e,t,n,r){let i=0;for(;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function Q(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function ce(e){return e!==e}var le=(function(){let e=`0123456789abcdef`,t=Array(256);for(let n=0;n<16;++n){let r=n*16;for(let i=0;i<16;++i)t[r+i]=e[n]+e[i]}return t})();function $(e){return typeof BigInt>`u`?ue:e}function ue(){throw Error(`BigInt not supported`)}})),E=t(((e,t)=>{ace.define(`ace/ext/modelist`,[`require`,`exports`,`module`],function(e,t,n){var r=[];function i(e){for(var t=c.text,n=e.split(/[\/\\]/).pop(),i=0;i<r.length;i++)if(r[i].supportsFile(n)){t=r[i];break}return t}var a=function(){function e(e,t,n){this.name=e,this.caption=t,this.mode=`ace/mode/`+e,this.extensions=n;var r=/\^/.test(n)?n.replace(/\|(\^)?/g,function(e,t){return`$|`+(t?`^`:`^.*\\.`)})+`$`:`\\.(`+n+`)$`;this.extRe=new RegExp(r,`gi`)}return e.prototype.supportsFile=function(e){return e.match(this.extRe)},e}(),o={ABAP:[`abap`],ABC:[`abc`],ActionScript:[`as`],ADA:[`ada|adb`],Alda:[`alda`],Apache_Conf:[`^htaccess|^htgroups|^htpasswd|^conf|htaccess|htgroups|htpasswd`],Apex:[`apex|cls|trigger|tgr`],AQL:[`aql`],AsciiDoc:[`asciidoc|adoc`],ASL:[`dsl|asl|asl.json`],Assembly_ARM32:[`s`],Assembly_x86:[`asm|a`],Astro:[`astro`],AutoHotKey:[`ahk`],Basic:[`bas|bak`],BatchFile:[`bat|cmd`],BibTeX:[`bib`],C_Cpp:[`cpp|c|cc|cxx|h|hh|hpp|ino`],C9Search:[`c9search_results`],Cedar:[`cedar`],CedarSchema:[`cedarschema`],Cirru:[`cirru|cr`],Clojure:[`clj|cljs`],Clue:[`clue`],Cobol:[`CBL|COB`],coffee:[`coffee|cf|cson|^Cakefile`],ColdFusion:[`cfm|cfc`],Crystal:[`cr`],CSharp:[`cs`],Csound_Document:[`csd`],Csound_Orchestra:[`orc`],Csound_Score:[`sco`],CSS:[`css`],CSV:[`csv`],Curly:[`curly`],Cuttlefish:[`conf`],D:[`d|di`],Dart:[`dart`],Diff:[`diff|patch`],Django:[`djt|html.djt|dj.html|djhtml`],Dockerfile:[`^Dockerfile`],Dot:[`dot`],Drools:[`drl`],Edifact:[`edi`],Eiffel:[`e|ge`],EJS:[`ejs`],Elixir:[`ex|exs`],Elm:[`elm`],Erlang:[`erl|hrl`],Flix:[`flix`],Forth:[`frt|fs|ldr|fth|4th`],Fortran:[`f|f90`],FSharp:[`fsi|fs|ml|mli|fsx|fsscript`],FSL:[`fsl`],FTL:[`ftl`],Gcode:[`gcode`],GDResource:[`tres|tscn`],GDScript:[`gd`],GDShader:[`gdshader|gdshaderinc`],Gherkin:[`feature`],Gitignore:[`^.gitignore`],Glsl:[`glsl|frag|vert`],Gobstones:[`gbs`],golang:[`go`],GraphQLSchema:[`gql`],GROQ:[`groq`],Groovy:[`groovy`],HAML:[`haml`],Handlebars:[`hbs|handlebars|tpl|mustache`],Haskell:[`hs`],Haskell_Cabal:[`cabal`],haXe:[`hx`],Hjson:[`hjson`],HTML:[`html|htm|xhtml|we|wpy`],HTML_Elixir:[`eex|html.eex`],HTML_Ruby:[`erb|rhtml|html.erb`],INI:[`ini|conf|cfg|prefs`],Io:[`io`],Ion:[`ion`],Jack:[`jack`],Jade:[`jade|pug`],Java:[`java`],JavaScript:[`js|jsm|cjs|mjs`],JEXL:[`jexl`],JSON:[`json`],JSON5:[`json5`],JSONiq:[`jq`],JSP:[`jsp`],JSSM:[`jssm|jssm_state`],JSX:[`jsx`],Julia:[`jl`],Kotlin:[`kt|kts`],LaTeX:[`tex|latex|ltx|bib`],Latte:[`latte`],LESS:[`less`],Liquid:[`liquid`],Lisp:[`lisp`],LiveScript:[`ls`],LogiQL:[`logic|lql`],Logtalk:[`lgt`],LSL:[`lsl`],Lua:[`lua`],LuaPage:[`lp`],Lucene:[`lucene`],Makefile:[`^Makefile|^GNUmakefile|^makefile|^OCamlMakefile|make`],Markdown:[`md|markdown`],Mask:[`mask`],MATLAB:[`matlab`],Maze:[`mz`],MediaWiki:[`wiki|mediawiki`],MEL:[`mel`],MIPS:[`s|asm`],MIXAL:[`mixal`],MUSHCode:[`mc|mush`],MySQL:[`mysql`],Mariadb:[`mariadb`],Nasal:[`nas`],Nginx:[`nginx|conf`],Nim:[`nim`],Nix:[`nix`],NSIS:[`nsi|nsh|nsdinc`],Nunjucks:[`nunjucks|nunjs|nj|njk`],ObjectiveC:[`m|mm`],OCaml:[`ml|mli`],Odin:[`odin`],PartiQL:[`partiql|pql`],Pascal:[`pas|p`],Perl:[`pl|pm`],pgSQL:[`pgsql`],PHP:[`php|inc|phtml|shtml|php3|php4|php5|phps|phpt|aw|ctp|module`],PHP_Laravel_blade:[`blade.php`],Pig:[`pig`],PLSQL:[`plsql`],Powershell:[`ps1`],Praat:[`praat|praatscript|psc|proc`],Prisma:[`prisma`],Prolog:[`plg|prolog`],Properties:[`properties`],Protobuf:[`proto`],PRQL:[`prql`],Puppet:[`epp|pp`],Python:[`py`],QML:[`qml`],R:[`r`],Raku:[`raku|rakumod|rakutest|p6|pl6|pm6`],Razor:[`cshtml|asp`],RDoc:[`Rd`],Red:[`red|reds`],RHTML:[`Rhtml`],Robot:[`robot|resource`],RST:[`rst`],Ruby:[`rb|ru|gemspec|rake|^Guardfile|^Rakefile|^Gemfile`],Rust:[`rs`],SaC:[`sac`],SASS:[`sass`],SCAD:[`scad`],Scala:[`scala|sbt`],Scheme:[`scm|sm|rkt|oak|scheme`],Scrypt:[`scrypt`],SCSS:[`scss`],SH:[`sh|bash|^.bashrc`],SJS:[`sjs`],Slim:[`slim|skim`],Smarty:[`smarty|tpl`],Smithy:[`smithy`],snippets:[`snippets`],Soy_Template:[`soy`],Space:[`space`],SPARQL:[`rq`],SQL:[`sql`],SQLServer:[`sqlserver`],Stylus:[`styl|stylus`],SVG:[`svg`],Swift:[`swift`],Tcl:[`tcl`],Terraform:[`tf`,`tfvars`,`terragrunt`],Tex:[`tex`],Text:[`txt`],Textile:[`textile`],Toml:[`toml`],TSV:[`tsv`],TSX:[`tsx`],Turtle:[`ttl`],Twig:[`twig|swig`],Typescript:[`ts|mts|cts|typescript|str`],Vala:[`vala`],VBScript:[`vbs|vb`],Velocity:[`vm`],Verilog:[`v|vh|sv|svh`],VHDL:[`vhd|vhdl`],Visualforce:[`vfp|component|page`],Vue:[`vue`],Wollok:[`wlk|wpgm|wtest`],XML:[`xml|rdf|rss|wsdl|xslt|atom|mathml|mml|xul|xbl|xaml`],XQuery:[`xq`],YAML:[`yaml|yml`],Zeek:[`zeek|bro`],Zig:[`zig`]},s={ObjectiveC:`Objective-C`,CSharp:`C#`,golang:`Go`,C_Cpp:`C and C++`,Csound_Document:`Csound Document`,Csound_Orchestra:`Csound`,Csound_Score:`Csound Score`,coffee:`CoffeeScript`,HTML_Ruby:`HTML (Ruby)`,HTML_Elixir:`HTML (Elixir)`,FTL:`FreeMarker`,PHP_Laravel_blade:`PHP (Blade Template)`,Perl6:`Perl 6`,AutoHotKey:`AutoHotkey / AutoIt`},c={};for(var l in o){var u=o[l],d=(s[l]||l).replace(/_/g,` `),f=l.toLowerCase(),p=new a(f,d,u[0]);c[f]=p,r.push(p)}t.getModeForPath=i,t.modes=r,t.modesByName=c}),(function(){ace.require([`ace/ext/modelist`],function(n){typeof t==`object`&&typeof e==`object`&&t&&(t.exports=n)})})()})),D=T(),O=e(f(),1);E(),r();var k=O.require?O.require(`ace/ext/modelist`):O.acequire(`ace/ext/modelist`),A=class e extends v{constructor(e){super(e),l(this,`writeFile64`,()=>{let e=this.props.href.split(`/`),t=this.state.editingValue||``;e.splice(0,2);let n=e[0],r=e.splice(1).join(`/`);this.props.socket.writeFile64(n,r,D.Buffer.from(t).toString(`base64`)).then(()=>this.props.onClose()).catch(e=>window.alert(`Cannot write file: ${e}`))}),Object.assign(this.state,{editing:!!this.props.formatEditFile||!1})}static getEditFile(e){switch(e){case`json`:return`json`;case`json5`:return`json5`;case`js`:return`javascript`;case`html`:return`html`;case`txt`:return`html`;default:return k.getModeForPath(`testFile.${e}`).mode.split(`/`).pop()||`text`}}getEditorOrViewer(){return i(x,{mode:e.getEditFile(this.props.formatEditFile),themeType:this.props.themeType,value:this.state.editingValue||this.state.code||this.state.text||void 0,onChange:this.state.editing?e=>this.setState({editingValue:e,changed:!0}):void 0})}onSave(){this.writeFile64()}},j=[{Owner:[{name:`read`,valueNum:1024,title:`read owner`},{name:`write`,valueNum:512,title:`write owner`}]},{Group:[{name:`read`,valueNum:64,title:`read group`},{name:`write`,valueNum:32,title:`write group`}]},{Everyone:[{name:`read`,valueNum:4,title:`read everyone`},{name:`write`,valueNum:2,title:`write everyone`}]}],M=(e,t,n)=>(e|=t&n,e&=t|~n&65535,e),ee=({value:e,setValue:t,t:r,differentValues:a,applyToChildren:o,mask:s,setMask:c,disabled:l})=>{h(()=>{if(o){let t=0;for(let n=0;n<a.length;n++)t|=e^a[n];c(t)}else c(0)},[a,o,c,e]);let d=new Set,f=e;for(let e of j)for(let t of e[Object.keys(e)[0]])f-t.valueNum>=0&&(f-=t.valueNum,d.add(t.valueNum));return i(`div`,{style:{display:`flex`,width:`fit-content`,margin:20,border:`1px solid`,borderLeft:0},children:j.map(a=>{let o=Object.keys(a)[0];return u(`div`,{style:{width:150,height:150,display:`flex`,flexDirection:`column`,alignItems:`center`,borderLeft:`1px solid`},children:[i(`div`,{style:{height:50,display:`flex`,alignItems:`center`,fontSize:18,borderBottom:`1px solid silver`,width:`100%`,justifyContent:`center`},children:r(o)}),i(`div`,{style:{display:`flex`,width:`100%`},children:a[o].map((a,o)=>{let f=d.has(a.valueNum),p=s&a.valueNum;return u(`div`,{style:{display:`flex`,flexDirection:`column`,flex:1,alignItems:`center`,borderRight:o===0?`1px solid`:0},children:[i(`div`,{style:{height:50,borderBottom:`1px solid`,width:`100%`,justifyContent:`center`,display:`flex`,alignItems:`center`,color:`silver`},children:r(a.name)}),i(`div`,{style:{height:50,display:`flex`},children:i(n,{disabled:l,checked:f,color:p?`primary`:`secondary`,indeterminate:!!p,style:p?{opacity:.5}:void 0,onChange:n=>{p&&(s&=~a.valueNum&65535,c(s));let r=e;n.target.checked?r|=a.valueNum:r&=~a.valueNum&65535,t(r)}})})]},a.valueNum)})})]},o)})})};async function N(e,t,n){let r=t[e];if(!r){let i=e.split(`/`),a=i.length,o=i.shift()||null,s=i.join(`/`),c=await n.readDir(o,s);t[e]=[];for(let n=0;n<c.length;n++){let r=c[n],i={id:`${e}/${r.file}`,ext:b.getFileExtension(r.file),folder:r.isDir,name:r.file,size:r.stats&&r.stats.size,modified:r.modifiedAt,acl:r.acl,level:a};t[e].push(i)}r=t[e]}for(let e=0;e<r.length;e++){let i=r[e];i.folder&&await N(i.id,t,n)}}function te(e){let t={};return Object.keys(e).forEach(n=>{t[n]={folder:!0,id:n,level:0,name:n},e[n].forEach(e=>{t[e.id]=e})}),t}async function P(e,t,n,r=``,i=``,a=0){if(typeof n==`string`&&(n=n.split(`/`),a=0,r=n.shift()||``,i=``),!(n.length>=a)){if(t[r+i]){if(n.length-1===a){let o=`${r+i}/${n[a]}`,s=t[r+i].find(e=>e.id===o);s&&s.folder&&await N(r+i,t,e);return}i+=`/${n[a]}`,await P(e,t,n,r,i,a+1)}else{let o=await e.readDir(r||null,i);t[r+i]=[],o.forEach(e=>{let n={id:`${i}/${e.file}`,ext:b.getFileExtension(e.file),folder:e.isDir,name:e.file,size:e.stats&&e.stats.size,modified:e.modifiedAt,acl:e.acl,level:a};t[r+i].push(n)}),await P(e,t,n,r,i,a+1)}}}var F=`different`,ne=({onClose:e,onApply:t,selected:n,applyChangesToObject:r,applyChangesToFile:s,objects:l,t:f,themeType:p,folders:g,socket:_,theme:v})=>{let y=n.substring(0,n.lastIndexOf(`/`))||n,b=(n.split(`/`).length===1?g[`/`].find(({id:e})=>e===n):g[y].find(({id:e})=>e===n))||{},[x,C]=m(null),[w,T]=m(null),[E,D]=m([]),[O,k]=m([]),[A,j]=m(!1),[N,ne]=m(0),[I,L]=m(null),[R,z]=m(!1),[B,V]=m(!1),[H,U]=m([]),[W,G]=m(0),[K,re]=m([]),[q,J]=m(!0),[Y,ie]=m(!1),X=c.getLanguage();return h(()=>{let e=[],t=b.id,n=!1,r=!1,i=null,a=null,o=null,s=[],c=0;P(_,g,t).then(()=>{let u=te(g),d=`${t}/`;Object.keys(u).forEach(f=>{if(f!==`/`&&(f===t||f.startsWith(d))){if(!f.includes(`/`)&&l[f]){var p,m,h,g,_,v,y,b,x;let t=l[f];c++,s.push(t),o===null&&((p=t.acl)==null?void 0:p.file)!==void 0&&(o=t.acl.file),i===null&&((m=t.acl)==null?void 0:m.owner)!==void 0&&(i=t.acl.owner),a===null&&((h=t.acl)==null?void 0:h.ownerGroup)!==void 0&&(a=t.acl.ownerGroup),!R&&i!==((g=t.acl)==null?void 0:g.owner)&&((_=t.acl)==null?void 0:_.owner)!==void 0&&(n=!0),!B&&a!==((v=t.acl)==null?void 0:v.ownerGroup)&&((y=t.acl)==null?void 0:y.ownerGroup)!==void 0&&(r=!0),((b=t.acl)==null?void 0:b.file)!==void 0&&o!==((x=t.acl)==null?void 0:x.file)&&!e.includes(t.acl.file)&&e.push(t.acl.file)}else if(!u[f].folder){var S,C,w,T,E,D;c++;let t=u[f];if(s.push(t),o===null&&t.acl.permissions!==void 0&&(o=t.acl.permissions),i===null&&((S=t.acl)==null?void 0:S.owner)!==void 0){var O;i=(O=t.acl)==null?void 0:O.owner}if(a===null&&((C=t.acl)==null?void 0:C.ownerGroup)!==void 0){var k;a=(k=t.acl)==null?void 0:k.ownerGroup}!R&&i!==((w=t.acl)==null?void 0:w.owner)&&((T=t.acl)==null?void 0:T.owner)!==void 0&&(n=!0),!B&&a!==((E=t.acl)==null?void 0:E.ownerGroup)&&((D=t.acl)==null?void 0:D.ownerGroup)!==void 0&&(r=!0),t.acl.permissions!==void 0&&o!==t.acl.permissions&&!e.includes(t.acl.permissions)&&e.push(t.acl.permissions)}}});let f=[],p=[];Object.keys(l).forEach(e=>{let t=l[e];e.startsWith(`system.group.`)&&(t==null?void 0:t.type)===`group`?p.push(t):e.startsWith(`system.user.`)&&(t==null?void 0:t.type)===`user`&&f.push(t)});let m=l[`system.config`].common.defaultNewAcl;i||=m.owner,a||=m.ownerGroup,o||=m.file,L(o),C(i),T(a),z(n),V(r),D(f),k(p),b!=null&&b.folder&&j(!0),ne(c),U(e),re(s)})},[l,n]),h(()=>{if(A)R&&x!==F&&C(F),B&&w!==F&&T(F);else{if(x&&x===F){var e;C(((e=l[n])==null||(e=e.acl)==null?void 0:e.owner)||null)}if(w&&w===F){var t;T(((t=l[n])==null||(t=t.acl)==null?void 0:t.ownerGroup)||null)}}console.log(`stateOwnerUser ${x}`)},[A,x,w,R,B]),K.length?i(S,{theme:v,titleButtonApply:`apply`,overflowHidden:!0,disableApply:q,progress:Y,onClose:e,onApply:()=>{ie(!0),setTimeout(async()=>{var e;let n=((e=l[`system.config`].common)==null||(e=e.defaultNewAcl)==null?void 0:e.file)||1636;if(A){let e=~W&65535;for(let t=0;t<K.length;t++){let l=K[t],m=!1,h=l,g=l;if(h._id){var i,a,o,c;let t=M(((i=h.acl)==null?void 0:i.file)||n,I??0,e);t!==((a=h.acl)==null?void 0:a.file)&&(h.acl=h.acl||{},h.acl.file=t,m=!0),x!==F&&x!==((o=h.acl)==null?void 0:o.owner)&&(h.acl=h.acl||{},h.acl.owner=x??``,m=!0),w!==F&&w!==((c=h.acl)==null?void 0:c.ownerGroup)&&(h.acl=h.acl||{},h.acl.ownerGroup=w??``,m=!0);try{m&&await r(h)}catch(e){console.error(e)}}else if(g&&!g.folder){var u,d,f,p;let t={},r=M(((u=g.acl)==null?void 0:u.permissions)||n,I??0,e);if(r!==((d=g.acl)==null?void 0:d.permissions)&&(t.permissions=r,m=!0),x!==F&&x!==((f=g.acl)==null?void 0:f.owner)&&(t.owner=x??void 0,m=!0),w!==F&&w!==((p=g.acl)==null?void 0:p.ownerGroup)&&(t.ownerGroup=w??void 0,m=!0),m){let e=g.id.split(`/`),n=e.shift()||``,r=e.join(`/`);try{await s(n,r,t)}catch(e){console.error(e)}}}}}else{let e=b.id.split(`/`),t=e.shift()||``,n=e.join(`/`),i={},a=!1;if(!b.folder){var m,h,g;((m=b.acl)==null?void 0:m.permissions)!==I&&(i.permissions=I??void 0,a=!0),((h=b.acl)==null?void 0:h.owner)!==x&&(i.owner=x??void 0,a=!0),((g=b.acl)==null?void 0:g.ownerGroup)!==w&&(i.ownerGroup=w??void 0,a=!0),a&&await s(t,n,i)}else if(!e.length&&l[b.id]){var _,v,y;let e=l[b.id];((_=e.acl)==null?void 0:_.file)!==I&&(e.acl=e.acl||{},e.acl.file=I??0,a=!0),((v=e.acl)==null?void 0:v.owner)!==x&&(e.acl=e.acl||{},e.acl.owner=x??``,a=!0),((y=e.acl)==null?void 0:y.ownerGroup)!==w&&(e.acl=e.acl||{},e.acl.ownerGroup=w??``,a=!0),a&&await r(e)}}ie(!1),t()},200)},children:u(`div`,{style:{display:`flex`,flexDirection:`column`},children:[i(`div`,{style:{margin:10,fontSize:20},children:f(`Access control list: %s`,n)}),u(`div`,{style:{display:`flex`},children:[i(a,{fullWidth:!0,style:{marginRight:10},label:f(`Owner user`),lang:X,list:E,t:f,disabled:Y,value:x||void 0,themeType:p,different:R?F:!1,onChange:e=>{z(!1),C(e),J(!1)}}),i(a,{fullWidth:!0,label:f(`Owner group`),lang:X,list:O,t:f,disabled:Y,value:w||void 0,themeType:p,different:B?F:!1,onChange:e=>{V(!1),T(e),J(!1)}})]}),u(`div`,{style:{display:`flex`,margin:10,alignItems:`center`,fontSize:10,marginLeft:0,color:`silver`},children:[i(`div`,{style:!b.folder||!A?{color:`green`}:void 0,children:f(`to apply one item`)}),i(o,{disabled:K.length===1||Y,checked:!l[b.id]&&!!b.folder||A,onChange:e=>{j(e.target.checked),J(!1)},color:`primary`}),u(`div`,{style:b.folder||A?{color:`green`}:void 0,children:[f(`to apply with children`),` `,b.folder||N>1?`(${N} ${f(`object(s)`)})`:``]})]}),Y&&i(d,{}),i(`div`,{style:{overflowY:`auto`},children:u(`div`,{children:[i(`h2`,{children:f(`File rights`)}),i(ee,{disabled:Y,mask:W,setMask:G,applyToChildren:A,differentValues:H,t:f,setValue:e=>{L(e),J(!1)},value:I??0})]})})]})}):i(d,{})};r();var I=[`select`,`view`],L=class e extends g{constructor(e){super(e),l(this,`t`,void 0),l(this,`wordCache`,void 0),l(this,`objects`,void 0),l(this,`navigateTo`,null),l(this,`translate`,(e,t,n)=>t===void 0?(this.wordCache[e]||(this.wordCache[e]=this.props.t(e)),this.wordCache[e]):this.props.t(e,t,n)),this.t=this.translate,this.wordCache={},this.objects={}}componentDidMount(){this.props.socket.getObjects(!0,!0).then(e=>this.objects=e)}static isAppDialogOpen(){let e=p.getLocation().dialog;return!!e&&!I.includes(e)}renderAclDialog(e){return i(ne,{theme:this.props.theme,themeType:this.props.themeType,applyChangesToObject:async t=>{let n=await this.props.socket.getObject(t._id);n.acl=t.acl,await this.props.socket.setObject(n._id,n);let r=n;r!=null&&r.acl&&e.updateItemsAcl([{id:r._id,acl:r.acl,level:0,name:r._id,folder:!1}])},applyChangesToFile:async(t,n,r)=>{let i=r||{},a;if((i.owner||i.ownerGroup)&&i.permissions?(await this.props.socket.chownFile(t,n,{owner:i.owner,ownerGroup:i.ownerGroup}),a=await this.props.socket.chmodFile(t,n,{mode:i.permissions})):i.permissions?a=await this.props.socket.chmodFile(t,n,{mode:i.permissions}):(i.owner||i.ownerGroup)&&(a=await this.props.socket.chownFile(t,n,{owner:i.owner,ownerGroup:i.ownerGroup})),Array.isArray(a))for(let n=0;n<a.length;n++){let r=a[n];r&&r.file&&r.acl&&e.updateItemsAcl([{id:`${t}/${r.path?`${r.path}/`:``}${r.file}`,acl:r.acl,level:0,name:``,folder:!1}])}},selected:e.state.selected,folders:e.state.folders,objects:this.objects,socket:this.props.socket,t:this.t,onClose:()=>e.setState({modalEditOfAccess:!1}),onApply:()=>e.setState({modalEditOfAccess:!1})})}render(){if(!this.props.ready)return i(d,{});if(!e.isAppDialogOpen()){let e=p.getLocation();this.navigateTo=e.tab===`tab-files`&&e.id?{mode:e.dialog===`view`?`view`:`select`,id:e.id}:null}let t=this.navigateTo;return i(s,{children:i(y,{overflow:`auto`,children:i(_,{navigateTo:t,onNavigateTo:t=>{e.isAppDialogOpen()||(t!=null&&t.id?p.doNavigate(`tab-files`,t.mode,t.id):p.doNavigate(`tab-files`))},showViewTypeButton:!0,ready:this.props.ready,socket:this.props.socket,themeType:this.props.themeType,theme:this.props.theme,lang:this.props.lang,t:this.props.t,showToolbar:!0,allowUpload:!0,allowView:!0,allowDownload:!0,allowCreateFolder:!0,allowDelete:!0,expertMode:this.props.expertMode,modalEditOfAccessControl:e=>this.renderAclDialog(e),FileViewer:A})})})}};export{L as default};
|
|
1
|
+
import{a as e,t}from"./rolldown-runtime-sJBDdmOt.js";import{Ds as n,Eo as r,Es as i,Pr as a,Qa as o,Rr as s,Tr as c,Us as l,Ws as u,Zo as d,c as f,cc as p,jr as m,mc as h,nc as g,ur as _,vr as v,zr as y}from"./loadShare-eager-BpwDZfDr.js";import{t as b}from"./AdminUtils-CopxRJZ2.js";import{M as x}from"./bootstrap-DSDOwKWU.js";import{t as S}from"./CustomModal-DjI4oCb8.js";var C=t((e=>{e.byteLength=c,e.toByteArray=u,e.fromByteArray=p;for(var t=[],n=[],r=typeof Uint8Array<`u`?Uint8Array:Array,i=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,a=0,o=i.length;a<o;++a)t[a]=i[a],n[i.charCodeAt(a)]=a;n[45]=62,n[95]=63;function s(e){var t=e.length;if(t%4>0)throw Error(`Invalid string. Length must be a multiple of 4`);var n=e.indexOf(`=`);n===-1&&(n=t);var r=n===t?0:4-n%4;return[n,r]}function c(e){var t=s(e),n=t[0],r=t[1];return(n+r)*3/4-r}function l(e,t,n){return(t+n)*3/4-n}function u(e){for(var t,i=s(e),a=i[0],o=i[1],c=new r(l(e,a,o)),u=0,d=o>0?a-4:a,f=0;f<d;f+=4)t=n[e.charCodeAt(f)]<<18|n[e.charCodeAt(f+1)]<<12|n[e.charCodeAt(f+2)]<<6|n[e.charCodeAt(f+3)],c[u++]=t>>16&255,c[u++]=t>>8&255,c[u++]=t&255;return o===2&&(t=n[e.charCodeAt(f)]<<2|n[e.charCodeAt(f+1)]>>4,c[u++]=t&255),o===1&&(t=n[e.charCodeAt(f)]<<10|n[e.charCodeAt(f+1)]<<4|n[e.charCodeAt(f+2)]>>2,c[u++]=t>>8&255,c[u++]=t&255),c}function d(e){return t[e>>18&63]+t[e>>12&63]+t[e>>6&63]+t[e&63]}function f(e,t,n){for(var r,i=[],a=t;a<n;a+=3)r=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(e[a+2]&255),i.push(d(r));return i.join(``)}function p(e){for(var n,r=e.length,i=r%3,a=[],o=16383,s=0,c=r-i;s<c;s+=o)a.push(f(e,s,s+o>c?c:s+o));return i===1?(n=e[r-1],a.push(t[n>>2]+t[n<<4&63]+`==`)):i===2&&(n=(e[r-2]<<8)+e[r-1],a.push(t[n>>10]+t[n>>4&63]+t[n<<2&63]+`=`)),a.join(``)}})),w=t((e=>{e.read=function(e,t,n,r,i){var a,o,s=i*8-r-1,c=(1<<s)-1,l=c>>1,u=-7,d=n?i-1:0,f=n?-1:1,p=e[t+d];for(d+=f,a=p&(1<<-u)-1,p>>=-u,u+=s;u>0;a=a*256+e[t+d],d+=f,u-=8);for(o=a&(1<<-u)-1,a>>=-u,u+=r;u>0;o=o*256+e[t+d],d+=f,u-=8);if(a===0)a=1-l;else if(a===c)return o?NaN:(p?-1:1)*(1/0);else o+=2**r,a-=l;return(p?-1:1)*o*2**(a-r)},e.write=function(e,t,n,r,i,a){var o,s,c,l=a*8-i-1,u=(1<<l)-1,d=u>>1,f=i===23?2**-24-2**-77:0,p=r?0:a-1,m=r?1:-1,h=+(t<0||t===0&&1/t<0);for(t=Math.abs(t),isNaN(t)||t===1/0?(s=+!!isNaN(t),o=u):(o=Math.floor(Math.log(t)/Math.LN2),t*(c=2**-o)<1&&(o--,c*=2),o+d>=1?t+=f/c:t+=f*2**(1-d),t*c>=2&&(o++,c/=2),o+d>=u?(s=0,o=u):o+d>=1?(s=(t*c-1)*2**i,o+=d):(s=t*2**(d-1)*2**i,o=0));i>=8;e[n+p]=s&255,p+=m,s/=256,i-=8);for(o=o<<i|s,l+=i;l>0;e[n+p]=o&255,p+=m,o/=256,l-=8);e[n+p-m]|=h*128}})),T=t((e=>{var t=C(),n=w(),r=typeof Symbol==`function`&&typeof Symbol.for==`function`?Symbol.for(`nodejs.util.inspect.custom`):null;e.Buffer=s,e.SlowBuffer=v,e.INSPECT_MAX_BYTES=50;var i=2147483647;e.kMaxLength=i,s.TYPED_ARRAY_SUPPORT=a(),!s.TYPED_ARRAY_SUPPORT&&typeof console<`u`&&typeof console.error==`function`&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function a(){try{let e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),e.foo()===42}catch{return!1}}Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}});function o(e){if(e>i)throw RangeError(`The value "`+e+`" is invalid for option "size"`);let t=new Uint8Array(e);return Object.setPrototypeOf(t,s.prototype),t}function s(e,t,n){if(typeof e==`number`){if(typeof t==`string`)throw TypeError(`The "string" argument must be of type string. Received type number`);return d(e)}return c(e,t,n)}s.poolSize=8192;function c(e,t,n){if(typeof e==`string`)return f(e,t);if(ArrayBuffer.isView(e))return m(e);if(e==null)throw TypeError(`The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type `+typeof e);if(Q(e,ArrayBuffer)||e&&Q(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<`u`&&(Q(e,SharedArrayBuffer)||e&&Q(e.buffer,SharedArrayBuffer)))return h(e,t,n);if(typeof e==`number`)throw TypeError(`The "value" argument must not be of type number. Received type number`);let r=e.valueOf&&e.valueOf();if(r!=null&&r!==e)return s.from(r,t,n);let i=g(e);if(i)return i;if(typeof Symbol<`u`&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]==`function`)return s.from(e[Symbol.toPrimitive](`string`),t,n);throw TypeError(`The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type `+typeof e)}s.from=function(e,t,n){return c(e,t,n)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array);function l(e){if(typeof e!=`number`)throw TypeError(`"size" argument must be of type number`);if(e<0)throw RangeError(`The value "`+e+`" is invalid for option "size"`)}function u(e,t,n){return l(e),e<=0||t===void 0?o(e):typeof n==`string`?o(e).fill(t,n):o(e).fill(t)}s.alloc=function(e,t,n){return u(e,t,n)};function d(e){return l(e),o(e<0?0:_(e)|0)}s.allocUnsafe=function(e){return d(e)},s.allocUnsafeSlow=function(e){return d(e)};function f(e,t){if((typeof t!=`string`||t===``)&&(t=`utf8`),!s.isEncoding(t))throw TypeError(`Unknown encoding: `+t);let n=y(e,t)|0,r=o(n),i=r.write(e,t);return i!==n&&(r=r.slice(0,i)),r}function p(e){let t=e.length<0?0:_(e.length)|0,n=o(t);for(let r=0;r<t;r+=1)n[r]=e[r]&255;return n}function m(e){if(Q(e,Uint8Array)){let t=new Uint8Array(e);return h(t.buffer,t.byteOffset,t.byteLength)}return p(e)}function h(e,t,n){if(t<0||e.byteLength<t)throw RangeError(`"offset" is outside of buffer bounds`);if(e.byteLength<t+(n||0))throw RangeError(`"length" is outside of buffer bounds`);let r;return r=t===void 0&&n===void 0?new Uint8Array(e):n===void 0?new Uint8Array(e,t):new Uint8Array(e,t,n),Object.setPrototypeOf(r,s.prototype),r}function g(e){if(s.isBuffer(e)){let t=_(e.length)|0,n=o(t);return n.length===0||e.copy(n,0,0,t),n}if(e.length!==void 0)return typeof e.length!=`number`||ce(e.length)?o(0):p(e);if(e.type===`Buffer`&&Array.isArray(e.data))return p(e.data)}function _(e){if(e>=i)throw RangeError(`Attempt to allocate Buffer larger than maximum size: 0x`+i.toString(16)+` bytes`);return e|0}function v(e){return+e!=e&&(e=0),s.alloc(+e)}s.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==s.prototype},s.compare=function(e,t){if(Q(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),Q(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(e)||!s.isBuffer(t))throw TypeError(`The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array`);if(e===t)return 0;let n=e.length,r=t.length;for(let i=0,a=Math.min(n,r);i<a;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:+(r<n)},s.isEncoding=function(e){switch(String(e).toLowerCase()){case`hex`:case`utf8`:case`utf-8`:case`ascii`:case`latin1`:case`binary`:case`base64`:case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return!0;default:return!1}},s.concat=function(e,t){if(!Array.isArray(e))throw TypeError(`"list" argument must be an Array of Buffers`);if(e.length===0)return s.alloc(0);let n;if(t===void 0)for(t=0,n=0;n<e.length;++n)t+=e[n].length;let r=s.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){let t=e[n];if(Q(t,Uint8Array))i+t.length>r.length?(s.isBuffer(t)||(t=s.from(t)),t.copy(r,i)):Uint8Array.prototype.set.call(r,t,i);else if(s.isBuffer(t))t.copy(r,i);else throw TypeError(`"list" argument must be an Array of Buffers`);i+=t.length}return r};function y(e,t){if(s.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||Q(e,ArrayBuffer))return e.byteLength;if(typeof e!=`string`)throw TypeError(`The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type `+typeof e);let n=e.length,r=arguments.length>2&&arguments[2]===!0;if(!r&&n===0)return 0;let i=!1;for(;;)switch(t){case`ascii`:case`latin1`:case`binary`:return n;case`utf8`:case`utf-8`:return X(e).length;case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return n*2;case`hex`:return n>>>1;case`base64`:return se(e).length;default:if(i)return r?-1:X(e).length;t=(``+t).toLowerCase(),i=!0}}s.byteLength=y;function b(e,t,n){let r=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,t>>>=0,n<=t))return``;for(e||=`utf8`;;)switch(e){case`hex`:return F(this,t,n);case`utf8`:case`utf-8`:return M(this,t,n);case`ascii`:return te(this,t,n);case`latin1`:case`binary`:return P(this,t,n);case`base64`:return j(this,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return ne(this,t,n);default:if(r)throw TypeError(`Unknown encoding: `+e);e=(e+``).toLowerCase(),r=!0}}s.prototype._isBuffer=!0;function x(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}s.prototype.swap16=function(){let e=this.length;if(e%2!=0)throw RangeError(`Buffer size must be a multiple of 16-bits`);for(let t=0;t<e;t+=2)x(this,t,t+1);return this},s.prototype.swap32=function(){let e=this.length;if(e%4!=0)throw RangeError(`Buffer size must be a multiple of 32-bits`);for(let t=0;t<e;t+=4)x(this,t,t+3),x(this,t+1,t+2);return this},s.prototype.swap64=function(){let e=this.length;if(e%8!=0)throw RangeError(`Buffer size must be a multiple of 64-bits`);for(let t=0;t<e;t+=8)x(this,t,t+7),x(this,t+1,t+6),x(this,t+2,t+5),x(this,t+3,t+4);return this},s.prototype.toString=function(){let e=this.length;return e===0?``:arguments.length===0?M(this,0,e):b.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(e){if(!s.isBuffer(e))throw TypeError(`Argument must be a Buffer`);return this===e||s.compare(this,e)===0},s.prototype.inspect=function(){let t=``,n=e.INSPECT_MAX_BYTES;return t=this.toString(`hex`,0,n).replace(/(.{2})/g,`$1 `).trim(),this.length>n&&(t+=` ... `),`<Buffer `+t+`>`},r&&(s.prototype[r]=s.prototype.inspect),s.prototype.compare=function(e,t,n,r,i){if(Q(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),!s.isBuffer(e))throw TypeError(`The "target" argument must be one of type Buffer or Uint8Array. Received type `+typeof e);if(t===void 0&&(t=0),n===void 0&&(n=e?e.length:0),r===void 0&&(r=0),i===void 0&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw RangeError(`out of range index`);if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,i>>>=0,this===e)return 0;let a=i-r,o=n-t,c=Math.min(a,o),l=this.slice(r,i),u=e.slice(t,n);for(let e=0;e<c;++e)if(l[e]!==u[e]){a=l[e],o=u[e];break}return a<o?-1:+(o<a)};function S(e,t,n,r,i){if(e.length===0)return-1;if(typeof n==`string`?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,ce(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(i)n=0;else return-1}if(typeof t==`string`&&(t=s.from(t,r)),s.isBuffer(t))return t.length===0?-1:T(e,t,n,r,i);if(typeof t==`number`)return t&=255,typeof Uint8Array.prototype.indexOf==`function`?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):T(e,[t],n,r,i);throw TypeError(`val must be string, number or Buffer`)}function T(e,t,n,r,i){let a=1,o=e.length,s=t.length;if(r!==void 0&&(r=String(r).toLowerCase(),r===`ucs2`||r===`ucs-2`||r===`utf16le`||r===`utf-16le`)){if(e.length<2||t.length<2)return-1;a=2,o/=2,s/=2,n/=2}function c(e,t){return a===1?e[t]:e.readUInt16BE(t*a)}let l;if(i){let r=-1;for(l=n;l<o;l++)if(c(e,l)===c(t,r===-1?0:l-r)){if(r===-1&&(r=l),l-r+1===s)return r*a}else r!==-1&&(l-=l-r),r=-1}else for(n+s>o&&(n=o-s),l=n;l>=0;l--){let n=!0;for(let r=0;r<s;r++)if(c(e,l+r)!==c(t,r)){n=!1;break}if(n)return l}return-1}s.prototype.includes=function(e,t,n){return this.indexOf(e,t,n)!==-1},s.prototype.indexOf=function(e,t,n){return S(this,e,t,n,!0)},s.prototype.lastIndexOf=function(e,t,n){return S(this,e,t,n,!1)};function E(e,t,n,r){n=Number(n)||0;let i=e.length-n;r?(r=Number(r),r>i&&(r=i)):r=i;let a=t.length;r>a/2&&(r=a/2);let o=0;for(;o<r;++o){let r=parseInt(t.substr(o*2,2),16);if(ce(r))return o;e[n+o]=r}return o}function D(e,t,n,r){return Z(X(t,e.length-n),e,n,r)}function O(e,t,n,r){return Z(ae(t),e,n,r)}function k(e,t,n,r){return Z(se(t),e,n,r)}function A(e,t,n,r){return Z(oe(t,e.length-n),e,n,r)}s.prototype.write=function(e,t,n,r){if(t===void 0)r=`utf8`,n=this.length,t=0;else if(n===void 0&&typeof t==`string`)r=t,n=this.length,t=0;else if(isFinite(t))t>>>=0,isFinite(n)?(n>>>=0,r===void 0&&(r=`utf8`)):(r=n,n=void 0);else throw Error(`Buffer.write(string, encoding, offset[, length]) is no longer supported`);let i=this.length-t;if((n===void 0||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw RangeError(`Attempt to write outside buffer bounds`);r||=`utf8`;let a=!1;for(;;)switch(r){case`hex`:return E(this,e,t,n);case`utf8`:case`utf-8`:return D(this,e,t,n);case`ascii`:case`latin1`:case`binary`:return O(this,e,t,n);case`base64`:return k(this,e,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return A(this,e,t,n);default:if(a)throw TypeError(`Unknown encoding: `+r);r=(``+r).toLowerCase(),a=!0}},s.prototype.toJSON=function(){return{type:`Buffer`,data:Array.prototype.slice.call(this._arr||this,0)}};function j(e,n,r){return n===0&&r===e.length?t.fromByteArray(e):t.fromByteArray(e.slice(n,r))}function M(e,t,n){n=Math.min(e.length,n);let r=[],i=t;for(;i<n;){let t=e[i],a=null,o=t>239?4:t>223?3:t>191?2:1;if(i+o<=n){let n,r,s,c;switch(o){case 1:t<128&&(a=t);break;case 2:n=e[i+1],(n&192)==128&&(c=(t&31)<<6|n&63,c>127&&(a=c));break;case 3:n=e[i+1],r=e[i+2],(n&192)==128&&(r&192)==128&&(c=(t&15)<<12|(n&63)<<6|r&63,c>2047&&(c<55296||c>57343)&&(a=c));break;case 4:n=e[i+1],r=e[i+2],s=e[i+3],(n&192)==128&&(r&192)==128&&(s&192)==128&&(c=(t&15)<<18|(n&63)<<12|(r&63)<<6|s&63,c>65535&&c<1114112&&(a=c))}}a===null?(a=65533,o=1):a>65535&&(a-=65536,r.push(a>>>10&1023|55296),a=56320|a&1023),r.push(a),i+=o}return N(r)}var ee=4096;function N(e){let t=e.length;if(t<=ee)return String.fromCharCode.apply(String,e);let n=``,r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=ee));return n}function te(e,t,n){let r=``;n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]&127);return r}function P(e,t,n){let r=``;n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function F(e,t,n){let r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);let i=``;for(let r=t;r<n;++r)i+=le[e[r]];return i}function ne(e,t,n){let r=e.slice(t,n),i=``;for(let e=0;e<r.length-1;e+=2)i+=String.fromCharCode(r[e]+r[e+1]*256);return i}s.prototype.slice=function(e,t){let n=this.length;e=~~e,t=t===void 0?n:~~t,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t<e&&(t=e);let r=this.subarray(e,t);return Object.setPrototypeOf(r,s.prototype),r};function I(e,t,n){if(e%1!=0||e<0)throw RangeError(`offset is not uint`);if(e+t>n)throw RangeError(`Trying to access beyond buffer length`)}s.prototype.readUintLE=s.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||I(e,t,this.length);let r=this[e],i=1,a=0;for(;++a<t&&(i*=256);)r+=this[e+a]*i;return r},s.prototype.readUintBE=s.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||I(e,t,this.length);let r=this[e+--t],i=1;for(;t>0&&(i*=256);)r+=this[e+--t]*i;return r},s.prototype.readUint8=s.prototype.readUInt8=function(e,t){return e>>>=0,t||I(e,1,this.length),this[e]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(e,t){return e>>>=0,t||I(e,2,this.length),this[e]|this[e+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(e,t){return e>>>=0,t||I(e,2,this.length),this[e]<<8|this[e+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(e,t){return e>>>=0,t||I(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(e,t){return e>>>=0,t||I(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},s.prototype.readBigUInt64LE=$(function(e){e>>>=0,q(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&J(e,this.length-8);let r=t+this[++e]*256+this[++e]*2**16+this[++e]*2**24,i=this[++e]+this[++e]*256+this[++e]*2**16+n*2**24;return BigInt(r)+(BigInt(i)<<BigInt(32))}),s.prototype.readBigUInt64BE=$(function(e){e>>>=0,q(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&J(e,this.length-8);let r=t*2**24+this[++e]*2**16+this[++e]*256+this[++e],i=this[++e]*2**24+this[++e]*2**16+this[++e]*256+n;return(BigInt(r)<<BigInt(32))+BigInt(i)}),s.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||I(e,t,this.length);let r=this[e],i=1,a=0;for(;++a<t&&(i*=256);)r+=this[e+a]*i;return i*=128,r>=i&&(r-=2**(8*t)),r},s.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||I(e,t,this.length);let r=t,i=1,a=this[e+--r];for(;r>0&&(i*=256);)a+=this[e+--r]*i;return i*=128,a>=i&&(a-=2**(8*t)),a},s.prototype.readInt8=function(e,t){return e>>>=0,t||I(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]},s.prototype.readInt16LE=function(e,t){e>>>=0,t||I(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n},s.prototype.readInt16BE=function(e,t){e>>>=0,t||I(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n},s.prototype.readInt32LE=function(e,t){return e>>>=0,t||I(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},s.prototype.readInt32BE=function(e,t){return e>>>=0,t||I(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},s.prototype.readBigInt64LE=$(function(e){e>>>=0,q(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&J(e,this.length-8);let r=this[e+4]+this[e+5]*256+this[e+6]*2**16+(n<<24);return(BigInt(r)<<BigInt(32))+BigInt(t+this[++e]*256+this[++e]*2**16+this[++e]*2**24)}),s.prototype.readBigInt64BE=$(function(e){e>>>=0,q(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&J(e,this.length-8);let r=(t<<24)+this[++e]*2**16+this[++e]*256+this[++e];return(BigInt(r)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*256+n)}),s.prototype.readFloatLE=function(e,t){return e>>>=0,t||I(e,4,this.length),n.read(this,e,!0,23,4)},s.prototype.readFloatBE=function(e,t){return e>>>=0,t||I(e,4,this.length),n.read(this,e,!1,23,4)},s.prototype.readDoubleLE=function(e,t){return e>>>=0,t||I(e,8,this.length),n.read(this,e,!0,52,8)},s.prototype.readDoubleBE=function(e,t){return e>>>=0,t||I(e,8,this.length),n.read(this,e,!1,52,8)};function L(e,t,n,r,i,a){if(!s.isBuffer(e))throw TypeError(`"buffer" argument must be a Buffer instance`);if(t>i||t<a)throw RangeError(`"value" argument is out of bounds`);if(n+r>e.length)throw RangeError(`Index out of range`)}s.prototype.writeUintLE=s.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){let r=2**(8*n)-1;L(this,e,t,n,r,0)}let i=1,a=0;for(this[t]=e&255;++a<n&&(i*=256);)this[t+a]=e/i&255;return t+n},s.prototype.writeUintBE=s.prototype.writeUIntBE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){let r=2**(8*n)-1;L(this,e,t,n,r,0)}let i=n-1,a=1;for(this[t+i]=e&255;--i>=0&&(a*=256);)this[t+i]=e/a&255;return t+n},s.prototype.writeUint8=s.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,1,255,0),this[t]=e&255,t+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};function R(e,t,n,r,i){re(t,r,i,e,n,7);let a=Number(t&BigInt(4294967295));e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,n}function z(e,t,n,r,i){re(t,r,i,e,n,7);let a=Number(t&BigInt(4294967295));e[n+7]=a,a>>=8,e[n+6]=a,a>>=8,e[n+5]=a,a>>=8,e[n+4]=a;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=o,o>>=8,e[n+2]=o,o>>=8,e[n+1]=o,o>>=8,e[n]=o,n+8}s.prototype.writeBigUInt64LE=$(function(e,t=0){return R(this,e,t,BigInt(0),BigInt(`0xffffffffffffffff`))}),s.prototype.writeBigUInt64BE=$(function(e,t=0){return z(this,e,t,BigInt(0),BigInt(`0xffffffffffffffff`))}),s.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){let r=2**(8*n-1);L(this,e,t,n,r-1,-r)}let i=0,a=1,o=0;for(this[t]=e&255;++i<n&&(a*=256);)e<0&&o===0&&this[t+i-1]!==0&&(o=1),this[t+i]=(e/a|0)-o&255;return t+n},s.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){let r=2**(8*n-1);L(this,e,t,n,r-1,-r)}let i=n-1,a=1,o=0;for(this[t+i]=e&255;--i>=0&&(a*=256);)e<0&&o===0&&this[t+i+1]!==0&&(o=1),this[t+i]=(e/a|0)-o&255;return t+n},s.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1},s.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2},s.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2},s.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},s.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4},s.prototype.writeBigInt64LE=$(function(e,t=0){return R(this,e,t,-BigInt(`0x8000000000000000`),BigInt(`0x7fffffffffffffff`))}),s.prototype.writeBigInt64BE=$(function(e,t=0){return z(this,e,t,-BigInt(`0x8000000000000000`),BigInt(`0x7fffffffffffffff`))});function B(e,t,n,r,i,a){if(n+r>e.length||n<0)throw RangeError(`Index out of range`)}function V(e,t,r,i,a){return t=+t,r>>>=0,a||B(e,t,r,4,34028234663852886e22,-34028234663852886e22),n.write(e,t,r,i,23,4),r+4}s.prototype.writeFloatLE=function(e,t,n){return V(this,e,t,!0,n)},s.prototype.writeFloatBE=function(e,t,n){return V(this,e,t,!1,n)};function H(e,t,r,i,a){return t=+t,r>>>=0,a||B(e,t,r,8,17976931348623157e292,-17976931348623157e292),n.write(e,t,r,i,52,8),r+8}s.prototype.writeDoubleLE=function(e,t,n){return H(this,e,t,!0,n)},s.prototype.writeDoubleBE=function(e,t,n){return H(this,e,t,!1,n)},s.prototype.copy=function(e,t,n,r){if(!s.isBuffer(e))throw TypeError(`argument should be a Buffer`);if(n||=0,!r&&r!==0&&(r=this.length),t>=e.length&&(t=e.length),t||=0,r>0&&r<n&&(r=n),r===n||e.length===0||this.length===0)return 0;if(t<0)throw RangeError(`targetStart out of bounds`);if(n<0||n>=this.length)throw RangeError(`Index out of range`);if(r<0)throw RangeError(`sourceEnd out of bounds`);r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);let i=r-n;return this===e&&typeof Uint8Array.prototype.copyWithin==`function`?this.copyWithin(t,n,r):Uint8Array.prototype.set.call(e,this.subarray(n,r),t),i},s.prototype.fill=function(e,t,n,r){if(typeof e==`string`){if(typeof t==`string`?(r=t,t=0,n=this.length):typeof n==`string`&&(r=n,n=this.length),r!==void 0&&typeof r!=`string`)throw TypeError(`encoding must be a string`);if(typeof r==`string`&&!s.isEncoding(r))throw TypeError(`Unknown encoding: `+r);if(e.length===1){let t=e.charCodeAt(0);(r===`utf8`&&t<128||r===`latin1`)&&(e=t)}}else typeof e==`number`?e&=255:typeof e==`boolean`&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw RangeError(`Out of range index`);if(n<=t)return this;t>>>=0,n=n===void 0?this.length:n>>>0,e||=0;let i;if(typeof e==`number`)for(i=t;i<n;++i)this[i]=e;else{let a=s.isBuffer(e)?e:s.from(e,r),o=a.length;if(o===0)throw TypeError(`The value "`+e+`" is invalid for argument "value"`);for(i=0;i<n-t;++i)this[i+t]=a[i%o]}return this};var U={};function W(e,t,n){U[e]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}W(`ERR_BUFFER_OUT_OF_BOUNDS`,function(e){return e?`${e} is outside of buffer bounds`:`Attempt to access memory outside buffer bounds`},RangeError),W(`ERR_INVALID_ARG_TYPE`,function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),W(`ERR_OUT_OF_RANGE`,function(e,t,n){let r=`The value of "${e}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=G(String(n)):typeof n==`bigint`&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=G(i)),i+=`n`),r+=` It must be ${t}. Received ${i}`,r},RangeError);function G(e){let t=``,n=e.length,r=+(e[0]===`-`);for(;n>=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function K(e,t,n){q(t,`offset`),(e[t]===void 0||e[t+n]===void 0)&&J(t,e.length-(n+1))}function re(e,t,n,r,i,a){if(e>n||e<t){let r=typeof t==`bigint`?`n`:``,i;throw i=a>3?t===0||t===BigInt(0)?`>= 0${r} and < 2${r} ** ${(a+1)*8}${r}`:`>= -(2${r} ** ${(a+1)*8-1}${r}) and < 2 ** ${(a+1)*8-1}${r}`:`>= ${t}${r} and <= ${n}${r}`,new U.ERR_OUT_OF_RANGE(`value`,i,e)}K(r,i,a)}function q(e,t){if(typeof e!=`number`)throw new U.ERR_INVALID_ARG_TYPE(t,`number`,e)}function J(e,t,n){throw Math.floor(e)===e?t<0?new U.ERR_BUFFER_OUT_OF_BOUNDS:new U.ERR_OUT_OF_RANGE(n||`offset`,`>= ${+!!n} and <= ${t}`,e):(q(e,n),new U.ERR_OUT_OF_RANGE(n||`offset`,`an integer`,e))}var Y=/[^+/0-9A-Za-z-_]/g;function ie(e){if(e=e.split(`=`)[0],e=e.trim().replace(Y,``),e.length<2)return``;for(;e.length%4!=0;)e+=`=`;return e}function X(e,t){t||=1/0;let n,r=e.length,i=null,a=[];for(let o=0;o<r;++o){if(n=e.charCodeAt(o),n>55295&&n<57344){if(!i){if(n>56319||o+1===r){(t-=3)>-1&&a.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&a.push(239,191,189),i=n;continue}n=(i-55296<<10|n-56320)+65536}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,n<128){if(--t<0)break;a.push(n)}else if(n<2048){if((t-=2)<0)break;a.push(n>>6|192,n&63|128)}else if(n<65536){if((t-=3)<0)break;a.push(n>>12|224,n>>6&63|128,n&63|128)}else if(n<1114112){if((t-=4)<0)break;a.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else throw Error(`Invalid code point`)}return a}function ae(e){let t=[];for(let n=0;n<e.length;++n)t.push(e.charCodeAt(n)&255);return t}function oe(e,t){let n,r,i,a=[];for(let o=0;o<e.length&&!((t-=2)<0);++o)n=e.charCodeAt(o),r=n>>8,i=n%256,a.push(i),a.push(r);return a}function se(e){return t.toByteArray(ie(e))}function Z(e,t,n,r){let i=0;for(;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function Q(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function ce(e){return e!==e}var le=(function(){let e=`0123456789abcdef`,t=Array(256);for(let n=0;n<16;++n){let r=n*16;for(let i=0;i<16;++i)t[r+i]=e[n]+e[i]}return t})();function $(e){return typeof BigInt>`u`?ue:e}function ue(){throw Error(`BigInt not supported`)}})),E=t(((e,t)=>{ace.define(`ace/ext/modelist`,[`require`,`exports`,`module`],function(e,t,n){var r=[];function i(e){for(var t=c.text,n=e.split(/[\/\\]/).pop(),i=0;i<r.length;i++)if(r[i].supportsFile(n)){t=r[i];break}return t}var a=function(){function e(e,t,n){this.name=e,this.caption=t,this.mode=`ace/mode/`+e,this.extensions=n;var r=/\^/.test(n)?n.replace(/\|(\^)?/g,function(e,t){return`$|`+(t?`^`:`^.*\\.`)})+`$`:`\\.(`+n+`)$`;this.extRe=new RegExp(r,`gi`)}return e.prototype.supportsFile=function(e){return e.match(this.extRe)},e}(),o={ABAP:[`abap`],ABC:[`abc`],ActionScript:[`as`],ADA:[`ada|adb`],Alda:[`alda`],Apache_Conf:[`^htaccess|^htgroups|^htpasswd|^conf|htaccess|htgroups|htpasswd`],Apex:[`apex|cls|trigger|tgr`],AQL:[`aql`],AsciiDoc:[`asciidoc|adoc`],ASL:[`dsl|asl|asl.json`],Assembly_ARM32:[`s`],Assembly_x86:[`asm|a`],Astro:[`astro`],AutoHotKey:[`ahk`],Basic:[`bas|bak`],BatchFile:[`bat|cmd`],BibTeX:[`bib`],C_Cpp:[`cpp|c|cc|cxx|h|hh|hpp|ino`],C9Search:[`c9search_results`],Cedar:[`cedar`],CedarSchema:[`cedarschema`],Cirru:[`cirru|cr`],Clojure:[`clj|cljs`],Clue:[`clue`],Cobol:[`CBL|COB`],coffee:[`coffee|cf|cson|^Cakefile`],ColdFusion:[`cfm|cfc`],Crystal:[`cr`],CSharp:[`cs`],Csound_Document:[`csd`],Csound_Orchestra:[`orc`],Csound_Score:[`sco`],CSS:[`css`],CSV:[`csv`],Curly:[`curly`],Cuttlefish:[`conf`],D:[`d|di`],Dart:[`dart`],Diff:[`diff|patch`],Django:[`djt|html.djt|dj.html|djhtml`],Dockerfile:[`^Dockerfile`],Dot:[`dot`],Drools:[`drl`],Edifact:[`edi`],Eiffel:[`e|ge`],EJS:[`ejs`],Elixir:[`ex|exs`],Elm:[`elm`],Erlang:[`erl|hrl`],Flix:[`flix`],Forth:[`frt|fs|ldr|fth|4th`],Fortran:[`f|f90`],FSharp:[`fsi|fs|ml|mli|fsx|fsscript`],FSL:[`fsl`],FTL:[`ftl`],Gcode:[`gcode`],GDResource:[`tres|tscn`],GDScript:[`gd`],GDShader:[`gdshader|gdshaderinc`],Gherkin:[`feature`],Gitignore:[`^.gitignore`],Glsl:[`glsl|frag|vert`],Gobstones:[`gbs`],golang:[`go`],GraphQLSchema:[`gql`],GROQ:[`groq`],Groovy:[`groovy`],HAML:[`haml`],Handlebars:[`hbs|handlebars|tpl|mustache`],Haskell:[`hs`],Haskell_Cabal:[`cabal`],haXe:[`hx`],Hjson:[`hjson`],HTML:[`html|htm|xhtml|we|wpy`],HTML_Elixir:[`eex|html.eex`],HTML_Ruby:[`erb|rhtml|html.erb`],INI:[`ini|conf|cfg|prefs`],Io:[`io`],Ion:[`ion`],Jack:[`jack`],Jade:[`jade|pug`],Java:[`java`],JavaScript:[`js|jsm|cjs|mjs`],JEXL:[`jexl`],JSON:[`json`],JSON5:[`json5`],JSONiq:[`jq`],JSP:[`jsp`],JSSM:[`jssm|jssm_state`],JSX:[`jsx`],Julia:[`jl`],Kotlin:[`kt|kts`],LaTeX:[`tex|latex|ltx|bib`],Latte:[`latte`],LESS:[`less`],Liquid:[`liquid`],Lisp:[`lisp`],LiveScript:[`ls`],LogiQL:[`logic|lql`],Logtalk:[`lgt`],LSL:[`lsl`],Lua:[`lua`],LuaPage:[`lp`],Lucene:[`lucene`],Makefile:[`^Makefile|^GNUmakefile|^makefile|^OCamlMakefile|make`],Markdown:[`md|markdown`],Mask:[`mask`],MATLAB:[`matlab`],Maze:[`mz`],MediaWiki:[`wiki|mediawiki`],MEL:[`mel`],MIPS:[`s|asm`],MIXAL:[`mixal`],MUSHCode:[`mc|mush`],MySQL:[`mysql`],Mariadb:[`mariadb`],Nasal:[`nas`],Nginx:[`nginx|conf`],Nim:[`nim`],Nix:[`nix`],NSIS:[`nsi|nsh|nsdinc`],Nunjucks:[`nunjucks|nunjs|nj|njk`],ObjectiveC:[`m|mm`],OCaml:[`ml|mli`],Odin:[`odin`],PartiQL:[`partiql|pql`],Pascal:[`pas|p`],Perl:[`pl|pm`],pgSQL:[`pgsql`],PHP:[`php|inc|phtml|shtml|php3|php4|php5|phps|phpt|aw|ctp|module`],PHP_Laravel_blade:[`blade.php`],Pig:[`pig`],PLSQL:[`plsql`],Powershell:[`ps1`],Praat:[`praat|praatscript|psc|proc`],Prisma:[`prisma`],Prolog:[`plg|prolog`],Properties:[`properties`],Protobuf:[`proto`],PRQL:[`prql`],Puppet:[`epp|pp`],Python:[`py`],QML:[`qml`],R:[`r`],Raku:[`raku|rakumod|rakutest|p6|pl6|pm6`],Razor:[`cshtml|asp`],RDoc:[`Rd`],Red:[`red|reds`],RHTML:[`Rhtml`],Robot:[`robot|resource`],RST:[`rst`],Ruby:[`rb|ru|gemspec|rake|^Guardfile|^Rakefile|^Gemfile`],Rust:[`rs`],SaC:[`sac`],SASS:[`sass`],SCAD:[`scad`],Scala:[`scala|sbt`],Scheme:[`scm|sm|rkt|oak|scheme`],Scrypt:[`scrypt`],SCSS:[`scss`],SH:[`sh|bash|^.bashrc`],SJS:[`sjs`],Slim:[`slim|skim`],Smarty:[`smarty|tpl`],Smithy:[`smithy`],snippets:[`snippets`],Soy_Template:[`soy`],Space:[`space`],SPARQL:[`rq`],SQL:[`sql`],SQLServer:[`sqlserver`],Stylus:[`styl|stylus`],SVG:[`svg`],Swift:[`swift`],Tcl:[`tcl`],Terraform:[`tf`,`tfvars`,`terragrunt`],Tex:[`tex`],Text:[`txt`],Textile:[`textile`],Toml:[`toml`],TSV:[`tsv`],TSX:[`tsx`],Turtle:[`ttl`],Twig:[`twig|swig`],Typescript:[`ts|mts|cts|typescript|str`],Vala:[`vala`],VBScript:[`vbs|vb`],Velocity:[`vm`],Verilog:[`v|vh|sv|svh`],VHDL:[`vhd|vhdl`],Visualforce:[`vfp|component|page`],Vue:[`vue`],Wollok:[`wlk|wpgm|wtest`],XML:[`xml|rdf|rss|wsdl|xslt|atom|mathml|mml|xul|xbl|xaml`],XQuery:[`xq`],YAML:[`yaml|yml`],Zeek:[`zeek|bro`],Zig:[`zig`]},s={ObjectiveC:`Objective-C`,CSharp:`C#`,golang:`Go`,C_Cpp:`C and C++`,Csound_Document:`Csound Document`,Csound_Orchestra:`Csound`,Csound_Score:`Csound Score`,coffee:`CoffeeScript`,HTML_Ruby:`HTML (Ruby)`,HTML_Elixir:`HTML (Elixir)`,FTL:`FreeMarker`,PHP_Laravel_blade:`PHP (Blade Template)`,Perl6:`Perl 6`,AutoHotKey:`AutoHotkey / AutoIt`},c={};for(var l in o){var u=o[l],d=(s[l]||l).replace(/_/g,` `),f=l.toLowerCase(),p=new a(f,d,u[0]);c[f]=p,r.push(p)}t.getModeForPath=i,t.modes=r,t.modesByName=c}),(function(){ace.require([`ace/ext/modelist`],function(n){typeof t==`object`&&typeof e==`object`&&t&&(t.exports=n)})})()})),D=T(),O=e(f(),1);E(),n();var k=O.require?O.require(`ace/ext/modelist`):O.acequire(`ace/ext/modelist`),A=class e extends v{constructor(e){super(e),i(this,`writeFile64`,()=>{let e=this.props.href.split(`/`),t=this.state.editingValue||``;e.splice(0,2);let n=e[0],r=e.splice(1).join(`/`);this.props.socket.writeFile64(n,r,D.Buffer.from(t).toString(`base64`)).then(()=>this.props.onClose()).catch(e=>window.alert(`Cannot write file: ${e}`))}),Object.assign(this.state,{editing:!!this.props.formatEditFile||!1})}static getEditFile(e){switch(e){case`json`:return`json`;case`json5`:return`json5`;case`js`:return`javascript`;case`html`:return`html`;case`txt`:return`html`;default:return k.getModeForPath(`testFile.${e}`).mode.split(`/`).pop()||`text`}}getEditorOrViewer(){return l(x,{mode:e.getEditFile(this.props.formatEditFile),themeType:this.props.themeType,value:this.state.editingValue||this.state.code||this.state.text||void 0,onChange:this.state.editing?e=>this.setState({editingValue:e,changed:!0}):void 0})}onSave(){this.writeFile64()}},j=[{Owner:[{name:`read`,valueNum:1024,title:`read owner`},{name:`write`,valueNum:512,title:`write owner`}]},{Group:[{name:`read`,valueNum:64,title:`read group`},{name:`write`,valueNum:32,title:`write group`}]},{Everyone:[{name:`read`,valueNum:4,title:`read everyone`},{name:`write`,valueNum:2,title:`write everyone`}]}],M=(e,t,n)=>(e|=t&n,e&=t|~n&65535,e),ee=({value:e,setValue:t,t:n,differentValues:i,applyToChildren:a,mask:o,setMask:s,disabled:c})=>{p(()=>{if(a){let t=0;for(let n=0;n<i.length;n++)t|=e^i[n];s(t)}else s(0)},[i,a,s,e]);let d=new Set,f=e;for(let e of j)for(let t of e[Object.keys(e)[0]])f-t.valueNum>=0&&(f-=t.valueNum,d.add(t.valueNum));return l(`div`,{style:{display:`flex`,width:`fit-content`,margin:20,border:`1px solid`,borderLeft:0},children:j.map(i=>{let a=Object.keys(i)[0];return u(`div`,{style:{width:150,height:150,display:`flex`,flexDirection:`column`,alignItems:`center`,borderLeft:`1px solid`},children:[l(`div`,{style:{height:50,display:`flex`,alignItems:`center`,fontSize:18,borderBottom:`1px solid silver`,width:`100%`,justifyContent:`center`},children:n(a)}),l(`div`,{style:{display:`flex`,width:`100%`},children:i[a].map((i,a)=>{let f=d.has(i.valueNum),p=o&i.valueNum;return u(`div`,{style:{display:`flex`,flexDirection:`column`,flex:1,alignItems:`center`,borderRight:a===0?`1px solid`:0},children:[l(`div`,{style:{height:50,borderBottom:`1px solid`,width:`100%`,justifyContent:`center`,display:`flex`,alignItems:`center`,color:`silver`},children:n(i.name)}),l(`div`,{style:{height:50,display:`flex`},children:l(r,{disabled:c,checked:f,color:p?`primary`:`secondary`,indeterminate:!!p,style:p?{opacity:.5}:void 0,onChange:n=>{p&&(o&=~i.valueNum&65535,s(o));let r=e;n.target.checked?r|=i.valueNum:r&=~i.valueNum&65535,t(r)}})})]},i.valueNum)})})]},a)})})};async function N(e,t,n){let r=t[e];if(!r){let i=e.split(`/`),a=i.length,o=i.shift()||null,s=i.join(`/`),c=await n.readDir(o,s);t[e]=[];for(let n=0;n<c.length;n++){let r=c[n],i={id:`${e}/${r.file}`,ext:b.getFileExtension(r.file),folder:r.isDir,name:r.file,size:r.stats&&r.stats.size,modified:r.modifiedAt,acl:r.acl,level:a};t[e].push(i)}r=t[e]}for(let e=0;e<r.length;e++){let i=r[e];i.folder&&await N(i.id,t,n)}}function te(e){let t={};return Object.keys(e).forEach(n=>{t[n]={folder:!0,id:n,level:0,name:n},e[n].forEach(e=>{t[e.id]=e})}),t}async function P(e,t,n,r=``,i=``,a=0){if(typeof n==`string`&&(n=n.split(`/`),a=0,r=n.shift()||``,i=``),!(n.length>=a)){if(t[r+i]){if(n.length-1===a){let o=`${r+i}/${n[a]}`,s=t[r+i].find(e=>e.id===o);s&&s.folder&&await N(r+i,t,e);return}i+=`/${n[a]}`,await P(e,t,n,r,i,a+1)}else{let o=await e.readDir(r||null,i);t[r+i]=[],o.forEach(e=>{let n={id:`${i}/${e.file}`,ext:b.getFileExtension(e.file),folder:e.isDir,name:e.file,size:e.stats&&e.stats.size,modified:e.modifiedAt,acl:e.acl,level:a};t[r+i].push(n)}),await P(e,t,n,r,i,a+1)}}}var F=`different`,ne=({onClose:e,onApply:t,selected:n,applyChangesToObject:r,applyChangesToFile:i,objects:s,t:f,themeType:m,folders:g,socket:_,theme:v})=>{let y=n.substring(0,n.lastIndexOf(`/`))||n,b=(n.split(`/`).length===1?g[`/`].find(({id:e})=>e===n):g[y].find(({id:e})=>e===n))||{},[x,C]=h(null),[w,T]=h(null),[E,D]=h([]),[O,k]=h([]),[A,j]=h(!1),[N,ne]=h(0),[I,L]=h(null),[R,z]=h(!1),[B,V]=h(!1),[H,U]=h([]),[W,G]=h(0),[K,re]=h([]),[q,J]=h(!0),[Y,ie]=h(!1),X=c.getLanguage();return p(()=>{let e=[],t=b.id,n=!1,r=!1,i=null,a=null,o=null,c=[],l=0;P(_,g,t).then(()=>{let u=te(g),d=`${t}/`;Object.keys(u).forEach(f=>{if(f!==`/`&&(f===t||f.startsWith(d))){if(!f.includes(`/`)&&s[f]){var p,m,h,g,_,v,y,b,x;let t=s[f];l++,c.push(t),o===null&&((p=t.acl)==null?void 0:p.file)!==void 0&&(o=t.acl.file),i===null&&((m=t.acl)==null?void 0:m.owner)!==void 0&&(i=t.acl.owner),a===null&&((h=t.acl)==null?void 0:h.ownerGroup)!==void 0&&(a=t.acl.ownerGroup),!R&&i!==((g=t.acl)==null?void 0:g.owner)&&((_=t.acl)==null?void 0:_.owner)!==void 0&&(n=!0),!B&&a!==((v=t.acl)==null?void 0:v.ownerGroup)&&((y=t.acl)==null?void 0:y.ownerGroup)!==void 0&&(r=!0),((b=t.acl)==null?void 0:b.file)!==void 0&&o!==((x=t.acl)==null?void 0:x.file)&&!e.includes(t.acl.file)&&e.push(t.acl.file)}else if(!u[f].folder){var S,C,w,T,E,D;l++;let t=u[f];if(c.push(t),o===null&&t.acl.permissions!==void 0&&(o=t.acl.permissions),i===null&&((S=t.acl)==null?void 0:S.owner)!==void 0){var O;i=(O=t.acl)==null?void 0:O.owner}if(a===null&&((C=t.acl)==null?void 0:C.ownerGroup)!==void 0){var k;a=(k=t.acl)==null?void 0:k.ownerGroup}!R&&i!==((w=t.acl)==null?void 0:w.owner)&&((T=t.acl)==null?void 0:T.owner)!==void 0&&(n=!0),!B&&a!==((E=t.acl)==null?void 0:E.ownerGroup)&&((D=t.acl)==null?void 0:D.ownerGroup)!==void 0&&(r=!0),t.acl.permissions!==void 0&&o!==t.acl.permissions&&!e.includes(t.acl.permissions)&&e.push(t.acl.permissions)}}});let f=[],p=[];Object.keys(s).forEach(e=>{let t=s[e];e.startsWith(`system.group.`)&&(t==null?void 0:t.type)===`group`?p.push(t):e.startsWith(`system.user.`)&&(t==null?void 0:t.type)===`user`&&f.push(t)});let m=s[`system.config`].common.defaultNewAcl;i||=m.owner,a||=m.ownerGroup,o||=m.file,L(o),C(i),T(a),z(n),V(r),D(f),k(p),b!=null&&b.folder&&j(!0),ne(l),U(e),re(c)})},[s,n]),p(()=>{if(A)R&&x!==F&&C(F),B&&w!==F&&T(F);else{if(x&&x===F){var e;C(((e=s[n])==null||(e=e.acl)==null?void 0:e.owner)||null)}if(w&&w===F){var t;T(((t=s[n])==null||(t=t.acl)==null?void 0:t.ownerGroup)||null)}}console.log(`stateOwnerUser ${x}`)},[A,x,w,R,B]),K.length?l(S,{theme:v,titleButtonApply:`apply`,overflowHidden:!0,disableApply:q,progress:Y,onClose:e,onApply:()=>{ie(!0),setTimeout(async()=>{var e;let n=((e=s[`system.config`].common)==null||(e=e.defaultNewAcl)==null?void 0:e.file)||1636;if(A){let e=~W&65535;for(let t=0;t<K.length;t++){let s=K[t],m=!1,h=s,g=s;if(h._id){var a,o,c,l;let t=M(((a=h.acl)==null?void 0:a.file)||n,I??0,e);t!==((o=h.acl)==null?void 0:o.file)&&(h.acl=h.acl||{},h.acl.file=t,m=!0),x!==F&&x!==((c=h.acl)==null?void 0:c.owner)&&(h.acl=h.acl||{},h.acl.owner=x??``,m=!0),w!==F&&w!==((l=h.acl)==null?void 0:l.ownerGroup)&&(h.acl=h.acl||{},h.acl.ownerGroup=w??``,m=!0);try{m&&await r(h)}catch(e){console.error(e)}}else if(g&&!g.folder){var u,d,f,p;let t={},r=M(((u=g.acl)==null?void 0:u.permissions)||n,I??0,e);if(r!==((d=g.acl)==null?void 0:d.permissions)&&(t.permissions=r,m=!0),x!==F&&x!==((f=g.acl)==null?void 0:f.owner)&&(t.owner=x??void 0,m=!0),w!==F&&w!==((p=g.acl)==null?void 0:p.ownerGroup)&&(t.ownerGroup=w??void 0,m=!0),m){let e=g.id.split(`/`),n=e.shift()||``,r=e.join(`/`);try{await i(n,r,t)}catch(e){console.error(e)}}}}}else{let e=b.id.split(`/`),t=e.shift()||``,n=e.join(`/`),a={},o=!1;if(!b.folder){var m,h,g;((m=b.acl)==null?void 0:m.permissions)!==I&&(a.permissions=I??void 0,o=!0),((h=b.acl)==null?void 0:h.owner)!==x&&(a.owner=x??void 0,o=!0),((g=b.acl)==null?void 0:g.ownerGroup)!==w&&(a.ownerGroup=w??void 0,o=!0),o&&await i(t,n,a)}else if(!e.length&&s[b.id]){var _,v,y;let e=s[b.id];((_=e.acl)==null?void 0:_.file)!==I&&(e.acl=e.acl||{},e.acl.file=I??0,o=!0),((v=e.acl)==null?void 0:v.owner)!==x&&(e.acl=e.acl||{},e.acl.owner=x??``,o=!0),((y=e.acl)==null?void 0:y.ownerGroup)!==w&&(e.acl=e.acl||{},e.acl.ownerGroup=w??``,o=!0),o&&await r(e)}}ie(!1),t()},200)},children:u(`div`,{style:{display:`flex`,flexDirection:`column`},children:[l(`div`,{style:{margin:10,fontSize:20},children:f(`Access control list: %s`,n)}),u(`div`,{style:{display:`flex`},children:[l(a,{fullWidth:!0,style:{marginRight:10},label:f(`Owner user`),lang:X,list:E,t:f,disabled:Y,value:x||void 0,themeType:m,different:R?F:!1,onChange:e=>{z(!1),C(e),J(!1)}}),l(a,{fullWidth:!0,label:f(`Owner group`),lang:X,list:O,t:f,disabled:Y,value:w||void 0,themeType:m,different:B?F:!1,onChange:e=>{V(!1),T(e),J(!1)}})]}),u(`div`,{style:{display:`flex`,margin:10,alignItems:`center`,fontSize:10,marginLeft:0,color:`silver`},children:[l(`div`,{style:!b.folder||!A?{color:`green`}:void 0,children:f(`to apply one item`)}),l(o,{disabled:K.length===1||Y,checked:!s[b.id]&&!!b.folder||A,onChange:e=>{j(e.target.checked),J(!1)},color:`primary`}),u(`div`,{style:b.folder||A?{color:`green`}:void 0,children:[f(`to apply with children`),` `,b.folder||N>1?`(${N} ${f(`object(s)`)})`:``]})]}),Y&&l(d,{}),l(`div`,{style:{overflowY:`auto`},children:u(`div`,{children:[l(`h2`,{children:f(`File rights`)}),l(ee,{disabled:Y,mask:W,setMask:G,applyToChildren:A,differentValues:H,t:f,setValue:e=>{L(e),J(!1)},value:I??0})]})})]})}):l(d,{})};n();var I=[`select`,`view`],L=class e extends g{constructor(e){super(e),i(this,`t`,void 0),i(this,`wordCache`,void 0),i(this,`objects`,void 0),i(this,`navigateTo`,null),i(this,`translate`,(e,t,n)=>t===void 0?(this.wordCache[e]||(this.wordCache[e]=this.props.t(e)),this.wordCache[e]):this.props.t(e,t,n)),this.t=this.translate,this.wordCache={},this.objects={}}componentDidMount(){this.props.socket.getObjects(!0,!0).then(e=>this.objects=e)}static isAppDialogOpen(){let e=m.getLocation().dialog;return!!e&&!I.includes(e)}renderAclDialog(e){return l(ne,{theme:this.props.theme,themeType:this.props.themeType,applyChangesToObject:async t=>{let n=await this.props.socket.getObject(t._id);n.acl=t.acl,await this.props.socket.setObject(n._id,n);let r=n;r!=null&&r.acl&&e.updateItemsAcl([{id:r._id,acl:r.acl,level:0,name:r._id,folder:!1}])},applyChangesToFile:async(t,n,r)=>{let i=r||{},a;if((i.owner||i.ownerGroup)&&i.permissions?(await this.props.socket.chownFile(t,n,{owner:i.owner,ownerGroup:i.ownerGroup}),a=await this.props.socket.chmodFile(t,n,{mode:i.permissions})):i.permissions?a=await this.props.socket.chmodFile(t,n,{mode:i.permissions}):(i.owner||i.ownerGroup)&&(a=await this.props.socket.chownFile(t,n,{owner:i.owner,ownerGroup:i.ownerGroup})),Array.isArray(a))for(let n=0;n<a.length;n++){let r=a[n];r&&r.file&&r.acl&&e.updateItemsAcl([{id:`${t}/${r.path?`${r.path}/`:``}${r.file}`,acl:r.acl,level:0,name:``,folder:!1}])}},selected:e.state.selected,folders:e.state.folders,objects:this.objects,socket:this.props.socket,t:this.t,onClose:()=>e.setState({modalEditOfAccess:!1}),onApply:()=>e.setState({modalEditOfAccess:!1})})}render(){if(!this.props.ready)return l(d,{});if(!e.isAppDialogOpen()){let e=m.getLocation();this.navigateTo=e.tab===`tab-files`&&e.id?{mode:e.dialog===`view`?`view`:`select`,id:e.id}:null}let t=this.navigateTo;return l(s,{children:l(y,{overflow:`auto`,children:l(_,{navigateTo:t,onNavigateTo:t=>{e.isAppDialogOpen()||(t!=null&&t.id?m.doNavigate(`tab-files`,t.mode,t.id):m.doNavigate(`tab-files`))},showViewTypeButton:!0,ready:this.props.ready,socket:this.props.socket,themeType:this.props.themeType,theme:this.props.theme,lang:this.props.lang,t:this.props.t,showToolbar:!0,allowUpload:!0,allowView:!0,allowDownload:!0,allowCreateFolder:!0,allowDelete:!0,expertMode:this.props.expertMode,modalEditOfAccessControl:e=>this.renderAclDialog(e),FileViewer:A})})})}};export{L as default};
|