iobroker.eos-admin 9.0.18 → 9.0.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (223) hide show
  1. package/NEXOWATT_EOS_BUILD_INFO.json +8 -9
  2. package/README.md +4 -2
  3. package/START_HIER_9.0.19.md +52 -0
  4. package/adminWww/.vite/manifest.json +114 -114
  5. package/adminWww/NEXOWATT_EOS_FRONTEND_MANIFEST.json +13759 -13759
  6. package/adminWww/assets/{AdapterUpdateDialog-ByJk9Cxj.js → AdapterUpdateDialog-JOf2z4Vg.js} +1 -1
  7. package/adminWww/assets/{Adapters-V2JtEPZX.js → Adapters-C9fcSdWm.js} +1 -1
  8. package/adminWww/assets/{ConfigManager-BKcdyJnN.js → ConfigManager-BeeLlT6D.js} +1 -1
  9. package/adminWww/assets/{Enums-ChbfAWzp.js → Enums-FqnXWl8U.js} +1 -1
  10. package/adminWww/assets/{Fields-DzaVXEvg.js → Fields-DMgrt5Pi.js} +1 -1
  11. package/adminWww/assets/{Files-CRpIXj4X.js → Files-CIHtt12g.js} +1 -1
  12. package/adminWww/assets/{Hosts-rOgfd2wo.js → Hosts-fPLBzvTy.js} +1 -1
  13. package/adminWww/assets/{Instances-BxLhJ6Pb.js → Instances-4XaVQlrT.js} +1 -1
  14. package/adminWww/assets/{Intro-BOql527d.js → Intro-5TKriiLO.js} +1 -1
  15. package/adminWww/assets/{Logs-WUUDY7a4.js → Logs-33zcIds-.js} +1 -1
  16. package/adminWww/assets/{Objects-DYaZkCK7.js → Objects-CNQPVbNG.js} +1 -1
  17. package/adminWww/assets/{Overview-C6hiiPbm.js → Overview-BskXGOc8.js} +1 -1
  18. package/adminWww/assets/{State-AH43l7fG.js → State-C8SJ_Iqo.js} +1 -1
  19. package/adminWww/assets/{UsedResources-jhsRMH4X.js → UsedResources-CgqRa9ei.js} +1 -1
  20. package/adminWww/assets/{Users-D9wyLyJ1.js → Users-0JVYWR9u.js} +1 -1
  21. package/adminWww/assets/{bootstrap-gVLo1K_2.js → bootstrap-D16lu6rd.js} +3 -3
  22. package/adminWww/assets/{hostInit-Dt_M-NAC.js → hostInit-C8YZJuzi.js} +1 -1
  23. package/adminWww/assets/{icons-material-DuVW_EUA.js → icons-material-CiNJ_6Ur.js} +1 -1
  24. package/adminWww/assets/{index-B1cnPkSO.js → index-DA9Sphgh.js} +2 -2
  25. package/adminWww/assets/{installSVGRenderer-GvgHjubR.js → installSVGRenderer-DPdkRa_d.js} +1 -1
  26. package/adminWww/assets/{mf-entry-bootstrap-0-6b32b635.js → mf-entry-bootstrap-0-a7ab91de.js} +2 -2
  27. package/adminWww/index.html +23 -23
  28. package/adminWww/mf-manifest.json +1 -1
  29. package/adminWww/mf-stats.json +1 -1
  30. package/adminWww/remoteEntry-eos-9.0.19.js +12 -0
  31. package/adminWww/remoteEntry.js +1 -1
  32. package/build/lib/eosCookieNamespace.js +12 -2
  33. package/build/lib/eosCookieNamespace.js.map +1 -1
  34. package/build/lib/eosDeviceEmsPlan.js +432 -24
  35. package/build/lib/eosDeviceEmsPlan.js.map +1 -1
  36. package/build/lib/eosDeviceEmsService.js +106 -10
  37. package/build/lib/eosDeviceEmsService.js.map +1 -1
  38. package/build/lib/eosModuleHost.js +178 -53
  39. package/build/lib/eosModuleHost.js.map +1 -1
  40. package/build/lib/web.js +19 -3
  41. package/build/lib/web.js.map +1 -1
  42. package/docs/reports/unified-9.0.19/ALIAS_MESSWERTFRISCHE.md +31 -0
  43. package/docs/reports/unified-9.0.19/COMMISSIONING_PLAN_REVIEW.md +56 -0
  44. package/docs/reports/unified-9.0.19/EMS_ABSCHLUSSREVIEW.md +43 -0
  45. package/docs/reports/unified-9.0.19/EMS_KATEGORIEN_ABDECKUNG.md +66 -0
  46. package/docs/reports/unified-9.0.19/EMS_VERGLEICH_UND_KOPPLUNG.md +25 -0
  47. package/docs/reports/unified-9.0.19/EVCS_STATE_OBJECTS.md +47 -0
  48. package/docs/reports/unified-9.0.19/GERAETE_EMS_EINRICHTUNG.md +100 -0
  49. package/docs/reports/unified-9.0.19/GERAETE_STARTAUSFALL.md +37 -0
  50. package/docs/reports/unified-9.0.19/INSTALLER_LIFECYCLE_REVIEW.md +59 -0
  51. package/docs/reports/unified-9.0.19/LEGACY_REGRESSION_REVIEW.md +42 -0
  52. package/docs/reports/unified-9.0.19/MODBUS_AUTHORIZATION_READS.md +25 -0
  53. package/docs/reports/unified-9.0.19/PRUEFBERICHT.md +56 -0
  54. package/docs/reports/unified-9.0.19/RUNTIME_START_UEBERNAHME.md +33 -0
  55. package/docs/reports/unified-9.0.19/SMA_RECEIVER_LIFECYCLE.md +42 -0
  56. package/docs/reports/unified-9.0.19/STATIC_REVIEW_DE.md +11 -0
  57. package/docs/reports/unified-9.0.19/TARIFF_PRICE_VALUES_REVIEW.md +31 -0
  58. package/docs/reports/unified-9.0.19/TARIF_VIERTELSTUNDEN_RUNTIME.md +17 -0
  59. package/docs/reports/unified-9.0.19/UNABHAENGIGER_REVIEW.md +49 -0
  60. package/docs/reports/unified-9.0.19/raw/INDEX.json +751 -0
  61. package/docs/reports/unified-9.0.19/raw/audit-full.log +345 -0
  62. package/docs/reports/unified-9.0.19/raw/audit-full.result.json +14 -0
  63. package/docs/reports/unified-9.0.19/raw/audit-runtime.log +23 -0
  64. package/docs/reports/unified-9.0.19/raw/audit-runtime.result.json +15 -0
  65. package/docs/reports/unified-9.0.19/raw/backend-final.log +5 -0
  66. package/docs/reports/unified-9.0.19/raw/backend-final.result.json +14 -0
  67. package/docs/reports/unified-9.0.19/raw/devices-hosted-typecheck-node22.log +0 -0
  68. package/docs/reports/unified-9.0.19/raw/devices-hosted-typecheck-node22.result.json +15 -0
  69. package/docs/reports/unified-9.0.19/raw/devices-hosted-typecheck-node24.log +0 -0
  70. package/docs/reports/unified-9.0.19/raw/devices-hosted-typecheck-node24.result.json +15 -0
  71. package/docs/reports/unified-9.0.19/raw/devices-incident-build.log +5 -0
  72. package/docs/reports/unified-9.0.19/raw/devices-incident-host-final.log +70 -0
  73. package/docs/reports/unified-9.0.19/raw/devices-incident-lease-918-before.log +26 -0
  74. package/docs/reports/unified-9.0.19/raw/devices-incident-lease-after.log +9 -0
  75. package/docs/reports/unified-9.0.19/raw/devices-incident-metadata-after.log +11 -0
  76. package/docs/reports/unified-9.0.19/raw/devices-incident-metadata-before.log +28 -0
  77. package/docs/reports/unified-9.0.19/raw/devices-incident-web-pipeline.log +22 -0
  78. package/docs/reports/unified-9.0.19/raw/frontend-build.log +152 -0
  79. package/docs/reports/unified-9.0.19/raw/frontend-build.result.json +14 -0
  80. package/docs/reports/unified-9.0.19/raw/installer-build.log +26 -0
  81. package/docs/reports/unified-9.0.19/raw/installer-build.result.json +14 -0
  82. package/docs/reports/unified-9.0.19/raw/keygen-source.json +6 -0
  83. package/docs/reports/unified-9.0.19/raw/legacy-auto-pv.log +6 -0
  84. package/docs/reports/unified-9.0.19/raw/legacy-auto-pv.result.json +14 -0
  85. package/docs/reports/unified-9.0.19/raw/legacy-charging-grid-cap-clamp.log +6 -0
  86. package/docs/reports/unified-9.0.19/raw/legacy-charging-grid-cap-clamp.result.json +14 -0
  87. package/docs/reports/unified-9.0.19/raw/legacy-charging-grid-cap-safe.log +6 -0
  88. package/docs/reports/unified-9.0.19/raw/legacy-charging-grid-cap-safe.result.json +14 -0
  89. package/docs/reports/unified-9.0.19/raw/legacy-charging-mode-recovery.log +539 -0
  90. package/docs/reports/unified-9.0.19/raw/legacy-charging-mode-recovery.result.json +14 -0
  91. package/docs/reports/unified-9.0.19/raw/legacy-core-limits-phase1.log +6 -0
  92. package/docs/reports/unified-9.0.19/raw/legacy-core-limits-phase1.result.json +14 -0
  93. package/docs/reports/unified-9.0.19/raw/legacy-core-limits-phase2.log +6 -0
  94. package/docs/reports/unified-9.0.19/raw/legacy-core-limits-phase2.result.json +14 -0
  95. package/docs/reports/unified-9.0.19/raw/legacy-core-limits-tariff-final.log +6 -0
  96. package/docs/reports/unified-9.0.19/raw/legacy-core-limits-tariff-final.result.json +14 -0
  97. package/docs/reports/unified-9.0.19/raw/legacy-energy-wallet-final.log +6 -0
  98. package/docs/reports/unified-9.0.19/raw/legacy-energy-wallet-final.result.json +14 -0
  99. package/docs/reports/unified-9.0.19/raw/legacy-farm-dispatch-loader-current.log +2 -0
  100. package/docs/reports/unified-9.0.19/raw/legacy-farm-dispatch-loader-current.result.json +14 -0
  101. package/docs/reports/unified-9.0.19/raw/legacy-final-write-envelope.log +6 -0
  102. package/docs/reports/unified-9.0.19/raw/legacy-final-write-envelope.result.json +14 -0
  103. package/docs/reports/unified-9.0.19/raw/legacy-history-http.log +39 -0
  104. package/docs/reports/unified-9.0.19/raw/legacy-history-http.result.json +15 -0
  105. package/docs/reports/unified-9.0.19/raw/legacy-import-grid-budget.log +30 -0
  106. package/docs/reports/unified-9.0.19/raw/legacy-import-grid-budget.result.json +14 -0
  107. package/docs/reports/unified-9.0.19/raw/legacy-import-grid-contract-current.log +2 -0
  108. package/docs/reports/unified-9.0.19/raw/legacy-import-grid-contract-current.result.json +14 -0
  109. package/docs/reports/unified-9.0.19/raw/legacy-live-mode-loader-current.log +203 -0
  110. package/docs/reports/unified-9.0.19/raw/legacy-live-mode-loader-current.result.json +14 -0
  111. package/docs/reports/unified-9.0.19/raw/legacy-load-grid-sanity.log +6 -0
  112. package/docs/reports/unified-9.0.19/raw/legacy-load-grid-sanity.result.json +14 -0
  113. package/docs/reports/unified-9.0.19/raw/legacy-ocpp-stability.log +6 -0
  114. package/docs/reports/unified-9.0.19/raw/legacy-ocpp-stability.result.json +14 -0
  115. package/docs/reports/unified-9.0.19/raw/legacy-ocpp21-storage-safety.log +6 -0
  116. package/docs/reports/unified-9.0.19/raw/legacy-ocpp21-storage-safety.result.json +14 -0
  117. package/docs/reports/unified-9.0.19/raw/legacy-permanent-grid-protection.log +18 -0
  118. package/docs/reports/unified-9.0.19/raw/legacy-permanent-grid-protection.result.json +14 -0
  119. package/docs/reports/unified-9.0.19/raw/legacy-storage-dp-persistence.log +6 -0
  120. package/docs/reports/unified-9.0.19/raw/legacy-storage-dp-persistence.result.json +14 -0
  121. package/docs/reports/unified-9.0.19/raw/legacy-storage-farm-dispatch-recovery.log +16 -0
  122. package/docs/reports/unified-9.0.19/raw/legacy-storage-farm-dispatch-recovery.result.json +14 -0
  123. package/docs/reports/unified-9.0.19/raw/legacy-storage-functional-safety.log +6 -0
  124. package/docs/reports/unified-9.0.19/raw/legacy-storage-functional-safety.result.json +14 -0
  125. package/docs/reports/unified-9.0.19/raw/legacy-storage-topology-loader-current.log +2 -0
  126. package/docs/reports/unified-9.0.19/raw/legacy-storage-topology-loader-current.result.json +14 -0
  127. package/docs/reports/unified-9.0.19/raw/legacy-test-loader.cjs +47 -0
  128. package/docs/reports/unified-9.0.19/raw/lint-final.log +16 -0
  129. package/docs/reports/unified-9.0.19/raw/lint-final.result.json +14 -0
  130. package/docs/reports/unified-9.0.19/raw/modules-build.log +5 -0
  131. package/docs/reports/unified-9.0.19/raw/modules-build.result.json +14 -0
  132. package/docs/reports/unified-9.0.19/raw/node22-tests-final.log +10719 -0
  133. package/docs/reports/unified-9.0.19/raw/node22-tests-final.result.json +13 -0
  134. package/docs/reports/unified-9.0.19/raw/node22-typecheck-final.log +7 -0
  135. package/docs/reports/unified-9.0.19/raw/node22-typecheck-final.result.json +14 -0
  136. package/docs/reports/unified-9.0.19/raw/node22-version.log +1 -0
  137. package/docs/reports/unified-9.0.19/raw/node24-tests-final.log +1805 -0
  138. package/docs/reports/unified-9.0.19/raw/node24-tests-final.result.json +13 -0
  139. package/docs/reports/unified-9.0.19/raw/node24-typecheck-final.log +5 -0
  140. package/docs/reports/unified-9.0.19/raw/node24-typecheck-final.result.json +14 -0
  141. package/docs/reports/unified-9.0.19/raw/node24-version.log +1 -0
  142. package/docs/reports/unified-9.0.19/raw/sbom-runtime.log +7 -0
  143. package/docs/reports/unified-9.0.19/raw/sbom-runtime.result.json +14 -0
  144. package/docs/reports/unified-9.0.19/raw/sbom-vendor-check.log +1 -0
  145. package/docs/reports/unified-9.0.19/raw/sbom-vendor-check.result.json +14 -0
  146. package/docs/reports/unified-9.0.19/raw/tariff-price-chain-919.log +11 -0
  147. package/docs/reports/unified-9.0.19/raw/tariff-price-chain-919.result.json +14 -0
  148. package/docs/reports/unified-9.0.19/raw/tariff-price-chain-old-918.log +68 -0
  149. package/docs/reports/unified-9.0.19/raw/tariff-price-chain-old-918.result.json +14 -0
  150. package/docs/reports/unified-9.0.19/raw/ui-docs-check.log +6 -0
  151. package/docs/reports/unified-9.0.19/raw/ui-docs-check.result.json +14 -0
  152. package/docs/reports/unified-9.0.19/raw/ui-runtime-final.log +7 -0
  153. package/docs/reports/unified-9.0.19/raw/ui-runtime-final.result.json +14 -0
  154. package/docs/reports/unified-9.0.19/raw/ui-runtime-sync.log +6 -0
  155. package/docs/reports/unified-9.0.19/raw/ui-runtime-sync.result.json +14 -0
  156. package/docs/reports/unified-9.0.19/raw/ui-sbom-check.log +6 -0
  157. package/docs/reports/unified-9.0.19/raw/ui-sbom-check.result.json +14 -0
  158. package/docs/reports/unified-9.0.19/raw/ui-sbom-final.log +6 -0
  159. package/docs/reports/unified-9.0.19/raw/ui-sbom-final.result.json +14 -0
  160. package/docs/reports/unified-9.0.19/raw/ui-secret-final.log +6 -0
  161. package/docs/reports/unified-9.0.19/raw/ui-secret-final.result.json +14 -0
  162. package/docs/reports/unified-9.0.19/raw/ui-security-final.log +8 -0
  163. package/docs/reports/unified-9.0.19/raw/ui-security-final.result.json +14 -0
  164. package/io-package.json +8 -8
  165. package/modules/devices/admin/ems-assignment.d.ts +8 -2
  166. package/modules/devices/admin/ems-assignment.js +192 -30
  167. package/modules/devices/admin/host-bridge.js +36 -11
  168. package/modules/devices/admin/index.html +26 -5
  169. package/modules/devices/admin/index_m.js +87 -3
  170. package/modules/devices/admin/style.css +17 -4
  171. package/modules/devices/checks/emsAssignment.check.js +10 -6
  172. package/modules/devices/contracts.d.ts +1 -1
  173. package/modules/devices/index.js +54 -17
  174. package/modules/devices/lib/deviceAliasFreshness.js +65 -0
  175. package/modules/devices/lib/deviceRuntime.js +201 -127
  176. package/modules/devices/lib/drivers/modbus.js +18 -3
  177. package/modules/devices/lib/drivers/speedwire.js +42 -22
  178. package/modules/devices/test/deviceAliasFreshness.test.js +149 -0
  179. package/modules/devices/test/emsAssignmentUi.test.js +119 -11
  180. package/modules/devices/test/modbusAuthorizationReads.test.js +112 -0
  181. package/modules/devices/test/runtimeLiveness.test.js +1 -1
  182. package/modules/devices/test/speedwireLifecycle.test.js +118 -0
  183. package/modules/devices/tsconfig.alias-semantics.json +1 -1
  184. package/modules/devices/tsconfig.hosted.json +1 -1
  185. package/package.json +9 -7
  186. package/release-manifests/unified/build-environment.cdx.json +1483 -7370
  187. package/release-manifests/unified/files.json +295 -133
  188. package/release-manifests/unified/frontend.cdx.json +2688 -5952
  189. package/release-manifests/unified/installer.cdx.json +2053 -821
  190. package/release-manifests/unified/obsolete-admin-assets.json +88 -6
  191. package/release-manifests/unified/runtime.cdx.json +40 -3283
  192. package/release-manifests/unified/validation.json +15 -15
  193. package/tools/eos-release-manifest.cjs +3 -3
  194. package/ui/docs/security/eslint-reviewed-findings.json +20 -20
  195. package/ui/ems/engine.js +54 -7
  196. package/ui/ems/module-manager.js +44 -21
  197. package/ui/ems/modules/core-limits.js +5 -3
  198. package/ui/ems/modules/energy-wallet.js +31 -32
  199. package/ui/ems/modules/storage-control.js +5 -4
  200. package/ui/ems/modules/tarif-vis.js +36 -24
  201. package/ui/ems/modules/tariff-provider.js +28 -6
  202. package/ui/ems/services/tariff-provider-registry.js +11 -8
  203. package/ui/io-package.json +1 -1
  204. package/ui/lib/customer-tariff.js +5 -1
  205. package/ui/lib/installer-lifecycle.js +134 -1
  206. package/ui/lib/storage-farm-overview.js +115 -0
  207. package/ui/lib/tariff-price.js +115 -0
  208. package/ui/main.js +202 -51
  209. package/ui/package.json +8 -2
  210. package/ui/www/app.js +47 -134
  211. package/ui/www/ems-apps.html +2 -0
  212. package/ui/www/ems-apps.js +14 -2
  213. package/ui/www/index.html +2 -0
  214. package/ui/www/licenses/smarthome-markdown-components.json +156 -156
  215. package/ui/www/manifest.webmanifest +2 -2
  216. package/ui/www/power-measurements.js +62 -0
  217. package/ui/www/settings.html +2 -0
  218. package/ui/www/storagefarm-summary.css +17 -0
  219. package/ui/www/storagefarm-summary.js +136 -0
  220. package/ui/www/storagefarm.html +16 -1
  221. package/ui/www/storagefarm.js +10 -22
  222. package/ui/www/tariff-display.js +161 -0
  223. package/adminWww/remoteEntry-eos-9.0.18.js +0 -12
@@ -1,2 +1,2 @@
1
- import{$r as e,Ao as t,As as n,Bo as r,Ci as i,Do as a,Es as o,Gi as s,Ha as c,Hs as l,Ii as u,Jo as d,Ka as f,Ki as p,Ko as m,Lr as h,Mo as g,Po as _,Qs as ee,Ro as v,To as y,Tr as b,Ts as x,Ui as S,Ur as C,Us as w,Vi as T,Vo as te,Vs as E,Wa as D,Wi as O,Wn as ne,Wo as k,Wr as A,Xn as re,Xo as ie,Yi as ae,Zo as oe,_s as se,er as ce,gi as le,go as j,gs as ue,ic as de,jo as M,js as fe,ks as N,lo as P,mo as F,ms as I,oi as pe,os as me,pc as L,po as R,ps as he,qo as z,qs as ge,r as B,sc as _e,tc as ve,ua as ye,uc as be,xo as xe,ya as Se,yo as V}from"./loadShare-eager-dmdYQhAl.js";import{t as Ce}from"./Apps-BZHXIYjq.js";import{t as we}from"./Computer-BBU3Cm9-.js";import{a as Te,i as Ee,n as De,r as Oe,t as ke}from"./Timer-vc3BIs4y.js";import{t as Ae}from"./Extension-DIV5Bi1u.js";import{t as je}from"./InfoOutlined-Bggo2-pX.js";import{t as Me}from"./Schedule-vdojlve9.js";import{t as Ne}from"./Storage-B44xXFFu.js";import{c as Pe,f as Fe,l as Ie,p as Le,s as Re,t as H}from"./AdminUtils-Dc1eHsx5.js";import{st as ze,xt as Be}from"./bootstrap-gVLo1K_2.js";import{i as Ve,l as He,n as Ue,r as We,t as Ge}from"./classPrivateFieldGet2-DZ8s9-Td.js";var Ke=168;function qe(e,t){if(e)try{return N(e,t)}catch{return}}var U={root:{display:`flex`,maxWidth:460},link:e=>({display:`flex`,width:`100%`,color:`inherit`,borderRadius:`12px`,"&:focus-visible":{outline:`2px solid ${e.palette.primary.main}`,outlineOffset:`2px`}}),card:e=>({display:`flex`,flexDirection:`column`,gap:`12px`,width:`100%`,p:`16px`,position:`relative`,overflow:`hidden`,backgroundColor:e.palette.mode===`dark`?fe(e.palette.background.paper,.08):n(e.palette.background.paper,.03),border:`1px solid`,borderColor:e.palette.divider,backgroundImage:`none`,transition:`border-color 0.15s, background-color 0.15s`,"@media (prefers-reduced-motion: reduce)":{transition:`none`}}),cardClickable:{cursor:`pointer`,"&:hover .intro-card-launch":{opacity:1}},cardOff:e=>({opacity:.45,borderStyle:`dashed`,borderColor:e.palette.text.disabled}),head:{display:`flex`,alignItems:`flex-start`,gap:`14px`},icon:{width:56,height:56,flex:`0 0 auto`,borderRadius:`14px`,display:`flex`,alignItems:`center`,justifyContent:`center`,overflow:`hidden`},iconOffline:{filter:`grayscale(1)`,opacity:.5},img:{width:40,height:40,objectFit:`contain`},headText:{minWidth:0,flex:1,display:`flex`,flexDirection:`column`,gap:`2px`,pr:`20px`},title:{fontSize:`0.98rem`,fontWeight:600,lineHeight:1.25,display:`-webkit-box`,WebkitBoxOrient:`vertical`,WebkitLineClamp:2,overflow:`hidden`,wordBreak:`break-word`},meta:e=>({fontSize:`0.78rem`,lineHeight:1.35,color:e.palette.text.secondary,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`}),warning:e=>({fontSize:17,ml:`4px`,verticalAlign:`-3px`,color:e.palette.warning.main}),corner:{position:`absolute`,top:16,right:16,zIndex:2,display:`flex`,alignItems:`center`,gap:`8px`},launch:e=>({fontSize:17,opacity:0,color:e.palette.text.secondary,transition:`opacity 0.15s`,"@media (prefers-reduced-motion: reduce)":{transition:`none`}}),lamp:{width:10,height:10,borderRadius:`50%`,flex:`0 0 auto`},lampOnline:e=>({backgroundColor:e.palette.success.main,boxShadow:`0 0 0 3px ${N(e.palette.success.main,.2)}`}),lampOffline:e=>({backgroundColor:e.palette.error.main,boxShadow:`0 0 0 3px ${N(e.palette.error.main,.2)}`}),lampUnknown:e=>({backgroundColor:e.palette.text.disabled}),content:e=>({flex:1,minHeight:0,overflow:`hidden`,fontSize:`0.82rem`,lineHeight:1.5,color:e.palette.text.secondary}),contentClamped:{display:`-webkit-box`,WebkitBoxOrient:`vertical`,WebkitLineClamp:3},infoButton:{alignSelf:`flex-start`,ml:`-6px`,fontSize:`0.78rem`,minHeight:0,py:`2px`},editBar:e=>({position:`absolute`,top:8,right:8,zIndex:3,display:`flex`,gap:`2px`,borderRadius:`10px`,p:`2px`,backgroundColor:N(e.palette.background.paper,.85),backdropFilter:`blur(3px)`}),tooltip:{pointerEvents:`none`},infoTitle:{display:`flex`,alignItems:`center`,gap:`8px`,pr:`12px`},infoTitleText:{flex:1,minWidth:0,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},infoBody:{fontSize:`0.9rem`,lineHeight:1.5}},W=class e extends ve{constructor(e){super(e),this.state={infoOpen:!1}}static getDerivedStateFromProps(e){return e.edit?{infoOpen:!1}:null}renderContent(){return this.props.children}openDialog(){}renderDialogs(){return null}hoverTint(e){let t=qe(e,this.props.theme.palette.mode===`dark`?.12:.07);return t?`linear-gradient(${t}, ${t})`:void 0}cardMinHeight(){return Ke}static swallow(e,t){e.preventDefault(),e.stopPropagation(),t==null||t()}renderEditBar(){return this.props.edit?w(j,{sx:U.editBar,children:[this.props.toggleActivation?l(R,{title:this.props.t(`show/hide item`),slotProps:{popper:{sx:U.tooltip}},children:l(m,{size:`small`,color:this.props.enabled?`primary`:`default`,onClick:t=>e.swallow(t,this.props.toggleActivation),children:l(D,{fontSize:`small`})})}):null,this.props.onEdit?l(R,{title:this.props.t(`Edit`),slotProps:{popper:{sx:U.tooltip}},children:l(m,{size:`small`,onClick:t=>e.swallow(t,this.props.onEdit),children:l(Te,{fontSize:`small`})})}):null,this.props.onRemove?l(R,{title:this.props.t(`Delete`),slotProps:{popper:{sx:U.tooltip}},children:l(m,{size:`small`,color:`error`,onClick:t=>e.swallow(t,this.props.onRemove),children:l(c,{fontSize:`small`})})}):null]}):null}renderInfoDialog(){var e,n;if(!this.props.showInfo||!this.state.infoOpen)return null;let r=(e=(n=this.props).getHostDescriptionAll)==null?void 0:e.call(n),i=()=>this.setState({infoOpen:!1});return w(t,{open:!0,onClose:i,maxWidth:`sm`,fullWidth:!0,onClick:e=>e.stopPropagation(),children:[w(_,{sx:U.infoTitle,children:[l(je,{color:`primary`}),w(j,{sx:U.infoTitleText,children:[this.props.t(`Info`),`: `,this.props.title]}),l(m,{size:`small`,onClick:i,children:l(f,{})})]}),l(g,{dividers:!0,sx:U.infoBody,children:r==null?void 0:r.el}),w(M,{children:[l(V,{color:`grey`,variant:`outlined`,startIcon:l(ce,{}),disabled:!(r!=null&&r.text),onClick:()=>{var e,t;A.copyToClipboard((r==null?void 0:r.text)||``),(e=(t=this.props).openSnackBarFunc)==null||e.call(t)},children:this.props.t(`Copy to clipboard`)}),l(V,{variant:`contained`,color:`primary`,autoFocus:!0,startIcon:l(f,{}),onClick:i,children:this.props.t(`Close`)})]})]})}render(){var t,n,r;let{theme:i}=this.props,a=this.props.color||i.palette.primary.main,o=!this.props.edit&&!!((t=this.props.action)!=null&&t.link)&&!this.props.unreachable,s=H.getText((n=this.props.action)==null?void 0:n.text,this.props.lang),c=``;if((r=this.props.action)!=null&&r.link)try{c=new URL(this.props.action.link,window.location.href).href}catch{c=this.props.action.link}return l(k,{size:{xs:12,sm:6,md:4,lg:3,xl:2},sx:A.getStyle(i,U.root,this.props.style),children:l(oe,{href:o?this.props.action.link:void 0,underline:`none`,target:`_blank`,rel:`noopener noreferrer`,sx:A.getStyle(i,U.link),children:w(xe,{sx:A.getStyle(i,U.card,{minHeight:this.cardMinHeight()},o&&U.cardClickable,o&&{"&:hover":{borderColor:qe(a,.7)||a,backgroundImage:this.hoverTint(a)}},this.props.edit&&!this.props.enabled&&U.cardOff,this.props.unreachable&&U.cardOff),onClick:e=>{e.stopPropagation(),this.openDialog()},children:[w(j,{sx:U.head,children:[l(j,{sx:A.getStyle(i,U.icon,{backgroundColor:this.props.color||qe(i.palette.text.primary,.07)},(this.props.offline||this.props.unreachable)&&U.iconOffline),children:l(j,{component:`img`,src:this.props.image,alt:``,sx:U.img})}),w(j,{sx:U.headText,children:[w(F,{component:`div`,sx:U.title,children:[this.props.title,this.props.warning||this.props.unreachable?l(R,{title:this.props.warning||this.props.t(`Only reachable in the local network`),slotProps:{popper:{sx:U.tooltip}},children:l(pe,{sx:U.warning})}):null]}),s?l(F,{component:`div`,sx:U.meta,title:c||s,children:s}):null]})]}),o||this.props.status?w(j,{sx:U.corner,children:[o?l(ne,{className:`intro-card-launch`,sx:U.launch}):null,this.props.status?l(R,{title:this.props.t(this.props.status===`unknown`?`unknown`:this.props.status),slotProps:{popper:{sx:U.tooltip}},children:l(j,{sx:A.getStyle(i,U.lamp,this.props.status===`online`&&U.lampOnline,this.props.status===`offline`&&U.lampOffline,this.props.status===`unknown`&&U.lampUnknown)})}):null]}):null,l(j,{sx:A.getStyle(i,U.content,typeof this.props.children==`string`&&U.contentClamped),children:this.renderContent()}),this.props.showInfo&&!this.props.offline?l(V,{sx:U.infoButton,size:`small`,color:`inherit`,startIcon:l(je,{fontSize:`small`}),disabled:this.props.disabled,onClick:t=>e.swallow(t,()=>this.setState({infoOpen:!0})),children:this.props.t(`Info`)}):null,this.renderInfoDialog(),this.renderEditBar(),this.renderDialogs()]})})})}};o();var G={rootGrid:{flexGrow:1},closeButton:e=>({position:`absolute`,right:8,top:8,color:e.palette.grey[500]}),paper:{},typography:{paddingRight:30},img:{width:`100%`,height:`100%`,objectFit:`contain`}},Je=class extends ve{constructor(e){super(e),x(this,`cameraUpdateTimer`,void 0),x(this,`cameraRef`,void 0),this.cameraUpdateTimer=null,this.cameraRef=ee()}componentDidMount(){this.props.camera&&this.props.camera!==`text`&&(this.cameraUpdateTimer=setInterval(()=>this.updateCamera(),Math.max(parseInt(this.props.interval||``,10),500)),this.updateCamera())}componentWillUnmount(){this.cameraUpdateTimer&&=(clearInterval(this.cameraUpdateTimer),null)}updateCamera(){if(this.cameraRef.current){if(this.props.camera===`custom`){let e=this.props.cameraUrl;this.props.addTs&&(e.includes(`?`)?e+=`&ts=${Date.now()}`:e+=`?ts=${Date.now()}`),this.cameraRef.current.src=e}else{let e=this.props.camera.split(`.`),t=e.shift(),n=e.shift();this.props.socket.sendTo(`${t}.${n}`,`image`,{name:e.pop(),width:this.cameraRef.current.width}).then(e=>{e&&e.data&&this.cameraRef.current&&(this.cameraRef.current.src=`data:image/jpeg;base64,${e.data}`)})}}}render(){return w(t,{onClose:()=>this.props.onClose(),open:!0,maxWidth:`xl`,fullWidth:!0,fullScreen:!0,sx:{"& .MuiDialog-paper":G.paper},children:[l(_,{children:w(F,{component:`h2`,variant:`h6`,sx:{"&.MuiTypography-root":G.typography},children:[this.props.name,l(m,{size:`large`,sx:G.closeButton,onClick:()=>this.props.onClose(),children:l(f,{})})]})}),l(g,{dividers:!0,children:l(`img`,{style:G.img,src:``,alt:`camera`,ref:this.cameraRef})}),l(M,{children:l(V,{variant:`contained`,autoFocus:!0,onClick:e=>{e.stopPropagation(),this.props.onClose()},color:`primary`,startIcon:l(f,{}),children:this.props.t(`Close`)})})]})}};o();var K={cameraImg:{width:`100%`,height:`100%`,objectFit:`contain`,borderRadius:8},imgContainer:{height:`100%`,width:`100%`},hidden:{display:`none`},imgSkeleton:{transform:`initial`}},Ye=class extends W{constructor(e){super(e),x(this,`cameraRef`,void 0),x(this,`cameraUpdateTimer`,void 0),x(this,`interval`,void 0),Object.assign(this.state,{error:!1,dialog:!1,loaded:!1}),this.cameraRef=ee(),this.cameraUpdateTimer=null,this.interval=e.interval||0}updateCamera(){if(this.cameraRef.current){if(this.props.camera===`custom`){let e=this.props.cameraUrl||``;this.props.addTs&&(e.includes(`?`)?e+=`&ts=${Date.now()}`:e+=`?ts=${Date.now()}`),this.cameraRef.current.src=e}else{let e=(this.props.camera||``).split(`.`),t=e.shift(),n=e.shift();this.props.socket.sendTo(`${t}.${n}`,`image`,{name:e.pop(),width:this.cameraRef.current.width}).then(e=>{e!=null&&e.data&&this.cameraRef.current&&(this.cameraRef.current.src=`data:image/jpeg;base64,${e.data}`)}).catch(e=>window.alert(`Cannot send to instance: ${e}`))}}}componentDidMount(){this.props.camera&&this.props.camera!==`text`&&(this.cameraUpdateTimer=setInterval(()=>this.updateCamera(),Math.max(parseInt(this.props.interval,10),500)),this.updateCamera())}componentWillUnmount(){this.cameraUpdateTimer&&=(clearInterval(this.cameraUpdateTimer),null)}cardMinHeight(){return 260}renderDialogs(){return this.state.dialog?l(Je,{socket:this.props.socket,camera:this.props.camera||``,name:this.props.title,t:this.props.t,onClose:()=>{this.props.camera&&this.props.camera!==`text`&&(this.cameraUpdateTimer&&clearInterval(this.cameraUpdateTimer),this.cameraUpdateTimer=setInterval(()=>this.updateCamera(),Math.max(parseInt(this.props.interval,10),500)),this.updateCamera()),this.setState({dialog:!1})},cameraUrl:this.props.cameraUrl||``}):null}handleImageLoad(){this.state.loaded||this.setState({loaded:!0,error:!1})}handleImageError(){this.state.error||this.setState({loaded:!1,error:!0})}renderContent(){var e;if(this.props.camera===`custom`){let e=this.props.cameraUrl||``;return this.props.addTs&&(e.includes(`?`)?e+=`&ts=${Date.now()}`:e+=`?ts=${Date.now()}`),w(k,{container:!0,style:K.imgContainer,sx:{alignItems:`center`,justifyContent:`center`},children:[l(`img`,{ref:this.cameraRef,src:e,alt:`Camera`,style:this.state.loaded&&!this.state.error?K.cameraImg:K.hidden,onLoad:()=>this.handleImageLoad(),onError:()=>this.handleImageError()}),!this.state.loaded&&!this.state.error&&l(I,{height:`100%`,width:`100%`,animation:`wave`,style:K.imgSkeleton}),this.state.error&&l(le,{fontSize:`large`})]})}return(e=this.props.camera)!=null&&e.startsWith(`cameras.`)?l(`img`,{ref:this.cameraRef,src:``,alt:`camera`,style:K.cameraImg}):null}render(){return this.props.camera&&this.props.camera!==`text`?this.interval!==this.props.interval&&(this.interval=this.props.interval||0,this.cameraUpdateTimer&&clearInterval(this.cameraUpdateTimer),this.cameraUpdateTimer=setInterval(()=>this.updateCamera(),Math.max(parseInt(this.props.interval,10),500))):this.cameraUpdateTimer&&=(clearInterval(this.cameraUpdateTimer),null),super.render()}};o();var q={formControl:{marginTop:32},rootGrid:{flexGrow:1},closeButton:e=>({position:`absolute`,right:8,top:8,color:e.palette.grey[500]}),paper:{},typography:{paddingRight:30},editItem:{marginTop:8},editItemSlider:{marginTop:24},labelSlider:{marginTop:16,fontSize:`1rem`},editColor:{width:`100%`},dropZone:{width:`100%`,height:100,position:`relative`},dropZoneEmpty:{},image:{height:`100%`,width:`auto`,objectFir:`contain`},uploadDiv:{position:`relative`,width:`100%`,height:100,opacity:.9},uploadDivDragging:{opacity:1},uploadCenterDiv:{margin:5,border:`3px dashed grey`,borderRadius:5,width:`calc(100% - 10px)`,height:`calc(100% - 10px)`,position:`relative`},uploadCenterIcon:{paddingTop:10,width:48,height:48},uploadCenterText:{fontSize:16},uploadCenterTextAndIcon:{textAlign:`center`,position:`absolute`,top:0,bottom:0,left:0,right:0}},Xe=class e extends ve{constructor(e){super(e),x(this,`originalData`,void 0),this.state={image:``,name:e.t(`New link`),link:`http://`,linkName:``,color:``,desc:``,addTs:!0,interval:5e3,camera:`text`,cameraList:[],...e.link},this.originalData=JSON.stringify(this.getData())}getData(){return{link:this.state.link,name:this.state.name,desc:this.state.desc,linkName:this.state.linkName,color:this.state.color,image:this.state.image,addTs:this.state.addTs,camera:this.state.camera,interval:this.state.interval}}componentDidMount(){this.getCamerasInstances()}getCamerasInstances(){this.props.socket.getAdapterInstances(`cameras`,!0).then(e=>{let t=[],n=[];e.forEach(e=>{let r=e._id.replace(`system.adapter.`,``);e.common&&e.common.enabled&&n.push(this.props.socket.getState(`${e._id}.alive`).then(e=>e&&e.val&&this.props.socket.sendTo(r,`list`,null)).then(e=>e&&e.list&&e.list.forEach(e=>t.push({id:e.id,name:`${e.desc} [${r}/${e.name}]`}))))}),Promise.all(n).then(()=>this.setState({cameraList:t}))})}static getLinkNameFromLink(e){let t=e.trim().match(/^https?:\/\/([^/:]+)(:\d+)?/);return t?t[1]+(t[2]||``):``}render(){return w(t,{onClose:()=>this.props.onClose(),open:!0,maxWidth:`md`,fullWidth:!0,sx:{"& .MuiDialog-paper":q.paper},children:[l(_,{children:w(F,{component:`h2`,variant:`h6`,sx:{"&.MuiTypography-root":q.typography},children:[this.props.isNew?this.props.t(`Add new link: `):this.props.t(`Edit link`),l(m,{size:`large`,sx:q.closeButton,onClick:()=>this.props.onClose(),children:l(f,{})})]})}),l(g,{dividers:!0,children:w(k,{style:q.rootGrid,container:!0,direction:`row`,children:[l(k,{size:{xs:12,sm:6,md:8,lg:9},children:w(k,{container:!0,sx:{flexDirection:`column`},children:[w(r,{variant:`standard`,style:q.formControl,children:[l(d,{id:`select-helper-label`,children:this.props.t(`Link type`)}),w(he,{variant:`standard`,labelId:`select-helper-label`,value:this.state.camera,onChange:e=>this.setState({camera:e.target.value}),children:[l(me,{value:`text`,children:l(`em`,{children:this.props.t(`Description`)})},`desc`),this.state.cameraList.map(e=>l(me,{value:e.id,children:e.name},e.id)),l(me,{value:`custom`,children:this.props.t(`Custom camera URL`)},`custom`)]})]}),l(P,{variant:`standard`,label:this.props.t(`URL`),value:this.state.link,style:q.editItem,onChange:t=>{let n=e.getLinkNameFromLink(this.state.link);n&&(!this.state.linkName||n===this.state.linkName)?this.setState({link:t.target.value,linkName:e.getLinkNameFromLink(t.target.value)}):this.setState({link:t.target.value})},slotProps:{input:{endAdornment:this.state.link?l(z,{position:`end`,children:l(m,{tabIndex:-1,size:`small`,onClick:()=>this.setState({link:``}),children:l(f,{})})}):null}}}),l(P,{variant:`standard`,style:q.editItem,label:this.props.t(`Name`),value:this.state.name||``,onChange:e=>this.setState({name:e.target.value}),slotProps:{input:{endAdornment:this.state.name?l(z,{position:`end`,children:l(m,{tabIndex:-1,size:`small`,onClick:()=>this.setState({name:``}),children:l(f,{})})}):null}}}),this.state.link?l(P,{variant:`standard`,style:q.editItem,label:this.props.t(`Link name`),value:this.state.linkName||``,onChange:e=>this.setState({linkName:e.target.value}),slotProps:{input:{endAdornment:this.state.linkName?l(z,{position:`end`,children:l(m,{tabIndex:-1,size:`small`,onClick:()=>this.setState({linkName:``}),children:l(f,{})})}):null}}}):null,this.state.camera===`custom`||this.state.camera===`text`?l(P,{variant:`standard`,style:q.editItem,label:this.state.camera===`custom`?this.props.t(`Camera URL`):this.props.t(`Description`),value:this.state.desc||``,onChange:e=>this.setState({desc:e.target.value}),slotProps:{input:{endAdornment:this.state.desc?l(z,{position:`end`,children:l(m,{tabIndex:-1,size:`small`,onClick:()=>this.setState({desc:``}),children:l(f,{})})}):null}}}):null,this.state.camera===`custom`?l(te,{style:q.editItem,control:l(y,{checked:this.state.addTs,onChange:e=>this.setState({addTs:e.target.checked})}),label:this.props.t(`Add timestamp to URL`)}):null,this.state.camera===`text`?null:l(F,{style:q.labelSlider,gutterBottom:!0,children:`Polling interval in ms`}),this.state.camera===`text`?null:l(ue,{style:q.editItemSlider,value:this.state.interval,getAriaValueText:()=>`${this.state.interval}ms`,onChange:(e,t)=>this.setState({interval:t}),step:100,min:500,max:6e4,valueLabelDisplay:`on`}),l(`div`,{style:{...q.editItem,width:50},children:l(P,{variant:`standard`,fullWidth:!0,label:this.props.t(`Color`),style:q.editColor,type:`color`,value:this.state.color,onChange:e=>this.setState({color:e.target.value})})}),l(C,{disabled:!1,crop:!0,maxSize:262144,icon:this.state.image,removeIconFunc:()=>this.setState({image:``}),onChange:e=>this.setState({image:e})})]})}),l(k,{size:{xs:12,sm:6,md:4,lg:3},children:this.state.camera===`text`?l(W,{image:this.state.image,title:this.state.name,action:{link:this.state.link,text:this.state.linkName},t:this.props.t,lang:this.props.lang,style:{width:`100% !important`,maxWidth:`100% !important`,marginLeft:`8px`},color:this.state.color,enabled:!0,theme:this.props.theme,children:this.state.desc}):l(Ye,{interval:this.state.interval,camera:this.state.camera,addTs:this.state.addTs,style:{width:`100% !important`,maxWidth:`100% !important`,marginLeft:`8px`},image:this.state.image,title:this.state.name,socket:this.props.socket,action:{link:this.state.link,text:this.state.linkName},t:this.props.t,lang:this.props.lang,color:this.state.color,enabled:!0,cameraUrl:this.state.desc,theme:this.props.theme})})]})}),w(M,{children:[l(V,{variant:`contained`,autoFocus:!0,onClick:()=>this.props.onClose(this.getData()),disabled:!this.props.isNew&&JSON.stringify(this.getData())===this.originalData,color:`primary`,startIcon:this.props.isNew?l(i,{}):l(D,{}),children:this.props.isNew?this.props.t(`Add`):this.props.t(`Save`)}),l(V,{variant:`contained`,onClick:()=>this.props.onClose(),color:`grey`,startIcon:l(f,{}),children:this.props.t(`Close`)})]})]})}},Ze=class extends ge.Component{constructor(e){super(e),this.state={inProgress:!1,success:!1,error:``,finished:!1}}render(){return w(t,{open:!0,maxWidth:`lg`,fullWidth:!0,children:[l(_,{children:b.t(`Node.js upgrade`)}),w(g,{style:{height:100,padding:`0 20px`,overflow:`hidden`},children:[this.state.finished?null:l(F,{children:b.t(`Performing this update will restart the js-controller afterwards!`)}),this.state.inProgress?l(j,{sx:{display:`flex`,justifyContent:`center`},children:l(a,{})}):null,this.state.success?l(F,{children:b.t(`Node.js update successful, restarting controller now!`)}):null,this.state.error?l(F,{sx:{color:`red`},children:b.t(`Node.js update failed: %s`,this.state.error)}):null]}),w(M,{children:[l(V,{disabled:this.state.inProgress||this.state.finished,color:`primary`,variant:`contained`,startIcon:l(ye,{}),onClick:()=>this.updateNodeJsVersion(),children:b.t(`Upgrade`)}),l(V,{disabled:this.state.inProgress,variant:`contained`,onClick:()=>{this.props.onClose()},color:`primary`,startIcon:l(f,{}),children:b.t(`Close`)})]})]})}async updateNodeJsVersion(){this.setState({inProgress:!0});let e=await this.props.socket.upgradeOsPackages(this.props.hostId,[{name:`nodejs`}],!0);this.setState({inProgress:!1,success:e.success,error:e.error||``,finished:!0})}},Qe={ok:`#01bc69`,info:`#48b9ff`,warning:`#ffbd59`,error:`#ff5f72`},$e={ok:`Normal`,info:`Information`,warning:`Begrenzt`,error:`Störung`};function J(e,t=0){let n=Number(e);return Number.isFinite(n)?n:t}function Y(e,t=``){return(typeof e==`string`?e:typeof e==`number`||typeof e==`boolean`?String(e):t).replace(/\s+/g,` `).trim()||t}function et(e,t){if(e&&typeof e==`object`)return e;try{return JSON.parse(typeof e==`string`?e:``)}catch{return t}}function X(e,t){var n;return(n=e[t])==null?void 0:n.val}function Z(e){let t=J(e,0),n=t<0?`−`:``,r=Math.abs(t);return r>=1e3?`${n}${(r/1e3).toLocaleString(`de-DE`,{minimumFractionDigits:1,maximumFractionDigits:2})} kW`:`${n}${Math.round(r).toLocaleString(`de-DE`)} W`}function tt(e){let t=J(e,0);if(!t)return`noch kein Regeltick`;let n=Math.max(0,Math.round((Date.now()-t)/1e3));return n<2?`gerade eben`:n<60?`vor ${n} s`:`vor ${Math.round(n/60)} min`}function nt(e){let t=J(e,0);if(!t)return`—`;try{return new Date(t).toLocaleTimeString(`de-DE`,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}catch{return`—`}}function Q(e){let t=Y(e).toLowerCase();return t===`error`?`error`:t===`warning`||t===`warn`?`warning`:t===`ok`?`ok`:`info`}function rt(e,t){let n=new Set;for(let t of Object.keys(e||{})){let e=t.match(/^(eos-admin\.\d+)\.info\.adminOverview\./);e!=null&&e[1]&&n.add(e[1])}let r=[];for(let a of n){var i;let n=et(X(e,`${a}.info.adminOverview.summaryJson`),{}),o=et(X(e,`${a}.info.adminOverview.eventsJson`),[]),s=Math.max(J(n.updatedAt,0),J(n.generatedAt,0),J(X(e,`${a}.info.adminOverview.updatedAt`),0),J((i=e[`${a}.info.adminOverview.summaryJson`])==null?void 0:i.ts,0)),c=X(t,`system.adapter.${a}.alive`),l=c==null?null:c===!0||c===1||[`true`,`1`,`online`,`active`].includes(Y(c).toLowerCase());r.push({instance:a,alive:l,summary:{...n,status:Q(n.status||X(e,`${a}.info.adminOverview.status`)),headline:Y(n.headline||X(e,`${a}.info.adminOverview.headline`),`EMS-Diagnose wird aufgebaut`),reason:Y(n.reason||X(e,`${a}.info.adminOverview.reason`),``),binding:Y(n.binding||X(e,`${a}.info.adminOverview.binding`),`none`)},events:Array.isArray(o)?o:[],updatedAt:s})}return r.sort((e,t)=>{let n=e=>e===!0?2:+(e===null);return n(t.alive)-n(e.alive)||t.updatedAt-e.updatedAt||e.instance.localeCompare(t.instance)})}function it(e){let t=[],n=e.charging||{};n.available&&t.push({subsystem:`charging`,severity:J(n.faultCount,0)>0?`error`:J(n.waitingCount,0)>0?`info`:`ok`,title:`${J(n.activeCount,0)} lädt · ${J(n.waitingCount,0)} wartet · ${J(n.faultCount,0)} gestört`,reason:Y(n.limiterText||n.status,`Lademanagement aktiv`),details:`Ist ${Z(n.actualW)} · Soll ${Z(n.targetW)}`});let r=e.storage||{};return r.available&&t.push({subsystem:`storage`,severity:r.writeOk===!1?`error`:`ok`,title:`Speicher ${Y(r.topology,`aktiv`)}${r.socPct==null?``:` · SoC ${Math.round(J(r.socPct,0))} %`}`,reason:Y(r.reason,`Speicherregelung aktiv`),details:`Ist ${Z(r.actualW)} · Soll ${Z(r.targetW)}`}),t}function at({socket:e}){let[t,n]=L(null),[r,i]=L(!0),[a,o]=L(``),[s,c]=L(()=>Date.now()),u=de(async()=>{if(document.visibilityState===`visible`)try{let t=await e.getCurrentInstance();if(!/^eos-admin\.\d+$/.test(t))throw Error(`EOS-Instanz konnte nicht eindeutig ermittelt werden`);let[r,i]=await Promise.all([e.getForeignStates(`${t}.info.adminOverview.*`),e.getForeignStates(`system.adapter.${t}.alive`)]),a=rt(r||{},i||{});n(a[0]||null),o(``)}catch(e){o(Y(e==null?void 0:e.message,`EMS-Diagnose konnte nicht gelesen werden`))}finally{i(!1),c(Date.now())}},[e]);_e(()=>{u();let e=()=>{document.visibilityState===`visible`&&u()};document.addEventListener(`visibilitychange`,e);let t=window.setInterval(()=>void u(),5e3);return()=>{document.removeEventListener(`visibilitychange`,e),window.clearInterval(t)}},[u]);let d=String(window.NEXOWATT_EOS_ACCESS_ROLE||`unknown`).toLowerCase(),f=d===`admin`||d===`service`||d===`installer`||d===`installateur`,p=(t==null?void 0:t.summary)||{},m=t!=null&&t.updatedAt?Math.max(0,s-t.updatedAt):1/0,h=!!(t&&(t.alive===!1||m>2e4)),g=Q(p.status),_=h?`error`:g,ee=Qe[_],v=p.budget||{},y=p.charging||{},b=p.storage||{},x=p.ems||{},S=p.para14a||{},C=p.tariff||{},T=p.forecast||{},te=p.peakShaving||{},E=Math.max(0,J(v.totalW,0)),D=Math.max(0,J(v.remainingW,0)),O=E>0?Math.max(0,Math.min(100,D/E*100)):0,ne=be(()=>(Array.isArray(p.currentDecisions)?p.currentDecisions:it(p)).slice(0,f?5:2),[p,f]),k=f?((t==null?void 0:t.events)||[]).slice(0,6):[],A=[];return Y(p.binding,`none`)!==`none`&&A.push({label:`Bindend: ${Y(v.bindingText||p.binding)}`,warning:!0}),S.communicationFallbackActive?A.push({label:`§14a-Fallback ${Z(S.fallbackCapW)}`,warning:!0}):S.binding&&A.push({label:`§14a begrenzt`,warning:!0}),te.active&&A.push({label:`Peak-Shaving: ${Y(te.status,`aktiv`)}`,warning:!0}),C.available&&A.push({label:`Tarif: ${Y(C.state,`aktiv`)}${C.priceEurPerKwh==null?``:` · ${J(C.priceEurPerKwh).toFixed(3)} €/kWh`}`}),T.available&&A.push({label:`Prognose: ${Y(T.source,`aktiv`)}${T.fresh===!1?` · veraltet`:``}`,warning:T.fresh===!1}),(x.safetyActive||x.safetyEmergencyStop||x.safetyValid===!1)&&A.push({label:`EOS Safety aktiv`,warning:!0}),!t&&!r?w(`section`,{className:`eos-ems-overview-card`,"data-nexowatt-contract":`nexowatt-ems-overview-v1`,style:{"--eos-ems-status-color":Qe.info},children:[w(`header`,{className:`eos-ems-overview-header`,children:[w(`div`,{children:[l(`span`,{className:`eos-ems-overview-eyebrow`,children:`NexoWatt EMS`}),l(`h2`,{children:`Live-Diagnose`}),l(`p`,{children:a||`Die integrierte EMS-Laufzeit startet oder die Diagnosewerte sind derzeit nicht verfügbar.`})]}),w(`div`,{className:`eos-ems-overview-state`,children:[l(`span`,{className:`eos-ems-overview-state-dot`}),l(`strong`,{children:`Nicht verfügbar`}),l(`small`,{children:`read-only`})]})]}),w(`footer`,{className:`eos-ems-overview-footer`,children:[l(`span`,{children:`Diagnose ist rein lesend.`}),l(`span`,{children:`Keine EMS-Regelung wurde verändert.`})]})]}):w(`section`,{className:`eos-ems-overview-card`,"data-nexowatt-contract":`nexowatt-ems-overview-v1`,style:{"--eos-ems-status-color":ee},children:[w(`header`,{className:`eos-ems-overview-header`,children:[w(`div`,{children:[l(`span`,{className:`eos-ems-overview-eyebrow`,children:`NexoWatt EMS · Live-Diagnose`}),l(`h2`,{children:r?`EMS-Diagnose wird geladen …`:h?`EMS-Diagnose ist nicht aktuell`:Y(p.headline,`EMS arbeitet normal`)}),l(`p`,{children:h?`Adapter oder Diagnosewerte sind älter als 20 Sekunden. Die dargestellten Werte dürfen nicht als aktuelle Regelentscheidung verwendet werden.`:Y(p.reason,`EMS arbeitet innerhalb aller aktiven Grenzen.`)})]}),w(`div`,{className:`eos-ems-overview-state`,children:[l(`span`,{className:`eos-ems-overview-state-dot`}),l(`strong`,{children:h?`Offline / veraltet`:$e[_]}),w(`small`,{children:[(t==null?void 0:t.instance)||`eos-admin`,` · `,tt(t==null?void 0:t.updatedAt)]})]})]}),w(`div`,{className:`eos-ems-overview-metrics`,children:[w(`div`,{className:`eos-ems-overview-metric`,children:[l(`span`,{children:`EMS-Budget`}),l(`strong`,{children:E>0?Z(E):`nicht begrenzt`}),w(`small`,{children:[`Rest `,Z(D)]})]}),w(`div`,{className:`eos-ems-overview-metric`,children:[l(`span`,{children:`Lademanagement`}),w(`strong`,{children:[Z(y.actualW),` / `,Z(y.targetW)]}),w(`small`,{children:[J(y.activeCount),` lädt · `,J(y.waitingCount),` wartet`]})]}),b.available?w(`div`,{className:`eos-ems-overview-metric`,children:[w(`span`,{children:[`Speicher `,Y(b.topology,``)]}),w(`strong`,{children:[Z(b.actualW),` / `,Z(b.targetW)]}),l(`small`,{children:b.socPct==null?Y(b.reason,`aktiv`):`SoC ${Math.round(J(b.socPct))} %`})]}):w(`div`,{className:`eos-ems-overview-metric`,children:[l(`span`,{children:`PV-Budget`}),l(`strong`,{children:Z(v.pvBudgetW)}),w(`small`,{children:[`PV-Rest `,Z(v.remainingPvW)]})]}),w(`div`,{className:`eos-ems-overview-metric`,children:[l(`span`,{children:`Letzter Regeltick`}),l(`strong`,{children:tt(x.lastTickTs||(t==null?void 0:t.updatedAt))}),l(`small`,{children:f?`Zyklus ${J(x.cycleMs)} ms`:Y(x.decision,`EMS aktiv`)})]})]}),E>0?l(`div`,{className:`eos-ems-overview-budget`,title:`${O.toFixed(1)} % Restbudget`,children:l(`span`,{style:{width:`${O}%`}})}):null,A.length?l(`div`,{className:`eos-ems-overview-tags`,children:A.map(e=>l(`span`,{className:e.warning?`is-warning`:``,children:e.label},e.label))}):null,w(`div`,{className:`eos-ems-overview-columns`,children:[w(`div`,{className:`eos-ems-overview-panel`,children:[l(`h3`,{children:`Aktuelle Regelentscheidungen`}),ne.length?ne.map((e,t)=>w(`div`,{className:`eos-ems-overview-decision eos-ems-overview-decision--${Q(e.severity)}`,children:[l(`strong`,{children:Y(e.title,`EMS-Entscheidung`)}),l(`span`,{children:Y(e.reason,`Keine zusätzliche Begrenzung`)}),f&&e.details?l(`small`,{children:e.details}):null]},`${e.subsystem||`ems`}-${t}`)):l(`div`,{className:`eos-ems-overview-empty`,children:`Keine aktiven Regelentscheidungen. EOS arbeitet mit den aktuellen Messwerten.`})]}),w(`div`,{className:`eos-ems-overview-panel`,children:[l(`h3`,{children:f?`Letzte EMS-Ereignisse`:`Systemerklärung`}),f?k.length?k.map((e,t)=>w(`div`,{className:`eos-ems-overview-event eos-ems-overview-event--${Q(e.severity)}`,children:[l(`time`,{children:nt(e.ts)}),w(`div`,{children:[l(`strong`,{children:Y(e.title,`EMS`)}),l(`span`,{children:Y(e.message||e.reason,`Zustand aktualisiert`)})]})]},e.id||`${e.ts}-${t}`)):l(`div`,{className:`eos-ems-overview-empty`,children:`Noch keine Zustandsänderung im begrenzten Ereignispuffer.`}):w(`div`,{className:`eos-ems-overview-decision eos-ems-overview-decision--info`,children:[l(`strong`,{children:Y(p.headline,`EMS aktiv`)}),l(`span`,{children:Y(p.reason,`EOS optimiert die Anlage innerhalb aller Sicherheitsgrenzen.`)})]})]})]}),l(`footer`,{className:`eos-ems-overview-footer`,children:l(`span`,{children:`Diagnose ist rein lesend. Keine Kachel besitzt Schreibhoheit.`})})]})}Ve(),o(),Ue();var $={button:{position:`absolute`,bottom:16,right:16},saveButton:e=>({backgroundColor:e.palette.success.main,right:80,"&:hover":{backgroundColor:e.palette.success.dark}}),addButton:e=>({backgroundColor:e.palette.secondary.main,right:144,"&:hover":{backgroundColor:e.palette.secondary.dark}}),closeButton:e=>({backgroundColor:e.palette.error.main,"&:hover":{backgroundColor:e.palette.error.dark}}),hostOffline:e=>({color:e.palette.error.main,fontWeight:500}),updateExists:{color:`#c28700`,marginRight:4},updateNo:{color:`#00b204`,marginRight:4},nodeUpdate:{opacity:.6},instanceNumber:{opacity:.6,fontWeight:500},hostStats:{display:`grid`,gridTemplateColumns:`auto minmax(0, 1fr)`,columnGap:`10px`,rowGap:`3px`,alignItems:`baseline`},hostStatLabel:e=>({color:e.palette.text.disabled,whiteSpace:`nowrap`}),hostStatValue:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},hostInfoStats:{display:`grid`,gridTemplateColumns:`auto auto minmax(0, 1fr)`,columnGap:`12px`,rowGap:`6px`,alignItems:`center`},hostInfoIcon:e=>({display:`flex`,alignItems:`center`,color:e.palette.text.disabled,fontSize:18,"& svg":{fontSize:18}}),hostInfoValue:{overflowWrap:`anywhere`},diskValue:{display:`flex`,alignItems:`center`,gap:`8px`},diskBar:{flex:`1 1 auto`,minWidth:60,maxWidth:160,height:8,borderRadius:4},diskText:{whiteSpace:`nowrap`},updateIcon:{cursor:`pointer`,fontSize:16},tooltip:{pointerEvents:`none`},cards:{alignContent:`flex-start`,width:`100%`,pt:`12px`,px:`8px`,pb:`64px`}},ot={Uptime:H.formatSeconds,"System uptime":H.formatSeconds,RAM:H.formatRam,Speed:H.formatSpeed,"Disk size":H.formatBytes,"Disk free":H.formatBytes,timeOffset:e=>{let t=Math.abs(e),n=Math.floor(t/60),r=t%60;return`UTC${e>0?`-`:`+`}${n}${r?`:${r.toString().padStart(2,`0`)}`:``}`}};function st(e,t,n){let r=typeof t==`number`?t:new Date().getTimezoneOffset(),i=new Date(e-r*6e4);try{return i.toLocaleString(n===`zh-cn`?`zh-CN`:n,{timeZone:`UTC`})}catch{return i.toUTCString().replace(` GMT`,``)}}function ct(e){return e&&e[0].toUpperCase()+e.substring(1)}function lt(e){let t=e.toLowerCase();return t.includes(`darwin`)||t.includes(`osx`)||t.includes(`mac`)?l(u,{}):t.includes(`win`)?l(ae,{}):t.includes(`bsd`)?l(T,{}):t.includes(`linux`)||t.includes(`docker`)||t.includes(`android`)?l(S,{}):l(we,{})}function ut(t,n){switch(t){case`Platform`:case`os`:return lt(`${n.Platform||``} ${n.os||``}`);case`Architecture`:return l(Ee,{});case`CPUs`:case`Model`:return l(O,{});case`Speed`:return l(De,{});case`RAM`:return l(ze,{});case`System uptime`:return l(Oe,{});case`Uptime`:return l(ke,{});case`Node.js`:return l(s,{});case`NPM`:return l(p,{});case`time`:return l(Me,{});case`timeOffset`:return l(re,{});case`adapters count`:return l(Ae,{});case`Disk size`:case`Disk free`:return l(Ne,{});case`Active instances`:return l(Ce,{});case`location`:return l(Se,{});case`alive`:case`active`:return n[t]?l(Be,{color:`success`}):l(e,{color:`error`});default:return null}}var dt=new WeakMap,ft=new WeakMap,pt=new WeakMap,mt=class e extends ge.Component{constructor(t){super(t),We(this,dt,18e5),We(this,ft,3e5),We(this,pt,6e4),x(this,`introLinksOriginal`,void 0),x(this,`deactivatedOriginal`,void 0),x(this,`remoteAccess`,null),x(this,`t`,void 0),x(this,`getDataTimeout`,void 0),x(this,`updateHostsAlive`,async t=>{let n=JSON.parse(JSON.stringify(this.state.alive)),r=[];if(t.find(e=>e.type===`deleted`))this.getDataDelayed();else if(t.forEach(e=>{!!n[e.id]!=!!e.alive&&(n[e.id]=e.alive,r.push(e.id))}),r.length){let t=JSON.parse(JSON.stringify(this.state.hostsData)),i=new Map(this.state.hostDataTimestampMap),a=Date.now();(await Promise.all(r.map(e=>this.getHostData(e,n[e])))).forEach(n=>{t[n.id]=e.preprocessHostData(n.data),i.set(n.id,a)}),this.setState({alive:n,hostsData:t,hostDataTimestampMap:i},()=>this.checkBackendTime())}}),x(this,`updateHosts`,t=>{let n=[];if(t.find(e=>!e.obj))this.getDataDelayed();else if(n=t.map(e=>e.id),n.length){let t=JSON.parse(JSON.stringify(this.state.hostsData)),r=new Map(this.state.hostDataTimestampMap),i=Date.now();Promise.all(n.map(e=>this.getHostData(e))).then(n=>{n.forEach(n=>{t[n.id]=e.preprocessHostData(n.data),r.set(n.id,i)}),this.setState({hostsData:t,hostDataTimestampMap:r})})}}),x(this,`getDataDelayed`,e=>{this.getDataTimeout&&clearTimeout(this.getDataTimeout),this.getDataTimeout=setTimeout(()=>{this.getDataTimeout=void 0,this.getData(!0).catch(e=>console.error(`Cannot get data: ${e}`))},300)}),this.state={instances:null,deactivated:[],edit:!1,link:null,introLinks:[],editLink:!1,editLinkIndex:-1,openSnackBar:!1,hasUnsavedChanges:!1,reverseProxy:null,alive:{},hostsData:{},hosts:null,hostTimeDiffMap:new Map,hostDataTimestampMap:new Map,nodeUpdateSupported:!1,nodeUpdateDialog:null},this.t=t.t}checkBackendTime(){let e=this.state.hostTimeDiffMap,t=this.state.hostDataTimestampMap,n=Date.now();for(let[r,i]of Object.entries(this.state.hostsData)){let a=Math.abs(i.time-n);e.set(r,a),t.set(r,n)}this.setState({hostTimeDiffMap:e,hostDataTimestampMap:t})}async componentDidMount(){let e=window;e.NEXOWATT_EOS_ADMIN_SOCKET=this.props.socket,e.NEXOWATT_EOS_SOCKET=this.props.socket,window.dispatchEvent(new CustomEvent(`nexowatt-eos-admin-socket-ready`));let t=[],n=!1;try{var r;let[e,i]=await Promise.all([this.props.socket.getObject(`system.adapter.${this.props.adminInstance}`),this.props.socket.checkFeatureSupported(`CONTROLLER_OS_PACKAGE_UPGRADE`)]);t=(e==null||(r=e.native)==null?void 0:r.reverseProxy)||[],n=i}catch(e){if(String(window.NEXOWATT_EOS_ACCESS_ROLE||`unknown`).toLowerCase()===`admin`)throw e}await new Promise(e=>this.setState({reverseProxy:t,nodeUpdateSupported:n},()=>e())),await this.getData(),this.props.instancesWorker.registerHandler(this.getDataDelayed),this.props.hostsWorker.registerHandler(this.updateHosts),this.props.hostsWorker.registerAliveHandler(this.updateHostsAlive),this.checkBackendTime()}componentWillUnmount(){this.getDataTimeout&&=(clearTimeout(this.getDataTimeout),void 0),this.props.instancesWorker.unregisterHandler(this.getDataDelayed),this.props.hostsWorker.unregisterHandler(this.updateHosts),this.props.hostsWorker.unregisterAliveHandler(this.updateHostsAlive)}async activateEditMode(){var e;let t=await this.props.socket.getSystemConfig(!0),n=await this.getInstances(!0,null,t),r=t!=null&&(e=t.native)!=null&&e.introLinks?t.native.introLinks:[];this.introLinksOriginal=JSON.stringify(r),this.deactivatedOriginal=JSON.parse(JSON.stringify(n.deactivated)),this.setState({instances:n.instances,deactivated:n.deactivated,edit:!0,introLinks:r,hasUnsavedChanges:!1})}deactivateEditMode(){this.state.hasUnsavedChanges,this.setState({deactivated:this.deactivatedOriginal||null,introLinks:JSON.parse(this.introLinksOriginal||`[]`),hasUnsavedChanges:!1,edit:!1},()=>{this.deactivatedOriginal=void 0,this.introLinksOriginal=void 0})}toggleCard(e,t){if(!this.state.instances||!this.state.instances.length)return;let n=JSON.parse(JSON.stringify(this.state.deactivated)),r=n.indexOf(`${e}_${t}`);r===-1?(n.push(`${e}_${t}`),n.sort()):n.splice(r,1);let i=JSON.stringify(n)!==JSON.stringify(this.deactivatedOriginal)||JSON.stringify(this.state.introLinks)!==this.introLinksOriginal;this.setState({deactivated:n,hasUnsavedChanges:i})}getInstancesCards(){return(this.state.instances||[]).map(e=>{var t;let n=`${e.id}_${e.linkName}`,r=String(window.NEXOWATT_EOS_ACCESS_ROLE||`unknown`).toLowerCase(),i=r===`admin`||r===`service`;if(!i&&/^(?:admin|xterm)(?:\.|$)/i.test(e.id))return null;let a=i&&/^(?:admin|xterm)(?:\.|$)/i.test(e.id)||!((t=this.state.deactivated)!=null&&t.includes(n));if(a||this.state.edit){let t=``;if(e.link)try{t=new URL(e.link,window.location.href).host}catch{t=e.link.replace(/^https?:\/\//,``).split(`/`)[0]}if(e.id===this.props.adminInstance)return null;let n=window.isFinite(e.id.split(`.`).pop());if(n){var o;n=!!((o=this.state.instances)!=null&&o.find(t=>t.id!==e.id&&e.name===t.name&&e.id.split(`.`)[0]===t.id.split(`.`)[0]))}let r=this.state.hostsData?this.state.hostsData[e.id]:null,i;e.info&&(i=r&&typeof r==`object`?r.alive===!1?`offline`:`online`:`unknown`);let s=this.state.hostTimeDiffMap.get(e.id)??0,c=this.state.hostDataTimestampMap.get(e.id)??0,u=Date.now()-c<Ge(ft,this);return l(W,{image:e.image||``,title:w(E,{children:[e.name,n?w(`span`,{style:$.instanceNumber,children:[`.`,e.id.split(`.`).pop()]}):null]}),action:{link:e.link||``,text:t},t:this.props.t,lang:this.props.lang,color:e.color||``,showInfo:!!e.info,status:i,edit:this.state.edit,offline:!!r&&r.alive===!1,warning:s>Ge(dt,this)&&u?this.t(`Backend time differs by %s minutes`,Math.round(s/Ge(pt,this)).toString()):void 0,enabled:a,unreachable:!!e.unreachable,disabled:!r||typeof r!=`object`,getHostDescriptionAll:()=>this.getHostDescriptionAll(e.id),toggleActivation:()=>this.toggleCard(e.id,e.linkName||``),openSnackBarFunc:()=>this.setState({openSnackBar:!0}),theme:this.props.theme,children:e.description||this.getHostDescription(e.id)},`${e.id}_${e.link}`)}return null})}toggleLinkCard(e){let t=JSON.parse(JSON.stringify(this.state.introLinks));t[e].enabled=!t[e].enabled;let n=JSON.stringify(this.state.deactivated)!==JSON.stringify(this.deactivatedOriginal)||JSON.stringify(t)!==this.introLinksOriginal;this.setState({introLinks:t,hasUnsavedChanges:n})}getLinkCards(){return(this.state.introLinks||[]).map((e,t)=>!e.enabled&&!this.state.edit?null:e.camera===`custom`?l(Ye,{image:e.image,title:e.name,action:{link:e.link,text:e.linkName},t:this.props.t,socket:this.props.socket,color:e.color,edit:this.state.edit,interval:e.interval,camera:e.camera,addTs:e.addTs,onEdit:()=>{var e;return this.setState({editLink:!0,editLinkIndex:t,link:JSON.parse(JSON.stringify((e=this.state.introLinks)==null?void 0:e[t]))})},onRemove:()=>{let e=JSON.parse(JSON.stringify(this.state.introLinks));e.splice(t,1);let n=JSON.stringify(this.state.deactivated)!==JSON.stringify(this.deactivatedOriginal)||JSON.stringify(e)!==this.introLinksOriginal;this.setState({introLinks:e,hasUnsavedChanges:n})},enabled:e.enabled,lang:this.props.lang,toggleActivation:()=>this.toggleLinkCard(t),cameraUrl:e.desc,theme:this.props.theme},`link${t}`):l(W,{image:e.image,title:e.name,action:{link:e.link,text:e.linkName},t:this.props.t,color:e.color,edit:this.state.edit,onEdit:()=>{var e;return this.setState({editLink:!0,editLinkIndex:t,link:JSON.parse(JSON.stringify((e=this.state.introLinks)==null?void 0:e[t]))})},onRemove:()=>{let e=JSON.parse(JSON.stringify(this.state.introLinks));e.splice(t,1);let n=JSON.stringify(this.state.deactivated)!==JSON.stringify(this.deactivatedOriginal)||JSON.stringify(e)!==this.introLinksOriginal;this.setState({introLinks:e,hasUnsavedChanges:n})},enabled:e.enabled,lang:this.props.lang,toggleActivation:()=>this.toggleLinkCard(t),theme:this.props.theme,children:e.desc||``},`link${t}`))}editLinkCard(){return this.state.editLink?l(Xe,{link:this.state.link,socket:this.props.socket,isNew:this.state.editLinkIndex===-1,t:this.props.t,lang:this.props.lang,theme:this.props.theme,onClose:e=>{if(e){let t=JSON.parse(JSON.stringify(this.state.introLinks));this.state.editLinkIndex===-1?(e.enabled=!0,t.push(e)):(e.enabled=t[this.state.editLinkIndex].enabled,t[this.state.editLinkIndex]=e);let n=JSON.stringify(this.state.deactivated)!==JSON.stringify(this.deactivatedOriginal)||JSON.stringify(t)!==this.introLinksOriginal;this.setState({introLinks:t,editLink:!1,hasUnsavedChanges:n,link:null})}else this.setState({editLink:!1})}}):null}getButtons(){let e=[];return this.state.edit?(e.push(l(v,{color:`primary`,size:`small`,sx:A.getStyle(this.props.theme,$.button,$.addButton),onClick:()=>this.setState({editLink:!0,editLinkIndex:-1,link:{}}),children:l(i,{})},`add`)),e.push(l(v,{size:`small`,color:`primary`,disabled:!this.state.hasUnsavedChanges,sx:A.getStyle(this.props.theme,$.button,$.saveButton),onClick:()=>this.saveCards(),children:l(D,{})},`save`)),e.push(l(v,{size:`small`,color:`primary`,sx:A.getStyle(this.props.theme,$.button,$.closeButton),onClick:()=>this.deactivateEditMode(),children:l(f,{})},`close`))):e.push(l(v,{color:`primary`,size:`small`,style:$.button,onClick:()=>this.activateEditMode(),children:l(Te,{})},`edit`)),e}async saveCards(){let e=await this.props.socket.getSystemConfig(!0),t=!1;JSON.stringify(e.common.intro)!==JSON.stringify(this.state.deactivated)&&(e.common.intro=this.state.deactivated||void 0,t=!0),!t&&JSON.stringify(e.native.introLinks)!==JSON.stringify(this.state.introLinks)&&(t=!0,e.native.introLinks=this.state.introLinks),t?this.props.socket.setSystemConfig(e).then(()=>this.props.showAlert(`Updated`,`success`)).catch(e=>{console.log(e),this.props.showAlert(e,`error`)}).then(()=>this.setState({edit:!1})):this.setState({edit:!1})}async getHostData(e,t){let n;if(t!==void 0)n={val:t};else try{n=await this.props.socket.getState(`${e}.alive`)}catch(t){console.error(`Cannot get state ${e}.alive: ${t}`),n={val:!1}}let r={alive:!1};if(n!=null&&n.val)try{r=await this.props.socket.getHostInfo(e,!1,1e4),r&&typeof r==`object`&&r.alive!==!1&&(r.alive=!0)}catch(t){console.error(`Cannot get host info for ${e}: ${t}`),r={alive:!1}}else r={alive:!1};let i=await this.props.socket.getForeignStates(`${e}.versions.*`);return Object.keys(i).forEach(e=>r[`_${e.split(`.`).pop()}`]=i[e].val),{id:e,data:r}}async getHostsData(t){let n=t.map(e=>this.getHostData(e._id)),r=await Promise.all(n),i={},a={},o=new Map(this.state.hostDataTimestampMap),s=Date.now();return r.forEach(t=>{i[t.id]=e.preprocessHostData(t.data),a[t.id]=!!t.data.alive,o.set(t.id,s)}),this.setState({hostDataTimestampMap:o}),{hostsData:i,alive:a}}addLinks(e,t,n,r,i,a){let o={id:e.id,name:e.name,description:e.description,color:e.color,image:e.icon,info:``},s=Fe(e.link,t.name,n,{instances:r,hostname:this.props.hostname,adminInstance:this.props.adminInstance,hosts:i}),c=this.state.reverseProxy,l=null;if(c!=null&&c.length){let e=window.location.pathname;l=c.find(t=>{if(!t.globalPath)return!1;let n=t.globalPath.endsWith(`/`)?t.globalPath:`${t.globalPath}/`;return e===n||e.startsWith(n)})||null}if(s.length>1&&(s.sort((e,t)=>(e.instance||``).localeCompare(t.instance||``,void 0,{numeric:!0})),s.splice(1)),s.length){if(o.link=s[0].url,o.port=s[0].port,this.remoteAccess){let e=Re(o.link,o.port,this.remoteAccess);e===null?o.unreachable=!0:o.link=e}else o.link=Pe(o.link,o.id,r,l)||o.link;let i=He(e.link,t.name,n,this.props.adminInstance,window.location.href);i&&(o.link=i,o.port=void 0,o.unreachable=!1);let c=a.find(e=>e.link===o.link);c?Le(o.link,t.name,c.id.split(`.`)[0])?a[a.indexOf(c)]=o:console.log(`Double links: "${o.id}" and "${c.id}"`):a.push(o)}}static getText(e,t){return e?typeof e==`object`?e[t]||e.en||``:e||``:``}static normalizeLinks(t,n,r){if(!t.common.localLinks&&!t.common.localLink&&!t.common.welcomeScreen&&!t.common.welcomeScreenPro)return null;let i={id:t._id.replace(`system.adapter.`,``),link:``,name:e.getText(t.common.titleLang||t.common.title||t.common.name,n),order:t.common.order||1e3,intro:!0,description:e.getText(t.common.desc,n),icon:t.common.icon?`adapter/${t.common.name}/${t.common.icon}`:`img/no-image.svg`},a=[];if(t.common.localLink){if(typeof t.common.localLink==`string`)a.push({...i,link:t.common.localLink});else{let e=t.common.localLink;if(e.link){let t={...i,link:e.link};e.color&&(t.color=e.color),e.order!==void 0&&typeof e.order==`number`&&(t.order=e.order),e.icon&&e.img&&(t.icon=e.icon||e.img),a.push(t)}else console.warn(`Unknown localLink structure: ${JSON.stringify(t.common.localLink)}`)}}let o=t.common.localLinks;if(o&&typeof o==`object`&&Object.keys(o).forEach(r=>{let s=o[r];if(typeof s==`string`)a.push({...i,link:s});else{let o=s;if(o.link){let s={...i,id:t._id.replace(`system.adapter.`,``)+(r===`_default`?``:` ${r}`),link:o.link,name:i.name+(r===`_default`?``:` ${r}`)};o.color&&(s.color=o.color),o.order!==void 0&&(s.order=parseInt(o.order,10)||1e3),o.icon&&o.img&&(s.icon=o.icon||o.img),o.description&&(s.description=e.getText(o.description,n)),o.pro!==void 0&&(s.pro=typeof o.pro==`string`?o.pro:`${t.common.name}/index.html`),o.cloud!==void 0&&(s.cloud=o.cloud),o.intro!==void 0&&(s.intro=o.intro===!0),o.name&&(s.name=e.getText(o.name,n)),r===`_default`&&(s.default=!0),a.push(s)}else console.warn(`Unknown localLinks structure: ${JSON.stringify(s)}`)}}),t.common.welcomeScreen&&typeof t.common.welcomeScreen==`object`&&((Array.isArray(t.common.welcomeScreen)?t.common.welcomeScreen:[t.common.welcomeScreen]).forEach(r=>{if(r.link){let s={...i,id:`${t._id.replace(`system.adapter.`,``)} cloud`,link:`%web_protocol%://%web_bind%:%web_port%/${r.link}`,cloud:r.link};if(r.color&&(s.color=r.color),r.order!==void 0&&typeof r.order==`number`&&(s.order=r.order),r.icon&&r.img&&(s.icon=r.icon||r.img),r.localLinks){var o;let e=(o=t.common.localLinks)==null?void 0:o[r.localLinks];e&&typeof e==`string`?s.link=e:e&&typeof e==`object`&&e.link&&(s.link=e.link)}r.name&&(s.name=e.getText(r.name,n)),a.push(s)}}),t.common.welcomeScreenPro&&typeof t.common.welcomeScreenPro==`object`&&(Array.isArray(t.common.welcomeScreenPro)?t.common.welcomeScreenPro:[t.common.welcomeScreenPro]).forEach(r=>{if(r.link){let s={...i,id:`${t._id.replace(`system.adapter.`,``)} pro`,link:`%web_protocol%://%web_bind%:%web_port%/${r.link}`,pro:r.link};if(r.color&&(s.color=r.color),r.order!==void 0&&typeof r.order==`number`&&(s.order=r.order),r.icon&&r.img&&(s.icon=r.icon||r.img),r.localLinks){var o;let e=(o=t.common.localLinks)==null?void 0:o[r.localLinks];e&&typeof e==`string`?s.link=e:e&&typeof e==`object`&&e.link&&(s.link=e.link)}r.name&&(s.name=e.getText(r.name,n)),a.push(s)}})),a.forEach(e=>{e.icon.startsWith(`adapter/`)||e.icon.startsWith(`data:image/`)||e.icon.startsWith(`http://`)||e.icon.startsWith(`https://`)||e.icon===`img/no-image.svg`||(e.icon=`adapter/${t.common.name}/${e.icon}`)}),r){let e={};a.forEach(t=>{e[t.link]?(t.color&&(e[t.link].color=t.color),t.icon&&(e[t.link].icon=t.icon),t.cloud&&(e[t.link].cloud=t.cloud),t.pro&&(e[t.link].pro=t.pro),t.intro!==void 0&&(e[t.link].intro=t.intro),t.name&&typeof t.name==`object`&&(e[t.link].name=t.name),t.order!==void 0&&(e[t.link].order=t.order),t.default&&(e[t.link].default=t.default)):e[t.link]=t}),a=Object.values(e)}return a.sort((e,t)=>e.default===void 0&&t.default===void 0?e.order===void 0&&t.order===void 0?0:e.order===void 0?-1:t.order===void 0?1:e.order-t.order:e.default===void 0?-1:t.default===void 0?1:e.order===void 0&&t.order===void 0?0:e.order===void 0?-1:t.order===void 0?1:e.order-t.order),a}async getInstances(t,n,r){n=n||this.state.hosts||[];let i={};n.forEach(e=>i[e._id]=e);try{let a=await this.props.socket.getAdapterInstances(``,t),o=r.common.intro||[];Array.isArray(o)||(o=Object.keys(o),o.sort());let s=[],c={};a.forEach(e=>c[e._id]=e),this.remoteAccess=Ie(c,window.location),a.forEach(t=>{if(!t)return;let n=t.common||null,r=t._id.split(`.`),a=parseInt(r.pop()||``,10),o;if(n!=null&&n.name&&typeof n.name==`object`){let e=n==null?void 0:n.name;o=e[this.props.lang]||e.en}else o=(n==null?void 0:n.name)||``;if((o!==`admin`||n.localLink!==(this.props.hostname||``))&&o!==`web`&&!(o&&o!==`vis-web-admin`&&o.match(/^vis-/)&&o!==`vis-2`)&&!(o!=null&&o.match(/^icons-/))&&n&&(n.enabled||n.onlyWWW)){let r=e.normalizeLinks(t,this.props.lang,!0);r&&r.forEach(e=>this.addLinks(e,n,a,c,i,s))}}),s.forEach(e=>{e.link&&(e.linkName=e.link.replace(`https://`,``).replace(`http://`,``).replace(/^[^_]+:/,``))}),s.sort((e,t)=>{if(e.order!==void 0||t.order!==void 0){if(e.order=e.order===void 0?1e3:e.order,t.order=t.order===void 0?1e3:t.order,e.order<t.order)return-1;if(e.order>t.order)return 1}return e.id>t.id?1:e.id<t.id?-1:0}),n==null||n.forEach(e=>{let t=e==null?void 0:e.common,n=t==null?void 0:t.name;if(typeof n==`object`&&(n&&=n[this.props.lang]||n.en),t){let r={id:e._id,name:n||``,color:``,image:t.icon||`img/no-image.svg`,info:this.t(`Info`),linkName:``};s.push(r)}});let l=[];return o.forEach(e=>{s.find(t=>e===`${t.id}_${t.linkName}`)&&l.push(e)}),o=l,{instances:s,deactivated:o}}catch(e){return console.log(e),{instances:[],deactivated:[]}}}getHostDescription(e){let t=this.state.hostsData?this.state.hostsData[e]:null;if(t&&t.alive===!1)return l(j,{sx:$.hostOffline,children:this.props.t(`Offline`)});let n=``,r=``;if(t){try{t._nodeNewest&&t[`Node.js`]&&B.gt(t._nodeNewest,t[`Node.js`].replace(/^v/,``))&&(n=t._nodeNewest)}catch{}try{t._nodeNewest!==t._nodeNewestNext&&t._nodeNewestNext&&t[`Node.js`]&&t._nodeNewest&&B.gt(t._nodeNewestNext,t[`Node.js`].replace(/^v/,``))&&B.gt(t._nodeNewestNext,t._nodeNewest)&&(n+=(n?` / `:``)+t._nodeNewestNext)}catch{}if(n){let r=this.state.nodeUpdateSupported&&t.Platform===`linux`;n=l(R,{title:this.props.t(`Some updates available`),slotProps:{popper:{sx:$.tooltip}},children:w(`span`,{style:{...$.nodeUpdate,display:`inline-flex`},children:[`(`,n,`)`,r?l(ye,{style:$.updateIcon,onClick:()=>this.setState({nodeUpdateDialog:{hostId:e,version:t._nodeNewestNext}})}):null]})})}try{t._npmNewest&&t.NPM&&B.gt(t._npmNewest,t.NPM)&&(r=t._npmNewest)}catch{}try{t._npmNewest!==t._npmNewestNext&&t._npmNewestNext&&t.NPM&&t._npmNewest&&B.gt(t._npmNewestNext,t.NPM)&&B.gt(t._npmNewestNext,t._npmNewest)&&(r+=(r?` / `:``)+t._npmNewestNext)}catch{}r&&=l(R,{title:this.props.t(`Some updates available`),slotProps:{popper:{sx:$.tooltip}},children:w(`span`,{style:$.nodeUpdate,children:[`(`,r,`)`]})})}return t&&typeof t==`object`?w(j,{sx:$.hostStats,children:[l(j,{sx:$.hostStatLabel,children:this.t(`Platform`)}),l(j,{sx:$.hostStatValue,title:t.Platform||``,children:t.Platform||`--`}),l(j,{sx:$.hostStatLabel,children:this.t(`RAM`)}),l(j,{sx:$.hostStatValue,children:ot.RAM(t.RAM)}),l(j,{sx:$.hostStatLabel,children:this.t(`Node.js`)}),w(j,{sx:$.hostStatValue,children:[l(`span`,{style:n?$.updateExists:$.updateNo,children:t[`Node.js`]||`--`}),n]}),l(j,{sx:$.hostStatLabel,children:this.t(`NPM`)}),w(j,{sx:$.hostStatValue,children:[l(`span`,{style:r?$.updateExists:$.updateNo,children:t.NPM||`--`}),r]})]}):w(j,{sx:$.hostStats,children:[l(I,{width:60}),l(I,{}),l(I,{width:60}),l(I,{}),l(I,{width:60}),l(I,{}),l(I,{width:60}),l(I,{})]})}renderDiskRow(e){let t=e[`Disk size`],n=e[`Disk free`],r=t>0?Math.max(0,Math.min(100,n/t*100)):0,i=`${H.formatBytes(n)} / ${H.formatBytes(t)}`,a=r<10?`error`:r<25?`warning`:`success`;return{name:`Disk free`,text:i,value:w(j,{sx:$.diskValue,children:[l(R,{title:`${Math.round(r)}% ${this.t(`Free`)}`,slotProps:{popper:{sx:$.tooltip}},children:l(ie,{variant:`determinate`,value:r,color:a,sx:$.diskBar})}),l(j,{component:`span`,sx:$.diskText,children:i})]})}}renderHostInfoRow(e,t){let n=t[e];return e===`time`?{name:e,text:st(n,t.timeOffset,this.props.lang)}:typeof n==`boolean`?{name:e,text:n?this.t(`Yes`):this.t(`No`)}:ot[e]?{name:e,text:ot[e](n,this.t)||`--`}:typeof n==`object`?{name:e,text:JSON.stringify(n)}:{name:e,text:n.toString()||`--`}}getHostDescriptionAll(e){let t=this.state.hostsData&&typeof this.state.hostsData[e]==`object`?this.state.hostsData[e]:null,n=[];if(t){for(let e of Object.keys(t))if(!(e.startsWith(`_`)||t[e]===null||t[e]===void 0)){if(e===`Disk size`&&typeof t[`Disk free`]==`number`)n.push(this.renderDiskRow(t));else if(e===`Disk free`&&typeof t[`Disk size`]==`number`)continue;else n.push(this.renderHostInfoRow(e,t))}}return{el:l(j,{sx:$.hostInfoStats,children:n.map(e=>w(ge.Fragment,{children:[l(j,{sx:$.hostInfoIcon,children:ut(e.name,t||{})}),l(j,{sx:$.hostStatLabel,children:ct(this.t(e.name))}),l(j,{sx:$.hostInfoValue,children:e.value??e.text})]},e.name))}),text:n.map(e=>`${ct(this.t(e.name))}: ${e.text}`).join(`
1
+ import{$r as e,Ao as t,As as n,Bo as r,Ci as i,Do as a,Es as o,Gi as s,Ha as c,Hs as l,Ii as u,Jo as d,Ka as f,Ki as p,Ko as m,Lr as h,Mo as g,Po as _,Qs as ee,Ro as v,To as y,Tr as b,Ts as x,Ui as S,Ur as C,Us as w,Vi as T,Vo as te,Vs as E,Wa as D,Wi as O,Wn as ne,Wo as k,Wr as A,Xn as re,Xo as ie,Yi as ae,Zo as oe,_s as se,er as ce,gi as le,go as j,gs as ue,ic as de,jo as M,js as fe,ks as N,lo as P,mo as F,ms as I,oi as pe,os as me,pc as L,po as R,ps as he,qo as z,qs as ge,r as B,sc as _e,tc as ve,ua as ye,uc as be,xo as xe,ya as Se,yo as V}from"./loadShare-eager-dmdYQhAl.js";import{t as Ce}from"./Apps-BZHXIYjq.js";import{t as we}from"./Computer-BBU3Cm9-.js";import{a as Te,i as Ee,n as De,r as Oe,t as ke}from"./Timer-vc3BIs4y.js";import{t as Ae}from"./Extension-DIV5Bi1u.js";import{t as je}from"./InfoOutlined-Bggo2-pX.js";import{t as Me}from"./Schedule-vdojlve9.js";import{t as Ne}from"./Storage-B44xXFFu.js";import{c as Pe,f as Fe,l as Ie,p as Le,s as Re,t as H}from"./AdminUtils-Dc1eHsx5.js";import{st as ze,xt as Be}from"./bootstrap-D16lu6rd.js";import{i as Ve,l as He,n as Ue,r as We,t as Ge}from"./classPrivateFieldGet2-DZ8s9-Td.js";var Ke=168;function qe(e,t){if(e)try{return N(e,t)}catch{return}}var U={root:{display:`flex`,maxWidth:460},link:e=>({display:`flex`,width:`100%`,color:`inherit`,borderRadius:`12px`,"&:focus-visible":{outline:`2px solid ${e.palette.primary.main}`,outlineOffset:`2px`}}),card:e=>({display:`flex`,flexDirection:`column`,gap:`12px`,width:`100%`,p:`16px`,position:`relative`,overflow:`hidden`,backgroundColor:e.palette.mode===`dark`?fe(e.palette.background.paper,.08):n(e.palette.background.paper,.03),border:`1px solid`,borderColor:e.palette.divider,backgroundImage:`none`,transition:`border-color 0.15s, background-color 0.15s`,"@media (prefers-reduced-motion: reduce)":{transition:`none`}}),cardClickable:{cursor:`pointer`,"&:hover .intro-card-launch":{opacity:1}},cardOff:e=>({opacity:.45,borderStyle:`dashed`,borderColor:e.palette.text.disabled}),head:{display:`flex`,alignItems:`flex-start`,gap:`14px`},icon:{width:56,height:56,flex:`0 0 auto`,borderRadius:`14px`,display:`flex`,alignItems:`center`,justifyContent:`center`,overflow:`hidden`},iconOffline:{filter:`grayscale(1)`,opacity:.5},img:{width:40,height:40,objectFit:`contain`},headText:{minWidth:0,flex:1,display:`flex`,flexDirection:`column`,gap:`2px`,pr:`20px`},title:{fontSize:`0.98rem`,fontWeight:600,lineHeight:1.25,display:`-webkit-box`,WebkitBoxOrient:`vertical`,WebkitLineClamp:2,overflow:`hidden`,wordBreak:`break-word`},meta:e=>({fontSize:`0.78rem`,lineHeight:1.35,color:e.palette.text.secondary,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`}),warning:e=>({fontSize:17,ml:`4px`,verticalAlign:`-3px`,color:e.palette.warning.main}),corner:{position:`absolute`,top:16,right:16,zIndex:2,display:`flex`,alignItems:`center`,gap:`8px`},launch:e=>({fontSize:17,opacity:0,color:e.palette.text.secondary,transition:`opacity 0.15s`,"@media (prefers-reduced-motion: reduce)":{transition:`none`}}),lamp:{width:10,height:10,borderRadius:`50%`,flex:`0 0 auto`},lampOnline:e=>({backgroundColor:e.palette.success.main,boxShadow:`0 0 0 3px ${N(e.palette.success.main,.2)}`}),lampOffline:e=>({backgroundColor:e.palette.error.main,boxShadow:`0 0 0 3px ${N(e.palette.error.main,.2)}`}),lampUnknown:e=>({backgroundColor:e.palette.text.disabled}),content:e=>({flex:1,minHeight:0,overflow:`hidden`,fontSize:`0.82rem`,lineHeight:1.5,color:e.palette.text.secondary}),contentClamped:{display:`-webkit-box`,WebkitBoxOrient:`vertical`,WebkitLineClamp:3},infoButton:{alignSelf:`flex-start`,ml:`-6px`,fontSize:`0.78rem`,minHeight:0,py:`2px`},editBar:e=>({position:`absolute`,top:8,right:8,zIndex:3,display:`flex`,gap:`2px`,borderRadius:`10px`,p:`2px`,backgroundColor:N(e.palette.background.paper,.85),backdropFilter:`blur(3px)`}),tooltip:{pointerEvents:`none`},infoTitle:{display:`flex`,alignItems:`center`,gap:`8px`,pr:`12px`},infoTitleText:{flex:1,minWidth:0,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},infoBody:{fontSize:`0.9rem`,lineHeight:1.5}},W=class e extends ve{constructor(e){super(e),this.state={infoOpen:!1}}static getDerivedStateFromProps(e){return e.edit?{infoOpen:!1}:null}renderContent(){return this.props.children}openDialog(){}renderDialogs(){return null}hoverTint(e){let t=qe(e,this.props.theme.palette.mode===`dark`?.12:.07);return t?`linear-gradient(${t}, ${t})`:void 0}cardMinHeight(){return Ke}static swallow(e,t){e.preventDefault(),e.stopPropagation(),t==null||t()}renderEditBar(){return this.props.edit?w(j,{sx:U.editBar,children:[this.props.toggleActivation?l(R,{title:this.props.t(`show/hide item`),slotProps:{popper:{sx:U.tooltip}},children:l(m,{size:`small`,color:this.props.enabled?`primary`:`default`,onClick:t=>e.swallow(t,this.props.toggleActivation),children:l(D,{fontSize:`small`})})}):null,this.props.onEdit?l(R,{title:this.props.t(`Edit`),slotProps:{popper:{sx:U.tooltip}},children:l(m,{size:`small`,onClick:t=>e.swallow(t,this.props.onEdit),children:l(Te,{fontSize:`small`})})}):null,this.props.onRemove?l(R,{title:this.props.t(`Delete`),slotProps:{popper:{sx:U.tooltip}},children:l(m,{size:`small`,color:`error`,onClick:t=>e.swallow(t,this.props.onRemove),children:l(c,{fontSize:`small`})})}):null]}):null}renderInfoDialog(){var e,n;if(!this.props.showInfo||!this.state.infoOpen)return null;let r=(e=(n=this.props).getHostDescriptionAll)==null?void 0:e.call(n),i=()=>this.setState({infoOpen:!1});return w(t,{open:!0,onClose:i,maxWidth:`sm`,fullWidth:!0,onClick:e=>e.stopPropagation(),children:[w(_,{sx:U.infoTitle,children:[l(je,{color:`primary`}),w(j,{sx:U.infoTitleText,children:[this.props.t(`Info`),`: `,this.props.title]}),l(m,{size:`small`,onClick:i,children:l(f,{})})]}),l(g,{dividers:!0,sx:U.infoBody,children:r==null?void 0:r.el}),w(M,{children:[l(V,{color:`grey`,variant:`outlined`,startIcon:l(ce,{}),disabled:!(r!=null&&r.text),onClick:()=>{var e,t;A.copyToClipboard((r==null?void 0:r.text)||``),(e=(t=this.props).openSnackBarFunc)==null||e.call(t)},children:this.props.t(`Copy to clipboard`)}),l(V,{variant:`contained`,color:`primary`,autoFocus:!0,startIcon:l(f,{}),onClick:i,children:this.props.t(`Close`)})]})]})}render(){var t,n,r;let{theme:i}=this.props,a=this.props.color||i.palette.primary.main,o=!this.props.edit&&!!((t=this.props.action)!=null&&t.link)&&!this.props.unreachable,s=H.getText((n=this.props.action)==null?void 0:n.text,this.props.lang),c=``;if((r=this.props.action)!=null&&r.link)try{c=new URL(this.props.action.link,window.location.href).href}catch{c=this.props.action.link}return l(k,{size:{xs:12,sm:6,md:4,lg:3,xl:2},sx:A.getStyle(i,U.root,this.props.style),children:l(oe,{href:o?this.props.action.link:void 0,underline:`none`,target:`_blank`,rel:`noopener noreferrer`,sx:A.getStyle(i,U.link),children:w(xe,{sx:A.getStyle(i,U.card,{minHeight:this.cardMinHeight()},o&&U.cardClickable,o&&{"&:hover":{borderColor:qe(a,.7)||a,backgroundImage:this.hoverTint(a)}},this.props.edit&&!this.props.enabled&&U.cardOff,this.props.unreachable&&U.cardOff),onClick:e=>{e.stopPropagation(),this.openDialog()},children:[w(j,{sx:U.head,children:[l(j,{sx:A.getStyle(i,U.icon,{backgroundColor:this.props.color||qe(i.palette.text.primary,.07)},(this.props.offline||this.props.unreachable)&&U.iconOffline),children:l(j,{component:`img`,src:this.props.image,alt:``,sx:U.img})}),w(j,{sx:U.headText,children:[w(F,{component:`div`,sx:U.title,children:[this.props.title,this.props.warning||this.props.unreachable?l(R,{title:this.props.warning||this.props.t(`Only reachable in the local network`),slotProps:{popper:{sx:U.tooltip}},children:l(pe,{sx:U.warning})}):null]}),s?l(F,{component:`div`,sx:U.meta,title:c||s,children:s}):null]})]}),o||this.props.status?w(j,{sx:U.corner,children:[o?l(ne,{className:`intro-card-launch`,sx:U.launch}):null,this.props.status?l(R,{title:this.props.t(this.props.status===`unknown`?`unknown`:this.props.status),slotProps:{popper:{sx:U.tooltip}},children:l(j,{sx:A.getStyle(i,U.lamp,this.props.status===`online`&&U.lampOnline,this.props.status===`offline`&&U.lampOffline,this.props.status===`unknown`&&U.lampUnknown)})}):null]}):null,l(j,{sx:A.getStyle(i,U.content,typeof this.props.children==`string`&&U.contentClamped),children:this.renderContent()}),this.props.showInfo&&!this.props.offline?l(V,{sx:U.infoButton,size:`small`,color:`inherit`,startIcon:l(je,{fontSize:`small`}),disabled:this.props.disabled,onClick:t=>e.swallow(t,()=>this.setState({infoOpen:!0})),children:this.props.t(`Info`)}):null,this.renderInfoDialog(),this.renderEditBar(),this.renderDialogs()]})})})}};o();var G={rootGrid:{flexGrow:1},closeButton:e=>({position:`absolute`,right:8,top:8,color:e.palette.grey[500]}),paper:{},typography:{paddingRight:30},img:{width:`100%`,height:`100%`,objectFit:`contain`}},Je=class extends ve{constructor(e){super(e),x(this,`cameraUpdateTimer`,void 0),x(this,`cameraRef`,void 0),this.cameraUpdateTimer=null,this.cameraRef=ee()}componentDidMount(){this.props.camera&&this.props.camera!==`text`&&(this.cameraUpdateTimer=setInterval(()=>this.updateCamera(),Math.max(parseInt(this.props.interval||``,10),500)),this.updateCamera())}componentWillUnmount(){this.cameraUpdateTimer&&=(clearInterval(this.cameraUpdateTimer),null)}updateCamera(){if(this.cameraRef.current){if(this.props.camera===`custom`){let e=this.props.cameraUrl;this.props.addTs&&(e.includes(`?`)?e+=`&ts=${Date.now()}`:e+=`?ts=${Date.now()}`),this.cameraRef.current.src=e}else{let e=this.props.camera.split(`.`),t=e.shift(),n=e.shift();this.props.socket.sendTo(`${t}.${n}`,`image`,{name:e.pop(),width:this.cameraRef.current.width}).then(e=>{e&&e.data&&this.cameraRef.current&&(this.cameraRef.current.src=`data:image/jpeg;base64,${e.data}`)})}}}render(){return w(t,{onClose:()=>this.props.onClose(),open:!0,maxWidth:`xl`,fullWidth:!0,fullScreen:!0,sx:{"& .MuiDialog-paper":G.paper},children:[l(_,{children:w(F,{component:`h2`,variant:`h6`,sx:{"&.MuiTypography-root":G.typography},children:[this.props.name,l(m,{size:`large`,sx:G.closeButton,onClick:()=>this.props.onClose(),children:l(f,{})})]})}),l(g,{dividers:!0,children:l(`img`,{style:G.img,src:``,alt:`camera`,ref:this.cameraRef})}),l(M,{children:l(V,{variant:`contained`,autoFocus:!0,onClick:e=>{e.stopPropagation(),this.props.onClose()},color:`primary`,startIcon:l(f,{}),children:this.props.t(`Close`)})})]})}};o();var K={cameraImg:{width:`100%`,height:`100%`,objectFit:`contain`,borderRadius:8},imgContainer:{height:`100%`,width:`100%`},hidden:{display:`none`},imgSkeleton:{transform:`initial`}},Ye=class extends W{constructor(e){super(e),x(this,`cameraRef`,void 0),x(this,`cameraUpdateTimer`,void 0),x(this,`interval`,void 0),Object.assign(this.state,{error:!1,dialog:!1,loaded:!1}),this.cameraRef=ee(),this.cameraUpdateTimer=null,this.interval=e.interval||0}updateCamera(){if(this.cameraRef.current){if(this.props.camera===`custom`){let e=this.props.cameraUrl||``;this.props.addTs&&(e.includes(`?`)?e+=`&ts=${Date.now()}`:e+=`?ts=${Date.now()}`),this.cameraRef.current.src=e}else{let e=(this.props.camera||``).split(`.`),t=e.shift(),n=e.shift();this.props.socket.sendTo(`${t}.${n}`,`image`,{name:e.pop(),width:this.cameraRef.current.width}).then(e=>{e!=null&&e.data&&this.cameraRef.current&&(this.cameraRef.current.src=`data:image/jpeg;base64,${e.data}`)}).catch(e=>window.alert(`Cannot send to instance: ${e}`))}}}componentDidMount(){this.props.camera&&this.props.camera!==`text`&&(this.cameraUpdateTimer=setInterval(()=>this.updateCamera(),Math.max(parseInt(this.props.interval,10),500)),this.updateCamera())}componentWillUnmount(){this.cameraUpdateTimer&&=(clearInterval(this.cameraUpdateTimer),null)}cardMinHeight(){return 260}renderDialogs(){return this.state.dialog?l(Je,{socket:this.props.socket,camera:this.props.camera||``,name:this.props.title,t:this.props.t,onClose:()=>{this.props.camera&&this.props.camera!==`text`&&(this.cameraUpdateTimer&&clearInterval(this.cameraUpdateTimer),this.cameraUpdateTimer=setInterval(()=>this.updateCamera(),Math.max(parseInt(this.props.interval,10),500)),this.updateCamera()),this.setState({dialog:!1})},cameraUrl:this.props.cameraUrl||``}):null}handleImageLoad(){this.state.loaded||this.setState({loaded:!0,error:!1})}handleImageError(){this.state.error||this.setState({loaded:!1,error:!0})}renderContent(){var e;if(this.props.camera===`custom`){let e=this.props.cameraUrl||``;return this.props.addTs&&(e.includes(`?`)?e+=`&ts=${Date.now()}`:e+=`?ts=${Date.now()}`),w(k,{container:!0,style:K.imgContainer,sx:{alignItems:`center`,justifyContent:`center`},children:[l(`img`,{ref:this.cameraRef,src:e,alt:`Camera`,style:this.state.loaded&&!this.state.error?K.cameraImg:K.hidden,onLoad:()=>this.handleImageLoad(),onError:()=>this.handleImageError()}),!this.state.loaded&&!this.state.error&&l(I,{height:`100%`,width:`100%`,animation:`wave`,style:K.imgSkeleton}),this.state.error&&l(le,{fontSize:`large`})]})}return(e=this.props.camera)!=null&&e.startsWith(`cameras.`)?l(`img`,{ref:this.cameraRef,src:``,alt:`camera`,style:K.cameraImg}):null}render(){return this.props.camera&&this.props.camera!==`text`?this.interval!==this.props.interval&&(this.interval=this.props.interval||0,this.cameraUpdateTimer&&clearInterval(this.cameraUpdateTimer),this.cameraUpdateTimer=setInterval(()=>this.updateCamera(),Math.max(parseInt(this.props.interval,10),500))):this.cameraUpdateTimer&&=(clearInterval(this.cameraUpdateTimer),null),super.render()}};o();var q={formControl:{marginTop:32},rootGrid:{flexGrow:1},closeButton:e=>({position:`absolute`,right:8,top:8,color:e.palette.grey[500]}),paper:{},typography:{paddingRight:30},editItem:{marginTop:8},editItemSlider:{marginTop:24},labelSlider:{marginTop:16,fontSize:`1rem`},editColor:{width:`100%`},dropZone:{width:`100%`,height:100,position:`relative`},dropZoneEmpty:{},image:{height:`100%`,width:`auto`,objectFir:`contain`},uploadDiv:{position:`relative`,width:`100%`,height:100,opacity:.9},uploadDivDragging:{opacity:1},uploadCenterDiv:{margin:5,border:`3px dashed grey`,borderRadius:5,width:`calc(100% - 10px)`,height:`calc(100% - 10px)`,position:`relative`},uploadCenterIcon:{paddingTop:10,width:48,height:48},uploadCenterText:{fontSize:16},uploadCenterTextAndIcon:{textAlign:`center`,position:`absolute`,top:0,bottom:0,left:0,right:0}},Xe=class e extends ve{constructor(e){super(e),x(this,`originalData`,void 0),this.state={image:``,name:e.t(`New link`),link:`http://`,linkName:``,color:``,desc:``,addTs:!0,interval:5e3,camera:`text`,cameraList:[],...e.link},this.originalData=JSON.stringify(this.getData())}getData(){return{link:this.state.link,name:this.state.name,desc:this.state.desc,linkName:this.state.linkName,color:this.state.color,image:this.state.image,addTs:this.state.addTs,camera:this.state.camera,interval:this.state.interval}}componentDidMount(){this.getCamerasInstances()}getCamerasInstances(){this.props.socket.getAdapterInstances(`cameras`,!0).then(e=>{let t=[],n=[];e.forEach(e=>{let r=e._id.replace(`system.adapter.`,``);e.common&&e.common.enabled&&n.push(this.props.socket.getState(`${e._id}.alive`).then(e=>e&&e.val&&this.props.socket.sendTo(r,`list`,null)).then(e=>e&&e.list&&e.list.forEach(e=>t.push({id:e.id,name:`${e.desc} [${r}/${e.name}]`}))))}),Promise.all(n).then(()=>this.setState({cameraList:t}))})}static getLinkNameFromLink(e){let t=e.trim().match(/^https?:\/\/([^/:]+)(:\d+)?/);return t?t[1]+(t[2]||``):``}render(){return w(t,{onClose:()=>this.props.onClose(),open:!0,maxWidth:`md`,fullWidth:!0,sx:{"& .MuiDialog-paper":q.paper},children:[l(_,{children:w(F,{component:`h2`,variant:`h6`,sx:{"&.MuiTypography-root":q.typography},children:[this.props.isNew?this.props.t(`Add new link: `):this.props.t(`Edit link`),l(m,{size:`large`,sx:q.closeButton,onClick:()=>this.props.onClose(),children:l(f,{})})]})}),l(g,{dividers:!0,children:w(k,{style:q.rootGrid,container:!0,direction:`row`,children:[l(k,{size:{xs:12,sm:6,md:8,lg:9},children:w(k,{container:!0,sx:{flexDirection:`column`},children:[w(r,{variant:`standard`,style:q.formControl,children:[l(d,{id:`select-helper-label`,children:this.props.t(`Link type`)}),w(he,{variant:`standard`,labelId:`select-helper-label`,value:this.state.camera,onChange:e=>this.setState({camera:e.target.value}),children:[l(me,{value:`text`,children:l(`em`,{children:this.props.t(`Description`)})},`desc`),this.state.cameraList.map(e=>l(me,{value:e.id,children:e.name},e.id)),l(me,{value:`custom`,children:this.props.t(`Custom camera URL`)},`custom`)]})]}),l(P,{variant:`standard`,label:this.props.t(`URL`),value:this.state.link,style:q.editItem,onChange:t=>{let n=e.getLinkNameFromLink(this.state.link);n&&(!this.state.linkName||n===this.state.linkName)?this.setState({link:t.target.value,linkName:e.getLinkNameFromLink(t.target.value)}):this.setState({link:t.target.value})},slotProps:{input:{endAdornment:this.state.link?l(z,{position:`end`,children:l(m,{tabIndex:-1,size:`small`,onClick:()=>this.setState({link:``}),children:l(f,{})})}):null}}}),l(P,{variant:`standard`,style:q.editItem,label:this.props.t(`Name`),value:this.state.name||``,onChange:e=>this.setState({name:e.target.value}),slotProps:{input:{endAdornment:this.state.name?l(z,{position:`end`,children:l(m,{tabIndex:-1,size:`small`,onClick:()=>this.setState({name:``}),children:l(f,{})})}):null}}}),this.state.link?l(P,{variant:`standard`,style:q.editItem,label:this.props.t(`Link name`),value:this.state.linkName||``,onChange:e=>this.setState({linkName:e.target.value}),slotProps:{input:{endAdornment:this.state.linkName?l(z,{position:`end`,children:l(m,{tabIndex:-1,size:`small`,onClick:()=>this.setState({linkName:``}),children:l(f,{})})}):null}}}):null,this.state.camera===`custom`||this.state.camera===`text`?l(P,{variant:`standard`,style:q.editItem,label:this.state.camera===`custom`?this.props.t(`Camera URL`):this.props.t(`Description`),value:this.state.desc||``,onChange:e=>this.setState({desc:e.target.value}),slotProps:{input:{endAdornment:this.state.desc?l(z,{position:`end`,children:l(m,{tabIndex:-1,size:`small`,onClick:()=>this.setState({desc:``}),children:l(f,{})})}):null}}}):null,this.state.camera===`custom`?l(te,{style:q.editItem,control:l(y,{checked:this.state.addTs,onChange:e=>this.setState({addTs:e.target.checked})}),label:this.props.t(`Add timestamp to URL`)}):null,this.state.camera===`text`?null:l(F,{style:q.labelSlider,gutterBottom:!0,children:`Polling interval in ms`}),this.state.camera===`text`?null:l(ue,{style:q.editItemSlider,value:this.state.interval,getAriaValueText:()=>`${this.state.interval}ms`,onChange:(e,t)=>this.setState({interval:t}),step:100,min:500,max:6e4,valueLabelDisplay:`on`}),l(`div`,{style:{...q.editItem,width:50},children:l(P,{variant:`standard`,fullWidth:!0,label:this.props.t(`Color`),style:q.editColor,type:`color`,value:this.state.color,onChange:e=>this.setState({color:e.target.value})})}),l(C,{disabled:!1,crop:!0,maxSize:262144,icon:this.state.image,removeIconFunc:()=>this.setState({image:``}),onChange:e=>this.setState({image:e})})]})}),l(k,{size:{xs:12,sm:6,md:4,lg:3},children:this.state.camera===`text`?l(W,{image:this.state.image,title:this.state.name,action:{link:this.state.link,text:this.state.linkName},t:this.props.t,lang:this.props.lang,style:{width:`100% !important`,maxWidth:`100% !important`,marginLeft:`8px`},color:this.state.color,enabled:!0,theme:this.props.theme,children:this.state.desc}):l(Ye,{interval:this.state.interval,camera:this.state.camera,addTs:this.state.addTs,style:{width:`100% !important`,maxWidth:`100% !important`,marginLeft:`8px`},image:this.state.image,title:this.state.name,socket:this.props.socket,action:{link:this.state.link,text:this.state.linkName},t:this.props.t,lang:this.props.lang,color:this.state.color,enabled:!0,cameraUrl:this.state.desc,theme:this.props.theme})})]})}),w(M,{children:[l(V,{variant:`contained`,autoFocus:!0,onClick:()=>this.props.onClose(this.getData()),disabled:!this.props.isNew&&JSON.stringify(this.getData())===this.originalData,color:`primary`,startIcon:this.props.isNew?l(i,{}):l(D,{}),children:this.props.isNew?this.props.t(`Add`):this.props.t(`Save`)}),l(V,{variant:`contained`,onClick:()=>this.props.onClose(),color:`grey`,startIcon:l(f,{}),children:this.props.t(`Close`)})]})]})}},Ze=class extends ge.Component{constructor(e){super(e),this.state={inProgress:!1,success:!1,error:``,finished:!1}}render(){return w(t,{open:!0,maxWidth:`lg`,fullWidth:!0,children:[l(_,{children:b.t(`Node.js upgrade`)}),w(g,{style:{height:100,padding:`0 20px`,overflow:`hidden`},children:[this.state.finished?null:l(F,{children:b.t(`Performing this update will restart the js-controller afterwards!`)}),this.state.inProgress?l(j,{sx:{display:`flex`,justifyContent:`center`},children:l(a,{})}):null,this.state.success?l(F,{children:b.t(`Node.js update successful, restarting controller now!`)}):null,this.state.error?l(F,{sx:{color:`red`},children:b.t(`Node.js update failed: %s`,this.state.error)}):null]}),w(M,{children:[l(V,{disabled:this.state.inProgress||this.state.finished,color:`primary`,variant:`contained`,startIcon:l(ye,{}),onClick:()=>this.updateNodeJsVersion(),children:b.t(`Upgrade`)}),l(V,{disabled:this.state.inProgress,variant:`contained`,onClick:()=>{this.props.onClose()},color:`primary`,startIcon:l(f,{}),children:b.t(`Close`)})]})]})}async updateNodeJsVersion(){this.setState({inProgress:!0});let e=await this.props.socket.upgradeOsPackages(this.props.hostId,[{name:`nodejs`}],!0);this.setState({inProgress:!1,success:e.success,error:e.error||``,finished:!0})}},Qe={ok:`#01bc69`,info:`#48b9ff`,warning:`#ffbd59`,error:`#ff5f72`},$e={ok:`Normal`,info:`Information`,warning:`Begrenzt`,error:`Störung`};function J(e,t=0){let n=Number(e);return Number.isFinite(n)?n:t}function Y(e,t=``){return(typeof e==`string`?e:typeof e==`number`||typeof e==`boolean`?String(e):t).replace(/\s+/g,` `).trim()||t}function et(e,t){if(e&&typeof e==`object`)return e;try{return JSON.parse(typeof e==`string`?e:``)}catch{return t}}function X(e,t){var n;return(n=e[t])==null?void 0:n.val}function Z(e){let t=J(e,0),n=t<0?`−`:``,r=Math.abs(t);return r>=1e3?`${n}${(r/1e3).toLocaleString(`de-DE`,{minimumFractionDigits:1,maximumFractionDigits:2})} kW`:`${n}${Math.round(r).toLocaleString(`de-DE`)} W`}function tt(e){let t=J(e,0);if(!t)return`noch kein Regeltick`;let n=Math.max(0,Math.round((Date.now()-t)/1e3));return n<2?`gerade eben`:n<60?`vor ${n} s`:`vor ${Math.round(n/60)} min`}function nt(e){let t=J(e,0);if(!t)return`—`;try{return new Date(t).toLocaleTimeString(`de-DE`,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}catch{return`—`}}function Q(e){let t=Y(e).toLowerCase();return t===`error`?`error`:t===`warning`||t===`warn`?`warning`:t===`ok`?`ok`:`info`}function rt(e,t){let n=new Set;for(let t of Object.keys(e||{})){let e=t.match(/^(eos-admin\.\d+)\.info\.adminOverview\./);e!=null&&e[1]&&n.add(e[1])}let r=[];for(let a of n){var i;let n=et(X(e,`${a}.info.adminOverview.summaryJson`),{}),o=et(X(e,`${a}.info.adminOverview.eventsJson`),[]),s=Math.max(J(n.updatedAt,0),J(n.generatedAt,0),J(X(e,`${a}.info.adminOverview.updatedAt`),0),J((i=e[`${a}.info.adminOverview.summaryJson`])==null?void 0:i.ts,0)),c=X(t,`system.adapter.${a}.alive`),l=c==null?null:c===!0||c===1||[`true`,`1`,`online`,`active`].includes(Y(c).toLowerCase());r.push({instance:a,alive:l,summary:{...n,status:Q(n.status||X(e,`${a}.info.adminOverview.status`)),headline:Y(n.headline||X(e,`${a}.info.adminOverview.headline`),`EMS-Diagnose wird aufgebaut`),reason:Y(n.reason||X(e,`${a}.info.adminOverview.reason`),``),binding:Y(n.binding||X(e,`${a}.info.adminOverview.binding`),`none`)},events:Array.isArray(o)?o:[],updatedAt:s})}return r.sort((e,t)=>{let n=e=>e===!0?2:+(e===null);return n(t.alive)-n(e.alive)||t.updatedAt-e.updatedAt||e.instance.localeCompare(t.instance)})}function it(e){let t=[],n=e.charging||{};n.available&&t.push({subsystem:`charging`,severity:J(n.faultCount,0)>0?`error`:J(n.waitingCount,0)>0?`info`:`ok`,title:`${J(n.activeCount,0)} lädt · ${J(n.waitingCount,0)} wartet · ${J(n.faultCount,0)} gestört`,reason:Y(n.limiterText||n.status,`Lademanagement aktiv`),details:`Ist ${Z(n.actualW)} · Soll ${Z(n.targetW)}`});let r=e.storage||{};return r.available&&t.push({subsystem:`storage`,severity:r.writeOk===!1?`error`:`ok`,title:`Speicher ${Y(r.topology,`aktiv`)}${r.socPct==null?``:` · SoC ${Math.round(J(r.socPct,0))} %`}`,reason:Y(r.reason,`Speicherregelung aktiv`),details:`Ist ${Z(r.actualW)} · Soll ${Z(r.targetW)}`}),t}function at({socket:e}){let[t,n]=L(null),[r,i]=L(!0),[a,o]=L(``),[s,c]=L(()=>Date.now()),u=de(async()=>{if(document.visibilityState===`visible`)try{let t=await e.getCurrentInstance();if(!/^eos-admin\.\d+$/.test(t))throw Error(`EOS-Instanz konnte nicht eindeutig ermittelt werden`);let[r,i]=await Promise.all([e.getForeignStates(`${t}.info.adminOverview.*`),e.getForeignStates(`system.adapter.${t}.alive`)]),a=rt(r||{},i||{});n(a[0]||null),o(``)}catch(e){o(Y(e==null?void 0:e.message,`EMS-Diagnose konnte nicht gelesen werden`))}finally{i(!1),c(Date.now())}},[e]);_e(()=>{u();let e=()=>{document.visibilityState===`visible`&&u()};document.addEventListener(`visibilitychange`,e);let t=window.setInterval(()=>void u(),5e3);return()=>{document.removeEventListener(`visibilitychange`,e),window.clearInterval(t)}},[u]);let d=String(window.NEXOWATT_EOS_ACCESS_ROLE||`unknown`).toLowerCase(),f=d===`admin`||d===`service`||d===`installer`||d===`installateur`,p=(t==null?void 0:t.summary)||{},m=t!=null&&t.updatedAt?Math.max(0,s-t.updatedAt):1/0,h=!!(t&&(t.alive===!1||m>2e4)),g=Q(p.status),_=h?`error`:g,ee=Qe[_],v=p.budget||{},y=p.charging||{},b=p.storage||{},x=p.ems||{},S=p.para14a||{},C=p.tariff||{},T=p.forecast||{},te=p.peakShaving||{},E=Math.max(0,J(v.totalW,0)),D=Math.max(0,J(v.remainingW,0)),O=E>0?Math.max(0,Math.min(100,D/E*100)):0,ne=be(()=>(Array.isArray(p.currentDecisions)?p.currentDecisions:it(p)).slice(0,f?5:2),[p,f]),k=f?((t==null?void 0:t.events)||[]).slice(0,6):[],A=[];return Y(p.binding,`none`)!==`none`&&A.push({label:`Bindend: ${Y(v.bindingText||p.binding)}`,warning:!0}),S.communicationFallbackActive?A.push({label:`§14a-Fallback ${Z(S.fallbackCapW)}`,warning:!0}):S.binding&&A.push({label:`§14a begrenzt`,warning:!0}),te.active&&A.push({label:`Peak-Shaving: ${Y(te.status,`aktiv`)}`,warning:!0}),C.available&&A.push({label:`Tarif: ${Y(C.state,`aktiv`)}${C.priceEurPerKwh==null?``:` · ${J(C.priceEurPerKwh).toFixed(3)} €/kWh`}`}),T.available&&A.push({label:`Prognose: ${Y(T.source,`aktiv`)}${T.fresh===!1?` · veraltet`:``}`,warning:T.fresh===!1}),(x.safetyActive||x.safetyEmergencyStop||x.safetyValid===!1)&&A.push({label:`EOS Safety aktiv`,warning:!0}),!t&&!r?w(`section`,{className:`eos-ems-overview-card`,"data-nexowatt-contract":`nexowatt-ems-overview-v1`,style:{"--eos-ems-status-color":Qe.info},children:[w(`header`,{className:`eos-ems-overview-header`,children:[w(`div`,{children:[l(`span`,{className:`eos-ems-overview-eyebrow`,children:`NexoWatt EMS`}),l(`h2`,{children:`Live-Diagnose`}),l(`p`,{children:a||`Die integrierte EMS-Laufzeit startet oder die Diagnosewerte sind derzeit nicht verfügbar.`})]}),w(`div`,{className:`eos-ems-overview-state`,children:[l(`span`,{className:`eos-ems-overview-state-dot`}),l(`strong`,{children:`Nicht verfügbar`}),l(`small`,{children:`read-only`})]})]}),w(`footer`,{className:`eos-ems-overview-footer`,children:[l(`span`,{children:`Diagnose ist rein lesend.`}),l(`span`,{children:`Keine EMS-Regelung wurde verändert.`})]})]}):w(`section`,{className:`eos-ems-overview-card`,"data-nexowatt-contract":`nexowatt-ems-overview-v1`,style:{"--eos-ems-status-color":ee},children:[w(`header`,{className:`eos-ems-overview-header`,children:[w(`div`,{children:[l(`span`,{className:`eos-ems-overview-eyebrow`,children:`NexoWatt EMS · Live-Diagnose`}),l(`h2`,{children:r?`EMS-Diagnose wird geladen …`:h?`EMS-Diagnose ist nicht aktuell`:Y(p.headline,`EMS arbeitet normal`)}),l(`p`,{children:h?`Adapter oder Diagnosewerte sind älter als 20 Sekunden. Die dargestellten Werte dürfen nicht als aktuelle Regelentscheidung verwendet werden.`:Y(p.reason,`EMS arbeitet innerhalb aller aktiven Grenzen.`)})]}),w(`div`,{className:`eos-ems-overview-state`,children:[l(`span`,{className:`eos-ems-overview-state-dot`}),l(`strong`,{children:h?`Offline / veraltet`:$e[_]}),w(`small`,{children:[(t==null?void 0:t.instance)||`eos-admin`,` · `,tt(t==null?void 0:t.updatedAt)]})]})]}),w(`div`,{className:`eos-ems-overview-metrics`,children:[w(`div`,{className:`eos-ems-overview-metric`,children:[l(`span`,{children:`EMS-Budget`}),l(`strong`,{children:E>0?Z(E):`nicht begrenzt`}),w(`small`,{children:[`Rest `,Z(D)]})]}),w(`div`,{className:`eos-ems-overview-metric`,children:[l(`span`,{children:`Lademanagement`}),w(`strong`,{children:[Z(y.actualW),` / `,Z(y.targetW)]}),w(`small`,{children:[J(y.activeCount),` lädt · `,J(y.waitingCount),` wartet`]})]}),b.available?w(`div`,{className:`eos-ems-overview-metric`,children:[w(`span`,{children:[`Speicher `,Y(b.topology,``)]}),w(`strong`,{children:[Z(b.actualW),` / `,Z(b.targetW)]}),l(`small`,{children:b.socPct==null?Y(b.reason,`aktiv`):`SoC ${Math.round(J(b.socPct))} %`})]}):w(`div`,{className:`eos-ems-overview-metric`,children:[l(`span`,{children:`PV-Budget`}),l(`strong`,{children:Z(v.pvBudgetW)}),w(`small`,{children:[`PV-Rest `,Z(v.remainingPvW)]})]}),w(`div`,{className:`eos-ems-overview-metric`,children:[l(`span`,{children:`Letzter Regeltick`}),l(`strong`,{children:tt(x.lastTickTs||(t==null?void 0:t.updatedAt))}),l(`small`,{children:f?`Zyklus ${J(x.cycleMs)} ms`:Y(x.decision,`EMS aktiv`)})]})]}),E>0?l(`div`,{className:`eos-ems-overview-budget`,title:`${O.toFixed(1)} % Restbudget`,children:l(`span`,{style:{width:`${O}%`}})}):null,A.length?l(`div`,{className:`eos-ems-overview-tags`,children:A.map(e=>l(`span`,{className:e.warning?`is-warning`:``,children:e.label},e.label))}):null,w(`div`,{className:`eos-ems-overview-columns`,children:[w(`div`,{className:`eos-ems-overview-panel`,children:[l(`h3`,{children:`Aktuelle Regelentscheidungen`}),ne.length?ne.map((e,t)=>w(`div`,{className:`eos-ems-overview-decision eos-ems-overview-decision--${Q(e.severity)}`,children:[l(`strong`,{children:Y(e.title,`EMS-Entscheidung`)}),l(`span`,{children:Y(e.reason,`Keine zusätzliche Begrenzung`)}),f&&e.details?l(`small`,{children:e.details}):null]},`${e.subsystem||`ems`}-${t}`)):l(`div`,{className:`eos-ems-overview-empty`,children:`Keine aktiven Regelentscheidungen. EOS arbeitet mit den aktuellen Messwerten.`})]}),w(`div`,{className:`eos-ems-overview-panel`,children:[l(`h3`,{children:f?`Letzte EMS-Ereignisse`:`Systemerklärung`}),f?k.length?k.map((e,t)=>w(`div`,{className:`eos-ems-overview-event eos-ems-overview-event--${Q(e.severity)}`,children:[l(`time`,{children:nt(e.ts)}),w(`div`,{children:[l(`strong`,{children:Y(e.title,`EMS`)}),l(`span`,{children:Y(e.message||e.reason,`Zustand aktualisiert`)})]})]},e.id||`${e.ts}-${t}`)):l(`div`,{className:`eos-ems-overview-empty`,children:`Noch keine Zustandsänderung im begrenzten Ereignispuffer.`}):w(`div`,{className:`eos-ems-overview-decision eos-ems-overview-decision--info`,children:[l(`strong`,{children:Y(p.headline,`EMS aktiv`)}),l(`span`,{children:Y(p.reason,`EOS optimiert die Anlage innerhalb aller Sicherheitsgrenzen.`)})]})]})]}),l(`footer`,{className:`eos-ems-overview-footer`,children:l(`span`,{children:`Diagnose ist rein lesend. Keine Kachel besitzt Schreibhoheit.`})})]})}Ve(),o(),Ue();var $={button:{position:`absolute`,bottom:16,right:16},saveButton:e=>({backgroundColor:e.palette.success.main,right:80,"&:hover":{backgroundColor:e.palette.success.dark}}),addButton:e=>({backgroundColor:e.palette.secondary.main,right:144,"&:hover":{backgroundColor:e.palette.secondary.dark}}),closeButton:e=>({backgroundColor:e.palette.error.main,"&:hover":{backgroundColor:e.palette.error.dark}}),hostOffline:e=>({color:e.palette.error.main,fontWeight:500}),updateExists:{color:`#c28700`,marginRight:4},updateNo:{color:`#00b204`,marginRight:4},nodeUpdate:{opacity:.6},instanceNumber:{opacity:.6,fontWeight:500},hostStats:{display:`grid`,gridTemplateColumns:`auto minmax(0, 1fr)`,columnGap:`10px`,rowGap:`3px`,alignItems:`baseline`},hostStatLabel:e=>({color:e.palette.text.disabled,whiteSpace:`nowrap`}),hostStatValue:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},hostInfoStats:{display:`grid`,gridTemplateColumns:`auto auto minmax(0, 1fr)`,columnGap:`12px`,rowGap:`6px`,alignItems:`center`},hostInfoIcon:e=>({display:`flex`,alignItems:`center`,color:e.palette.text.disabled,fontSize:18,"& svg":{fontSize:18}}),hostInfoValue:{overflowWrap:`anywhere`},diskValue:{display:`flex`,alignItems:`center`,gap:`8px`},diskBar:{flex:`1 1 auto`,minWidth:60,maxWidth:160,height:8,borderRadius:4},diskText:{whiteSpace:`nowrap`},updateIcon:{cursor:`pointer`,fontSize:16},tooltip:{pointerEvents:`none`},cards:{alignContent:`flex-start`,width:`100%`,pt:`12px`,px:`8px`,pb:`64px`}},ot={Uptime:H.formatSeconds,"System uptime":H.formatSeconds,RAM:H.formatRam,Speed:H.formatSpeed,"Disk size":H.formatBytes,"Disk free":H.formatBytes,timeOffset:e=>{let t=Math.abs(e),n=Math.floor(t/60),r=t%60;return`UTC${e>0?`-`:`+`}${n}${r?`:${r.toString().padStart(2,`0`)}`:``}`}};function st(e,t,n){let r=typeof t==`number`?t:new Date().getTimezoneOffset(),i=new Date(e-r*6e4);try{return i.toLocaleString(n===`zh-cn`?`zh-CN`:n,{timeZone:`UTC`})}catch{return i.toUTCString().replace(` GMT`,``)}}function ct(e){return e&&e[0].toUpperCase()+e.substring(1)}function lt(e){let t=e.toLowerCase();return t.includes(`darwin`)||t.includes(`osx`)||t.includes(`mac`)?l(u,{}):t.includes(`win`)?l(ae,{}):t.includes(`bsd`)?l(T,{}):t.includes(`linux`)||t.includes(`docker`)||t.includes(`android`)?l(S,{}):l(we,{})}function ut(t,n){switch(t){case`Platform`:case`os`:return lt(`${n.Platform||``} ${n.os||``}`);case`Architecture`:return l(Ee,{});case`CPUs`:case`Model`:return l(O,{});case`Speed`:return l(De,{});case`RAM`:return l(ze,{});case`System uptime`:return l(Oe,{});case`Uptime`:return l(ke,{});case`Node.js`:return l(s,{});case`NPM`:return l(p,{});case`time`:return l(Me,{});case`timeOffset`:return l(re,{});case`adapters count`:return l(Ae,{});case`Disk size`:case`Disk free`:return l(Ne,{});case`Active instances`:return l(Ce,{});case`location`:return l(Se,{});case`alive`:case`active`:return n[t]?l(Be,{color:`success`}):l(e,{color:`error`});default:return null}}var dt=new WeakMap,ft=new WeakMap,pt=new WeakMap,mt=class e extends ge.Component{constructor(t){super(t),We(this,dt,18e5),We(this,ft,3e5),We(this,pt,6e4),x(this,`introLinksOriginal`,void 0),x(this,`deactivatedOriginal`,void 0),x(this,`remoteAccess`,null),x(this,`t`,void 0),x(this,`getDataTimeout`,void 0),x(this,`updateHostsAlive`,async t=>{let n=JSON.parse(JSON.stringify(this.state.alive)),r=[];if(t.find(e=>e.type===`deleted`))this.getDataDelayed();else if(t.forEach(e=>{!!n[e.id]!=!!e.alive&&(n[e.id]=e.alive,r.push(e.id))}),r.length){let t=JSON.parse(JSON.stringify(this.state.hostsData)),i=new Map(this.state.hostDataTimestampMap),a=Date.now();(await Promise.all(r.map(e=>this.getHostData(e,n[e])))).forEach(n=>{t[n.id]=e.preprocessHostData(n.data),i.set(n.id,a)}),this.setState({alive:n,hostsData:t,hostDataTimestampMap:i},()=>this.checkBackendTime())}}),x(this,`updateHosts`,t=>{let n=[];if(t.find(e=>!e.obj))this.getDataDelayed();else if(n=t.map(e=>e.id),n.length){let t=JSON.parse(JSON.stringify(this.state.hostsData)),r=new Map(this.state.hostDataTimestampMap),i=Date.now();Promise.all(n.map(e=>this.getHostData(e))).then(n=>{n.forEach(n=>{t[n.id]=e.preprocessHostData(n.data),r.set(n.id,i)}),this.setState({hostsData:t,hostDataTimestampMap:r})})}}),x(this,`getDataDelayed`,e=>{this.getDataTimeout&&clearTimeout(this.getDataTimeout),this.getDataTimeout=setTimeout(()=>{this.getDataTimeout=void 0,this.getData(!0).catch(e=>console.error(`Cannot get data: ${e}`))},300)}),this.state={instances:null,deactivated:[],edit:!1,link:null,introLinks:[],editLink:!1,editLinkIndex:-1,openSnackBar:!1,hasUnsavedChanges:!1,reverseProxy:null,alive:{},hostsData:{},hosts:null,hostTimeDiffMap:new Map,hostDataTimestampMap:new Map,nodeUpdateSupported:!1,nodeUpdateDialog:null},this.t=t.t}checkBackendTime(){let e=this.state.hostTimeDiffMap,t=this.state.hostDataTimestampMap,n=Date.now();for(let[r,i]of Object.entries(this.state.hostsData)){let a=Math.abs(i.time-n);e.set(r,a),t.set(r,n)}this.setState({hostTimeDiffMap:e,hostDataTimestampMap:t})}async componentDidMount(){let e=window;e.NEXOWATT_EOS_ADMIN_SOCKET=this.props.socket,e.NEXOWATT_EOS_SOCKET=this.props.socket,window.dispatchEvent(new CustomEvent(`nexowatt-eos-admin-socket-ready`));let t=[],n=!1;try{var r;let[e,i]=await Promise.all([this.props.socket.getObject(`system.adapter.${this.props.adminInstance}`),this.props.socket.checkFeatureSupported(`CONTROLLER_OS_PACKAGE_UPGRADE`)]);t=(e==null||(r=e.native)==null?void 0:r.reverseProxy)||[],n=i}catch(e){if(String(window.NEXOWATT_EOS_ACCESS_ROLE||`unknown`).toLowerCase()===`admin`)throw e}await new Promise(e=>this.setState({reverseProxy:t,nodeUpdateSupported:n},()=>e())),await this.getData(),this.props.instancesWorker.registerHandler(this.getDataDelayed),this.props.hostsWorker.registerHandler(this.updateHosts),this.props.hostsWorker.registerAliveHandler(this.updateHostsAlive),this.checkBackendTime()}componentWillUnmount(){this.getDataTimeout&&=(clearTimeout(this.getDataTimeout),void 0),this.props.instancesWorker.unregisterHandler(this.getDataDelayed),this.props.hostsWorker.unregisterHandler(this.updateHosts),this.props.hostsWorker.unregisterAliveHandler(this.updateHostsAlive)}async activateEditMode(){var e;let t=await this.props.socket.getSystemConfig(!0),n=await this.getInstances(!0,null,t),r=t!=null&&(e=t.native)!=null&&e.introLinks?t.native.introLinks:[];this.introLinksOriginal=JSON.stringify(r),this.deactivatedOriginal=JSON.parse(JSON.stringify(n.deactivated)),this.setState({instances:n.instances,deactivated:n.deactivated,edit:!0,introLinks:r,hasUnsavedChanges:!1})}deactivateEditMode(){this.state.hasUnsavedChanges,this.setState({deactivated:this.deactivatedOriginal||null,introLinks:JSON.parse(this.introLinksOriginal||`[]`),hasUnsavedChanges:!1,edit:!1},()=>{this.deactivatedOriginal=void 0,this.introLinksOriginal=void 0})}toggleCard(e,t){if(!this.state.instances||!this.state.instances.length)return;let n=JSON.parse(JSON.stringify(this.state.deactivated)),r=n.indexOf(`${e}_${t}`);r===-1?(n.push(`${e}_${t}`),n.sort()):n.splice(r,1);let i=JSON.stringify(n)!==JSON.stringify(this.deactivatedOriginal)||JSON.stringify(this.state.introLinks)!==this.introLinksOriginal;this.setState({deactivated:n,hasUnsavedChanges:i})}getInstancesCards(){return(this.state.instances||[]).map(e=>{var t;let n=`${e.id}_${e.linkName}`,r=String(window.NEXOWATT_EOS_ACCESS_ROLE||`unknown`).toLowerCase(),i=r===`admin`||r===`service`;if(!i&&/^(?:admin|xterm)(?:\.|$)/i.test(e.id))return null;let a=i&&/^(?:admin|xterm)(?:\.|$)/i.test(e.id)||!((t=this.state.deactivated)!=null&&t.includes(n));if(a||this.state.edit){let t=``;if(e.link)try{t=new URL(e.link,window.location.href).host}catch{t=e.link.replace(/^https?:\/\//,``).split(`/`)[0]}if(e.id===this.props.adminInstance)return null;let n=window.isFinite(e.id.split(`.`).pop());if(n){var o;n=!!((o=this.state.instances)!=null&&o.find(t=>t.id!==e.id&&e.name===t.name&&e.id.split(`.`)[0]===t.id.split(`.`)[0]))}let r=this.state.hostsData?this.state.hostsData[e.id]:null,i;e.info&&(i=r&&typeof r==`object`?r.alive===!1?`offline`:`online`:`unknown`);let s=this.state.hostTimeDiffMap.get(e.id)??0,c=this.state.hostDataTimestampMap.get(e.id)??0,u=Date.now()-c<Ge(ft,this);return l(W,{image:e.image||``,title:w(E,{children:[e.name,n?w(`span`,{style:$.instanceNumber,children:[`.`,e.id.split(`.`).pop()]}):null]}),action:{link:e.link||``,text:t},t:this.props.t,lang:this.props.lang,color:e.color||``,showInfo:!!e.info,status:i,edit:this.state.edit,offline:!!r&&r.alive===!1,warning:s>Ge(dt,this)&&u?this.t(`Backend time differs by %s minutes`,Math.round(s/Ge(pt,this)).toString()):void 0,enabled:a,unreachable:!!e.unreachable,disabled:!r||typeof r!=`object`,getHostDescriptionAll:()=>this.getHostDescriptionAll(e.id),toggleActivation:()=>this.toggleCard(e.id,e.linkName||``),openSnackBarFunc:()=>this.setState({openSnackBar:!0}),theme:this.props.theme,children:e.description||this.getHostDescription(e.id)},`${e.id}_${e.link}`)}return null})}toggleLinkCard(e){let t=JSON.parse(JSON.stringify(this.state.introLinks));t[e].enabled=!t[e].enabled;let n=JSON.stringify(this.state.deactivated)!==JSON.stringify(this.deactivatedOriginal)||JSON.stringify(t)!==this.introLinksOriginal;this.setState({introLinks:t,hasUnsavedChanges:n})}getLinkCards(){return(this.state.introLinks||[]).map((e,t)=>!e.enabled&&!this.state.edit?null:e.camera===`custom`?l(Ye,{image:e.image,title:e.name,action:{link:e.link,text:e.linkName},t:this.props.t,socket:this.props.socket,color:e.color,edit:this.state.edit,interval:e.interval,camera:e.camera,addTs:e.addTs,onEdit:()=>{var e;return this.setState({editLink:!0,editLinkIndex:t,link:JSON.parse(JSON.stringify((e=this.state.introLinks)==null?void 0:e[t]))})},onRemove:()=>{let e=JSON.parse(JSON.stringify(this.state.introLinks));e.splice(t,1);let n=JSON.stringify(this.state.deactivated)!==JSON.stringify(this.deactivatedOriginal)||JSON.stringify(e)!==this.introLinksOriginal;this.setState({introLinks:e,hasUnsavedChanges:n})},enabled:e.enabled,lang:this.props.lang,toggleActivation:()=>this.toggleLinkCard(t),cameraUrl:e.desc,theme:this.props.theme},`link${t}`):l(W,{image:e.image,title:e.name,action:{link:e.link,text:e.linkName},t:this.props.t,color:e.color,edit:this.state.edit,onEdit:()=>{var e;return this.setState({editLink:!0,editLinkIndex:t,link:JSON.parse(JSON.stringify((e=this.state.introLinks)==null?void 0:e[t]))})},onRemove:()=>{let e=JSON.parse(JSON.stringify(this.state.introLinks));e.splice(t,1);let n=JSON.stringify(this.state.deactivated)!==JSON.stringify(this.deactivatedOriginal)||JSON.stringify(e)!==this.introLinksOriginal;this.setState({introLinks:e,hasUnsavedChanges:n})},enabled:e.enabled,lang:this.props.lang,toggleActivation:()=>this.toggleLinkCard(t),theme:this.props.theme,children:e.desc||``},`link${t}`))}editLinkCard(){return this.state.editLink?l(Xe,{link:this.state.link,socket:this.props.socket,isNew:this.state.editLinkIndex===-1,t:this.props.t,lang:this.props.lang,theme:this.props.theme,onClose:e=>{if(e){let t=JSON.parse(JSON.stringify(this.state.introLinks));this.state.editLinkIndex===-1?(e.enabled=!0,t.push(e)):(e.enabled=t[this.state.editLinkIndex].enabled,t[this.state.editLinkIndex]=e);let n=JSON.stringify(this.state.deactivated)!==JSON.stringify(this.deactivatedOriginal)||JSON.stringify(t)!==this.introLinksOriginal;this.setState({introLinks:t,editLink:!1,hasUnsavedChanges:n,link:null})}else this.setState({editLink:!1})}}):null}getButtons(){let e=[];return this.state.edit?(e.push(l(v,{color:`primary`,size:`small`,sx:A.getStyle(this.props.theme,$.button,$.addButton),onClick:()=>this.setState({editLink:!0,editLinkIndex:-1,link:{}}),children:l(i,{})},`add`)),e.push(l(v,{size:`small`,color:`primary`,disabled:!this.state.hasUnsavedChanges,sx:A.getStyle(this.props.theme,$.button,$.saveButton),onClick:()=>this.saveCards(),children:l(D,{})},`save`)),e.push(l(v,{size:`small`,color:`primary`,sx:A.getStyle(this.props.theme,$.button,$.closeButton),onClick:()=>this.deactivateEditMode(),children:l(f,{})},`close`))):e.push(l(v,{color:`primary`,size:`small`,style:$.button,onClick:()=>this.activateEditMode(),children:l(Te,{})},`edit`)),e}async saveCards(){let e=await this.props.socket.getSystemConfig(!0),t=!1;JSON.stringify(e.common.intro)!==JSON.stringify(this.state.deactivated)&&(e.common.intro=this.state.deactivated||void 0,t=!0),!t&&JSON.stringify(e.native.introLinks)!==JSON.stringify(this.state.introLinks)&&(t=!0,e.native.introLinks=this.state.introLinks),t?this.props.socket.setSystemConfig(e).then(()=>this.props.showAlert(`Updated`,`success`)).catch(e=>{console.log(e),this.props.showAlert(e,`error`)}).then(()=>this.setState({edit:!1})):this.setState({edit:!1})}async getHostData(e,t){let n;if(t!==void 0)n={val:t};else try{n=await this.props.socket.getState(`${e}.alive`)}catch(t){console.error(`Cannot get state ${e}.alive: ${t}`),n={val:!1}}let r={alive:!1};if(n!=null&&n.val)try{r=await this.props.socket.getHostInfo(e,!1,1e4),r&&typeof r==`object`&&r.alive!==!1&&(r.alive=!0)}catch(t){console.error(`Cannot get host info for ${e}: ${t}`),r={alive:!1}}else r={alive:!1};let i=await this.props.socket.getForeignStates(`${e}.versions.*`);return Object.keys(i).forEach(e=>r[`_${e.split(`.`).pop()}`]=i[e].val),{id:e,data:r}}async getHostsData(t){let n=t.map(e=>this.getHostData(e._id)),r=await Promise.all(n),i={},a={},o=new Map(this.state.hostDataTimestampMap),s=Date.now();return r.forEach(t=>{i[t.id]=e.preprocessHostData(t.data),a[t.id]=!!t.data.alive,o.set(t.id,s)}),this.setState({hostDataTimestampMap:o}),{hostsData:i,alive:a}}addLinks(e,t,n,r,i,a){let o={id:e.id,name:e.name,description:e.description,color:e.color,image:e.icon,info:``},s=Fe(e.link,t.name,n,{instances:r,hostname:this.props.hostname,adminInstance:this.props.adminInstance,hosts:i}),c=this.state.reverseProxy,l=null;if(c!=null&&c.length){let e=window.location.pathname;l=c.find(t=>{if(!t.globalPath)return!1;let n=t.globalPath.endsWith(`/`)?t.globalPath:`${t.globalPath}/`;return e===n||e.startsWith(n)})||null}if(s.length>1&&(s.sort((e,t)=>(e.instance||``).localeCompare(t.instance||``,void 0,{numeric:!0})),s.splice(1)),s.length){if(o.link=s[0].url,o.port=s[0].port,this.remoteAccess){let e=Re(o.link,o.port,this.remoteAccess);e===null?o.unreachable=!0:o.link=e}else o.link=Pe(o.link,o.id,r,l)||o.link;let i=He(e.link,t.name,n,this.props.adminInstance,window.location.href);i&&(o.link=i,o.port=void 0,o.unreachable=!1);let c=a.find(e=>e.link===o.link);c?Le(o.link,t.name,c.id.split(`.`)[0])?a[a.indexOf(c)]=o:console.log(`Double links: "${o.id}" and "${c.id}"`):a.push(o)}}static getText(e,t){return e?typeof e==`object`?e[t]||e.en||``:e||``:``}static normalizeLinks(t,n,r){if(!t.common.localLinks&&!t.common.localLink&&!t.common.welcomeScreen&&!t.common.welcomeScreenPro)return null;let i={id:t._id.replace(`system.adapter.`,``),link:``,name:e.getText(t.common.titleLang||t.common.title||t.common.name,n),order:t.common.order||1e3,intro:!0,description:e.getText(t.common.desc,n),icon:t.common.icon?`adapter/${t.common.name}/${t.common.icon}`:`img/no-image.svg`},a=[];if(t.common.localLink){if(typeof t.common.localLink==`string`)a.push({...i,link:t.common.localLink});else{let e=t.common.localLink;if(e.link){let t={...i,link:e.link};e.color&&(t.color=e.color),e.order!==void 0&&typeof e.order==`number`&&(t.order=e.order),e.icon&&e.img&&(t.icon=e.icon||e.img),a.push(t)}else console.warn(`Unknown localLink structure: ${JSON.stringify(t.common.localLink)}`)}}let o=t.common.localLinks;if(o&&typeof o==`object`&&Object.keys(o).forEach(r=>{let s=o[r];if(typeof s==`string`)a.push({...i,link:s});else{let o=s;if(o.link){let s={...i,id:t._id.replace(`system.adapter.`,``)+(r===`_default`?``:` ${r}`),link:o.link,name:i.name+(r===`_default`?``:` ${r}`)};o.color&&(s.color=o.color),o.order!==void 0&&(s.order=parseInt(o.order,10)||1e3),o.icon&&o.img&&(s.icon=o.icon||o.img),o.description&&(s.description=e.getText(o.description,n)),o.pro!==void 0&&(s.pro=typeof o.pro==`string`?o.pro:`${t.common.name}/index.html`),o.cloud!==void 0&&(s.cloud=o.cloud),o.intro!==void 0&&(s.intro=o.intro===!0),o.name&&(s.name=e.getText(o.name,n)),r===`_default`&&(s.default=!0),a.push(s)}else console.warn(`Unknown localLinks structure: ${JSON.stringify(s)}`)}}),t.common.welcomeScreen&&typeof t.common.welcomeScreen==`object`&&((Array.isArray(t.common.welcomeScreen)?t.common.welcomeScreen:[t.common.welcomeScreen]).forEach(r=>{if(r.link){let s={...i,id:`${t._id.replace(`system.adapter.`,``)} cloud`,link:`%web_protocol%://%web_bind%:%web_port%/${r.link}`,cloud:r.link};if(r.color&&(s.color=r.color),r.order!==void 0&&typeof r.order==`number`&&(s.order=r.order),r.icon&&r.img&&(s.icon=r.icon||r.img),r.localLinks){var o;let e=(o=t.common.localLinks)==null?void 0:o[r.localLinks];e&&typeof e==`string`?s.link=e:e&&typeof e==`object`&&e.link&&(s.link=e.link)}r.name&&(s.name=e.getText(r.name,n)),a.push(s)}}),t.common.welcomeScreenPro&&typeof t.common.welcomeScreenPro==`object`&&(Array.isArray(t.common.welcomeScreenPro)?t.common.welcomeScreenPro:[t.common.welcomeScreenPro]).forEach(r=>{if(r.link){let s={...i,id:`${t._id.replace(`system.adapter.`,``)} pro`,link:`%web_protocol%://%web_bind%:%web_port%/${r.link}`,pro:r.link};if(r.color&&(s.color=r.color),r.order!==void 0&&typeof r.order==`number`&&(s.order=r.order),r.icon&&r.img&&(s.icon=r.icon||r.img),r.localLinks){var o;let e=(o=t.common.localLinks)==null?void 0:o[r.localLinks];e&&typeof e==`string`?s.link=e:e&&typeof e==`object`&&e.link&&(s.link=e.link)}r.name&&(s.name=e.getText(r.name,n)),a.push(s)}})),a.forEach(e=>{e.icon.startsWith(`adapter/`)||e.icon.startsWith(`data:image/`)||e.icon.startsWith(`http://`)||e.icon.startsWith(`https://`)||e.icon===`img/no-image.svg`||(e.icon=`adapter/${t.common.name}/${e.icon}`)}),r){let e={};a.forEach(t=>{e[t.link]?(t.color&&(e[t.link].color=t.color),t.icon&&(e[t.link].icon=t.icon),t.cloud&&(e[t.link].cloud=t.cloud),t.pro&&(e[t.link].pro=t.pro),t.intro!==void 0&&(e[t.link].intro=t.intro),t.name&&typeof t.name==`object`&&(e[t.link].name=t.name),t.order!==void 0&&(e[t.link].order=t.order),t.default&&(e[t.link].default=t.default)):e[t.link]=t}),a=Object.values(e)}return a.sort((e,t)=>e.default===void 0&&t.default===void 0?e.order===void 0&&t.order===void 0?0:e.order===void 0?-1:t.order===void 0?1:e.order-t.order:e.default===void 0?-1:t.default===void 0?1:e.order===void 0&&t.order===void 0?0:e.order===void 0?-1:t.order===void 0?1:e.order-t.order),a}async getInstances(t,n,r){n=n||this.state.hosts||[];let i={};n.forEach(e=>i[e._id]=e);try{let a=await this.props.socket.getAdapterInstances(``,t),o=r.common.intro||[];Array.isArray(o)||(o=Object.keys(o),o.sort());let s=[],c={};a.forEach(e=>c[e._id]=e),this.remoteAccess=Ie(c,window.location),a.forEach(t=>{if(!t)return;let n=t.common||null,r=t._id.split(`.`),a=parseInt(r.pop()||``,10),o;if(n!=null&&n.name&&typeof n.name==`object`){let e=n==null?void 0:n.name;o=e[this.props.lang]||e.en}else o=(n==null?void 0:n.name)||``;if((o!==`admin`||n.localLink!==(this.props.hostname||``))&&o!==`web`&&!(o&&o!==`vis-web-admin`&&o.match(/^vis-/)&&o!==`vis-2`)&&!(o!=null&&o.match(/^icons-/))&&n&&(n.enabled||n.onlyWWW)){let r=e.normalizeLinks(t,this.props.lang,!0);r&&r.forEach(e=>this.addLinks(e,n,a,c,i,s))}}),s.forEach(e=>{e.link&&(e.linkName=e.link.replace(`https://`,``).replace(`http://`,``).replace(/^[^_]+:/,``))}),s.sort((e,t)=>{if(e.order!==void 0||t.order!==void 0){if(e.order=e.order===void 0?1e3:e.order,t.order=t.order===void 0?1e3:t.order,e.order<t.order)return-1;if(e.order>t.order)return 1}return e.id>t.id?1:e.id<t.id?-1:0}),n==null||n.forEach(e=>{let t=e==null?void 0:e.common,n=t==null?void 0:t.name;if(typeof n==`object`&&(n&&=n[this.props.lang]||n.en),t){let r={id:e._id,name:n||``,color:``,image:t.icon||`img/no-image.svg`,info:this.t(`Info`),linkName:``};s.push(r)}});let l=[];return o.forEach(e=>{s.find(t=>e===`${t.id}_${t.linkName}`)&&l.push(e)}),o=l,{instances:s,deactivated:o}}catch(e){return console.log(e),{instances:[],deactivated:[]}}}getHostDescription(e){let t=this.state.hostsData?this.state.hostsData[e]:null;if(t&&t.alive===!1)return l(j,{sx:$.hostOffline,children:this.props.t(`Offline`)});let n=``,r=``;if(t){try{t._nodeNewest&&t[`Node.js`]&&B.gt(t._nodeNewest,t[`Node.js`].replace(/^v/,``))&&(n=t._nodeNewest)}catch{}try{t._nodeNewest!==t._nodeNewestNext&&t._nodeNewestNext&&t[`Node.js`]&&t._nodeNewest&&B.gt(t._nodeNewestNext,t[`Node.js`].replace(/^v/,``))&&B.gt(t._nodeNewestNext,t._nodeNewest)&&(n+=(n?` / `:``)+t._nodeNewestNext)}catch{}if(n){let r=this.state.nodeUpdateSupported&&t.Platform===`linux`;n=l(R,{title:this.props.t(`Some updates available`),slotProps:{popper:{sx:$.tooltip}},children:w(`span`,{style:{...$.nodeUpdate,display:`inline-flex`},children:[`(`,n,`)`,r?l(ye,{style:$.updateIcon,onClick:()=>this.setState({nodeUpdateDialog:{hostId:e,version:t._nodeNewestNext}})}):null]})})}try{t._npmNewest&&t.NPM&&B.gt(t._npmNewest,t.NPM)&&(r=t._npmNewest)}catch{}try{t._npmNewest!==t._npmNewestNext&&t._npmNewestNext&&t.NPM&&t._npmNewest&&B.gt(t._npmNewestNext,t.NPM)&&B.gt(t._npmNewestNext,t._npmNewest)&&(r+=(r?` / `:``)+t._npmNewestNext)}catch{}r&&=l(R,{title:this.props.t(`Some updates available`),slotProps:{popper:{sx:$.tooltip}},children:w(`span`,{style:$.nodeUpdate,children:[`(`,r,`)`]})})}return t&&typeof t==`object`?w(j,{sx:$.hostStats,children:[l(j,{sx:$.hostStatLabel,children:this.t(`Platform`)}),l(j,{sx:$.hostStatValue,title:t.Platform||``,children:t.Platform||`--`}),l(j,{sx:$.hostStatLabel,children:this.t(`RAM`)}),l(j,{sx:$.hostStatValue,children:ot.RAM(t.RAM)}),l(j,{sx:$.hostStatLabel,children:this.t(`Node.js`)}),w(j,{sx:$.hostStatValue,children:[l(`span`,{style:n?$.updateExists:$.updateNo,children:t[`Node.js`]||`--`}),n]}),l(j,{sx:$.hostStatLabel,children:this.t(`NPM`)}),w(j,{sx:$.hostStatValue,children:[l(`span`,{style:r?$.updateExists:$.updateNo,children:t.NPM||`--`}),r]})]}):w(j,{sx:$.hostStats,children:[l(I,{width:60}),l(I,{}),l(I,{width:60}),l(I,{}),l(I,{width:60}),l(I,{}),l(I,{width:60}),l(I,{})]})}renderDiskRow(e){let t=e[`Disk size`],n=e[`Disk free`],r=t>0?Math.max(0,Math.min(100,n/t*100)):0,i=`${H.formatBytes(n)} / ${H.formatBytes(t)}`,a=r<10?`error`:r<25?`warning`:`success`;return{name:`Disk free`,text:i,value:w(j,{sx:$.diskValue,children:[l(R,{title:`${Math.round(r)}% ${this.t(`Free`)}`,slotProps:{popper:{sx:$.tooltip}},children:l(ie,{variant:`determinate`,value:r,color:a,sx:$.diskBar})}),l(j,{component:`span`,sx:$.diskText,children:i})]})}}renderHostInfoRow(e,t){let n=t[e];return e===`time`?{name:e,text:st(n,t.timeOffset,this.props.lang)}:typeof n==`boolean`?{name:e,text:n?this.t(`Yes`):this.t(`No`)}:ot[e]?{name:e,text:ot[e](n,this.t)||`--`}:typeof n==`object`?{name:e,text:JSON.stringify(n)}:{name:e,text:n.toString()||`--`}}getHostDescriptionAll(e){let t=this.state.hostsData&&typeof this.state.hostsData[e]==`object`?this.state.hostsData[e]:null,n=[];if(t){for(let e of Object.keys(t))if(!(e.startsWith(`_`)||t[e]===null||t[e]===void 0)){if(e===`Disk size`&&typeof t[`Disk free`]==`number`)n.push(this.renderDiskRow(t));else if(e===`Disk free`&&typeof t[`Disk size`]==`number`)continue;else n.push(this.renderHostInfoRow(e,t))}}return{el:l(j,{sx:$.hostInfoStats,children:n.map(e=>w(ge.Fragment,{children:[l(j,{sx:$.hostInfoIcon,children:ut(e.name,t||{})}),l(j,{sx:$.hostStatLabel,children:ct(this.t(e.name))}),l(j,{sx:$.hostInfoValue,children:e.value??e.text})]},e.name))}),text:n.map(e=>`${ct(this.t(e.name))}: ${e.text}`).join(`
2
2
  `)}}async getData(e){try{let t=await this.props.socket.getSystemConfig(e),n=await this.props.socket.getCompactHosts(e),r=await this.getInstances(e,n,t);this.setState({instances:r.instances,hosts:n,deactivated:r.deactivated,introLinks:t&&t.native&&t.native.introLinks?t.native.introLinks:[]});let i=await this.getHostsData(n);await new Promise(e=>{this.setState(i,()=>e())})}catch(t){if(String(window.NEXOWATT_EOS_ACCESS_ROLE||`unknown`).toLowerCase()!==`admin`){try{let t=await this.getInstances(e,[],{common:{intro:[]},native:{introLinks:[]}});this.setState({instances:t.instances,hosts:[],deactivated:t.deactivated,introLinks:[],hostsData:{},alive:{}})}catch{this.setState({instances:[],hosts:[],deactivated:[],introLinks:[],hostsData:{},alive:{}})}return}window.alert(`Cannot get data: ${t}`)}}renderCopiedToast(){return l(se,{anchorOrigin:{vertical:`bottom`,horizontal:`left`},open:this.state.openSnackBar,autoHideDuration:3e3,onClose:()=>this.setState({openSnackBar:!1}),message:this.t(`copied`)})}getOverviewRoleConfig(){let e=String(window.NEXOWATT_EOS_ACCESS_ROLE||`unknown`).toLowerCase();return e===`installer`||e===`installateur`?{role:`installer`,label:`Installateur`,text:`Inbetriebnahme, Fehlersuche, Geräte- und EMS-Diagnose – mit deinen freigegebenen Installateurrechten.`,admin:!1}:e!==`admin`&&e!==`service`?{role:`enduser`,label:`Endkunde`,text:`Energie, Laden, Gebäude und die aktuellen EMS-Entscheidungen auf einen Blick.`,admin:!1}:{role:`admin`,label:`Admin / Service`,text:`Systemstatus, Module, Dienste und Anlagenzugänge in einer modernen Serviceübersicht.`,admin:!0}}render(){return this.state.instances?w(h,{elevation:0,overflow:`visible`,children:[this.renderCopiedToast(),w(`section`,{id:`eos-native-overview-hero`,className:`eos-overview-hero eos-native-overview-hero`,"data-eos-native-react-overview":`true`,children:[w(`div`,{children:[l(`span`,{className:`eos-overview-eyebrow`,children:`NexoWatt EOS`}),l(`h1`,{children:`Übersicht`}),l(`p`,{children:this.getOverviewRoleConfig().text})]}),w(`div`,{className:`eos-overview-role`,"data-nexowatt-overview-role":this.getOverviewRoleConfig().role,children:[l(`span`,{className:`eos-overview-status-dot`}),this.getOverviewRoleConfig().label]})]}),this.state.nodeUpdateDialog?l(Ze,{onClose:()=>this.setState({nodeUpdateDialog:null}),socket:this.props.socket,...this.state.nodeUpdateDialog}):null,w(k,{container:!0,className:`eos-native-intro-grid`,spacing:2,sx:$.cards,children:[this.getInstancesCards(),this.getLinkCards(),l(at,{socket:this.props.socket,t:this.props.t,lang:this.props.lang,theme:this.props.theme}),this.getOverviewRoleConfig().admin?l(`div`,{className:`eos-overview-edit-controls`,children:this.getButtons()}):null]}),this.getOverviewRoleConfig().admin?this.editLinkCard():null]}):l(ie,{})}static preprocessHostData(e){var t;if((t=e.dockerInformation)!=null&&t.isDocker){let t=e.dockerInformation.isOfficial?`official image`:`unofficial image`;e.dockerInformation.isOfficial&&(t+=` - ${e.dockerInformation.officialVersion}`),e.Platform=`${e.Platform} (${t})`}return delete e.dockerInformation,e}};export{mt as default};
@@ -1,2 +1,2 @@
1
- import{$a as e,Ao as t,Bo as n,Es as r,Gr as i,Ha as a,Hs as o,Is as s,Ka as c,Ko as l,Ln as u,Lr as d,Mo as f,On as p,Po as m,Ps as h,Qi as ee,Rr as te,Ts as g,Ua as _,Us as v,Vs as y,Wa as b,Wr as x,Xo as S,Yn as C,ao as w,as as T,br as E,co as D,eo as ne,go as O,jo as k,kn as A,la as j,lo as re,mo as M,no as ie,oi as N,os as P,po as F,ps as I,qi as L,ro as R,tc as z,to as B,ua as V,yo as H,zr as U,zs as W}from"./loadShare-eager-dmdYQhAl.js";import{t as G}from"./DeleteForever-CioJt3X3.js";import{t as K}from"./TextSnippet-C9R3EbZy.js";import{t as q}from"./AdminUtils-Dc1eHsx5.js";import{D as J,k as ae}from"./bootstrap-gVLo1K_2.js";r();var Y=3e3,oe=RegExp(`\x1B\\[\\d+m`,`g`),X=[0,1,6,24,72,168,720],se=24,ce=12e4,Z={container:{height:`100%`},table:{tableLayout:`fixed`,minWidth:960,"& td,th":{padding:`3px 4px`},"& td:nth-of-type(5)":{overflow:`hidden`,whiteSpace:`nowrap`,textOverflow:`ellipsis`},"& td:last-of-type":{overflowWrap:`anywhere`}},row:{"@media screen and (max-width: 450px)":{"& > *":{fontSize:`8px !important`}}},rowOdd:e=>({backgroundColor:e.palette.background.default}),cell:{verticalAlign:`top`},cellName:{lineHeight:`14px`},updatedRow:{animation:`updated 1s`},formControl:{width:`100%`,"@media screen and (max-width: 450px)":{"& > *":{fontSize:`10px !important`},position:`relative`}},light_error:{color:W[800]},light_warn:{color:s[800]},light_debug:{color:h[800]},light_silly:{color:h[700]},dark_error:{color:W[200]},dark_warn:{color:s[200]},dark_debug:{color:`#b1b1b1`},dark_silly:{color:`#7e7e7e`},source:{width:200,"@media screen and (max-width: 450px)":{width:120}},pid:{width:55,"@media screen and (max-width: 450px)":{width:40}},timestamp:{width:175,"@media screen and (max-width: 450px)":{width:100}},severity:{width:80,"@media screen and (max-width: 450px)":{width:61}},message:{minWidth:300,"@media screen and (max-width: 450px)":{minWidth:150}},hidden:{display:`none`},grow:{flexGrow:1},logSize:{marginRight:`1rem`,marginLeft:`1rem`},logEstimated:{fontStyle:`italic`},closeButton:e=>({position:`absolute`,right:8,top:8,color:e.palette.grey[500]}),header:e=>({"& .MuiFormLabel-root.Mui-disabled":{color:e.palette.text.primary},"& .MuiInput-underline::before":{content:`""`,borderBottom:`none`},"@media screen and (max-width: 450px)":{"& > *":{fontSize:`10px !important`}}}),pauseButton:{minWidth:48},pauseCount:{color:s[500]},downloadLogSize:{color:h[500],marginLeft:16},downloadEntry:{display:`flex`,justifyContent:`space-between`},pidSize:{fontSize:14,width:24,height:24,display:`flex`,alignItems:`center`},messageText:{"@media screen and (max-width: 450px)":{"& > *":{fontSize:`10px !important`}}},badge:{top:10,right:10},badgeError:{},badgeWarn:{backgroundColor:s[500]},emptyButton:{width:48},icon:{width:16,height:16},iconSelect:{width:24,height:25,marginRight:4},name:{verticalAlign:`top`,display:`inline-block`,marginTop:1,marginLeft:2,overflow:`hidden`,whiteSpace:`nowrap`,width:`100%`,textOverflow:`ellipsis`},iconAndName:{whiteSpace:`nowrap`,display:`flex`},tooltip:{pointerEvents:`none`},searchError:e=>({color:e.palette.error.main,overflow:`hidden`,whiteSpace:`nowrap`,textOverflow:`ellipsis`,maxWidth:400}),searchTruncated:e=>({color:e.palette.warning.main,width:16,height:16,verticalAlign:`text-bottom`,marginLeft:4}),searchProgress:{position:`absolute`,top:0,left:0,right:0,zIndex:3}},Q=[`#ffadad30`,`#ffd6a530`,`#fdffb630`,`#caffbf30`,`#9bf6ff30`,`#a0c4ff30`,`#bdb2ff30`,`#ffc6ff30`,`#fffffc30`],$=[`rgba(255,109,109,0.1)`,`rgba(253,173,84,0.1)`,`rgba(241,255,88,0.1)`,`rgba(115,253,81,0.1)`,`rgba(71,235,255,0.1)`,`rgba(74,145,255,0.1)`,`rgba(108,85,255,0.1)`,`rgba(250,77,250,0.1)`,`rgba(255,255,105,0.1)`],le=class r extends z{constructor(e){super(e),g(this,`severities`,void 0),g(this,`t`,void 0),g(this,`ignoreNextLogs`,!1),g(this,`lastRowRender`,0),g(this,`lastRowRenderTimeout`,null),g(this,`readLogsInProcess`,!1),g(this,`hostsTimer`,null),g(this,`scrollToEnd`,void 0),g(this,`logsRequest`,0),g(this,`searchUntil`,0),g(this,`visibleRows`,0),g(this,`logHandler`,(e,t)=>{if(this.ignoreNextLogs){this.ignoreNextLogs=!1;return}if(this.searchUntil&&(e=e.filter(e=>e.ts>this.searchUntil),!e.length))return;let n=(this.state.logs||[]).concat(e);n.length>Y&&n.splice(0,n.length-Y);let r=0,i=0,a=!1,o,s=Object.keys(this.state.sources).length,c=this.props.themeType===`dark`?$:Q;n.forEach(e=>{if(e.odd===void 0?(a=!a,e.odd=a):a=e.odd,!e.time){let t=new Date(e.ts);e.time=`${t.getFullYear()}-${(t.getMonth()+1).toString().padStart(2,`0`)}-${t.getDate().toString().padStart(2,`0`)} ${t.getHours().toString().padStart(2,`0`)}:${t.getMinutes().toString().padStart(2,`0`)}:${t.getSeconds().toString().padStart(2,`0`)}.${t.getMilliseconds().toString().padStart(3,`0`)}`}if(e.severity===`error`?i++:e.severity===`warn`&&r++,e.from){var t,n;!this.state.sources[e.from]&&!(o!=null&&o[e.from])?(o||=JSON.parse(JSON.stringify(this.state.sources)),o[e.from]={active:!0,color:c[s%c.length],icon:this.getSourceIcon(e.from)},s++):!((t=this.state.sources[e.from])!=null&&t.active)&&!(o!=null&&(n=o[e.from])!=null&&n.active)&&(o||=JSON.parse(JSON.stringify(this.state.sources)),o[e.from].active=!0)}});let l={logs:n,logSize:(this.state.logSize??0)+t,estimatedSize:!0,logWarnings:r,logErrors:i};if(o&&(l.sources=o),this.state.reverse){let e=document.getElementById(`endOfLog`);this.scrollToEnd=!e||e.getBoundingClientRect().top<window.innerHeight}this.setState(l)}),this.state={source:(window._localStorage||window.localStorage).getItem(`Log.source`)||`1`,severity:(window._localStorage||window.localStorage).getItem(`Log.severity`)||`debug`,message:(window._localStorage||window.localStorage).getItem(`Log.message`)||``,reverse:(window._localStorage||window.localStorage).getItem(`Log.reverse`)===`true`,logDeleteDialog:!1,logDownloadDialog:null,logFiles:[],logs:null,logSize:null,logErrors:0,logWarnings:0,estimatedSize:!0,pause:0,pid:(window._localStorage||window.localStorage).getItem(`Logs.pid`)===`true`,colors:(window._localStorage||window.localStorage).getItem(`Logs.colors`)===`true`,adapters:{},sources:{},currentHost:this.props.currentHost,hosts:{},searchHours:0,searching:!1,searchError:``,searchTruncated:!1,searchInstance:``},this.scrollToEnd=this.state.reverse,this.severities={silly:0,debug:1,info:2,warn:3,error:4},this.t=e.t}prepareLogs(e){let t=0,n=0,r=!0,i=JSON.parse(JSON.stringify(this.state.sources));Object.values(i).forEach(e=>e.active=!1),e.forEach(e=>{if(r=!r,e.odd=r,!e.time){let t=new Date(e.ts);e.time=`${t.getFullYear()}-${(t.getMonth()+1).toString().padStart(2,`0`)}-${t.getDate().toString().padStart(2,`0`)} ${t.getHours().toString().padStart(2,`0`)}:${t.getMinutes().toString().padStart(2,`0`)}:${t.getSeconds().toString().padStart(2,`0`)}.${t.getMilliseconds().toString().padStart(3,`0`)}`}e.severity===`error`?n++:e.severity===`warn`&&t++,e.from&&(i[e.from]?i[e.from].active=!0:i[e.from]={active:!0,icon:this.getSourceIcon(e.from)})});let a=0,o=this.props.themeType===`dark`?$:Q;return Object.keys(i).sort().forEach(e=>{i[e].color=o[a%o.length],a++}),{logErrors:n,logWarnings:t,sources:i}}readLogs(e,t,n){let r=++this.logsRequest;this.searchUntil=0,(this.state.searchHours||this.state.searching||this.state.searchError)&&this.setState({searchHours:0,searching:!1,searchError:``,searchTruncated:!1}),this.props.logsWorker&&this.state.hosts?this.props.logsWorker.getLogs(e,this.getRequestedLogLevel()).then(e=>{if(!e)return;if(r!==this.logsRequest){t?this.setState({logFiles:t},()=>n&&n()):n&&n();return}let i=[...e.logs];this.scrollToEnd=this.state.reverse;let a={logs:i,logSize:e.logSize,estimatedSize:!1,...this.prepareLogs(i)};t&&(a.logFiles=t),this.setState(a,()=>n&&n())}):t&&this.setState({logFiles:t},()=>n&&n())}isSearchPossible(){return!!this.state.searchInstance}static getLastSearchHours(){let e=parseInt((window._localStorage||window.localStorage).getItem(`Log.searchHours`)||``,10);return e&&X.includes(e)?e:se}async detectSearchInstance(){try{this.setState({searchInstance:await this.props.socket.getCurrentInstance()})}catch(e){console.warn(`Cannot find out the admin instance: ${e}`)}}async searchLogFiles(e){if(!this.isSearchPossible())return;e||=this.state.searchHours||r.getLastSearchHours();let t=++this.logsRequest;this.setState({searchHours:e,searching:!0,searchError:``});let n=this.state.source!==`1`&&this.state.sources[this.state.source]?this.state.source:void 0;try{var i;let r=await ae(this.props.socket,this.state.searchInstance,`admin:searchLogs`,{host:this.state.currentHost,hours:e,level:this.state.severity,source:n,text:this.state.message||void 0,maxRows:Y},ce);if(t!==this.logsRequest)return;if(!r||typeof r!=`object`||!Array.isArray(r.lines))throw Error((typeof r==`string`?r:r==null?void 0:r.error)||`no answer`);let a=[],o=0;for(let e of r.lines){let t=J(e);t&&(o&&o<=t.ts&&(t.key=o+1),o=t.key||0,t.message=q.parseColorMessage(t.message),a.push(t))}let s=r.until||Date.now();(i=this.state.logs)==null||i.forEach(e=>e.ts>s&&a.push(e)),a.length>Y&&a.splice(0,a.length-Y),this.searchUntil=s,this.scrollToEnd=this.state.reverse,this.setState({logs:a,searching:!1,searchTruncated:!!r.truncated,pause:0,...this.prepareLogs(a)})}catch(e){t===this.logsRequest&&this.setState({searching:!1,searchError:e.message||String(e)})}}handleSearchHoursChange(e){e?((window._localStorage||window.localStorage).setItem(`Log.searchHours`,e.toString()),this.searchLogFiles(e)):this.readLogs(!0)}onFilterChanged(){this.state.searchHours&&this.searchLogFiles()}exportLogs(){let e=[],t=this.state.message.toLowerCase(),n=this.state.source!==`1`&&this.state.sources[this.state.source]?this.state.source:`1`,r=this.state.logs||[],i=this.state.pause>0?this.state.pause:r.length;for(let a=0;a<i;a++){let i=r[a];if(i&&!this.getRowView(i,n,t).hidden){let t=typeof i.message==`object`?i.message.original:i.message;e.push(`${i.time} - ${i.severity}: ${(t||``).replace(oe,``)}`)}}this.state.reverse||e.reverse();let a=window.URL.createObjectURL(new Blob([`${e.join(`
1
+ import{$a as e,Ao as t,Bo as n,Es as r,Gr as i,Ha as a,Hs as o,Is as s,Ka as c,Ko as l,Ln as u,Lr as d,Mo as f,On as p,Po as m,Ps as h,Qi as ee,Rr as te,Ts as g,Ua as _,Us as v,Vs as y,Wa as b,Wr as x,Xo as S,Yn as C,ao as w,as as T,br as E,co as D,eo as ne,go as O,jo as k,kn as A,la as j,lo as re,mo as M,no as ie,oi as N,os as P,po as F,ps as I,qi as L,ro as R,tc as z,to as B,ua as V,yo as H,zr as U,zs as W}from"./loadShare-eager-dmdYQhAl.js";import{t as G}from"./DeleteForever-CioJt3X3.js";import{t as K}from"./TextSnippet-C9R3EbZy.js";import{t as q}from"./AdminUtils-Dc1eHsx5.js";import{D as J,k as ae}from"./bootstrap-D16lu6rd.js";r();var Y=3e3,oe=RegExp(`\x1B\\[\\d+m`,`g`),X=[0,1,6,24,72,168,720],se=24,ce=12e4,Z={container:{height:`100%`},table:{tableLayout:`fixed`,minWidth:960,"& td,th":{padding:`3px 4px`},"& td:nth-of-type(5)":{overflow:`hidden`,whiteSpace:`nowrap`,textOverflow:`ellipsis`},"& td:last-of-type":{overflowWrap:`anywhere`}},row:{"@media screen and (max-width: 450px)":{"& > *":{fontSize:`8px !important`}}},rowOdd:e=>({backgroundColor:e.palette.background.default}),cell:{verticalAlign:`top`},cellName:{lineHeight:`14px`},updatedRow:{animation:`updated 1s`},formControl:{width:`100%`,"@media screen and (max-width: 450px)":{"& > *":{fontSize:`10px !important`},position:`relative`}},light_error:{color:W[800]},light_warn:{color:s[800]},light_debug:{color:h[800]},light_silly:{color:h[700]},dark_error:{color:W[200]},dark_warn:{color:s[200]},dark_debug:{color:`#b1b1b1`},dark_silly:{color:`#7e7e7e`},source:{width:200,"@media screen and (max-width: 450px)":{width:120}},pid:{width:55,"@media screen and (max-width: 450px)":{width:40}},timestamp:{width:175,"@media screen and (max-width: 450px)":{width:100}},severity:{width:80,"@media screen and (max-width: 450px)":{width:61}},message:{minWidth:300,"@media screen and (max-width: 450px)":{minWidth:150}},hidden:{display:`none`},grow:{flexGrow:1},logSize:{marginRight:`1rem`,marginLeft:`1rem`},logEstimated:{fontStyle:`italic`},closeButton:e=>({position:`absolute`,right:8,top:8,color:e.palette.grey[500]}),header:e=>({"& .MuiFormLabel-root.Mui-disabled":{color:e.palette.text.primary},"& .MuiInput-underline::before":{content:`""`,borderBottom:`none`},"@media screen and (max-width: 450px)":{"& > *":{fontSize:`10px !important`}}}),pauseButton:{minWidth:48},pauseCount:{color:s[500]},downloadLogSize:{color:h[500],marginLeft:16},downloadEntry:{display:`flex`,justifyContent:`space-between`},pidSize:{fontSize:14,width:24,height:24,display:`flex`,alignItems:`center`},messageText:{"@media screen and (max-width: 450px)":{"& > *":{fontSize:`10px !important`}}},badge:{top:10,right:10},badgeError:{},badgeWarn:{backgroundColor:s[500]},emptyButton:{width:48},icon:{width:16,height:16},iconSelect:{width:24,height:25,marginRight:4},name:{verticalAlign:`top`,display:`inline-block`,marginTop:1,marginLeft:2,overflow:`hidden`,whiteSpace:`nowrap`,width:`100%`,textOverflow:`ellipsis`},iconAndName:{whiteSpace:`nowrap`,display:`flex`},tooltip:{pointerEvents:`none`},searchError:e=>({color:e.palette.error.main,overflow:`hidden`,whiteSpace:`nowrap`,textOverflow:`ellipsis`,maxWidth:400}),searchTruncated:e=>({color:e.palette.warning.main,width:16,height:16,verticalAlign:`text-bottom`,marginLeft:4}),searchProgress:{position:`absolute`,top:0,left:0,right:0,zIndex:3}},Q=[`#ffadad30`,`#ffd6a530`,`#fdffb630`,`#caffbf30`,`#9bf6ff30`,`#a0c4ff30`,`#bdb2ff30`,`#ffc6ff30`,`#fffffc30`],$=[`rgba(255,109,109,0.1)`,`rgba(253,173,84,0.1)`,`rgba(241,255,88,0.1)`,`rgba(115,253,81,0.1)`,`rgba(71,235,255,0.1)`,`rgba(74,145,255,0.1)`,`rgba(108,85,255,0.1)`,`rgba(250,77,250,0.1)`,`rgba(255,255,105,0.1)`],le=class r extends z{constructor(e){super(e),g(this,`severities`,void 0),g(this,`t`,void 0),g(this,`ignoreNextLogs`,!1),g(this,`lastRowRender`,0),g(this,`lastRowRenderTimeout`,null),g(this,`readLogsInProcess`,!1),g(this,`hostsTimer`,null),g(this,`scrollToEnd`,void 0),g(this,`logsRequest`,0),g(this,`searchUntil`,0),g(this,`visibleRows`,0),g(this,`logHandler`,(e,t)=>{if(this.ignoreNextLogs){this.ignoreNextLogs=!1;return}if(this.searchUntil&&(e=e.filter(e=>e.ts>this.searchUntil),!e.length))return;let n=(this.state.logs||[]).concat(e);n.length>Y&&n.splice(0,n.length-Y);let r=0,i=0,a=!1,o,s=Object.keys(this.state.sources).length,c=this.props.themeType===`dark`?$:Q;n.forEach(e=>{if(e.odd===void 0?(a=!a,e.odd=a):a=e.odd,!e.time){let t=new Date(e.ts);e.time=`${t.getFullYear()}-${(t.getMonth()+1).toString().padStart(2,`0`)}-${t.getDate().toString().padStart(2,`0`)} ${t.getHours().toString().padStart(2,`0`)}:${t.getMinutes().toString().padStart(2,`0`)}:${t.getSeconds().toString().padStart(2,`0`)}.${t.getMilliseconds().toString().padStart(3,`0`)}`}if(e.severity===`error`?i++:e.severity===`warn`&&r++,e.from){var t,n;!this.state.sources[e.from]&&!(o!=null&&o[e.from])?(o||=JSON.parse(JSON.stringify(this.state.sources)),o[e.from]={active:!0,color:c[s%c.length],icon:this.getSourceIcon(e.from)},s++):!((t=this.state.sources[e.from])!=null&&t.active)&&!(o!=null&&(n=o[e.from])!=null&&n.active)&&(o||=JSON.parse(JSON.stringify(this.state.sources)),o[e.from].active=!0)}});let l={logs:n,logSize:(this.state.logSize??0)+t,estimatedSize:!0,logWarnings:r,logErrors:i};if(o&&(l.sources=o),this.state.reverse){let e=document.getElementById(`endOfLog`);this.scrollToEnd=!e||e.getBoundingClientRect().top<window.innerHeight}this.setState(l)}),this.state={source:(window._localStorage||window.localStorage).getItem(`Log.source`)||`1`,severity:(window._localStorage||window.localStorage).getItem(`Log.severity`)||`debug`,message:(window._localStorage||window.localStorage).getItem(`Log.message`)||``,reverse:(window._localStorage||window.localStorage).getItem(`Log.reverse`)===`true`,logDeleteDialog:!1,logDownloadDialog:null,logFiles:[],logs:null,logSize:null,logErrors:0,logWarnings:0,estimatedSize:!0,pause:0,pid:(window._localStorage||window.localStorage).getItem(`Logs.pid`)===`true`,colors:(window._localStorage||window.localStorage).getItem(`Logs.colors`)===`true`,adapters:{},sources:{},currentHost:this.props.currentHost,hosts:{},searchHours:0,searching:!1,searchError:``,searchTruncated:!1,searchInstance:``},this.scrollToEnd=this.state.reverse,this.severities={silly:0,debug:1,info:2,warn:3,error:4},this.t=e.t}prepareLogs(e){let t=0,n=0,r=!0,i=JSON.parse(JSON.stringify(this.state.sources));Object.values(i).forEach(e=>e.active=!1),e.forEach(e=>{if(r=!r,e.odd=r,!e.time){let t=new Date(e.ts);e.time=`${t.getFullYear()}-${(t.getMonth()+1).toString().padStart(2,`0`)}-${t.getDate().toString().padStart(2,`0`)} ${t.getHours().toString().padStart(2,`0`)}:${t.getMinutes().toString().padStart(2,`0`)}:${t.getSeconds().toString().padStart(2,`0`)}.${t.getMilliseconds().toString().padStart(3,`0`)}`}e.severity===`error`?n++:e.severity===`warn`&&t++,e.from&&(i[e.from]?i[e.from].active=!0:i[e.from]={active:!0,icon:this.getSourceIcon(e.from)})});let a=0,o=this.props.themeType===`dark`?$:Q;return Object.keys(i).sort().forEach(e=>{i[e].color=o[a%o.length],a++}),{logErrors:n,logWarnings:t,sources:i}}readLogs(e,t,n){let r=++this.logsRequest;this.searchUntil=0,(this.state.searchHours||this.state.searching||this.state.searchError)&&this.setState({searchHours:0,searching:!1,searchError:``,searchTruncated:!1}),this.props.logsWorker&&this.state.hosts?this.props.logsWorker.getLogs(e,this.getRequestedLogLevel()).then(e=>{if(!e)return;if(r!==this.logsRequest){t?this.setState({logFiles:t},()=>n&&n()):n&&n();return}let i=[...e.logs];this.scrollToEnd=this.state.reverse;let a={logs:i,logSize:e.logSize,estimatedSize:!1,...this.prepareLogs(i)};t&&(a.logFiles=t),this.setState(a,()=>n&&n())}):t&&this.setState({logFiles:t},()=>n&&n())}isSearchPossible(){return!!this.state.searchInstance}static getLastSearchHours(){let e=parseInt((window._localStorage||window.localStorage).getItem(`Log.searchHours`)||``,10);return e&&X.includes(e)?e:se}async detectSearchInstance(){try{this.setState({searchInstance:await this.props.socket.getCurrentInstance()})}catch(e){console.warn(`Cannot find out the admin instance: ${e}`)}}async searchLogFiles(e){if(!this.isSearchPossible())return;e||=this.state.searchHours||r.getLastSearchHours();let t=++this.logsRequest;this.setState({searchHours:e,searching:!0,searchError:``});let n=this.state.source!==`1`&&this.state.sources[this.state.source]?this.state.source:void 0;try{var i;let r=await ae(this.props.socket,this.state.searchInstance,`admin:searchLogs`,{host:this.state.currentHost,hours:e,level:this.state.severity,source:n,text:this.state.message||void 0,maxRows:Y},ce);if(t!==this.logsRequest)return;if(!r||typeof r!=`object`||!Array.isArray(r.lines))throw Error((typeof r==`string`?r:r==null?void 0:r.error)||`no answer`);let a=[],o=0;for(let e of r.lines){let t=J(e);t&&(o&&o<=t.ts&&(t.key=o+1),o=t.key||0,t.message=q.parseColorMessage(t.message),a.push(t))}let s=r.until||Date.now();(i=this.state.logs)==null||i.forEach(e=>e.ts>s&&a.push(e)),a.length>Y&&a.splice(0,a.length-Y),this.searchUntil=s,this.scrollToEnd=this.state.reverse,this.setState({logs:a,searching:!1,searchTruncated:!!r.truncated,pause:0,...this.prepareLogs(a)})}catch(e){t===this.logsRequest&&this.setState({searching:!1,searchError:e.message||String(e)})}}handleSearchHoursChange(e){e?((window._localStorage||window.localStorage).setItem(`Log.searchHours`,e.toString()),this.searchLogFiles(e)):this.readLogs(!0)}onFilterChanged(){this.state.searchHours&&this.searchLogFiles()}exportLogs(){let e=[],t=this.state.message.toLowerCase(),n=this.state.source!==`1`&&this.state.sources[this.state.source]?this.state.source:`1`,r=this.state.logs||[],i=this.state.pause>0?this.state.pause:r.length;for(let a=0;a<i;a++){let i=r[a];if(i&&!this.getRowView(i,n,t).hidden){let t=typeof i.message==`object`?i.message.original:i.message;e.push(`${i.time} - ${i.severity}: ${(t||``).replace(oe,``)}`)}}this.state.reverse||e.reverse();let a=window.URL.createObjectURL(new Blob([`${e.join(`
2
2
  `)}\n`],{type:`text/plain;charset=utf-8`})),o=document.createElement(`a`);o.href=a,o.download=`iobroker-log-${this.state.currentHost.replace(`system.host.`,``)}-${new Date().toISOString().replace(/[:.]/g,`-`)}.txt`,document.body.appendChild(o);try{o.click()}finally{o.remove(),setTimeout(()=>window.URL.revokeObjectURL(a),1e3)}}async readLogFiles(){let e=await this.props.socket.getLogsFiles(this.state.currentHost);if(e!=null&&e.length){let t=[];return e.reverse(),e.forEach(e=>{let n=(e.fileName.split(`/`).pop()||``).replace(/iobroker\.?/,``).replace(`.log`,``);n[0]<=`9`&&t.push({path:e,name:n})}),e.sort(),e.forEach(e=>{let n=(e.fileName.split(`/`).pop()||``).replace(/iobroker\.?/,``).replace(`.log`,``);n[0]>`9`&&t.push({path:e,name:n})}),t}return[]}componentDidMount(){this.props.logsWorker.registerHandler(this.logHandler),this.props.clearErrors(),this.props.socket.getCompactAdapters().then(async e=>{let t=await this.props.socket.getCompactHosts(),n={};t.forEach(e=>n[e._id]=e),await new Promise(t=>{this.setState({adapters:e,hosts:n},()=>t())});let r=await this.readLogFiles();this.readLogs(!0,r)}),this.detectSearchInstance()}componentWillUnmount(){this.props.logsWorker.unregisterHandler(this.logHandler),this.props.clearErrors()}getSourceIcon(e){var t;let n=e.replace(/\.\d+$/,``),r=(t=this.state.adapters[n])==null?void 0:t.icon;if(r)r.startsWith(`data:image`)||(r=`./files/${n}.admin/${r}`);else if(this.state.hosts){var i;r=((i=this.state.hosts[`system.${e}`])==null||(i=i.common)==null?void 0:i.icon)||`img/no-image.svg`}return r||``}clearLog(){var e;(e=this.props.logsWorker)==null||e.clearLines(),this.props.clearErrors(),this.logsRequest++,this.searchUntil=0,this.setState({logs:[],logSize:null,logErrors:0,logWarnings:0,searchHours:0,searching:!1,searchError:``,searchTruncated:!1})}handleMessageChange(e){(window._localStorage||window.localStorage).setItem(`Log.message`,e.target.value),this.setState({message:e.target.value})}handleSourceChange(e){(window._localStorage||window.localStorage).setItem(`Log.source`,e),this.setState({source:e},()=>this.onFilterChanged())}getRequestedLogLevel(){let e=this.state.severity;return e===`silly`||e===`debug`?void 0:e}handleSeverityChange(e){(window._localStorage||window.localStorage).setItem(`Log.severity`,e.target.value),this.setState({severity:e.target.value},()=>this.state.searchHours?this.onFilterChanged():this.readLogs(!0))}handleLogDelete(){this.props.socket.delLogs(this.state.currentHost).then(()=>this.clearLog()).then(()=>this.readLogs(!0,void 0,()=>this.setState({logDeleteDialog:!1}))).catch(e=>{this.setState({logDeleteDialog:!1}),window.alert(e)})}handleLogPause(){var e;this.setState({pause:this.state.pause?0:((e=this.state.logs)==null?void 0:e.length)??0})}static openTab(e){var t;(t=window.open(e,`_blank`))==null||t.focus()}getLogFiles(){return this.state.logFiles.map(e=>v(P,{style:Z.downloadEntry,onClick:()=>{r.openTab(e.path.fileName),this.setState({logDownloadDialog:null})},children:[e.name,o(M,{style:Z.downloadLogSize,variant:`caption`,children:q.formatBytes(e.path.size)||`-`})]},e.name))}getSeverities(){let e=[];for(let t in this.severities)e.push(o(P,{value:t,style:Z[`${this.props.themeType}_${t}`],children:t},t));return e}getSources(){let e=Object.keys(this.state.sources).sort();return e.unshift(`1`),e.map(e=>v(P,{value:e,style:{backgroundColor:!this.state.colors||e===`1`?void 0:this.state.sources[e].color,display:`flex`,alignItems:`center`},children:[e===`1`?null:o(E,{src:this.state.sources[e].icon||``,style:Z.iconSelect}),e===`1`?this.t(`Source (show all)`):e]},e))}getOneRow(e,t,n){var r,i,a;let s=(r=this.state.logs)==null?void 0:r[e];if(!s)return;let c=s.severity,{message:l,id:u,hidden:d}=this.getRowView(s,n.sourceFilter,n.filterMessage);d||n.visible++;let f=n.previousKey===s.key?e:s.key??e;n.previousKey=s.key??0,t.push(v(w,{id:n.length===e?`endOfLog`:void 0,sx:x.getStyle(this.props.theme,Z.row,s.odd&&Z.rowOdd,d&&Z.hidden,this.lastRowRender&&s.ts>this.lastRowRender&&Z.updatedRow),style:this.state.colors?{backgroundColor:((i=this.state.sources[s.from])==null?void 0:i.color)||void 0}:{},hover:!0,children:[o(B,{style:{...Z.cell,...Z.cellName},children:v(`div`,{style:Z.iconAndName,children:[o(E,{src:((a=this.state.sources[s.from])==null?void 0:a.icon)||``,style:Z.icon}),o(`div`,{style:Z.name,children:s.from})]})}),this.state.pid&&o(B,{style:{...Z.cell,...Z[`${this.props.themeType}_${c}`]},children:u}),o(B,{style:{...Z.cell,...Z[`${this.props.themeType}_${c}`]},children:s.time}),o(B,{style:{...Z.cell,...Z[`${this.props.themeType}_${c}`],fontWeight:`bold`},children:s.severity}),o(B,{style:{...Z.cell,...Z[`${this.props.themeType}_${c}`]},title:typeof l==`object`?l.original:l,children:typeof l==`object`?l.parts.map((e,t)=>o(`span`,{style:e.style,children:e.text},t)):l})]},n.keyPrefix+f))}getRowView(e,t,n){let r=e.message||``,i=``;if(typeof r!=`object`){let t=RegExp(`${e.from.replace(`.`,`\\.`).replace(`)`,`\\)`).replace(`(`,`\\(`)} \\(\\d+\\) `,`g`),n=r.match(t);n?(r=r.replace(n[0],``),i=(n[0].split(` `)[1].match(/\d+/g)||[``])[0]):r=r.replace(`${e.from} `,``)}let a=t!==`1`&&t!==e.from||this.severities[e.severity]<this.severities[this.state.severity];return!a&&n&&(a=typeof r==`object`?!r.original.toLowerCase().includes(n):!r.toLowerCase().includes(n)),{message:r,id:i,hidden:a}}getRows(){var e;let t=[],n={filterMessage:this.state.message.toLowerCase(),sourceFilter:this.state.source,previousKey:0,keyPrefix:``,length:0,visible:0},r=Object.keys(this.state.sources).sort();if(r.unshift(`1`),r.includes(n.sourceFilter)||(n.sourceFilter=`1`),n.previousKey=0,n.keyPrefix=this.state.reverse?`r`:``,n.length=this.state.pause>0?this.state.pause-1:(((e=this.state.logs)==null?void 0:e.length)??0)-1,this.state.reverse)for(let e=0;e<=n.length;e++)this.getOneRow(e,t,n);else for(let e=n.length;e>=0;e--)this.getOneRow(e,t,n);return n.length>0&&this.scrollToEnd&&(setTimeout(()=>{let e=document.getElementById(`endOfLog`);e==null||e.scrollIntoView()},200),this.scrollToEnd=!1),(!this.lastRowRender||Date.now()-this.lastRowRender>1e3)&&(this.lastRowRenderTimeout||=setTimeout(()=>{this.lastRowRenderTimeout=null,this.lastRowRender=Date.now()},1e3)),this.visibleRows=n.visible,t}renderClearDialog(){return this.state.logDeleteDialog?v(t,{onClose:()=>this.setState({logDeleteDialog:!1}),open:!0,children:[v(m,{children:[this.t(`Please confirm`),o(l,{size:`large`,sx:Z.closeButton,onClick:()=>this.setState({logDeleteDialog:!1}),children:o(c,{})})]}),o(f,{dividers:!0,children:o(M,{gutterBottom:!0,children:this.t(`Log file will be deleted. Are you sure?`)})}),v(k,{children:[o(H,{variant:`contained`,autoFocus:!0,onClick:()=>this.handleLogDelete(),color:`primary`,startIcon:o(b,{}),children:this.t(`Ok`)}),o(H,{variant:`contained`,onClick:()=>this.setState({logDeleteDialog:!1}),color:`grey`,startIcon:o(c,{}),children:this.t(`Cancel`)})]})]}):null}changePid(){let e=!this.state.pid;(window._localStorage||window.localStorage).setItem(`Logs.pid`,e?`true`:`false`),this.setState({pid:e})}renderToolbar(){var e,t,n;let r=this.state.pause?o(M,{style:Z.pauseCount,children:(((e=this.state.logs)==null?void 0:e.length)??0)-this.state.pause}):o(u,{}),i=this.props.width===`xs`||this.props.width===`sm`,s=i?o(l,{color:`primary`,onClick:e=>this.setState({logDownloadDialog:e.currentTarget}),children:o(j,{})}):o(H,{variant:`contained`,color:`primary`,startIcon:o(j,{}),onClick:e=>this.setState({logDownloadDialog:e.currentTarget}),children:this.t(`Download log`)});return v(U,{children:[this.props.menuButtonSpace?o(O,{sx:{width:40,flexShrink:0}}):null,o(F,{title:this.props.t(`Refresh log`),slotProps:{popper:{sx:Z.tooltip}},children:o(l,{size:`large`,onClick:()=>this.state.searchHours?void this.searchLogFiles():this.readLogs(!0),children:o(V,{})})}),o(F,{title:this.props.t(`Pause output`),slotProps:{popper:{sx:Z.tooltip}},children:o(l,{size:`large`,style:Z.pauseButton,onClick:()=>this.handleLogPause(),children:r})}),o(F,{title:this.props.t(`Clear log`),slotProps:{popper:{sx:Z.tooltip}},children:o(l,{size:`large`,onClick:()=>this.clearLog(),children:o(a,{})})}),o(F,{title:this.props.t(`Clear on disk permanent`),slotProps:{popper:{sx:Z.tooltip}},children:o(l,{size:`large`,onClick:()=>this.setState({logDeleteDialog:!0}),children:o(G,{})})}),o(F,{title:this.props.t(`Show/hide PID`),slotProps:{popper:{sx:Z.tooltip}},children:o(l,{size:`large`,onClick:()=>this.changePid(),color:this.state.pid?`primary`:`default`,children:o(`div`,{style:Z.pidSize,children:this.props.t(`PID`)})})}),o(F,{title:this.props.t(`Show/hide colors`),slotProps:{popper:{sx:Z.tooltip}},children:o(l,{size:`large`,onClick:()=>{(window._localStorage||window.localStorage).setItem(`Logs.colors`,this.state.colors?`false`:`true`),this.setState({colors:!this.state.colors})},color:this.state.colors?`primary`:`default`,children:o(L,{style:{width:`0.8em`,height:`0.8em`}})})}),o(F,{title:this.props.t(`Reverse output direction`),slotProps:{popper:{sx:Z.tooltip}},children:o(l,{size:`large`,onClick:()=>{(window._localStorage||window.localStorage).setItem(`Log.reverse`,this.state.reverse?`false`:`true`),this.setState({reverse:!this.state.reverse}),setTimeout(()=>{let e=document.getElementById(`endOfLog`);e==null||e.scrollIntoView()},500)},color:this.state.reverse?`primary`:`default`,children:this.state.reverse?o(p,{}):o(A,{})})}),o(F,{title:this.props.t(`Show errors`),slotProps:{popper:{sx:Z.tooltip}},children:o(D,{badgeContent:this.state.logErrors,color:`error`,sx:{"& .MuiBadge-badge":{...Z.badge,...Z.badgeError}},children:o(l,{size:`large`,onClick:()=>{this.state.severity===`error`?this.setState({severity:`debug`},()=>this.onFilterChanged()):this.setState({severity:`error`,logErrors:0},()=>this.onFilterChanged())},color:this.state.severity===`error`?`primary`:`default`,children:o(_,{})})})}),o(F,{title:this.props.t(`Show errors and warnings`),slotProps:{popper:{sx:Z.tooltip}},children:o(D,{badgeContent:this.state.logWarnings,color:`default`,sx:{"& .MuiBadge-badge":{...Z.badge,...Z.badgeWarn}},children:o(l,{size:`large`,onClick:()=>{this.state.severity===`warn`?this.setState({severity:`debug`},()=>this.onFilterChanged()):this.setState({severity:`warn`,logWarnings:0},()=>this.onFilterChanged())},color:this.state.severity===`warn`?`primary`:`default`,children:o(N,{})})})}),o(F,{title:this.props.t(`Export the shown entries as a text file`),slotProps:{popper:{sx:Z.tooltip}},children:o(`span`,{children:o(l,{size:`large`,disabled:!((t=this.state.logs)!=null&&t.length),onClick:()=>this.exportLogs(),children:o(K,{})})})}),o(`div`,{style:Z.grow}),(n=this.state.logFiles)!=null&&n.length?s:null,this.state.logDownloadDialog?o(T,{id:`simple-menu`,anchorEl:this.state.logDownloadDialog,keepMounted:!0,open:!!this.state.logDownloadDialog,onClose:()=>this.setState({logDownloadDialog:null}),children:this.getLogFiles()}):null,i?null:o(`div`,{style:Z.grow}),i?null:this.renderLogInfo(),o(O,{sx:{ml:`auto`,pl:1},children:this.props.hostSelector})]})}renderLogInfo(){return this.state.searchError?o(M,{variant:`body2`,sx:[Z.logSize,Z.searchError],title:this.state.searchError,children:this.t(`Search failed: %s`,this.state.searchError)}):this.state.searchHours?v(M,{variant:`body2`,style:Z.logSize,children:[this.t(`Hits: %s`,this.state.searching?`…`:this.visibleRows),this.state.searchTruncated&&!this.state.searching?o(F,{title:this.t(`Only the newest %s hits are shown`,Y),slotProps:{popper:{sx:Z.tooltip}},children:o(O,{component:N,sx:Z.searchTruncated})}):null]}):v(M,{variant:`body2`,title:this.state.estimatedSize?this.props.t(`Estimated size`):``,style:Z.logSize,children:[this.t(`Log size:`),` `,o(`span`,{style:this.state.estimatedSize?Z.logEstimated:void 0,children:this.state.logSize===null?`-`:q.formatBytes(this.state.logSize)})]})}renderTimeHeader(){return o(F,{title:this.t(`Search the log files in this time range`),placement:`top`,slotProps:{popper:{sx:Z.tooltip}},children:o(n,{variant:`standard`,style:Z.formControl,children:o(I,{variant:`standard`,value:this.state.searchHours,disabled:!this.isSearchPossible(),onChange:e=>this.handleSearchHoursChange(Number(e.target.value)),children:X.map(e=>o(P,{value:e,children:e?e===1?this.t(`1 hour`):e<72?this.t(`%s hours`,e):this.t(`%s days`,e/24):this.t(`Latest entries`)},e))})})})}renderTableHeader(){let e=Object.keys(this.state.sources).sort();return e.unshift(`1`),o(R,{children:v(w,{children:[o(B,{sx:Z.source,children:v(n,{variant:`standard`,sx:Z.formControl,children:[o(I,{variant:`standard`,labelId:`source-label`,value:e.includes(this.state.source)?this.state.source:`1`,onChange:e=>this.handleSourceChange(e.target.value),renderValue:e=>v(`div`,{style:{backgroundColor:!this.state.colors||e===`1`?void 0:this.state.sources[e].color,display:`flex`,alignItems:`center`},children:[e===`1`?null:o(E,{src:this.state.sources[e].icon||``,style:Z.iconSelect}),e===`1`?this.t(`Source`):e]}),children:this.getSources()}),(e.includes(this.state.source)?this.state.source:`1`)===`1`?null:o(l,{sx:{position:`absolute`,top:1,right:15,zIndex:1},size:`small`,onClick:()=>this.handleSourceChange(`1`),children:o(ee,{})})]})}),this.state.pid&&o(B,{sx:Z.pid,children:o(O,{component:`div`,sx:Z.header,children:this.t(`PID`)})}),o(B,{sx:Z.timestamp,children:this.renderTimeHeader()}),o(B,{sx:Z.severity,children:o(n,{variant:`standard`,style:Z.formControl,children:o(I,{variant:`standard`,labelId:`severity-label`,value:this.state.severity,onChange:e=>this.handleSeverityChange(e),renderValue:e=>o(`span`,{style:Z[`${this.props.themeType}_${e}`],children:e}),children:this.getSeverities()})})}),o(B,{sx:Z.message,children:o(n,{variant:`standard`,style:Z.formControl,children:o(re,{variant:`standard`,sx:Z.messageText,placeholder:this.t(`Message`),onChange:e=>this.handleMessageChange(e),onKeyDown:e=>{e.key===`Enter`&&this.searchLogFiles()},value:this.state.message,slotProps:{input:{endAdornment:v(y,{children:[this.state.message?o(l,{tabIndex:-1,size:`small`,onClick:()=>{(window._localStorage||window.localStorage).removeItem(`Log.message`),this.setState({message:``})},children:o(c,{})}):null,this.isSearchPossible()?o(F,{title:this.t(`Search in the log files (Enter)`),slotProps:{popper:{sx:Z.tooltip}},children:o(l,{tabIndex:-1,size:`small`,disabled:this.state.searching,onClick:()=>this.searchLogFiles(),children:o(C,{})})}):null]})}}})})})]})})}render(){if(!this.state.logs)return o(S,{});this.state.logFiles===null&&!this.readLogsInProcess&&(this.readLogsInProcess=!0,setTimeout(()=>this.readLogFiles().then(e=>{this.readLogsInProcess=!1,this.setState({logFiles:e})}),100)),this.props.currentHost!==this.state.currentHost&&(this.hostsTimer=this.hostsTimer||setTimeout(()=>{this.hostsTimer=null,this.setState({currentHost:this.props.currentHost,logs:[],logFiles:[]},()=>this.readLogs(!0))},200));let t=this.getRows();return v(d,{children:[this.renderToolbar(),v(te,{style:{position:`relative`},children:[this.state.searching?o(S,{sx:Z.searchProgress}):null,o(ie,{style:Z.container,children:v(e,{stickyHeader:!0,size:`small`,sx:Z.table,children:[this.renderTableHeader(),o(ne,{children:t})]})})]}),this.renderClearDialog()]})}},ue=i()(le);export{ue as default};
@@ -1,4 +1,4 @@
1
- import{a as e,t}from"./rolldown-runtime-sJBDdmOt.js";import{$r as n,Ai as r,An as i,Ao as a,Ar as o,Bo as s,Br as c,Ci as l,Er as u,Es as d,Ga as f,Ha as p,Hs as m,In as h,Io as g,Ji as _,Jo as v,Jr as y,Ka as b,Ko as x,Li as S,Lt as ee,Mo as C,No as te,Oi as ne,Oo as re,Po as w,Qa as ie,Qs as ae,Ri as oe,Ro as se,Sn as ce,So as le,To as ue,Tr as T,Ts as E,Ur as de,Us as D,Vo as fe,Wa as pe,Wo as O,Wr as k,Xo as me,Za as he,_r as ge,_s as _e,ao as ve,as as ye,ba as be,bn as xe,br as Se,cr as Ce,cs as we,ea as Te,eo as Ee,fo as De,go as A,gr as Oe,hr as ke,i as Ae,is as je,jo as Me,lo as j,lr as Ne,ls as Pe,mo as Fe,mr as Ie,no as Le,ns as Re,os as M,pc as N,po as P,ps as ze,qa as Be,qo as F,qs as Ve,ro as He,rr as Ue,rs as We,sc as Ge,so as Ke,sr as qe,ss as Je,tc as Ye,to as I,vi as Xe,wi as Ze,xn as Qe,yo as L,zi as $e,zt as et}from"./loadShare-eager-dmdYQhAl.js";import{a as tt,i as nt,n as rt,o as it,r as at,s as ot,t as st}from"./MoreHoriz-CS7nODK8.js";import{n as ct,t as lt}from"./KeyboardArrowRight-ifvmV1ZL.js";import{t as ut}from"./Remove-IN7ZNaCF.js";import{t as dt}from"./en-US-BjjaEI6N.js";import{a as ft,c as pt,d as mt,f as ht,i as gt,l as _t,n as vt,o as yt,r as bt,s as xt,u as St}from"./locale-DN6Bdkdt.js";import{t as Ct}from"./AdminUtils-Dc1eHsx5.js";import{t as wt}from"./AceEditor-BgLZBrSD.js";import{n as Tt,t as Et}from"./ctrlEnter-CruFIPb_.js";import{G as Dt,M as Ot,r as kt}from"./bootstrap-gVLo1K_2.js";import{a as At,c as jt,d as Mt,i as Nt,l as Pt,n as Ft,o as It,r as Lt,s as Rt,t as zt,u as Bt}from"./zh-cn-B6dBxOyw.js";import{t as Vt}from"./CustomModal-Do2qVZr7.js";import{$ as Ht,$t as R,A as Ut,At as Wt,B as Gt,Bt as Kt,C as qt,Ct as Jt,D as z,Dt as Yt,E as Xt,Et as Zt,F as Qt,Ft as $t,G as en,Gt as tn,H as nn,Ht as rn,I as an,It as on,J as sn,Jt as cn,K as ln,Kt as un,L as dn,Lt as fn,M as pn,Mt as mn,O as hn,Ot as gn,P as _n,Q as vn,Qt as yn,R as bn,Rt as xn,S as Sn,St as Cn,T as wn,Tt as Tn,U as En,Ut as Dn,Vt as On,W as kn,Wt as An,X as jn,Xt as Mn,Yt as Nn,Z as Pn,Zt as Fn,_ as In,_n as B,_t as Ln,a as Rn,an as zn,at as Bn,b as Vn,bt as Hn,c as Un,cn as Wn,d as Gn,dn as Kn,dt as qn,en as Jn,et as Yn,f as Xn,fn as Zn,g as Qn,gn as $n,gt as er,h as tr,hn as nr,ht as rr,i as ir,in as ar,it as or,jt as sr,k as cr,kt as lr,l as ur,ln as dr,lt as fr,m as pr,mn as mr,mt as hr,n as gr,nt as _r,o as vr,on as yr,ot as br,p as xr,pn as Sr,pt as Cr,q as wr,qt as Tr,r as Er,rn as Dr,rt as Or,s as kr,st as Ar,t as jr,tn as Mr,tt as Nr,u as Pr,un as Fr,ut as Ir,vt as Lr,w as Rr,wt as zr,x as Br,xt as Vr,y as Hr,yt as Ur,z as Wr,zt as Gr}from"./installSVGRenderer-GvgHjubR.js";var Kr=e(y(),1),qr=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,7,9,32,4,318,1,78,5,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,68,8,2,0,3,0,2,3,2,4,2,0,15,1,83,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,7,19,58,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,199,7,137,9,54,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,55,9,266,3,10,1,2,0,49,6,4,4,14,10,5350,0,7,14,11465,27,2343,9,87,9,39,4,60,6,26,9,535,9,470,0,2,54,8,3,82,0,12,1,19628,1,4178,9,519,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,245,1,2,9,233,0,3,0,8,1,6,0,475,6,110,6,6,9,4759,9,787719,239],Jr=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,4,51,13,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,7,25,39,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,39,27,10,22,251,41,7,1,17,5,57,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,31,9,2,0,3,0,2,37,2,0,26,0,2,0,45,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,200,32,32,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,24,43,261,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,26,3994,6,582,6842,29,1763,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,433,44,212,63,33,24,3,24,45,74,6,0,67,12,65,1,2,0,15,4,10,7381,42,31,98,114,8702,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,229,29,3,0,208,30,2,2,2,1,2,6,3,4,10,1,225,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4381,3,5773,3,7472,16,621,2467,541,1507,4938,6,8489],Yr=`‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࢗ-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ-᫝᫠-᫫ᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‌‍‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・`,Xr=`ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-࢏ࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚ౜ౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽ೜-ೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲊᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-Ƛ꟱-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ`,Zr={3:`abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile`,5:`class enum extends super const export import`,6:`enum`,strict:`implements interface let package private protected public static yield`,strictBind:`eval arguments`},Qr=`break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this`,$r={5:Qr,"5module":Qr+` export import`,6:Qr+` const class extends export import super`},ei=/^in(stanceof)?$/,ti=RegExp(`[`+Xr+`]`),ni=RegExp(`[`+Xr+Yr+`]`);function ri(e,t){for(var n=65536,r=0;r<t.length;r+=2){if(n+=t[r],n>e)return!1;if(n+=t[r+1],n>=e)return!0}return!1}function ii(e,t){return e<65?e===36:e<91?!0:e<97?e===95:e<123?!0:e<=65535?e>=170&&ti.test(String.fromCharCode(e)):t!==!1&&ri(e,Jr)}function ai(e,t){return e<48?e===36:e<58?!0:e<65?!1:e<91?!0:e<97?e===95:e<123?!0:e<=65535?e>=170&&ni.test(String.fromCharCode(e)):t===!1?!1:ri(e,Jr)||ri(e,qr)}var V=function(e,t){t===void 0&&(t={}),this.label=e,this.keyword=t.keyword,this.beforeExpr=!!t.beforeExpr,this.startsExpr=!!t.startsExpr,this.isLoop=!!t.isLoop,this.isAssign=!!t.isAssign,this.prefix=!!t.prefix,this.postfix=!!t.postfix,this.binop=t.binop||null,this.updateContext=null};function oi(e,t){return new V(e,{beforeExpr:!0,binop:t})}var si={beforeExpr:!0},ci={startsExpr:!0},li={};function H(e,t){return t===void 0&&(t={}),t.keyword=e,li[e]=new V(e,t)}var U={num:new V(`num`,ci),regexp:new V(`regexp`,ci),string:new V(`string`,ci),name:new V(`name`,ci),privateId:new V(`privateId`,ci),eof:new V(`eof`),bracketL:new V(`[`,{beforeExpr:!0,startsExpr:!0}),bracketR:new V(`]`),braceL:new V(`{`,{beforeExpr:!0,startsExpr:!0}),braceR:new V(`}`),parenL:new V(`(`,{beforeExpr:!0,startsExpr:!0}),parenR:new V(`)`),comma:new V(`,`,si),semi:new V(`;`,si),colon:new V(`:`,si),dot:new V(`.`),question:new V(`?`,si),questionDot:new V(`?.`),arrow:new V(`=>`,si),template:new V(`template`),invalidTemplate:new V(`invalidTemplate`),ellipsis:new V(`...`,si),backQuote:new V("`",ci),dollarBraceL:new V("${",{beforeExpr:!0,startsExpr:!0}),eq:new V(`=`,{beforeExpr:!0,isAssign:!0}),assign:new V(`_=`,{beforeExpr:!0,isAssign:!0}),incDec:new V(`++/--`,{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new V(`!/~`,{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:oi(`||`,1),logicalAND:oi(`&&`,2),bitwiseOR:oi(`|`,3),bitwiseXOR:oi(`^`,4),bitwiseAND:oi(`&`,5),equality:oi(`==/!=/===/!==`,6),relational:oi(`</>/<=/>=`,7),bitShift:oi(`<</>>/>>>`,8),plusMin:new V(`+/-`,{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:oi(`%`,10),star:oi(`*`,10),slash:oi(`/`,10),starstar:new V(`**`,{beforeExpr:!0}),coalesce:oi(`??`,1),_break:H(`break`),_case:H(`case`,si),_catch:H(`catch`),_continue:H(`continue`),_debugger:H(`debugger`),_default:H(`default`,si),_do:H(`do`,{isLoop:!0,beforeExpr:!0}),_else:H(`else`,si),_finally:H(`finally`),_for:H(`for`,{isLoop:!0}),_function:H(`function`,ci),_if:H(`if`),_return:H(`return`,si),_switch:H(`switch`),_throw:H(`throw`,si),_try:H(`try`),_var:H(`var`),_const:H(`const`),_while:H(`while`,{isLoop:!0}),_with:H(`with`),_new:H(`new`,{beforeExpr:!0,startsExpr:!0}),_this:H(`this`,ci),_super:H(`super`,ci),_class:H(`class`,ci),_extends:H(`extends`,si),_export:H(`export`),_import:H(`import`,ci),_null:H(`null`,ci),_true:H(`true`,ci),_false:H(`false`,ci),_in:H(`in`,{beforeExpr:!0,binop:7}),_instanceof:H(`instanceof`,{beforeExpr:!0,binop:7}),_typeof:H(`typeof`,{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:H(`void`,{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:H(`delete`,{beforeExpr:!0,prefix:!0,startsExpr:!0})},ui=/\r\n?|\n|\u2028|\u2029/,di=new RegExp(ui.source,`g`);function fi(e){return e===10||e===13||e===8232||e===8233}function pi(e,t,n){n===void 0&&(n=e.length);for(var r=t;r<n;r++){var i=e.charCodeAt(r);if(fi(i))return r<n-1&&i===13&&e.charCodeAt(r+1)===10?r+2:r+1}return-1}var mi=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,hi=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,gi=Object.prototype,_i=gi.hasOwnProperty,vi=gi.toString,yi=Object.hasOwn||(function(e,t){return _i.call(e,t)}),bi=Array.isArray||(function(e){return vi.call(e)===`[object Array]`}),xi=Object.create(null);function Si(e){return xi[e]||(xi[e]=RegExp(`^(?:`+e.replace(/ /g,`|`)+`)$`))}function Ci(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}var wi=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,Ti=function(e,t){this.line=e,this.column=t};Ti.prototype.offset=function(e){return new Ti(this.line,this.column+e)};var Ei=function(e,t,n){this.start=t,this.end=n,e.sourceFile!==null&&(this.source=e.sourceFile)};function Di(e,t){for(var n=1,r=0;;){var i=pi(e,r,t);if(i<0)return new Ti(n,t-r);++n,r=i}}var Oi={ecmaVersion:null,sourceType:`script`,strict:!1,onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowAwaitOutsideFunction:null,allowSuperOutsideMethod:null,allowHashBang:!1,checkPrivateFields:!0,locations:!1,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1},ki=!1;function Ai(e){var t={};for(var n in Oi)t[n]=e&&yi(e,n)?e[n]:Oi[n];if(t.ecmaVersion===`latest`?t.ecmaVersion=1e8:t.ecmaVersion==null?(!ki&&typeof console==`object`&&console.warn&&(ki=!0,console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required.
1
+ import{a as e,t}from"./rolldown-runtime-sJBDdmOt.js";import{$r as n,Ai as r,An as i,Ao as a,Ar as o,Bo as s,Br as c,Ci as l,Er as u,Es as d,Ga as f,Ha as p,Hs as m,In as h,Io as g,Ji as _,Jo as v,Jr as y,Ka as b,Ko as x,Li as S,Lt as ee,Mo as C,No as te,Oi as ne,Oo as re,Po as w,Qa as ie,Qs as ae,Ri as oe,Ro as se,Sn as ce,So as le,To as ue,Tr as T,Ts as E,Ur as de,Us as D,Vo as fe,Wa as pe,Wo as O,Wr as k,Xo as me,Za as he,_r as ge,_s as _e,ao as ve,as as ye,ba as be,bn as xe,br as Se,cr as Ce,cs as we,ea as Te,eo as Ee,fo as De,go as A,gr as Oe,hr as ke,i as Ae,is as je,jo as Me,lo as j,lr as Ne,ls as Pe,mo as Fe,mr as Ie,no as Le,ns as Re,os as M,pc as N,po as P,ps as ze,qa as Be,qo as F,qs as Ve,ro as He,rr as Ue,rs as We,sc as Ge,so as Ke,sr as qe,ss as Je,tc as Ye,to as I,vi as Xe,wi as Ze,xn as Qe,yo as L,zi as $e,zt as et}from"./loadShare-eager-dmdYQhAl.js";import{a as tt,i as nt,n as rt,o as it,r as at,s as ot,t as st}from"./MoreHoriz-CS7nODK8.js";import{n as ct,t as lt}from"./KeyboardArrowRight-ifvmV1ZL.js";import{t as ut}from"./Remove-IN7ZNaCF.js";import{t as dt}from"./en-US-BjjaEI6N.js";import{a as ft,c as pt,d as mt,f as ht,i as gt,l as _t,n as vt,o as yt,r as bt,s as xt,u as St}from"./locale-DN6Bdkdt.js";import{t as Ct}from"./AdminUtils-Dc1eHsx5.js";import{t as wt}from"./AceEditor-BgLZBrSD.js";import{n as Tt,t as Et}from"./ctrlEnter-CruFIPb_.js";import{G as Dt,M as Ot,r as kt}from"./bootstrap-D16lu6rd.js";import{a as At,c as jt,d as Mt,i as Nt,l as Pt,n as Ft,o as It,r as Lt,s as Rt,t as zt,u as Bt}from"./zh-cn-B6dBxOyw.js";import{t as Vt}from"./CustomModal-Do2qVZr7.js";import{$ as Ht,$t as R,A as Ut,At as Wt,B as Gt,Bt as Kt,C as qt,Ct as Jt,D as z,Dt as Yt,E as Xt,Et as Zt,F as Qt,Ft as $t,G as en,Gt as tn,H as nn,Ht as rn,I as an,It as on,J as sn,Jt as cn,K as ln,Kt as un,L as dn,Lt as fn,M as pn,Mt as mn,O as hn,Ot as gn,P as _n,Q as vn,Qt as yn,R as bn,Rt as xn,S as Sn,St as Cn,T as wn,Tt as Tn,U as En,Ut as Dn,Vt as On,W as kn,Wt as An,X as jn,Xt as Mn,Yt as Nn,Z as Pn,Zt as Fn,_ as In,_n as B,_t as Ln,a as Rn,an as zn,at as Bn,b as Vn,bt as Hn,c as Un,cn as Wn,d as Gn,dn as Kn,dt as qn,en as Jn,et as Yn,f as Xn,fn as Zn,g as Qn,gn as $n,gt as er,h as tr,hn as nr,ht as rr,i as ir,in as ar,it as or,jt as sr,k as cr,kt as lr,l as ur,ln as dr,lt as fr,m as pr,mn as mr,mt as hr,n as gr,nt as _r,o as vr,on as yr,ot as br,p as xr,pn as Sr,pt as Cr,q as wr,qt as Tr,r as Er,rn as Dr,rt as Or,s as kr,st as Ar,t as jr,tn as Mr,tt as Nr,u as Pr,un as Fr,ut as Ir,vt as Lr,w as Rr,wt as zr,x as Br,xt as Vr,y as Hr,yt as Ur,z as Wr,zt as Gr}from"./installSVGRenderer-DPdkRa_d.js";var Kr=e(y(),1),qr=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,7,9,32,4,318,1,78,5,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,68,8,2,0,3,0,2,3,2,4,2,0,15,1,83,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,7,19,58,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,199,7,137,9,54,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,55,9,266,3,10,1,2,0,49,6,4,4,14,10,5350,0,7,14,11465,27,2343,9,87,9,39,4,60,6,26,9,535,9,470,0,2,54,8,3,82,0,12,1,19628,1,4178,9,519,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,245,1,2,9,233,0,3,0,8,1,6,0,475,6,110,6,6,9,4759,9,787719,239],Jr=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,4,51,13,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,7,25,39,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,39,27,10,22,251,41,7,1,17,5,57,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,31,9,2,0,3,0,2,37,2,0,26,0,2,0,45,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,200,32,32,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,24,43,261,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,26,3994,6,582,6842,29,1763,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,433,44,212,63,33,24,3,24,45,74,6,0,67,12,65,1,2,0,15,4,10,7381,42,31,98,114,8702,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,229,29,3,0,208,30,2,2,2,1,2,6,3,4,10,1,225,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4381,3,5773,3,7472,16,621,2467,541,1507,4938,6,8489],Yr=`‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࢗ-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ-᫝᫠-᫫ᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‌‍‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・`,Xr=`ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-࢏ࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚ౜ౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽ೜-ೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲊᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-Ƛ꟱-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ`,Zr={3:`abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile`,5:`class enum extends super const export import`,6:`enum`,strict:`implements interface let package private protected public static yield`,strictBind:`eval arguments`},Qr=`break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this`,$r={5:Qr,"5module":Qr+` export import`,6:Qr+` const class extends export import super`},ei=/^in(stanceof)?$/,ti=RegExp(`[`+Xr+`]`),ni=RegExp(`[`+Xr+Yr+`]`);function ri(e,t){for(var n=65536,r=0;r<t.length;r+=2){if(n+=t[r],n>e)return!1;if(n+=t[r+1],n>=e)return!0}return!1}function ii(e,t){return e<65?e===36:e<91?!0:e<97?e===95:e<123?!0:e<=65535?e>=170&&ti.test(String.fromCharCode(e)):t!==!1&&ri(e,Jr)}function ai(e,t){return e<48?e===36:e<58?!0:e<65?!1:e<91?!0:e<97?e===95:e<123?!0:e<=65535?e>=170&&ni.test(String.fromCharCode(e)):t===!1?!1:ri(e,Jr)||ri(e,qr)}var V=function(e,t){t===void 0&&(t={}),this.label=e,this.keyword=t.keyword,this.beforeExpr=!!t.beforeExpr,this.startsExpr=!!t.startsExpr,this.isLoop=!!t.isLoop,this.isAssign=!!t.isAssign,this.prefix=!!t.prefix,this.postfix=!!t.postfix,this.binop=t.binop||null,this.updateContext=null};function oi(e,t){return new V(e,{beforeExpr:!0,binop:t})}var si={beforeExpr:!0},ci={startsExpr:!0},li={};function H(e,t){return t===void 0&&(t={}),t.keyword=e,li[e]=new V(e,t)}var U={num:new V(`num`,ci),regexp:new V(`regexp`,ci),string:new V(`string`,ci),name:new V(`name`,ci),privateId:new V(`privateId`,ci),eof:new V(`eof`),bracketL:new V(`[`,{beforeExpr:!0,startsExpr:!0}),bracketR:new V(`]`),braceL:new V(`{`,{beforeExpr:!0,startsExpr:!0}),braceR:new V(`}`),parenL:new V(`(`,{beforeExpr:!0,startsExpr:!0}),parenR:new V(`)`),comma:new V(`,`,si),semi:new V(`;`,si),colon:new V(`:`,si),dot:new V(`.`),question:new V(`?`,si),questionDot:new V(`?.`),arrow:new V(`=>`,si),template:new V(`template`),invalidTemplate:new V(`invalidTemplate`),ellipsis:new V(`...`,si),backQuote:new V("`",ci),dollarBraceL:new V("${",{beforeExpr:!0,startsExpr:!0}),eq:new V(`=`,{beforeExpr:!0,isAssign:!0}),assign:new V(`_=`,{beforeExpr:!0,isAssign:!0}),incDec:new V(`++/--`,{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new V(`!/~`,{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:oi(`||`,1),logicalAND:oi(`&&`,2),bitwiseOR:oi(`|`,3),bitwiseXOR:oi(`^`,4),bitwiseAND:oi(`&`,5),equality:oi(`==/!=/===/!==`,6),relational:oi(`</>/<=/>=`,7),bitShift:oi(`<</>>/>>>`,8),plusMin:new V(`+/-`,{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:oi(`%`,10),star:oi(`*`,10),slash:oi(`/`,10),starstar:new V(`**`,{beforeExpr:!0}),coalesce:oi(`??`,1),_break:H(`break`),_case:H(`case`,si),_catch:H(`catch`),_continue:H(`continue`),_debugger:H(`debugger`),_default:H(`default`,si),_do:H(`do`,{isLoop:!0,beforeExpr:!0}),_else:H(`else`,si),_finally:H(`finally`),_for:H(`for`,{isLoop:!0}),_function:H(`function`,ci),_if:H(`if`),_return:H(`return`,si),_switch:H(`switch`),_throw:H(`throw`,si),_try:H(`try`),_var:H(`var`),_const:H(`const`),_while:H(`while`,{isLoop:!0}),_with:H(`with`),_new:H(`new`,{beforeExpr:!0,startsExpr:!0}),_this:H(`this`,ci),_super:H(`super`,ci),_class:H(`class`,ci),_extends:H(`extends`,si),_export:H(`export`),_import:H(`import`,ci),_null:H(`null`,ci),_true:H(`true`,ci),_false:H(`false`,ci),_in:H(`in`,{beforeExpr:!0,binop:7}),_instanceof:H(`instanceof`,{beforeExpr:!0,binop:7}),_typeof:H(`typeof`,{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:H(`void`,{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:H(`delete`,{beforeExpr:!0,prefix:!0,startsExpr:!0})},ui=/\r\n?|\n|\u2028|\u2029/,di=new RegExp(ui.source,`g`);function fi(e){return e===10||e===13||e===8232||e===8233}function pi(e,t,n){n===void 0&&(n=e.length);for(var r=t;r<n;r++){var i=e.charCodeAt(r);if(fi(i))return r<n-1&&i===13&&e.charCodeAt(r+1)===10?r+2:r+1}return-1}var mi=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,hi=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,gi=Object.prototype,_i=gi.hasOwnProperty,vi=gi.toString,yi=Object.hasOwn||(function(e,t){return _i.call(e,t)}),bi=Array.isArray||(function(e){return vi.call(e)===`[object Array]`}),xi=Object.create(null);function Si(e){return xi[e]||(xi[e]=RegExp(`^(?:`+e.replace(/ /g,`|`)+`)$`))}function Ci(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}var wi=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,Ti=function(e,t){this.line=e,this.column=t};Ti.prototype.offset=function(e){return new Ti(this.line,this.column+e)};var Ei=function(e,t,n){this.start=t,this.end=n,e.sourceFile!==null&&(this.source=e.sourceFile)};function Di(e,t){for(var n=1,r=0;;){var i=pi(e,r,t);if(i<0)return new Ti(n,t-r);++n,r=i}}var Oi={ecmaVersion:null,sourceType:`script`,strict:!1,onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowAwaitOutsideFunction:null,allowSuperOutsideMethod:null,allowHashBang:!1,checkPrivateFields:!0,locations:!1,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1},ki=!1;function Ai(e){var t={};for(var n in Oi)t[n]=e&&yi(e,n)?e[n]:Oi[n];if(t.ecmaVersion===`latest`?t.ecmaVersion=1e8:t.ecmaVersion==null?(!ki&&typeof console==`object`&&console.warn&&(ki=!0,console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required.
2
2
  Defaulting to 2020, but this will stop working in the future.`)),t.ecmaVersion=11):t.ecmaVersion>=2015&&(t.ecmaVersion-=2009),t.allowReserved??=t.ecmaVersion<5,e&&e.allowHashBang!=null||(t.allowHashBang=t.ecmaVersion>=14),bi(t.onToken)){var r=t.onToken;t.onToken=function(e){return r.push(e)}}if(bi(t.onComment)&&(t.onComment=ji(t,t.onComment)),t.sourceType===`commonjs`&&t.allowAwaitOutsideFunction)throw Error(`Cannot use allowAwaitOutsideFunction with sourceType: commonjs`);return t}function ji(e,t){return function(n,r,i,a,o,s){var c={type:n?`Block`:`Line`,value:r,start:i,end:a};e.locations&&(c.loc=new Ei(this,o,s)),e.ranges&&(c.range=[i,a]),t.push(c)}}var Mi=1,Ni=2,Pi=4,Fi=8,Ii=16,Li=32,Ri=64,zi=128,Bi=256,Vi=512,Hi=1024,Ui=Mi|Ni|Bi;function Wi(e,t){return Ni|(e?Pi:0)|(t?Fi:0)}var Gi=0,Ki=1,qi=2,Ji=3,Yi=4,Xi=5,W=function(e,t,n){this.options=e=Ai(e),this.sourceFile=e.sourceFile,this.keywords=Si($r[e.ecmaVersion>=6?6:e.sourceType===`module`?`5module`:5]);var r=``;e.allowReserved!==!0&&(r=Zr[e.ecmaVersion>=6?6:e.ecmaVersion===5?5:3],e.sourceType===`module`&&(r+=` await`)),this.reservedWords=Si(r);var i=(r?r+` `:``)+Zr.strict;this.reservedWordsStrict=Si(i),this.reservedWordsStrictBind=Si(i+` `+Zr.strictBind),this.input=String(t),this.containsEsc=!1,n?(this.pos=n,this.lineStart=this.input.lastIndexOf(`
3
3
  `,n-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(ui).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=U.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.inModule=e.sourceType===`module`,this.strict=this.inModule||e.strict===!0||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.potentialArrowInForAwait=!1,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels=[],this.undefinedExports=Object.create(null),this.pos===0&&e.allowHashBang&&this.input.slice(0,2)===`#!`&&this.skipLineComment(2),this.scopeStack=[],this.enterScope(this.options.sourceType===`commonjs`?Ni:Mi),this.regexpState=null,this.privateNameStack=[]},Zi={inFunction:{configurable:!0},inGenerator:{configurable:!0},inAsync:{configurable:!0},canAwait:{configurable:!0},allowReturn:{configurable:!0},allowSuper:{configurable:!0},allowDirectSuper:{configurable:!0},treatFunctionsAsVar:{configurable:!0},allowNewDotTarget:{configurable:!0},allowUsing:{configurable:!0},inClassStaticBlock:{configurable:!0}};W.prototype.parse=function(){var e=this,t=this.options.program||this.startNode();return this.nextToken(),this.catchStackOverflow(function(){return e.parseTopLevel(t)})},Zi.inFunction.get=function(){return(this.currentVarScope().flags&Ni)>0},Zi.inGenerator.get=function(){return(this.currentVarScope().flags&Fi)>0},Zi.inAsync.get=function(){return(this.currentVarScope().flags&Pi)>0},Zi.canAwait.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e].flags;if(t&(Bi|Vi))return!1;if(t&Ni)return(t&Pi)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction},Zi.allowReturn.get=function(){return!!(this.inFunction||this.options.allowReturnOutsideFunction&&this.currentVarScope().flags&Mi)},Zi.allowSuper.get=function(){return(this.currentThisScope().flags&Ri)>0||this.options.allowSuperOutsideMethod},Zi.allowDirectSuper.get=function(){return(this.currentThisScope().flags&zi)>0},Zi.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())},Zi.allowNewDotTarget.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e].flags;if(t&(Bi|Vi)||t&Ni&&!(t&Ii))return!0}return!1},Zi.allowUsing.get=function(){var e=this.currentScope().flags;return!(e&Hi||!this.inModule&&e&Mi)},Zi.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&Bi)>0},W.extend=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];for(var n=this,r=0;r<e.length;r++)n=e[r](n);return n},W.parse=function(e,t){return new this(t,e).parse()},W.parseExpressionAt=function(e,t,n){var r=new this(n,e,t);return r.nextToken(),r.parseExpression()},W.tokenizer=function(e,t){return new this(t,e)},Object.defineProperties(W.prototype,Zi);var Qi=W.prototype,$i=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;Qi.strictDirective=function(e){if(this.options.ecmaVersion<5)return!1;for(;;){hi.lastIndex=e,e+=hi.exec(this.input)[0].length;var t=$i.exec(this.input.slice(e));if(!t)return!1;if((t[1]||t[2])===`use strict`){hi.lastIndex=e+t[0].length;var n=hi.exec(this.input),r=n.index+n[0].length,i=this.input.charAt(r);return i===`;`||i===`}`||ui.test(n[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(i)||i===`!`&&this.input.charAt(r+1)===`=`)}e+=t[0].length,hi.lastIndex=e,e+=hi.exec(this.input)[0].length,this.input[e]===`;`&&e++}},Qi.eat=function(e){return this.type===e&&(this.next(),!0)},Qi.isContextual=function(e){return this.type===U.name&&this.value===e&&!this.containsEsc},Qi.eatContextual=function(e){return this.isContextual(e)?(this.next(),!0):!1},Qi.catchStackOverflow=function(e){try{return e()}catch(e){if(e instanceof Error&&(/\bstack\b.*\b(exceeded|overflow)\b/i.test(e.message)||/\btoo much recursion\b/i.test(e.message)))this.raise(this.start,`Not enough stack space to parse input`);else throw e}},Qi.expectContextual=function(e){this.eatContextual(e)||this.unexpected()},Qi.canInsertSemicolon=function(){return this.type===U.eof||this.type===U.braceR||ui.test(this.input.slice(this.lastTokEnd,this.start))},Qi.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0},Qi.semicolon=function(){!this.eat(U.semi)&&!this.insertSemicolon()&&this.unexpected()},Qi.afterTrailingComma=function(e,t){if(this.type===e)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),t||this.next(),!0},Qi.expect=function(e){this.eat(e)||this.unexpected()},Qi.unexpected=function(e){this.raise(e??this.start,`Unexpected token`)};var ea=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};Qi.checkPatternErrors=function(e,t){if(e){e.trailingComma>-1&&this.raiseRecoverable(e.trailingComma,`Comma is not permitted after the rest element`);var n=t?e.parenthesizedAssign:e.parenthesizedBind;n>-1&&this.raiseRecoverable(n,t?`Assigning to rvalue`:`Parenthesized pattern`)}},Qi.checkExpressionErrors=function(e,t){if(!e)return!1;var n=e.shorthandAssign,r=e.doubleProto;if(!t)return n>=0||r>=0;n>=0&&this.raise(n,`Shorthand property assignments are valid only in destructuring patterns`),r>=0&&this.raiseRecoverable(r,`Redefinition of __proto__ property`)},Qi.checkYieldAwaitInDefaultParams=function(){this.yieldPos&&(!this.awaitPos||this.yieldPos<this.awaitPos)&&this.raise(this.yieldPos,`Yield expression cannot be a default value`),this.awaitPos&&this.raise(this.awaitPos,`Await expression cannot be a default value`)},Qi.isSimpleAssignTarget=function(e){return e.type===`ParenthesizedExpression`?this.isSimpleAssignTarget(e.expression):e.type===`Identifier`||e.type===`MemberExpression`};var G=W.prototype;G.parseTopLevel=function(e){var t=Object.create(null);for(e.body||=[];this.type!==U.eof;){var n=this.parseStatement(null,!0,t);e.body.push(n)}if(this.inModule)for(var r=0,i=Object.keys(this.undefinedExports);r<i.length;r+=1){var a=i[r];this.raiseRecoverable(this.undefinedExports[a].start,`Export '`+a+`' is not defined`)}return this.adaptDirectivePrologue(e.body),this.next(),e.sourceType=this.options.sourceType===`commonjs`?`script`:this.options.sourceType,this.finishNode(e,`Program`)};var ta={kind:`loop`},na={kind:`switch`};G.isLet=function(e){if(this.options.ecmaVersion<6||!this.isContextual(`let`))return!1;hi.lastIndex=this.pos;var t=hi.exec(this.input),n=this.pos+t[0].length,r=this.fullCharCodeAt(n);if(r===91||r===92)return!0;if(e)return!1;if(r===123)return!0;if(ii(r)){var i=n;do n+=r<=65535?1:2;while(ai(r=this.fullCharCodeAt(n)));if(r===92)return!0;var a=this.input.slice(i,n);if(!ei.test(a))return!0}return!1},G.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual(`async`))return!1;hi.lastIndex=this.pos;var e=hi.exec(this.input),t=this.pos+e[0].length,n;return!ui.test(this.input.slice(this.pos,t))&&this.input.slice(t,t+8)===`function`&&(t+8===this.input.length||!(ai(n=this.fullCharCodeAt(t+8))||n===92))},G.isUsingKeyword=function(e,t){if(this.options.ecmaVersion<17||!this.isContextual(e?`await`:`using`))return!1;hi.lastIndex=this.pos;var n=hi.exec(this.input),r=this.pos+n[0].length;if(ui.test(this.input.slice(this.pos,r)))return!1;if(e){var i=r+5,a;if(this.input.slice(r,i)!==`using`||i===this.input.length||ai(a=this.fullCharCodeAt(i))||a===92)return!1;hi.lastIndex=i;var o=hi.exec(this.input);if(r=i+o[0].length,o&&ui.test(this.input.slice(i,r)))return!1}var s=this.fullCharCodeAt(r);if(!ii(s)&&s!==92)return!1;var c=r;do r+=s<=65535?1:2;while(ai(s=this.fullCharCodeAt(r)));if(s===92)return!0;var l=this.input.slice(c,r);if(ei.test(l))return!1;if(t&&!e&&l===`of`){hi.lastIndex=r;var u=hi.exec(this.input);if(r+=u[0].length,this.input.charCodeAt(r)!==61||(s=this.input.charCodeAt(r+1))===61||s===62)return!1}return!0},G.isAwaitUsing=function(e){return this.isUsingKeyword(!0,e)},G.isUsing=function(e){return this.isUsingKeyword(!1,e)},G.parseStatement=function(e,t,n){var r=this.type,i=this.startNode(),a;switch(this.isLet(e)&&(r=U._var,a=`let`),r){case U._break:case U._continue:return this.parseBreakContinueStatement(i,r.keyword);case U._debugger:return this.parseDebuggerStatement(i);case U._do:return this.parseDoStatement(i);case U._for:return this.parseForStatement(i);case U._function:return e&&(this.strict||e!==`if`&&e!==`label`)&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(i,!1,!e);case U._class:return e&&this.unexpected(),this.parseClass(i,!0);case U._if:return this.parseIfStatement(i);case U._return:return this.parseReturnStatement(i);case U._switch:return this.parseSwitchStatement(i);case U._throw:return this.parseThrowStatement(i);case U._try:return this.parseTryStatement(i);case U._const:case U._var:return a||=this.value,e&&a!==`var`&&this.unexpected(),this.parseVarStatement(i,a);case U._while:return this.parseWhileStatement(i);case U._with:return this.parseWithStatement(i);case U.braceL:return this.parseBlock(!0,i);case U.semi:return this.parseEmptyStatement(i);case U._export:case U._import:if(this.options.ecmaVersion>10&&r===U._import){hi.lastIndex=this.pos;var o=hi.exec(this.input),s=this.pos+o[0].length,c=this.input.charCodeAt(s);if(c===40||c===46)return this.parseExpressionStatement(i,this.parseExpression())}return this.options.allowImportExportEverywhere||(t||this.raise(this.start,`'import' and 'export' may only appear at the top level`),this.inModule||this.raise(this.start,`'import' and 'export' may appear only with 'sourceType: module'`)),r===U._import?this.parseImport(i):this.parseExport(i,n);default:if(this.isAsyncFunction())return e&&this.unexpected(),this.next(),this.parseFunctionStatement(i,!0,!e);var l=this.isAwaitUsing(!1)?`await using`:this.isUsing(!1)?`using`:null;if(l)return this.allowUsing||this.raise(this.start,"Using declaration cannot appear in the top level when source type is `script` or in the bare case statement"),e&&this.raise(this.start,`Using declaration is not allowed in single-statement positions`),l===`await using`&&(this.canAwait||this.raise(this.start,`Await using cannot appear outside of async function`),this.next()),this.next(),this.parseVar(i,!1,l),this.semicolon(),this.finishNode(i,`VariableDeclaration`);var u=this.value,d=this.parseExpression();return r===U.name&&d.type===`Identifier`&&this.eat(U.colon)?this.parseLabeledStatement(i,u,d,e):this.parseExpressionStatement(i,d)}},G.parseBreakContinueStatement=function(e,t){var n=t===`break`;this.next(),this.eat(U.semi)||this.insertSemicolon()?e.label=null:this.type===U.name?(e.label=this.parseIdent(),this.semicolon()):this.unexpected();for(var r=0;r<this.labels.length;++r){var i=this.labels[r];if((e.label==null||i.name===e.label.name)&&(i.kind!=null&&(n||i.kind===`loop`)||e.label&&n))break}return r===this.labels.length&&this.raise(e.start,`Unsyntactic `+t),this.finishNode(e,n?`BreakStatement`:`ContinueStatement`)},G.parseDebuggerStatement=function(e){return this.next(),this.semicolon(),this.finishNode(e,`DebuggerStatement`)},G.parseDoStatement=function(e){return this.next(),this.labels.push(ta),e.body=this.parseStatement(`do`),this.labels.pop(),this.expect(U._while),e.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(U.semi):this.semicolon(),this.finishNode(e,`DoWhileStatement`)},G.parseForStatement=function(e){this.next();var t=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual(`await`)?this.lastTokStart:-1;if(this.labels.push(ta),this.enterScope(0),this.expect(U.parenL),this.type===U.semi)return t>-1&&this.unexpected(t),this.parseFor(e,null);var n=this.isLet();if(this.type===U._var||this.type===U._const||n){var r=this.startNode(),i=n?`let`:this.value;return this.next(),this.parseVar(r,!0,i),this.finishNode(r,`VariableDeclaration`),this.parseForAfterInit(e,r,t)}var a=this.isContextual(`let`),o=!1,s=this.isUsing(!0)?`using`:this.isAwaitUsing(!0)?`await using`:null;if(s){var c=this.startNode();return this.next(),s===`await using`&&(this.canAwait||this.raise(this.start,`Await using cannot appear outside of async function`),this.next()),this.parseVar(c,!0,s),this.finishNode(c,`VariableDeclaration`),this.parseForAfterInit(e,c,t)}var l=this.containsEsc,u=new ea,d=this.start,f=t>-1?this.parseExprSubscripts(u,`await`):this.parseExpression(!0,u);return this.type===U._in||(o=this.options.ecmaVersion>=6&&this.isContextual(`of`))?(t>-1?(this.type===U._in&&this.unexpected(t),e.await=!0):o&&this.options.ecmaVersion>=8&&(f.start===d&&!l&&f.type===`Identifier`&&f.name===`async`?this.unexpected():this.options.ecmaVersion>=9&&(e.await=!1)),a&&o&&this.raise(f.start,`The left-hand side of a for-of loop may not start with 'let'.`),this.toAssignable(f,!1,u),this.checkLValPattern(f),this.parseForIn(e,f)):(this.checkExpressionErrors(u,!0),t>-1&&this.unexpected(t),this.parseFor(e,f))},G.parseForAfterInit=function(e,t,n){return(this.type===U._in||this.options.ecmaVersion>=6&&this.isContextual(`of`))&&t.declarations.length===1?(this.type===U._in?(t.kind!==`using`&&t.kind!==`await using`||t.declarations[0].init||this.raise(this.start,`Using declaration is not allowed in for-in loops`),this.options.ecmaVersion>=9&&n>-1&&this.unexpected(n)):this.options.ecmaVersion>=9&&(e.await=n>-1),this.parseForIn(e,t)):(n>-1&&this.unexpected(n),this.parseFor(e,t))},G.parseFunctionStatement=function(e,t,n){return this.next(),this.parseFunction(e,ia|(n?0:aa),!1,t)},G.parseIfStatement=function(e){return this.next(),e.test=this.parseParenExpression(),e.consequent=this.parseStatement(`if`),e.alternate=this.eat(U._else)?this.parseStatement(`if`):null,this.finishNode(e,`IfStatement`)},G.parseReturnStatement=function(e){return this.allowReturn||this.raise(this.start,`'return' outside of function`),this.next(),this.eat(U.semi)||this.insertSemicolon()?e.argument=null:(e.argument=this.parseExpression(),this.semicolon()),this.finishNode(e,`ReturnStatement`)},G.parseSwitchStatement=function(e){this.next(),e.discriminant=this.parseParenExpression(),e.cases=[],this.expect(U.braceL),this.labels.push(na),this.enterScope(Hi);for(var t,n=!1;this.type!==U.braceR;)if(this.type===U._case||this.type===U._default){var r=this.type===U._case;t&&this.finishNode(t,`SwitchCase`),e.cases.push(t=this.startNode()),t.consequent=[],this.next(),r?t.test=this.parseExpression():(n&&this.raiseRecoverable(this.lastTokStart,`Multiple default clauses`),n=!0,t.test=null),this.expect(U.colon)}else t||this.unexpected(),t.consequent.push(this.parseStatement(null));return this.exitScope(),t&&this.finishNode(t,`SwitchCase`),this.next(),this.labels.pop(),this.finishNode(e,`SwitchStatement`)},G.parseThrowStatement=function(e){return this.next(),ui.test(this.input.slice(this.lastTokEnd,this.start))&&this.raise(this.lastTokEnd,`Illegal newline after throw`),e.argument=this.parseExpression(),this.semicolon(),this.finishNode(e,`ThrowStatement`)};var ra=[];G.parseCatchClauseParam=function(){var e=this.parseBindingAtom(),t=e.type===`Identifier`;return this.enterScope(t?Li:0),this.checkLValPattern(e,t?Yi:qi),this.expect(U.parenR),e},G.parseTryStatement=function(e){if(this.next(),e.block=this.parseBlock(),e.handler=null,this.type===U._catch){var t=this.startNode();this.next(),this.eat(U.parenL)?t.param=this.parseCatchClauseParam():(this.options.ecmaVersion<10&&this.unexpected(),t.param=null,this.enterScope(0)),t.body=this.parseBlock(!1),this.exitScope(),e.handler=this.finishNode(t,`CatchClause`)}return e.finalizer=this.eat(U._finally)?this.parseBlock():null,!e.handler&&!e.finalizer&&this.raise(e.start,`Missing catch or finally clause`),this.finishNode(e,`TryStatement`)},G.parseVarStatement=function(e,t,n){return this.next(),this.parseVar(e,!1,t,n),this.semicolon(),this.finishNode(e,`VariableDeclaration`)},G.parseWhileStatement=function(e){return this.next(),e.test=this.parseParenExpression(),this.labels.push(ta),e.body=this.parseStatement(`while`),this.labels.pop(),this.finishNode(e,`WhileStatement`)},G.parseWithStatement=function(e){return this.strict&&this.raise(this.start,`'with' in strict mode`),this.next(),e.object=this.parseParenExpression(),e.body=this.parseStatement(`with`),this.finishNode(e,`WithStatement`)},G.parseEmptyStatement=function(e){return this.next(),this.finishNode(e,`EmptyStatement`)},G.parseLabeledStatement=function(e,t,n,r){for(var i=0,a=this.labels;i<a.length;i+=1)a[i].name===t&&this.raise(n.start,`Label '`+t+`' is already declared`);for(var o=this.type.isLoop?`loop`:this.type===U._switch?`switch`:null,s=this.labels.length-1;s>=0;s--){var c=this.labels[s];if(c.statementStart===e.start)c.statementStart=this.start,c.kind=o;else break}return this.labels.push({name:t,kind:o,statementStart:this.start}),e.body=this.parseStatement(r?r.indexOf(`label`)===-1?r+`label`:r:`label`),this.labels.pop(),e.label=n,this.finishNode(e,`LabeledStatement`)},G.parseExpressionStatement=function(e,t){return e.expression=t,this.semicolon(),this.finishNode(e,`ExpressionStatement`)},G.parseBlock=function(e,t,n){for(e===void 0&&(e=!0),t===void 0&&(t=this.startNode()),t.body=[],this.expect(U.braceL),e&&this.enterScope(0);this.type!==U.braceR;){var r=this.parseStatement(null);t.body.push(r)}return n&&(this.strict=!1),this.next(),e&&this.exitScope(),this.finishNode(t,`BlockStatement`)},G.parseFor=function(e,t){return e.init=t,this.expect(U.semi),e.test=this.type===U.semi?null:this.parseExpression(),this.expect(U.semi),e.update=this.type===U.parenR?null:this.parseExpression(),this.expect(U.parenR),e.body=this.parseStatement(`for`),this.exitScope(),this.labels.pop(),this.finishNode(e,`ForStatement`)},G.parseForIn=function(e,t){var n=this.type===U._in;return this.next(),t.type===`VariableDeclaration`&&t.declarations[0].init!=null&&(!n||this.options.ecmaVersion<8||this.strict||t.kind!==`var`||t.declarations[0].id.type!==`Identifier`)&&this.raise(t.start,(n?`for-in`:`for-of`)+` loop variable declaration may not have an initializer`),e.left=t,e.right=n?this.parseExpression():this.parseMaybeAssign(),this.expect(U.parenR),e.body=this.parseStatement(`for`),this.exitScope(),this.labels.pop(),this.finishNode(e,n?`ForInStatement`:`ForOfStatement`)},G.parseVar=function(e,t,n,r){for(e.declarations=[],e.kind=n;;){var i=this.startNode();if(this.parseVarId(i,n),this.eat(U.eq)?i.init=this.parseMaybeAssign(t):!r&&n===`const`&&!(this.type===U._in||this.options.ecmaVersion>=6&&this.isContextual(`of`))?this.unexpected():!r&&(n===`using`||n===`await using`)&&this.options.ecmaVersion>=17&&this.type!==U._in&&!this.isContextual(`of`)?this.raise(this.lastTokEnd,`Missing initializer in `+n+` declaration`):!r&&i.id.type!==`Identifier`&&(!t||this.type!==U._in&&!this.isContextual(`of`))?this.raise(this.lastTokEnd,`Complex binding patterns require an initialization value`):i.init=null,e.declarations.push(this.finishNode(i,`VariableDeclarator`)),!this.eat(U.comma))break}return e},G.parseVarId=function(e,t){e.id=t===`using`||t===`await using`?this.parseIdent():this.parseBindingAtom(),this.checkLValPattern(e.id,t===`var`?Ki:qi,!1)};var ia=1,aa=2,oa=4;G.parseFunction=function(e,t,n,r,i){this.initFunction(e),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!r)&&(this.type===U.star&&t&aa&&this.unexpected(),e.generator=this.eat(U.star)),this.options.ecmaVersion>=8&&(e.async=!!r),t&ia&&(e.id=t&oa&&this.type!==U.name?null:this.parseIdent(),e.id&&!(t&aa)&&this.checkLValSimple(e.id,this.strict||e.generator||e.async?this.treatFunctionsAsVar?Ki:qi:Ji));var a=this.yieldPos,o=this.awaitPos,s=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Wi(e.async,e.generator)),t&ia||(e.id=this.type===U.name?this.parseIdent():null),this.parseFunctionParams(e),this.parseFunctionBody(e,n,!1,i),this.yieldPos=a,this.awaitPos=o,this.awaitIdentPos=s,this.finishNode(e,t&ia?`FunctionDeclaration`:`FunctionExpression`)},G.parseFunctionParams=function(e){this.expect(U.parenL),e.params=this.parseBindingList(U.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()},G.parseClass=function(e,t){this.next();var n=this.strict;this.strict=!0,this.parseClassId(e,t),this.parseClassSuper(e);var r=this.enterClassBody(),i=this.startNode(),a=!1;for(i.body=[],this.expect(U.braceL);this.type!==U.braceR;){var o=this.parseClassElement(e.superClass!==null);o&&(i.body.push(o),o.type===`MethodDefinition`&&o.kind===`constructor`?(a&&this.raiseRecoverable(o.start,`Duplicate constructor in the same class`),a=!0):o.key&&o.key.type===`PrivateIdentifier`&&sa(r,o)&&this.raiseRecoverable(o.key.start,`Identifier '#`+o.key.name+`' has already been declared`))}return this.strict=n,this.next(),e.body=this.finishNode(i,`ClassBody`),this.exitClassBody(),this.finishNode(e,t?`ClassDeclaration`:`ClassExpression`)},G.parseClassElement=function(e){if(this.eat(U.semi))return null;var t=this.options.ecmaVersion,n=this.startNode(),r=``,i=!1,a=!1,o=`method`,s=!1;if(this.eatContextual(`static`)){if(t>=13&&this.eat(U.braceL))return this.parseClassStaticBlock(n),n;this.isClassElementNameStart()||this.type===U.star?s=!0:r=`static`}if(n.static=s,!r&&t>=8&&this.eatContextual(`async`)&&((this.isClassElementNameStart()||this.type===U.star)&&!this.canInsertSemicolon()?a=!0:r=`async`),!r&&(t>=9||!a)&&this.eat(U.star)&&(i=!0),!r&&!a&&!i){var c=this.value;(this.eatContextual(`get`)||this.eatContextual(`set`))&&(this.isClassElementNameStart()?o=c:r=c)}if(r?(n.computed=!1,n.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),n.key.name=r,this.finishNode(n.key,`Identifier`)):this.parseClassElementName(n),t<13||this.type===U.parenL||o!==`method`||i||a){var l=!n.static&&ca(n,`constructor`),u=l&&e;l&&o!==`method`&&this.raise(n.key.start,`Constructor can't have get/set modifier`),n.kind=l?`constructor`:o,this.parseClassMethod(n,i,a,u)}else this.parseClassField(n);return n},G.isClassElementNameStart=function(){return this.type===U.name||this.type===U.privateId||this.type===U.num||this.type===U.string||this.type===U.bracketL||this.type.keyword},G.parseClassElementName=function(e){this.type===U.privateId?(this.value===`constructor`&&this.raise(this.start,`Classes can't have an element named '#constructor'`),e.computed=!1,e.key=this.parsePrivateIdent()):this.parsePropertyName(e)},G.parseClassMethod=function(e,t,n,r){var i=e.key;e.kind===`constructor`?(t&&this.raise(i.start,`Constructor can't be a generator`),n&&this.raise(i.start,`Constructor can't be an async method`)):e.static&&ca(e,`prototype`)&&this.raise(i.start,`Classes may not have a static property named prototype`);var a=e.value=this.parseMethod(t,n,r);return e.kind===`get`&&a.params.length!==0&&this.raiseRecoverable(a.start,`getter should have no params`),e.kind===`set`&&a.params.length!==1&&this.raiseRecoverable(a.start,`setter should have exactly one param`),e.kind===`set`&&a.params[0].type===`RestElement`&&this.raiseRecoverable(a.params[0].start,`Setter cannot use rest params`),this.finishNode(e,`MethodDefinition`)},G.parseClassField=function(e){return ca(e,`constructor`)?this.raise(e.key.start,`Classes can't have a field named 'constructor'`):e.static&&ca(e,`prototype`)&&this.raise(e.key.start,`Classes can't have a static field named 'prototype'`),this.eat(U.eq)?(this.enterScope(Vi|Ri),e.value=this.parseMaybeAssign(),this.exitScope()):e.value=null,this.semicolon(),this.finishNode(e,`PropertyDefinition`)},G.parseClassStaticBlock=function(e){e.body=[];var t=this.labels;for(this.labels=[],this.enterScope(Bi|Ri);this.type!==U.braceR;){var n=this.parseStatement(null);e.body.push(n)}return this.next(),this.exitScope(),this.labels=t,this.finishNode(e,`StaticBlock`)},G.parseClassId=function(e,t){this.type===U.name?(e.id=this.parseIdent(),t&&this.checkLValSimple(e.id,qi,!1)):(t===!0&&this.unexpected(),e.id=null)},G.parseClassSuper=function(e){e.superClass=this.eat(U._extends)?this.parseExprSubscripts(null,!1):null},G.enterClassBody=function(){var e={declared:Object.create(null),used:[]};return this.privateNameStack.push(e),e.declared},G.exitClassBody=function(){var e=this.privateNameStack.pop(),t=e.declared,n=e.used;if(this.options.checkPrivateFields)for(var r=this.privateNameStack.length,i=r===0?null:this.privateNameStack[r-1],a=0;a<n.length;++a){var o=n[a];yi(t,o.name)||(i?i.used.push(o):this.raiseRecoverable(o.start,`Private field '#`+o.name+`' must be declared in an enclosing class`))}};function sa(e,t){var n=t.key.name,r=e[n],i=`true`;return t.type===`MethodDefinition`&&(t.kind===`get`||t.kind===`set`)&&(i=(t.static?`s`:`i`)+t.kind),r===`iget`&&i===`iset`||r===`iset`&&i===`iget`||r===`sget`&&i===`sset`||r===`sset`&&i===`sget`?(e[n]=`true`,!1):r?!0:(e[n]=i,!1)}function ca(e,t){var n=e.computed,r=e.key;return!n&&(r.type===`Identifier`&&r.name===t||r.type===`Literal`&&r.value===t)}G.parseExportAllDeclaration=function(e,t){return this.options.ecmaVersion>=11&&(this.eatContextual(`as`)?(e.exported=this.parseModuleExportName(),this.checkExport(t,e.exported,this.lastTokStart)):e.exported=null),this.expectContextual(`from`),this.type!==U.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,`ExportAllDeclaration`)},G.parseExport=function(e,t){if(this.next(),this.eat(U.star))return this.parseExportAllDeclaration(e,t);if(this.eat(U._default))return this.checkExport(t,`default`,this.lastTokStart),e.declaration=this.parseExportDefaultDeclaration(),this.finishNode(e,`ExportDefaultDeclaration`);if(this.shouldParseExportStatement())e.declaration=this.parseExportDeclaration(e),e.declaration.type===`VariableDeclaration`?this.checkVariableExport(t,e.declaration.declarations):this.checkExport(t,e.declaration.id,e.declaration.id.start),e.specifiers=[],e.source=null,this.options.ecmaVersion>=16&&(e.attributes=[]);else{if(e.declaration=null,e.specifiers=this.parseExportSpecifiers(t),this.eatContextual(`from`))this.type!==U.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause());else{for(var n=0,r=e.specifiers;n<r.length;n+=1){var i=r[n];this.checkUnreserved(i.local),this.checkLocalExport(i.local),i.local.type===`Literal`&&this.raise(i.local.start,"A string literal cannot be used as an exported binding without `from`.")}e.source=null,this.options.ecmaVersion>=16&&(e.attributes=[])}this.semicolon()}return this.finishNode(e,`ExportNamedDeclaration`)},G.parseExportDeclaration=function(e){return this.parseStatement(null)},G.parseExportDefaultDeclaration=function(){var e;if(this.type===U._function||(e=this.isAsyncFunction())){var t=this.startNode();return this.next(),e&&this.next(),this.parseFunction(t,ia|oa,!1,e)}if(this.type===U._class){var n=this.startNode();return this.parseClass(n,`nullableID`)}var r=this.parseMaybeAssign();return this.semicolon(),r},G.checkExport=function(e,t,n){e&&(typeof t!=`string`&&(t=t.type===`Identifier`?t.name:t.value),yi(e,t)&&this.raiseRecoverable(n,`Duplicate export '`+t+`'`),e[t]=!0)},G.checkPatternExport=function(e,t){var n=t.type;if(n===`Identifier`)this.checkExport(e,t,t.start);else if(n===`ObjectPattern`)for(var r=0,i=t.properties;r<i.length;r+=1){var a=i[r];this.checkPatternExport(e,a)}else if(n===`ArrayPattern`)for(var o=0,s=t.elements;o<s.length;o+=1){var c=s[o];c&&this.checkPatternExport(e,c)}else n===`Property`?this.checkPatternExport(e,t.value):n===`AssignmentPattern`?this.checkPatternExport(e,t.left):n===`RestElement`&&this.checkPatternExport(e,t.argument)},G.checkVariableExport=function(e,t){if(e)for(var n=0,r=t;n<r.length;n+=1){var i=r[n];this.checkPatternExport(e,i.id)}},G.shouldParseExportStatement=function(){return this.type.keyword===`var`||this.type.keyword===`const`||this.type.keyword===`class`||this.type.keyword===`function`||this.isLet()||this.isAsyncFunction()},G.parseExportSpecifier=function(e){var t=this.startNode();return t.local=this.parseModuleExportName(),t.exported=this.eatContextual(`as`)?this.parseModuleExportName():t.local,this.checkExport(e,t.exported,t.exported.start),this.finishNode(t,`ExportSpecifier`)},G.parseExportSpecifiers=function(e){var t=[],n=!0;for(this.expect(U.braceL);!this.eat(U.braceR);){if(n)n=!1;else if(this.expect(U.comma),this.afterTrailingComma(U.braceR))break;t.push(this.parseExportSpecifier(e))}return t},G.parseImport=function(e){return this.next(),this.type===U.string?(e.specifiers=ra,e.source=this.parseExprAtom()):(e.specifiers=this.parseImportSpecifiers(),this.expectContextual(`from`),e.source=this.type===U.string?this.parseExprAtom():this.unexpected()),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,`ImportDeclaration`)},G.parseImportSpecifier=function(){var e=this.startNode();return e.imported=this.parseModuleExportName(),this.eatContextual(`as`)?e.local=this.parseIdent():(this.checkUnreserved(e.imported),e.local=e.imported),this.checkLValSimple(e.local,qi),this.finishNode(e,`ImportSpecifier`)},G.parseImportDefaultSpecifier=function(){var e=this.startNode();return e.local=this.parseIdent(),this.checkLValSimple(e.local,qi),this.finishNode(e,`ImportDefaultSpecifier`)},G.parseImportNamespaceSpecifier=function(){var e=this.startNode();return this.next(),this.expectContextual(`as`),e.local=this.parseIdent(),this.checkLValSimple(e.local,qi),this.finishNode(e,`ImportNamespaceSpecifier`)},G.parseImportSpecifiers=function(){var e=[],t=!0;if(this.type===U.name&&(e.push(this.parseImportDefaultSpecifier()),!this.eat(U.comma)))return e;if(this.type===U.star)return e.push(this.parseImportNamespaceSpecifier()),e;for(this.expect(U.braceL);!this.eat(U.braceR);){if(t)t=!1;else if(this.expect(U.comma),this.afterTrailingComma(U.braceR))break;e.push(this.parseImportSpecifier())}return e},G.parseWithClause=function(){var e=[];if(!this.eat(U._with))return e;this.expect(U.braceL);for(var t={},n=!0;!this.eat(U.braceR);){if(n)n=!1;else if(this.expect(U.comma),this.afterTrailingComma(U.braceR))break;var r=this.parseImportAttribute(),i=r.key.type===`Identifier`?r.key.name:r.key.value;yi(t,i)&&this.raiseRecoverable(r.key.start,`Duplicate attribute key '`+i+`'`),t[i]=!0,e.push(r)}return e},G.parseImportAttribute=function(){var e=this.startNode();return e.key=this.type===U.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!==`never`),this.expect(U.colon),this.type!==U.string&&this.unexpected(),e.value=this.parseExprAtom(),this.finishNode(e,`ImportAttribute`)},G.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===U.string){var e=this.parseLiteral(this.value);return wi.test(e.value)&&this.raise(e.start,`An export name cannot include a lone surrogate.`),e}return this.parseIdent(!0)},G.adaptDirectivePrologue=function(e){for(var t=0;t<e.length&&this.isDirectiveCandidate(e[t]);++t)e[t].directive=e[t].expression.raw.slice(1,-1)},G.isDirectiveCandidate=function(e){return this.options.ecmaVersion>=5&&e.type===`ExpressionStatement`&&e.expression.type===`Literal`&&typeof e.expression.value==`string`&&(this.input[e.start]===`"`||this.input[e.start]===`'`)};var la=W.prototype;la.toAssignable=function(e,t,n){if(this.options.ecmaVersion>=6&&e)switch(e.type){case`Identifier`:this.inAsync&&e.name===`await`&&this.raise(e.start,`Cannot use 'await' as identifier inside an async function`);break;case`ObjectPattern`:case`ArrayPattern`:case`AssignmentPattern`:case`RestElement`:break;case`ObjectExpression`:e.type=`ObjectPattern`,n&&this.checkPatternErrors(n,!0);for(var r=0,i=e.properties;r<i.length;r+=1){var a=i[r];this.toAssignable(a,t),a.type===`RestElement`&&(a.argument.type===`ArrayPattern`||a.argument.type===`ObjectPattern`)&&this.raise(a.argument.start,`Unexpected token`)}break;case`Property`:e.kind!==`init`&&this.raise(e.key.start,`Object pattern can't contain getter or setter`),this.toAssignable(e.value,t);break;case`ArrayExpression`:e.type=`ArrayPattern`,n&&this.checkPatternErrors(n,!0),this.toAssignableList(e.elements,t);break;case`SpreadElement`:e.type=`RestElement`,this.toAssignable(e.argument,t),e.argument.type===`AssignmentPattern`&&this.raise(e.argument.start,`Rest elements cannot have a default value`);break;case`AssignmentExpression`:e.operator!==`=`&&this.raise(e.left.end,`Only '=' operator can be used for specifying default value.`),e.type=`AssignmentPattern`,delete e.operator,this.toAssignable(e.left,t);break;case`ParenthesizedExpression`:this.toAssignable(e.expression,t,n);break;case`ChainExpression`:this.raiseRecoverable(e.start,`Optional chaining cannot appear in left-hand side`);break;case`MemberExpression`:if(!t)break;default:this.raise(e.start,`Assigning to rvalue`)}else n&&this.checkPatternErrors(n,!0);return e},la.toAssignableList=function(e,t){for(var n=e.length,r=0;r<n;r++){var i=e[r];i&&this.toAssignable(i,t)}if(n){var a=e[n-1];this.options.ecmaVersion===6&&t&&a&&a.type===`RestElement`&&a.argument.type!==`Identifier`&&this.unexpected(a.argument.start)}return e},la.parseSpread=function(e){var t=this.startNode();return this.next(),t.argument=this.parseMaybeAssign(!1,e),this.finishNode(t,`SpreadElement`)},la.parseRestBinding=function(){var e=this.startNode();return this.next(),this.options.ecmaVersion===6&&this.type!==U.name&&this.unexpected(),e.argument=this.parseBindingAtom(),this.finishNode(e,`RestElement`)},la.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case U.bracketL:var e=this.startNode();return this.next(),e.elements=this.parseBindingList(U.bracketR,!0,!0),this.finishNode(e,`ArrayPattern`);case U.braceL:return this.parseObj(!0)}return this.parseIdent()},la.parseBindingList=function(e,t,n,r){for(var i=[],a=!0;!this.eat(e);)if(a?a=!1:this.expect(U.comma),t&&this.type===U.comma)i.push(null);else if(n&&this.afterTrailingComma(e))break;else if(this.type===U.ellipsis){var o=this.parseRestBinding();this.parseBindingListItem(o),i.push(o),this.type===U.comma&&this.raiseRecoverable(this.start,`Comma is not permitted after the rest element`),this.expect(e);break}else i.push(this.parseAssignableListItem(r));return i},la.parseAssignableListItem=function(e){var t=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(t),t},la.parseBindingListItem=function(e){return e},la.parseMaybeDefault=function(e,t,n){if(n||=this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(U.eq))return n;var r=this.startNodeAt(e,t);return r.left=n,r.right=this.parseMaybeAssign(),this.finishNode(r,`AssignmentPattern`)},la.checkLValSimple=function(e,t,n){t===void 0&&(t=Gi);var r=t!==Gi;switch(e.type){case`Identifier`:this.strict&&this.reservedWordsStrictBind.test(e.name)&&this.raiseRecoverable(e.start,(r?`Binding `:`Assigning to `)+e.name+` in strict mode`),r&&(t===qi&&e.name===`let`&&this.raiseRecoverable(e.start,`let is disallowed as a lexically bound name`),n&&(yi(n,e.name)&&this.raiseRecoverable(e.start,`Argument name clash`),n[e.name]=!0),t!==Xi&&this.declareName(e.name,t,e.start));break;case`ChainExpression`:this.raiseRecoverable(e.start,`Optional chaining cannot appear in left-hand side`);break;case`MemberExpression`:r&&this.raiseRecoverable(e.start,`Binding member expression`);break;case`ParenthesizedExpression`:return r&&this.raiseRecoverable(e.start,`Binding parenthesized expression`),this.checkLValSimple(e.expression,t,n);default:this.raise(e.start,(r?`Binding`:`Assigning to`)+` rvalue`)}},la.checkLValPattern=function(e,t,n){switch(t===void 0&&(t=Gi),e.type){case`ObjectPattern`:for(var r=0,i=e.properties;r<i.length;r+=1){var a=i[r];this.checkLValInnerPattern(a,t,n)}break;case`ArrayPattern`:for(var o=0,s=e.elements;o<s.length;o+=1){var c=s[o];c&&this.checkLValInnerPattern(c,t,n)}break;default:this.checkLValSimple(e,t,n)}},la.checkLValInnerPattern=function(e,t,n){switch(t===void 0&&(t=Gi),e.type){case`Property`:this.checkLValInnerPattern(e.value,t,n);break;case`AssignmentPattern`:this.checkLValPattern(e.left,t,n);break;case`RestElement`:this.checkLValPattern(e.argument,t,n);break;default:this.checkLValPattern(e,t,n)}};var ua=function(e,t,n,r,i){this.token=e,this.isExpr=!!t,this.preserveSpace=!!n,this.override=r,this.generator=!!i},K={b_stat:new ua(`{`,!1),b_expr:new ua(`{`,!0),b_tmpl:new ua("${",!1),p_stat:new ua(`(`,!1),p_expr:new ua(`(`,!0),q_tmpl:new ua("`",!0,!0,function(e){return e.tryReadTemplateToken()}),f_stat:new ua(`function`,!1),f_expr:new ua(`function`,!0),f_expr_gen:new ua(`function`,!0,!1,null,!0),f_gen:new ua(`function`,!1,!1,null,!0)},da=W.prototype;da.initialContext=function(){return[K.b_stat]},da.curContext=function(){return this.context[this.context.length-1]},da.braceIsBlock=function(e){var t=this.curContext();return t===K.f_expr||t===K.f_stat?!0:e===U.colon&&(t===K.b_stat||t===K.b_expr)?!t.isExpr:e===U._return||e===U.name&&this.exprAllowed?ui.test(this.input.slice(this.lastTokEnd,this.start)):e===U._else||e===U.semi||e===U.eof||e===U.parenR||e===U.arrow?!0:e===U.braceL?t===K.b_stat:e===U._var||e===U._const||e===U.name?!1:!this.exprAllowed},da.inGeneratorContext=function(){for(var e=this.context.length-1;e>=1;e--){var t=this.context[e];if(t.token===`function`)return t.generator}return!1},da.updateContext=function(e){var t,n=this.type;n.keyword&&e===U.dot?this.exprAllowed=!1:(t=n.updateContext)?t.call(this,e):this.exprAllowed=n.beforeExpr},da.overrideContext=function(e){this.curContext()!==e&&(this.context[this.context.length-1]=e)},U.parenR.updateContext=U.braceR.updateContext=function(){if(this.context.length===1)this.exprAllowed=!0;else{var e=this.context.pop();e===K.b_stat&&this.curContext().token===`function`&&(e=this.context.pop()),this.exprAllowed=!e.isExpr}},U.braceL.updateContext=function(e){this.context.push(this.braceIsBlock(e)?K.b_stat:K.b_expr),this.exprAllowed=!0},U.dollarBraceL.updateContext=function(){this.context.push(K.b_tmpl),this.exprAllowed=!0},U.parenL.updateContext=function(e){var t=e===U._if||e===U._for||e===U._with||e===U._while;this.context.push(t?K.p_stat:K.p_expr),this.exprAllowed=!0},U.incDec.updateContext=function(){},U._function.updateContext=U._class.updateContext=function(e){e.beforeExpr&&e!==U._else&&(e!==U.semi||this.curContext()===K.p_stat)&&!(e===U._return&&ui.test(this.input.slice(this.lastTokEnd,this.start)))&&(e!==U.colon&&e!==U.braceL||this.curContext()!==K.b_stat)?this.context.push(K.f_expr):this.context.push(K.f_stat),this.exprAllowed=!1},U.colon.updateContext=function(){this.curContext().token===`function`&&this.context.pop(),this.exprAllowed=!0},U.backQuote.updateContext=function(){this.curContext()===K.q_tmpl?this.context.pop():this.context.push(K.q_tmpl),this.exprAllowed=!1},U.star.updateContext=function(e){if(e===U._function){var t=this.context.length-1;this.context[t]===K.f_expr?this.context[t]=K.f_expr_gen:this.context[t]=K.f_gen}this.exprAllowed=!0},U.name.updateContext=function(e){var t=!1;this.options.ecmaVersion>=6&&e!==U.dot&&(this.value===`of`&&!this.exprAllowed||this.value===`yield`&&this.inGeneratorContext())&&(t=!0),this.exprAllowed=t};var q=W.prototype;q.checkPropClash=function(e,t,n){if(!(this.options.ecmaVersion>=9&&e.type===`SpreadElement`)&&!(this.options.ecmaVersion>=6&&(e.computed||e.method||e.shorthand))){var r=e.key,i;switch(r.type){case`Identifier`:i=r.name;break;case`Literal`:i=String(r.value);break;default:return}var a=e.kind;if(this.options.ecmaVersion>=6)i===`__proto__`&&a===`init`&&(t.proto&&(n?n.doubleProto<0&&(n.doubleProto=r.start):this.raiseRecoverable(r.start,`Redefinition of __proto__ property`)),t.proto=!0);else{i=`$`+i;var o=t[i];o?(a===`init`?this.strict&&o.init||o.get||o.set:o.init||o[a])&&this.raiseRecoverable(r.start,`Redefinition of property`):o=t[i]={init:!1,get:!1,set:!1},o[a]=!0}}},q.parseExpression=function(e,t){var n=this;return this.catchStackOverflow(function(){var r=n.start,i=n.startLoc,a=n.parseMaybeAssign(e,t);if(n.type===U.comma){var o=n.startNodeAt(r,i);for(o.expressions=[a];n.eat(U.comma);)o.expressions.push(n.parseMaybeAssign(e,t));return n.finishNode(o,`SequenceExpression`)}return a})},q.parseMaybeAssign=function(e,t,n){if(this.isContextual(`yield`)){if(this.inGenerator)return this.parseYield(e);this.exprAllowed=!1}var r=!1,i=-1,a=-1,o=-1;t?(i=t.parenthesizedAssign,a=t.trailingComma,o=t.doubleProto,t.parenthesizedAssign=t.trailingComma=-1):(t=new ea,r=!0);var s=this.start,c=this.startLoc;(this.type===U.parenL||this.type===U.name)&&(this.potentialArrowAt=this.start,this.potentialArrowInForAwait=e===`await`);var l=this.parseMaybeConditional(e,t);if(n&&(l=n.call(this,l,s,c)),this.type.isAssign){var u=this.startNodeAt(s,c);return u.operator=this.value,this.type===U.eq&&(l=this.toAssignable(l,!1,t)),r||(t.parenthesizedAssign=t.trailingComma=t.doubleProto=-1),t.shorthandAssign>=l.start&&(t.shorthandAssign=-1),this.type===U.eq?this.checkLValPattern(l):this.checkLValSimple(l),u.left=l,this.next(),u.right=this.parseMaybeAssign(e),o>-1&&(t.doubleProto=o),this.finishNode(u,`AssignmentExpression`)}return r&&this.checkExpressionErrors(t,!0),i>-1&&(t.parenthesizedAssign=i),a>-1&&(t.trailingComma=a),l},q.parseMaybeConditional=function(e,t){var n=this.start,r=this.startLoc,i=this.parseExprOps(e,t);if(this.checkExpressionErrors(t))return i;if((i.type!==`ArrowFunctionExpression`||i.start!==n)&&this.eat(U.question)){var a=this.startNodeAt(n,r);return a.test=i,a.consequent=this.parseMaybeAssign(),this.expect(U.colon),a.alternate=this.parseMaybeAssign(e),this.finishNode(a,`ConditionalExpression`)}return i},q.parseExprOps=function(e,t){var n=this.start,r=this.startLoc,i=this.parseMaybeUnary(t,!1,!1,e);return this.checkExpressionErrors(t)||i.start===n&&i.type===`ArrowFunctionExpression`?i:this.parseExprOp(i,n,r,-1,e)},q.parseExprOp=function(e,t,n,r,i){var a=this.type.binop;if(a!=null&&(!i||this.type!==U._in)&&a>r){var o=this.type===U.logicalOR||this.type===U.logicalAND,s=this.type===U.coalesce;s&&(a=U.logicalAND.binop);var c=this.value;this.next();var l=this.start,u=this.startLoc,d=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,i),l,u,a,i),f=this.buildBinary(t,n,e,d,c,o||s);return(o&&this.type===U.coalesce||s&&(this.type===U.logicalOR||this.type===U.logicalAND))&&this.raiseRecoverable(this.start,`Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses`),this.parseExprOp(f,t,n,r,i)}return e},q.buildBinary=function(e,t,n,r,i,a){r.type===`PrivateIdentifier`&&this.raise(r.start,`Private identifier can only be left side of binary expression`);var o=this.startNodeAt(e,t);return o.left=n,o.operator=i,o.right=r,this.finishNode(o,a?`LogicalExpression`:`BinaryExpression`)},q.parseMaybeUnary=function(e,t,n,r){var i=this.start,a=this.startLoc,o;if(this.isContextual(`await`)&&this.canAwait)o=this.parseAwait(r),t=!0;else if(this.type.prefix){var s=this.startNode(),c=this.type===U.incDec;s.operator=this.value,s.prefix=!0,this.next(),s.argument=this.parseMaybeUnary(null,!0,c,r),this.checkExpressionErrors(e,!0),c?this.checkLValSimple(s.argument):this.strict&&s.operator===`delete`&&fa(s.argument)?this.raiseRecoverable(s.start,`Deleting local variable in strict mode`):s.operator===`delete`&&pa(s.argument)?this.raiseRecoverable(s.start,`Private fields can not be deleted`):t=!0,o=this.finishNode(s,c?`UpdateExpression`:`UnaryExpression`)}else if(!t&&this.type===U.privateId)(r||this.privateNameStack.length===0)&&this.options.checkPrivateFields&&this.unexpected(),o=this.parsePrivateIdent(),this.type!==U._in&&this.unexpected();else{if(o=this.parseExprSubscripts(e,r),this.checkExpressionErrors(e))return o;for(;this.type.postfix&&!this.canInsertSemicolon();){var l=this.startNodeAt(i,a);l.operator=this.value,l.prefix=!1,l.argument=o,this.checkLValSimple(o),this.next(),o=this.finishNode(l,`UpdateExpression`)}}if(!n&&this.eat(U.starstar)){if(t)this.unexpected(this.lastTokStart);else return this.buildBinary(i,a,o,this.parseMaybeUnary(null,!1,!1,r),`**`,!1)}else return o};function fa(e){return e.type===`Identifier`||e.type===`ParenthesizedExpression`&&fa(e.expression)}function pa(e){return e.type===`MemberExpression`&&e.property.type===`PrivateIdentifier`||e.type===`ChainExpression`&&pa(e.expression)||e.type===`ParenthesizedExpression`&&pa(e.expression)}q.parseExprSubscripts=function(e,t){var n=this.start,r=this.startLoc,i=this.parseExprAtom(e,t);if(i.type===`ArrowFunctionExpression`&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==`)`)return i;var a=this.parseSubscripts(i,n,r,!1,t);return e&&a.type===`MemberExpression`&&(e.parenthesizedAssign>=a.start&&(e.parenthesizedAssign=-1),e.parenthesizedBind>=a.start&&(e.parenthesizedBind=-1),e.trailingComma>=a.start&&(e.trailingComma=-1)),a},q.parseSubscripts=function(e,t,n,r,i){for(var a=this.options.ecmaVersion>=8&&e.type===`Identifier`&&e.name===`async`&&this.lastTokEnd===e.end&&!this.canInsertSemicolon()&&e.end-e.start===5&&this.potentialArrowAt===e.start,o=!1;;){var s=this.parseSubscript(e,t,n,r,a,o,i);if(s.optional&&(o=!0),s===e||s.type===`ArrowFunctionExpression`){if(o){var c=this.startNodeAt(t,n);c.expression=s,s=this.finishNode(c,`ChainExpression`)}return s}e=s}},q.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(U.arrow)},q.parseSubscriptAsyncArrow=function(e,t,n,r){return this.parseArrowExpression(this.startNodeAt(e,t),n,!0,r)},q.parseSubscript=function(e,t,n,r,i,a,o){var s=this.options.ecmaVersion>=11,c=s&&this.eat(U.questionDot);r&&c&&this.raise(this.lastTokStart,`Optional chaining cannot appear in the callee of new expressions`);var l=this.eat(U.bracketL);if(l||c&&this.type!==U.parenL&&this.type!==U.backQuote||this.eat(U.dot)){var u=this.startNodeAt(t,n);u.object=e,l?(u.property=this.parseExpression(),this.expect(U.bracketR)):u.property=this.type===U.privateId&&e.type!==`Super`?this.parsePrivateIdent():this.parseIdent(this.options.allowReserved!==`never`),u.computed=!!l,s&&(u.optional=c),e=this.finishNode(u,`MemberExpression`)}else if(!r&&this.eat(U.parenL)){var d=new ea,f=this.yieldPos,p=this.awaitPos,m=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var h=this.parseExprList(U.parenR,this.options.ecmaVersion>=8,!1,d);if(i&&!c&&this.shouldParseAsyncArrow())return this.checkPatternErrors(d,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0&&this.raise(this.awaitIdentPos,`Cannot use 'await' as identifier inside an async function`),this.yieldPos=f,this.awaitPos=p,this.awaitIdentPos=m,this.parseSubscriptAsyncArrow(t,n,h,o);this.checkExpressionErrors(d,!0),this.yieldPos=f||this.yieldPos,this.awaitPos=p||this.awaitPos,this.awaitIdentPos=m||this.awaitIdentPos;var g=this.startNodeAt(t,n);g.callee=e,g.arguments=h,s&&(g.optional=c),e=this.finishNode(g,`CallExpression`)}else if(this.type===U.backQuote){(c||a)&&this.raise(this.start,`Optional chaining cannot appear in the tag of tagged template expressions`);var _=this.startNodeAt(t,n);_.tag=e,_.quasi=this.parseTemplate({isTagged:!0}),e=this.finishNode(_,`TaggedTemplateExpression`)}return e},q.parseExprAtom=function(e,t,n){this.type===U.slash&&this.readRegexp();var r,i=this.potentialArrowAt===this.start;switch(this.type){case U._super:return this.allowSuper||this.raise(this.start,`'super' keyword outside a method`),r=this.startNode(),this.next(),this.type===U.parenL&&!this.allowDirectSuper&&this.raise(r.start,`super() call outside constructor of a subclass`),this.type!==U.dot&&this.type!==U.bracketL&&this.type!==U.parenL&&this.unexpected(),this.finishNode(r,`Super`);case U._this:return r=this.startNode(),this.next(),this.finishNode(r,`ThisExpression`);case U.name:var a=this.start,o=this.startLoc,s=this.containsEsc,c=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!s&&c.name===`async`&&!this.canInsertSemicolon()&&this.eat(U._function))return this.overrideContext(K.f_expr),this.parseFunction(this.startNodeAt(a,o),0,!1,!0,t);if(i&&!this.canInsertSemicolon()){if(this.eat(U.arrow))return this.parseArrowExpression(this.startNodeAt(a,o),[c],!1,t);if(this.options.ecmaVersion>=8&&c.name===`async`&&this.type===U.name&&!s&&(!this.potentialArrowInForAwait||this.value!==`of`||this.containsEsc))return c=this.parseIdent(!1),(this.canInsertSemicolon()||!this.eat(U.arrow))&&this.unexpected(),this.parseArrowExpression(this.startNodeAt(a,o),[c],!0,t)}return c;case U.regexp:var l=this.value;return r=this.parseLiteral(l.value),r.regex={pattern:l.pattern,flags:l.flags},r;case U.num:case U.string:return this.parseLiteral(this.value);case U._null:case U._true:case U._false:return r=this.startNode(),r.value=this.type===U._null?null:this.type===U._true,r.raw=this.type.keyword,this.next(),this.finishNode(r,`Literal`);case U.parenL:var u=this.start,d=this.parseParenAndDistinguishExpression(i,t);return e&&(e.parenthesizedAssign<0&&!this.isSimpleAssignTarget(d)&&(e.parenthesizedAssign=u),e.parenthesizedBind<0&&(e.parenthesizedBind=u)),d;case U.bracketL:return r=this.startNode(),this.next(),r.elements=this.parseExprList(U.bracketR,!0,!0,e),this.finishNode(r,`ArrayExpression`);case U.braceL:return this.overrideContext(K.b_expr),this.parseObj(!1,e);case U._function:return r=this.startNode(),this.next(),this.parseFunction(r,0);case U._class:return this.parseClass(this.startNode(),!1);case U._new:return this.parseNew();case U.backQuote:return this.parseTemplate();case U._import:return this.options.ecmaVersion>=11?this.parseExprImport(n):this.unexpected();default:return this.parseExprAtomDefault()}},q.parseExprAtomDefault=function(){this.unexpected()},q.parseExprImport=function(e){var t=this.startNode();if(this.containsEsc&&this.raiseRecoverable(this.start,`Escape sequence in keyword import`),this.next(),this.type===U.parenL&&!e)return this.parseDynamicImport(t);if(this.type===U.dot){var n=this.startNodeAt(t.start,t.loc&&t.loc.start);return n.name=`import`,t.meta=this.finishNode(n,`Identifier`),this.parseImportMeta(t)}this.unexpected()},q.parseDynamicImport=function(e){if(this.next(),e.source=this.parseMaybeAssign(),this.options.ecmaVersion>=16)this.eat(U.parenR)?e.options=null:(this.expect(U.comma),this.afterTrailingComma(U.parenR)?e.options=null:(e.options=this.parseMaybeAssign(),this.eat(U.parenR)||(this.expect(U.comma),this.afterTrailingComma(U.parenR)||this.unexpected())));else if(!this.eat(U.parenR)){var t=this.start;this.eat(U.comma)&&this.eat(U.parenR)?this.raiseRecoverable(t,`Trailing comma is not allowed in import()`):this.unexpected(t)}return this.finishNode(e,`ImportExpression`)},q.parseImportMeta=function(e){this.next();var t=this.containsEsc;return e.property=this.parseIdent(!0),e.property.name!==`meta`&&this.raiseRecoverable(e.property.start,`The only valid meta property for import is 'import.meta'`),t&&this.raiseRecoverable(e.start,`'import.meta' must not contain escaped characters`),this.options.sourceType!==`module`&&!this.options.allowImportExportEverywhere&&this.raiseRecoverable(e.start,`Cannot use 'import.meta' outside a module`),this.finishNode(e,`MetaProperty`)},q.parseLiteral=function(e){var t=this.startNode();return t.value=e,t.raw=this.input.slice(this.start,this.end),t.raw.charCodeAt(t.raw.length-1)===110&&(t.bigint=t.value==null?t.raw.slice(0,-1).replace(/_/g,``):t.value.toString()),this.next(),this.finishNode(t,`Literal`)},q.parseParenExpression=function(){this.expect(U.parenL);var e=this.parseExpression();return this.expect(U.parenR),e},q.shouldParseArrow=function(e){return!this.canInsertSemicolon()},q.parseParenAndDistinguishExpression=function(e,t){var n=this.start,r=this.startLoc,i,a=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var o=this.start,s=this.startLoc,c=[],l=!0,u=!1,d=new ea,f=this.yieldPos,p=this.awaitPos,m;for(this.yieldPos=0,this.awaitPos=0;this.type!==U.parenR;){if(l?l=!1:this.expect(U.comma),a&&this.afterTrailingComma(U.parenR,!0)){u=!0;break}if(this.type===U.ellipsis){m=this.start,c.push(this.parseParenItem(this.parseRestBinding())),this.type===U.comma&&this.raiseRecoverable(this.start,`Comma is not permitted after the rest element`);break}c.push(this.parseMaybeAssign(!1,d,this.parseParenItem))}var h=this.lastTokEnd,g=this.lastTokEndLoc;if(this.expect(U.parenR),e&&this.shouldParseArrow(c)&&this.eat(U.arrow))return this.checkPatternErrors(d,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=f,this.awaitPos=p,this.parseParenArrowList(n,r,c,t);(!c.length||u)&&this.unexpected(this.lastTokStart),m&&this.unexpected(m),this.checkExpressionErrors(d,!0),this.yieldPos=f||this.yieldPos,this.awaitPos=p||this.awaitPos,c.length>1?(i=this.startNodeAt(o,s),i.expressions=c,this.finishNodeAt(i,`SequenceExpression`,h,g)):i=c[0]}else i=this.parseParenExpression();if(this.options.preserveParens){var _=this.startNodeAt(n,r);return _.expression=i,this.finishNode(_,`ParenthesizedExpression`)}return i},q.parseParenItem=function(e){return e},q.parseParenArrowList=function(e,t,n,r){return this.parseArrowExpression(this.startNodeAt(e,t),n,!1,r)};var ma=[];q.parseNew=function(){this.containsEsc&&this.raiseRecoverable(this.start,`Escape sequence in keyword new`);var e=this.startNode();if(this.next(),this.options.ecmaVersion>=6&&this.type===U.dot){var t=this.startNodeAt(e.start,e.loc&&e.loc.start);t.name=`new`,e.meta=this.finishNode(t,`Identifier`),this.next();var n=this.containsEsc;return e.property=this.parseIdent(!0),e.property.name!==`target`&&this.raiseRecoverable(e.property.start,`The only valid meta property for new is 'new.target'`),n&&this.raiseRecoverable(e.start,`'new.target' must not contain escaped characters`),this.allowNewDotTarget||this.raiseRecoverable(e.start,`'new.target' can only be used in functions and class static block`),this.finishNode(e,`MetaProperty`)}var r=this.start,i=this.startLoc;return e.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),r,i,!0,!1),e.callee.type===`Super`&&this.raiseRecoverable(r,`Invalid use of 'super'`),e.arguments=this.eat(U.parenL)?this.parseExprList(U.parenR,this.options.ecmaVersion>=8,!1):ma,this.finishNode(e,`NewExpression`)},q.parseTemplateElement=function(e){var t=e.isTagged,n=this.startNode();return this.type===U.invalidTemplate?(t||this.raiseRecoverable(this.start,`Bad escape sequence in untagged template literal`),n.value={raw:this.value.replace(/\r\n?/g,`
4
4
  `),cooked:null}):n.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,`