iobroker.eos-admin 8.0.0 → 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 +7 -6
- package/NEXOWATT_EOS_PREBUILT_MANIFEST.json +195 -107
- package/START_HERE_8.0.1.md +36 -0
- 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-B3y8RL_5.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-CFuOc_kb.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-DnckPMA8.js → Fields-C2Bn4V04.js} +1 -1
- package/adminWww/assets/{Files-CwUHx0pF.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-WwP6FjK-.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-CMTzFOX3.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-Bs4TZ7iA.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-2xIZYDSq.js → hostInit-Cd61hJHh.js} +1 -1
- package/adminWww/assets/{icons-material-BLgrEUSv.js → icons-material-Dms1APQk.js} +1 -1
- package/adminWww/assets/{index-BZifaJHi.js → index-D6uhIclX.js} +2 -2
- package/adminWww/assets/{installSVGRenderer-Pe6-VnD2.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-a6a54377.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.0.js → remoteEntry-eos-8.0.2.js} +2 -2
- package/adminWww/remoteEntry.js +1 -1
- package/build/lib/eosSessionSecurity.js +12 -4
- package/build/lib/eosSessionSecurity.js.map +1 -1
- package/build/lib/vendor/webserver/LICENSE +21 -0
- package/build/lib/vendor/webserver/README.md +506 -0
- package/build/lib/vendor/webserver/build/index.d.ts +9 -0
- package/build/lib/vendor/webserver/build/index.js +42 -0
- package/build/lib/vendor/webserver/build/index.js.map +1 -0
- package/build/lib/vendor/webserver/build/lib/acmeChallenge.d.ts +65 -0
- package/build/lib/vendor/webserver/build/lib/acmeChallenge.js +149 -0
- package/build/lib/vendor/webserver/build/lib/acmeChallenge.js.map +1 -0
- package/build/lib/vendor/webserver/build/lib/certificateManager.d.ts +60 -0
- package/build/lib/vendor/webserver/build/lib/certificateManager.js +128 -0
- package/build/lib/vendor/webserver/build/lib/certificateManager.js.map +1 -0
- package/build/lib/vendor/webserver/build/lib/http2Compat.d.ts +21 -0
- package/build/lib/vendor/webserver/build/lib/http2Compat.js +109 -0
- package/build/lib/vendor/webserver/build/lib/http2Compat.js.map +1 -0
- package/build/lib/vendor/webserver/build/lib/oauth2-authcode.d.ts +167 -0
- package/build/lib/vendor/webserver/build/lib/oauth2-authcode.js +619 -0
- package/build/lib/vendor/webserver/build/lib/oauth2-authcode.js.map +1 -0
- package/build/lib/vendor/webserver/build/lib/oauth2-clients.d.ts +92 -0
- package/build/lib/vendor/webserver/build/lib/oauth2-clients.js +230 -0
- package/build/lib/vendor/webserver/build/lib/oauth2-clients.js.map +1 -0
- package/build/lib/vendor/webserver/build/lib/oauth2-model.d.ts +84 -0
- package/build/lib/vendor/webserver/build/lib/oauth2-model.js +388 -0
- package/build/lib/vendor/webserver/build/lib/oauth2-model.js.map +1 -0
- package/build/lib/vendor/webserver/build/lib/oauth2.d.ts +75 -0
- package/build/lib/vendor/webserver/build/lib/oauth2.js +625 -0
- package/build/lib/vendor/webserver/build/lib/oauth2.js.map +1 -0
- package/build/lib/vendor/webserver/build/lib/securityChecker.d.ts +6 -0
- package/build/lib/vendor/webserver/build/lib/securityChecker.js +96 -0
- package/build/lib/vendor/webserver/build/lib/securityChecker.js.map +1 -0
- package/build/lib/vendor/webserver/build/lib/usedResources.d.ts +62 -0
- package/build/lib/vendor/webserver/build/lib/usedResources.js +231 -0
- package/build/lib/vendor/webserver/build/lib/usedResources.js.map +1 -0
- package/build/lib/vendor/webserver/build/lib/utils.d.ts +35 -0
- package/build/lib/vendor/webserver/build/lib/utils.js +110 -0
- package/build/lib/vendor/webserver/build/lib/utils.js.map +1 -0
- package/build/lib/vendor/webserver/build/lib/webServer.d.ts +164 -0
- package/build/lib/vendor/webserver/build/lib/webServer.js +454 -0
- package/build/lib/vendor/webserver/build/lib/webServer.js.map +1 -0
- package/build/lib/vendor/webserver/package.json +63 -0
- package/build/lib/web.js +26 -6
- package/build/lib/web.js.map +1 -1
- package/docs/ADMIN8_MIGRATION_8.0.0_DE.md +4 -0
- package/docs/cra/CRA_IEC_GAP_ANALYSIS_2026-09-30.md +10 -0
- package/docs/security/admin8-2026-11-04/development-1.log +4 -4
- package/docs/security/admin8-2026-11-04/development-2.log +275 -233
- package/docs/security/admin8-2026-11-05/copy-update/evidence-sha256.json +0 -5
- package/docs/security/admin8-2026-11-05/login-fix/BACKEND_DIAGNOSE_DE.md +48 -0
- package/docs/security/admin8-2026-11-05/login-fix/REPORT_DE.md +47 -0
- package/docs/security/admin8-2026-11-05/login-fix/REVIEW_DE.md +7 -0
- package/docs/security/admin8-2026-11-05/login-fix/controller-adapter-api.ts.txt +122 -0
- package/docs/security/admin8-2026-11-05/login-fix/controller-file-view.ts.txt +75 -0
- package/docs/security/admin8-2026-11-05/login-fix/controller-redis-view.ts.txt +471 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/LICENSE-webserver-3.4.0 +21 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/REPORT_DE.md +41 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/evidence-sha256.json +116 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/http-consumer-check.cjs +58 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/rejected-file-dependency/README_DE.md +9 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/rejected-file-dependency/REJECTED-webserver-3.4.0-eos-oauth.provenance.json +263 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/rejected-file-dependency/REJECTED-webserver-3.4.0-eos-oauth.tgz +0 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/rejected-file-dependency/admission.log +16 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/rejected-file-dependency/consumer-audit-stderr.log +1 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/rejected-file-dependency/consumer-audit.json +22 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/rejected-file-dependency/consumer-fixture-1.0.0.tgz +0 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/rejected-file-dependency/consumer-fixture-package.json +11 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/rejected-file-dependency/consumer-npm10-package-lock.json +387 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/rejected-file-dependency/consumer-npm11-package-lock.json +387 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/rejected-file-dependency/evidence-sha256.json +85 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/rejected-file-dependency/http-consumer-npm10-node22.json +11 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/rejected-file-dependency/http-consumer-npm11-node24.json +11 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/rejected-file-dependency/local-tests.json +38 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/rejected-file-dependency/tests-node22.log +168 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/rejected-file-dependency/tests-node24.log +36 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/source-vendor-tests-node22.log +224 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/source-vendor-tests-node24.log +42 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/source-vendor-tests.json +31 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/webserver-3.4.0-upstream.tgz +0 -0
- package/docs/security/admin8-2026-11-05/login-fix/eos-session-8.0.0.js.txt +385 -0
- package/docs/security/admin8-2026-11-05/login-fix/evidence-sha256.json +59 -0
- package/docs/security/admin8-2026-11-05/login-fix/path-budget.json +6 -0
- package/docs/security/admin8-2026-11-05/login-fix/provenance.json +51 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/admission.log +21 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/archive-scan.json +13 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/artifacts.log +6 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/backend-build.log +5 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/consumer-package-lock.json +3258 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/copy-update-journal.json +165 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/development.log +365 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/frontend-build.log +149 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/full-consumer-audit.json +22 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/full-consumer-audit.stderr +2 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/full-consumer-final-install-node22.log +9 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/full-consumer-http-node22.json +15 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/full-consumer-http-node22.stderr +2 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/full-consumer-http-node24.json +15 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/full-consumer-http-node24.stderr +0 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/inventory.log +8 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/npm-pack-final.json +7809 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/npm-pack-final.stderr +6 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/overlay-final-publish-node22.json +10213 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/overlay-final-publish-node22.stderr +282 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/pipeline.json +72 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/seal.log +6 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/vendor-final-review-node24.log +18 -0
- package/docs/security/admin8-2026-11-05/login-fix/reproduce.cjs +79 -0
- package/docs/security/admin8-2026-11-05/login-fix/reproduction.json +80 -0
- package/docs/security/admin8-2026-11-05/login-fix/upstream-LICENSE.txt +22 -0
- package/docs/security/admin8-2026-11-05/login-fix/validation.json +85 -0
- 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 +3 -3
- package/io-package.json +13 -15
- package/package.json +10 -4
- package/release-manifests/admin8-development-validation.json +136 -43
- package/reports/security/artifact-inventory.json +822 -587
- package/reports/security/inventory-summary.json +39 -17
- package/reports/security/sbom-backend-lock.cdx.json +108 -111
- package/reports/security/sbom-frontend-lock.cdx.json +5 -5
- package/reports/security/source-runtime-manifest.json +553 -163
- package/tools/nexowatt-admin8-development-check.cjs +8 -1
- package/tools/nexowatt-artifact-inventory.cjs +8 -1
- package/tools/nexowatt-installer-ems-selftest.cjs +1 -1
- package/tools/nexowatt-lock-provenance-check.cjs +8 -3
- package/tools/nexowatt-repair-lock-metadata.cjs +3 -3
- package/tools/nexowatt-role-security-selftest.cjs +2 -2
- package/tools/nexowatt-security-inventory.cjs +22 -1
- package/tools/nexowatt-user-area-selftest.cjs +1 -1
- package/tools/nexowatt-v7109-clean-core-selftest.cjs +1 -1
- package/tools/nexowatt-vendored-webserver.cjs +69 -0
- package/tools/vendor/eos-retired-release-files.json +268 -1
- package/tools/vendor/webserver-3.4.0-source.provenance.json +244 -0
- package/adminWww/assets/Adapters-BDxfhfGe.js +0 -7
- package/adminWww/assets/EasyMode-TwIN5yxu.js +0 -1
- package/adminWww/assets/Enums-CSzSzWm7.js +0 -92
- package/adminWww/assets/Hosts-QkyuASJy.js +0 -120
- package/adminWww/assets/Instances-BaWBemTT.js +0 -4
- package/adminWww/assets/Intro-DsfrPrWv.js +0 -2
- package/adminWww/assets/Logs-Cngy2Opt.js +0 -2
- package/adminWww/assets/Objects-DY8KS7zK.js +0 -301
- package/adminWww/assets/Remove-DplJatnC.js +0 -1
- package/adminWww/assets/State-vP1o2BCL.js +0 -1
- package/adminWww/assets/Storage-COo2RkS1.js +0 -1
- package/adminWww/assets/Users-BjTGOjzL.js +0 -1
- package/adminWww/assets/ViewList-DuKCnBnc.js +0 -1
- package/adminWww/assets/helpers-DBoACUHw.js +0 -1
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{$a as e,$o as t,$s as n,An as r,Ar as i,Br as a,Bs as o,Ci as s,Ds as c,Eo as l,Es as u,Fo as d,Ga as f,Go as p,Gr as m,Ho as h,Hs as g,Jo as _,Js as v,Ka as ee,Ls as y,Mo as b,Ni as te,No as x,On as ne,Oo as re,Os as ie,Pi as ae,Qo as oe,Rr as se,Rs as ce,So as le,To as ue,Tr as S,Ua as de,Ui as fe,Us as C,Vo as pe,Ws as w,Xn as me,Yo as he,Zo as T,_o as E,as as ge,ba as _e,bo as D,br as ve,ca as ye,co as be,da as xe,ei as Se,eo as Ce,es as we,fa as Te,gs as Ee,ho as O,io as De,is as Oe,ja as ke,jo as k,ki as Ae,kn as je,ls as Me,ma as Ne,mo as A,ms as j,nc as M,no as N,oo as P,po as Pe,ps as Fe,qa as F,qo as I,r as L,ro as Ie,rs as Le,sc as Re,ss as R,ta as ze,tn as Be,to as Ve,ts as He,uo as z,us as B,vi as Ue,wi as We,wo as Ge,zo as Ke,zr as qe,zs as Je}from"./loadShare-eager-BpwDZfDr.js";import{a as Ye,c as Xe,d as Ze,f as Qe,i as $e,l as et,n as tt,o as nt,p as rt,r as it,s as at,t as ot,u as st}from"./Star-ChMjBwLn.js";import{f as ct}from"./WifiTethering-Cp63fmkC.js";import{t as lt}from"./DeleteForever-Caoe64_y.js";import{t as ut}from"./Remove-BPxvNccW.js";import{t as dt}from"./ViewList-1pB5VinA.js";import{n as ft,o as pt,r as mt,t as ht}from"./AdminUtils-CopxRJZ2.js";import{A as gt,E as _t,F as V,I as vt,O as yt,Q as bt,_t as xt,i as St,j as Ct,n as wt,q as Tt}from"./bootstrap-DSDOwKWU.js";import{n as Et,r as Dt,t as Ot}from"./sentry-BFzW-2KQ.js";import{i as kt,n as At,r as jt,t as Mt}from"./AdapterUpdateDialog-QwlPbETd.js";import{t as Nt}from"./CustomModal-DjI4oCb8.js";c();var H={smallAvatar:{width:24,height:24},listItem:e=>({mb:`2px`,background:e.palette.background,"@media screen and (max-width: 400px)":{pl:`2px`}}),toVersion:e=>({color:e.palette.mode===`dark`?`#00dc00`:`#008100`,fontWeight:`bold`,ml:`4px`}),updateDone:{background:`#5ef05e80`,opacity:.7},minWidthCss:{"@media screen and (max-width: 400px)":{minWidth:32}},wrapperButton:{},typography:{paddingRight:30},versions:{minWidth:110,display:`inline-block`},closeButton:e=>({position:`absolute`,right:8,top:8,color:e.palette.grey[500]}),languageButton:{position:`absolute`,right:60,top:8},languageButtonActive:e=>({color:e.palette.primary.main}),versionHeader:e=>({background:`#4dabf5`,borderRadius:`3px`,pl:`10px`,fontWeight:`bold`,color:e.palette.mode===`dark`?`black`:`white`}),repoStableVersionText:e=>({color:e.palette.mode===`dark`?`#8dff7a`:`#2b9800`,fontWeight:`bold`,marginLeft:`4px`}),repoLatestVersionText:e=>({color:e.palette.mode===`dark`?`#a3fcff`:`#005498`,fontWeight:`bold`,marginLeft:`4px`})},Pt=class e extends M{constructor(e){super(e),u(this,`updateAvailable`,void 0),u(this,`initialVersions`,void 0),u(this,`currentRef`,void 0),u(this,`current`,void 0),this.updateAvailable=this.detectUpdates(),this.initialVersions={},this.updateAvailable.forEach(e=>this.initialVersions[e]=this.props.installed[e].version),this.state={showNews:null},this.currentRef=v.createRef(),this.current=e.current,this.props.onUpdateSelected([...this.updateAvailable],this.updateAvailable)}static isUpdateAvailable(e){let{oldVersion:t,newVersion:n,name:r}=e;try{return L.gt(n,t)}catch{return console.warn(`Cannot compare "${n}" and "${t}" of adapter ${r}`),!1}}detectUpdates(){let t=[];return Object.keys(this.props.repository).forEach(n=>{let r=this.props.installed[n];n!==`js-controller`&&n!==`admin`&&n!==`eos-admin`&&r&&this.props.repository[n].version&&r.ignoreVersion!==this.props.repository[n].version&&e.isUpdateAvailable({oldVersion:r.version,newVersion:this.props.repository[n].version,name:n})&&(At(this.props.repository[n].messages,r.version,this.props.repository[n].version)?console.log(`Adapter ${n} is filtered out from update all functionality, because it has messages which need to be read before update`):this.props.rightDependenciesFunc(n)?t.push(n):console.log(`Adapter ${n} is filtered out from update all functionality, because its dependencies are not met`))}),t.sort(),t}getNews(e){let t=this.props.repository[e],n=this.props.installed[e],r=[],i=t==null?void 0:t.news;return n&&i&&Object.keys(i).forEach(t=>{try{L.gt(t,n.version)&&r.push({version:t,news:this.props.noTranslation?i[t].en:i[t][this.props.lang]||i[t].en})}catch{console.warn(`Cannot compare "${t}" and "${n.version}" of adapter ${e}`)}}),r}renderOneAdapter(e){var t;let n=this.props.selected.includes(e);if((this.props.finished||this.props.inProcess)&&!n||!this.props.installed[e])return null;let r=this.props.installed[e].localIcon,i=r?`.${r}`:((t=this.props.repository[e])==null?void 0:t.extIcon)||`img/no-image.svg`;return w(we,{dense:!0,sx:{"&.MuiListItem-root":m.getStyle(this.props.theme,H.listItem,this.props.updated.includes(e)&&H.updateDone)},ref:this.props.current===e?this.currentRef:null,secondaryAction:!this.props.finished&&!this.props.inProcess?C(l,{edge:`end`,checked:n,tabIndex:-1,disableRipple:!0,disabled:this.props.inProcess,onClick:()=>{let t=[...this.props.selected],n=t.indexOf(e);n===-1?(t.push(e),t.sort()):t.splice(n,1),this.props.onUpdateSelected(t)}}):this.props.current===e&&!this.props.stopped&&!this.props.finished&&C(re,{}),children:[C(Le,{sx:H.minWidthCss,children:C(Ee,{variant:`square`,alt:e,src:i,style:H.smallAvatar})}),C(Oe,{primary:e,title:this.getNews(e).map(e=>`${e.version}: ${e.news}`).join(`
|
|
2
|
+
`),secondary:w(`span`,{children:[w(`div`,{style:H.versions,children:[this.initialVersions[e],` →`,C(E,{component:`span`,sx:H.toVersion,children:this.props.repository[e].version})]}),C(I,{title:S.t(`Show change log`),onClick:()=>this.setState({showNews:{adapter:e,version:this.props.repository[e].version,fromVersion:this.initialVersions[e]}}),size:`small`,children:C(ze,{})})]})})]},e)}getReactNews(e,t){let n=this.props.repository[e],r=this.props.installed[e];t||=r.version;let i=[],a,o,s=this.props.repository._repoInfo;if(s!=null&&s.stable){var c,l;a=(c=this.props.repository[e])==null?void 0:c.version,o=(l=this.props.repository[e])==null?void 0:l.latestVersion}else{var u,d;a=(u=this.props.repository[e])==null?void 0:u.stable,o=(d=this.props.repository[e])==null?void 0:d.version}let f=n==null?void 0:n.news;return r&&f&&Object.keys(f).forEach(n=>{try{if(L.gt(n,t)&&f[n]){let e=(this.props.noTranslation?f[n].en||``:f[n][this.props.lang]||f[n].en||``).split(`
|
|
3
|
+
`).map(e=>kt(e.trim()).replace(/<!--[^>]*->/g,``).replace(/<! -[^>]*->/g,``).trim()).filter(e=>!!e);i.push(w(p,{children:[w(O,{sx:H.versionHeader,children:[n,o===n?C(E,{component:`span`,sx:H.repoLatestVersionText,children:`(latest)`}):null,a===n?C(E,{component:`span`,sx:H.repoStableVersionText,children:`(${S.t(`stable`)})`}):null]}),e.map((e,t)=>C(jt,{text:e},`${n}-${t}`))]},n))}}catch{console.warn(`Cannot compare "${n}" and "${t}" of adapter ${e}`)}}),i}renderShowNews(){if(this.state.showNews){let e=this.getReactNews(this.state.showNews.adapter,this.state.showNews.fromVersion),t=m.getStyle(this.props.theme,H.closeButton),n=m.getStyle(this.props.theme,H.languageButtonActive);return w(k,{onClose:()=>this.setState({showNews:null}),open:!0,children:[C(d,{children:w(O,{component:`h2`,variant:`h6`,sx:{"&.MuiTypography-root":H.typography},children:[C(`div`,{style:{width:`calc(100% - 60px)`},children:S.t(`Update "%s" to v%s`,this.state.showNews.adapter,this.state.showNews.version)}),C(I,{size:`large`,style:t,onClick:()=>this.setState({showNews:null}),children:C(F,{})}),S.getLanguage()!==`en`&&this.props.toggleTranslation?C(I,{size:`large`,style:{...H.languageButton,...this.props.noTranslation?n:void 0},onClick:this.props.toggleTranslation,title:S.t(`Disable/Enable translation`),children:C(ke,{})}):null]})}),C(x,{dividers:!0,children:C(p,{container:!0,spacing:2,wrap:`nowrap`,sx:{flexDirection:`column`},children:e.length?w(p,{children:[C(O,{variant:`h6`,gutterBottom:!0,children:S.t(`Change log`)}),C(p,{container:!0,spacing:2,wrap:`nowrap`,sx:{flexDirection:`column`},children:e})]}):S.t(`No change log available`)})}),C(b,{style:H.wrapperButton,children:C(D,{variant:`contained`,onClick:()=>this.setState({showNews:null}),color:`grey`,startIcon:C(F,{}),children:S.t(`Close`)})})]})}return null}render(){return this.current!==this.props.current&&(this.current=this.props.current,setTimeout(()=>{var e;return(e=this.currentRef.current)==null?void 0:e.scrollIntoView()},200)),w(t,{style:H.root,children:[this.updateAvailable.map(e=>this.renderOneAdapter(e)),this.renderShowNews()]})}};c();var U={dialogRoot:{height:`calc(100% - 64px)`},wrapperHead:{justifyContent:`space-between`,display:`flex`},checkbox:{marginRight:10},appBar:e=>({flexWrap:`wrap`,position:`sticky`,bottom:-10,pl:1,pr:1,borderRadius:`${e.shape.borderRadius}px`,background:e.palette.background.paper}),container:{overflow:`hidden`,flex:`1 1 auto`,minHeight:0,flexWrap:`nowrap`,"@media screen and (max-width: 602px)":{flex:`none`,flexWrap:`wrap`}},content:{display:`flex`,flexDirection:`column`,"& > .MuiToolbar-root":{flexShrink:0},"@media screen and (max-width: 500px)":{p:1}},languageButton:{position:`absolute`,right:73,top:11},languageButtonActive:e=>({color:e.palette.primary.main})},Ft=class extends M{constructor(e){super(e),u(this,`updateAvailable`,[]),u(this,`onAdapterFinished`,null),u(this,`processList`,[]),this.state={selected:[],inProcess:!1,finished:!1,current:``,updated:[],stopped:!1,debug:(window._localStorage||window.localStorage).getItem(`AdaptersUpdaterDialog.debug`)===`true`,stopOnError:(window._localStorage||window.localStorage).getItem(`AdaptersUpdaterDialog.stopOnError`)!==`false`,closeOnFinished:(window._localStorage||window.localStorage).getItem(`AdaptersUpdaterDialog.closeOnFinished`)===`true`,currentVersion:``},this.updateAvailable=[]}updateAdapter(e,t,n){this.onAdapterFinished=n,this.setState({current:e,currentVersion:t})}onStartUpdate(){this.props.ready?this.setState({inProcess:!0},()=>{this.props.onSetCommandRunning(!0),this.processList=[...this.state.selected].sort((e,t)=>e===`eos-admin`?1:t===`eos-admin`?-1:e.localeCompare(t)).map(e=>{var t;return{adapter:e,version:(t=this.props.repository[e])==null?void 0:t.version}}),this.updateAdapters(()=>{this.setState({inProcess:!1,finished:!0},()=>{this.props.onSetCommandRunning(!1),this.state.closeOnFinished&&this.props.onClose(!!this.state.updated.length)})})}):window.alert(this.props.t(`The connection is not ready yet. Please wait a moment and try again.`))}updateAdapters(e){if(!this.processList||!this.processList.length||this.state.stopped)e&&e();else{let{adapter:t,version:n}=this.processList.shift();this.updateAdapter(t,n,()=>{let n=[...this.state.updated];n.push(t),this.setState({updated:n},()=>setTimeout(()=>this.updateAdapters(e),200))})}}render(){let e=this.props.noTranslation?m.getStyle(this.props.theme,U.languageButtonActive):void 0;return w(k,{open:!0,maxWidth:`lg`,fullWidth:!!this.state.current,onClose:()=>this.props.onClose(!!this.state.updated.length),"aria-labelledby":`update-dialog-title`,"aria-describedby":`update-dialog-description`,sx:{"& .MuiPaper-root":U.dialogRoot},scroll:`paper`,children:[C(d,{id:`update-dialog-title`,children:w(`div`,{style:U.wrapperHead,children:[this.props.t(`Update %s adapter(s)`,this.state.selected.length),!this.state.finished&&!this.state.inProcess&&C(A,{title:this.props.t(`Select/Unselect all`),slotProps:{popper:{sx:{pointerEvents:`none`}}},children:C(l,{checked:this.state.selected.length===this.updateAvailable.length,style:U.checkbox,tabIndex:-1,indeterminate:this.state.selected.length!==this.updateAvailable.length&&this.state.selected.length!==0,disableRipple:!0,onClick:()=>{let e=[];this.state.selected.length!==this.updateAvailable.length&&(e=[...this.updateAvailable]),this.setState({selected:e})}})}),S.getLanguage()!==`en`&&this.props.toggleTranslation?C(I,{size:`large`,style:{...U.languageButton,...e},onClick:()=>{var e,t;return(e=(t=this.props).toggleTranslation)==null?void 0:e.call(t)},title:S.t(`Disable/Enable translation`),children:C(ke,{})}):null]})}),w(x,{sx:{"&.MuiDialogContent-root":U.content},children:[w(p,{container:!0,direction:`row`,sx:U.container,children:[C(p,{style:{height:`100%`,overflow:`hidden`,width:this.state.current?250:`100%`},children:C(`div`,{style:{height:`100%`,overflow:`auto`},children:C(Pt,{finished:this.state.finished,inProcess:this.state.inProcess,selected:this.state.selected,current:this.state.current,stopped:this.state.stopped,updated:this.state.updated,lang:this.props.lang,installed:this.props.installed,repository:this.props.repository,noTranslation:!!this.props.noTranslation,toggleTranslation:this.props.toggleTranslation||(()=>{}),onUpdateSelected:(e,t)=>{t&&(this.updateAvailable=t),this.setState({selected:e})},theme:this.props.theme,rightDependenciesFunc:this.props.rightDependenciesFunc})})}),!!this.state.current&&C(p,{style:{height:`100%`,overflow:`hidden`,width:`calc(100% - 260px)`,minWidth:240},children:C(vt,{noSpacing:!0,ready:this.props.ready,host:this.props.currentHost,socket:this.props.socket,t:this.props.t,cmd:`upgrade ${this.state.current}@${this.state.currentVersion}${this.state.debug?` --debug`:``}`,onFinished:()=>{var e;return(e=this.onAdapterFinished)==null?void 0:e.call(this)},errorFunc:()=>{if(this.state.stopOnError)this.setState({stopped:!0,finished:!0}),this.onAdapterFinished=null,this.props.onSetCommandRunning(!1);else{var e;(e=this.onAdapterFinished)==null||e.call(this)}}},this.state.current)})]}),w(Pe,{variant:`dense`,disableGutters:!0,sx:U.appBar,children:[C(h,{control:C(l,{disabled:this.state.finished,checked:this.state.stopOnError,onChange:()=>{(window._localStorage||window.localStorage).setItem(`AdaptersUpdaterDialog.stopOnError`,this.state.stopOnError?`false`:`true`),this.setState({stopOnError:!this.state.stopOnError})}}),label:this.props.t(`Stop on error`)}),C(h,{control:C(l,{disabled:this.state.finished,checked:this.state.closeOnFinished,onChange:()=>{(window._localStorage||window.localStorage).setItem(`AdaptersUpdaterDialog.closeOnFinished`,this.state.closeOnFinished?`false`:`true`),this.setState({closeOnFinished:!this.state.closeOnFinished})}}),label:this.props.t(`Close on finished`)}),C(h,{control:C(l,{disabled:this.state.finished||this.state.inProcess,checked:this.state.debug,onChange:()=>{(window._localStorage||window.localStorage).setItem(`AdaptersUpdaterDialog.debug`,this.state.debug?`false`:`true`),this.setState({debug:!this.state.debug})}}),label:this.props.t(`Debug info`)})]})]}),w(b,{children:[C(D,{id:`adapters-update-dialog-update`,variant:`contained`,disabled:this.state.stopped||this.state.inProcess||this.state.finished||!this.state.selected.length||!this.props.ready,onClick:()=>this.onStartUpdate(),color:`primary`,autoFocus:!0,startIcon:C(f,{}),children:this.props.t(`Update`)}),C(D,{id:`adapters-update-dialog-cancel`,variant:`contained`,disabled:!this.state.inProcess,color:`grey`,startIcon:C(Se,{}),onClick:()=>{this.setState({stopped:!0,finished:!0}),this.props.onSetCommandRunning(!1)},children:this.props.t(`Cancel`)}),C(D,{id:`adapters-update-dialog-close`,variant:`contained`,onClick:()=>this.props.onClose(!!this.state.updated.length),disabled:this.state.inProcess&&!this.state.stopped,color:this.state.stopped?`error`:`grey`,startIcon:C(F,{}),children:this.props.t(`Close`)})]})]})}},It=ie(w(g,{children:[C(`path`,{d:`M21 10.12h-6.78l2.74-2.82c-2.73-2.7-7.15-2.8-9.88-.1-2.73 2.71-2.73 7.08 0 9.79s7.15 2.71 9.88 0C18.32 15.65 19 14.08 19 12.1h2c0 1.98-.88 4.55-2.64 6.29-3.51 3.48-9.21 3.48-12.72 0-3.5-3.47-3.53-9.11-.02-12.58s9.14-3.47 12.65 0L21 3z`}),C(`path`,{d:`M8.6 8.7h2.9v2.9H8.6zM12.5 8.7h2.9v2.9h-2.9zM8.6 12.6h2.9v2.9H8.6zM12.5 12.6h2.9v2.9h-2.9z`})]}),`UpdateAll`);c();var Lt=class extends _t{constructor(e,t){super(e,`${t}.adapter`,`adapter`),u(this,`host`,void 0),u(this,`prefix`,void 0),this.prefix=`${t}.adapter.`,this.host=t}getObject(e){return this.objects&&this.objects[this.prefix+e]||null}getHost(){return this.host}};function Rt(e){var t;return(e==null||(t=e.licenseInformation)==null?void 0:t.link)||zt(e)}function zt(e){if(!e)return``;let t=e.licenseUrl;if(!t||!t.includes(`/LICENSE`)||!t.includes(`raw.githubusercontent.com`)){if(t=e.extIcon,!t){if(t=e.readme,!t)return console.error(`No extIcon for ${e.name||JSON.stringify(e)}`),``;t=t.replace(`github.com`,`raw.githubusercontent.com`).replace(`/blob/`,`/`),t.includes(`/main`)?t=`${t.split(`/main`)[0]}/main/LICENSE`:t.includes(`/master`)&&(t=`${t.split(`/master`)[0]}/master/LICENSE`)}if(t.includes(`/main`))t=`${t.split(`/main`)[0]}/main/LICENSE`;else if(t.includes(`/master`))t=`${t.split(`/master`)[0]}/master/LICENSE`;else return``}return t}function Bt(e){if(!e)return null;let t=e.trim().split(`?`)[0].split(`#`)[0],n=t.match(/iobroker\.([a-z\d][a-z\d_-]*?)-\d+\.\d+\.\d+[^/\\]*\.tgz$/i);if(n)return n[1].toLowerCase();let r=t.match(/iobroker\.([a-z\d][a-z\d_-]*)/i);return r?r[1].toLowerCase():/^[a-z\d][a-z\d_-]*$/i.test(t)?t.toLowerCase():null}var Vt=`data:image/svg+xml,%3csvg%20viewBox='0%200%202500%202500'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M0%200h2500v2500H0z'%20fill='%23c00'/%3e%3cpath%20d='M1241.5%20268.5h-973v1962.9h972.9V763.5h495v1467.9h495V268.5z'%20fill='%23fff'/%3e%3c/svg%3e`;function Ht(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=()=>{let e=r.result,n=e.indexOf(`,`);t(n===-1?e:e.substring(n+1))},r.onerror=()=>n(r.error||Error(`Cannot read file`)),r.readAsDataURL(e)})}function Ut(e){return{id:`github-install-dialog-tab-${e}`,"aria-controls":`github-install-dialog-panel-${e}`}}var W={root:e=>({backgroundColor:e.palette.background.paper,width:`100%`,height:`100%`}),paper:{maxWidth:1e3},tabPaper:{padding:16},title:e=>({mt:`10px`,p:1,ml:1,fontSize:18,color:e.palette.primary.main}),warningText:{color:`#f53939`},noteText:{marginTop:16},errorTextNoGit:{fontSize:13,color:`#ff1616`},listIcon:{width:24,height:24},listIconWithMargin:{width:24,height:24,marginRight:8},tabSelected:e=>({color:e.palette.mode===`dark`?e.palette.secondary.contrastText:`#222 !important`})};function Wt(e){let t=[];for(let n=0;n<e.length;n++)typeof e[n]==`object`?e[n].forEach(e=>t.push(e)):t.push(e[n]);return t}var Gt=10,Kt=class extends v.Component{constructor(e){super(e);let t=[],n=(window._localstorage||window.localStorage).getItem(`App.npmHistory`);if(n)try{t=JSON.parse(n)}catch{}this.state={autoCompleteValue:(window._localstorage||window.localStorage).getItem(`App.autocomplete`)||null,debug:(window._localstorage||window.localStorage).getItem(`App.gitDebug`)===`true`,createInstance:(window._localstorage||window.localStorage).getItem(`App.createInstanceAfterInstall`)!==`false`,url:(window._localstorage||window.localStorage).getItem(`App.userUrl`)||``,currentTab:(window._localstorage||window.localStorage).getItem(`App.gitTab`)||`npm`,customHistory:t,selectedFile:null,restartAfterInstall:(window._localstorage||window.localStorage).getItem(`App.restartAfterInstall`)!==`false`,uploading:!1,selectedHost:e.currentHost,cmdExecFilesSupported:!1}}async componentDidMount(){try{let e=await this.props.socket.checkFeatureSupported(`CONTROLLER_CMD_EXEC_FILES`);this.setState({cmdExecFilesSupported:!!e})}catch(e){console.error(`Cannot read feature: ${e}`)}}async uploadFileToServer(){if(!this.state.selectedFile)return null;this.setState({uploading:!0});try{let e=new FormData;e.append(`file`,this.state.selectedFile);let t=await fetch(`./upload-adapter`,{method:`POST`,body:e});if(!t.ok){let e;try{e=(await t.json()).error||`Upload failed with status ${t.status}`}catch{e=`Upload failed with status ${t.status}`}throw Error(e)}return(await t.json()).filePath}catch(e){return window.alert(`${S.t(`Upload failed`)}: ${e.message}`),null}finally{this.setState({uploading:!1})}}async restartInstances(e){if(!this.state.restartAfterInstall||!e)return;let t=await this.props.socket.getAdapterInstances(e);for(let e of t){var n;e!=null&&(n=e.common)!=null&&n.enabled&&await this.props.socket.extendObject(e._id,{})}}async createInstanceIfDesired(e,t){if(this.state.createInstance&&e)try{await this.props.createInstance(e,t)}catch(t){console.error(`Cannot create the instance of ${e}: ${t.message}`)}}async installFile(){if(!this.state.selectedFile)return;let e=Bt(this.state.selectedFile.name)||``;if(this.state.cmdExecFilesSupported){try{let t=await Ht(this.state.selectedFile),n=this.state.selectedFile.name.replace(/[^a-zA-Z0-9._-]/g,`_`),r=await this.props.installFromUrl(n,this.state.debug,!0,{host:this.state.selectedHost,files:[{name:n,file:t}]});await this.restartInstances(e),r&&await this.createInstanceIfDesired(e,this.state.selectedHost)}catch(e){console.error(`Installation from file failed: ${e.message}`)}return}let t=await this.uploadFileToServer();if(t)try{let n=await this.props.installFromUrl(t,this.state.debug,!0);await this.restartInstances(e),n&&await this.createInstanceIfDesired(e)}catch(e){console.error(`Installation from file failed: ${e.message}`)}}async handleInstall(){if(this.state.currentTab===`GitHub`){var e;let t=(((e=this.state.autoCompleteValue)==null?void 0:e.value)||``).split(`/`),n=`${t[1]}/ioBroker.${t[0]}`;await this.props.installFromUrl(n,this.state.debug,!0)&&await this.createInstanceIfDesired(t[0])}else if(this.state.currentTab===`URL`){let e=this.state.customHistory.filter(e=>e!==this.state.url);e.unshift(this.state.url),e.length>Gt&&e.pop(),(window._localstorage||window.localStorage).setItem(`App.npmHistory`,JSON.stringify(e));let t=this.state.url.includes(`.`)?this.state.url:`iobroker.${this.state.url}`;await this.props.installFromUrl(t,this.state.debug,!0)&&await this.createInstanceIfDesired(Bt(t))}else if(this.state.currentTab===`File`)await this.installFile();else if(this.state.currentTab===`npm`){var t;let e=(((t=this.state.autoCompleteValue)==null?void 0:t.value)||``).split(`/`)[0],n=e.includes(`.`)?e.split(`.`)[1]:e;try{let e=await this.props.installFromUrl(`iobroker.${n}@latest`,this.state.debug,!0);await this.props.upload(n),e&&await this.createInstanceIfDesired(n)}catch(e){console.error(`Installation from url failed: ${e.message}`)}}}renderCreateInstance(){return C(`div`,{style:{display:`flex`,alignItems:`center`},children:C(h,{control:C(l,{checked:this.state.createInstance,onChange:e=>{(window._localstorage||window.localStorage).setItem(`App.createInstanceAfterInstall`,e.target.checked?`true`:`false`),this.setState({createInstance:e.target.checked})}}),label:this.props.t(`Create instance if it does not exist yet`)})})}renderNpm(){return this.state.currentTab===`npm`?w(B,{style:W.tabPaper,id:`github-install-dialog-panel-npm`,children:[C(`div`,{style:{display:`flex`,alignItems:`center`},children:C(h,{control:C(l,{checked:this.state.debug,onChange:e=>{(window._localstorage||window.localStorage).setItem(`App.gitDebug`,e.target.checked?`true`:`false`),this.setState({debug:e.target.checked})}}),label:this.props.t(`Debug outputs`)})}),this.renderCreateInstance(),w(`div`,{style:{display:`flex`,alignItems:`flex-end`},children:[C(it,{style:{marginRight:10}}),C(Me,{fullWidth:!0,value:this.state.autoCompleteValue,onChange:(e,t)=>{(window._localstorage||window.localStorage).setItem(`App.autocomplete`,t||void 0),this.setState({autoCompleteValue:t||null})},options:this.getList(),getOptionLabel:e=>(e==null?void 0:e.name)??``,renderInput:e=>{var t;return C(z,{variant:`standard`,...e,slotProps:{...e.slotProps,input:{...e.slotProps.input,startAdornment:C(_,{position:`start`,children:C(ve,{src:((t=this.state.autoCompleteValue)==null?void 0:t.icon)||``,style:W.listIcon})})}},label:S.t(`Select adapter`)})},renderOption:(e,t)=>w(E,{component:`li`,sx:{"& > img":{mr:2,flexShrink:0}},...e,children:[C(ve,{src:(t==null?void 0:t.icon)||``,style:W.listIconWithMargin}),(t==null?void 0:t.name)??``]})})]}),C(`div`,{style:{fontSize:24,fontWeight:`bold`,marginTop:40},children:this.props.t(`Warning!`)}),C(`div`,{style:W.warningText,children:this.props.t(`npm_warning`,`NPM`,`NPM`)}),C(`div`,{style:W.noteText,children:this.props.t(`github_note`)})]}):null}renderGitHub(){return this.state.currentTab===`GitHub`?w(B,{style:W.tabPaper,id:`github-install-dialog-panel-github`,children:[C(`div`,{style:{display:`flex`,alignItems:`center`},children:C(h,{control:C(l,{checked:this.state.debug,onChange:e=>{(window._localstorage||window.localStorage).setItem(`App.gitDebug`,e.target.checked?`true`:`false`),this.setState({debug:e.target.checked})}}),label:this.props.t(`Debug outputs`)})}),this.renderCreateInstance(),w(`div`,{style:{display:`flex`,alignItems:`flex-end`},children:[C(it,{style:{marginRight:10}}),C(Me,{fullWidth:!0,value:this.state.autoCompleteValue,getOptionDisabled:e=>!!(e!=null&&e.nogit),renderOption:(e,t)=>w(E,{component:`li`,sx:{"& > img":{mr:2,flexShrink:0}},...e,children:[C(ve,{src:(t==null?void 0:t.icon)||``,style:W.listIconWithMargin}),(t==null?void 0:t.name)??``,(t==null?void 0:t.nogit)&&C(`div`,{style:W.errorTextNoGit,children:S.t(`This adapter cannot be installed from git as must be built before installation.`)})]}),onChange:(e,t)=>{(window._localstorage||window.localStorage).setItem(`App.autocomplete`,t),this.setState({autoCompleteValue:t})},options:this.getList(),getOptionLabel:e=>(e==null?void 0:e.name)??``,renderInput:e=>{var t;return C(z,{variant:`standard`,...e,slotProps:{...e.slotProps,input:{...e.slotProps.input,startAdornment:C(_,{position:`start`,children:C(ve,{src:((t=this.state.autoCompleteValue)==null?void 0:t.icon)||``,style:W.listIconWithMargin})})}},label:S.t(`Select adapter`)})}})]}),C(`div`,{style:{fontSize:24,fontWeight:`bold`,marginTop:40},children:this.props.t(`Warning!`)}),C(`div`,{style:W.warningText,children:this.props.t(`github_warning`,`GitHub`,`GitHub`)}),C(`div`,{style:W.noteText,children:this.props.t(`github_note`)})]}):null}renderCustom(){return this.state.currentTab===`URL`?w(B,{style:W.tabPaper,id:`github-install-dialog-panel-custom`,children:[C(`div`,{style:{display:`flex`,alignItems:`center`},children:C(h,{control:C(l,{checked:this.state.debug,onChange:e=>{(window._localstorage||window.localStorage).setItem(`App.gitDebug`,e.target.checked?`true`:`false`),this.setState({debug:e.target.checked})}}),label:this.props.t(`Debug outputs`)})}),this.renderCreateInstance(),C(`div`,{style:{display:`flex`,alignItems:`center`},children:C(Me,{fullWidth:!0,value:this.state.url||``,onInputChange:(e,t)=>{(window._localstorage||window.localStorage).setItem(`App.userUrl`,t||``),this.setState({url:t||``})},onChange:(e,t)=>{(window._localstorage||window.localStorage).setItem(`App.userUrl`,t||``),this.setState({url:t||``})},renderOption:(e,t)=>w(E,{component:`li`,...e,style:{display:`flex`,alignItems:`left`},children:[t,C(`div`,{style:{flexGrow:1}}),C(I,{size:`small`,onClick:e=>{e.stopPropagation();let n=this.state.customHistory.filter(e=>e!==t);(window._localstorage||window.localStorage).setItem(`App.npmHistory`,JSON.stringify(n)),this.setState({customHistory:n})},children:C(de,{})})]}),freeSolo:!0,options:this.state.customHistory,renderInput:e=>C(z,{variant:`standard`,...e,onKeyUp:e=>{e.key===`Enter`&&this.state.url&&this.handleInstall().then(()=>{this.setState({autoCompleteValue:null,url:``}),this.props.onClose()})},helperText:this.props.t(`URL or file path`),label:this.props.t(`URL`)})})}),C(`div`,{style:{fontSize:24,fontWeight:`bold`,marginTop:40},children:this.props.t(`Warning!`)}),C(`div`,{style:W.warningText,children:this.props.t(`github_warning`,`URL`,`URL`)}),C(`div`,{style:W.noteText,children:this.props.t(`github_note`)})]}):null}renderFile(){return this.state.currentTab===`File`?w(B,{style:W.tabPaper,id:`github-install-dialog-panel-file`,children:[w(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[w(D,{variant:`outlined`,component:`label`,startIcon:C(Te,{}),disabled:this.state.uploading,children:[this.props.t(`Select file`),C(`input`,{type:`file`,accept:`.tgz`,hidden:!0,onChange:e=>{var t;let n=((t=e.target.files)==null?void 0:t[0])||null;this.setState({selectedFile:n,url:``}),(window._localstorage||window.localStorage).setItem(`App.userUrl`,``),e.target.value=``}})]}),this.state.selectedFile&&w(g,{children:[C(O,{variant:`body2`,style:{flex:1},children:this.state.selectedFile.name}),C(I,{size:`small`,onClick:()=>this.setState({selectedFile:null}),children:C(F,{})})]}),this.state.uploading&&C(re,{size:24})]}),this.state.selectedFile&&C(h,{control:C(l,{checked:this.state.restartAfterInstall,onChange:e=>{(window._localstorage||window.localStorage).setItem(`App.restartAfterInstall`,e.target.checked?`true`:`false`),this.setState({restartAfterInstall:e.target.checked})}}),label:this.props.t(`Restart adapter after install`)}),this.renderCreateInstance(),this.state.cmdExecFilesSupported&&w(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginTop:8},children:[w(O,{variant:`body2`,children:[this.props.t(`Install on host`),`:`]}),C(yt,{socket:this.props.socket,currentHost:this.state.selectedHost,hostsWorker:this.props.hostsWorker,expertMode:this.props.expertMode,themeType:this.props.themeType,tooltip:this.props.t(`Install on host`),setCurrentHost:(e,t)=>this.setState({selectedHost:t})})]}),C(`div`,{style:{fontSize:24,fontWeight:`bold`,marginTop:40},children:this.props.t(`Warning!`)}),C(`div`,{style:W.warningText,children:this.props.t(`github_warning`,`File`,`File`)}),C(`div`,{style:W.noteText,children:this.props.t(`github_note`)})]}):null}getList(){let e=Wt(this.props.categories.map(e=>e.adapters));return e.sort(),e.map((t,n)=>{if(n&&e[n-1]===t)return null;let r=this.props.repository[t];if(!(r!=null&&r.controller)){let e=(r.extIcon||r.meta||r.readme||``).toString().split(`/`),n=r==null?void 0:r.name;n||=(n=r.titleLang,n&&typeof n==`object`?n[S.getLanguage()]||n.en:r.title||t);let i={value:`${t}/${e[3]}`,name:`${n} [${e[3]}]`,icon:r.extIcon||r.icon||``,nogit:!!r.nogit,title:t};return this.props.installed[n]&&n!==`admin`&&(i.icon=pt(`adapter/${t}/${(r.icon||``).split(`/admin/`).pop()}`)),i}return null}).filter(e=>e).sort((e,t)=>e.name<t.name?-1:+(e.name>t.name))}render(){var t;let n=()=>this.setState({autoCompleteValue:null,url:``,selectedFile:null,uploading:!1});return w(k,{onClose:()=>this.props.onClose(),open:!0,sx:{"& .MuiDialog-paper":W.paper},children:[C(x,{dividers:!0,children:w(E,{component:`div`,sx:W.root,children:[C(ge,{position:`static`,color:`default`,children:w(be,{value:this.state.currentTab,onChange:(e,t)=>{(window._localstorage||window.localStorage).setItem(`App.gitTab`,t),this.setState({currentTab:t})},variant:`fullWidth`,indicatorColor:`secondary`,children:[C(e,{label:this.props.t(`From npm`),wrapped:!0,sx:{"&.Mui-selected":W.tabSelected},icon:C(`img`,{src:Vt,alt:`npm`,width:24,height:24}),...Ut(`npm`),value:`npm`}),C(e,{label:this.props.t(`From github`),wrapped:!0,sx:{"&.Mui-selected":W.tabSelected},icon:C(fe,{style:{width:24,height:24},width:24,height:24}),...Ut(`github`),value:`GitHub`}),C(e,{label:this.props.t(`Custom`),wrapped:!0,sx:{"&.Mui-selected":W.tabSelected},icon:C(ke,{width:24,height:24}),...Ut(`custom`),value:`URL`}),C(e,{label:this.props.t(`From file`),wrapped:!0,sx:{"&.Mui-selected":W.tabSelected},icon:C(Ue,{style:{width:24,height:24}}),...Ut(`file`),value:`File`})]})}),C(E,{component:`div`,sx:W.title,children:this.props.t(`Install or update the adapter from %s`,this.state.currentTab||`npm`)}),this.renderNpm(),this.renderGitHub(),this.renderCustom(),this.renderFile()]})}),w(b,{children:[C(D,{id:`github-install-dialog-ok`,variant:`contained`,disabled:this.state.uploading||this.props.commandRunning||(this.state.currentTab===`GitHub`||this.state.currentTab===`npm`)&&!((t=this.state.autoCompleteValue)!=null&&t.value)||this.state.currentTab===`URL`&&!this.state.url||this.state.currentTab===`File`&&!this.state.selectedFile,autoFocus:!0,onClick:async()=>{await this.handleInstall(),this.props.onClose(),n()},color:`primary`,startIcon:this.props.commandRunning?C(re,{size:20}):C(f,{}),children:this.props.t(`Install`)}),C(D,{id:`github-install-dialog-close`,variant:`contained`,onClick:()=>{this.props.onClose(),n()},color:`grey`,startIcon:C(F,{}),children:this.props.t(`Close`)})]})]})}};c();var G={formControl:{marginTop:24,width:100},closeButton:e=>({position:`absolute`,right:8,top:8,color:e.palette.grey[500]}),languageButton:{position:`absolute`,right:60,top:8},languageButtonActive:e=>({color:e.palette.primary.main}),paper:{},typography:{pr:`30px`},messageText:{},messageColor_warn:{color:`#cb7642`},messageColor_error:{color:`#f5614d`},messageColor_info:{color:`#5abd29`},messageTitle_warn:e=>({background:`#cb7642`,borderRadius:`3px`,pl:`10px`,fontWeight:`bold`,color:e.palette.mode===`dark`?`black`:`white`}),messageTitle_error:e=>({background:`#f5614d`,borderRadius:`3px`,pl:`10px`,fontWeight:`bold`,color:e.palette.mode===`dark`?`black`:`white`}),messageTitle_info:e=>({background:`#5abd29`,borderRadius:`3px`,pl:`10px`,fontWeight:`bold`,color:e.palette.mode===`dark`?`black`:`white`}),deps:e=>({m:`10px`,fontSize:16,color:e.palette.mode===`dark`?`#e70000`:`#840101`})},qt=class extends M{constructor(e){super(e),u(this,`t`,void 0),u(this,`messages`,null),u(this,`lang`,void 0),this.state={instanceNumbers:[]},this.t=e.t,this.lang=S.getLanguage(),this.messages=At(e.adapterObject.messages,null,e.adapterObject.version,e.instances)}componentDidMount(){this.props.instancesWorker.getObjects().then(e=>{let t=Object.keys(e||{}).filter(t=>{var n;return(e==null||(n=e[t])==null||(n=n.common)==null?void 0:n.name)===this.props.adapter}).map(e=>e.substring(e.lastIndexOf(`.`)+1));this.setState({instanceNumbers:t})})}getAvailableInstances(){let e=[];e.push(C(R,{value:`auto`,children:this.t(`auto`)},`auto`));for(let t=0;t<=100&&(this.state.instanceNumbers.includes(t.toString())||e.push(C(R,{value:t.toString(),children:t},t)),!(e.length>11));t++);return e}checkDependencies(e=this.props.dependencies){if(!e)return``;let t=[];for(let r of e){var n;r.installedVersion?(n=r.wrongHosts)!=null&&n.length?t.push(w(`div`,{children:[C(`div`,{children:this.props.t(`The following hosts do not fulfill the required version %s of %s:`,r.version||`unknown`,r.name)}),C(`ul`,{style:{margin:`4px 0`},children:r.wrongHosts.map(e=>w(`li`,{children:[e.host,`: `,e.installedVersion]},e.host))})]},r.name)):r.rightVersion||t.push(C(`div`,{children:`${this.props.t(`Invalid version of %s. Required %s. Current `,r.name,r.version||`unknown`)}${r.installedVersion}`},r.name)):t.push(C(`div`,{children:this.props.t(`No version of %s`,r.name,r.name)},r.name))}return t.length?t:``}getText(e,t){return e&&typeof e==`object`?t?e.en:e[this.lang]||e.en:typeof e==`object`?``:e}renderOneMessage(e,t){return w(p,{children:[C(O,{sx:G[`messageTitle_${e.level||`warn`}`],children:this.getText(e.title,this.props.noTranslation)||``}),C(O,{component:`div`,variant:`body2`,style:G.messageText,children:this.getText(e.text,this.props.noTranslation)||``}),e.link?C(D,{onClick:()=>{let t=window.open(e.link,`_blank`);t==null||t.focus()},startIcon:C(me,{}),variant:`contained`,color:`grey`,children:this.getText(e.linkText||``,this.props.noTranslation)||this.props.t(`More info`)}):null]},t)}renderMessages(){return this.messages?C(p,{container:!0,spacing:2,wrap:`nowrap`,sx:{marginBottom:1,flexDirection:`column`},children:this.messages.map((e,t)=>this.renderOneMessage(e,t))}):null}render(){let e=this.checkDependencies();return w(k,{onClose:()=>{},open:!0,sx:{"& .MuiDialog-paper":G.paper},children:[C(d,{children:w(O,{component:`h2`,variant:`h6`,sx:{"&.MuiTypography-root":G.typography},children:[this.t(`You are going to add new instance:`),` `,this.props.adapter,C(I,{size:`large`,sx:G.closeButton,onClick:()=>this.props.onClose(!1),children:C(F,{})}),this.messages&&this.lang!==`en`&&this.props.toggleTranslation?C(I,{size:`large`,style:m.getStyle(this.props.theme,G.languageButton,this.props.noTranslation&&G.languageButtonActive),onClick:this.props.toggleTranslation,title:S.t(`Disable/Enable translation`),children:C(ke,{})}):null]})}),w(x,{dividers:!0,children:[this.renderMessages(),!e&&this.props.expertMode?w(p,{container:!0,sx:{flexDirection:`column`},children:[C(yt,{tooltip:this.t(`Select host to add the instance`),expertMode:!0,socket:this.props.socket,hostsWorker:this.props.hostsWorker,currentHost:this.props.currentHost,setCurrentHost:(e,t)=>this.props.onHostChange(t.replace(/^system\.host\./,``))}),w(pe,{variant:`standard`,style:G.formControl,children:[C(he,{id:`instance-label`,children:this.t(`Instance`)}),C(j,{variant:`standard`,labelId:`instance-label`,value:this.props.currentInstance,onChange:this.props.onInstanceChange,children:this.getAvailableInstances()})]})]}):null,C(E,{component:`div`,sx:G.deps,children:e})]}),w(b,{children:[C(D,{id:`instance-add-dialog-ok`,variant:`contained`,autoFocus:!0,disabled:!!e,onClick:()=>this.props.onClose(!0),color:`primary`,startIcon:C(We,{}),children:this.t(`Add`)}),C(D,{id:`instance-add-dialog-cancel`,variant:`contained`,onClick:()=>this.props.onClose(!1),color:`grey`,startIcon:C(F,{}),children:this.t(`Close`)})]})]})}},K=class e extends M{constructor(e){super(e),this.state={showDialog:!1,showLicenseDialog:null,addInstanceHostName:``,addInstanceId:`auto`,addInstanceDialog:``}}renderLicenseDialog(t){var n;return this.state.showLicenseDialog?C(St,{licenseType:this.state.showLicenseDialog.licenseType,url:this.state.showLicenseDialog.url,link:(n=t.repository[this.state.showLicenseDialog.adapterName])==null||(n=n.licenseInformation)==null?void 0:n.link,onClose:n=>{let r=n?this.state.showLicenseDialog:null;this.setState({showLicenseDialog:null,showDialog:!1},()=>{r&&(r.upload?e.upload(r.adapterName,t):this.addInstance({adapterName:r.adapterName,context:t}).catch(e=>window.alert(`Cannot add instance: ${e}`)))})}}):null}async addInstance(t){if(!t.customUrl){let e=t.context.repository[t.adapterName],n=At(e.messages,null,e.version,t.context.compactInstances);if(!t.instance&&(t.context.expertMode||n))return this.setState({addInstanceDialog:t.adapterName,showDialog:!0,addInstanceHostName:t.context.currentHost.replace(/^system\.host\./,``),addInstanceId:t.instance||`auto`}),!1;if(t.instance){let e=await t.context.instancesWorker.getObjects();if(e&&e[`system.adapter.${t.adapterName}.${t.instance}`])return window.alert(t.context.t(`Instance %s already exists`,`${t.adapterName}.${t.instance}`)),!1}}let n=(t.host||this.state.addInstanceHostName||t.context.currentHost).replace(/^system\.host\./,``);if(!t.customUrl){let r=await e.getSingletonRefusal(t.adapterName,n,t.context);if(r)return window.alert(r),!1}try{await new Promise((e,r)=>{t.context.executeCommand(`${t.customUrl?`url`:`add`} ${t.adapterName} ${t.instance?`${t.instance} `:``}--host ${n} ${t.debug||t.context.expertMode?`--debug`:``}`,n,t=>t?r(Error(`The process returned an exit code of ${t}`)):e(),t.files)})}catch(e){return window.alert(`${S.t(`Cannot install`)}: ${e}`),!1}return!0}static isSingletonInstalled(e,t){var n;if(!((n=t.adapters[`system.adapter.${e}`])!=null&&(n=n.common)!=null&&n.singleton))return!1;let r=`system.adapter.${e}.`;return Object.keys(t.compactInstances).some(e=>e.startsWith(r))}static async getSingletonRefusal(e,t,n){var r;let i=(r=n.adapters[`system.adapter.${e}`])==null?void 0:r.common;if(!(i!=null&&i.singleton)&&!(i!=null&&i.singletonHost))return null;let a=await n.instancesWorker.getObjects().catch(()=>null)||{},o=`system.adapter.${e}.`,s=Object.values(a).filter(e=>e==null?void 0:e._id.startsWith(o));if(i.singleton&&s.length)return n.t(`Adapter "%s" allows only one instance, and %s exists already`,e,s[0]._id.substring(15));let c=s.find(e=>e.common.host===t);return i.singletonHost&&c?n.t(`Adapter "%s" allows only one instance per host, and %s exists already on host "%s"`,e,c._id.substring(15),t):null}static async createInstanceIfNotExists(e){let{adapterName:t,context:n}=e,r=(e.host||n.currentHost).replace(/^system\.host\./,``),i;for(let e=0;e<5&&!i;e++){await new Promise(e=>setTimeout(e,500));try{i=await n.socket.getObject(`system.adapter.${t}`)}catch{}}if(!i){console.warn(`Cannot create an instance: adapter "${t}" not found after the installation`);return}let a=await n.instancesWorker.getObjects(!0);if(!(a&&Object.keys(a).find(e=>e.startsWith(`system.adapter.${t}.`))))try{await new Promise((i,a)=>{n.executeCommand(`add ${t} --host ${r} ${e.debug||n.expertMode?`--debug`:``}`,r,e=>e?a(Error(`The process returned an exit code of ${e}`)):i())})}catch(e){window.alert(`${S.t(`Cannot create instance`)}: ${e}`)}}static getDependencies(e,t){let n=t.repository[e],r=[];if(n){let e=n.dependencies?Array.isArray(n.dependencies)?n.dependencies:[n.dependencies]:[],a=n.globalDependencies?Array.isArray(n.globalDependencies)?n.globalDependencies:[n.globalDependencies]:[],o=n.node;if(e.length)for(let n of e){let e={name:``,version:null,installed:!1,installedVersion:null,rightVersion:!1},i=typeof n!=`string`,a=Object.keys(n);if(e.name=(i?a?a[0]:``:n)||``,e.version=i?n[e.name]:null,e.name){let n=t.installed[e.name];e.installed=!!n,e.installedVersion=n?n.version:null;try{e.rightVersion=n?!i||L.satisfies(n.version,e.version||`*`,{includePrerelease:!0}):!1}catch{e.rightVersion=!0}}r.push(e)}if(a.length)for(let e of a){let n={name:``,version:null,installed:!1,installedVersion:null,rightVersion:!1},a=typeof e!=`string`,o=Object.keys(e);if(n.name=(a?o?o[0]:``:e)||``,n.version=a?e[n.name]:null,n.name){var i;let e=t.installedGlobal[n.name];n.installed=!!e,n.installedVersion=e?e.version:null;let r=(i=t.installedGlobalHosts)==null?void 0:i[n.name];if(a&&r&&Object.keys(r).length>1){let t=[];for(let[e,i]of Object.entries(r)){let r;try{r=L.satisfies(i,n.version||`*`,{includePrerelease:!0})}catch{r=!0}r||t.push({host:e,installedVersion:i})}n.wrongHosts=t,n.rightVersion=e?!t.length:!1}else try{n.rightVersion=e?!a||L.satisfies(e.version,n.version||`*`,{includePrerelease:!0}):!1}catch{n.rightVersion=!0}}r.push(n)}let s=n.ifInstalledDependencies||{};if(typeof s==`object`&&!Array.isArray(s)){let e=Object.keys(s);for(let n of e){let e={name:n,version:s[n],installed:!1,installedVersion:null,rightVersion:!1};if(e.name){let n=t.installedGlobal[e.name];e.installed=!!n,e.installedVersion=n?n.version:null;try{e.rightVersion=!n||L.satisfies(n.version,e.version||`*`,{includePrerelease:!0})}catch{e.rightVersion=!0}}r.push(e)}}if(o){let e={name:`node`,version:o,installed:!0,installedVersion:t.nodeJsVersion,rightVersion:!1};try{e.rightVersion=L.satisfies(t.nodeJsVersion,o)}catch{e.rightVersion=!0}r.push(e)}}return r}renderAddInstanceDialog(t){return this.state.addInstanceDialog?C(qt,{adapter:this.state.addInstanceDialog,socket:t.socket,hostsWorker:t.hostsWorker,instancesWorker:t.instancesWorker,dependencies:e.getDependencies(this.state.addInstanceDialog,t),currentHost:`system.host.${this.state.addInstanceHostName}`,currentInstance:this.state.addInstanceId,t:t.t,onClose:e=>{let n=e?this.state.addInstanceDialog:``,r=e?this.state.addInstanceId:``;this.setState({addInstanceDialog:``,addInstanceId:`auto`,showDialog:!1},()=>{if(n)try{this.addInstance({adapterName:n,instance:r,context:t})}catch(e){window.alert(`Cannot add instance: ${e}`)}})},onHostChange:e=>this.setState({addInstanceHostName:e.replace(/^system\.host\./,``)}),onInstanceChange:e=>this.setState({addInstanceId:e.target.value.toString()}),adapterObject:t.repository[this.state.addInstanceDialog],instances:t.compactInstances,toggleTranslation:t.toggleTranslation,noTranslation:this.props.noTranslation,expertMode:t.expertMode,theme:t.theme}):null}static upload(e,t){t.executeCommand(`upload ${e}${t.expertMode?` --debug`:``}`)}onAddInstance(e,t){var n;let r=t.repository[e],i=zt(r),a=((n=r.licenseInformation)==null?void 0:n.license)||r.license;a===`MIT`||a===`Apache-2.0`||a===`ISC`||a===`BSD-3-Clause`||a===`BSD-2-Clause`||!a?this.addInstance({adapterName:e,context:t}).catch(e=>window.alert(`Cannot add instance: ${e}`)):this.setState({showLicenseDialog:{url:i,adapterName:e,licenseType:a},showDialog:!0})}renderDialogs(e){return this.state.showDialog?w(g,{children:[this.renderAddInstanceDialog(e),this.renderLicenseDialog(e)]}):null}},q={name:{flexWrap:`nowrap`,width:300,marginTop:0},nameDiv:{display:`flex`,alignItems:`center`},categoryName:{fontWeight:`bold`,cursor:`pointer`},green:{color:ce[500]},blue:{color:Je[700]},category:{backgroundColor:`background.default`},marginRight5:{marginRight:5}};function Jt(e){let{installedCount:t,name:n,categoryName:i}=e;return w(P,{hover:!1,sx:q.category,children:[C(N,{children:C(p,{container:!0,spacing:1,style:q.name,sx:{alignItems:`center`},children:C(p,{component:`div`,children:C(I,{size:`small`,onClick:e.onToggle,children:e.expanded?C(r,{}):C(Qe,{})})})})}),C(N,{onClick:e.onToggle,children:w(`div`,{style:{...q.nameDiv,...q.categoryName},children:[C(Dt,{iconName:i,style:q.marginRight5}),n]})}),w(N,{colSpan:e.descHidden?5:6,children:[C(O,{component:`span`,variant:`body2`,style:q.green,children:t}),` ${e.t(`of`)} `,C(O,{component:`span`,variant:`body2`,style:q.blue,children:e.count}),` ${e.t(`Adapters from this Group installed`)}`]})]})}var J={rating:{marginBottom:20},listRating:{marginRight:8},listTime:{opacity:.5,fontStyle:`italic`},list:{},listOwn:e=>({backgroundColor:e.palette.mode===`light`?`#16516e2e`:e.palette.secondary.dark}),listTitle:e=>({backgroundColor:e.palette.primary.dark,pt:`4px`,pb:`4px`,mb:`4px`,color:`#ffffff`,textAlign:`center`}),languageFilter:{width:300},ratingTextControl:{width:`calc(100% - 138px)`,marginRight:8},ratingLanguageControl:{width:130},noComments:{width:`100%`,textAlign:`center`,marginTop:16},commentCount:{marginTop:2,marginLeft:8,opacity:.8,fontSize:10,float:`right`},infoText:{textAlign:`left`,fontSize:`14px`},infoTextContainer:{display:`flex`,paddingBottom:`10px`,alignItems:`center`,gap:`10px`}},Yt=[{id:`en`,title:`English`},{id:`de`,title:`Deutsch`},{id:`ru`,title:`русский`},{id:`pt`,title:`Portugues`},{id:`nl`,title:`Nederlands`},{id:`fr`,title:`français`},{id:`it`,title:`Italiano`},{id:`es`,title:`Espanol`},{id:`pl`,title:`Polski`},{id:`uk`,title:`Українська`},{id:`zh-cn`,title:`简体中文`}],Xt=class extends M{constructor(e){super(e),this.state={ratingNumber:0,ratingComment:``,votings:null,ratingLang:this.props.lang,filterLang:(window._localStorage||window.localStorage).getItem(`app.commentLang`)||this.props.lang,commentsByLanguage:{}}}componentDidMount(){fetch(`https://rating.iobroker.net/adapter/${this.props.adapter}?uuid=${this.props.uuid}`).then(e=>e.json()).then(e=>{e||={},e.rating||={};let t=Object.keys(e.rating);t.sort((t,n)=>e.rating[t].ts>e.rating[n].ts?-1:+(e.rating[t].ts<e.rating[n].ts));let n={};if(e.comments&&(e.comments.sort((e,t)=>e.ts>t.ts?-1:+(e.ts<t.ts)),e.comments.forEach(e=>{n[e.lang]=n[e.lang]||0,n[e.lang]++})),t.length){let r=e.rating[t[0]];this.setState({votings:e,ratingNumber:r?r.r:0,commentsByLanguage:n})}else this.setState({votings:e,commentsByLanguage:n})})}setAdapterRating(e,t,n,r,i){return fetch(`https://rating.iobroker.net/vote`,{method:`POST`,headers:{"Content-Type":`application/json`},redirect:`follow`,body:JSON.stringify({uuid:this.props.uuid,adapter:e,version:t,rating:n,comment:r,lang:i})}).then(e=>e.json()).then(r=>(window.alert(`${this.props.t(`Vote:`)} ${e}@${t}=${n}`),delete r.adapter,r)).catch(e=>(window.alert(`Cannot vote: ${e}`),null))}renderInfoText(){return w(`div`,{style:J.infoTextContainer,children:[C(ze,{}),C(O,{style:J.infoText,children:this.props.t(`use GitHub for issues`)})]})}renderComments(){var e;if((e=this.state.votings)!=null&&e.comments&&this.state.votings.comments.length){let e=this.state.votings.comments.find(e=>!(this.state.filterLang&&this.state.filterLang!==`_`&&e.lang!==this.state.filterLang));return w(`div`,{style:{width:`100%`,textAlign:`left`},children:[C(E,{component:`h3`,sx:J.listTitle,children:this.props.t(`Comments`)}),w(pe,{variant:`standard`,style:J.languageFilter,children:[C(he,{children:this.props.t(`Show comments in language`)}),w(j,{variant:`standard`,value:this.state.filterLang,onChange:e=>{(window._localStorage||window.localStorage).setItem(`app.commentLang`,e.target.value),this.setState({filterLang:e.target.value})},children:[w(R,{value:`_`,children:[this.props.t(`All`),` `,C(`span`,{style:J.commentCount,children:this.state.votings.comments.length})]}),Yt.map(e=>w(R,{value:e.id,children:[e.title,` `,this.state.commentsByLanguage[e.id]?C(`span`,{style:J.commentCount,children:this.state.commentsByLanguage[e.id]}):null]},e.id))]})]}),w(t,{style:J.list,dense:!0,disablePadding:!0,children:[e&&this.state.votings.comments.map((e,t)=>this.state.filterLang&&this.state.filterLang!==`_`&&e.lang!==this.state.filterLang?null:e?w(we,{title:e.uuid?this.props.t(`Your comment`):``,sx:{"&.MuiListItem-root":e.uuid?J.listOwn:void 0},dense:!0,children:[C(He,{style:J.listRating,children:C(Fe,{readOnly:!0,defaultValue:e.rating,size:`small`})}),C(Oe,{primary:e.comment,secondary:`${new Date(e.ts).toLocaleString()} / v${e.version}`,sx:{"& .MuiListItemText-secondary":J.listTime}})]},t):null),!e&&C(`div`,{style:J.noComments,children:this.props.t(`No comments in selected language`)})]})]})}return null}render(){var e,t;let n,r;if(this.state.votings){let e=this.state.votings.rating||{};r=Object.keys(e),r.sort((t,n)=>e[t].ts>e[n].ts?-1:+(e[t].ts<e[n].ts)),r.length&&(n=e[r[0]])}return w(k,{open:!0,onClose:()=>this.props.onClose(),children:[C(d,{children:`${this.props.t(`Review`)} ${this.props.adapter}${this.props.version?`@${this.props.version}`:``}`}),w(x,{style:{textAlign:`center`},title:((e=this.props.currentRating)==null?void 0:e.title)||``,children:[this.renderInfoText(),C(Fe,{style:J.rating,name:this.props.adapter,value:this.props.version?this.state.ratingNumber:(t=this.props.currentRating)==null||(t=t.rating)==null?void 0:t.r,size:`large`,readOnly:!this.props.version,onChange:(e,t)=>this.setState({ratingNumber:t})}),this.props.version?w(`div`,{style:{width:`100%`,textAlign:`left`},children:[C(z,{variant:`standard`,style:J.ratingTextControl,value:this.state.ratingComment,label:this.props.t(`Comment to version`),helperText:this.props.t(`Max length %s characters`,200),onChange:e=>this.setState({ratingComment:e.target.value}),slotProps:{input:{endAdornment:this.state.ratingComment?C(_,{position:`end`,children:C(I,{tabIndex:-1,size:`small`,onClick:()=>this.setState({ratingComment:``}),children:C(F,{})})}):null},htmlInput:{maxLength:200}}}),w(pe,{variant:`standard`,style:J.ratingLanguageControl,children:[C(he,{children:this.props.t(`Language`)}),C(j,{variant:`standard`,value:this.state.ratingLang,onChange:e=>this.setState({ratingLang:e.target.value}),children:Yt.map(e=>C(R,{value:e.id,children:e.title},e.id))})]})]}):null,this.props.version?C(`div`,{style:{paddingTop:20,paddingBottom:16},children:this.props.t(`Rate how good this version of the adapter works on your system. You can vote for every new version.`)}):null,r&&n?C(`div`,{children:this.props.t(`You voted for %s on %s`,r[0],new Date(n.ts).toLocaleDateString())}):null,this.renderComments()]}),w(b,{children:[this.props.version&&C(D,{variant:`contained`,autoFocus:!0,color:`primary`,disabled:!this.state.ratingNumber||this.state.votings===null,onClick:()=>{this.state.ratingNumber!==(n==null?void 0:n.r)||this.state.ratingComment?this.setAdapterRating(this.props.adapter,this.props.version,this.state.ratingNumber||5,this.state.ratingComment,this.state.ratingLang).then(e=>this.props.onClose(e)):this.props.onClose()},startIcon:C(Xe,{}),children:this.props.t(`Rate`)}),C(D,{autoFocus:!this.props.version,variant:`contained`,onClick:()=>this.props.onClose(),color:`grey`,startIcon:C(F,{}),children:this.props.t(`Close`)})]})]})}};c();var Zt={formControl:{marginTop:24},closeButton:e=>({position:`absolute`,right:8,top:8,color:e.palette.grey[500]}),typography:{paddingRight:30}},Qt=class extends M{constructor(e){super(e),u(this,`t`,void 0),this.state={deleteCustom:!1,deleteCustomSupported:!1},this.t=e.t}componentDidMount(){this.props.socket.checkFeatureSupported(`DEL_INSTANCE_CUSTOM`).then(e=>{if(e)return this.props.socket.getObject(`system.adapter.${this.props.adapter}`).then(e=>{e!=null&&e.common?e.common.supportCustoms&&this.setState({deleteCustomSupported:e.common.supportCustoms}):this.setState({deleteCustomSupported:!0})})})}render(){return w(k,{onClose:this.props.onClose,open:!0,children:[C(d,{children:w(O,{component:`h2`,variant:`h6`,sx:{"&.MuiTypography-root":Zt.typography},children:[this.t(`Please confirm`),C(I,{size:`large`,sx:Zt.closeButton,onClick:this.props.onClose,children:C(F,{})})]})}),w(x,{dividers:!0,children:[C(O,{gutterBottom:!0,children:this.t(`Are you sure you want to delete adapter %s?`,this.props.adapter)}),this.state.deleteCustomSupported&&C(h,{control:C(l,{checked:this.state.deleteCustom,onChange:e=>this.setState({deleteCustom:e.target.checked})}),label:this.t(`Delete all custom object settings of this adapter too`)})]}),w(b,{children:[C(D,{id:`adapter-delete-dialog-ok`,variant:`contained`,autoFocus:!0,onClick:()=>{this.props.onClick(this.state.deleteCustom),this.props.onClose()},color:`primary`,startIcon:C(f,{}),children:this.t(`Ok`)}),C(D,{id:`adapter-delete-dialog-cancel`,variant:`contained`,autoFocus:!0,onClick:()=>this.props.onClose(),color:`grey`,startIcon:C(F,{}),children:this.t(`Close`)})]})]})}},$t={none:C(et,{}),patch:C(nt,{style:{color:`green`}}),minor:C($e,{style:{color:`orange`}}),major:C(te,{style:{color:`red`}})},en=class extends v.Component{constructor(e){super(e),this.state={currentSavedPolicy:`none`,policy:`none`,repositories:[],supported:!0}}async componentDidMount(){await this.getConfiguredRepositories(),await this.getCurrentAutoUpgradeSetting()}async getConfiguredRepositories(){var e;let t=await this.props.socket.getObject(`system.config`);if(!(t!=null&&(e=t.common)!=null&&e.adapterAutoUpgrade))return;let n=Object.entries(t.common.adapterAutoUpgrade.repositories).filter(([,e])=>e).map(([e])=>e);this.setState({repositories:n})}getAdapterId(){return`${this.props.hostId}.adapter.${this.props.adapter}`}async getCurrentAutoUpgradeSetting(){let e=await this.props.socket.getObject(this.getAdapterId());e?this.setState({policy:e.common.automaticUpgrade||`none`,currentSavedPolicy:e.common.automaticUpgrade||`none`}):(console.error(`no adapter object existing`),this.setState({supported:!1}))}async save(){let e=await this.props.socket.getObject(this.getAdapterId());e?(e.common.automaticUpgrade=this.state.policy,await this.props.socket.setObject(this.getAdapterId(),e),this.setState({currentSavedPolicy:this.state.policy},()=>this.props.onClose())):(console.error(`no adapter object existing`),this.setState({supported:!1}))}render(){return w(k,{open:!0,maxWidth:`md`,fullWidth:!0,children:[C(d,{children:S.t(`Auto upgrade policy for %s`,this.props.adapter)}),w(x,{style:{padding:`0 20px`,overflow:`hidden`},children:[C(V,{value:!this.state.supported,children:C(O,{children:S.t(`This feature is supported up from js-controller Kiera (Version 6)!`)})}),w(V,{value:this.state.supported,children:[C(O,{children:S.t(`Allow only the following upgrades to be performed automatically:`)}),C(j,{variant:`standard`,style:{marginTop:20,minWidth:150,marginBottom:8},value:this.state.policy,onChange:e=>this.setState({policy:e.target.value}),children:mt.map(e=>C(R,{value:e,children:w(`div`,{style:{display:`flex`,gap:8},children:[$t[e],ft[e]]})},e))}),C(V,{value:this.state.repositories.includes(`beta`)&&this.state.policy!==`none`,children:C(i,{type:`warning`,children:S.t(`repo_update_hint`)})}),C(V,{value:this.state.policy===`major`,children:C(i,{type:`warning`,children:S.t(`The current selected configuration will allow to automatically pull in incompatible changes of this adapter!`)})})]})]}),w(b,{children:[C(D,{disabled:this.state.currentSavedPolicy===this.state.policy,color:`primary`,variant:`contained`,startIcon:C(ee,{}),onClick:()=>this.save(),children:S.t(`Save`)}),C(D,{variant:`contained`,onClick:()=>this.props.onClose(),color:`grey`,startIcon:C(F,{}),children:S.t(`Close`)})]})]})}};c();var tn=new Set([`admin`,`eos-admin`,`backitup`,`nexowatt-devices`,`nexowatt-device`,`nexowatt-dev`,`nexowatt-ui`]),nn=e=>String(e||``).toLowerCase().replace(/^system\.adapter\./,``).replace(/^iobroker\./,``).replace(/^@nexowatt\/iobroker\./,``).replace(/^@nexowatt\//,``).replace(/\.\d+$/,``),rn=e=>{let t=nn(e);return tn.has(t)},an={hidden:{display:`none`},buttonUpdate:{border:`1px solid`,padding:`0px 7px`,borderRadius:5,display:`flex`,alignItems:`center`,cursor:`pointer`,transition:`background 0.5s`,"&:hover":{background:`#00800026`}},buttonUpdateIcon:{height:20,width:20,marginRight:10},classPoll:{color:`orange`},classPush:{color:`green`},classAssumption:{color:`red`,transform:`rotate(90deg)`},marginLeft5:{marginLeft:5},ratingSet:{cursor:`pointer`},sentry:{width:21,height:21,objectFit:`fill`,marginTop:3,filter:`invert(0%) sepia(90%) saturate(1267%) hue-rotate(-260deg) brightness(99%) contrast(97%)`},tooltip:{pointerEvents:`none`},wrongDependencies:{color:o[700]},updateAvailable:{color:ce[700]},repositoryVersionAvailable:{color:y[800]},currentVersion:e=>({cursor:`pointer`,mb:`6px`,mr:`8px`,mt:`4px`,"&:hover":{background:e.palette.primary.dark}}),header:e=>({fontWeight:`bold`,background:e.palette.secondary.main,p:`10px`}),modalDialog:{height:`calc(100% - 64px)`,overflowY:`hidden`},currentVersionText:e=>({color:e.palette.mode===`dark`?`#a3ffa3`:`#009800`,fontWeight:`bold`,marginLeft:`4px`}),repoStableVersionText:e=>({color:e.palette.mode===`dark`?`#8dff7a`:`#2b9800`,fontWeight:`bold`,marginLeft:`4px`}),repoLatestVersionText:e=>({color:e.palette.mode===`dark`?`#a3fcff`:`#005498`,fontWeight:`bold`,marginLeft:`4px`}),rating:{},containerVersion:{},containerSpecificVersion:{},versionWarn:{color:y[500]},cardContentFlexBetween:{},cardContentFlex:{}},on=class e extends K{constructor(e){super(e),u(this,`installedVersion`,``),Object.assign(this.state,{autoUpgradeDialogOpen:!1,showUpdateDialog:!1,installRepositoryVersion:!1,adapterDeletionDialog:!1,adapterInstallSpecificVersion:``,showInstallVersion:!1,showSetRating:null})}static renderImage(e){var t;let{style:n,alt:r,...i}=e,a=(t=n.backgroundImage)==null?void 0:t.substring(5,n.backgroundImage.length-2);return C(`img`,{...i,alt:r,src:a,onError:e=>{e.target&&(e.target.onerror=null,e.target.src=`img/no-image.svg`)}})}renderAddInstanceButton(){let e=!this.props.context.repository[this.props.adapterName]||this.props.context.repository[this.props.adapterName].allowAdapterInstall;return C(V,{value:e!==!1&&!K.isSingletonInstalled(this.props.adapterName,this.props.context),children:C(A,{title:this.props.context.t(`Add instance`),slotProps:{popper:{sx:this.styles.tooltip}},children:C(I,{size:`small`,disabled:this.props.commandRunning,style:this.props.cached.rightOs?void 0:this.styles.hidden,onClick:this.props.cached.rightOs?e=>{e.preventDefault(),e.stopPropagation(),this.onAddInstance(this.props.adapterName,this.props.context)}:void 0,children:C(We,{})})})})}renderAutoUpgradeButton(){var e;let t=this.props.context.hostAdapterWorker.getObject(this.props.adapterName);if(!t)return C(`div`,{style:{width:34,height:34,display:`inline-block`}});let n=(e=t.common)==null?void 0:e.automaticUpgrade;return C(A,{title:this.props.context.t(`Automatic Upgrade Policy`)+(n?`: ${n}`:``),slotProps:{popper:{sx:this.styles.tooltip}},children:C(I,{size:`small`,onClick:e=>{e.preventDefault(),e.stopPropagation(),this.setState({autoUpgradeDialogOpen:!0,showDialog:!0})},children:!n||n===`none`?C(at,{}):$t[n]})})}renderReadmeButton(){let e=!this.props.context.repository[this.props.adapterName]||this.props.context.repository[this.props.adapterName].allowAdapterReadme;return C(V,{value:e,children:C(A,{title:this.props.context.t(`Readme`),slotProps:{popper:{sx:this.styles.tooltip}},children:C(I,{size:`small`,onClick:e=>{e.preventDefault(),e.stopPropagation(),this.openInfoDialog()},children:C(ae,{})})})})}renderRating(){var e,t;let n=!this.props.context.repository[this.props.adapterName]||this.props.context.repository[this.props.adapterName].allowAdapterRating;return this.props.context.isTileView&&(this.props.context.sortPopularFirst||this.props.context.sortRecentlyUpdated||this.props.context.sortRecentlyCreated)||!this.props.context.repository[this.props.adapterName].stat||n===!1?null:C(`div`,{onClick:()=>this.setState({showSetRating:{version:this.installedVersion,rating:this.props.context.repository[this.props.adapterName].rating},showDialog:!0}),style:{...this.styles.rating,...this.styles.ratingSet},title:(e=this.props.context.repository[this.props.adapterName].rating)==null?void 0:e.title,children:C(Fe,{name:this.props.adapterName,precision:.5,size:`small`,readOnly:!0,value:((t=this.props.context.repository[this.props.adapterName].rating)==null||(t=t.rating)==null?void 0:t.r)||0})})}renderConnectionType(){var e;let t=(e=this.props.context.repository[this.props.adapterName])==null?void 0:e.connectionType;return t===`cloud`?C(A,{title:this.props.context.t(`Adapter requires the specific cloud access for these devices/service`),slotProps:{popper:{sx:this.styles.tooltip}},children:C(xt,{})}):t===`local`?C(A,{title:this.props.context.t(`Adapter does not use the cloud for these devices/service`),slotProps:{popper:{sx:this.styles.tooltip}},children:C(Ze,{})}):null}renderDataSource(){var e;let t=(e=this.props.context.repository[this.props.adapterName])==null?void 0:e.dataSource;return t?C(`div`,{style:this.styles.marginLeft5,title:t,children:t===`poll`?C(A,{title:this.props.context.t(`The device or service will be periodically asked`),slotProps:{popper:{sx:this.styles.tooltip}},children:C(je,{style:this.styles.classPoll})}):t===`push`?C(A,{title:this.props.context.t(`The device or service delivers the new state actively`),slotProps:{popper:{sx:this.styles.tooltip}},children:C(ne,{style:this.styles.classPush})}):t===`assumption`?C(A,{slotProps:{popper:{sx:this.styles.tooltip}},title:this.props.context.t(`Adapter cannot request the exactly device status and the status will be guessed on the last sent command`),children:C(ut,{style:this.styles.classAssumption})}):C(`div`,{style:{width:24,height:24}})}):null}renderLicenseInfo(e=!1){var t,n,r,i;let a=this.props.context.repository[this.props.adapterName],o=Rt(a),s=(t=a.licenseInformation)!=null&&t.type?C(oe,{href:o,target:`_blank`,rel:`noopener`,sx:e=>({color:e.palette.mode===`dark`?`white`:`black`,"&:hover":{color:e.palette.mode===`dark`?`white`:`black`}}),children:((n=a.licenseInformation)==null?void 0:n.type)===`paid`?C(A,{title:this.props.context.t(`The adapter requires a paid license.`),slotProps:{popper:{sx:this.styles.tooltip}},children:C(Ye,{})}):((r=a.licenseInformation)==null?void 0:r.type)===`commercial`?C(A,{slotProps:{popper:{sx:this.styles.tooltip}},title:this.props.context.t(`The adapter requires a paid license for commercial use.`),children:C(Ye,{opacity:.5})}):((i=a.licenseInformation)==null?void 0:i.type)===`limited`?C(A,{slotProps:{popper:{sx:this.styles.tooltip}},title:this.props.context.t(`The adapter has a limited functionality without a paid license.`),children:C(Ye,{opacity:.5})}):null}):null;return!s&&e?C(`div`,{style:{width:24,height:24}}):s}renderSentryInfo(){var e;return(e=this.props.context.repository[this.props.adapterName])!=null&&(e=e.plugins)!=null&&e.sentry?C(`div`,{style:this.styles.marginLeft5,children:C(A,{title:`sentry`,slotProps:{popper:{sx:this.styles.tooltip}},children:C(ue,{style:this.styles.sentry,component:`img`,image:Ot})})}):null}getDependencies(){let e=K.getDependencies(this.props.adapterName,this.props.context);if(!e)return null;let t=[];for(let r of e){var n;r.installedVersion?(n=r.wrongHosts)!=null&&n.length?t.push(`${this.props.context.t(`The following hosts do not fulfill the required version %s of %s:`,r.version||`unknown`,r.name)} ${r.wrongHosts.map(e=>`${e.host} (${e.installedVersion})`).join(`, `)}`):r.rightVersion||t.push(`${this.props.context.t(`Invalid version of %s. Required %s. Current `,r.name,r.version||`unknown`)}${r.installedVersion}`):t.push(this.props.context.t(`No version of %s`,r.name,r.name))}return t.length?(t.unshift(this.props.context.t(`Wrong dependencies`)),t.map((e,t)=>C(`div`,{style:t?void 0:{fontWeight:`bold`,fontSize:`larger`},children:e},e))):null}renderVersion(){let e=!this.props.context.repository[this.props.adapterName]||this.props.context.repository[this.props.adapterName].allowAdapterUpdate,t=this.props.context.repository[this.props.adapterName],n=t==null?void 0:t.version;return n?!this.props.commandRunning&&e!==!1&&this.isRepositoryVersionInstallable()?C(A,{title:this.props.context.t(`Install version %s from repository`,n),slotProps:{popper:{sx:this.styles.tooltip}},children:w(`div`,{onClick:()=>this.setState({showUpdateDialog:!0,showDialog:!0,installRepositoryVersion:!0}),style:{...this.styles.buttonUpdate,...this.props.cached.rightDependencies?this.styles.repositoryVersionAvailable:void 0},children:[C(I,{style:this.styles.buttonUpdateIcon,size:`small`,children:C(bt,{})}),n]})}):!this.props.commandRunning&&this.props.cached.updateAvailable&&e!==!1?C(A,{title:this.props.context.t(`Update`),slotProps:{popper:{sx:this.styles.tooltip}},children:w(`div`,{onClick:e=>{e.preventDefault(),e.stopPropagation(),this.setState({showUpdateDialog:!0,showDialog:!0,installRepositoryVersion:!1})},style:{...this.styles.buttonUpdate,...this.props.cached.rightDependencies?this.styles.updateAvailable:void 0},children:[C(I,{style:this.styles.buttonUpdateIcon,size:`small`,children:C(xe,{})}),n]})}):C(A,{title:this.getDependencies(),slotProps:{popper:{sx:this.styles.tooltip}},children:C(`span`,{style:this.props.cached.rightDependencies?void 0:this.styles.wrongDependencies,children:n})}):C(`span`,{style:this.styles.wrongDependencies,children:this.props.context.t(`not maintained`)})}isRepositoryVersionInstallable(){var e,t,n;let r=(e=this.props.context.repository[this.props.adapterName])==null?void 0:e.version,i=(t=this.props.context.installed[this.props.adapterName])==null?void 0:t.version;if(!r||!i||this.props.cached.updateAvailable)return!1;if(r!==i)return ht.updateAvailable(r,i,`adapter "${this.props.adapterName}"`);let a=(n=this.props.context.adapters[`system.adapter.${this.props.adapterName}`])==null||(n=n.common)==null?void 0:n.installedFrom;return!!a&&!a.startsWith(`iobroker.${this.props.adapterName}@`)}static extractGitHubCommitHash(e){if(!e)return null;let t=e.indexOf(`#`);if(t===-1)return null;let n=e.substring(t+1);return n.length>=7?n.substring(0,7):n}renderInstalledVersion(t){var n;let r=this.props.context.installed[this.props.adapterName],i=(n=this.props.context.adapters[`system.adapter.${this.props.adapterName}`])==null||(n=n.common)==null?void 0:n.installedFrom,{adapterName:a}=this.props,o=i&&!i.startsWith(`iobroker.${a}@`),s=o?e.extractGitHubCommitHash(i):null,c=o&&s?`${this.installedVersion}+${s}`:this.installedVersion;if(t){let e=r==null?void 0:r.enabled,t=r==null?void 0:r.count;return w(p,{container:!0,wrap:`nowrap`,spacing:1,sx:{alignItems:`center`},children:[this.installedVersion?C(p,{children:c+(t?` (${t}${t===e?``:`~`})`:``)}):null,o&&C(p,{container:!0,children:C(A,{title:`${this.props.context.t(`Non-NPM-Version`)}: ${i}`,slotProps:{popper:{sx:this.styles.tooltip}},children:C(st,{fontSize:`small`,style:this.styles.versionWarn})})})]})}return this.installedVersion?w(O,{component:`span`,style:this.styles.cardContentFlexBetween,children:[w(`div`,{children:[this.props.context.t(`Installed version`),`:`]}),w(`div`,{style:this.styles.cardContentFlex,children:[o&&C(A,{title:`${this.props.context.t(`Non-NPM-Version`)}: ${i}`,slotProps:{popper:{sx:this.styles.tooltip}},children:C(st,{fontSize:`small`,style:this.styles.versionWarn})}),c]})]}):null}renderUploadButton(){return this.props.context.expertMode&&this.installedVersion?C(A,{title:this.props.context.t(`Upload`),slotProps:{popper:{sx:this.styles.tooltip}},children:C(I,{size:`small`,disabled:this.props.commandRunning,"data-eos-adapter-action":`upload`,onClick:e=>{e.preventDefault(),e.stopPropagation(),this.onUpload()},children:C(Te,{})})}):null}renderDeleteButton(){let e=rn(this.props.adapterName);return C(V,{value:!!this.installedVersion&&!e,children:C(A,{title:this.props.context.t(`Delete adapter`),slotProps:{popper:{sx:this.styles.tooltip}},children:C(I,{size:`small`,disabled:this.props.commandRunning,"data-eos-adapter-action":`delete`,onClick:e=>{e.preventDefault(),e.stopPropagation(),this.setState({adapterDeletionDialog:!0,showDialog:!0})},children:C(lt,{})})})})}renderInstallSpecificVersionButton(){return this.props.context.expertMode&&this.installedVersion?C(A,{title:this.props.context.t(`Install a specific version`),slotProps:{popper:{sx:this.styles.tooltip}},children:C(I,{disabled:this.props.commandRunning,size:`small`,"data-eos-adapter-action":`install-specific-version`,onClick:e=>{e.preventDefault(),e.stopPropagation(),this.setState({showInstallVersion:!0,showDialog:!0})},children:C(rt,{})})}):null}renderRebuildButton(){return!this.props.context.expertMode||!this.installedVersion?null:C(A,{title:this.props.context.t(`Rebuild`),children:C(I,{size:`small`,disabled:this.props.commandRunning,"data-eos-adapter-action":`rebuild`,onClick:e=>{e.preventDefault(),e.stopPropagation(),this.rebuild()},children:C(s,{})})})}renderAutoUpdateDialog(){return this.state.autoUpgradeDialogOpen?C(en,{onClose:()=>this.setState({autoUpgradeDialogOpen:!1,showDialog:!1}),adapter:this.props.adapterName,hostId:this.props.context.adminHost,socket:this.props.context.socket}):null}async ignoreVersion(e){let t=await this.props.context.socket.getObject(`system.adapter.${this.props.adapterName}`);t!=null&&t.common?(t.common.ignoreVersion=e,this.props.context.socket.setObject(t._id,t).catch(e=>window.alert(`Cannot write object: ${e}`))):window.alert(`Adapter "${this.props.adapterName}" does not exist!`),this.props.context.removeUpdateAvailable(this.props.adapterName)}renderUpdateAdapterDialog(){var e,t;if(!this.state.showUpdateDialog)return null;this.installedVersion=(e=this.props.context.installed[this.props.adapterName])==null?void 0:e.version;let n=(t=this.props.context.repository[this.props.adapterName])==null?void 0:t.version;return C(Mt,{textTitle:this.state.installRepositoryVersion?this.props.context.t(`Install "%s" v%s from repository instead of v%s`,this.props.adapterName,n,this.installedVersion):void 0,textUpdate:this.state.installRepositoryVersion?this.props.context.t(`Install`):void 0,adapter:this.props.adapterName,adapterObject:this.props.context.repository[this.props.adapterName],t:this.props.context.t,dependencies:K.getDependencies(this.props.adapterName,this.props.context),rightDependencies:this.props.context.rightDependenciesFunc(this.props.adapterName),news:this.getNews(),toggleTranslation:this.props.context.toggleTranslation,noTranslation:this.props.noTranslation,installedVersion:this.installedVersion,onUpdate:e=>this.setState({showUpdateDialog:!1,showDialog:!1},()=>this.update(e)),isStable:this.props.context.repository._repoInfo.stable,onIgnore:this.state.installRepositoryVersion?void 0:e=>this.setState({showUpdateDialog:!1,showDialog:!1},()=>void this.ignoreVersion(e)),onClose:()=>this.setState({showUpdateDialog:!1,showDialog:!1}),instances:this.props.context.compactInstances,theme:this.props.context.theme})}static formatNews(e){return(e||``).toString().split(`
|
|
4
|
+
`).map(e=>e.trim().replace(/^\*+/,``).replace(/^-/,``).replace(/\*+$/,``).replace(/\r/g,``).trim()).filter(e=>e).map((e,t)=>w(`div`,{style:{},children:[C(`span`,{children:`- `}),e]},t))}renderAdapterInstallVersion(){if(!this.state.showInstallVersion)return null;let t,n,r=this.props.context.repository._repoInfo;if(r!=null&&r.stable){var i,a;t=(i=this.props.context.repository[this.props.adapterName])==null?void 0:i.version,n=(a=this.props.context.repository[this.props.adapterName])==null?void 0:a.latestVersion}else{var o,s;t=(o=this.props.context.repository[this.props.adapterName])==null?void 0:o.stable,n=(s=this.props.context.repository[this.props.adapterName])==null?void 0:s.version}return C(Nt,{title:this.props.context.t(`Please select specific version of %s`,this.props.adapterName),applyButton:!1,onClose:()=>this.setState({showInstallVersion:!1,adapterInstallSpecificVersion:``,showDialog:!1}),theme:this.props.context.theme,toggleTranslation:this.props.context.toggleTranslation,noTranslation:this.props.noTranslation,children:w(`div`,{style:{height:`100%`,overflowY:`hidden`},children:[w(`div`,{style:this.styles.containerSpecificVersion,children:[w(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[C(z,{variant:`standard`,style:{flexGrow:1},label:this.props.context.t(`Enter version manually`),value:this.state.adapterInstallSpecificVersion,onChange:e=>this.setState({adapterInstallSpecificVersion:e.target.value}),slotProps:{input:{endAdornment:this.state.adapterInstallSpecificVersion?C(_,{position:`end`,children:C(I,{tabIndex:-1,size:`small`,onClick:()=>this.setState({adapterInstallSpecificVersion:``}),children:C(F,{})})}):null}}}),C(D,{color:`primary`,variant:`contained`,size:`small`,disabled:!this.state.adapterInstallSpecificVersion,onClick:()=>{this.state.adapterInstallSpecificVersion&&(this.update(this.state.adapterInstallSpecificVersion),this.setState({showInstallVersion:!1,adapterInstallSpecificVersion:``,showDialog:!1}))},children:this.props.context.t(`Install`)})]}),C(A,{title:this.props.context.t(`npmjs.com`),slotProps:{popper:{sx:this.styles.tooltip}},children:C(I,{size:`small`,onClick:()=>{var e;(e=window.open(`https://www.npmjs.com/package/iobroker.${this.props.adapterName}?activeTab=versions`,this.props.adapterName))==null||e.focus()},children:C(Ae,{})})})]}),C(E,{component:`div`,sx:this.styles.header,children:this.props.context.t(`Or select from the list`)}),C(`div`,{style:{...this.styles.containerVersion,height:`calc(100% - 122px)`,overflowY:`auto`},children:this.getNews(!0).map(({version:r,news:i})=>C(le,{variant:`outlined`,sx:this.styles.currentVersion,onClick:()=>{this.update(r),this.setState({showInstallVersion:!1,showDialog:!1})},children:w(Ge,{children:[w(O,{sx:m.getStyle(this.props.context.theme,this.installedVersion===r&&this.styles.currentVersionText,{fontSize:16,fontWeight:`bold`}),color:`text.secondary`,gutterBottom:!0,children:[r,this.installedVersion===r?C(E,{component:`span`,sx:this.styles.currentVersionText,children:`(${this.props.context.t(`current`)})`}):null,n===r?C(E,{component:`span`,sx:this.styles.repoLatestVersionText,children:`(latest)`}):null,t===r?C(E,{component:`span`,sx:this.styles.repoStableVersionText,children:`(${this.props.context.t(`stable`)})`}):null]}),C(O,{variant:`body2`,style:{opacity:.7},children:e.formatNews(i)})]})},r))})]})})}renderSetRatingDialog(){return this.state.showSetRating?C(Xt,{t:this.props.context.t,lang:this.props.context.lang,version:this.state.showSetRating.version,adapter:this.props.adapterName,currentRating:this.state.showSetRating.rating,onClose:e=>{e&&this.props.context.updateRating(this.props.adapterName,e),this.setState({showSetRating:null,showDialog:!1})},uuid:this.props.context.uuid}):null}renderAdapterDeletionDialog(){return this.state.adapterDeletionDialog?C(Qt,{adapter:this.props.adapterName,socket:this.props.context.socket,t:this.props.context.t,onClick:e=>this.delete(e),onClose:()=>this.setState({adapterDeletionDialog:!1,showDialog:!1})}):null}openInfoDialog(){var e;let t=(e=this.props.context.repository[this.props.adapterName].docs)!=null&&e[this.props.context.lang]?this.props.context.lang:`en`;window.open(ht.getDocsLinkForAdapter({lang:t,adapterName:this.props.adapterName}),`help`)}getNews(e=!1){let t=this.props.context.repository[this.props.adapterName],n=this.props.context.installed[this.props.adapterName],r=[];return n&&t!=null&&t.news&&Object.keys(t.news).forEach(i=>{try{if(L.gt(i,n.version)||e){let e;e=typeof t.news[i]==`object`?this.props.noTranslation?t.news[i].en:t.news[i][this.props.context.lang]||t.news[i].en:t.news[i],r.push({version:i,news:e})}}catch{console.warn(`[ADAPTERS] Cannot compare "${i}" and "${n.version}" (${this.props.adapterName})`)}}),r}onUpload(){var e;let t=this.props.context.repository[this.props.adapterName],n=zt(t),r=((e=t.licenseInformation)==null?void 0:e.license)||t.license;r!==`MIT`&&r!==`Apache-2.0`&&r!==`ISC`&&r!==`BSD-3-Clause`&&r!==`BSD-2-Clause`&&r?this.setState({showLicenseDialog:{url:n,upload:!0,adapterName:this.props.adapterName,licenseType:r},showDialog:!0}):K.upload(this.props.adapterName,this.props.context)}delete(e){rn(this.props.adapterName)?window.alert(`Dieser Adapter ist ein geschütztes NexoWatt-EOS-Systemmodul und darf nicht gelöscht werden.`):this.props.context.executeCommand(`del ${this.props.adapterName}${e?` --custom`:``}${this.props.context.expertMode?` --debug`:``}`)}update(e){this.props.context.executeCommand(`upgrade ${this.props.adapterName}@${e}${this.props.context.expertMode?` --debug`:``}`)}rebuild(){this.props.context.executeCommand(`rebuild ${this.props.adapterName}${this.props.context.expertMode?` --debug`:``}`)}renderDialogs(){return this.state.showDialog?w(g,{children:[this.renderAddInstanceDialog(this.props.context),this.renderLicenseDialog(this.props.context),this.renderUpdateAdapterDialog(),this.renderAdapterInstallVersion(),this.renderSetRatingDialog(),this.renderAdapterDeletionDialog(),this.renderAutoUpdateDialog()]}):null}};c();var sn=`0 8px 17px 0 rgba(0, 0, 0, .2),0 6px 20px 0 rgba(0, 0, 0, .19)`,cn={...an,type:{color:`tile`},root:e=>({position:`relative`,m:`10px`,width:300,minHeight:200,borderRadius:24,overflow:`hidden`,background:`linear-gradient(180deg, rgba(13, 36, 58, 0.90), rgba(7, 23, 39, 0.88))`,boxShadow:`0 14px 30px rgba(0,0,0,.24)`,display:`flex`,flexDirection:`column`,transition:`box-shadow 0.18s ease, transform 0.18s ease, border-color 0.18s ease`,"&:hover":{boxShadow:sn}}),imageBlock:e=>({background:`linear-gradient(135deg, rgba(0,255,136,.16), rgba(0,212,255,.11))`,borderBottom:`1px solid rgba(0,255,136,.20)`,minHeight:60,display:`flex`,padding:`0 10px 0 10px`,position:`relative`,justifyContent:`space-between`,color:`#eef7ff`}),img:{width:45,height:45,margin:`auto 0`,position:`relative`,"&:after":{content:`""`,position:`absolute`,zIndex:2,top:0,left:0,width:`100%`,height:`100%`,background:`url("img/no-image.svg") 100% 100% no-repeat`,backgroundSize:`cover`,backgroundColor:`#fff`}},installed:{background:`#77c7ff8c`},update:{background:`#10ff006b`},fab:{position:`absolute`,bottom:-20,width:40,height:40,right:20},greenText:e=>({color:e.palette.success.dark}),collapse:{height:`100%`,background:`linear-gradient(180deg, rgba(8, 29, 47, 0.985), rgba(4, 14, 25, 0.975))`,color:`#eef7ff`,border:`1px solid rgba(0, 255, 136, 0.34)`,borderRadius:24,position:`absolute`,width:`100%`,zIndex:1200,marginTop:`auto`,bottom:0,overflow:`hidden`,pointerEvents:`auto`,justifyContent:`space-between`,display:`flex`,flexDirection:`column`},close:{display:`flex`,ml:`auto`,mt:`-4px`,color:`#eaf9ff`},footerBlock:e=>({background:`rgba(2, 9, 20, 0.90)`,borderTop:`1px solid rgba(0,255,136,.22)`,position:`relative`,zIndex:40,pointerEvents:`auto`,p:`10px`,display:`flex`,justifyContent:`space-between`}),versionDate:{alignSelf:`center`},adapter:e=>({width:`100%`,fontWeight:`bold`,fontSize:16,verticalAlign:`middle`,pl:1,pt:2,color:(e.palette.mode,`#333`)}),adapterWithAgo:{width:`calc(100% - 145px)`},description:e=>({display:`block`,color:`rgba(238, 247, 255, 0.94)`,fontSize:13.5,lineHeight:1.48,whiteSpace:`normal`,overflowWrap:`anywhere`}),cardContent:{overflow:`auto`},cardContentDiv:{position:`sticky`,right:0,top:0,background:`linear-gradient(135deg, rgba(0,255,136,.16), rgba(0,212,255,.09))`,borderBottom:`1px solid rgba(0,255,136,.22)`,zIndex:2},cardContentFlex:{display:`flex`},cardContentFlexBetween:{display:`flex`,justifyContent:`space-between`},cardContent2:{height:`100%`,display:`flex`,flexDirection:`column`,justifyContent:`space-between`},cardMargin10:{marginTop:10},availableVersion:{display:`flex`,justifyContent:`space-between`},curdContentFlexCenter:{display:`flex`,alignItems:`center`},versionWarn:{color:y[500],marginRight:5},rating:{marginTop:20}},ln=class extends on{constructor(e){super(e),u(this,`styles`,cn),Object.assign(this.state,{openCollapse:!1})}renderInfoCard(){return w(`div`,{className:`eos-adapter-info-card`,style:this.styles.collapse,children:[w(Ge,{style:this.styles.cardContent,children:[C(`div`,{style:this.styles.cardContentDiv,children:C(I,{size:`small`,sx:this.styles.close,onClick:()=>this.setState({openCollapse:!this.state.openCollapse}),children:C(F,{})})}),C(O,{gutterBottom:!0,component:`span`,variant:`body2`,sx:this.styles.description,children:this.props.cached.desc})]}),w(E,{component:`div`,sx:this.styles.footerBlock,children:[this.renderAddInstanceButton(),w(`div`,{style:this.styles.cardContentFlex,children:[this.renderAutoUpgradeButton(),this.renderReadmeButton(),this.renderUploadButton(),this.renderDeleteButton(),this.renderInstallSpecificVersionButton()]})]})]})}renderCardMedia(){let e=this.props.context.repository[this.props.adapterName],t=e==null?void 0:e.version;return w(E,{component:`div`,sx:m.getStyle(this.props.context.theme,this.styles.imageBlock,this.installedVersion&&this.styles.installed,this.installedVersion&&t&&this.installedVersion!==t&&this.props.cached.updateAvailable&&this.styles.update),children:[C(ue,{sx:this.styles.img,component:e=>on.renderImage(e),src:this.props.cached.image||`img/no-image.svg`,image:this.props.cached.image||`img/no-image.svg`}),C(E,{component:`div`,sx:m.getStyle(this.props.context.theme,this.styles.adapter,(e.stat||this.props.context.sortRecentlyUpdated||this.props.context.sortRecentlyCreated)&&this.styles.adapterWithAgo),children:this.props.adapterName}),this.props.context.sortPopularFirst?C(`div`,{style:this.styles.versionDate,children:e.stat}):null,this.props.context.sortRecentlyUpdated?C(`div`,{style:this.styles.versionDate,children:this.props.cached.daysAgoText}):null,this.props.context.sortRecentlyCreated?C(`div`,{style:this.styles.versionDate,children:this.props.cached.createdDaysAgoText}):null,!this.props.context.sortPopularFirst&&!this.props.context.sortRecentlyUpdated&&!this.props.context.sortRecentlyCreated?this.renderRating():null,this.state.openCollapse?null:C(A,{title:this.props.context.t(`Info`),slotProps:{popper:{sx:{pointerEvents:`none`}}},children:C(Ke,{onClick:()=>this.setState({openCollapse:!this.state.openCollapse}),style:this.styles.fab,color:`primary`,"aria-label":`add`,children:C(Be,{})})})]})}renderCardContent(){let e=!this.props.context.repository[this.props.adapterName]||this.props.context.repository[this.props.adapterName].allowAdapterUpdate,t=this.props.context.installed[this.props.adapterName];return w(Ge,{style:this.styles.cardContent2,children:[C(O,{gutterBottom:!0,variant:`h5`,component:`h5`,children:this.props.cached.title}),w(`div`,{style:this.styles.cardContentFlex,children:[this.renderConnectionType(),this.renderDataSource(),C(`div`,{children:this.renderLicenseInfo()}),this.renderSentryInfo()]}),w(`div`,{style:this.styles.cardMargin10,children:[t!=null&&t.count?w(O,{component:`span`,style:this.styles.cardContentFlexBetween,children:[w(`div`,{children:[this.props.context.t(`Installed instances`),`:`]}),C(`div`,{children:t.count})]}):null,C(V,{value:e,children:w(O,{component:`span`,style:this.styles.availableVersion,children:[C(`div`,{children:this.props.context.t(`Available version:`)}),C(E,{component:`div`,sx:m.getStyle(this.props.context.theme,this.props.cached.updateAvailable&&this.styles.greenText,this.styles.curdContentFlexCenter),children:this.renderVersion()})]})}),this.renderInstalledVersion()]})]})}render(){var e;return this.installedVersion=(e=this.props.context.installed[this.props.adapterName])==null?void 0:e.version,w(le,{sx:this.styles.root,children:[this.state.openCollapse?this.renderInfoCard():null,this.renderCardMedia(),this.renderCardContent(),this.renderDialogs()]})}};c();var un={...an,type:{color:`line`},smallAvatar:{width:32,height:32,marginLeft:4},paddingNone:{padding:`0 !important`},name:{flexWrap:`nowrap`,width:300,marginTop:0},flex:{display:`flex`},nameCell:{paddingTop:`0 !important`,paddingBottom:`0 !important`}},dn=class extends on{constructor(...e){super(...e),u(this,`styles`,un)}render(){var e,t;let n=this.props.context.repository[this.props.adapterName],r=!n||n.allowAdapterRating;return this.installedVersion=(e=this.props.context.installed[this.props.adapterName])==null?void 0:e.version,w(P,{hover:!0,children:[C(N,{}),C(N,{children:w(p,{container:!0,spacing:1,style:this.styles.name,sx:{alignItems:`center`},children:[C(A,{title:this.props.adapterName,slotProps:{popper:{sx:this.styles.tooltip}},children:C(p,{style:this.styles.paddingNone,children:C(Ee,{variant:`square`,alt:this.props.cached.title,src:this.props.cached.image,style:this.styles.smallAvatar})})}),r===!1?C(p,{children:this.props.cached.title}):w(p,{style:this.styles.nameCell,children:[C(`div`,{children:this.props.cached.title}),this.renderRating()]})]})}),!this.props.context.descHidden&&C(N,{title:this.props.cached.desc,style:{width:20,wordWrap:`break-word`},children:this.props.cached.desc}),C(N,{children:w(`div`,{style:this.styles.flex,children:[this.renderConnectionType()||C(`div`,{style:{width:24,height:24}}),this.renderDataSource()||C(`div`,{style:{marginLeft:5,width:24,height:24}}),this.renderSentryInfo()||C(`div`,{style:{marginLeft:5,width:24,height:24}}),this.renderLicenseInfo(!0)]})}),C(N,{children:this.renderInstalledVersion(!0)}),C(N,{children:C(p,{container:!0,sx:{alignItems:`center`},children:this.renderVersion()})}),C(N,{style:{fontSize:`smaller`},children:(n==null||(t=n.licenseInformation)==null?void 0:t.license)||(n==null?void 0:n.license)}),w(N,{children:[this.renderAddInstanceButton(),this.renderAutoUpgradeButton(),this.renderReadmeButton(),this.renderUploadButton(),this.renderDeleteButton(),this.renderInstallSpecificVersionButton(),this.renderRebuildButton()]}),this.renderDialogs()]})}};c();var fn=246,Y={emptyBlock:50,name:300,connectionType:120,installed:120,available:120,update:40,license:80,install:fn},pn=Object.keys(Y).reduce((e,t)=>e+Y[t],0),X={container:{height:`100%`,width:`100%`},containerNotFullHeight:{height:`calc(100% - 50px)`},containerFullHeight:{height:`100%`},table:{width:`100%`,tableLayout:`fixed`,minWidth:960,"& td":{whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`,pt:`2px`,pb:`2px`,pr:`4px`,pl:`4px`},"& th":{whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`,pt:`2px`,pb:`2px`,pr:`4px`,pl:`4px`}},name:{flexWrap:`nowrap`,width:Y.name},emptyBlock:{flexWrap:`nowrap`,width:Y.emptyBlock},description:{width:`calc(100% - ${pn+2}px)`},connectionType:{width:Y.connectionType},installed:{width:Y.installed},available:{width:Y.available,paddingRight:6},update:{width:Y.update,padding:0},license:{width:Y.license},install:{width:Y.install},viewModeDiv:{display:`flex`,flexFlow:`wrap`,overflow:`auto`,justifyContent:`center`}},mn=class extends M{constructor(e){super(e),u(this,`lastRenderCounter`,-1),this.state={descWidth:e.descWidth,repoName:e.repoName,systemConfig:!!e.systemConfig,tableViewMode:e.tableViewMode,oneListView:e.oneListView,categoriesExpanded:JSON.stringify(e.categoriesExpanded),cachedAdapters:e.cachedAdapters?Object.keys(e.cachedAdapters).length:0,update:e.update,sortByName:e.sortByName,sortPopularFirst:e.sortPopularFirst,sortRecentlyUpdated:e.sortRecentlyUpdated,sortRecentlyCreated:e.sortRecentlyCreated,renderCounter:0,listOfVisibleAdapter:JSON.stringify(e.listOfVisibleAdapter),expertMode:e.context.expertMode,commandRunning:e.commandRunning,noTranslation:e.noTranslation}}getRow(e,t){var n;let r=(n=this.props.cachedAdapters)==null?void 0:n[e];return r?C(dn,{context:t,adapterName:e,cached:r,commandRunning:this.state.commandRunning,noTranslation:this.state.noTranslation},`adapter-${e}`):null}getRows(e){if(!this.props.listOfVisibleAdapter)return C(P,{children:C(N,{colSpan:8,children:C(T,{})})});let t=0,n=[];if(this.props.oneListView){for(let t=0;t<this.props.listOfVisibleAdapter.length;t++){var r;let i=this.props.listOfVisibleAdapter[t];if(n.length>50&&!((r=this.props.context.installed[i])!=null&&r.version))continue;let a=this.getRow(i,e);a&&n.push(a)}if(t=n.length,t&&this.props.listOfVisibleAdapter.length>n.length){let e=this.props.listOfVisibleAdapter.length-n.length,t=e===1?this.props.context.t(`Filter adapters to see others. There is %s more`,1):this.props.context.t(`Filter adapters to see others. There are %s more`,e);n.push(C(P,{children:C(N,{colSpan:8,style:{fontSize:20,padding:20,textAlign:`center`},children:t})},`more`))}}else n=this.props.categories.map(n=>{if(!n.adapters.find(e=>{var t;return(t=this.props.listOfVisibleAdapter)==null?void 0:t.includes(e)}))return null;let r=n.name,i=this.props.categoriesExpanded[r];return t++,w(Re,{children:[C(Jt,{categoryName:r,count:n.count,expanded:i,installedCount:n.installed,name:n.translation,descHidden:e.descHidden,onToggle:()=>this.props.toggleCategory(r),t:this.props.context.t},`category-${r}1`),i&&n.adapters.map(n=>{let r=this.getRow(n,e);return r&&t++,r})]},`category-${r} ${n.adapters.length}`)});return t?n:this.props.update?null:C(`tr`,{children:w(`td`,{colSpan:8,style:{textAlign:`center`},children:[this.props.searchFilter||this.props.installedListFilter?C(D,{variant:`outlined`,title:this.props.context.t(`Click to clear all filters`),onClick:()=>this.props.clearAllFilters(),children:this.props.context.t(`all items are filtered out`)}):null,this.props.updateListFilter&&(this.props.searchFilter||this.props.installedListFilter)?C(`br`,{}):null,this.props.updateListFilter?C(D,{style:{marginTop:16},variant:`outlined`,onClick:()=>this.props.clearAllFilters(!0),startIcon:C(Tt,{}),children:this.props.context.t(`Remove filter for updatable adapters`)}):null]})})}getTiles(e){if(!this.props.listOfVisibleAdapter)return C(T,{});if(!this.props.listOfVisibleAdapter.length)return this.props.update?null:w(`div`,{style:{width:`100%`,display:`flex`,flexDirection:`column`,justifyContent:`center`,alignItems:`center`,gap:16},children:[this.props.searchFilter||this.props.installedListFilter?C(A,{title:this.props.context.t(`Click to clear all filters`),slotProps:{popper:{sx:{pointerEvents:`none`}}},children:C(D,{variant:`outlined`,onClick:()=>this.props.clearAllFilters(),children:this.props.context.t(`all items are filtered out`)})}):null,this.props.updateListFilter?C(D,{variant:`outlined`,onClick:()=>this.props.clearAllFilters(!0),startIcon:C(Tt,{}),children:this.props.context.t(`Remove filter for updatable adapters`)}):null]});let t=[];for(let i=0;i<this.props.listOfVisibleAdapter.length;i++){var n,r;let a=this.props.listOfVisibleAdapter[i],o=(n=this.props.cachedAdapters)==null?void 0:n[a];t.length>50&&!((r=this.props.context.installed[a])!=null&&r.version)||o&&t.push(C(ln,{context:e,adapterName:a,cached:o,commandRunning:this.state.commandRunning,noTranslation:this.state.noTranslation},`adapter-${a}`))}return this.props.listOfVisibleAdapter.length>t.length&&(t.push(C(`div`,{style:{flexBasis:`100%`,height:0}},`newLine`)),t.push(C(`div`,{style:{fontSize:20,margin:20},children:this.props.context.t(`Filter adapters to see others. There is %s more`,this.props.listOfVisibleAdapter.length-t.length)},`more`))),t}shouldShowRepositoryWarning(e,t){return!e&&String(t||``).toLowerCase()!==`nexowatt`}renderTileView(e,t,n){return w(g,{children:[this.shouldShowRepositoryWarning(e,t)?C(E,{sx:{marginX:2,marginTop:1,width:`calc(100% - 32px)`},children:C(i,{type:`warning`,children:this.props.context.t(`Active repo is "%s"`,t)})}):null,C(`div`,{style:X.viewModeDiv,children:this.getTiles(n)})]})}renderTableView(e,t,n){return w(qe,{children:[this.shouldShowRepositoryWarning(e,t)?C(E,{sx:{marginX:2,marginTop:1,width:`calc(100% - 32px)`},children:C(i,{type:`warning`,children:this.props.context.t(`Active repo is "%s"`,t)})}):null,C(Ie,{style:{...X.container,...e?X.containerFullHeight:X.containerNotFullHeight},children:w(Ce,{stickyHeader:!0,size:`small`,sx:X.table,children:[C(De,{children:w(P,{children:[C(N,{style:X.emptyBlock}),C(N,{style:X.name,children:C(O,{children:this.props.context.t(`Name`)})}),!n.descHidden&&C(N,{style:{...X.description,width:this.props.descWidth},children:C(O,{children:this.props.context.t(`Description`)})}),C(N,{style:X.connectionType}),C(N,{style:X.installed,children:C(O,{children:this.props.context.t(`Installed`)})}),C(N,{style:X.available,children:C(O,{children:this.props.context.t(`Available`)})}),C(N,{style:X.license,children:C(O,{children:this.props.context.t(`License`)})}),C(N,{style:{...X.install,width:this.state.expertMode?fn:178},children:C(O,{children:this.props.context.t(`Install`)})})]})}),C(Ve,{children:this.getRows(n)})]})})]})}static getDerivedStateFromProps(e,t){let n=!1;e.descWidth!==t.descWidth&&(console.log(`Render because of descWidth`),n=!0),e.repoName!==t.repoName&&(console.log(`Render because of repoName`),n=!0),!!e.systemConfig!==t.systemConfig&&(console.log(`Render because of systemConfig`),n=!0),e.tableViewMode!==t.tableViewMode&&(console.log(`Render because of tableViewMode`),n=!0),e.oneListView!==t.oneListView&&(console.log(`Render because of oneListView`),n=!0);let r=JSON.stringify(e.categoriesExpanded);r!==t.categoriesExpanded&&(console.log(`Render because of categoriesExpanded`),n=!0);let i=e.cachedAdapters?Object.keys(e.cachedAdapters).length:0;i!==t.cachedAdapters&&(console.log(`Render because of cachedAdapters ${i} <> ${t.cachedAdapters}`),n=!0),e.update!==t.update&&(console.log(`Render because of update`),n=!0),e.sortByName!==t.sortByName&&(console.log(`Render because of sortByName`),n=!0),e.sortPopularFirst!==t.sortPopularFirst&&(console.log(`Render because of sortPopularFirst`),n=!0),e.sortRecentlyUpdated!==t.sortRecentlyUpdated&&(console.log(`Render because of sortRecentlyUpdated`),n=!0),e.sortRecentlyCreated!==t.sortRecentlyCreated&&(console.log(`Render because of sortRecentlyCreated`),n=!0),e.context.expertMode!==t.expertMode&&(console.log(`Render because of expertMode`),n=!0);let a=JSON.stringify(e.listOfVisibleAdapter);return a!==t.listOfVisibleAdapter&&(console.log(`Render because of listOfVisibleAdapter`),n=!0),e.commandRunning!==t.commandRunning&&(console.log(`Render because of commandRunning`),n=!0),e.noTranslation!==t.noTranslation&&(console.log(`Render because of commandRunning`),n=!0),n?{descWidth:e.descWidth,repoName:e.repoName,systemConfig:!!e.systemConfig,tableViewMode:e.tableViewMode,oneListView:e.oneListView,categoriesExpanded:r,cachedAdapters:i,update:e.update,sortByName:e.sortByName,sortPopularFirst:e.sortPopularFirst,sortRecentlyUpdated:e.sortRecentlyUpdated,sortRecentlyCreated:e.sortRecentlyCreated,listOfVisibleAdapter:a,renderCounter:t.renderCounter+1,expertMode:e.context.expertMode,commandRunning:e.commandRunning,noTranslation:e.noTranslation}:null}shouldComponentUpdate(e,t){return this.lastRenderCounter!==t.renderCounter&&(this.lastRenderCounter=t.renderCounter,!0)}render(){var e;return(e=this.props.systemConfig)!=null&&(e=e.common)!=null&&e.activeRepo?this.props.tableViewMode?this.renderTableView(this.props.stableRepo,this.props.repoName,this.props.context):this.renderTileView(this.props.stableRepo,this.props.repoName,this.props.context):C(T,{})}};c();var hn=class extends M{constructor(e){super(e),u(this,`updating`,void 0),u(this,`interval`,null),u(this,`startTimeout`,null),u(this,`textareaRef`,void 0),u(this,`link`,void 0),u(this,`oldVersion`,void 0),this.state={response:null,error:null,starting:!0,upAgain:!1},this.updating=!1,this.textareaRef=v.createRef(),this.link=`${window.location.protocol}//${window.location.host}/`}setUpdating(e){this.updating!==e&&(this.updating=e,this.props.onUpdating(e))}async getWebserverParams(){let e=await this.props.socket.getObject(`system.adapter.${this.props.adminInstance}`);return{useHttps:e==null?void 0:e.native.secure,port:e==null?void 0:e.native.port,certPrivateName:e==null?void 0:e.native.certPrivate,certPublicName:e==null?void 0:e.native.certPublic}}async componentDidMount(){let{certPrivateName:e,certPublicName:t,port:n,useHttps:r}=await this.getWebserverParams();this.oldVersion=this.props.currentAdminVersion,await this.props.socket.upgradeAdapterWithWebserver(this.props.host,{version:this.props.version,adapterName:`eos-admin`,port:n,useHttps:r,certPublicName:t,certPrivateName:e}),this.setUpdating(!0),this.interval=setInterval(()=>this.checkStatus(),1e3),this.startTimeout=setTimeout(()=>{this.startTimeout=null,this.setState({starting:!1})},1e4)}componentWillUnmount(){this.interval&&=(clearInterval(this.interval),null),this.startTimeout&&=(clearTimeout(this.startTimeout),null)}async checkVersion(){try{let e=await(await fetch(`./version`)).text();return e&&e.length<20&&e!==this.oldVersion?(this.interval&&=(clearInterval(this.interval),null),this.setState({response:{running:!1,success:!0,stderr:[],stdout:[S.t(`Version updated to %s`,e)]},upAgain:!0,error:null},()=>this.setUpdating(!1)),!0):e===this.oldVersion}catch{return!1}}async checkStatus(){console.log(`Request update status from: ${this.link}`);try{let e=await(await fetch(this.link)).text();if(console.log(`Received status: ${e}`),e.startsWith(`{`)&&e.endsWith(`}`))try{let t=JSON.parse(e);t!=null&&t.stderr&&(t.stderr=t.stderr.filter(e=>e.trim())),t&&!t.running&&t.success&&t.stdout?(t.stdout.push(``),t.stdout.push(`---------------------------------------------------`),t.stdout.push(S.t(`%s was successfully updated to %s`,`eos-admin`,this.props.version))):t!=null&&t.stdout&&(t.stdout.unshift(``),t.stdout.unshift(`---------------------------------------------------`),t.stdout.unshift(S.t(`updating %s to %s...`,`eos-admin`,this.props.version))),this.setState({response:t,error:null},()=>{t&&!t.running?(this.interval&&=(clearInterval(this.interval),null),this.waitForAdapterStart()):t!=null&&t.running&&this.setUpdating(!0),this.textareaRef.current&&setTimeout(()=>this.textareaRef.current&&(this.textareaRef.current.scrollTop=this.textareaRef.current.scrollHeight),100)})}catch(t){console.error(`Cannot parse response: ${t}`),this.setState({error:e},()=>this.setUpdating(!1))}else await this.checkVersion()||console.error(`Response is not JSON: ${e}`)}catch(e){this.state.starting||this.setState({error:e.toString()},()=>this.setUpdating(!1))}}waitForAdapterStart(){this.interval=setInterval(async()=>{try{await fetch(this.link),this.interval&&clearInterval(this.interval),this.interval=null,this.setState({upAgain:!0})}catch{}},1e3)}render(){var e,t,n,r,i,a,o;return w(k,{onClose:(e,t)=>{t!==`escapeKeyDown`&&t!==`backdropClick`&&this.props.onClose()},open:!0,maxWidth:`lg`,fullWidth:!0,children:[C(d,{children:S.t(`Updating %s...`,`eos-admin`)}),w(x,{style:{height:400,padding:`0 20px`,overflow:`hidden`},children:[(!this.state.response||this.state.response.running)&&!this.state.error?C(T,{}):null,this.state.response||this.state.error?C(`textarea`,{ref:this.textareaRef,style:{width:`100%`,height:`100%`,resize:`none`,background:this.props.themeType===`dark`?`#000`:`#fff`,color:this.props.themeType===`dark`?`#EEE`:`#111`,boxSizing:`border-box`,fontFamily:`Consolas,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New, monospace`,border:(e=this.state.response)!=null&&e.success?`2px solid green`:this.state.error||this.state.response&&!this.state.response.running&&!this.state.response.success?`2px solid red`:void 0},value:this.state.error?this.state.error:(t=this.state.response)!=null&&(t=t.stderr)!=null&&t.length?this.state.response.stderr.join(`
|
|
5
|
+
`):(n=this.state.response)==null||(n=n.stdout)==null?void 0:n.join(`
|
|
6
|
+
`),readOnly:!0}):null]}),C(b,{children:C(D,{variant:`contained`,disabled:this.state.starting||!this.state.error&&!this.state.upAgain,onClick:()=>{var e;(e=this.state.response)!=null&&e.success&&window.location.reload(),this.props.onClose()},color:(r=this.state.response)!=null&&r.success?`primary`:`grey`,startIcon:(i=this.state.response)!=null&&i.success?C(xe,{}):C(F,{}),children:(a=this.state.response)!=null&&a.success&&!this.state.upAgain?C(re,{}):(o=this.state.response)!=null&&o.success?S.t(`Reload`):S.t(`Close`)})})]})}};c();var gn=864e5,_n=5e3,vn=gn/10,Z={grow:{flexGrow:1},counters:{mr:`10px`,minWidth:120,display:`flex`,"& div":{ml:`3px`}},infoAdapters:e=>({fontSize:10,color:e.palette.mode===`dark`?`#9c9c9c`:`#333`,cursor:`pointer`}),greenText:{color:`#00a005d1`},tooltip:{pointerEvents:`none`}},Q=`Description A-Z`,$=`Name A-Z`,yn=`Popular first`,bn=`Recently updated`,xn=`Recently created`,Sn=[{name:Q},{name:$},{name:yn,notByList:!0},{name:bn,notByList:!0},{name:xn,notByList:!0}],Cn=class e extends K{static isTransientConnectionError(e){return/notconnected|not connected|connectionerror|close_abnormal|closed_no_status|websocket|timeout|networkerror/i.test(e instanceof Error?e.message:typeof e==`string`?e:``)}scheduleInitializationRetry(){if(this.unmounted||this.initializationRetryTimer)return;let e=[250,500,1e3,2e3,4e3,8e3,12e3,15e3],t=e[Math.min(this.initializationRetryAttempt,e.length-1)];this.initializationRetryAttempt++,this.initializationRetryTimer=setTimeout(()=>{this.initializationRetryTimer=null,this.initializeAdapters()},t)}async initializeAdapters(){if(!(this.unmounted||this.initialized||this.initializing||!this.props.ready)){this.initializing=!0;try{if(!this.hostAdapterWorker||this.hostAdapterWorker.getHost()!==this.props.currentHost){var t;(t=this.hostAdapterWorker)==null||t.destroy(),this.hostAdapterWorker=new Lt(this.props.socket,this.props.currentHost),this.hostAdapterWorker.registerHandler(this.onHostAdapterChanged)}if(!await this.hostAdapterWorker.getObjects())throw Error(`Host adapter data are not available yet`);if(await this.updateAll(),this.unmounted)return;this.state.search&&this.filterAdapters(),this.workerHandlersRegistered||=(this.props.adaptersWorker.registerHandler(this.onAdaptersChanged),this.props.instancesWorker.registerHandler(this.onAdaptersChanged),!0),this.initialized=!0,this.initializationRetryAttempt=0}catch(t){this.unmounted||(e.isTransientConnectionError(t)||console.error(`Cannot initialize adapter list: ${t}`),this.scheduleInitializationRetry())}finally{this.initializing=!1}}}constructor(e){super(e),u(this,`inputRef`,void 0),u(this,`countRef`,void 0),u(this,`t`,void 0),u(this,`wordCache`,{}),u(this,`cache`,{listOfVisibleAdapter:null,adapters:null}),u(this,`listOfVisibleAdapterLength`,0),u(this,`allAdapters`,0),u(this,`installedAdapters`,0),u(this,`recentUpdatedAdapters`,0),u(this,`recentCreatedAdapters`,0),u(this,`uuid`,``),u(this,`buildCacheTimer`,null),u(this,`updateTimeout`,null),u(this,`typingTimer`,null),u(this,`hostsTimer`,null),u(this,`onHostAdapterTimer`,null),u(this,`tempAdapters`,null),u(this,`tempInstalled`,null),u(this,`tempInstances`,null),u(this,`hostAdapterWorker`,null),u(this,`initializing`,!1),u(this,`initialized`,!1),u(this,`unmounted`,!1),u(this,`initializationRetryTimer`,null),u(this,`initializationRetryAttempt`,0),u(this,`workerHandlersRegistered`,!1),u(this,`installedOfHosts`,{}),u(this,`installedReadId`,0),u(this,`installedShownId`,0),u(this,`installedPending`,!1),u(this,`translate`,(e,t,n)=>t===void 0?(this.wordCache[e]||=this.props.t(e),this.wordCache[e]):n===void 0?this.props.t(e,t):this.props.t(e,t,n)),u(this,`onAdaptersChanged`,e=>{this.tempAdapters||=JSON.parse(JSON.stringify(this.state.adapters||{})),this.tempInstalled||=JSON.parse(JSON.stringify(this.state.installed||{})),this.tempInstances||=JSON.parse(JSON.stringify(this.state.compactInstances||{}));let t=this.tempAdapters,n=this.tempInstalled,r=this.tempInstances;e.forEach(e=>{if(e.id.match(/\.\d+$/))e.type===`deleted`||!e.obj?delete r[e.id]:r[e.id]={enabled:e.obj.common.enabled,icon:e.obj.common.icon,name:e.obj.common.name,adminTab:e.obj.common.adminTab,version:e.obj.common.version};else if(e.type===`deleted`||!e.obj){let r=e.id.split(`.`);delete n[r[2]],delete t[e.id]}else{let r=e.obj.common.name;n[r]?Object.keys(n[r]).forEach(t=>{e.obj.common[t]!==void 0&&t!==`installedFrom`&&(n[r][t]=e.obj.common[t])}):n[e.id.split(`.`).pop()||``]=JSON.parse(JSON.stringify(e.obj.common)),t[e.id]=e.obj}}),this.updateTimeout&&clearTimeout(this.updateTimeout),this.updateTimeout=setTimeout(()=>{this.updateTimeout=null;let e=this.tempAdapters;this.tempAdapters=null;let t=this.tempInstalled;this.tempInstalled=null;let n=this.tempInstances;this.tempInstances=null,this.analyseInstalled({adapters:e||{},installedLocal:t||{},cb:()=>this.calculateInfo(n||{})})},300)}),u(this,`rightDependencies`,e=>K.getDependencies(e,this.state).every(e=>e.rightVersion)),u(this,`onHostAdapterChanged`,e=>{this.onHostAdapterTimer&&clearTimeout(this.onHostAdapterTimer),this.onHostAdapterTimer=setTimeout(()=>{this.onHostAdapterTimer=null,this.cache.listOfVisibleAdapter=null,this.forceUpdate()},200)}),u(this,`setAdminUpgradeTo`,e=>this.setState({adminUpgradeTo:e})),this.state={...this.state||{},lastUpdate:0,repository:{},installed:{},installedGlobal:{},installedGlobalHosts:{},adapters:{},compactInstances:{},categories:[],hostData:null,compactRepositories:null,hostOs:``,nodeJsVersion:``,init:!1,update:!1,filterConnectionType:!1,search:(window._localStorage||window.localStorage).getItem(`Adapter.search`)||``,oneListView:!1,tableViewMode:!1,updateList:!1,installedList:0,categoriesTiles:`All`,filterTiles:Q,gitHubInstallDialog:!1,updateAvailable:[],filteredList:null,showUpdater:!1,descWidth:300,showStatistics:!1,readTimeoutMs:wt.getReadTimeoutMs(),showSlowConnectionWarning:!1,currentHost:e.currentHost,forceUpdateAdapters:e.forceUpdateAdapters,triggerUpdate:e.triggerUpdate,ratings:null,categoriesExpanded:{},adminUpgradeTo:``},this.inputRef=n(),this.countRef=n(),this.t=this.translate}renderSlowConnectionWarning(){return this.state.showSlowConnectionWarning?C(wt,{readTimeoutMs:this.state.readTimeoutMs,t:this.t,onClose:e=>{e?this.setState({showSlowConnectionWarning:!1,readTimeoutMs:e},()=>this.updateAll()):this.setState({showSlowConnectionWarning:!1})}}):null}componentDidMount(){this.unmounted=!1,this.initializeAdapters()}async updateAll(e,t,n){let r=this.state.currentHost?this.readAdaptersInfo(e):null,i=++this.installedReadId,a=this.readInstalled(e,i),{repository:o,allInstalled:s}=await this.getAdapters(a,e,t,n);r&&await this.getAdaptersInfo(r,n),!s&&i===this.installedReadId&&(this.installedShownId=i,a.then(async()=>{i===this.installedReadId&&(await this.readMissingNews(o),this.showInstalled(o))})),i===this.installedReadId&&this.props.adaptersWorker.isForceUpdate()&&await this.updateAll(!0)}componentDidUpdate(e){!this.props.ready||e.ready&&this.initialized||this.initializeAdapters();let t=this.getDescWidth();this.state.descWidth!==t&&this.setState({descWidth:t}),this.countRef.current&&(this.countRef.current.innerHTML=this.listOfVisibleAdapterLength.toString())}componentWillUnmount(){var e;this.unmounted=!0,this.initializationRetryTimer&&=(clearTimeout(this.initializationRetryTimer),null),this.updateTimeout&&=(clearTimeout(this.updateTimeout),null),this.buildCacheTimer&&=(clearTimeout(this.buildCacheTimer),null),this.typingTimer&&=(clearTimeout(this.typingTimer),null),this.hostsTimer&&=(clearTimeout(this.hostsTimer),null),this.onHostAdapterTimer&&=(clearTimeout(this.onHostAdapterTimer),null),this.installedReadId++,this.workerHandlersRegistered&&=(this.props.adaptersWorker.unregisterHandler(this.onAdaptersChanged),this.props.instancesWorker.unregisterHandler(this.onAdaptersChanged),!1),(e=this.hostAdapterWorker)==null||e.destroy(),this.hostAdapterWorker=null}analyseInstalled(e){let{adapters:t,repository:n}=e,{cb:r,installedLocal:i}=e,{installedGlobal:a,installedGlobalHosts:o}=e;t||=this.state.adapters;let s=i||this.state.installed;a||=this.state.installedGlobal,o||=this.state.installedGlobalHosts,n||=this.state.repository;let c=[];Object.keys(s).forEach(e=>{if(s[e]){let t=s[e].version,r=n[e];r&&r.version!==t&&ht.updateAvailable(t,r.version,`adapter "${e}"`)&&!c.includes(e)&&c.push(e)}}),this.cache.listOfVisibleAdapter=null,this.setState({adapters:t,updateAvailable:c,installed:s,repository:n,installedGlobal:a,installedGlobalHosts:o},()=>r&&r())}async readInstalled(e,t){this.installedPending=!0;let n=[];try{n=await this.props.socket.getHosts(e),Object.keys(this.installedOfHosts).forEach(e=>{n.find(t=>t._id===e)||delete this.installedOfHosts[e]})}catch(e){window.alert(`Cannot read hosts: ${e}`)}let r=n.length;await Promise.all(n.map(async n=>{let i=null;try{let t=await this.props.socket.getState(`${n._id}.alive`);t!=null&&t.val&&(i=await this.props.socket.getInstalled(n._id,e,this.state.readTimeoutMs))}catch(e){window.alert(`Cannot getInstalled from "${n._id}" (timeout ${this.state.readTimeoutMs}ms): ${e}`),e.toString().includes(`timeout`)&&this.setState({showSlowConnectionWarning:!0})}t===this.installedReadId&&(i?this.installedOfHosts[n._id]=i:delete this.installedOfHosts[n._id],r--,r&&this.installedShownId===t&&this.showInstalled())})),t===this.installedReadId&&(this.installedPending=!1)}mergeInstalled(){let e={},t={},n={};return Object.keys(this.installedOfHosts).sort().forEach(r=>{let i=this.installedOfHosts[r];r===this.state.currentHost&&(e=i);let a=r.replace(/^system\.host\./,``);for(let e of Object.keys(i)){var o;e!==`hosts`&&(o=i[e])!=null&&o.version&&(n[e]||={},n[e][a]=i[e].version)}t={...t,...i}}),{installedLocal:e,installedGlobal:t,installedGlobalHosts:n}}showInstalled(e){this.analyseInstalled({adapters:this.state.adapters,repository:e,...this.mergeInstalled(),cb:()=>void this.calculateInfo(this.state.compactInstances||{})})}async readMissingNews(e){try{await gt(this.props.socket,this.state.currentHost,e,Object.keys(this.mergeInstalled().installedGlobal),{repo:this.props.systemConfig.common.activeRepo,lang:this.props.lang},this.state.readTimeoutMs)}catch(e){console.warn(`Cannot read the news of the installed adapters: ${e}`)}}async getAdapters(e,t,n,r){console.log(`[ADAPTERS] getAdapters`);let i=this.state.currentHost;t||=this.props.adaptersWorker.isForceUpdate(),!this.state.update&&(t||r)&&this.setState({update:!0});let[a,o]=await Promise.all([this.props.adaptersWorker.getObjects(t).then(e=>e||{}).catch(e=>(window.alert(`Cannot getAdapters: ${e}`),{})),Ct(this.props.socket,i,{repo:this.props.systemConfig.common.activeRepo,update:n||r,lang:this.props.lang},t,this.state.readTimeoutMs).then(e=>e).catch(e=>(window.alert(`Cannot getRepository: ${e}`),e.toString().includes(`timeout`)&&this.setState({showSlowConnectionWarning:!0}),{}))]);if(this.installedPending){let t;await Promise.race([e,new Promise(e=>t=setTimeout(e,_n))]),clearTimeout(t)}let s=!this.installedPending;return s&&await this.readMissingNews(o),await new Promise(e=>this.analyseInstalled({adapters:a,repository:o,...this.mergeInstalled(),cb:e})),{repository:o,allInstalled:s}}getWordVotes(e){if(e===1)return this.t(`vote`);if(e>=2&&e<=4)return this.t(`votes2`);if(e>=5&&e<=20)return this.t(`votes`);let t=e%10;return t===1?this.t(`vote21`):t>=2&&t<=4?this.t(`votes2`):this.t(`votes`)}static getAdapterTitle(e,t,n){if(!t[e])return e;let r=t[e].titleLang||t[e].title||``,i;return i=typeof r==`object`?r[n]||r.en:r,i=((i||``).toString()||``).replace(`ioBroker Visualisation - `,``),i.toLowerCase()}static sortAdapters(t,n,r,i,a,o,s,c,l){let u={};t.sort((t,d)=>{if(o){var f,p,m,h;return((f=i[d])==null?void 0:f.stat)===((p=i[t])==null?void 0:p.stat)?(u[t]||=e.getAdapterTitle(t,i,n),u[d]||=e.getAdapterTitle(d,i,n),u[t]>u[d]?1:u[t]<u[d]?-1:0):(((m=i[d])==null?void 0:m.stat)??0)-(((h=i[t])==null?void 0:h.stat)??0)}if(s){if(!i[t])return-1;if(!i[d])return 1;let r=i[t].daysAgo,a=i[d].daysAgo,o=Number.isFinite(r)?r:1/0,s=Number.isFinite(a)?a:1/0;return o===s?(u[t]||=e.getAdapterTitle(t,i,n),u[d]||=e.getAdapterTitle(d,i,n),u[t]>u[d]?1:u[t]<u[d]?-1:0):o-s}if(c){if(!i[t])return-1;if(!i[d])return 1;let r=i[t].createdDaysAgo,a=i[d].createdDaysAgo,o=Number.isFinite(r)?r:1/0,s=Number.isFinite(a)?a:1/0;return o===s?(u[t]||=e.getAdapterTitle(t,i,n),u[d]||=e.getAdapterTitle(d,i,n),u[t]>u[d]?1:u[t]<u[d]?-1:0):o-s}if(l){if(l[t].exact&&!l[d].exact)return-1;if(!l[t].exact&&l[d].exact)return 1}return r[t]&&r[d]?a?t>d?1:t<d?-1:0:(u[t]||=e.getAdapterTitle(t,i,n),u[d]||=e.getAdapterTitle(d,i,n),u[t]>u[d]?1:u[t]<u[d]?-1:0):r[t]?-1:r[d]?1:a?t>d?1:t<d?-1:0:(u[t]||=e.getAdapterTitle(t,i,n),u[d]||=e.getAdapterTitle(d,i,n),u[t]>u[d]?1:u[t]<u[d]?-1:0)})}calculateInfo(t,n,r,i){r||=this.state.hostData,n||=this.state.ratings,t||=this.state.compactInstances,i!=null&&i._id||(i=this.state.compactRepositories);let a=this.state.adapters,o=JSON.parse(JSON.stringify(this.state.installed)),s=JSON.parse(JSON.stringify(this.state.repository)),c=((r==null?void 0:r[`Node.js`])||``).replace(`v`,``),l=(r==null?void 0:r.os)||``,u={},d=[],f={};try{f=JSON.parse((window._localStorage||window.localStorage).getItem(`Adapters.expandedCategories`)||`null`)||{}}catch{}Object.keys(o).forEach(e=>{var t;let n=o[e];(t=a[e])!=null&&(t=t.common)!=null&&t.ignoreVersion&&(n.ignoreVersion=a[e].common.ignoreVersion),n.controller||e===`hosts`||s[e]||(s[e]=JSON.parse(JSON.stringify(n)),s[e].version=``),n.count=0,n.enabled=0}),Object.keys(t).forEach(e=>{let n=t[e].name;o[n]&&o[n].count++});let p=Date.now();this.recentUpdatedAdapters=0,this.installedAdapters=0,Object.keys(s).forEach(e=>{var t;if(e===`hosts`||e.startsWith(`_`))return;let r=s[e];if(typeof r!=`object`){console.error(`[${e}] ${e} is not an object.`);return}r.keywords&&=r.keywords.map(e=>e.toLowerCase());let i=o[e];if(r.rating=n==null?void 0:n[e],(t=r.rating)!=null&&t.rating){var a,c,l;r.rating.title=[`${this.t(`Total rating:`)} ${r.rating.rating.r} (${r.rating.rating.c} ${this.getWordVotes(r.rating.rating.c)})`,i!=null&&i.version&&r.rating[i.version]?`${this.t(`Rating for`)} v${i.version}: ${(a=r.rating[i.version])==null?void 0:a.r} (${(c=r.rating[i.version])==null?void 0:c.c} ${this.getWordVotes(((l=r.rating.rating)==null?void 0:l.c)??0)})`:``].filter(e=>e).join(`
|
|
7
|
+
`)}else r.rating={title:this.t(`No rating or too few data`)};if(!r.controller){let t=r.type||``,n=o[e],i=Math.round((p-new Date(r.versionDate||0).getTime())/gn),a=Math.round((p-new Date(r.published||0).getTime())/gn);i<=31&&this.recentUpdatedAdapters++,a<=31&&this.recentCreatedAdapters++,o[e]&&this.installedAdapters++,u[t]?(u[t].count++,u[t].adapters.push(e),n&&u[t].installed++):u[t]={name:t,translation:this.t(`${t}_group`),count:1,installed:+!!n,adapters:[e]}}}),Object.keys(u).sort((e,t)=>e===`general`&&t!==`general`?-1:e!==`general`&&t===`general`||u[e].translation>u[t].translation?1:u[e].translation<u[t].translation?-1:0).forEach(e=>d.push(u[e]));let m=this.state.filterTiles===$;Object.keys(u).forEach(t=>e.sortAdapters(u[t].adapters,this.props.lang,o,s,m));let h=0;try{h=JSON.parse((window._localStorage||window.localStorage).getItem(`Adapters.installedList`)||`0`),h===!1&&(h=0)}catch{}let g=(window._localStorage||window.localStorage).getItem(`Adapters.list`)===`true`,_=(window._localStorage||window.localStorage).getItem(`Adapters.viewMode`)===`true`,v=(window._localStorage||window.localStorage).getItem(`Adapters.updateList`)===`true`,ee=(window._localStorage||window.localStorage).getItem(`Adapters.categoriesTiles`)||`All`,y=(window._localStorage||window.localStorage).getItem(`Adapters.filterTiles`)||Q;return y===`A-Z`&&(y=Q),this.allAdapters=Object.keys(s).length-1,this.cache.listOfVisibleAdapter=null,new Promise(e=>{this.setState({repository:s,installed:o,ratings:n,filterTiles:y,categoriesTiles:ee,compactRepositories:i,installedList:h,compactInstances:t,updateList:v,tableViewMode:_,oneListView:g,lastUpdate:Date.now(),hostData:r,hostOs:l,nodeJsVersion:c,categories:d,categoriesExpanded:f,init:!0,update:this.installedPending},()=>e())})}readAdaptersInfo(e){var t;let n=this.state.currentHost,r=((t=this.props.adminGuiConfig.admin)==null||(t=t.adapters)==null?void 0:t.allowAdapterRating)!==!1;return Promise.all([this.props.socket.getHostInfoShort(n,e,this.state.readTimeoutMs).catch(e=>{window.alert(`Cannot getHostInfo for "${n}": ${e}`),e.toString().includes(`timeout`)&&this.setState({showSlowConnectionWarning:!0})}),r?this.props.socket.getRatings(e).catch(e=>(window.alert(`Cannot read ratings: ${e}`),null)):Promise.resolve(null),this.props.socket.getCompactInstances(e).catch(e=>(window.alert(`Cannot read countsOfInstances: ${e}`),{})),this.props.socket.getCompactSystemRepositories(e).catch(e=>(window.alert(`Cannot read getCompactSystemRepositories: ${e}`),{}))]).then(([e,t,n,i])=>(r&&(this.uuid=(t==null?void 0:t.uuid)||``),{hostData:e,ratings:t,compactInstances:n||{},compactRepositories:i}))}async getAdaptersInfo(e,t){if(this.state.currentHost&&Date.now()-this.state.lastUpdate>1e3){console.log(`[ADAPTERS] getAdaptersInfo`);try{(!this.state.update||t)&&await new Promise(e=>{this.setState({update:!0},()=>e())});let{hostData:n,ratings:r,compactInstances:i,compactRepositories:a}=await e;await this.calculateInfo(i,r,n,a)}catch(e){window.alert(`Cannot get adapters info: ${e}`)}}}toggleCategory(e){this.setState(t=>{let n=t.categoriesExpanded;return n[e]=!n[e],(window._localStorage||window.localStorage).setItem(`Adapters.expandedCategories`,JSON.stringify(n)),{categoriesExpanded:n}})}rightOs(e){let t=this.state.repository[e];return t!=null&&t.os?Array.isArray(t.os)?!!t.os.find(e=>this.state.hostOs===e):this.state.hostOs===t.os:!0}handleFilterChange(e){this.typingTimer&&clearTimeout(this.typingTimer),this.typingTimer=setTimeout(e=>{(window._localStorage||window.localStorage).setItem(`Adapter.search`,e||``),this.typingTimer=null,this.filterAdapters(e)},300,e.target.value)}expandAll(){this.setState(e=>{let t=e.categories,n=e.categoriesExpanded;return t.forEach(e=>n[e.name]=!0),(window._localStorage||window.localStorage).setItem(`Adapters.expandedCategories`,JSON.stringify(n)),{categoriesExpanded:n}})}collapseAll(){let e={};(window._localStorage||window.localStorage).setItem(`Adapters.expandedCategories`,JSON.stringify(e)),this.setState({categoriesExpanded:e})}listTable(){let e=!this.state.oneListView;e&&this.expandAll(),(window._localStorage||window.localStorage).setItem(`Adapters.list`,e?`true`:`false`),this.setState({oneListView:e})}changeViewMode(){this.cache.listOfVisibleAdapter=null;let e=!this.state.tableViewMode,t=this.state.filterTiles;e&&t!==Q&&t!==$&&(t=Q,(window._localStorage||window.localStorage).setItem(`Adapters.filterTiles`,t)),(window._localStorage||window.localStorage).setItem(`Adapters.viewMode`,e?`true`:`false`),this.setState({tableViewMode:e,filterTiles:t})}changeUpdateList(){this.cache.listOfVisibleAdapter=null;let e=!this.state.updateList;(window._localStorage||window.localStorage).setItem(`Adapters.updateList`,e?`true`:`false`),this.setState({updateList:e})}changeInstalledList(e){this.cache.listOfVisibleAdapter=null;let t=this.state.installedList?this.state.installedList<2?2:0:1;!t&&e&&(t=1),(window._localStorage||window.localStorage).setItem(`Adapters.installedList`,JSON.stringify(t)),this.setState({installedList:t})}changeFilterTiles(e){this.cache.listOfVisibleAdapter=null,(window._localStorage||window.localStorage).setItem(`Adapters.filterTiles`,e),this.setState({filterTiles:e})}changeCategoriesTiles(e){this.cache.listOfVisibleAdapter=null,(window._localStorage||window.localStorage).setItem(`Adapters.categoriesTiles`,e),this.setState({categoriesTiles:e})}filterAdapters(e){e=e===void 0?this.state.search:e,e=(e||``).toLowerCase().trim();let t=null;if(e){let n={};this.state.categories.forEach(t=>t.adapters.forEach(t=>{var r;let i=this.state.repository[t];if(!i)return;let a,o,s=i.titleLang||i.title;a=typeof s==`object`?s[this.props.lang]||s.en:s,a=((a||``).toString()||``).replace(`ioBroker Visualisation - `,``),o=i.desc?typeof i.desc==`string`?i.desc:i.desc[this.props.lang]||i.desc.en||``:``,t.includes(e)?n[t]={exact:t===e,type:`name`,start:t.startsWith(e)}:a&&typeof a==`string`&&a.toLowerCase().includes(e)?n[t]={exact:!1,type:`title`}:o&&typeof o==`string`&&o.toLowerCase().includes(e)?n[t]={exact:!1,type:`desc`}:(r=i.keywords)!=null&&r.find(t=>t.includes(e))&&(n[t]={exact:!1,type:`keywords`})})),t=n}this.setState({filteredList:t,search:e},()=>{this.cache.listOfVisibleAdapter=null,this.forceUpdate()})}clearAllFilters(e){e?((window._localStorage||window.localStorage).removeItem(`Adapters.updateList`),this.setState({updateList:!1},()=>this.filterAdapters())):((window._localStorage||window.localStorage).removeItem(`Adapter.search`),(window._localStorage||window.localStorage).removeItem(`Adapters.installedList`),(window._localStorage||window.localStorage).removeItem(`Adapters.updateList`),this.inputRef.current&&(this.inputRef.current.value=``),this.setState({filteredList:null,updateList:!1,filterConnectionType:!1,installedList:0,search:``},()=>this.filterAdapters()))}getContext(e){return{expertMode:this.props.expertMode,t:this.t,socket:this.props.socket,removeUpdateAvailable:e=>{let t=[...this.state.updateAvailable],n=t.indexOf(e);n!==-1&&(t.splice(n,1),this.setState({updateAvailable:t}))},toggleTranslation:this.props.toggleTranslation,rightDependenciesFunc:this.rightDependencies,lang:this.props.lang,uuid:this.uuid,themeType:this.props.themeType,theme:this.props.theme,onUpdating:this.props.onUpdating,repository:this.state.repository,installed:this.state.installed,installedGlobal:this.state.installedGlobal,installedGlobalHosts:this.state.installedGlobalHosts,compactInstances:this.state.compactInstances||{},adapters:this.state.adapters,nodeJsVersion:this.state.nodeJsVersion,currentHost:this.state.currentHost,adminHost:this.props.adminHost,adminInstance:this.props.adminInstance,instancesWorker:this.props.instancesWorker,hostsWorker:this.props.hostsWorker,executeCommand:this.props.executeCommand,categories:this.state.categories,descHidden:e,sortPopularFirst:!this.state.tableViewMode&&this.state.filterTiles===yn,sortRecentlyUpdated:!this.state.tableViewMode&&this.state.filterTiles===bn,sortRecentlyCreated:!this.state.tableViewMode&&this.state.filterTiles===xn,isTileView:!this.state.tableViewMode,updateRating:(e,t)=>{let n=JSON.parse(JSON.stringify(this.state.repository));Object.assign(n[e].rating||{},t),this.setState({repository:n})},setAdminUpgradeTo:this.setAdminUpgradeTo,hostAdapterWorker:this.hostAdapterWorker}}buildCache(t){this.cache.listOfVisibleAdapter=[],this.cache.adapters={};let n=Date.now(),r=this.t(`0 %d days ago`),i=this.t(`1 %d days ago`),a=this.t(`2 %d days ago`),o=this.t(`5 %d days ago`);this.state.categories.filter(e=>this.state.tableViewMode||!this.state.categoriesTiles||this.state.categoriesTiles===`All`||e.name===this.state.categoriesTiles).forEach(e=>e.adapters.forEach(e=>{let t=this.state.repository[e];if(t&&!t.controller){let l=t.connectionType?t.connectionType:`-`,u=this.state.updateAvailable.includes(e),d=this.state.installed[e],f=!this.state.filteredList||!!this.state.filteredList[e];if(f&&this.state.filterConnectionType&&(f=l===`local`),f&&this.state.updateList&&(f=u),f&&this.state.installedList&&(f=this.state.installedList<2?!!(d&&d.version):!!(d&&d.version&&!d.count)),f){var s,c;(s=this.cache.listOfVisibleAdapter)==null||s.push(e);let l=Math.round((n-new Date(t.versionDate||0).getTime())/vn),u=Math.round(l/10),f=Math.round((n-new Date(t.published||0).getTime())/vn),p=Math.round(f/10),m=t.titleLang||t.title,h;h=m&&typeof m==`object`?m[this.props.lang]||m.en:m||e,h=((h||``).toString()||``).replace(`ioBroker Visualisation - `,``);let g;g=t.desc?typeof t.desc==`string`?t.desc:t.desc[this.props.lang]||t.desc.en||``:``;let _=u%100<=10||u%100>=20?u%10:5,v=p%100<=10||p%100>=20?p%10:5;this.cache.adapters[e]={title:h,desc:g,image:d!=null&&d.localIcon&&this.state.adapters[`system.adapter.${e}`]?`.${d.localIcon}`:t.extIcon||``,connectionType:t.connectionType?t.connectionType:`-`,updateAvailable:this.state.updateAvailable.includes(e),rightDependencies:this.rightDependencies(e),rightOs:this.rightOs(e),sentry:!!((c=t.plugins)!=null&&c.sentry),daysAgo:l,createdDaysAgo:f,stat:t.stat||0,daysAgoText:u||u===0?u===0?r:_===1?i.replace(`%d`,u.toString()):_===2||_===3||_===4?a.replace(`%d`,u.toString()):o.replace(`%d`,u.toString()):``,createdDaysAgoText:p||p===0?p===0?r:v===1?i.replace(`%d`,p.toString()):v===2||v===3||v===4?a.replace(`%d`,p.toString()):o.replace(`%d`,p.toString()):``}}}})),this.listOfVisibleAdapterLength=this.cache.listOfVisibleAdapter.length;let s=this.state.filterTiles===$;this.state.tableViewMode&&this.state.categories.forEach(t=>e.sortAdapters(t.adapters,this.props.lang,this.state.installed,this.cache.adapters||{},s)),e.sortAdapters(this.cache.listOfVisibleAdapter,this.props.lang,this.state.installed,this.cache.adapters,s,t.sortPopularFirst,t.sortRecentlyUpdated,t.sortRecentlyCreated,this.state.filteredList),this.forceUpdate()}getUpdater(){return this.state.showUpdater?C(Ft,{theme:this.props.theme,onSetCommandRunning:e=>this.props.onSetCommandRunning(e),t:this.props.t,currentHost:this.state.currentHost,lang:this.props.lang,installed:this.state.installed,repository:this.state.repository,toggleTranslation:this.props.toggleTranslation,noTranslation:this.props.noTranslation,onClose:e=>this.setState({showUpdater:!1},()=>e&&this.updateAll(!0,!1)),socket:this.props.socket,rightDependenciesFunc:this.rightDependencies,ready:this.props.ready}):null}getDescWidth(){return this.props.menuOpened?document.body.scrollWidth-pn-180+13:this.props.menuClosed?document.body.scrollWidth-pn:document.body.scrollWidth-pn-50+13}getStatistics(){return this.state.showStatistics?w(k,{open:!0,onClose:()=>this.setState({showStatistics:!1}),children:[C(d,{children:this.t(`Statistics`)}),w(x,{style:{fontSize:16},children:[w(E,{component:`div`,sx:Z.counters,children:[this.t(`Total adapters`),`:`,` `,C(`span`,{style:{paddingLeft:6,fontWeight:`bold`},children:this.allAdapters})]}),w(E,{component:`div`,sx:Z.counters,children:[this.t(`Installed adapters`),`:`,` `,C(`span`,{style:{paddingLeft:6,fontWeight:`bold`},children:this.installedAdapters})]}),w(E,{component:`div`,sx:Z.counters,children:[this.t(`Last month updated adapters`),`:`,` `,C(`span`,{style:{paddingLeft:6,fontWeight:`bold`},children:this.recentUpdatedAdapters})]}),w(E,{component:`div`,sx:Z.counters,children:[this.t(`Last month created adapters`),`:`,` `,C(`span`,{style:{paddingLeft:6,fontWeight:`bold`},children:this.recentCreatedAdapters})]})]}),C(b,{children:C(D,{variant:`contained`,onClick:()=>this.setState({showStatistics:!1}),color:`primary`,autoFocus:!0,startIcon:C(F,{}),children:this.props.t(`Close`)})})]}):null}renderGitHubInstallDialog(e){return this.state.gitHubInstallDialog?C(Kt,{t:this.t,categories:this.state.categories,installed:this.state.installedGlobal,socket:e.socket,currentHost:e.currentHost,hostsWorker:e.hostsWorker,expertMode:e.expertMode,themeType:e.themeType,commandRunning:this.props.commandRunning,upload:e=>new Promise(t=>this.props.executeCommand(`upload ${e}${this.props.expertMode?` --debug`:``}`,void 0,()=>t())),createInstance:(t,n)=>K.createInstanceIfNotExists({adapterName:t,context:e,host:n}),installFromUrl:(t,n,r,i)=>this.addInstance({adapterName:t,debug:n,customUrl:r,context:e,host:i==null?void 0:i.host,files:i==null?void 0:i.files}),repository:this.state.repository,onClose:()=>{this.setState({gitHubInstallDialog:!1})}}):null}renderRepositoryTimestamp(){var e;let t=(e=this.state.compactRepositories)==null||(e=e.native)==null?void 0:e.repositories;if(!t)return null;let n=null,r=null,i=[];if(typeof this.props.systemConfig.common.activeRepo==`string`){var a;let e=(a=t[this.props.systemConfig.common.activeRepo])==null||(a=a.json)==null?void 0:a._repoInfo;if(e){n=e.repoTime||null,r=e.repoReadTime||null;let t=this.getRepositoryName(e);t&&i.push(t)}}else if(Array.isArray(this.props.systemConfig.common.activeRepo)){let e=null,a=null;this.props.systemConfig.common.activeRepo.forEach(n=>{var r;let o=(r=t[n])==null||(r=r.json)==null?void 0:r._repoInfo;if(o){let t=this.getRepositoryName(o);t&&i.push(t),o.repoTime&&(!e||new Date(o.repoTime)<new Date(e))&&(e=o.repoTime),o.repoReadTime&&(!a||new Date(o.repoReadTime)<new Date(a))&&(a=o.repoReadTime)}}),n=e,r=a}let o=r||n;if(!o)return null;let s=this.formatRepositoryTimestamp(o),c=``;return c=i.length>1?this.t(`Repository timestamps (oldest from %s):`,i.join(`, `)):this.t(`Repository timestamps:`),n&&(c+=`\n${this.t(`Generated: %s`,this.formatRepositoryTimestamp(n))}`),r&&(c+=`\n${this.t(`Last read: %s`,this.formatRepositoryTimestamp(r))}`),C(A,{title:c,slotProps:{popper:{sx:Z.tooltip}},children:C(E,{component:`div`,sx:{display:`flex`,alignItems:`center`,marginLeft:1,fontSize:`0.75rem`,color:`text.secondary`,cursor:`help`,whiteSpace:`nowrap`},children:s})})}getRepositoryName(e){return e!=null&&e.name?typeof e.name==`object`?e.name[this.props.lang]||e.name.en:e.name:null}formatRepositoryTimestamp(e){try{let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/6e4),i=Math.floor(r/60),a=Math.floor(i/24);return r<60?this.t(`%s minutes ago`,r.toString()):i<24?this.t(`%s hours ago`,i.toString()):a<30?this.t(`%s days ago`,a.toString()):t.toLocaleDateString(this.props.lang||`en`)}catch{return e}}renderHeader(){var e;let t=!this.props.commandRunning&&!!this.props.ready&&!!this.state.updateList&&this.state.updateAvailable.length>1;return t&&this.state.updateAvailable.length===2&&this.state.updateAvailable.includes(`admin`)&&(t=!1),w(a,{children:[this.props.menuButtonSpace?C(E,{sx:{width:40,flexShrink:0}}):null,C(A,{title:this.t(`Change view mode`),slotProps:{popper:{sx:Z.tooltip}},children:C(I,{size:`large`,onClick:()=>this.changeViewMode(),children:this.state.tableViewMode?C(ye,{}):C(dt,{})})}),C(A,{title:this.t(`Check adapter for updates`),slotProps:{popper:{sx:Z.tooltip}},children:C(I,{size:`large`,onClick:()=>this.updateAll(!0,!0),children:C(xe,{})})}),this.renderRepositoryTimestamp(),this.state.tableViewMode&&!this.state.oneListView&&C(A,{title:this.t(`expand all`),slotProps:{popper:{sx:Z.tooltip}},children:C(I,{size:`large`,onClick:()=>this.expandAll(),children:C(_e,{})})}),this.state.tableViewMode&&!this.state.oneListView&&C(A,{title:this.t(`collapse all`),slotProps:{popper:{sx:Z.tooltip}},children:C(I,{size:`large`,onClick:()=>this.collapseAll(),children:C(ct,{})})}),this.state.tableViewMode&&C(A,{title:this.t(`list`),slotProps:{popper:{sx:Z.tooltip}},children:C(I,{size:`large`,onClick:()=>this.listTable(),children:C(Ne,{color:this.state.oneListView?`primary`:`inherit`})})}),this.state.updateList?C(I,{size:`large`,onClick:()=>this.changeInstalledList(!0),children:C(ot,{color:`primary`,style:{opacity:.3,color:this.state.installedList===2?`red`:void 0}})}):C(A,{slotProps:{popper:{sx:Z.tooltip}},title:this.t(this.state.installedList?this.state.installedList===1?`Showed only installed adapters`:`Showed only installed adapters without instance.`:`Show only installed`),children:C(I,{size:`large`,onClick:()=>this.changeInstalledList(),children:C(ot,{style:this.state.installedList===2?{color:`red`}:void 0,color:this.state.installedList===1?`primary`:`inherit`})})}),C(V,{config:this.props.adminGuiConfig.admin,name:`admin.adapters.filterUpdates`,children:C(A,{title:this.t(`Filter adapter with updates`),slotProps:{popper:{sx:Z.tooltip}},children:C(I,{size:`large`,onClick:()=>this.changeUpdateList(),children:C(Tt,{color:this.state.updateList?`primary`:`inherit`})})})}),t&&C(A,{title:this.t(`Update all adapters`),slotProps:{popper:{sx:Z.tooltip}},children:C(I,{size:`large`,onClick:()=>this.setState({showUpdater:!0}),children:C(It,{})})}),this.props.expertMode&&((e=this.props.adminGuiConfig.admin)==null||(e=e.adapters)==null?void 0:e.gitHubInstall)!==!1&&C(A,{title:this.t(`Install from custom URL`),slotProps:{popper:{sx:Z.tooltip}},children:C(I,{size:`large`,onClick:()=>this.setState({gitHubInstallDialog:!0}),children:C(fe,{})})}),C(`div`,{style:Z.grow}),C(z,{variant:`standard`,inputRef:this.inputRef,label:this.t(`Filter by name`),defaultValue:this.state.search,onChange:e=>this.handleFilterChange(e),slotProps:{input:{endAdornment:this.state.search?C(_,{position:`end`,children:C(I,{tabIndex:-1,size:`small`,onClick:()=>{(window._localStorage||window.localStorage).removeItem(`Adapter.search`),this.inputRef.current&&(this.inputRef.current.value=``),this.setState({search:``},()=>this.filterAdapters())},children:C(F,{})})}):null}}}),!this.state.tableViewMode&&C(Et,{t:this.t,icons:!0,contained:this.state.categoriesTiles!==`All`,translateSuffix:`_group`,arrayItem:[{name:`All`},...this.state.categories],onClick:e=>this.changeCategoriesTiles(e),value:this.state.categoriesTiles}),C(Et,{title:this.t(`Sort by`),t:this.t,buttonIcon:C(tt,{style:{marginRight:4}}),arrayItem:this.state.tableViewMode?Sn.filter(e=>!e.notByList):Sn,onClick:e=>this.changeFilterTiles(e),value:this.state.filterTiles}),C(`div`,{style:Z.grow}),C(V,{config:this.props.adminGuiConfig.admin,name:`admin.adapters.statistics`,children:w(E,{component:`div`,sx:m.getStyle(this.props.theme,Z.infoAdapters,{display:{xs:`none`,md:`inline-block`}}),onClick:()=>this.setState({showStatistics:!0}),children:[w(E,{component:`div`,sx:{...Z.counters,...Z.greenText},children:[this.t(`Selected adapters`),C(`div`,{ref:this.countRef})]}),w(E,{component:`div`,sx:Z.counters,children:[this.t(`Total adapters`),`:`,C(`div`,{children:this.allAdapters})]}),w(E,{component:`div`,sx:Z.counters,children:[this.t(`Installed adapters`),`:`,C(`div`,{children:this.installedAdapters})]}),w(E,{component:`div`,sx:Z.counters,children:[this.t(`Last month updated adapters`),`:`,C(`div`,{children:this.recentUpdatedAdapters})]})]})}),C(E,{sx:{ml:`auto`,pl:1},children:this.props.hostSelector})]})}renderWebserverUpgrade(){return this.state.adminUpgradeTo?C(hn,{socket:this.props.socket,themeType:this.props.themeType,host:this.props.adminHost,onClose:()=>{console.log(`Close dialog`),this.setState({adminUpgradeTo:``,showDialog:!1})},version:this.state.adminUpgradeTo,adminInstance:this.props.adminInstance,onUpdating:e=>{this.props.onUpdating(e)},currentAdminVersion:this.props.currentAdminVersion}):null}render(){var e;if(!this.state.init)return C(T,{});this.state.triggerUpdate!==this.props.triggerUpdate&&setTimeout(()=>{this.setState({triggerUpdate:this.props.triggerUpdate},()=>this.updateAll(!0))},100),(this.props.currentHost!==this.state.currentHost||this.props.forceUpdateAdapters!==this.state.forceUpdateAdapters)&&(this.hostsTimer=this.hostsTimer||setTimeout(()=>{this.hostsTimer=null,this.setState({currentHost:this.props.currentHost,forceUpdateAdapters:this.props.forceUpdateAdapters},async()=>{var e;if(((e=this.hostAdapterWorker)==null?void 0:e.getHost())!==this.props.currentHost){var t;(t=this.hostAdapterWorker)==null||t.destroy(),this.hostAdapterWorker=new Lt(this.props.socket,this.props.currentHost),this.hostAdapterWorker.registerHandler(this.onHostAdapterChanged,!0),await this.hostAdapterWorker.getObjects()}await this.updateAll(!1,!1,!0)})},200));let t=m.isStableRepository(this.props.systemConfig.common.activeRepo),n=((e=this.state.compactRepositories)==null||(e=e.native)==null?void 0:e.repositories)||{};if(n&&this.props.systemConfig.common.activeRepo){if(Array.isArray(this.props.systemConfig.common.activeRepo))t=this.props.systemConfig.common.activeRepo.every(e=>{var t;return e.toLowerCase().startsWith(`stable`)||((t=n[e])==null||(t=t.json)==null||(t=t._repoInfo)==null?void 0:t.stable)});else if(typeof this.props.systemConfig.common.activeRepo==`string`){var r;t=this.props.systemConfig.common.activeRepo.toLowerCase().startsWith(`stable`)||((r=n[this.props.systemConfig.common.activeRepo])==null||(r=r.json)==null||(r=r._repoInfo)==null?void 0:r.stable)}}let i=``;if(!t){if(i=Array.isArray(this.props.systemConfig.common.activeRepo)?this.props.systemConfig.common.activeRepo.join(`, `):this.props.systemConfig.common.activeRepo,typeof this.props.systemConfig.common.activeRepo==`string`){var a;let e=n&&((a=n[this.props.systemConfig.common.activeRepo])==null||(a=a.json)==null?void 0:a._repoInfo);e!=null&&e.name&&(i=e.name&&typeof e.name==`object`?e.name[this.props.lang]||e.name.en:e.name)}else this.props.systemConfig.common.activeRepo&&typeof this.props.systemConfig.common.activeRepo!=`string`&&(i=this.props.systemConfig.common.activeRepo.map(e=>{var t;let r=n&&((t=n[e])==null||(t=t.json)==null?void 0:t._repoInfo);return r!=null&&r.name?r.name&&typeof r.name==`object`?r.name[this.props.lang]||r.name.en:r.name:e}).join(`, `))}let o=this.getContext(this.state.descWidth<50);return this.cache.listOfVisibleAdapter||(this.buildCacheTimer=this.buildCacheTimer||setTimeout(()=>{this.buildCacheTimer=null,this.buildCache(o)},0)),w(se,{children:[this.state.update&&C(p,{children:C(T,{})}),this.renderHeader(),C(mn,{stableRepo:t,repoName:i,context:o,noTranslation:this.props.noTranslation,systemConfig:this.props.systemConfig,tableViewMode:this.state.tableViewMode,oneListView:this.state.oneListView,update:this.state.update,updateListFilter:this.state.updateList,searchFilter:this.state.search,installedListFilter:this.state.installedList,cachedAdapters:this.cache.adapters,categories:this.state.categories,categoriesExpanded:this.state.categoriesExpanded,listOfVisibleAdapter:this.cache.listOfVisibleAdapter,toggleCategory:e=>this.toggleCategory(e),clearAllFilters:e=>this.clearAllFilters(e),descWidth:this.state.descWidth,sortByName:this.state.filterTiles===$,sortPopularFirst:o.sortPopularFirst,sortRecentlyUpdated:o.sortRecentlyUpdated,sortRecentlyCreated:o.sortRecentlyCreated,commandRunning:this.props.commandRunning}),this.getUpdater(),this.getStatistics(),this.renderSlowConnectionWarning(),this.renderGitHubInstallDialog(o),this.renderWebserverUpgrade(),this.renderDialogs(o)]})}};export{Cn as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Es as e,Ts as t,r as n}from"./loadShare-eager-CRNcc8D7.js";var r={WebkitTextSecurity:`disc`},i=`https://github.com/ioBroker/ioBroker.js-controller/blob/master/CHANGELOG.md`,a=[`none`,`patch`,`minor`,`major`],o={none:`none`,patch:`patch`,minor:`patch & minor`,major:`patch, minor & major`};function s(e){return e.split(`.`).reduce((e,t)=>(e<<8)+parseInt(t,10),0)>>>0}function c(e,t){var n;let r=e==null||(n=e.native)==null||(n=n.hardware)==null?void 0:n.networkInterfaces;if(!r)return null;let i=null;for(let e of Object.values(r))if(e)for(let n=0;n<e.length;n++){let r=e[n];r.internal||t.includes(`:`)&&r.family!==`IPv6`||(!t.includes(`.`)||t.match(/[^.\d]/)||r.family===`IPv4`)&&(t===`127.0.0.0`||t===`localhost`||t.match(/[^.\d]/)||r.family===`IPv4`&&t.includes(`.`)&&(s(t)&s(r.netmask))===(s(r.address)&s(r.netmask)))&&(i=r.address)}if(!i){for(let e of Object.values(r))if(e)for(let n=0;n<e.length;n++){let r=e[n];r.internal||t.includes(`:`)&&r.family!==`IPv6`||t.includes(`.`)&&!t.match(/[^.\d]/)&&r.family!==`IPv4`||t!==`127.0.0.0`&&t!==`localhost`&&!t.match(/[^.\d]/)||(i=r.address)}}if(!i){for(let e of Object.values(r))if(e)for(let t=0;t<e.length;t++){let n=e[t];n.internal||(i=n.address)}}return i}function l(e,t,n,r,i){var a;if(!(e!=null&&e.common))return null;let o,s=(a=t[`system.adapter.${i}`])==null||(a=a.common)==null?void 0:a.host;if(e.common.host!==s){let t=n[`system.host.${e.common.host}`];if(t){let n=c(t,r);if(n)o=n;else return console.warn(`Cannot find suitable IP in host ${e.common.host} for ${e._id}`),null}else return console.warn(`Cannot find host ${e.common.host} for ${e._id}`),null}else o=r;return o}function u(e){let t=e.match(/^[^/]*:\/\/[^/]*/);return t?{origin:t[0],path:e.substring(t[0].length).replace(/^\//,``)}:{origin:null,path:e.replace(/^\//,``)}}function d(e){if(!e)return``;try{return new URL(e.includes(`://`)?e:`https://${e}`).hostname}catch{return``}}function f(e,t){if(t.pathname!==`/admin`&&!t.pathname.startsWith(`/admin/`))return null;let n=t=>{var n;if(!t)return;let r=e[t.startsWith(`system.adapter.`)?t:`system.adapter.${t}`],i=r==null||(n=r.native)==null?void 0:n.port;return typeof i==`number`?i:void 0};for(let o of Object.keys(e)){var r,i;let s=e[o];if(s!=null&&(r=s.common)!=null&&r.enabled){if(s.common.name===`cloud`){var a;if(d((a=s.native)==null?void 0:a.cloudUrl)===t.hostname)return{origin:t.origin,webPort:n(s.native.instance),adminPort:n(s.native.allowAdmin),lovelacePort:n(s.native.lovelace)}}else if(s.common.name===`iot`&&(i=s.native)!=null&&i.remote&&(t.hostname===`iobroker.pro`||t.hostname.endsWith(`.iobroker.pro`)))return{origin:t.origin,webPort:n(s.native.remoteWebInstance),adminPort:n(s.native.remoteAdminInstance)}}}return null}function p(e,t,n){if(!e||t===void 0)return e;let r=null;return n.webPort!==void 0&&t===n.webPort?r=``:n.adminPort!==void 0&&t===n.adminPort?r=`/admin`:n.lovelacePort!==void 0&&t===n.lovelacePort&&(r=`/lovelace`),r===null?null:`${n.origin}${r}/${u(e).path}`}function m(e){return e&&u(e).path.split(/[/?#]/)[0]||``}function h(e,t,n){return!t||t===n?!1:m(e)===t}function g(e,t,n,r){let i=t.native.webInstance,a=u(n).path||`${e}/`,o;i===`*`?(o=Object.keys(r.instances).filter(e=>e.startsWith(`system.adapter.web.`)&&r.instances[e].common.enabled).map(e=>e.substring(15)),o.length||(o=Object.keys(r.instances).filter(e=>e.startsWith(`system.adapter.web.`)).map(e=>e.substring(15)))):o=[i];let s=[];for(let e of o){let t=r.instances[`system.adapter.${e}`],n=t==null?void 0:t.native;if(!n)continue;let i=n.secure===void 0?n.protocol:n.secure,o=i===!0||i===`true`?`https`:`http`,c=n.bind||n.ip;c&&c!==`0.0.0.0`||(c=l(t,r.instances,r.hosts,r.hostname,r.adminInstance));let u=n.port;s.push({url:`${o}://${c||``}${u?`:${u}`:``}/${a}`,port:u,instance:e})}return s}var _=[`ip`,`bind`,`port`,`webinterfacePort`,`protocol`,`secure`,`s`];function v(e){return(e.match(/%(\w+)%/g)||[]).every(e=>{let t=e.replace(/%/g,``).replace(/^native_/,``);return t.includes(`_`)||_.includes(t)})}function y(e,t){if(typeof e!=`string`)return e;let n=e.match(/^(https?:\/\/)?(localhost|127\.0\.0\.1|0\.0\.0\.0|\[::1\])(?=[:/]|$)/i);if(!n)return e;let r=t();return r?`${n[1]||``}${r}${e.substring(n[0].length)}`:e}function b(e,t,n,r,i,a,o,s){r===`protocol`&&(r=`secure`);try{let c=t[`system.adapter.${n}`];if(e&&c){if(r===`secure`)e=e.replace(`%${i}%`,c.native[r]?`https`:`http`);else{let n=c.native[r];if(r!==`webinterfacePort`&&r!==`port`||n&&n!==`0`||(n=c.native.secure===!0?443:80),r===`bind`||r===`ip`){let n=c.native.bind||c.native.ip;n===`0.0.0.0`&&(n=l(c,t,a,o,s)),e=e.includes(`%${i}%`)?e.replace(`%${i}%`,n||``):e.replace(`%native_${i}%`,n||``)}else n=y(n,()=>l(c,t,a,o,s)),e=e.includes(`%${i}%`)?e.replace(`%${i}%`,n):e.replace(`%native_${i}%`,n),e=e.replace(/^https?:\/\/(?=https?:\/\/)/i,``)}}else console.log(`Cannot get link ${r}`),e=e.replace(`%${i}%`,``)}catch(e){console.log(e)}return e}function x(e,t,n,r){let i=[],a;if(e){let f=r.instances[`system.adapter.${t}.${n}`],p=(f==null?void 0:f.native)||{};if(f!=null&&f.common.webExtension&&p.webInstance){let n=u(e).origin;(n===null||n.includes(`%`)&&v(n))&&i.push(...g(t,f,e,r))}let m=i.length>0,h=e.match(/%(\w+)%/g);if(h)for(let u=0;u<h.length;u++){let g=h[u];if(g===`%ip%`){let t=p.bind||p.ip;t&&t!==`0.0.0.0`||(t=l(f,r.instances,r.hosts,r.hostname,r.adminInstance)),i.length?i.forEach(e=>e.url=e.url.replace(`%ip%`,t||``)):e=e.replace(`%ip%`,t||``)}else if(g===`%protocol%`){let t=p.secure===void 0?p.protocol:p.secure,n;n=t===!0||t===`true`?`https`:t===!1||t===`false`||!t?`http`:t.toString().replace(/:$/,``),i.length?i.forEach(e=>e.url=e.url.replace(`%protocol%`,n)):e=e.replace(`%protocol%`,n)}else if(g===`%s%`){let t=p.secure===void 0?p.protocol:p.secure,n;n=t===!0||t===`true`?`s`:t===!1||t===`false`||!t?``:t.toString().replace(/:$/,``),i.length?i.forEach(e=>e.url=e.url.replace(`%s%`,n)):e=e.replace(`%s%`,n)}else if(g===`%instance%`)e=e.replace(`%instance%`,n.toString()),i.length?i.forEach(e=>e.url=e.url.replace(`%instance%`,n.toString())):e=e.replace(`%instance%`,n.toString());else if(g=g.replace(/%/g,``),g.startsWith(`native_`)&&(g=g.substring(7)),g.includes(`_`)){let[l,u]=g.split(`_`);if(l.match(/\.[0-9]+$/)){var o;e=b(e,r.instances,l,u,g,r.hosts,r.hostname,r.adminInstance),a=(o=r.instances[`system.adapter.${l}`])==null||(o=o.native)==null?void 0:o.port}else{let a;t===l?a=[`${t}.${n}`]:(a=Object.keys(r.instances).filter(e=>e.startsWith(`system.adapter.${l}.`)&&r.instances[e].common.enabled).map(e=>e.substring(15)),a.length||(a=Object.keys(r.instances).filter(e=>e.startsWith(`system.adapter.${l}.`)).map(e=>e.substring(15))));for(let t of a)if(i.length){let n=i.find(e=>e.instance===t);if(n)n.url=b(n.url,r.instances,t,u,g,r.hosts,r.hostname,r.adminInstance);else if(m)i.forEach(e=>e.url=b(e.url,r.instances,t,u,g,r.hosts,r.hostname,r.adminInstance));else{var s;let n=b(e,r.instances,t,u,g,r.hosts,r.hostname,r.adminInstance),a=(s=r.instances[`system.adapter.${t}`])==null||(s=s.native)==null?void 0:s.port;i.push({url:n,port:a,instance:t})}}else{var c;let n=b(e,r.instances,t,u,g,r.hosts,r.hostname,r.adminInstance),a=(c=r.instances[`system.adapter.${t}`])==null||(c=c.native)==null?void 0:c.port;i.push({url:n,port:a,instance:t})}}}else{let o=`${t}.${n}`;if(i.length)i.forEach(e=>e.url=b(e.url,r.instances,o,g,g,r.hosts,r.hostname,r.adminInstance));else{var d;e=b(e,r.instances,o,g,g,r.hosts,r.hostname,r.adminInstance),a=(d=r.instances[`system.adapter.${o}`])==null||(d=d.native)==null?void 0:d.port}}}}return i.length?i:[{url:e,port:a}]}function S(e){if(e.startsWith(`http://`)||e.startsWith(`https://`))return e;let t=globalThis.socketPath;return(t&&!t.startsWith(`@@`)?t:`/`)+e.replace(/^\//,``)}function C(e,t,n,r){return!e||!r||r.paths.forEach(r=>{if(r.instance===t)e=r.path;else if(r.instance.startsWith(`web.`)){var i;let t=n[`system.adapter.${r.instance}`];if(t!=null&&(i=t.native)!=null&&i.port&&e!=null&&e.includes(`:${t.native.port}`)){let n=RegExp(`^.*:${t.native.port}/`);e=e.replace(n,r.path)}}}),e}async function w(e,t,n){let r={};return await Promise.all(t.map(async t=>{try{let i=await e.getState(`${t._id}.alive`);if(!(i!=null&&i.val))return;let a=await e.getCompactInstalled(t._id,n==null?void 0:n.update,n==null?void 0:n.cmdTimeout);r[t._id.replace(/^system\.host\./,``)]=new Set(Object.keys(a||{}))}catch(e){console.warn(`Cannot read the installed adapters of "${t._id}": ${e}`)}})),r}function T(e,t){var n,r;let i=e==null||(n=e.common)==null?void 0:n.host,a=e==null||(r=e.common)==null?void 0:r.name;if(!i||!a)return!1;let o=t[i];return!!o&&!o.has(a)}e();var E=0,D=39,O=49,k=1,A=22,j={30:{color:`black`},31:{color:`red`},32:{color:`green`},33:{color:`yellow`},34:{color:`blue`},35:{color:`purple`},36:{color:`cyan`},37:{color:`white`},90:{color:`grey`},91:{color:`lightred`},92:{color:`lightgreen`},93:{color:`lightyellow`},94:{color:`lightblue`},95:{color:`lightpurple`},96:{color:`lightcyan`},97:{color:`white`},40:{backgroundColor:`black`},41:{backgroundColor:`red`},42:{backgroundColor:`green`},43:{backgroundColor:`yellow`},44:{backgroundColor:`blue`},45:{backgroundColor:`purple`},46:{backgroundColor:`cyan`},47:{backgroundColor:`white`},100:{backgroundColor:`grey`},101:{backgroundColor:`lightred`},102:{backgroundColor:`lightgreen`},103:{backgroundColor:`lightyellow`},104:{backgroundColor:`lightblue`},105:{backgroundColor:`lightpurple`},106:{backgroundColor:`lightcyan`},107:{backgroundColor:`white`}},M=class e{static deepClone(e){return JSON.parse(JSON.stringify(e))}static formatRam(e){let t=Math.floor(e/1073741824*10)/10;e%=1073741824;let n=Math.floor(e/1048576*10)/10,r=``;return r+=t>1?`${t} GB`:`${n} MB`,r}static isTouchDevice(){return`ontouchstart`in window||window.navigator.maxTouchPoints>0||window.navigator.msMaxTouchPoints>0}static formatSpeed(e){return`${e} MHz`}static formatBytes(e){if(Math.abs(e)<1024)return`${e} B`;let t=[`KB`,`MB`,`GB`],n=-1;do e/=1024,++n;while(Math.abs(e)>=1024&&n<t.length-1);return`${e.toFixed(1)} ${t[n]}`}static getFileExtension(e){let t=e.lastIndexOf(`.`);return t===-1?null:e.substring(t+1).toLowerCase()}static invertColor(e,t){if(e==null||e===``||typeof e!=`string`)return``;if(e.indexOf(`#`)===0&&(e=e.slice(1)),e.length===3&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),e.length!==6)throw Error(`Invalid HEX color.`);let n=parseInt(e.slice(0,2),16),r=parseInt(e.slice(2,4),16),i=parseInt(e.slice(4,6),16);if(t)return n*.299+r*.587+i*.114>186?`#000000`:`#FFFFFF`;let a=(255-n).toString(16),o=(255-r).toString(16),s=(255-i).toString(16);return`#${a.padStart(2,`0`)}${o.padStart(2,`0`)}${s.padStart(2,`0`)}`}static formatSeconds(e,t){let n=Math.floor(e/86400),r,i,a;e%=86400;let o=Math.floor(e/3600);a=o<10?`0${o}`:o.toString(),e%=3600;let s=Math.floor(e/60);r=s<10?`0${s}`:s.toString(),e%=60,e=Math.floor(e),i=e<10?`0${e}`:e.toString();let c=``;return n&&(c+=`${n} ${t?t(`daysShortText`):`d`} `),c+=`${a}:${r}:${i}`,c}static objectMap(e,t){let n=[];for(let r in e)n.push(t(e[r],r));return n}static fixAdminUI(e){if(e!=null&&e.common){if(!e.common.adminUI)e.common.noConfig?(e.common.adminUI||={},e.common.adminUI.config=`none`):e.common.jsonConfig?(e.common.adminUI||={},e.common.adminUI.config=`json`):e.common.materialize?(e.common.adminUI||={},e.common.adminUI.config=`materialize`):(e.common.adminUI||={},e.common.adminUI.config=`html`),(e.common.jsonCustom||e.common.supportCustoms)&&(e.common.adminUI||={},e.common.adminUI.custom=`json`),e.common.materializeTab&&e.common.adminTab?(e.common.adminUI||={},e.common.adminUI.tab=`materialize`):e.common.adminTab&&(e.common.adminUI||={},e.common.adminUI.tab=`html`),e.common.adminUI&&console.warn(`Please add to "${e._id.replace(/\.\d+$/,``)}" common.adminUI=${JSON.stringify(e.common.adminUI)}`);else{let t=!1;e.common.materializeTab&&e.common.adminTab?e.common.adminUI.tab!==`materialize`&&(e.common.adminUI.tab=`materialize`,t=!0):e.common.adminTab&&e.common.adminUI.tab!==`html`&&e.common.adminUI.tab!==`materialize`&&(e.common.adminUI.tab=`html`,t=!0),(e.common.jsonCustom||e.common.supportCustoms)&&e.common.adminUI.custom!==`json`&&(e.common.adminUI.custom=`json`,t=!0),e.common.noConfig?e.common.adminUI.config!==`none`&&(e.common.adminUI.config=`none`,t=!0):e.common.jsonConfig?(e.common.adminUI.config!==`json`&&(e.common.adminUI.config=`json`,t=!0),e.common.adminUI.config=`json`):e.common.materialize?e.common.adminUI.config!==`materialize`&&(e.common.adminUI.config||(e.common.adminUI.config=`materialize`,t=!0)):e.common.adminUI.config||(e.common.adminUI.config=`html`,t=!0),t&&console.warn(`Please modify "${e._id.replace(/\.\d+$/,``)}" common.adminUI=${JSON.stringify(e.common.adminUI)}`)}}}static parseColorMessage(e){if(e&&(e.includes(`\x1B[`)||e.includes(`\x1B[`))){let t=e.match(/\u001b\[\d+m/gi);if(t){let n=e,r=[],i={};for(let n=0;n<t.length;n++){let a=e.indexOf(t[n]);a&&r.push({text:e.substring(0,a),style:{...i}});let o=parseInt(t[n].substring(2),10);j[o]?Object.assign(i,j[o]):D===o?delete i.color:O===o?delete i.backgroundColor:A===o?delete i.fontWeight:k===o?i.fontWeight=`bold`:E===o&&(i={}),e=e.substring(t[n].length+a)}return e&&r.push({text:e,style:{...i}}),{original:n,parts:r}}return e}return e}static checkPassword(t,n){return t||=``,n||=``,t&&n&&t!==e.PASSWORD_SET&&n!==e.PASSWORD_SET?t.length<8||!t.match(/\d/)||!t.match(/[a-z]/)||!t.match(/[A-Z]/)?e.PASSWORD_ERROR_LENGTH:t!==n&&e.PASSWORD_ERROR_NOT_EQUAL:t&&t!==e.PASSWORD_SET?t.length<8||!t.match(/\d/)||!t.match(/[a-z]/)||!t.match(/[A-Z]/)?e.PASSWORD_ERROR_LENGTH:!1:n&&n!==e.PASSWORD_SET?n.length<8||!n.match(/\d/)||!n.match(/[a-z]/)||!n.match(/[A-Z]/)?e.PASSWORD_ERROR_LENGTH:!1:t===e.PASSWORD_SET||n===e.PASSWORD_SET?!1:e.PASSWORD_ERROR_EMPTY}static getDocsLinkForAdapter(t){let{adapterName:n}=t,{lang:r}=t;return e.SUPPORTED_DOC_LANGUAGES.includes(r)||(r=`en`),`https://www.iobroker.net/#${r}/adapters/adapterref/iobroker.${n}/README.md`}static updateAvailable(e,t,r){if(!e||!t)return!1;try{return n.gt(t,e)===!0}catch{return console.warn(`[ADAPTERS] Cannot compare the available version "${t}" with the installed "${e}"${r?` of ${r}`:``}`),!1}}static countAdapterUpdates(t,n){if(!t)return 0;let r=0;for(let i of Object.keys(t)){let a=t[i],o=n==null?void 0:n[i];i!==`js-controller`&&i!==`hosts`&&a!=null&&a.version&&o!=null&&o.version&&a.ignoreVersion!==o.version&&e.updateAvailable(a.version,o.version,`adapter "${i}"`)&&r++}return r}static getText(e,t){return typeof e==`object`?e?(e[t]||e.en||``).toString():``:e?e.toString():``}static clone(e){return JSON.parse(JSON.stringify(e))}static async getHref(t,n,r,i,a,o){var s;let c=await t.getObjects(),l=n.replace(/^tab-/,``),u=l.match(/-(\d+)$/),d=u?parseInt(u[1],10):null,m;if(c){if(d!==null){l=l.replace(/-(\d+)$/,``);let e=`system.adapter.${l}.${d}`;m=Object.keys(c).find(t=>t===e)}else{let e=`system.adapter.${l}.`;m=Object.keys(c).find(t=>t.startsWith(e))}}let h=m?c==null?void 0:c[m]:void 0;if(e.fixAdminUI(h),!(h!=null&&(s=h.common)!=null&&s.adminTab))return console.error(`Cannot find instance ${n}`),{href:``,adapterName:l,instanceNumber:d};let g=h.common.adminTab.link;if(!g){var _;g=((_=h.common.adminUI)==null?void 0:_.tab)===`materialize`?`adapter/${l}/tab_m.html${d==null?``:`?${d}`}`:`adapter/${l}/tab.html${d==null?``:`?${d}`}`}let v=d===null?parseInt(h._id.split(`.`).pop()||``,10):d,y=!!h.common.adminTab.proxy&&/^[^/]*:\/\/[^/]*/.test(g);if(y){let e=g.replace(/^[^/]*:\/\/[^/]*/,``);g=`proxy/${l}.${v}${e.startsWith(`/`)||e.startsWith(`%`)?e:`/${e}`}`}!h.common.adminTab.singleton&&d!=null&&(g+=`${g.includes(`?`)?`&`:`?`}instance=${d}`);let b=!1;if(g.includes(`%`)){var S;let e=x(g,l,v,{hostname:r,instances:c||{},hosts:i,adminInstance:a});g=e?(S=e[0])==null?void 0:S.url:``;let t=y?null:f(c||{},window.location);if(g&&t){var C;let n=p(g,e==null||(C=e[0])==null?void 0:C.port,t);n===null?b=!0:g=n}}return g+=`${g.includes(`?`)?`&`:`?`}newReact=true${d==null?``:`&${d}`}&react=${o}`,{href:g,adapterName:l,instanceNumber:d,unreachable:b}}};t(M,`PASSWORD_ERROR_LENGTH`,`Password must be at least 8 characters long and have numbers, upper and lower case letters`),t(M,`PASSWORD_ERROR_NOT_EQUAL`,`Repeat password is not equal with password`),t(M,`PASSWORD_ERROR_EMPTY`,`Empty password is not allowed`),t(M,`PASSWORD_SET`,`***********`),t(M,`SUPPORTED_DOC_LANGUAGES`,[`en`,`de`,`ru`,`zh-cn`]);export{r as a,C as c,T as d,x as f,i,f as l,o as n,S as o,h as p,a as r,p as s,M as t,w as u};
|
|
1
|
+
import{Ds as e,Es as t,r as n}from"./loadShare-eager-BpwDZfDr.js";var r={WebkitTextSecurity:`disc`},i=`https://github.com/ioBroker/ioBroker.js-controller/blob/master/CHANGELOG.md`,a=[`none`,`patch`,`minor`,`major`],o={none:`none`,patch:`patch`,minor:`patch & minor`,major:`patch, minor & major`};function s(e){return e.split(`.`).reduce((e,t)=>(e<<8)+parseInt(t,10),0)>>>0}function c(e,t){var n;let r=e==null||(n=e.native)==null||(n=n.hardware)==null?void 0:n.networkInterfaces;if(!r)return null;let i=null;for(let e of Object.values(r))if(e)for(let n=0;n<e.length;n++){let r=e[n];r.internal||t.includes(`:`)&&r.family!==`IPv6`||(!t.includes(`.`)||t.match(/[^.\d]/)||r.family===`IPv4`)&&(t===`127.0.0.0`||t===`localhost`||t.match(/[^.\d]/)||r.family===`IPv4`&&t.includes(`.`)&&(s(t)&s(r.netmask))===(s(r.address)&s(r.netmask)))&&(i=r.address)}if(!i){for(let e of Object.values(r))if(e)for(let n=0;n<e.length;n++){let r=e[n];r.internal||t.includes(`:`)&&r.family!==`IPv6`||t.includes(`.`)&&!t.match(/[^.\d]/)&&r.family!==`IPv4`||t!==`127.0.0.0`&&t!==`localhost`&&!t.match(/[^.\d]/)||(i=r.address)}}if(!i){for(let e of Object.values(r))if(e)for(let t=0;t<e.length;t++){let n=e[t];n.internal||(i=n.address)}}return i}function l(e,t,n,r,i){var a;if(!(e!=null&&e.common))return null;let o,s=(a=t[`system.adapter.${i}`])==null||(a=a.common)==null?void 0:a.host;if(e.common.host!==s){let t=n[`system.host.${e.common.host}`];if(t){let n=c(t,r);if(n)o=n;else return console.warn(`Cannot find suitable IP in host ${e.common.host} for ${e._id}`),null}else return console.warn(`Cannot find host ${e.common.host} for ${e._id}`),null}else o=r;return o}function u(e){let t=e.match(/^[^/]*:\/\/[^/]*/);return t?{origin:t[0],path:e.substring(t[0].length).replace(/^\//,``)}:{origin:null,path:e.replace(/^\//,``)}}function d(e){if(!e)return``;try{return new URL(e.includes(`://`)?e:`https://${e}`).hostname}catch{return``}}function f(e,t){if(t.pathname!==`/admin`&&!t.pathname.startsWith(`/admin/`))return null;let n=t=>{var n;if(!t)return;let r=e[t.startsWith(`system.adapter.`)?t:`system.adapter.${t}`],i=r==null||(n=r.native)==null?void 0:n.port;return typeof i==`number`?i:void 0};for(let o of Object.keys(e)){var r,i;let s=e[o];if(s!=null&&(r=s.common)!=null&&r.enabled){if(s.common.name===`cloud`){var a;if(d((a=s.native)==null?void 0:a.cloudUrl)===t.hostname)return{origin:t.origin,webPort:n(s.native.instance),adminPort:n(s.native.allowAdmin),lovelacePort:n(s.native.lovelace)}}else if(s.common.name===`iot`&&(i=s.native)!=null&&i.remote&&(t.hostname===`iobroker.pro`||t.hostname.endsWith(`.iobroker.pro`)))return{origin:t.origin,webPort:n(s.native.remoteWebInstance),adminPort:n(s.native.remoteAdminInstance)}}}return null}function p(e,t,n){if(!e||t===void 0)return e;let r=null;return n.webPort!==void 0&&t===n.webPort?r=``:n.adminPort!==void 0&&t===n.adminPort?r=`/admin`:n.lovelacePort!==void 0&&t===n.lovelacePort&&(r=`/lovelace`),r===null?null:`${n.origin}${r}/${u(e).path}`}function m(e){return e&&u(e).path.split(/[/?#]/)[0]||``}function h(e,t,n){return!t||t===n?!1:m(e)===t}function g(e,t,n,r){let i=t.native.webInstance,a=u(n).path||`${e}/`,o;i===`*`?(o=Object.keys(r.instances).filter(e=>e.startsWith(`system.adapter.web.`)&&r.instances[e].common.enabled).map(e=>e.substring(15)),o.length||(o=Object.keys(r.instances).filter(e=>e.startsWith(`system.adapter.web.`)).map(e=>e.substring(15)))):o=[i];let s=[];for(let e of o){let t=r.instances[`system.adapter.${e}`],n=t==null?void 0:t.native;if(!n)continue;let i=n.secure===void 0?n.protocol:n.secure,o=i===!0||i===`true`?`https`:`http`,c=n.bind||n.ip;c&&c!==`0.0.0.0`||(c=l(t,r.instances,r.hosts,r.hostname,r.adminInstance));let u=n.port;s.push({url:`${o}://${c||``}${u?`:${u}`:``}/${a}`,port:u,instance:e})}return s}var _=[`ip`,`bind`,`port`,`webinterfacePort`,`protocol`,`secure`,`s`];function v(e){return(e.match(/%(\w+)%/g)||[]).every(e=>{let t=e.replace(/%/g,``).replace(/^native_/,``);return t.includes(`_`)||_.includes(t)})}function y(e,t){if(typeof e!=`string`)return e;let n=e.match(/^(https?:\/\/)?(localhost|127\.0\.0\.1|0\.0\.0\.0|\[::1\])(?=[:/]|$)/i);if(!n)return e;let r=t();return r?`${n[1]||``}${r}${e.substring(n[0].length)}`:e}function b(e,t,n,r,i,a,o,s){r===`protocol`&&(r=`secure`);try{let c=t[`system.adapter.${n}`];if(e&&c){if(r===`secure`)e=e.replace(`%${i}%`,c.native[r]?`https`:`http`);else{let n=c.native[r];if(r!==`webinterfacePort`&&r!==`port`||n&&n!==`0`||(n=c.native.secure===!0?443:80),r===`bind`||r===`ip`){let n=c.native.bind||c.native.ip;n===`0.0.0.0`&&(n=l(c,t,a,o,s)),e=e.includes(`%${i}%`)?e.replace(`%${i}%`,n||``):e.replace(`%native_${i}%`,n||``)}else n=y(n,()=>l(c,t,a,o,s)),e=e.includes(`%${i}%`)?e.replace(`%${i}%`,n):e.replace(`%native_${i}%`,n),e=e.replace(/^https?:\/\/(?=https?:\/\/)/i,``)}}else console.log(`Cannot get link ${r}`),e=e.replace(`%${i}%`,``)}catch(e){console.log(e)}return e}function x(e,t,n,r){let i=[],a;if(e){let f=r.instances[`system.adapter.${t}.${n}`],p=(f==null?void 0:f.native)||{};if(f!=null&&f.common.webExtension&&p.webInstance){let n=u(e).origin;(n===null||n.includes(`%`)&&v(n))&&i.push(...g(t,f,e,r))}let m=i.length>0,h=e.match(/%(\w+)%/g);if(h)for(let u=0;u<h.length;u++){let g=h[u];if(g===`%ip%`){let t=p.bind||p.ip;t&&t!==`0.0.0.0`||(t=l(f,r.instances,r.hosts,r.hostname,r.adminInstance)),i.length?i.forEach(e=>e.url=e.url.replace(`%ip%`,t||``)):e=e.replace(`%ip%`,t||``)}else if(g===`%protocol%`){let t=p.secure===void 0?p.protocol:p.secure,n;n=t===!0||t===`true`?`https`:t===!1||t===`false`||!t?`http`:t.toString().replace(/:$/,``),i.length?i.forEach(e=>e.url=e.url.replace(`%protocol%`,n)):e=e.replace(`%protocol%`,n)}else if(g===`%s%`){let t=p.secure===void 0?p.protocol:p.secure,n;n=t===!0||t===`true`?`s`:t===!1||t===`false`||!t?``:t.toString().replace(/:$/,``),i.length?i.forEach(e=>e.url=e.url.replace(`%s%`,n)):e=e.replace(`%s%`,n)}else if(g===`%instance%`)e=e.replace(`%instance%`,n.toString()),i.length?i.forEach(e=>e.url=e.url.replace(`%instance%`,n.toString())):e=e.replace(`%instance%`,n.toString());else if(g=g.replace(/%/g,``),g.startsWith(`native_`)&&(g=g.substring(7)),g.includes(`_`)){let[l,u]=g.split(`_`);if(l.match(/\.[0-9]+$/)){var o;e=b(e,r.instances,l,u,g,r.hosts,r.hostname,r.adminInstance),a=(o=r.instances[`system.adapter.${l}`])==null||(o=o.native)==null?void 0:o.port}else{let a;t===l?a=[`${t}.${n}`]:(a=Object.keys(r.instances).filter(e=>e.startsWith(`system.adapter.${l}.`)&&r.instances[e].common.enabled).map(e=>e.substring(15)),a.length||(a=Object.keys(r.instances).filter(e=>e.startsWith(`system.adapter.${l}.`)).map(e=>e.substring(15))));for(let t of a)if(i.length){let n=i.find(e=>e.instance===t);if(n)n.url=b(n.url,r.instances,t,u,g,r.hosts,r.hostname,r.adminInstance);else if(m)i.forEach(e=>e.url=b(e.url,r.instances,t,u,g,r.hosts,r.hostname,r.adminInstance));else{var s;let n=b(e,r.instances,t,u,g,r.hosts,r.hostname,r.adminInstance),a=(s=r.instances[`system.adapter.${t}`])==null||(s=s.native)==null?void 0:s.port;i.push({url:n,port:a,instance:t})}}else{var c;let n=b(e,r.instances,t,u,g,r.hosts,r.hostname,r.adminInstance),a=(c=r.instances[`system.adapter.${t}`])==null||(c=c.native)==null?void 0:c.port;i.push({url:n,port:a,instance:t})}}}else{let o=`${t}.${n}`;if(i.length)i.forEach(e=>e.url=b(e.url,r.instances,o,g,g,r.hosts,r.hostname,r.adminInstance));else{var d;e=b(e,r.instances,o,g,g,r.hosts,r.hostname,r.adminInstance),a=(d=r.instances[`system.adapter.${o}`])==null||(d=d.native)==null?void 0:d.port}}}}return i.length?i:[{url:e,port:a}]}function S(e){if(e.startsWith(`http://`)||e.startsWith(`https://`))return e;let t=globalThis.socketPath;return(t&&!t.startsWith(`@@`)?t:`/`)+e.replace(/^\//,``)}function C(e,t,n,r){return!e||!r||r.paths.forEach(r=>{if(r.instance===t)e=r.path;else if(r.instance.startsWith(`web.`)){var i;let t=n[`system.adapter.${r.instance}`];if(t!=null&&(i=t.native)!=null&&i.port&&e!=null&&e.includes(`:${t.native.port}`)){let n=RegExp(`^.*:${t.native.port}/`);e=e.replace(n,r.path)}}}),e}async function w(e,t,n){let r={};return await Promise.all(t.map(async t=>{try{let i=await e.getState(`${t._id}.alive`);if(!(i!=null&&i.val))return;let a=await e.getCompactInstalled(t._id,n==null?void 0:n.update,n==null?void 0:n.cmdTimeout);r[t._id.replace(/^system\.host\./,``)]=new Set(Object.keys(a||{}))}catch(e){console.warn(`Cannot read the installed adapters of "${t._id}": ${e}`)}})),r}function T(e,t){var n,r;let i=e==null||(n=e.common)==null?void 0:n.host,a=e==null||(r=e.common)==null?void 0:r.name;if(!i||!a)return!1;let o=t[i];return!!o&&!o.has(a)}e();var E=0,D=39,O=49,k=1,A=22,j={30:{color:`black`},31:{color:`red`},32:{color:`green`},33:{color:`yellow`},34:{color:`blue`},35:{color:`purple`},36:{color:`cyan`},37:{color:`white`},90:{color:`grey`},91:{color:`lightred`},92:{color:`lightgreen`},93:{color:`lightyellow`},94:{color:`lightblue`},95:{color:`lightpurple`},96:{color:`lightcyan`},97:{color:`white`},40:{backgroundColor:`black`},41:{backgroundColor:`red`},42:{backgroundColor:`green`},43:{backgroundColor:`yellow`},44:{backgroundColor:`blue`},45:{backgroundColor:`purple`},46:{backgroundColor:`cyan`},47:{backgroundColor:`white`},100:{backgroundColor:`grey`},101:{backgroundColor:`lightred`},102:{backgroundColor:`lightgreen`},103:{backgroundColor:`lightyellow`},104:{backgroundColor:`lightblue`},105:{backgroundColor:`lightpurple`},106:{backgroundColor:`lightcyan`},107:{backgroundColor:`white`}},M=class e{static deepClone(e){return JSON.parse(JSON.stringify(e))}static formatRam(e){let t=Math.floor(e/1073741824*10)/10;e%=1073741824;let n=Math.floor(e/1048576*10)/10,r=``;return r+=t>1?`${t} GB`:`${n} MB`,r}static isTouchDevice(){return`ontouchstart`in window||window.navigator.maxTouchPoints>0||window.navigator.msMaxTouchPoints>0}static formatSpeed(e){return`${e} MHz`}static formatBytes(e){if(Math.abs(e)<1024)return`${e} B`;let t=[`KB`,`MB`,`GB`],n=-1;do e/=1024,++n;while(Math.abs(e)>=1024&&n<t.length-1);return`${e.toFixed(1)} ${t[n]}`}static getFileExtension(e){let t=e.lastIndexOf(`.`);return t===-1?null:e.substring(t+1).toLowerCase()}static invertColor(e,t){if(e==null||e===``||typeof e!=`string`)return``;if(e.indexOf(`#`)===0&&(e=e.slice(1)),e.length===3&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),e.length!==6)throw Error(`Invalid HEX color.`);let n=parseInt(e.slice(0,2),16),r=parseInt(e.slice(2,4),16),i=parseInt(e.slice(4,6),16);if(t)return n*.299+r*.587+i*.114>186?`#000000`:`#FFFFFF`;let a=(255-n).toString(16),o=(255-r).toString(16),s=(255-i).toString(16);return`#${a.padStart(2,`0`)}${o.padStart(2,`0`)}${s.padStart(2,`0`)}`}static formatSeconds(e,t){let n=Math.floor(e/86400),r,i,a;e%=86400;let o=Math.floor(e/3600);a=o<10?`0${o}`:o.toString(),e%=3600;let s=Math.floor(e/60);r=s<10?`0${s}`:s.toString(),e%=60,e=Math.floor(e),i=e<10?`0${e}`:e.toString();let c=``;return n&&(c+=`${n} ${t?t(`daysShortText`):`d`} `),c+=`${a}:${r}:${i}`,c}static objectMap(e,t){let n=[];for(let r in e)n.push(t(e[r],r));return n}static fixAdminUI(e){if(e!=null&&e.common){if(!e.common.adminUI)e.common.noConfig?(e.common.adminUI||={},e.common.adminUI.config=`none`):e.common.jsonConfig?(e.common.adminUI||={},e.common.adminUI.config=`json`):e.common.materialize?(e.common.adminUI||={},e.common.adminUI.config=`materialize`):(e.common.adminUI||={},e.common.adminUI.config=`html`),(e.common.jsonCustom||e.common.supportCustoms)&&(e.common.adminUI||={},e.common.adminUI.custom=`json`),e.common.materializeTab&&e.common.adminTab?(e.common.adminUI||={},e.common.adminUI.tab=`materialize`):e.common.adminTab&&(e.common.adminUI||={},e.common.adminUI.tab=`html`),e.common.adminUI&&console.warn(`Please add to "${e._id.replace(/\.\d+$/,``)}" common.adminUI=${JSON.stringify(e.common.adminUI)}`);else{let t=!1;e.common.materializeTab&&e.common.adminTab?e.common.adminUI.tab!==`materialize`&&(e.common.adminUI.tab=`materialize`,t=!0):e.common.adminTab&&e.common.adminUI.tab!==`html`&&e.common.adminUI.tab!==`materialize`&&(e.common.adminUI.tab=`html`,t=!0),(e.common.jsonCustom||e.common.supportCustoms)&&e.common.adminUI.custom!==`json`&&(e.common.adminUI.custom=`json`,t=!0),e.common.noConfig?e.common.adminUI.config!==`none`&&(e.common.adminUI.config=`none`,t=!0):e.common.jsonConfig?(e.common.adminUI.config!==`json`&&(e.common.adminUI.config=`json`,t=!0),e.common.adminUI.config=`json`):e.common.materialize?e.common.adminUI.config!==`materialize`&&(e.common.adminUI.config||(e.common.adminUI.config=`materialize`,t=!0)):e.common.adminUI.config||(e.common.adminUI.config=`html`,t=!0),t&&console.warn(`Please modify "${e._id.replace(/\.\d+$/,``)}" common.adminUI=${JSON.stringify(e.common.adminUI)}`)}}}static parseColorMessage(e){if(e&&(e.includes(`\x1B[`)||e.includes(`\x1B[`))){let t=e.match(/\u001b\[\d+m/gi);if(t){let n=e,r=[],i={};for(let n=0;n<t.length;n++){let a=e.indexOf(t[n]);a&&r.push({text:e.substring(0,a),style:{...i}});let o=parseInt(t[n].substring(2),10);j[o]?Object.assign(i,j[o]):D===o?delete i.color:O===o?delete i.backgroundColor:A===o?delete i.fontWeight:k===o?i.fontWeight=`bold`:E===o&&(i={}),e=e.substring(t[n].length+a)}return e&&r.push({text:e,style:{...i}}),{original:n,parts:r}}return e}return e}static checkPassword(t,n){return t||=``,n||=``,t&&n&&t!==e.PASSWORD_SET&&n!==e.PASSWORD_SET?t.length<8||!t.match(/\d/)||!t.match(/[a-z]/)||!t.match(/[A-Z]/)?e.PASSWORD_ERROR_LENGTH:t!==n&&e.PASSWORD_ERROR_NOT_EQUAL:t&&t!==e.PASSWORD_SET?t.length<8||!t.match(/\d/)||!t.match(/[a-z]/)||!t.match(/[A-Z]/)?e.PASSWORD_ERROR_LENGTH:!1:n&&n!==e.PASSWORD_SET?n.length<8||!n.match(/\d/)||!n.match(/[a-z]/)||!n.match(/[A-Z]/)?e.PASSWORD_ERROR_LENGTH:!1:t===e.PASSWORD_SET||n===e.PASSWORD_SET?!1:e.PASSWORD_ERROR_EMPTY}static getDocsLinkForAdapter(t){let{adapterName:n}=t,{lang:r}=t;return e.SUPPORTED_DOC_LANGUAGES.includes(r)||(r=`en`),`https://www.iobroker.net/#${r}/adapters/adapterref/iobroker.${n}/README.md`}static updateAvailable(e,t,r){if(!e||!t)return!1;try{return n.gt(t,e)===!0}catch{return console.warn(`[ADAPTERS] Cannot compare the available version "${t}" with the installed "${e}"${r?` of ${r}`:``}`),!1}}static countAdapterUpdates(t,n){if(!t)return 0;let r=0;for(let i of Object.keys(t)){let a=t[i],o=n==null?void 0:n[i];i!==`js-controller`&&i!==`hosts`&&a!=null&&a.version&&o!=null&&o.version&&a.ignoreVersion!==o.version&&e.updateAvailable(a.version,o.version,`adapter "${i}"`)&&r++}return r}static getText(e,t){return typeof e==`object`?e?(e[t]||e.en||``).toString():``:e?e.toString():``}static clone(e){return JSON.parse(JSON.stringify(e))}static async getHref(t,n,r,i,a,o){var s;let c=await t.getObjects(),l=n.replace(/^tab-/,``),u=l.match(/-(\d+)$/),d=u?parseInt(u[1],10):null,m;if(c){if(d!==null){l=l.replace(/-(\d+)$/,``);let e=`system.adapter.${l}.${d}`;m=Object.keys(c).find(t=>t===e)}else{let e=`system.adapter.${l}.`;m=Object.keys(c).find(t=>t.startsWith(e))}}let h=m?c==null?void 0:c[m]:void 0;if(e.fixAdminUI(h),!(h!=null&&(s=h.common)!=null&&s.adminTab))return console.error(`Cannot find instance ${n}`),{href:``,adapterName:l,instanceNumber:d};let g=h.common.adminTab.link;if(!g){var _;g=((_=h.common.adminUI)==null?void 0:_.tab)===`materialize`?`adapter/${l}/tab_m.html${d==null?``:`?${d}`}`:`adapter/${l}/tab.html${d==null?``:`?${d}`}`}let v=d===null?parseInt(h._id.split(`.`).pop()||``,10):d,y=!!h.common.adminTab.proxy&&/^[^/]*:\/\/[^/]*/.test(g);if(y){let e=g.replace(/^[^/]*:\/\/[^/]*/,``);g=`proxy/${l}.${v}${e.startsWith(`/`)||e.startsWith(`%`)?e:`/${e}`}`}!h.common.adminTab.singleton&&d!=null&&(g+=`${g.includes(`?`)?`&`:`?`}instance=${d}`);let b=!1;if(g.includes(`%`)){var S;let e=x(g,l,v,{hostname:r,instances:c||{},hosts:i,adminInstance:a});g=e?(S=e[0])==null?void 0:S.url:``;let t=y?null:f(c||{},window.location);if(g&&t){var C;let n=p(g,e==null||(C=e[0])==null?void 0:C.port,t);n===null?b=!0:g=n}}return g+=`${g.includes(`?`)?`&`:`?`}newReact=true${d==null?``:`&${d}`}&react=${o}`,{href:g,adapterName:l,instanceNumber:d,unreachable:b}}};t(M,`PASSWORD_ERROR_LENGTH`,`Password must be at least 8 characters long and have numbers, upper and lower case letters`),t(M,`PASSWORD_ERROR_NOT_EQUAL`,`Repeat password is not equal with password`),t(M,`PASSWORD_ERROR_EMPTY`,`Empty password is not allowed`),t(M,`PASSWORD_SET`,`***********`),t(M,`SUPPORTED_DOC_LANGUAGES`,[`en`,`de`,`ru`,`zh-cn`]);export{r as a,C as c,T as d,x as f,i,f as l,o as n,S as o,h as p,a as r,p as s,M as t,w as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{Os as e,Us as t}from"./loadShare-eager-BpwDZfDr.js";var n=e(t(`path`,{d:`M4 8h4V4H4zm6 12h4v-4h-4zm-6 0h4v-4H4zm0-6h4v-4H4zm6 0h4v-4h-4zm6-10v4h4V4zm-6 4h4V4h-4zm6 6h4v-4h-4zm0 6h4v-4h-4z`}),`Apps`);export{n as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{Os as e,Us as t}from"./loadShare-eager-BpwDZfDr.js";var n=e(t(`path`,{d:`M18 2H6c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2M6 4h5v8l-2.5-1.5L6 12z`}),`Book`);export{n as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{Os as e,Us as t}from"./loadShare-eager-BpwDZfDr.js";var n=e(t(`path`,{d:`m19 8-4 4h3c0 3.31-2.69 6-6 6-1.01 0-1.97-.25-2.8-.7l-1.46 1.46C8.97 19.54 10.43 20 12 20c4.42 0 8-3.58 8-8h3zM6 12c0-3.31 2.69-6 6-6 1.01 0 1.97.25 2.8.7l1.46-1.46C15.03 4.46 13.57 4 12 4c-4.42 0-8 3.58-8 8H1l4 4 4-4z`}),`Cached`);export{n as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{Os as e,Us as t}from"./loadShare-eager-BpwDZfDr.js";var n=e(t(`path`,{d:`M20 18c1.1 0 1.99-.9 1.99-2L22 6c0-1.1-.9-2-2-2H4c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2H0v2h24v-2zM4 6h16v10H4z`}),`Computer`);export{n as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Eo as e,Es as t,Fo as n,Fs as r,Ho as i,Hs as a,In as o,It as s,Ln as c,Ls as l,Mo as u,No as d,Pi as f,Ps as p,Ts as m,Us as h,Vo as g,Wo as _,Yo as v,_o as y,as as b,bo as x,br as S,da as C,ho as w,jo as T,ka as E,mo as D,ms as O,os as k,po as A,qo as j,sr as M,ss as N,t as P,tc as F,tn as I,us as L,xa as R,zo as z,zs as B}from"./loadShare-eager-CRNcc8D7.js";import{o as V,t as H}from"./AdminUtils-DDT_kD8H.js";import{t as U}from"./AceEditor-DTzNaeVy.js";t();var W=[`silly`,`debug`,`info`,`warn`,`error`],G={root:{height:`100%`,display:`flex`,flexDirection:`column`,overflow:`hidden`},scroll:{height:`100%`,overflowY:`auto`},instanceIcon:{width:42,height:42,marginRight:16,verticalAlign:`middle`},button:{width:36,height:36},version:{fontSize:12,opacity:.8,marginLeft:20,marginRight:10},versionAliveConnected:e=>({color:e.palette.mode===`dark`?`#23a623`:`#60ff60`}),versionAliveNotConnected:{color:`#a67223`},buttonControl:{padding:`5px`,transition:`opacity 0.2s`,height:34},enabled:{color:l[400],"&:hover":{backgroundColor:l[200]}},disabled:{color:B[400],"&:hover":{backgroundColor:B[200]}},hide:{visibility:`hidden`},formControl:{width:`100%`,marginBottom:5},logLevel:{fontSize:12,marginLeft:10},green:{color:l[700]},red:{color:B[700]},grey:{color:p[700]},blue:{color:`#0055a9`},orange:{color:r[400]},orangeDevice:{color:r[300]},tooltip:{pointerEvents:`none`}},K=class extends F{constructor(e){super(e),m(this,`refIframe`,void 0),m(this,`registered`,void 0),m(this,`onObjectChange`,(e,t)=>{let n=t;if(e===`system.adapter.${this.props.adapter}.${this.props.instance}`){var r,i,a,o;this.setState({running:!!(n!=null&&(r=n.common)!=null&&r.onlyWWW||n!=null&&(i=n.common)!=null&&i.enabled),canStart:!(n!=null&&(a=n.common)!=null&&a.onlyWWW),logLevel:(n==null||(o=n.common)==null?void 0:o.loglevel)||`info`})}}),m(this,`onStateChange`,(e,t)=>{let n=`system.adapter.${this.props.adapter}.${this.props.instance}`;e===`${n}.alive`?!!(t!=null&&t.val)!==this.state.alive&&this.setState({alive:!!(t!=null&&t.val)}):e===`${n}.connected`?!!(t!=null&&t.val)!==this.state.connectedToHost&&this.setState({connectedToHost:!!(t!=null&&t.val)}):e===`${this.props.adapter}.${this.props.instance}.info.connection`?(t?!!t.val:null)!==this.state.connected&&this.setState({connected:t?!!t.val:null}):e===`${this.props.adapter}.${this.props.instance}.info.extension`?(t?!!t.val:null)!==this.state.extension&&this.setState({extension:t?!!t.val:null}):e===`${n}.logLevel`&&this.setState({tempLogLevel:t?t.val:void 0})}),m(this,`closeConfig`,e=>{if(e.origin===window.location.origin){if(e.data===`close`||e.message===`close`)this.props.easyMode?this.props.handleNavigation(`easy`):this.props.handleNavigation(`tab-instances`);else if(e.data===`change`||e.message===`change`)this.props.configStored(!1);else if(e.data===`nochange`||e.message===`nochange`)this.props.configStored(!0);else if(typeof e.data==`string`&&e.data.startsWith(`goto:`)||typeof e.message==`string`&&e.message.startsWith(`goto:`)){let[,t]=(e.data||e.message).split(`:`),[n,r,i]=t.split(`/`);this.props.handleNavigation(n,r,i)}}}),this.state={checkedExist:!1,showStopAdminDialog:!1,running:!1,canStart:!1,alive:!1,connected:!1,connectedToHost:!1,logOnTheFlyValue:!1,logLevel:`info`,logLevelValue:`info`,tempLogLevel:`info`,showLogLevelDialog:!1,showMore:null},this.refIframe=null,this.registered=!1}componentDidUpdate(){var e;!this.registered&&(e=this.refIframe)!=null&&e.contentWindow&&(this.registered=!0,this.props.onRegisterIframeRef(this.refIframe))}componentDidMount(){var e;if(this.props.tab)this.props.socket.fileExists(`${this.props.adapter}.admin`,`tab.html`).then(e=>{if(e)this.setState({checkedExist:`tab.html`});else return this.props.socket.fileExists(`${this.props.adapter}.admin`,`tab_m.html`).then(e=>e?this.setState({checkedExist:`tab_m.html`}):window.alert(`Cannot find tab(_m).html`))});else{let e=`system.adapter.${this.props.adapter}.${this.props.instance}`;this.props.socket.subscribeObject(e,this.onObjectChange),this.props.socket.getObject(e).then(async t=>{var n,r,i,a,o,s,c;let l=await this.props.socket.getState(`${e}.logLevel`);await this.props.socket.subscribeState(`${e}.logLevel`,this.onStateChange);let u=await this.props.socket.getState(`${e}.alive`);await this.props.socket.subscribeState(`${e}.alive`,this.onStateChange);let d=await this.props.socket.getState(`${e}.connected`);await this.props.socket.subscribeState(`${e}.connected`,this.onStateChange);let f;try{f=await this.props.socket.getState(`${this.props.adapter}.${this.props.instance}.info.connection`),this.props.socket.subscribeState(`${this.props.adapter}.${this.props.instance}.info.connection`,this.onStateChange)}catch{f=null}let p;try{p=await this.props.socket.getState(`${this.props.adapter}.${this.props.instance}.info.extension`),this.props.socket.subscribeState(`${this.props.adapter}.${this.props.instance}.info.extension`,this.onStateChange)}catch{p=null}this.setState({checkedExist:!0,running:!!(t!=null&&(n=t.common)!=null&&n.onlyWWW||t!=null&&(r=t.common)!=null&&r.enabled),canStart:!(t!=null&&(i=t.common)!=null&&i.onlyWWW),alive:!!(u!=null&&u.val),extension:p?!!(p!=null&&p.val):null,connectedToHost:!!(d!=null&&d.val),connected:f?!!f.val:null,logLevel:(t==null||(a=t.common)==null?void 0:a.loglevel)||`info`,logLevelValue:(t==null||(o=t.common)==null?void 0:o.loglevel)||`info`,tempLogLevel:(l==null?void 0:l.val)||(t==null||(s=t.common)==null?void 0:s.loglevel)||`info`,common:(t==null?void 0:t.common)||{},native:(t==null?void 0:t.native)||{},adapterDocLangs:t!=null&&(c=t.common)!=null&&c.docs?Object.keys(t.common.docs):[`en`]})}).catch(e=>{console.error(e),this.setState({checkedExist:!0,running:!1})})}!this.registered&&(e=this.refIframe)!=null&&e.contentWindow&&(this.registered=!0,this.props.onRegisterIframeRef(this.refIframe)),window.addEventListener(`message`,this.closeConfig,!1)}getInstanceStatus(){var e,t,n;let r=((e=this.state.common)==null?void 0:e.mode)||``,i=r===`daemon`?`green`:`blue`;if((t=this.state.common)!=null&&t.enabled&&(!this.state.common.webExtension||!((n=this.state.native)!=null&&n.webInstance)||r===`daemon`)){var a;if(this.state.common.webExtension&&(a=this.state.native)!=null&&a.webInstance)return`green`;this.state.connectedToHost&&this.state.alive||(i=r===`daemon`?`red`:`orangeDevice`),this.state.connected!==null&&!this.state.connected&&i!==`red`&&(i=`orange`)}else i=r===`daemon`?`grey`:`blue`;return i}componentWillUnmount(){this.props.socket.unsubscribeObject(`system.adapter.${this.props.adapter}.${this.props.instance}`,this.onObjectChange),window.removeEventListener(`message`,this.closeConfig,!1),this.registered&&this.refIframe&&this.props.onUnregisterIframeRef(this.refIframe),this.refIframe=null}renderHelpButton(){return this.props.jsonConfig?a(D,{title:this.props.t(`Show help for this adapter`),slotProps:{popper:{sx:G.tooltip}},children:a(z,{sx:{"&.MuiFab-root":G.button},onClick:()=>{var e;let t=(e=this.state.adapterDocLangs)!=null&&e.includes(this.props.lang)?this.props.lang:`en`;window.open(H.getDocsLinkForAdapter({lang:t,adapterName:this.props.adapter}),`help`)},children:a(f,{})})}):null}getConfigurator(){if(this.props.jsonConfig)return a(s,{expertMode:this.props.expertMode,theme:this.props.theme,width:this.props.width,adapterName:this.props.adapter,instance:this.props.instance,socket:this.props.socket,themeName:this.props.themeName,themeType:this.props.themeType,dateFormat:this.props.dateFormat,isFloatComma:this.props.isFloatComma,configStored:this.props.configStored,t:this.props.t,DeviceManager:P,AceEditor:U});let e=`adapter/${this.props.adapter}/${this.props.tab?this.state.checkedExist:this.props.materialize?`index_m.html`:`index.html`}?${this.props.instance||0}&newReact=true&${this.props.instance||0}&react=${this.props.themeName}`;return this.state.checkedExist?a(`iframe`,{ref:e=>{this.refIframe=e},title:`config`,style:this.props.style,src:V(e)}):null}returnStopAdminDialog(){return this.state.showStopAdminDialog?a(M,{title:this.props.t(`Please confirm`),text:this.props.t(`stop_admin`,this.props.instance),ok:this.props.t(`Stop admin`),onClose:e=>{e&&this.props.socket.extendObject(`system.adapter.${this.props.adapter}.${this.props.instance}`,{common:{enabled:!1}}).catch(e=>window.alert(e)),this.setState({showStopAdminDialog:!1})}}):null}renderLogLevelDialog(){return this.state.showLogLevelDialog?h(T,{open:!0,onClose:()=>this.setState({showLogLevelDialog:!1}),children:[a(n,{children:this.props.t(`Edit log level rule for %s`,`${this.props.adapter}.${this.props.instance}`)}),h(d,{children:[h(g,{style:{...G.formControl,marginTop:10},variant:`outlined`,children:[a(v,{children:this.props.t(`log level`)}),a(O,{variant:`standard`,value:this.state.logLevelValue,fullWidth:!0,onChange:e=>this.setState({logLevelValue:e.target.value}),children:W.map(e=>a(N,{value:e,children:this.props.t(e)},e))})]}),h(g,{style:G.formControl,variant:`outlined`,children:[a(i,{control:a(e,{checked:this.state.logOnTheFlyValue,onChange:e=>this.setState({logOnTheFlyValue:e.target.checked})}),label:this.props.t(`Without restart`)}),a(_,{children:this.state.logOnTheFlyValue?this.props.t(`Will be reset to the saved log level after restart of adapter`):this.props.t(`Log level will be saved permanently`)})]})]}),h(u,{children:[a(x,{color:`primary`,variant:`contained`,onClick:()=>{this.state.logOnTheFlyValue?this.props.socket.setState(`system.adapter.${this.props.adapter}.${this.props.instance}.logLevel`,this.state.logLevelValue):this.props.socket.extendObject(`system.adapter.${this.props.adapter}.${this.props.instance}`,{common:{loglevel:this.state.logLevelValue}}).catch(e=>window.alert(`Cannot set log level: ${e}`)),this.setState({showLogLevelDialog:!1})},children:this.props.t(`Ok`)}),a(x,{color:`grey`,variant:`contained`,onClick:()=>this.setState({showLogLevelDialog:!1}),children:this.props.t(`Cancel`)})]})]}):null}render(){let e=[this.props.version?h(`span`,{style:{...G.version,...G[this.getInstanceStatus()]},children:[`v`,this.props.version]},`version`):null,a(D,{title:this.props.t(`Start/stop`),slotProps:{popper:{sx:G.tooltip}},children:a(`span`,{children:a(j,{size:`small`,onClick:e=>{e.stopPropagation(),e.preventDefault(),this.state.running&&`${this.props.adapter}.${this.props.instance}`===this.props.adminInstance?this.setState({showStopAdminDialog:!0,showMore:null}):(this.setState({showMore:null}),this.props.socket.extendObject(`system.adapter.${this.props.adapter}.${this.props.instance}`,{common:{enabled:!this.state.running}}).catch(e=>window.alert(`Cannot set log level: ${e}`)))},onFocus:e=>e.stopPropagation(),sx:{...G.buttonControl,...this.state.canStart?this.state.running?G.enabled:G.disabled:G.hide},children:this.state.running?a(c,{}):a(o,{})})})},`start`),a(D,{title:this.props.t(`Restart`),slotProps:{popper:{sx:G.tooltip}},children:a(`span`,{children:a(j,{size:`small`,onClick:e=>{this.setState({showMore:null}),e.stopPropagation(),this.props.socket.extendObject(`system.adapter.${this.props.adapter}.${this.props.instance}`,{}).catch(e=>window.alert(`Cannot set log level: ${e}`))},onFocus:e=>e.stopPropagation(),style:{...G.buttonControl,...this.state.canStart?void 0:G.hide},disabled:!this.state.running,children:a(C,{})})})},`restart`),this.state.tempLogLevel===this.state.logLevel?null:a(D,{title:this.props.t(`temporary log level`),slotProps:{popper:{sx:G.tooltip}},children:a(`span`,{style:G.logLevel,children:this.state.tempLogLevel})},`log`),a(D,{title:this.props.t(`log level`),slotProps:{popper:{sx:G.tooltip}},children:a(`span`,{style:G.logLevel,children:this.state.tempLogLevel===this.state.logLevel?this.state.logLevel:`/ ${this.state.logLevel}`})},`logLevel`),a(D,{title:this.props.t(`Edit log level rule for %s`,`${this.props.adapter}.${this.props.instance}`),children:a(j,{size:`small`,onClick:e=>{e.stopPropagation(),this.setState({showLogLevelDialog:!0,showMore:null})},onFocus:e=>e.stopPropagation(),style:{...G.buttonControl,...this.state.canStart?void 0:G.hide,width:34,height:34},children:a(R,{style:{width:20,height:20}})})},`editLog`)];return h(L,{style:G.root,children:[a(b,{color:`default`,position:`static`,children:h(A,{variant:`dense`,style:{marginLeft:8,paddingRight:6},children:[h(w,{variant:`h6`,color:`inherit`,style:{display:`flex`,alignItems:`center`},children:[a(j,{size:`small`,onClick:()=>{this.props.easyMode?this.props.handleNavigation(`easy`):this.props.handleNavigation(`tab-instances`)},onFocus:e=>e.stopPropagation(),style:{marginRight:10},children:a(E,{})}),this.props.jsonConfig?a(S,{src:this.props.icon,style:G.instanceIcon}):null,a(y,{component:`span`,sx:e=>({[e.breakpoints.down(`md`)]:{display:`none`},marginRight:`8px`}),children:`${this.props.t(`Instance settings`)}:`}),`${this.props.adapter}.${this.props.instance}`,a(y,{component:`div`,sx:e=>({[e.breakpoints.down(`sm`)]:{display:`none`}}),children:e}),h(y,{component:`span`,sx:e=>({[e.breakpoints.up(`sm`)]:{display:`none`}}),children:[a(j,{style:{marginLeft:8},onClick:e=>this.setState({showMore:e.currentTarget}),children:a(I,{})}),this.state.showMore?a(k,{open:!0,anchorEl:this.state.showMore,onClose:()=>this.setState({showMore:null}),children:e}):null]})]}),a(`div`,{style:{flexGrow:1}}),this.renderHelpButton()]})}),this.getConfigurator(),this.returnStopAdminDialog(),this.renderLogLevelDialog()]})}};export{K as t};
|
|
1
|
+
import{Bs as e,Ds as t,Eo as n,Es as r,Fo as i,Fs as a,Ho as o,In as s,Is as c,It as l,Ln as u,Mo as d,No as f,Pi as p,Rs as m,Us as h,Vo as g,Wo as _,Ws as v,Yo as y,_o as b,as as x,bo as S,br as C,da as w,ho as T,jo as E,ka as D,mo as O,ms as k,nc as A,os as j,po as M,qo as N,sr as P,ss as F,t as I,tn as L,us as R,xa as z,zo as B}from"./loadShare-eager-BpwDZfDr.js";import{o as V,t as H}from"./AdminUtils-CopxRJZ2.js";import{t as U}from"./AceEditor-CJ-_Ev2E.js";t();var W=[`silly`,`debug`,`info`,`warn`,`error`],G={root:{height:`100%`,display:`flex`,flexDirection:`column`,overflow:`hidden`},scroll:{height:`100%`,overflowY:`auto`},instanceIcon:{width:42,height:42,marginRight:16,verticalAlign:`middle`},button:{width:36,height:36},version:{fontSize:12,opacity:.8,marginLeft:20,marginRight:10},versionAliveConnected:e=>({color:e.palette.mode===`dark`?`#23a623`:`#60ff60`}),versionAliveNotConnected:{color:`#a67223`},buttonControl:{padding:`5px`,transition:`opacity 0.2s`,height:34},enabled:{color:m[400],"&:hover":{backgroundColor:m[200]}},disabled:{color:e[400],"&:hover":{backgroundColor:e[200]}},hide:{visibility:`hidden`},formControl:{width:`100%`,marginBottom:5},logLevel:{fontSize:12,marginLeft:10},green:{color:m[700]},red:{color:e[700]},grey:{color:a[700]},blue:{color:`#0055a9`},orange:{color:c[400]},orangeDevice:{color:c[300]},tooltip:{pointerEvents:`none`}},K=class extends A{constructor(e){super(e),r(this,`refIframe`,void 0),r(this,`registered`,void 0),r(this,`onObjectChange`,(e,t)=>{let n=t;if(e===`system.adapter.${this.props.adapter}.${this.props.instance}`){var r,i,a,o;this.setState({running:!!(n!=null&&(r=n.common)!=null&&r.onlyWWW||n!=null&&(i=n.common)!=null&&i.enabled),canStart:!(n!=null&&(a=n.common)!=null&&a.onlyWWW),logLevel:(n==null||(o=n.common)==null?void 0:o.loglevel)||`info`})}}),r(this,`onStateChange`,(e,t)=>{let n=`system.adapter.${this.props.adapter}.${this.props.instance}`;e===`${n}.alive`?!!(t!=null&&t.val)!==this.state.alive&&this.setState({alive:!!(t!=null&&t.val)}):e===`${n}.connected`?!!(t!=null&&t.val)!==this.state.connectedToHost&&this.setState({connectedToHost:!!(t!=null&&t.val)}):e===`${this.props.adapter}.${this.props.instance}.info.connection`?(t?!!t.val:null)!==this.state.connected&&this.setState({connected:t?!!t.val:null}):e===`${this.props.adapter}.${this.props.instance}.info.extension`?(t?!!t.val:null)!==this.state.extension&&this.setState({extension:t?!!t.val:null}):e===`${n}.logLevel`&&this.setState({tempLogLevel:t?t.val:void 0})}),r(this,`closeConfig`,e=>{if(e.origin===window.location.origin){if(e.data===`close`||e.message===`close`)this.props.easyMode?this.props.handleNavigation(`easy`):this.props.handleNavigation(`tab-instances`);else if(e.data===`change`||e.message===`change`)this.props.configStored(!1);else if(e.data===`nochange`||e.message===`nochange`)this.props.configStored(!0);else if(typeof e.data==`string`&&e.data.startsWith(`goto:`)||typeof e.message==`string`&&e.message.startsWith(`goto:`)){let[,t]=(e.data||e.message).split(`:`),[n,r,i]=t.split(`/`);this.props.handleNavigation(n,r,i)}}}),this.state={checkedExist:!1,showStopAdminDialog:!1,running:!1,canStart:!1,alive:!1,connected:!1,connectedToHost:!1,logOnTheFlyValue:!1,logLevel:`info`,logLevelValue:`info`,tempLogLevel:`info`,showLogLevelDialog:!1,showMore:null},this.refIframe=null,this.registered=!1}componentDidUpdate(){var e;!this.registered&&(e=this.refIframe)!=null&&e.contentWindow&&(this.registered=!0,this.props.onRegisterIframeRef(this.refIframe))}componentDidMount(){var e;if(this.props.tab)this.props.socket.fileExists(`${this.props.adapter}.admin`,`tab.html`).then(e=>{if(e)this.setState({checkedExist:`tab.html`});else return this.props.socket.fileExists(`${this.props.adapter}.admin`,`tab_m.html`).then(e=>e?this.setState({checkedExist:`tab_m.html`}):window.alert(`Cannot find tab(_m).html`))});else{let e=`system.adapter.${this.props.adapter}.${this.props.instance}`;this.props.socket.subscribeObject(e,this.onObjectChange),this.props.socket.getObject(e).then(async t=>{var n,r,i,a,o,s,c;let l=await this.props.socket.getState(`${e}.logLevel`);await this.props.socket.subscribeState(`${e}.logLevel`,this.onStateChange);let u=await this.props.socket.getState(`${e}.alive`);await this.props.socket.subscribeState(`${e}.alive`,this.onStateChange);let d=await this.props.socket.getState(`${e}.connected`);await this.props.socket.subscribeState(`${e}.connected`,this.onStateChange);let f;try{f=await this.props.socket.getState(`${this.props.adapter}.${this.props.instance}.info.connection`),this.props.socket.subscribeState(`${this.props.adapter}.${this.props.instance}.info.connection`,this.onStateChange)}catch{f=null}let p;try{p=await this.props.socket.getState(`${this.props.adapter}.${this.props.instance}.info.extension`),this.props.socket.subscribeState(`${this.props.adapter}.${this.props.instance}.info.extension`,this.onStateChange)}catch{p=null}this.setState({checkedExist:!0,running:!!(t!=null&&(n=t.common)!=null&&n.onlyWWW||t!=null&&(r=t.common)!=null&&r.enabled),canStart:!(t!=null&&(i=t.common)!=null&&i.onlyWWW),alive:!!(u!=null&&u.val),extension:p?!!(p!=null&&p.val):null,connectedToHost:!!(d!=null&&d.val),connected:f?!!f.val:null,logLevel:(t==null||(a=t.common)==null?void 0:a.loglevel)||`info`,logLevelValue:(t==null||(o=t.common)==null?void 0:o.loglevel)||`info`,tempLogLevel:(l==null?void 0:l.val)||(t==null||(s=t.common)==null?void 0:s.loglevel)||`info`,common:(t==null?void 0:t.common)||{},native:(t==null?void 0:t.native)||{},adapterDocLangs:t!=null&&(c=t.common)!=null&&c.docs?Object.keys(t.common.docs):[`en`]})}).catch(e=>{console.error(e),this.setState({checkedExist:!0,running:!1})})}!this.registered&&(e=this.refIframe)!=null&&e.contentWindow&&(this.registered=!0,this.props.onRegisterIframeRef(this.refIframe)),window.addEventListener(`message`,this.closeConfig,!1)}getInstanceStatus(){var e,t,n;let r=((e=this.state.common)==null?void 0:e.mode)||``,i=r===`daemon`?`green`:`blue`;if((t=this.state.common)!=null&&t.enabled&&(!this.state.common.webExtension||!((n=this.state.native)!=null&&n.webInstance)||r===`daemon`)){var a;if(this.state.common.webExtension&&(a=this.state.native)!=null&&a.webInstance)return`green`;this.state.connectedToHost&&this.state.alive||(i=r===`daemon`?`red`:`orangeDevice`),this.state.connected!==null&&!this.state.connected&&i!==`red`&&(i=`orange`)}else i=r===`daemon`?`grey`:`blue`;return i}componentWillUnmount(){this.props.socket.unsubscribeObject(`system.adapter.${this.props.adapter}.${this.props.instance}`,this.onObjectChange),window.removeEventListener(`message`,this.closeConfig,!1),this.registered&&this.refIframe&&this.props.onUnregisterIframeRef(this.refIframe),this.refIframe=null}renderHelpButton(){return this.props.jsonConfig?h(O,{title:this.props.t(`Show help for this adapter`),slotProps:{popper:{sx:G.tooltip}},children:h(B,{sx:{"&.MuiFab-root":G.button},onClick:()=>{var e;let t=(e=this.state.adapterDocLangs)!=null&&e.includes(this.props.lang)?this.props.lang:`en`;window.open(H.getDocsLinkForAdapter({lang:t,adapterName:this.props.adapter}),`help`)},children:h(p,{})})}):null}getConfigurator(){if(this.props.jsonConfig)return h(l,{expertMode:this.props.expertMode,theme:this.props.theme,width:this.props.width,adapterName:this.props.adapter,instance:this.props.instance,socket:this.props.socket,themeName:this.props.themeName,themeType:this.props.themeType,dateFormat:this.props.dateFormat,isFloatComma:this.props.isFloatComma,configStored:this.props.configStored,t:this.props.t,DeviceManager:I,AceEditor:U});let e=`adapter/${this.props.adapter}/${this.props.tab?this.state.checkedExist:this.props.materialize?`index_m.html`:`index.html`}?${this.props.instance||0}&newReact=true&${this.props.instance||0}&react=${this.props.themeName}`;return this.state.checkedExist?h(`iframe`,{ref:e=>{this.refIframe=e},title:`config`,style:this.props.style,src:V(e)}):null}returnStopAdminDialog(){return this.state.showStopAdminDialog?h(P,{title:this.props.t(`Please confirm`),text:this.props.t(`stop_admin`,this.props.instance),ok:this.props.t(`Stop admin`),onClose:e=>{e&&this.props.socket.extendObject(`system.adapter.${this.props.adapter}.${this.props.instance}`,{common:{enabled:!1}}).catch(e=>window.alert(e)),this.setState({showStopAdminDialog:!1})}}):null}renderLogLevelDialog(){return this.state.showLogLevelDialog?v(E,{open:!0,onClose:()=>this.setState({showLogLevelDialog:!1}),children:[h(i,{children:this.props.t(`Edit log level rule for %s`,`${this.props.adapter}.${this.props.instance}`)}),v(f,{children:[v(g,{style:{...G.formControl,marginTop:10},variant:`outlined`,children:[h(y,{children:this.props.t(`log level`)}),h(k,{variant:`standard`,value:this.state.logLevelValue,fullWidth:!0,onChange:e=>this.setState({logLevelValue:e.target.value}),children:W.map(e=>h(F,{value:e,children:this.props.t(e)},e))})]}),v(g,{style:G.formControl,variant:`outlined`,children:[h(o,{control:h(n,{checked:this.state.logOnTheFlyValue,onChange:e=>this.setState({logOnTheFlyValue:e.target.checked})}),label:this.props.t(`Without restart`)}),h(_,{children:this.state.logOnTheFlyValue?this.props.t(`Will be reset to the saved log level after restart of adapter`):this.props.t(`Log level will be saved permanently`)})]})]}),v(d,{children:[h(S,{color:`primary`,variant:`contained`,onClick:()=>{this.state.logOnTheFlyValue?this.props.socket.setState(`system.adapter.${this.props.adapter}.${this.props.instance}.logLevel`,this.state.logLevelValue):this.props.socket.extendObject(`system.adapter.${this.props.adapter}.${this.props.instance}`,{common:{loglevel:this.state.logLevelValue}}).catch(e=>window.alert(`Cannot set log level: ${e}`)),this.setState({showLogLevelDialog:!1})},children:this.props.t(`Ok`)}),h(S,{color:`grey`,variant:`contained`,onClick:()=>this.setState({showLogLevelDialog:!1}),children:this.props.t(`Cancel`)})]})]}):null}render(){let e=[this.props.version?v(`span`,{style:{...G.version,...G[this.getInstanceStatus()]},children:[`v`,this.props.version]},`version`):null,h(O,{title:this.props.t(`Start/stop`),slotProps:{popper:{sx:G.tooltip}},children:h(`span`,{children:h(N,{size:`small`,onClick:e=>{e.stopPropagation(),e.preventDefault(),this.state.running&&`${this.props.adapter}.${this.props.instance}`===this.props.adminInstance?this.setState({showStopAdminDialog:!0,showMore:null}):(this.setState({showMore:null}),this.props.socket.extendObject(`system.adapter.${this.props.adapter}.${this.props.instance}`,{common:{enabled:!this.state.running}}).catch(e=>window.alert(`Cannot set log level: ${e}`)))},onFocus:e=>e.stopPropagation(),sx:{...G.buttonControl,...this.state.canStart?this.state.running?G.enabled:G.disabled:G.hide},children:this.state.running?h(u,{}):h(s,{})})})},`start`),h(O,{title:this.props.t(`Restart`),slotProps:{popper:{sx:G.tooltip}},children:h(`span`,{children:h(N,{size:`small`,onClick:e=>{this.setState({showMore:null}),e.stopPropagation(),this.props.socket.extendObject(`system.adapter.${this.props.adapter}.${this.props.instance}`,{}).catch(e=>window.alert(`Cannot set log level: ${e}`))},onFocus:e=>e.stopPropagation(),style:{...G.buttonControl,...this.state.canStart?void 0:G.hide},disabled:!this.state.running,children:h(w,{})})})},`restart`),this.state.tempLogLevel===this.state.logLevel?null:h(O,{title:this.props.t(`temporary log level`),slotProps:{popper:{sx:G.tooltip}},children:h(`span`,{style:G.logLevel,children:this.state.tempLogLevel})},`log`),h(O,{title:this.props.t(`log level`),slotProps:{popper:{sx:G.tooltip}},children:h(`span`,{style:G.logLevel,children:this.state.tempLogLevel===this.state.logLevel?this.state.logLevel:`/ ${this.state.logLevel}`})},`logLevel`),h(O,{title:this.props.t(`Edit log level rule for %s`,`${this.props.adapter}.${this.props.instance}`),children:h(N,{size:`small`,onClick:e=>{e.stopPropagation(),this.setState({showLogLevelDialog:!0,showMore:null})},onFocus:e=>e.stopPropagation(),style:{...G.buttonControl,...this.state.canStart?void 0:G.hide,width:34,height:34},children:h(z,{style:{width:20,height:20}})})},`editLog`)];return v(R,{style:G.root,children:[h(x,{color:`default`,position:`static`,children:v(M,{variant:`dense`,style:{marginLeft:8,paddingRight:6},children:[v(T,{variant:`h6`,color:`inherit`,style:{display:`flex`,alignItems:`center`},children:[h(N,{size:`small`,onClick:()=>{this.props.easyMode?this.props.handleNavigation(`easy`):this.props.handleNavigation(`tab-instances`)},onFocus:e=>e.stopPropagation(),style:{marginRight:10},children:h(D,{})}),this.props.jsonConfig?h(C,{src:this.props.icon,style:G.instanceIcon}):null,h(b,{component:`span`,sx:e=>({[e.breakpoints.down(`md`)]:{display:`none`},marginRight:`8px`}),children:`${this.props.t(`Instance settings`)}:`}),`${this.props.adapter}.${this.props.instance}`,h(b,{component:`div`,sx:e=>({[e.breakpoints.down(`sm`)]:{display:`none`}}),children:e}),v(b,{component:`span`,sx:e=>({[e.breakpoints.up(`sm`)]:{display:`none`}}),children:[h(N,{style:{marginLeft:8},onClick:e=>this.setState({showMore:e.currentTarget}),children:h(L,{})}),this.state.showMore?h(j,{open:!0,anchorEl:this.state.showMore,onClose:()=>this.setState({showMore:null}),children:e}):null]})]}),h(`div`,{style:{flexGrow:1}}),this.renderHelpButton()]})}),this.getConfigurator(),this.returnStopAdminDialog(),this.renderLogLevelDialog()]})}};export{K as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{Tr as e,Us as t,jr as n,mo as r,qo as i,t as a}from"./loadShare-eager-BpwDZfDr.js";import{n as o,t as s}from"./PushPinOutlined-CEBeTmNm.js";import{N as c,P as l}from"./bootstrap-DSDOwKWU.js";var u={root:{display:`block`,position:`relative`,left:0,top:0,width:`100%`,height:`100%`,color:`black`,borderRadius:4,boxShadow:`0px 2px 1px -1px rgb(0 0 0 / 20%), 0px 1px 1px 0px rgb(0 0 0 / 14%), 0px 1px 3px 0px rgb(0 0 0 / 12%)`,border:`0px solid #888`},pinnedIcon:{color:`#ffca28`}},d={backgroundColor:`rgba(255, 255, 255, 0.25)`,"&:hover":{backgroundColor:`rgba(255, 255, 255, 0.35)`}},f=class extends n{constructor(e){super(e);let t=n.getLocation().id||window.localStorage.getItem(`dmSelectedInstance`)||``;this.state={instance:t,pinned:t?c(t):!1,listKey:t}}componentDidMount(){super.componentDidMount(),this.state.instance||this.detectSingleInstance()}async detectSingleInstance(){try{let e=await this.props.socket.getObjectViewSystem(`instance`,`system.adapter.`,`system.adapter.香`),t=Object.keys(e||{}).filter(t=>{var n;return(n=e[t])==null||(n=n.common)==null||(n=n.supportedMessages)==null?void 0:n.deviceManager}).map(e=>e.substring(15)),n=[];for(let e of t){let t=await this.props.socket.getState(`system.adapter.${e}.alive`);t!=null&&t.val&&n.push(e)}n.length===1&&!this.state.instance&&this.setState({instance:n[0],pinned:c(n[0])})}catch(e){console.error(`Cannot read the instances with a device manager: ${e}`)}}onHashChanged(){let e=n.getLocation().id;e&&e!==this.state.instance&&this.setState({instance:e,pinned:c(e),listKey:e})}renderPinButton(){return this.state.instance?t(r,{title:e.t(this.state.pinned?`Remove from navigation`:`Pin to navigation`),slotProps:{popper:{sx:{pointerEvents:`none`}}},children:t(i,{color:`inherit`,size:`small`,sx:{mr:1,...this.state.pinned?d:void 0},onClick:()=>{let e=!this.state.pinned;l(this.state.instance,e),this.setState({pinned:e})},children:this.state.pinned?t(o,{style:u.pinnedIcon}):t(s,{})})}):null}render(){return t(`div`,{style:u.root,children:t(a,{socket:this.props.socket,themeType:this.props.themeType,themeName:this.props.themeName,theme:this.props.theme,isFloatComma:this.props.isFloatComma,dateFormat:this.props.dateFormat,title:this.renderPinButton(),instance:this.state.instance,onInstanceChanged:e=>{this.setState({instance:e,pinned:e?c(e):!1}),n.doNavigate(`tab-devicemanager`,`tab`,e)}},this.state.listKey)})}};export{f as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Fo as e,Ga as t,Gr as n,
|
|
1
|
+
import{Fo as e,Ga as t,Gr as n,Jo as r,Mo as i,No as a,Tr as o,Us as s,Ws as c,bo as l,go as u,ja as d,jo as f,mc as p,mo as m,qa as h,qo as g,uo as _,yo as v}from"./loadShare-eager-BpwDZfDr.js";import{n as y}from"./ctrlEnter-CruFIPb_.js";var b={modalDialog:{minWidth:400,maxWidth:800},overflowHidden:{display:`flex`,overflow:`hidden`},titleIcon:{marginRight:5},content:{fontSize:16},languageButton:{position:`absolute`,right:8,top:8},languageButtonActive:e=>({color:e.palette.primary.main})},x=({toggleTranslation:x,noTranslation:S,title:C,fullWidth:w,help:T,maxWidth:E,progress:D,icon:O,disableApplyIfNotChanged:k,applyButton:A,onClose:j,children:M,titleButtonApply:N,titleButtonClose:P,onApply:F,textInput:I,defaultValue:L,overflowHidden:R,disableApply:z,theme:B})=>{let[V,H]=p(L),[U,W]=p(L);U!==L&&(W(L),H(L));let G=v(),K=u(G.breakpoints.down(`md`)),q=null;O&&(q=O);let J=n.getStyle(B,b.languageButtonActive),Y=z||D||k&&L===V,X=()=>{Y||A!==void 0&&!A||F==null||F(I?V??``:``)};return c(f,{open:!0,maxWidth:K?!1:E||`md`,fullWidth:!!w,fullScreen:K,onClose:j,onKeyDown:e=>y(e,X),sx:{"& .MuiPaper-root":K?{}:b.modalDialog},children:[C&&c(e,{children:[q?s(q,{style:b.titleIcon}):null,C,o.getLanguage()!==`en`&&x?s(g,{size:`large`,style:{...b.languageButton,...S?J:void 0},onClick:()=>x(),title:o.t(`Disable/Enable translation`),children:s(d,{})}):null]}),c(a,{style:{...R?b.overflowHidden:void 0,...b.content,paddingTop:8},children:[I&&s(_,{autoComplete:`off`,fullWidth:!0,autoFocus:!0,variant:`standard`,size:`medium`,multiline:!0,value:V,onChange:e=>H(e.target.value),slotProps:{input:{endAdornment:V?s(r,{position:`end`,children:s(g,{tabIndex:-1,size:`small`,onClick:()=>H(``),children:s(h,{})})}):null}}}),M,T?s(`div`,{children:T}):null]}),c(i,{children:[(A===void 0||A)&&s(m,{title:o.t(`Press CTRL+ENTER to confirm`),children:s(`span`,{children:s(l,{startIcon:s(t,{}),disabled:Y,onClick:X,variant:`contained`,color:`primary`,children:o.t(N||`Ok`)})})}),s(l,{color:`grey`,onClick:j,disabled:D,variant:`contained`,startIcon:s(h,{}),children:o.t(P||`Cancel`)})]})]})};export{x as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-sJBDdmOt.js";import{
|
|
1
|
+
import{a as e}from"./rolldown-runtime-sJBDdmOt.js";import{Ds as t,Es as n,Lt as r,Tr as i,Us as a,Ws as o,Yr as s,Zo as c,jr as l,nc as u,t as d}from"./loadShare-eager-BpwDZfDr.js";import{o as f,t as p}from"./AdminUtils-CopxRJZ2.js";import{t as m}from"./AceEditor-CJ-_Ev2E.js";var h=e(s(),1);t();var g={root:{display:`block`,position:`relative`,left:0,top:0,width:`100%`,height:`100%`,color:`black`,borderRadius:4,boxShadow:`0px 2px 1px -1px rgb(0 0 0 / 20%), 0px 1px 1px 0px rgb(0 0 0 / 14%), 0px 1px 3px 0px rgb(0 0 0 / 12%)`,border:`0px solid #888`}},_=class extends u{constructor(e){super(e),n(this,`refIframe`,null),n(this,`registered`,!1),n(this,`loadingTimer`,null),n(this,`onMessage`,e=>{if(this.props.supportsLoadingMessage&&e.data===`iobLoaded`||e.message===`iobLoaded`)this.setState({loading:!1}),this.loadingTimer&&=(clearInterval(this.loadingTimer),null);else if(e.origin===window.location.origin){if(e.data===`close`||e.message===`close`)l.doNavigate(`tab-instances`);else if(e.data===`change`||e.message===`change`)console.warn(`Application sends "change" message, but it is not processed yet`);else if(e.data===`nochange`||e.message===`nochange`)console.warn(`Application sends "nochange" message, but it is not processed yet`);else if(typeof e.data==`string`&&e.data.startsWith(`goto:`)||typeof e.message==`string`&&e.message.startsWith(`goto:`)){let[,t]=(e.data||e.message).split(`:`),[n,r,i]=t.split(`/`);l.doNavigate(n,r,i)}}}),this.state={href:``,adapterName:``,instanceNumber:null,schema:null,jsonData:{},loadingKey:0,loading:!0,unreachable:!1}}async componentDidMount(){var e;!this.registered&&(e=this.refIframe)!=null&&e.contentWindow&&(this.registered=!0,this.props.onRegisterIframeRef(this.refIframe)),window.addEventListener(`message`,this.onMessage,!1);let t={};for(let e of this.props.hosts)t[e._id]=e;let n=await p.getHref(this.props.instancesWorker,this.props.tab,this.props.hostname,t,this.props.adminInstance,this.props.theme.palette.mode),i=null,a=(n==null?void 0:n.href.split(`?`)[0])||``,o={};if(a.endsWith(`.json`)||a.endsWith(`.json5`)){fetch(f(`validate_tab/${n.adapterName}`)).catch(e=>console.warn(`Cannot validate jsonTab of ${n.adapterName}: ${e}`));try{let e=``,t=await this.props.socket.readFile(`${n.adapterName}.admin`,a,!0);t.file!==void 0&&(e=atob(t.file.toString()),e.startsWith(`{`)||(e=decodeURIComponent(e)));try{i=h.default.parse(e)}catch(e){console.error(`Cannot parse jsonConfig of ${n.adapterName}: ${e}`),window.alert(`Cannot parse jsonConfig of ${n.adapterName}: ${e}`)}if(i&&await r.loadI18n(this.props.socket,i.i18n,n.adapterName),i!=null&&i.command){let e=await this.props.socket.getState(`system.adapter.${n.adapterName}.${n.instanceNumber||0}.alive`);if(e!=null&&e.val){let e=await this.props.socket.sendTo(`${n.adapterName}.${n.instanceNumber||0}`,i==null?void 0:i.command,null);e!=null&&e.data&&(o=e.data)}}}catch(e){console.error(`Cannot load ${n.adapterName}.admin/${n.href}: ${e}`),window.alert(`Cannot load ${n.adapterName}.admin/${n.href}: ${e}`)}}this.setState({href:f(n.href),adapterName:n.adapterName,instanceNumber:n.instanceNumber,schema:i,jsonData:o,unreachable:!!n.unreachable})}componentWillUnmount(){this.loadingTimer&&=(clearInterval(this.loadingTimer),null),this.registered&&=(this.props.onUnregisterIframeRef(this.refIframe),!1),window.removeEventListener(`message`,this.onMessage,!1)}componentDidUpdate(){var e;!this.registered&&(e=this.refIframe)!=null&&e.contentWindow&&(this.registered=!0,this.props.onRegisterIframeRef(this.refIframe))}render(){return this.state.href?this.state.href.includes(`.json`)?this.state.schema?a(r,{socket:this.props.socket,themeName:this.props.themeName,themeType:this.props.theme.palette.mode,adapterName:this.state.adapterName,instance:this.state.instanceNumber||0,isFloatComma:this.props.isFloatComma,dateFormat:this.props.dateFormat,schema:this.state.schema,data:this.state.jsonData,onError:()=>{},theme:this.props.theme,withoutSaveButtons:!0,expertMode:this.props.expertMode,DeviceManager:d,AceEditor:m}):a(c,{}):this.state.unreachable?o(`div`,{style:{padding:10,display:`flex`,justifyContent:`center`,alignItems:`center`,height:`100%`,flexDirection:`column`,fontSize:18,gap:20,textAlign:`center`},children:[a(`div`,{children:i.t(`Only reachable in the local network`)}),a(`div`,{children:i.t(`This page is not provided by the remote access of ioBroker Cloud/Pro.`)}),a(`div`,{style:{opacity:.7,fontSize:16},children:this.state.href})]}):this.state.href.startsWith(`http://`)&&window.location.protocol===`https:`&&window.location.hostname!==`localhost`?o(`div`,{style:{padding:10,display:`flex`,justifyContent:`center`,alignItems:`center`,height:`100%`,flexDirection:`column`,fontSize:18,gap:20},children:[a(`div`,{children:i.t(`This content cannot be loaded because it uses insecure HTTP protocol.`)}),a(`div`,{children:i.t(`But you can open this link in new tab:`)}),a(`a`,{href:this.state.href,target:`_blank`,rel:`noopener noreferrer`,children:this.state.href})]}):o(`div`,{style:g.root,children:[this.state.loading?a(c,{style:{position:`absolute`,zIndex:2,width:`100%`}}):null,this.state.loading&&this.props.icon?a(`div`,{style:{position:`absolute`,zIndex:2,width:`100%`,height:`100%`,display:`flex`,justifyContent:`center`,alignItems:`center`,fontSize:48},children:typeof this.props.icon==`string`?a(`img`,{src:this.props.icon,alt:`icon`,style:{maxWidth:200,width:`100%`,opacity:.7}}):this.props.icon}):null,a(`iframe`,{ref:e=>{this.refIframe=e},title:this.props.tab,style:{display:`block`,position:`relative`,left:0,top:0,width:`100%`,height:`100%`,color:`black`,zIndex:1,borderRadius:0,boxShadow:`none`,border:`0px solid #888`},src:this.state.href,onLoad:()=>{this.props.supportsLoadingMessage||(this.setState({loading:!1}),this.loadingTimer&&=(clearInterval(this.loadingTimer),null))},onError:e=>{e.target.onerror=null,this.state.href.includes(`tab_m.html`)?this.setState(e=>({href:e.href.replace(`tab_m.html`,`tab.html`)})):this.loadingTimer||=setInterval(()=>this.setState({loadingKey:this.state.loadingKey+1}),3e3)}})]}):a(c,{})}};export{_ 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:`M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6zm2.46-7.12 1.41-1.41L12 12.59l2.12-2.12 1.41 1.41L13.41 14l2.12 2.12-1.41 1.41L12 15.41l-2.12 2.12-1.41-1.41L10.59 14zM15.5 4l-1-1h-5l-1 1H5v2h14V4z`}),`DeleteForever`);export{n as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Oo as e,So as t,To as n,Ur as r,Us as i,Ws as a,as as o,ka as s,nc as c,po as l,qo as u,us as d}from"./loadShare-eager-BpwDZfDr.js";import{t as f}from"./Config-BwTa1LdH.js";var p=`0 2px 2px 0 rgba(0, 0, 0, .14),0 3px 1px -2px rgba(0, 0, 0, .12),0 1px 5px 0 rgba(0, 0, 0, .2)`,m=`0 8px 17px 0 rgba(0, 0, 0, .2),0 6px 20px 0 rgba(0, 0, 0, .19)`,h={root:e=>({position:`relative`,m:`10px`,width:300,minHeight:200,background:e.palette.background.default,boxShadow:p,display:`flex`,transition:`box-shadow 0.5s`,cursor:`pointer`,"&:hover":{boxShadow:m}}),imageBlock:{background:`silver`,minHeight:60,display:`flex`,padding:`0 10px 0 10px`,position:`relative`,justifyContent:`space-between`,transition:`background 0.5s`},img:{width:60,height:60,marginTop:20,position:`relative`,"&:after":{content:`""`,position:`absolute`,zIndex:2,top:0,left:0,width:`100%`,height:`100%`,background:`url("img/no-image.svg") 100% 100% no-repeat`,backgroundSize:`cover`,backgroundColor:`#fff`}},adapter:{width:`100%`,fontWeight:`bold`,fontSize:15,verticalAlign:`middle`,marginTop:`auto`,borderTop:`1px solid silver`,padding:`20px 4px`,textAlign:`center`,textTransform:`uppercase`,textOverflow:`ellipsis`,overflow:`hidden`,color:`#ffab40`},instanceStateNotAlive1:{backgroundColor:`rgba(192, 192, 192, 0.4)`},wrapperDesc:{display:`flex`,flexDirection:`column`,width:`100%`,overflow:`hidden`},desc:{padding:20,fontSize:15}};function g(e,t){return e&&typeof e==`object`?e[t]||e.en||``:e||``}var _=({icon:e,id:r,desc:o,lang:s,navigate:c})=>a(t,{onClick:c,sx:h.root,children:[i(`div`,{style:{...h.imageBlock,...h.instanceStateNotAlive1},children:i(n,{sx:h.img,component:`img`,image:`adapter/${r.split(`.`)[0]}/${e}`})}),a(`div`,{style:h.wrapperDesc,children:[i(`div`,{style:h.desc,children:g(o,s)}),i(`div`,{style:h.adapter,children:r})]})]}),v={appBar:e=>({transition:e.transitions.create([`margin`,`width`],{easing:e.transitions.easing.sharp,duration:e.transitions.duration.leavingScreen})}),wrapperEasyMode:{height:`100%`,borderRadius:0},wrapperCard:{padding:`80px 20px 20px`,height:`100%`,overflowY:`auto`},controlHeight:{display:`flex`,flexFlow:`wrap`,justifyContent:`center`},img:{width:60,height:60,position:`relative`,borderRadius:60},logoWhite:{background:`white`},wrapperHeader:{display:`flex`,alignItems:`center`},headerName:{fontSize:24,marginLeft:10},toolBar:{justifyContent:`space-between`,margin:`5px 0`},paper:{height:`100%`,paddingTop:80},iframe:{height:`100%`,width:`100%`,background:`#FFF`,color:`#000`,borderRadius:5,border:`1px solid #888`},IconButtons:{display:`flex`},logoPointer:{cursor:`pointer`}},y=class extends c{constructor(e){super(e),this.state={configs:this.props.configs||[],strictMode:!this.props.configs}}componentDidMount(){this.props.configs||this.props.socket.getEasyMode().then(e=>this.setState({configs:e.configs}))}render(){let{t,themeName:c,toggleTheme:p,navigate:m,location:h,socket:g,themeType:y,theme:b,width:x,isFloatComma:S,dateFormat:C,configStored:w,getLocation:T,adminInstance:E}=this.props,{configs:D,strictMode:O}=this.state;if(!D)return i(e,{});let k=h.id,A=D.find(({id:e})=>e===k);return a(d,{style:v.wrapperEasyMode,children:[i(o,{color:`default`,position:`fixed`,sx:v.appBar,children:a(l,{style:v.toolBar,children:[a(`div`,{style:v.wrapperHeader,children:[i(n,{onClick:O&&!T().dialog||A!=null&&A.tab?()=>m(A!=null&&A.tab?`easy`:`tab-intro`):void 0,style:{...v.img,...c===`colored`?v.logoWhite:void 0,...O&&!T().dialog||A!=null&&A.tab?v.logoPointer:void 0},component:`img`,image:`img/no-image.svg`}),i(`div`,{style:v.headerName,children:t(`Easy Admin`)})]}),a(`div`,{style:v.IconButtons,children:[(O&&!T().dialog||(A==null?void 0:A.tab))&&i(u,{size:`large`,onClick:()=>m(A!=null&&A.tab?`easy`:`tab-intro`),children:i(s,{})}),i(r,{t,toggleTheme:p,themeName:c,size:`large`})]})]})}),A?i(d,{style:v.paper,children:i(f,{expertMode:!0,style:v.iframe,adapter:A.id.split(`.`)[0],instance:parseInt(A.id.split(`.`)[1],10),jsonConfig:A.jsonConfig,materialize:A.materialize,tab:A==null?void 0:A.tab,socket:g,easyMode:!0,themeName:c,themeType:y,theme:b,width:x,t,lang:this.props.lang,icon:A.icon,adminInstance:E,configStored:w,dateFormat:C,isFloatComma:S,onRegisterIframeRef:e=>this.props.onRegisterIframeRef(e),onUnregisterIframeRef:e=>this.props.onUnregisterIframeRef(e),handleNavigation:this.props.handleNavigation})}):i(`div`,{style:v.wrapperCard,children:i(`div`,{style:v.controlHeight,children:D.sort((e,t)=>e.id<t.id?-1:+(e.id>t.id)).map(e=>i(_,{lang:this.props.lang,navigate:()=>m(null,`config`,e.id),...e},e.id))})})]})}};export{y as default};
|