iobroker.eos-admin 8.0.1 → 8.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (157) hide show
  1. package/NEXOWATT_EOS_BUILD_INFO.json +3 -3
  2. package/NEXOWATT_EOS_PREBUILT_MANIFEST.json +102 -96
  3. package/START_HERE_8.0.2.md +41 -0
  4. package/adminWww/.vite/manifest.json +278 -278
  5. package/adminWww/NEXOWATT_EOS_FRONTEND_MANIFEST.json +333 -329
  6. package/adminWww/assets/{AccessTime-Dpa6PKHY.js → AccessTime-5f47qrw7.js} +1 -1
  7. package/adminWww/assets/{AceEditor-DTzNaeVy.js → AceEditor-CJ-_Ev2E.js} +1 -1
  8. package/adminWww/assets/{AdapterUpdateDialog-D3y2bGHM.js → AdapterUpdateDialog-QwlPbETd.js} +3 -3
  9. package/adminWww/assets/Adapters-gKngfaOu.js +7 -0
  10. package/adminWww/assets/{AdminUtils-DDT_kD8H.js → AdminUtils-CopxRJZ2.js} +1 -1
  11. package/adminWww/assets/{Apps-C8LE9l6Z.js → Apps-BKnx1gzD.js} +1 -1
  12. package/adminWww/assets/{Book-QmHxDaHb.js → Book-DrhneQH0.js} +1 -1
  13. package/adminWww/assets/{Cached-f77QQBQD.js → Cached-XJmxLN4E.js} +1 -1
  14. package/adminWww/assets/{Computer-DFIUq-fL.js → Computer-DDMBRY5r.js} +1 -1
  15. package/adminWww/assets/{Config-BZDUILCW.js → Config-BwTa1LdH.js} +1 -1
  16. package/adminWww/assets/{ConfigManager-BMdQoiCg.js → ConfigManager-DYwC4yq9.js} +1 -1
  17. package/adminWww/assets/{CustomModal-B8vdCRn1.js → CustomModal-DjI4oCb8.js} +1 -1
  18. package/adminWww/assets/{CustomTab-DSPqif6P.js → CustomTab-_HYUrXsZ.js} +1 -1
  19. package/adminWww/assets/{DeleteForever-BnEM-6_v.js → DeleteForever-Caoe64_y.js} +1 -1
  20. package/adminWww/assets/EasyMode-CCRqFtQq.js +1 -0
  21. package/adminWww/assets/Enums-BTurn3-x.js +92 -0
  22. package/adminWww/assets/{Extension-DU1jqvic.js → Extension-D-tNJv4S.js} +1 -1
  23. package/adminWww/assets/{Fields-Df7Llf6U.js → Fields-C2Bn4V04.js} +1 -1
  24. package/adminWww/assets/{Files-Bwbw17Fb.js → Files-XdmhxGOR.js} +1 -1
  25. package/adminWww/assets/Hosts-DiTMe9fw.js +120 -0
  26. package/adminWww/assets/{InfoOutlined-l86Si1qa.js → InfoOutlined-DIGDQvu6.js} +1 -1
  27. package/adminWww/assets/Instances-DA6FIgRs.js +4 -0
  28. package/adminWww/assets/Intro-CJpwLg8Q.js +2 -0
  29. package/adminWww/assets/{KeyboardArrowRight-zZUJhG9e.js → KeyboardArrowRight-DVPBjTKi.js} +1 -1
  30. package/adminWww/assets/Logs-CA0mEMlO.js +2 -0
  31. package/adminWww/assets/{MoreHoriz-CR2kD-dc.js → MoreHoriz-BYaCptH0.js} +1 -1
  32. package/adminWww/assets/Objects-B2IC3Bce.js +301 -0
  33. package/adminWww/assets/{Overview-CDvnM655.js → Overview-HG8fAMFM.js} +2 -2
  34. package/adminWww/assets/{Pageview-DBITLOzI.js → Pageview-DFHddrKX.js} +1 -1
  35. package/adminWww/assets/{PersonOff-ANdO5Nu4.js → PersonOff-BwYQLD1M.js} +1 -1
  36. package/adminWww/assets/{PushPinOutlined-DvxsqPHo.js → PushPinOutlined-CEBeTmNm.js} +1 -1
  37. package/adminWww/assets/Remove-BPxvNccW.js +1 -0
  38. package/adminWww/assets/{Schedule-BMMrgd7j.js → Schedule-BQlh1nhQ.js} +1 -1
  39. package/adminWww/assets/{Star-DNdm064z.js → Star-ChMjBwLn.js} +1 -1
  40. package/adminWww/assets/State-UGfoS6qW.js +1 -0
  41. package/adminWww/assets/Storage-DrC3j-wf.js +1 -0
  42. package/adminWww/assets/{TextSnippet-Bywi1YuG.js → TextSnippet-BQ4TSmvS.js} +1 -1
  43. package/adminWww/assets/{Timeline-IQCnSLiw.js → Timeline-CEyldmz2.js} +1 -1
  44. package/adminWww/assets/{Timer-Be9yF62g.js → Timer-I0twtyWh.js} +1 -1
  45. package/adminWww/assets/{UnfoldMore-Du7-8wYn.js → UnfoldMore-_DDSfPKk.js} +1 -1
  46. package/adminWww/assets/{Usb-Ca47vqRv.js → Usb-Dwk7qdYu.js} +1 -1
  47. package/adminWww/assets/{UsedResources-BIdU7UPm.js → UsedResources-B6HWeXGX.js} +2 -2
  48. package/adminWww/assets/Users-DFeYuC5y.js +1 -0
  49. package/adminWww/assets/{ViewCompact-C3SC0jFF.js → ViewCompact-BbfomOIi.js} +1 -1
  50. package/adminWww/assets/ViewList-1pB5VinA.js +1 -0
  51. package/adminWww/assets/{ViewSidebar-kHvah-XS.js → ViewSidebar-DdedDirX.js} +1 -1
  52. package/adminWww/assets/{VpnKey-iMA7KrB-.js → VpnKey-o8QeqmnU.js} +1 -1
  53. package/adminWww/assets/{WifiTethering-Da8nW7Do.js → WifiTethering-Cp63fmkC.js} +1 -1
  54. package/adminWww/assets/{_virtual_mf-localSharedImportMap___mfe_internal__iobroker_admin__mf_owner__1-CpelrCgN.js → _virtual_mf-localSharedImportMap___mfe_internal__iobroker_admin__mf_owner__1-uaKFfE5p.js} +1 -1
  55. package/adminWww/assets/{bootstrap-D-7xcwTc.js → bootstrap-DSDOwKWU.js} +33 -33
  56. package/adminWww/assets/{date-fns-Bpgjk9P-.js → date-fns-ukillHs-.js} +1 -1
  57. package/adminWww/assets/helpers-CDcY0YJ-.js +1 -0
  58. package/adminWww/assets/{hostInit-huY-0clu.js → hostInit-Cd61hJHh.js} +1 -1
  59. package/adminWww/assets/{icons-material-Bu1f45BT.js → icons-material-Dms1APQk.js} +1 -1
  60. package/adminWww/assets/{index-D8vmzGp8.js → index-D6uhIclX.js} +2 -2
  61. package/adminWww/assets/{installSVGRenderer-BkdptYag.js → installSVGRenderer-BR-zIijZ.js} +1 -1
  62. package/adminWww/assets/{lib-CE1B3iHH.js → lib-BZRGBDoe.js} +2 -2
  63. package/adminWww/assets/{loadShare-eager-CRNcc8D7.js → loadShare-eager-BpwDZfDr.js} +93 -93
  64. package/adminWww/assets/{mf-entry-bootstrap-0-f6098d8b.js → mf-entry-bootstrap-0-2d631020.js} +3 -3
  65. package/adminWww/assets/{pendingShares-CuQbFsaK.js → pendingShares-D1Vr_qYv.js} +2 -2
  66. package/adminWww/assets/{sentry-B4uGc7ut.js → sentry-BFzW-2KQ.js} +1 -1
  67. package/adminWww/assets/{setYear-DurmWw03.js → setYear-DhVdgUBF.js} +1 -1
  68. package/adminWww/css/nexowatt-native-shell.css +72 -0
  69. package/adminWww/index.html +21 -21
  70. package/adminWww/js/eos-license-link.js +9 -16
  71. package/adminWww/js/nexowatt-native-shell.js +2 -2
  72. package/adminWww/mf-manifest.json +1 -1
  73. package/adminWww/mf-stats.json +1 -1
  74. package/adminWww/{remoteEntry-eos-8.0.1.js → remoteEntry-eos-8.0.2.js} +2 -2
  75. package/adminWww/remoteEntry.js +1 -1
  76. package/build/lib/web.js +25 -5
  77. package/build/lib/web.js.map +1 -1
  78. package/docs/ADMIN8_MIGRATION_8.0.0_DE.md +2 -0
  79. package/docs/cra/CRA_IEC_GAP_ANALYSIS_2026-09-30.md +5 -0
  80. package/docs/security/admin8-2026-11-04/development-1.log +4 -4
  81. package/docs/security/admin8-2026-11-04/development-2.log +275 -248
  82. package/docs/security/admin8-2026-11-05/system-fix/BACKEND_ROLE_REVIEW_DE.md +79 -0
  83. package/docs/security/admin8-2026-11-05/system-fix/NAVIGATION_DE.md +30 -0
  84. package/docs/security/admin8-2026-11-05/system-fix/REPORT_DE.md +51 -0
  85. package/docs/security/admin8-2026-11-05/system-fix/REVIEW_DE.md +65 -0
  86. package/docs/security/admin8-2026-11-05/system-fix/SCOPE_DE.md +21 -0
  87. package/docs/security/admin8-2026-11-05/system-fix/SYSTEM_DE.md +44 -0
  88. package/docs/security/admin8-2026-11-05/system-fix/archive-scan.json +12 -0
  89. package/docs/security/admin8-2026-11-05/system-fix/browser/README.md +46 -0
  90. package/docs/security/admin8-2026-11-05/system-fix/browser/integrity.json +16 -0
  91. package/docs/security/admin8-2026-11-05/system-fix/browser/system-browser-result.json +3607 -0
  92. package/docs/security/admin8-2026-11-05/system-fix/browser/system-browser.cjs +221 -0
  93. package/docs/security/admin8-2026-11-05/system-fix/browser/system-fixture.cjs +60 -0
  94. package/docs/security/admin8-2026-11-05/system-fix/evidence-sha256.json +49 -0
  95. package/docs/security/admin8-2026-11-05/system-fix/license-ui-tests-node22.log +80 -0
  96. package/docs/security/admin8-2026-11-05/system-fix/license-ui-tests-node24.log +19 -0
  97. package/docs/security/admin8-2026-11-05/system-fix/navigation/lint.log +0 -0
  98. package/docs/security/admin8-2026-11-05/system-fix/navigation/node22-tests.log +56 -0
  99. package/docs/security/admin8-2026-11-05/system-fix/navigation/node24-tests.log +15 -0
  100. package/docs/security/admin8-2026-11-05/system-fix/navigation/source-sha256.json +11 -0
  101. package/docs/security/admin8-2026-11-05/system-fix/path-budget.json +7 -0
  102. package/docs/security/admin8-2026-11-05/system-fix/release/artifacts.log +6 -0
  103. package/docs/security/admin8-2026-11-05/system-fix/release/audit-root.json +22 -0
  104. package/docs/security/admin8-2026-11-05/system-fix/release/audit-root.stderr +1 -0
  105. package/docs/security/admin8-2026-11-05/system-fix/release/backend-build.log +5 -0
  106. package/docs/security/admin8-2026-11-05/system-fix/release/clean.log +6 -0
  107. package/docs/security/admin8-2026-11-05/system-fix/release/consumer-audit.json +22 -0
  108. package/docs/security/admin8-2026-11-05/system-fix/release/consumer-audit.stderr +2 -0
  109. package/docs/security/admin8-2026-11-05/system-fix/release/consumer-install.log +4 -0
  110. package/docs/security/admin8-2026-11-05/system-fix/release/consumer-package-lock.json +3258 -0
  111. package/docs/security/admin8-2026-11-05/system-fix/release/development.log +392 -0
  112. package/docs/security/admin8-2026-11-05/system-fix/release/frontend-build.log +149 -0
  113. package/docs/security/admin8-2026-11-05/system-fix/release/http-node22.json +15 -0
  114. package/docs/security/admin8-2026-11-05/system-fix/release/http-node24.json +15 -0
  115. package/docs/security/admin8-2026-11-05/system-fix/release/inventory.log +8 -0
  116. package/docs/security/admin8-2026-11-05/system-fix/release/overlay-journal.json +452 -0
  117. package/docs/security/admin8-2026-11-05/system-fix/release/overlay-publish.log +10790 -0
  118. package/docs/security/admin8-2026-11-05/system-fix/release/overlay-validation.json +12 -0
  119. package/docs/security/admin8-2026-11-05/system-fix/release/pack.json +8104 -0
  120. package/docs/security/admin8-2026-11-05/system-fix/release/pack.stderr +6 -0
  121. package/docs/security/admin8-2026-11-05/system-fix/release/retired-801.json +68 -0
  122. package/docs/security/admin8-2026-11-05/system-fix/release/seal.log +6 -0
  123. package/docs/security/admin8-2026-11-05/system-fix/review-tests.log +30 -0
  124. package/docs/security/admin8-2026-11-05/system-fix/role-context-before.log +86 -0
  125. package/docs/security/admin8-2026-11-05/system-fix/role-context-lint.log +0 -0
  126. package/docs/security/admin8-2026-11-05/system-fix/role-context-node22.log +44 -0
  127. package/docs/security/admin8-2026-11-05/system-fix/role-context-test.log +13 -0
  128. package/docs/security/admin8-2026-11-05/system-fix/validation.json +90 -0
  129. package/docs/third-party/admin8/NOTICE-PROVENANCE.json +1 -1
  130. package/io-package.json +9 -10
  131. package/package.json +3 -2
  132. package/release-manifests/admin8-development-validation.json +42 -32
  133. package/reports/security/artifact-inventory.json +561 -561
  134. package/reports/security/inventory-summary.json +7 -7
  135. package/reports/security/sbom-backend-lock.cdx.json +5 -5
  136. package/reports/security/sbom-frontend-lock.cdx.json +5 -5
  137. package/reports/security/source-runtime-manifest.json +155 -155
  138. package/tools/nexowatt-admin8-development-check.cjs +8 -1
  139. package/tools/nexowatt-installer-ems-selftest.cjs +1 -1
  140. package/tools/nexowatt-role-security-selftest.cjs +2 -2
  141. package/tools/nexowatt-user-area-selftest.cjs +1 -1
  142. package/tools/nexowatt-v7109-clean-core-selftest.cjs +1 -1
  143. package/tools/vendor/eos-retired-release-files.json +196 -1
  144. package/adminWww/assets/Adapters-WMGNQt7g.js +0 -7
  145. package/adminWww/assets/EasyMode-TwIN5yxu.js +0 -1
  146. package/adminWww/assets/Enums-CHm2sGa-.js +0 -92
  147. package/adminWww/assets/Hosts-BR0g-Wxo.js +0 -120
  148. package/adminWww/assets/Instances-BKydFSdw.js +0 -4
  149. package/adminWww/assets/Intro-Dt2GzmtW.js +0 -2
  150. package/adminWww/assets/Logs-hbcdBDN3.js +0 -2
  151. package/adminWww/assets/Objects-HPx0yuOk.js +0 -301
  152. package/adminWww/assets/Remove-DplJatnC.js +0 -1
  153. package/adminWww/assets/State-Cc-tyuqB.js +0 -1
  154. package/adminWww/assets/Storage-COo2RkS1.js +0 -1
  155. package/adminWww/assets/Users-BruHA-yU.js +0 -1
  156. package/adminWww/assets/ViewList-DuKCnBnc.js +0 -1
  157. package/adminWww/assets/helpers-DBoACUHw.js +0 -1
@@ -0,0 +1,301 @@
1
+ import{a as e,t}from"./rolldown-runtime-sJBDdmOt.js";import{$a as n,$s as r,An as i,Bi as a,Co as o,Dr as s,Ds as c,Eo as l,Es as u,Fo as d,Ga as f,Go as p,Gr as m,Ho as h,In as g,Ja as _,Jo as v,Js as y,Ka as b,Lo as ee,Lt as x,Mo as S,No as C,Po as te,Qa as ne,Ri as re,Sn as ie,Ti as ae,Tr as w,Ua as oe,Us as T,Vo as se,Vr as ce,Wr as le,Ws as E,Yi as ue,Yo as de,Yr as fe,Zo as pe,_o as D,_r as me,as as he,bn as ge,bo as O,br as _e,cc as ve,co as ye,cr as be,cs as xe,ei as Se,gr as Ce,ho as we,hr as Te,i as Ee,io as De,is as Oe,ji as ke,jo as k,jr as Ae,ki as je,ko as Me,lr as Ne,ls as Pe,mc as A,mo as j,mr as Fe,ms as Ie,nc as Le,no as M,oo as Re,os as ze,po as Be,qa as N,qo as P,ro as Ve,rr as He,rs as Ue,sr as We,ss as F,ta as Ge,to as Ke,uo as I,us as qe,vs as Je,wi as Ye,xa as Xe,xn as Ze,yi as Qe,zi as $e,zo as et,zt as tt}from"./loadShare-eager-BpwDZfDr.js";import{a as nt,i as rt,n as it,o as at,r as ot,s as st,t as ct}from"./MoreHoriz-BYaCptH0.js";import{n as lt,t as ut}from"./KeyboardArrowRight-DVPBjTKi.js";import{t as dt}from"./Remove-BPxvNccW.js";import{t as ft}from"./en-US-BjjaEI6N.js";import{a as pt,c as mt,d as ht,f as gt,i as _t,l as vt,n as yt,o as bt,r as xt,s as St,u as Ct}from"./locale-DN6Bdkdt.js";import{t as wt}from"./AdminUtils-CopxRJZ2.js";import{t as Tt}from"./AceEditor-CJ-_Ev2E.js";import{n as Et,t as Dt}from"./ctrlEnter-CruFIPb_.js";import{G as Ot,M as kt,r as At}from"./bootstrap-DSDOwKWU.js";import{a as jt,c as Mt,d as Nt,i as Pt,l as Ft,n as It,o as Lt,r as Rt,s as zt,t as Bt,u as Vt}from"./zh-cn-B6dBxOyw.js";import{t as Ht}from"./CustomModal-DjI4oCb8.js";import{$ as Ut,$t as L,A as Wt,At as Gt,B as Kt,Bt as qt,C as Jt,Ct as Yt,D as R,Dt as Xt,E as Zt,Et as Qt,F as $t,Ft as en,G as tn,Gt as nn,H as rn,Ht as an,I as on,It as sn,J as cn,Jt as ln,K as un,Kt as dn,L as fn,Lt as pn,M as mn,Mt as hn,O as gn,Ot as _n,P as vn,Q as yn,Qt as bn,R as xn,Rt as Sn,S as Cn,St as wn,T as Tn,Tt as En,U as Dn,Ut as On,Vt as kn,W as An,Wt as jn,X as Mn,Xt as Nn,Yt as Pn,Z as Fn,Zt as In,_ as Ln,_n as z,_t as Rn,a as zn,an as Bn,at as Vn,b as Hn,bt as Un,c as Wn,cn as Gn,d as Kn,dn as qn,dt as Jn,en as Yn,et as Xn,f as Zn,fn as Qn,g as $n,gn as er,gt as tr,h as nr,hn as rr,ht as ir,i as ar,in as or,it as sr,jt as cr,k as lr,kt as ur,l as dr,ln as fr,lt as pr,m as mr,mn as hr,mt as gr,n as _r,nt as vr,o as yr,on as br,ot as xr,p as Sr,pn as Cr,pt as wr,q as Tr,qt as Er,r as Dr,rn as Or,rt as kr,s as Ar,st as jr,t as Mr,tn as Nr,tt as Pr,u as Fr,un as Ir,ut as Lr,vt as Rr,w as zr,wt as Br,x as Vr,xt as Hr,y as Ur,yt as Wr,z as Gr,zt as Kr}from"./installSVGRenderer-BR-zIijZ.js";var qr=e(fe(),1),Jr=[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],Yr=[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],Xr=`‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࢗ-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ-᫝᫠-᫫ᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‌‍‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・`,Zr=`ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-࢏ࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚ౜ౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽ೜-ೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲊᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-Ƛ꟱-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ`,Qr={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`},$r=`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`,ei={5:$r,"5module":$r+` export import`,6:$r+` const class extends export import super`},ti=/^in(stanceof)?$/,ni=RegExp(`[`+Zr+`]`),ri=RegExp(`[`+Zr+Xr+`]`);function ii(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 ai(e,t){return e<65?e===36:e<91?!0:e<97?e===95:e<123?!0:e<=65535?e>=170&&ni.test(String.fromCharCode(e)):t!==!1&&ii(e,Yr)}function oi(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&&ri.test(String.fromCharCode(e)):t===!1?!1:ii(e,Yr)||ii(e,Jr)}var B=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 si(e,t){return new B(e,{beforeExpr:!0,binop:t})}var ci={beforeExpr:!0},li={startsExpr:!0},ui={};function V(e,t){return t===void 0&&(t={}),t.keyword=e,ui[e]=new B(e,t)}var H={num:new B(`num`,li),regexp:new B(`regexp`,li),string:new B(`string`,li),name:new B(`name`,li),privateId:new B(`privateId`,li),eof:new B(`eof`),bracketL:new B(`[`,{beforeExpr:!0,startsExpr:!0}),bracketR:new B(`]`),braceL:new B(`{`,{beforeExpr:!0,startsExpr:!0}),braceR:new B(`}`),parenL:new B(`(`,{beforeExpr:!0,startsExpr:!0}),parenR:new B(`)`),comma:new B(`,`,ci),semi:new B(`;`,ci),colon:new B(`:`,ci),dot:new B(`.`),question:new B(`?`,ci),questionDot:new B(`?.`),arrow:new B(`=>`,ci),template:new B(`template`),invalidTemplate:new B(`invalidTemplate`),ellipsis:new B(`...`,ci),backQuote:new B("`",li),dollarBraceL:new B("${",{beforeExpr:!0,startsExpr:!0}),eq:new B(`=`,{beforeExpr:!0,isAssign:!0}),assign:new B(`_=`,{beforeExpr:!0,isAssign:!0}),incDec:new B(`++/--`,{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new B(`!/~`,{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:si(`||`,1),logicalAND:si(`&&`,2),bitwiseOR:si(`|`,3),bitwiseXOR:si(`^`,4),bitwiseAND:si(`&`,5),equality:si(`==/!=/===/!==`,6),relational:si(`</>/<=/>=`,7),bitShift:si(`<</>>/>>>`,8),plusMin:new B(`+/-`,{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:si(`%`,10),star:si(`*`,10),slash:si(`/`,10),starstar:new B(`**`,{beforeExpr:!0}),coalesce:si(`??`,1),_break:V(`break`),_case:V(`case`,ci),_catch:V(`catch`),_continue:V(`continue`),_debugger:V(`debugger`),_default:V(`default`,ci),_do:V(`do`,{isLoop:!0,beforeExpr:!0}),_else:V(`else`,ci),_finally:V(`finally`),_for:V(`for`,{isLoop:!0}),_function:V(`function`,li),_if:V(`if`),_return:V(`return`,ci),_switch:V(`switch`),_throw:V(`throw`,ci),_try:V(`try`),_var:V(`var`),_const:V(`const`),_while:V(`while`,{isLoop:!0}),_with:V(`with`),_new:V(`new`,{beforeExpr:!0,startsExpr:!0}),_this:V(`this`,li),_super:V(`super`,li),_class:V(`class`,li),_extends:V(`extends`,ci),_export:V(`export`),_import:V(`import`,li),_null:V(`null`,li),_true:V(`true`,li),_false:V(`false`,li),_in:V(`in`,{beforeExpr:!0,binop:7}),_instanceof:V(`instanceof`,{beforeExpr:!0,binop:7}),_typeof:V(`typeof`,{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:V(`void`,{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:V(`delete`,{beforeExpr:!0,prefix:!0,startsExpr:!0})},di=/\r\n?|\n|\u2028|\u2029/,fi=new RegExp(di.source,`g`);function pi(e){return e===10||e===13||e===8232||e===8233}function mi(e,t,n){n===void 0&&(n=e.length);for(var r=t;r<n;r++){var i=e.charCodeAt(r);if(pi(i))return r<n-1&&i===13&&e.charCodeAt(r+1)===10?r+2:r+1}return-1}var hi=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,U=/(?:\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=mi(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
+ 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(ei[e.ecmaVersion>=6?6:e.sourceType===`module`?`5module`:5]);var r=``;e.allowReserved!==!0&&(r=Qr[e.ecmaVersion>=6?6:e.ecmaVersion===5?5:3],e.sourceType===`module`&&(r+=` await`)),this.reservedWords=Si(r);var i=(r?r+` `:``)+Qr.strict;this.reservedWordsStrict=Si(i),this.reservedWordsStrictBind=Si(i+` `+Qr.strictBind),this.input=String(t),this.containsEsc=!1,n?(this.pos=n,this.lineStart=this.input.lastIndexOf(`
3
+ `,n-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(di).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=H.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(;;){U.lastIndex=e,e+=U.exec(this.input)[0].length;var t=$i.exec(this.input.slice(e));if(!t)return!1;if((t[1]||t[2])===`use strict`){U.lastIndex=e+t[0].length;var n=U.exec(this.input),r=n.index+n[0].length,i=this.input.charAt(r);return i===`;`||i===`}`||di.test(n[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(i)||i===`!`&&this.input.charAt(r+1)===`=`)}e+=t[0].length,U.lastIndex=e,e+=U.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===H.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===H.eof||this.type===H.braceR||di.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(H.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!==H.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;U.lastIndex=this.pos;var t=U.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(ai(r)){var i=n;do n+=r<=65535?1:2;while(oi(r=this.fullCharCodeAt(n)));if(r===92)return!0;var a=this.input.slice(i,n);if(!ti.test(a))return!0}return!1},G.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual(`async`))return!1;U.lastIndex=this.pos;var e=U.exec(this.input),t=this.pos+e[0].length,n;return!di.test(this.input.slice(this.pos,t))&&this.input.slice(t,t+8)===`function`&&(t+8===this.input.length||!(oi(n=this.fullCharCodeAt(t+8))||n===92))},G.isUsingKeyword=function(e,t){if(this.options.ecmaVersion<17||!this.isContextual(e?`await`:`using`))return!1;U.lastIndex=this.pos;var n=U.exec(this.input),r=this.pos+n[0].length;if(di.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||oi(a=this.fullCharCodeAt(i))||a===92)return!1;U.lastIndex=i;var o=U.exec(this.input);if(r=i+o[0].length,o&&di.test(this.input.slice(i,r)))return!1}var s=this.fullCharCodeAt(r);if(!ai(s)&&s!==92)return!1;var c=r;do r+=s<=65535?1:2;while(oi(s=this.fullCharCodeAt(r)));if(s===92)return!0;var l=this.input.slice(c,r);if(ti.test(l))return!1;if(t&&!e&&l===`of`){U.lastIndex=r;var u=U.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=H._var,a=`let`),r){case H._break:case H._continue:return this.parseBreakContinueStatement(i,r.keyword);case H._debugger:return this.parseDebuggerStatement(i);case H._do:return this.parseDoStatement(i);case H._for:return this.parseForStatement(i);case H._function:return e&&(this.strict||e!==`if`&&e!==`label`)&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(i,!1,!e);case H._class:return e&&this.unexpected(),this.parseClass(i,!0);case H._if:return this.parseIfStatement(i);case H._return:return this.parseReturnStatement(i);case H._switch:return this.parseSwitchStatement(i);case H._throw:return this.parseThrowStatement(i);case H._try:return this.parseTryStatement(i);case H._const:case H._var:return a||=this.value,e&&a!==`var`&&this.unexpected(),this.parseVarStatement(i,a);case H._while:return this.parseWhileStatement(i);case H._with:return this.parseWithStatement(i);case H.braceL:return this.parseBlock(!0,i);case H.semi:return this.parseEmptyStatement(i);case H._export:case H._import:if(this.options.ecmaVersion>10&&r===H._import){U.lastIndex=this.pos;var o=U.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===H._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===H.name&&d.type===`Identifier`&&this.eat(H.colon)?this.parseLabeledStatement(i,u,d,e):this.parseExpressionStatement(i,d)}},G.parseBreakContinueStatement=function(e,t){var n=t===`break`;this.next(),this.eat(H.semi)||this.insertSemicolon()?e.label=null:this.type===H.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(H._while),e.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(H.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(H.parenL),this.type===H.semi)return t>-1&&this.unexpected(t),this.parseFor(e,null);var n=this.isLet();if(this.type===H._var||this.type===H._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===H._in||(o=this.options.ecmaVersion>=6&&this.isContextual(`of`))?(t>-1?(this.type===H._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===H._in||this.options.ecmaVersion>=6&&this.isContextual(`of`))&&t.declarations.length===1?(this.type===H._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(H._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(H.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(H.braceL),this.labels.push(na),this.enterScope(Hi);for(var t,n=!1;this.type!==H.braceR;)if(this.type===H._case||this.type===H._default){var r=this.type===H._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(H.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(),di.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(H.parenR),e},G.parseTryStatement=function(e){if(this.next(),e.block=this.parseBlock(),e.handler=null,this.type===H._catch){var t=this.startNode();this.next(),this.eat(H.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(H._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===H._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(H.braceL),e&&this.enterScope(0);this.type!==H.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(H.semi),e.test=this.type===H.semi?null:this.parseExpression(),this.expect(H.semi),e.update=this.type===H.parenR?null:this.parseExpression(),this.expect(H.parenR),e.body=this.parseStatement(`for`),this.exitScope(),this.labels.pop(),this.finishNode(e,`ForStatement`)},G.parseForIn=function(e,t){var n=this.type===H._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(H.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(H.eq)?i.init=this.parseMaybeAssign(t):!r&&n===`const`&&!(this.type===H._in||this.options.ecmaVersion>=6&&this.isContextual(`of`))?this.unexpected():!r&&(n===`using`||n===`await using`)&&this.options.ecmaVersion>=17&&this.type!==H._in&&!this.isContextual(`of`)?this.raise(this.lastTokEnd,`Missing initializer in `+n+` declaration`):!r&&i.id.type!==`Identifier`&&(!t||this.type!==H._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(H.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===H.star&&t&aa&&this.unexpected(),e.generator=this.eat(H.star)),this.options.ecmaVersion>=8&&(e.async=!!r),t&ia&&(e.id=t&oa&&this.type!==H.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===H.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(H.parenL),e.params=this.parseBindingList(H.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(H.braceL);this.type!==H.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(H.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(H.braceL))return this.parseClassStaticBlock(n),n;this.isClassElementNameStart()||this.type===H.star?s=!0:r=`static`}if(n.static=s,!r&&t>=8&&this.eatContextual(`async`)&&((this.isClassElementNameStart()||this.type===H.star)&&!this.canInsertSemicolon()?a=!0:r=`async`),!r&&(t>=9||!a)&&this.eat(H.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===H.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===H.name||this.type===H.privateId||this.type===H.num||this.type===H.string||this.type===H.bracketL||this.type.keyword},G.parseClassElementName=function(e){this.type===H.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(H.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!==H.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===H.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(H._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!==H.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(H.star))return this.parseExportAllDeclaration(e,t);if(this.eat(H._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!==H.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===H._function||(e=this.isAsyncFunction())){var t=this.startNode();return this.next(),e&&this.next(),this.parseFunction(t,ia|oa,!1,e)}if(this.type===H._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(H.braceL);!this.eat(H.braceR);){if(n)n=!1;else if(this.expect(H.comma),this.afterTrailingComma(H.braceR))break;t.push(this.parseExportSpecifier(e))}return t},G.parseImport=function(e){return this.next(),this.type===H.string?(e.specifiers=ra,e.source=this.parseExprAtom()):(e.specifiers=this.parseImportSpecifiers(),this.expectContextual(`from`),e.source=this.type===H.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===H.name&&(e.push(this.parseImportDefaultSpecifier()),!this.eat(H.comma)))return e;if(this.type===H.star)return e.push(this.parseImportNamespaceSpecifier()),e;for(this.expect(H.braceL);!this.eat(H.braceR);){if(t)t=!1;else if(this.expect(H.comma),this.afterTrailingComma(H.braceR))break;e.push(this.parseImportSpecifier())}return e},G.parseWithClause=function(){var e=[];if(!this.eat(H._with))return e;this.expect(H.braceL);for(var t={},n=!0;!this.eat(H.braceR);){if(n)n=!1;else if(this.expect(H.comma),this.afterTrailingComma(H.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===H.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!==`never`),this.expect(H.colon),this.type!==H.string&&this.unexpected(),e.value=this.parseExprAtom(),this.finishNode(e,`ImportAttribute`)},G.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===H.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!==H.name&&this.unexpected(),e.argument=this.parseBindingAtom(),this.finishNode(e,`RestElement`)},la.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case H.bracketL:var e=this.startNode();return this.next(),e.elements=this.parseBindingList(H.bracketR,!0,!0),this.finishNode(e,`ArrayPattern`);case H.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(H.comma),t&&this.type===H.comma)i.push(null);else if(n&&this.afterTrailingComma(e))break;else if(this.type===H.ellipsis){var o=this.parseRestBinding();this.parseBindingListItem(o),i.push(o),this.type===H.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(H.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===H.colon&&(t===K.b_stat||t===K.b_expr)?!t.isExpr:e===H._return||e===H.name&&this.exprAllowed?di.test(this.input.slice(this.lastTokEnd,this.start)):e===H._else||e===H.semi||e===H.eof||e===H.parenR||e===H.arrow?!0:e===H.braceL?t===K.b_stat:e===H._var||e===H._const||e===H.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===H.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)},H.parenR.updateContext=H.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}},H.braceL.updateContext=function(e){this.context.push(this.braceIsBlock(e)?K.b_stat:K.b_expr),this.exprAllowed=!0},H.dollarBraceL.updateContext=function(){this.context.push(K.b_tmpl),this.exprAllowed=!0},H.parenL.updateContext=function(e){var t=e===H._if||e===H._for||e===H._with||e===H._while;this.context.push(t?K.p_stat:K.p_expr),this.exprAllowed=!0},H.incDec.updateContext=function(){},H._function.updateContext=H._class.updateContext=function(e){e.beforeExpr&&e!==H._else&&(e!==H.semi||this.curContext()===K.p_stat)&&!(e===H._return&&di.test(this.input.slice(this.lastTokEnd,this.start)))&&(e!==H.colon&&e!==H.braceL||this.curContext()!==K.b_stat)?this.context.push(K.f_expr):this.context.push(K.f_stat),this.exprAllowed=!1},H.colon.updateContext=function(){this.curContext().token===`function`&&this.context.pop(),this.exprAllowed=!0},H.backQuote.updateContext=function(){this.curContext()===K.q_tmpl?this.context.pop():this.context.push(K.q_tmpl),this.exprAllowed=!1},H.star.updateContext=function(e){if(e===H._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},H.name.updateContext=function(e){var t=!1;this.options.ecmaVersion>=6&&e!==H.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===H.comma){var o=n.startNodeAt(r,i);for(o.expressions=[a];n.eat(H.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===H.parenL||this.type===H.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===H.eq&&(l=this.toAssignable(l,!1,t)),r||(t.parenthesizedAssign=t.trailingComma=t.doubleProto=-1),t.shorthandAssign>=l.start&&(t.shorthandAssign=-1),this.type===H.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(H.question)){var a=this.startNodeAt(n,r);return a.test=i,a.consequent=this.parseMaybeAssign(),this.expect(H.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!==H._in)&&a>r){var o=this.type===H.logicalOR||this.type===H.logicalAND,s=this.type===H.coalesce;s&&(a=H.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===H.coalesce||s&&(this.type===H.logicalOR||this.type===H.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===H.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===H.privateId)(r||this.privateNameStack.length===0)&&this.options.checkPrivateFields&&this.unexpected(),o=this.parsePrivateIdent(),this.type!==H._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(H.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(H.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(H.questionDot);r&&c&&this.raise(this.lastTokStart,`Optional chaining cannot appear in the callee of new expressions`);var l=this.eat(H.bracketL);if(l||c&&this.type!==H.parenL&&this.type!==H.backQuote||this.eat(H.dot)){var u=this.startNodeAt(t,n);u.object=e,l?(u.property=this.parseExpression(),this.expect(H.bracketR)):u.property=this.type===H.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(H.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(H.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===H.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===H.slash&&this.readRegexp();var r,i=this.potentialArrowAt===this.start;switch(this.type){case H._super:return this.allowSuper||this.raise(this.start,`'super' keyword outside a method`),r=this.startNode(),this.next(),this.type===H.parenL&&!this.allowDirectSuper&&this.raise(r.start,`super() call outside constructor of a subclass`),this.type!==H.dot&&this.type!==H.bracketL&&this.type!==H.parenL&&this.unexpected(),this.finishNode(r,`Super`);case H._this:return r=this.startNode(),this.next(),this.finishNode(r,`ThisExpression`);case H.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(H._function))return this.overrideContext(K.f_expr),this.parseFunction(this.startNodeAt(a,o),0,!1,!0,t);if(i&&!this.canInsertSemicolon()){if(this.eat(H.arrow))return this.parseArrowExpression(this.startNodeAt(a,o),[c],!1,t);if(this.options.ecmaVersion>=8&&c.name===`async`&&this.type===H.name&&!s&&(!this.potentialArrowInForAwait||this.value!==`of`||this.containsEsc))return c=this.parseIdent(!1),(this.canInsertSemicolon()||!this.eat(H.arrow))&&this.unexpected(),this.parseArrowExpression(this.startNodeAt(a,o),[c],!0,t)}return c;case H.regexp:var l=this.value;return r=this.parseLiteral(l.value),r.regex={pattern:l.pattern,flags:l.flags},r;case H.num:case H.string:return this.parseLiteral(this.value);case H._null:case H._true:case H._false:return r=this.startNode(),r.value=this.type===H._null?null:this.type===H._true,r.raw=this.type.keyword,this.next(),this.finishNode(r,`Literal`);case H.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 H.bracketL:return r=this.startNode(),this.next(),r.elements=this.parseExprList(H.bracketR,!0,!0,e),this.finishNode(r,`ArrayExpression`);case H.braceL:return this.overrideContext(K.b_expr),this.parseObj(!1,e);case H._function:return r=this.startNode(),this.next(),this.parseFunction(r,0);case H._class:return this.parseClass(this.startNode(),!1);case H._new:return this.parseNew();case H.backQuote:return this.parseTemplate();case H._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===H.parenL&&!e)return this.parseDynamicImport(t);if(this.type===H.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(H.parenR)?e.options=null:(this.expect(H.comma),this.afterTrailingComma(H.parenR)?e.options=null:(e.options=this.parseMaybeAssign(),this.eat(H.parenR)||(this.expect(H.comma),this.afterTrailingComma(H.parenR)||this.unexpected())));else if(!this.eat(H.parenR)){var t=this.start;this.eat(H.comma)&&this.eat(H.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(H.parenL);var e=this.parseExpression();return this.expect(H.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!==H.parenR;){if(l?l=!1:this.expect(H.comma),a&&this.afterTrailingComma(H.parenR,!0)){u=!0;break}if(this.type===H.ellipsis){m=this.start,c.push(this.parseParenItem(this.parseRestBinding())),this.type===H.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(H.parenR),e&&this.shouldParseArrow(c)&&this.eat(H.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===H.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(H.parenL)?this.parseExprList(H.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===H.invalidTemplate?(t||this.raiseRecoverable(this.start,`Bad escape sequence in untagged template literal`),n.value={raw:this.value.replace(/\r\n?/g,`
4
+ `),cooked:null}):n.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,`
5
+ `),cooked:this.value},this.next(),n.tail=this.type===H.backQuote,this.finishNode(n,`TemplateElement`)},q.parseTemplate=function(e){e===void 0&&(e={});var t=e.isTagged;t===void 0&&(t=!1);var n=this.startNode();this.next(),n.expressions=[];var r=this.parseTemplateElement({isTagged:t});for(n.quasis=[r];!r.tail;)this.type===H.eof&&this.raise(this.pos,`Unterminated template literal`),this.expect(H.dollarBraceL),n.expressions.push(this.parseExpression()),this.expect(H.braceR),n.quasis.push(r=this.parseTemplateElement({isTagged:t}));return this.next(),this.finishNode(n,`TemplateLiteral`)},q.isAsyncProp=function(e){return!e.computed&&e.key.type===`Identifier`&&e.key.name===`async`&&(this.type===H.name||this.type===H.num||this.type===H.string||this.type===H.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===H.star)&&!di.test(this.input.slice(this.lastTokEnd,this.start))},q.parseObj=function(e,t){var n=this.startNode(),r=!0,i={};for(n.properties=[],this.next();!this.eat(H.braceR);){if(r)r=!1;else if(this.expect(H.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(H.braceR))break;var a=this.parseProperty(e,t);e||this.checkPropClash(a,i,t),n.properties.push(a)}return this.finishNode(n,e?`ObjectPattern`:`ObjectExpression`)},q.parseProperty=function(e,t){var n=this.startNode(),r,i,a,o;if(this.options.ecmaVersion>=9&&this.eat(H.ellipsis))return e?(n.argument=this.parseIdent(!1),this.type===H.comma&&this.raiseRecoverable(this.start,`Comma is not permitted after the rest element`),this.finishNode(n,`RestElement`)):(n.argument=this.parseMaybeAssign(!1,t),this.type===H.comma&&t&&t.trailingComma<0&&(t.trailingComma=this.start),this.finishNode(n,`SpreadElement`));this.options.ecmaVersion>=6&&(n.method=!1,n.shorthand=!1,(e||t)&&(a=this.start,o=this.startLoc),e||(r=this.eat(H.star)));var s=this.containsEsc;return this.parsePropertyName(n),!e&&!s&&this.options.ecmaVersion>=8&&!r&&this.isAsyncProp(n)?(i=!0,r=this.options.ecmaVersion>=9&&this.eat(H.star),this.parsePropertyName(n)):i=!1,this.parsePropertyValue(n,e,r,i,a,o,t,s),this.finishNode(n,`Property`)},q.parseGetterSetter=function(e){var t=e.key.name;this.parsePropertyName(e),e.value=this.parseMethod(!1),e.kind=t;var n=e.kind===`get`?0:1;if(e.value.params.length!==n){var r=e.value.start;e.kind===`get`?this.raiseRecoverable(r,`getter should have no params`):this.raiseRecoverable(r,`setter should have exactly one param`)}else e.kind===`set`&&e.value.params[0].type===`RestElement`&&this.raiseRecoverable(e.value.params[0].start,`Setter cannot use rest params`)},q.parsePropertyValue=function(e,t,n,r,i,a,o,s){(n||r)&&this.type===H.colon&&this.unexpected(),this.eat(H.colon)?(e.value=t?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,o),e.kind=`init`):this.options.ecmaVersion>=6&&this.type===H.parenL?(t&&this.unexpected(),e.method=!0,e.value=this.parseMethod(n,r),e.kind=`init`):!t&&!s&&this.options.ecmaVersion>=5&&!e.computed&&e.key.type===`Identifier`&&(e.key.name===`get`||e.key.name===`set`)&&this.type!==H.comma&&this.type!==H.braceR&&this.type!==H.eq?((n||r)&&this.unexpected(),this.parseGetterSetter(e)):this.options.ecmaVersion>=6&&!e.computed&&e.key.type===`Identifier`?((n||r)&&this.unexpected(),this.checkUnreserved(e.key),e.key.name===`await`&&!this.awaitIdentPos&&(this.awaitIdentPos=i),t?e.value=this.parseMaybeDefault(i,a,this.copyNode(e.key)):this.type===H.eq&&o?(o.shorthandAssign<0&&(o.shorthandAssign=this.start),e.value=this.parseMaybeDefault(i,a,this.copyNode(e.key))):e.value=this.copyNode(e.key),e.kind=`init`,e.shorthand=!0):this.unexpected()},q.parsePropertyName=function(e){if(this.options.ecmaVersion>=6){if(this.eat(H.bracketL))return e.computed=!0,e.key=this.parseMaybeAssign(),this.expect(H.bracketR),e.key;e.computed=!1}return e.key=this.type===H.num||this.type===H.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!==`never`)},q.initFunction=function(e){e.id=null,this.options.ecmaVersion>=6&&(e.generator=e.expression=!1),this.options.ecmaVersion>=8&&(e.async=!1)},q.parseMethod=function(e,t,n){var r=this.startNode(),i=this.yieldPos,a=this.awaitPos,o=this.awaitIdentPos;return this.initFunction(r),this.options.ecmaVersion>=6&&(r.generator=e),this.options.ecmaVersion>=8&&(r.async=!!t),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Wi(t,r.generator)|Ri|(n?zi:0)),this.expect(H.parenL),r.params=this.parseBindingList(H.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(r,!1,!0,!1),this.yieldPos=i,this.awaitPos=a,this.awaitIdentPos=o,this.finishNode(r,`FunctionExpression`)},q.parseArrowExpression=function(e,t,n,r){var i=this.yieldPos,a=this.awaitPos,o=this.awaitIdentPos;return this.enterScope(Wi(n,!1)|Ii),this.initFunction(e),this.options.ecmaVersion>=8&&(e.async=!!n),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,e.params=this.toAssignableList(t,!0),this.parseFunctionBody(e,!0,!1,r),this.yieldPos=i,this.awaitPos=a,this.awaitIdentPos=o,this.finishNode(e,`ArrowFunctionExpression`)},q.parseFunctionBody=function(e,t,n,r){var i=t&&this.type!==H.braceL,a=this.strict,o=!1;if(i)e.body=this.parseMaybeAssign(r),e.expression=!0,this.checkParams(e,!1);else{var s=this.options.ecmaVersion>=7&&!this.isSimpleParamList(e.params);(!a||s)&&(o=this.strictDirective(this.end),o&&s&&this.raiseRecoverable(e.start,`Illegal 'use strict' directive in function with non-simple parameter list`));var c=this.labels;this.labels=[],o&&(this.strict=!0),this.checkParams(e,!a&&!o&&!t&&!n&&this.isSimpleParamList(e.params)),this.strict&&e.id&&this.checkLValSimple(e.id,Xi),e.body=this.parseBlock(!1,void 0,o&&!a),e.expression=!1,this.adaptDirectivePrologue(e.body.body),this.labels=c}this.exitScope()},q.isSimpleParamList=function(e){for(var t=0,n=e;t<n.length;t+=1)if(n[t].type!==`Identifier`)return!1;return!0},q.checkParams=function(e,t){for(var n=Object.create(null),r=0,i=e.params;r<i.length;r+=1){var a=i[r];this.checkLValInnerPattern(a,Ki,t?null:n)}},q.parseExprList=function(e,t,n,r){for(var i=[],a=!0;!this.eat(e);){if(a)a=!1;else if(this.expect(H.comma),t&&this.afterTrailingComma(e))break;var o=void 0;n&&this.type===H.comma?o=null:this.type===H.ellipsis?(o=this.parseSpread(r),r&&this.type===H.comma&&r.trailingComma<0&&(r.trailingComma=this.start)):o=this.parseMaybeAssign(!1,r),i.push(o)}return i},q.checkUnreserved=function(e){var t=e.start,n=e.end,r=e.name;this.inGenerator&&r===`yield`&&this.raiseRecoverable(t,`Cannot use 'yield' as identifier inside a generator`),this.inAsync&&r===`await`&&this.raiseRecoverable(t,`Cannot use 'await' as identifier inside an async function`),!(this.currentThisScope().flags&Ui)&&r===`arguments`&&this.raiseRecoverable(t,`Cannot use 'arguments' in class field initializer`),this.inClassStaticBlock&&(r===`arguments`||r===`await`)&&this.raise(t,`Cannot use `+r+` in class static initialization block`),this.keywords.test(r)&&this.raise(t,`Unexpected keyword '`+r+`'`),!(this.options.ecmaVersion<6&&this.input.slice(t,n).indexOf(`\\`)!==-1)&&(this.strict?this.reservedWordsStrict:this.reservedWords).test(r)&&(!this.inAsync&&r===`await`&&this.raiseRecoverable(t,`Cannot use keyword 'await' outside an async function`),this.raiseRecoverable(t,`The keyword '`+r+`' is reserved`))},q.parseIdent=function(e){var t=this.parseIdentNode();return this.next(!!e),this.finishNode(t,`Identifier`),e||(this.checkUnreserved(t),t.name===`await`&&!this.awaitIdentPos&&(this.awaitIdentPos=t.start)),t},q.parseIdentNode=function(){var e=this.startNode();return this.type===H.name?e.name=this.value:this.type.keyword?(e.name=this.type.keyword,e.name!==`class`&&e.name!==`function`||this.lastTokEnd===this.lastTokStart+1&&this.input.charCodeAt(this.lastTokStart)===46||this.context.pop(),this.type=H.name):this.unexpected(),e},q.parsePrivateIdent=function(){var e=this.startNode();return this.type===H.privateId?e.name=this.value:this.unexpected(),this.next(),this.finishNode(e,`PrivateIdentifier`),this.options.checkPrivateFields&&(this.privateNameStack.length===0?this.raise(e.start,`Private field '#`+e.name+`' must be declared in an enclosing class`):this.privateNameStack[this.privateNameStack.length-1].used.push(e)),e},q.parseYield=function(e){this.yieldPos||=this.start;var t=this.startNode();return this.next(),this.type===H.semi||this.canInsertSemicolon()||this.type!==H.star&&!this.type.startsExpr?(t.delegate=!1,t.argument=null):(t.delegate=this.eat(H.star),t.argument=this.parseMaybeAssign(e)),this.finishNode(t,`YieldExpression`)},q.parseAwait=function(e){this.awaitPos||=this.start;var t=this.startNode();return this.next(),t.argument=this.parseMaybeUnary(null,!0,!1,e),this.finishNode(t,`AwaitExpression`)};var ha=W.prototype;ha.raise=function(e,t){var n=Di(this.input,e);t+=` (`+n.line+`:`+n.column+`)`,this.sourceFile&&(t+=` in `+this.sourceFile);var r=SyntaxError(t);throw r.pos=e,r.loc=n,r.raisedAt=this.pos,r},ha.raiseRecoverable=ha.raise,ha.curPosition=function(){if(this.options.locations)return new Ti(this.curLine,this.pos-this.lineStart)};var ga=W.prototype,_a=function(e){this.flags=e,this.var=[],this.lexical=[],this.functions=[]};ga.enterScope=function(e){this.scopeStack.push(new _a(e))},ga.exitScope=function(){this.scopeStack.pop()},ga.treatFunctionsAsVarInScope=function(e){return e.flags&Ni||!this.inModule&&e.flags&Mi},ga.declareName=function(e,t,n){var r=!1;if(t===qi){var i=this.currentScope();r=i.lexical.indexOf(e)>-1||i.functions.indexOf(e)>-1||i.var.indexOf(e)>-1,i.lexical.push(e),this.inModule&&i.flags&Mi&&delete this.undefinedExports[e]}else if(t===Yi)this.currentScope().lexical.push(e);else if(t===Ji){var a=this.currentScope();r=this.treatFunctionsAsVar?a.lexical.indexOf(e)>-1:a.lexical.indexOf(e)>-1||a.var.indexOf(e)>-1,a.functions.push(e)}else for(var o=this.scopeStack.length-1;o>=0;--o){var s=this.scopeStack[o];if(s.lexical.indexOf(e)>-1&&!(s.flags&Li&&s.lexical[0]===e)||!this.treatFunctionsAsVarInScope(s)&&s.functions.indexOf(e)>-1){r=!0;break}if(s.var.push(e),this.inModule&&s.flags&Mi&&delete this.undefinedExports[e],s.flags&Ui)break}r&&this.raiseRecoverable(n,`Identifier '`+e+`' has already been declared`)},ga.checkLocalExport=function(e){this.scopeStack[0].lexical.indexOf(e.name)===-1&&this.scopeStack[0].var.indexOf(e.name)===-1&&(this.undefinedExports[e.name]=e)},ga.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]},ga.currentVarScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&(Ui|Vi|Bi))return t}},ga.currentThisScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&(Ui|Vi|Bi)&&!(t.flags&Ii))return t}};var va=function(e,t,n){this.type=``,this.start=t,this.end=0,e.options.locations&&(this.loc=new Ei(e,n)),e.options.directSourceFile&&(this.sourceFile=e.options.directSourceFile),e.options.ranges&&(this.range=[t,0])},ya=W.prototype;ya.startNode=function(){return new va(this,this.start,this.startLoc)},ya.startNodeAt=function(e,t){return new va(this,e,t)};function ba(e,t,n,r){return e.type=t,e.end=n,this.options.locations&&(e.loc.end=r),this.options.ranges&&(e.range[1]=n),e}ya.finishNode=function(e,t){return ba.call(this,e,t,this.lastTokEnd,this.lastTokEndLoc)},ya.finishNodeAt=function(e,t,n,r){return ba.call(this,e,t,n,r)},ya.copyNode=function(e){var t=new va(this,e.start,this.startLoc);for(var n in e)t[n]=e[n];return t};var xa=`Berf Beria_Erfe Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sidetic Sidt Sunu Sunuwar Tai_Yo Tayo Todhri Todr Tolong_Siki Tols Tulu_Tigalari Tutg Unknown Zzzz`,Sa=`ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS`,Ca=Sa+` Extended_Pictographic`,wa=Ca,Ta=wa+` EBase EComp EMod EPres ExtPict`,Ea=Ta,Da={9:Sa,10:Ca,11:wa,12:Ta,13:Ea,14:Ea},Oa={9:``,10:``,11:``,12:``,13:``,14:`Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji`},ka=`Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu`,Aa=`Adlam Adlm Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb`,ja=Aa+` Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd`,Ma=ja+` Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho`,Na=Ma+` Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi`,Pa=Na+` Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith`,Fa={9:Aa,10:ja,11:Ma,12:Na,13:Pa,14:Pa+` `+xa},Ia={};function La(e){var t=Ia[e]={binary:Si(Da[e]+` `+ka),binaryOfStrings:Si(Oa[e]),nonBinary:{General_Category:Si(ka),Script:Si(Fa[e])}};t.nonBinary.Script_Extensions=t.nonBinary.Script,t.nonBinary.gc=t.nonBinary.General_Category,t.nonBinary.sc=t.nonBinary.Script,t.nonBinary.scx=t.nonBinary.Script_Extensions}for(var Ra=0,za=[9,10,11,12,13,14];Ra<za.length;Ra+=1){var Ba=za[Ra];La(Ba)}var J=W.prototype,Va=function(e,t){this.parent=e,this.base=t||this};Va.prototype.separatedFrom=function(e){for(var t=this;t;t=t.parent)for(var n=e;n;n=n.parent)if(t.base===n.base&&t!==n)return!0;return!1},Va.prototype.sibling=function(){return new Va(this.parent,this.base)};var Ha=function(e){this.parser=e,this.validFlags=`gim`+(e.options.ecmaVersion>=6?`uy`:``)+(e.options.ecmaVersion>=9?`s`:``)+(e.options.ecmaVersion>=13?`d`:``)+(e.options.ecmaVersion>=15?`v`:``),this.unicodeProperties=Ia[e.options.ecmaVersion>=14?14:e.options.ecmaVersion],this.source=``,this.flags=``,this.start=0,this.switchU=!1,this.switchV=!1,this.switchN=!1,this.pos=0,this.lastIntValue=0,this.lastStringValue=``,this.lastAssertionIsQuantifiable=!1,this.numCapturingParens=0,this.maxBackReference=0,this.groupNames=Object.create(null),this.backReferenceNames=[],this.branchID=null};Ha.prototype.reset=function(e,t,n){var r=n.indexOf(`v`)!==-1,i=n.indexOf(`u`)!==-1;this.start=e|0,this.source=t+``,this.flags=n,r&&this.parser.options.ecmaVersion>=15?(this.switchU=!0,this.switchV=!0,this.switchN=!0):(this.switchU=i&&this.parser.options.ecmaVersion>=6,this.switchV=!1,this.switchN=i&&this.parser.options.ecmaVersion>=9)},Ha.prototype.raise=function(e){this.parser.raiseRecoverable(this.start,`Invalid regular expression: /`+this.source+`/: `+e)},Ha.prototype.at=function(e,t){t===void 0&&(t=!1);var n=this.source,r=n.length;if(e>=r)return-1;var i=n.charCodeAt(e);if(!(t||this.switchU)||i<=55295||i>=57344||e+1>=r)return i;var a=n.charCodeAt(e+1);return a>=56320&&a<=57343?(i<<10)+a-56613888:i},Ha.prototype.nextIndex=function(e,t){t===void 0&&(t=!1);var n=this.source,r=n.length;if(e>=r)return r;var i=n.charCodeAt(e),a;return!(t||this.switchU)||i<=55295||i>=57344||e+1>=r||(a=n.charCodeAt(e+1))<56320||a>57343?e+1:e+2},Ha.prototype.current=function(e){return e===void 0&&(e=!1),this.at(this.pos,e)},Ha.prototype.lookahead=function(e){return e===void 0&&(e=!1),this.at(this.nextIndex(this.pos,e),e)},Ha.prototype.advance=function(e){e===void 0&&(e=!1),this.pos=this.nextIndex(this.pos,e)},Ha.prototype.eat=function(e,t){return t===void 0&&(t=!1),this.current(t)===e&&(this.advance(t),!0)},Ha.prototype.eatChars=function(e,t){t===void 0&&(t=!1);for(var n=this.pos,r=0,i=e;r<i.length;r+=1){var a=i[r],o=this.at(n,t);if(o===-1||o!==a)return!1;n=this.nextIndex(n,t)}return this.pos=n,!0},J.validateRegExpFlags=function(e){for(var t=e.validFlags,n=e.flags,r=!1,i=!1,a=0;a<n.length;a++){var o=n.charAt(a);t.indexOf(o)===-1&&this.raise(e.start,`Invalid regular expression flag`),n.indexOf(o,a+1)>-1&&this.raise(e.start,`Duplicate regular expression flag`),o===`u`&&(r=!0),o===`v`&&(i=!0)}this.options.ecmaVersion>=15&&r&&i&&this.raise(e.start,`Invalid regular expression flag`)};function Ua(e){for(var t in e)return!0;return!1}J.validateRegExpPattern=function(e){this.regexp_pattern(e),!e.switchN&&this.options.ecmaVersion>=9&&Ua(e.groupNames)&&(e.switchN=!0,this.regexp_pattern(e))},J.regexp_pattern=function(e){e.pos=0,e.lastIntValue=0,e.lastStringValue=``,e.lastAssertionIsQuantifiable=!1,e.numCapturingParens=0,e.maxBackReference=0,e.groupNames=Object.create(null),e.backReferenceNames.length=0,e.branchID=null,this.regexp_disjunction(e),e.pos!==e.source.length&&(e.eat(41)&&e.raise(`Unmatched ')'`),(e.eat(93)||e.eat(125))&&e.raise(`Lone quantifier brackets`)),e.maxBackReference>e.numCapturingParens&&e.raise(`Invalid escape`);for(var t=0,n=e.backReferenceNames;t<n.length;t+=1){var r=n[t];e.groupNames[r]||e.raise(`Invalid named capture referenced`)}},J.regexp_disjunction=function(e){var t=this.options.ecmaVersion>=16;for(t&&(e.branchID=new Va(e.branchID,null)),this.regexp_alternative(e);e.eat(124);)t&&(e.branchID=e.branchID.sibling()),this.regexp_alternative(e);t&&(e.branchID=e.branchID.parent),this.regexp_eatQuantifier(e,!0)&&e.raise(`Nothing to repeat`),e.eat(123)&&e.raise(`Lone quantifier brackets`)},J.regexp_alternative=function(e){for(;e.pos<e.source.length&&this.regexp_eatTerm(e););},J.regexp_eatTerm=function(e){return this.regexp_eatAssertion(e)?(e.lastAssertionIsQuantifiable&&this.regexp_eatQuantifier(e)&&e.switchU&&e.raise(`Invalid quantifier`),!0):(e.switchU?this.regexp_eatAtom(e):this.regexp_eatExtendedAtom(e))?(this.regexp_eatQuantifier(e),!0):!1},J.regexp_eatAssertion=function(e){var t=e.pos;if(e.lastAssertionIsQuantifiable=!1,e.eat(94)||e.eat(36))return!0;if(e.eat(92)){if(e.eat(66)||e.eat(98))return!0;e.pos=t}if(e.eat(40)&&e.eat(63)){var n=!1;if(this.options.ecmaVersion>=9&&(n=e.eat(60)),e.eat(61)||e.eat(33))return this.regexp_disjunction(e),e.eat(41)||e.raise(`Unterminated group`),e.lastAssertionIsQuantifiable=!n,!0}return e.pos=t,!1},J.regexp_eatQuantifier=function(e,t){return t===void 0&&(t=!1),this.regexp_eatQuantifierPrefix(e,t)?(e.eat(63),!0):!1},J.regexp_eatQuantifierPrefix=function(e,t){return e.eat(42)||e.eat(43)||e.eat(63)||this.regexp_eatBracedQuantifier(e,t)},J.regexp_eatBracedQuantifier=function(e,t){var n=e.pos;if(e.eat(123)){var r=0,i=-1;if(this.regexp_eatDecimalDigits(e)&&(r=e.lastIntValue,e.eat(44)&&this.regexp_eatDecimalDigits(e)&&(i=e.lastIntValue),e.eat(125)))return i!==-1&&i<r&&!t&&e.raise(`numbers out of order in {} quantifier`),!0;e.switchU&&!t&&e.raise(`Incomplete quantifier`),e.pos=n}return!1},J.regexp_eatAtom=function(e){return this.regexp_eatPatternCharacters(e)||e.eat(46)||this.regexp_eatReverseSolidusAtomEscape(e)||this.regexp_eatCharacterClass(e)||this.regexp_eatUncapturingGroup(e)||this.regexp_eatCapturingGroup(e)},J.regexp_eatReverseSolidusAtomEscape=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatAtomEscape(e))return!0;e.pos=t}return!1},J.regexp_eatUncapturingGroup=function(e){var t=e.pos;if(e.eat(40)){if(e.eat(63)){if(this.options.ecmaVersion>=16){var n=this.regexp_eatModifiers(e),r=e.eat(45);if(n||r){for(var i=0;i<n.length;i++){var a=n.charAt(i);n.indexOf(a,i+1)>-1&&e.raise(`Duplicate regular expression modifiers`)}if(r){var o=this.regexp_eatModifiers(e);!n&&!o&&e.current()===58&&e.raise(`Invalid regular expression modifiers`);for(var s=0;s<o.length;s++){var c=o.charAt(s);(o.indexOf(c,s+1)>-1||n.indexOf(c)>-1)&&e.raise(`Duplicate regular expression modifiers`)}}}}if(e.eat(58)){if(this.regexp_disjunction(e),e.eat(41))return!0;e.raise(`Unterminated group`)}}e.pos=t}return!1},J.regexp_eatCapturingGroup=function(e){if(e.eat(40)){if(this.options.ecmaVersion>=9?this.regexp_groupSpecifier(e):e.current()===63&&e.raise(`Invalid group`),this.regexp_disjunction(e),e.eat(41))return e.numCapturingParens+=1,!0;e.raise(`Unterminated group`)}return!1},J.regexp_eatModifiers=function(e){for(var t=``,n=0;(n=e.current())!==-1&&Wa(n);)t+=Ci(n),e.advance();return t};function Wa(e){return e===105||e===109||e===115}J.regexp_eatExtendedAtom=function(e){return e.eat(46)||this.regexp_eatReverseSolidusAtomEscape(e)||this.regexp_eatCharacterClass(e)||this.regexp_eatUncapturingGroup(e)||this.regexp_eatCapturingGroup(e)||this.regexp_eatInvalidBracedQuantifier(e)||this.regexp_eatExtendedPatternCharacter(e)},J.regexp_eatInvalidBracedQuantifier=function(e){return this.regexp_eatBracedQuantifier(e,!0)&&e.raise(`Nothing to repeat`),!1},J.regexp_eatSyntaxCharacter=function(e){var t=e.current();return Ga(t)?(e.lastIntValue=t,e.advance(),!0):!1};function Ga(e){return e===36||e>=40&&e<=43||e===46||e===63||e>=91&&e<=94||e>=123&&e<=125}J.regexp_eatPatternCharacters=function(e){for(var t=e.pos,n=0;(n=e.current())!==-1&&!Ga(n);)e.advance();return e.pos!==t},J.regexp_eatExtendedPatternCharacter=function(e){var t=e.current();return t!==-1&&t!==36&&!(t>=40&&t<=43)&&t!==46&&t!==63&&t!==91&&t!==94&&t!==124&&(e.advance(),!0)},J.regexp_groupSpecifier=function(e){if(e.eat(63)){this.regexp_eatGroupName(e)||e.raise(`Invalid group`);var t=this.options.ecmaVersion>=16,n=e.groupNames[e.lastStringValue];if(n){if(t)for(var r=0,i=n;r<i.length;r+=1)i[r].separatedFrom(e.branchID)||e.raise(`Duplicate capture group name`);else e.raise(`Duplicate capture group name`)}t?(n||(e.groupNames[e.lastStringValue]=[])).push(e.branchID):e.groupNames[e.lastStringValue]=!0}},J.regexp_eatGroupName=function(e){if(e.lastStringValue=``,e.eat(60)){if(this.regexp_eatRegExpIdentifierName(e)&&e.eat(62))return!0;e.raise(`Invalid capture group name`)}return!1},J.regexp_eatRegExpIdentifierName=function(e){if(e.lastStringValue=``,this.regexp_eatRegExpIdentifierStart(e)){for(e.lastStringValue+=Ci(e.lastIntValue);this.regexp_eatRegExpIdentifierPart(e);)e.lastStringValue+=Ci(e.lastIntValue);return!0}return!1},J.regexp_eatRegExpIdentifierStart=function(e){var t=e.pos,n=this.options.ecmaVersion>=11,r=e.current(n);return e.advance(n),r===92&&this.regexp_eatRegExpUnicodeEscapeSequence(e,n)&&(r=e.lastIntValue),Ka(r)?(e.lastIntValue=r,!0):(e.pos=t,!1)};function Ka(e){return ai(e,!0)||e===36||e===95}J.regexp_eatRegExpIdentifierPart=function(e){var t=e.pos,n=this.options.ecmaVersion>=11,r=e.current(n);return e.advance(n),r===92&&this.regexp_eatRegExpUnicodeEscapeSequence(e,n)&&(r=e.lastIntValue),qa(r)?(e.lastIntValue=r,!0):(e.pos=t,!1)};function qa(e){return oi(e,!0)||e===36||e===95||e===8204||e===8205}J.regexp_eatAtomEscape=function(e){return this.regexp_eatBackReference(e)||this.regexp_eatCharacterClassEscape(e)||this.regexp_eatCharacterEscape(e)||e.switchN&&this.regexp_eatKGroupName(e)?!0:(e.switchU&&(e.current()===99&&e.raise(`Invalid unicode escape`),e.raise(`Invalid escape`)),!1)},J.regexp_eatBackReference=function(e){var t=e.pos;if(this.regexp_eatDecimalEscape(e)){var n=e.lastIntValue;if(e.switchU)return n>e.maxBackReference&&(e.maxBackReference=n),!0;if(n<=e.numCapturingParens)return!0;e.pos=t}return!1},J.regexp_eatKGroupName=function(e){if(e.eat(107)){if(this.regexp_eatGroupName(e))return e.backReferenceNames.push(e.lastStringValue),!0;e.raise(`Invalid named reference`)}return!1},J.regexp_eatCharacterEscape=function(e){return this.regexp_eatControlEscape(e)||this.regexp_eatCControlLetter(e)||this.regexp_eatZero(e)||this.regexp_eatHexEscapeSequence(e)||this.regexp_eatRegExpUnicodeEscapeSequence(e,!1)||!e.switchU&&this.regexp_eatLegacyOctalEscapeSequence(e)||this.regexp_eatIdentityEscape(e)},J.regexp_eatCControlLetter=function(e){var t=e.pos;if(e.eat(99)){if(this.regexp_eatControlLetter(e))return!0;e.pos=t}return!1},J.regexp_eatZero=function(e){return e.current()===48&&!ao(e.lookahead())&&(e.lastIntValue=0,e.advance(),!0)},J.regexp_eatControlEscape=function(e){var t=e.current();return t===116?(e.lastIntValue=9,e.advance(),!0):t===110?(e.lastIntValue=10,e.advance(),!0):t===118?(e.lastIntValue=11,e.advance(),!0):t===102?(e.lastIntValue=12,e.advance(),!0):t===114&&(e.lastIntValue=13,e.advance(),!0)},J.regexp_eatControlLetter=function(e){var t=e.current();return Ja(t)?(e.lastIntValue=t%32,e.advance(),!0):!1};function Ja(e){return e>=65&&e<=90||e>=97&&e<=122}J.regexp_eatRegExpUnicodeEscapeSequence=function(e,t){t===void 0&&(t=!1);var n=e.pos,r=t||e.switchU;if(e.eat(117)){if(this.regexp_eatFixedHexDigits(e,4)){var i=e.lastIntValue;if(r&&i>=55296&&i<=56319){var a=e.pos;if(e.eat(92)&&e.eat(117)&&this.regexp_eatFixedHexDigits(e,4)){var o=e.lastIntValue;if(o>=56320&&o<=57343)return e.lastIntValue=(i-55296)*1024+(o-56320)+65536,!0}e.pos=a,e.lastIntValue=i}return!0}if(r&&e.eat(123)&&this.regexp_eatHexDigits(e)&&e.eat(125)&&Ya(e.lastIntValue))return!0;r&&e.raise(`Invalid unicode escape`),e.pos=n}return!1};function Ya(e){return e>=0&&e<=1114111}J.regexp_eatIdentityEscape=function(e){if(e.switchU)return this.regexp_eatSyntaxCharacter(e)?!0:e.eat(47)?(e.lastIntValue=47,!0):!1;var t=e.current();return t!==99&&(!e.switchN||t!==107)&&(e.lastIntValue=t,e.advance(),!0)},J.regexp_eatDecimalEscape=function(e){e.lastIntValue=0;var t=e.current();if(t>=49&&t<=57){do e.lastIntValue=10*e.lastIntValue+(t-48),e.advance();while((t=e.current())>=48&&t<=57);return!0}return!1};var Xa=0,Za=1,Qa=2;J.regexp_eatCharacterClassEscape=function(e){var t=e.current();if($a(t))return e.lastIntValue=-1,e.advance(),Za;var n=!1;if(e.switchU&&this.options.ecmaVersion>=9&&((n=t===80)||t===112)){e.lastIntValue=-1,e.advance();var r;if(e.eat(123)&&(r=this.regexp_eatUnicodePropertyValueExpression(e))&&e.eat(125))return n&&r===Qa&&e.raise(`Invalid property name`),r;e.raise(`Invalid property name`)}return Xa};function $a(e){return e===100||e===68||e===115||e===83||e===119||e===87}J.regexp_eatUnicodePropertyValueExpression=function(e){var t=e.pos;if(this.regexp_eatUnicodePropertyName(e)&&e.eat(61)){var n=e.lastStringValue;if(this.regexp_eatUnicodePropertyValue(e)){var r=e.lastStringValue;return this.regexp_validateUnicodePropertyNameAndValue(e,n,r),Za}}if(e.pos=t,this.regexp_eatLoneUnicodePropertyNameOrValue(e)){var i=e.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(e,i)}return Xa},J.regexp_validateUnicodePropertyNameAndValue=function(e,t,n){yi(e.unicodeProperties.nonBinary,t)||e.raise(`Invalid property name`),e.unicodeProperties.nonBinary[t].test(n)||e.raise(`Invalid property value`)},J.regexp_validateUnicodePropertyNameOrValue=function(e,t){if(e.unicodeProperties.binary.test(t))return Za;if(e.switchV&&e.unicodeProperties.binaryOfStrings.test(t))return Qa;e.raise(`Invalid property name`)},J.regexp_eatUnicodePropertyName=function(e){var t=0;for(e.lastStringValue=``;eo(t=e.current());)e.lastStringValue+=Ci(t),e.advance();return e.lastStringValue!==``};function eo(e){return Ja(e)||e===95}J.regexp_eatUnicodePropertyValue=function(e){var t=0;for(e.lastStringValue=``;to(t=e.current());)e.lastStringValue+=Ci(t),e.advance();return e.lastStringValue!==``};function to(e){return eo(e)||ao(e)}J.regexp_eatLoneUnicodePropertyNameOrValue=function(e){return this.regexp_eatUnicodePropertyValue(e)},J.regexp_eatCharacterClass=function(e){if(e.eat(91)){var t=e.eat(94),n=this.regexp_classContents(e);return e.eat(93)||e.raise(`Unterminated character class`),t&&n===Qa&&e.raise(`Negated character class may contain strings`),!0}return!1},J.regexp_classContents=function(e){return e.current()===93?Za:e.switchV?this.regexp_classSetExpression(e):(this.regexp_nonEmptyClassRanges(e),Za)},J.regexp_nonEmptyClassRanges=function(e){for(;this.regexp_eatClassAtom(e);){var t=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassAtom(e)){var n=e.lastIntValue;e.switchU&&(t===-1||n===-1)&&e.raise(`Invalid character class`),t!==-1&&n!==-1&&t>n&&e.raise(`Range out of order in character class`)}}},J.regexp_eatClassAtom=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatClassEscape(e))return!0;if(e.switchU){var n=e.current();(n===99||co(n))&&e.raise(`Invalid class escape`),e.raise(`Invalid escape`)}e.pos=t}var r=e.current();return r!==93&&(e.lastIntValue=r,e.advance(),!0)},J.regexp_eatClassEscape=function(e){var t=e.pos;if(e.eat(98))return e.lastIntValue=8,!0;if(e.switchU&&e.eat(45))return e.lastIntValue=45,!0;if(!e.switchU&&e.eat(99)){if(this.regexp_eatClassControlLetter(e))return!0;e.pos=t}return this.regexp_eatCharacterClassEscape(e)||this.regexp_eatCharacterEscape(e)},J.regexp_classSetExpression=function(e){var t=Za,n;if(!this.regexp_eatClassSetRange(e)){if(n=this.regexp_eatClassSetOperand(e)){n===Qa&&(t=Qa);for(var r=e.pos;e.eatChars([38,38]);)e.current()!==38&&(n=this.regexp_eatClassSetOperand(e))?n!==Qa&&(t=Za):e.raise(`Invalid character in character class`);if(r!==e.pos)return t;for(;e.eatChars([45,45]);)this.regexp_eatClassSetOperand(e)||e.raise(`Invalid character in character class`);if(r!==e.pos)return t}else e.raise(`Invalid character in character class`)}for(;;)if(!this.regexp_eatClassSetRange(e)){if(n=this.regexp_eatClassSetOperand(e),!n)return t;n===Qa&&(t=Qa)}},J.regexp_eatClassSetRange=function(e){var t=e.pos;if(this.regexp_eatClassSetCharacter(e)){var n=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassSetCharacter(e)){var r=e.lastIntValue;return n!==-1&&r!==-1&&n>r&&e.raise(`Range out of order in character class`),!0}e.pos=t}return!1},J.regexp_eatClassSetOperand=function(e){return this.regexp_eatClassSetCharacter(e)?Za:this.regexp_eatClassStringDisjunction(e)||this.regexp_eatNestedClass(e)},J.regexp_eatNestedClass=function(e){var t=e.pos;if(e.eat(91)){var n=e.eat(94),r=this.regexp_classContents(e);if(e.eat(93))return n&&r===Qa&&e.raise(`Negated character class may contain strings`),r;e.pos=t}if(e.eat(92)){var i=this.regexp_eatCharacterClassEscape(e);if(i)return i;e.pos=t}return null},J.regexp_eatClassStringDisjunction=function(e){var t=e.pos;if(e.eatChars([92,113])){if(e.eat(123)){var n=this.regexp_classStringDisjunctionContents(e);if(e.eat(125))return n}else e.raise(`Invalid escape`);e.pos=t}return null},J.regexp_classStringDisjunctionContents=function(e){for(var t=this.regexp_classString(e);e.eat(124);)this.regexp_classString(e)===Qa&&(t=Qa);return t},J.regexp_classString=function(e){for(var t=0;this.regexp_eatClassSetCharacter(e);)t++;return t===1?Za:Qa},J.regexp_eatClassSetCharacter=function(e){var t=e.pos;if(e.eat(92))return this.regexp_eatCharacterEscape(e)||this.regexp_eatClassSetReservedPunctuator(e)?!0:e.eat(98)?(e.lastIntValue=8,!0):(e.pos=t,!1);var n=e.current();return n<0||n===e.lookahead()&&no(n)||ro(n)?!1:(e.advance(),e.lastIntValue=n,!0)};function no(e){return e===33||e>=35&&e<=38||e>=42&&e<=44||e===46||e>=58&&e<=64||e===94||e===96||e===126}function ro(e){return e===40||e===41||e===45||e===47||e>=91&&e<=93||e>=123&&e<=125}J.regexp_eatClassSetReservedPunctuator=function(e){var t=e.current();return io(t)?(e.lastIntValue=t,e.advance(),!0):!1};function io(e){return e===33||e===35||e===37||e===38||e===44||e===45||e>=58&&e<=62||e===64||e===96||e===126}J.regexp_eatClassControlLetter=function(e){var t=e.current();return ao(t)||t===95?(e.lastIntValue=t%32,e.advance(),!0):!1},J.regexp_eatHexEscapeSequence=function(e){var t=e.pos;if(e.eat(120)){if(this.regexp_eatFixedHexDigits(e,2))return!0;e.switchU&&e.raise(`Invalid escape`),e.pos=t}return!1},J.regexp_eatDecimalDigits=function(e){var t=e.pos,n=0;for(e.lastIntValue=0;ao(n=e.current());)e.lastIntValue=10*e.lastIntValue+(n-48),e.advance();return e.pos!==t};function ao(e){return e>=48&&e<=57}J.regexp_eatHexDigits=function(e){var t=e.pos,n=0;for(e.lastIntValue=0;oo(n=e.current());)e.lastIntValue=16*e.lastIntValue+so(n),e.advance();return e.pos!==t};function oo(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function so(e){return e>=65&&e<=70?10+(e-65):e>=97&&e<=102?10+(e-97):e-48}J.regexp_eatLegacyOctalEscapeSequence=function(e){if(this.regexp_eatOctalDigit(e)){var t=e.lastIntValue;if(this.regexp_eatOctalDigit(e)){var n=e.lastIntValue;e.lastIntValue=t<=3&&this.regexp_eatOctalDigit(e)?t*64+n*8+e.lastIntValue:t*8+n}else e.lastIntValue=t;return!0}return!1},J.regexp_eatOctalDigit=function(e){var t=e.current();return co(t)?(e.lastIntValue=t-48,e.advance(),!0):(e.lastIntValue=0,!1)};function co(e){return e>=48&&e<=55}J.regexp_eatFixedHexDigits=function(e,t){var n=e.pos;e.lastIntValue=0;for(var r=0;r<t;++r){var i=e.current();if(!oo(i))return e.pos=n,!1;e.lastIntValue=16*e.lastIntValue+so(i),e.advance()}return!0};var lo=function(e){this.type=e.type,this.value=e.value,this.start=e.start,this.end=e.end,e.options.locations&&(this.loc=new Ei(e,e.startLoc,e.endLoc)),e.options.ranges&&(this.range=[e.start,e.end])},Y=W.prototype;Y.next=function(e){!e&&this.type.keyword&&this.containsEsc&&this.raiseRecoverable(this.start,`Escape sequence in keyword `+this.type.keyword),this.options.onToken&&this.options.onToken(new lo(this)),this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()},Y.getToken=function(){return this.next(),new lo(this)},typeof Symbol<`u`&&(Y[Symbol.iterator]=function(){var e=this;return{next:function(){var t=e.getToken();return{done:t.type===H.eof,value:t}}}}),Y.nextToken=function(){var e=this.curContext();if(e&&e.preserveSpace||this.skipSpace(),this.start=this.pos,this.options.locations&&(this.startLoc=this.curPosition()),this.pos>=this.input.length)return this.finishToken(H.eof);if(e.override)return e.override(this);this.readToken(this.fullCharCodeAtPos())},Y.readToken=function(e){return ai(e,this.options.ecmaVersion>=6)||e===92?this.readWord():this.getTokenFromCode(e)},Y.fullCharCodeAt=function(e){var t=this.input.charCodeAt(e);if(t<=55295||t>=56320)return t;var n=this.input.charCodeAt(e+1);return n<=56319||n>=57344?t:(t<<10)+n-56613888},Y.fullCharCodeAtPos=function(){return this.fullCharCodeAt(this.pos)},Y.skipBlockComment=function(){var e=this.options.onComment&&this.curPosition(),t=this.pos,n=this.input.indexOf(`*/`,this.pos+=2);if(n===-1&&this.raise(this.pos-2,`Unterminated comment`),this.pos=n+2,this.options.locations)for(var r=void 0,i=t;(r=mi(this.input,i,this.pos))>-1;)++this.curLine,i=this.lineStart=r;this.options.onComment&&this.options.onComment(!0,this.input.slice(t+2,n),t,this.pos,e,this.curPosition())},Y.skipLineComment=function(e){for(var t=this.pos,n=this.options.onComment&&this.curPosition(),r=this.input.charCodeAt(this.pos+=e);this.pos<this.input.length&&!pi(r);)r=this.input.charCodeAt(++this.pos);this.options.onComment&&this.options.onComment(!1,this.input.slice(t+e,this.pos),t,this.pos,n,this.curPosition())},Y.skipSpace=function(){loop:for(;this.pos<this.input.length;){var e=this.input.charCodeAt(this.pos);switch(e){case 32:case 160:++this.pos;break;case 13:this.input.charCodeAt(this.pos+1)===10&&++this.pos;case 10:case 8232:case 8233:++this.pos,this.options.locations&&(++this.curLine,this.lineStart=this.pos);break;case 47:switch(this.input.charCodeAt(this.pos+1)){case 42:this.skipBlockComment();break;case 47:this.skipLineComment(2);break;default:break loop}break;default:if(e>8&&e<14||e>=5760&&hi.test(String.fromCharCode(e)))++this.pos;else break loop}}},Y.finishToken=function(e,t){this.end=this.pos,this.options.locations&&(this.endLoc=this.curPosition());var n=this.type;this.type=e,this.value=t,this.updateContext(n)},Y.readToken_dot=function(){var e=this.input.charCodeAt(this.pos+1);if(e>=48&&e<=57)return this.readNumber(!0);var t=this.input.charCodeAt(this.pos+2);return this.options.ecmaVersion>=6&&e===46&&t===46?(this.pos+=3,this.finishToken(H.ellipsis)):(++this.pos,this.finishToken(H.dot))},Y.readToken_slash=function(){var e=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):e===61?this.finishOp(H.assign,2):this.finishOp(H.slash,1)},Y.readToken_mult_modulo_exp=function(e){var t=this.input.charCodeAt(this.pos+1),n=1,r=e===42?H.star:H.modulo;return this.options.ecmaVersion>=7&&e===42&&t===42&&(++n,r=H.starstar,t=this.input.charCodeAt(this.pos+2)),t===61?this.finishOp(H.assign,n+1):this.finishOp(r,n)},Y.readToken_pipe_amp=function(e){var t=this.input.charCodeAt(this.pos+1);return t===e?this.options.ecmaVersion>=12&&this.input.charCodeAt(this.pos+2)===61?this.finishOp(H.assign,3):this.finishOp(e===124?H.logicalOR:H.logicalAND,2):t===61?this.finishOp(H.assign,2):this.finishOp(e===124?H.bitwiseOR:H.bitwiseAND,1)},Y.readToken_caret=function(){return this.input.charCodeAt(this.pos+1)===61?this.finishOp(H.assign,2):this.finishOp(H.bitwiseXOR,1)},Y.readToken_plus_min=function(e){var t=this.input.charCodeAt(this.pos+1);return t===e?t===45&&!this.inModule&&this.input.charCodeAt(this.pos+2)===62&&(this.lastTokEnd===0||di.test(this.input.slice(this.lastTokEnd,this.pos)))?(this.skipLineComment(3),this.skipSpace(),this.nextToken()):this.finishOp(H.incDec,2):t===61?this.finishOp(H.assign,2):this.finishOp(H.plusMin,1)},Y.readToken_lt_gt=function(e){var t=this.input.charCodeAt(this.pos+1),n=1;return t===e?(n=e===62&&this.input.charCodeAt(this.pos+2)===62?3:2,this.input.charCodeAt(this.pos+n)===61?this.finishOp(H.assign,n+1):this.finishOp(H.bitShift,n)):t===33&&e===60&&!this.inModule&&this.input.charCodeAt(this.pos+2)===45&&this.input.charCodeAt(this.pos+3)===45?(this.skipLineComment(4),this.skipSpace(),this.nextToken()):(t===61&&(n=2),this.finishOp(H.relational,n))},Y.readToken_eq_excl=function(e){var t=this.input.charCodeAt(this.pos+1);return t===61?this.finishOp(H.equality,this.input.charCodeAt(this.pos+2)===61?3:2):e===61&&t===62&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken(H.arrow)):this.finishOp(e===61?H.eq:H.prefix,1)},Y.readToken_question=function(){var e=this.options.ecmaVersion;if(e>=11){var t=this.input.charCodeAt(this.pos+1);if(t===46){var n=this.input.charCodeAt(this.pos+2);if(n<48||n>57)return this.finishOp(H.questionDot,2)}if(t===63)return e>=12&&this.input.charCodeAt(this.pos+2)===61?this.finishOp(H.assign,3):this.finishOp(H.coalesce,2)}return this.finishOp(H.question,1)},Y.readToken_numberSign=function(){var e=this.options.ecmaVersion,t=35;if(e>=13&&(++this.pos,t=this.fullCharCodeAtPos(),ai(t,!0)||t===92))return this.finishToken(H.privateId,this.readWord1());this.raise(this.pos,`Unexpected character '`+Ci(t)+`'`)},Y.getTokenFromCode=function(e){switch(e){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(H.parenL);case 41:return++this.pos,this.finishToken(H.parenR);case 59:return++this.pos,this.finishToken(H.semi);case 44:return++this.pos,this.finishToken(H.comma);case 91:return++this.pos,this.finishToken(H.bracketL);case 93:return++this.pos,this.finishToken(H.bracketR);case 123:return++this.pos,this.finishToken(H.braceL);case 125:return++this.pos,this.finishToken(H.braceR);case 58:return++this.pos,this.finishToken(H.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(H.backQuote);case 48:var t=this.input.charCodeAt(this.pos+1);if(t===120||t===88)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(t===111||t===79)return this.readRadixNumber(8);if(t===98||t===66)return this.readRadixNumber(2)}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.readNumber(!1);case 34:case 39:return this.readString(e);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(e);case 124:case 38:return this.readToken_pipe_amp(e);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(e);case 60:case 62:return this.readToken_lt_gt(e);case 61:case 33:return this.readToken_eq_excl(e);case 63:return this.readToken_question();case 126:return this.finishOp(H.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,`Unexpected character '`+Ci(e)+`'`)},Y.finishOp=function(e,t){var n=this.input.slice(this.pos,this.pos+t);return this.pos+=t,this.finishToken(e,n)},Y.readRegexp=function(){for(var e,t,n=this.pos;;){this.pos>=this.input.length&&this.raise(n,`Unterminated regular expression`);var r=this.input.charAt(this.pos);if(di.test(r)&&this.raise(n,`Unterminated regular expression`),e)e=!1;else{if(r===`[`)t=!0;else if(r===`]`&&t)t=!1;else if(r===`/`&&!t)break;e=r===`\\`}++this.pos}var i=this.input.slice(n,this.pos);++this.pos;var a=this.pos,o=this.readWord1();this.containsEsc&&this.unexpected(a);var s=this.regexpState||=new Ha(this);s.reset(n,i,o),this.validateRegExpFlags(s),this.validateRegExpPattern(s);var c=null;try{c=new RegExp(i,o)}catch{}return this.finishToken(H.regexp,{pattern:i,flags:o,value:c})},Y.readInt=function(e,t,n){for(var r=this.options.ecmaVersion>=12&&t===void 0,i=n&&this.input.charCodeAt(this.pos)===48,a=this.pos,o=0,s=0,c=0,l=t??1/0;c<l;++c,++this.pos){var u=this.input.charCodeAt(this.pos),d=void 0;if(r&&u===95)i&&this.raiseRecoverable(this.pos,`Numeric separator is not allowed in legacy octal numeric literals`),s===95&&this.raiseRecoverable(this.pos,`Numeric separator must be exactly one underscore`),c===0&&this.raiseRecoverable(this.pos,`Numeric separator is not allowed at the first of digits`),s=u;else{if(d=u>=97?u-97+10:u>=65?u-65+10:u>=48&&u<=57?u-48:1/0,d>=e)break;s=u,o=o*e+d}}return r&&s===95&&this.raiseRecoverable(this.pos-1,`Numeric separator is not allowed at the last of digits`),this.pos===a||t!=null&&this.pos-a!==t?null:o};function uo(e,t){return t?parseInt(e,8):parseFloat(e.replace(/_/g,``))}function fo(e){return typeof BigInt==`function`?BigInt(e.replace(/_/g,``)):null}Y.readRadixNumber=function(e){var t=this.pos;this.pos+=2;var n=this.readInt(e);return n??this.raise(this.start+2,`Expected number in radix `+e),this.options.ecmaVersion>=11&&this.input.charCodeAt(this.pos)===110?(n=fo(this.input.slice(t,this.pos)),++this.pos):ai(this.fullCharCodeAtPos())&&this.raise(this.pos,`Identifier directly after number`),this.finishToken(H.num,n)},Y.readNumber=function(e){var t=this.pos;!e&&this.readInt(10,void 0,!0)===null&&this.raise(t,`Invalid number`);var n=this.pos-t>=2&&this.input.charCodeAt(t)===48;n&&this.strict&&this.raise(t,`Invalid number`);var r=this.input.charCodeAt(this.pos);if(!n&&!e&&this.options.ecmaVersion>=11&&r===110){var i=fo(this.input.slice(t,this.pos));return++this.pos,ai(this.fullCharCodeAtPos())&&this.raise(this.pos,`Identifier directly after number`),this.finishToken(H.num,i)}n&&/[89]/.test(this.input.slice(t,this.pos))&&(n=!1),r===46&&!n&&(++this.pos,this.readInt(10),r=this.input.charCodeAt(this.pos)),r!==69&&r!==101||n||(r=this.input.charCodeAt(++this.pos),(r===43||r===45)&&++this.pos,this.readInt(10)===null&&this.raise(t,`Invalid number`)),ai(this.fullCharCodeAtPos())&&this.raise(this.pos,`Identifier directly after number`);var a=uo(this.input.slice(t,this.pos),n);return this.finishToken(H.num,a)},Y.readCodePoint=function(){var e=this.input.charCodeAt(this.pos),t;if(e===123){this.options.ecmaVersion<6&&this.unexpected();var n=++this.pos;t=this.readHexChar(this.input.indexOf(`}`,this.pos)-this.pos),++this.pos,t>1114111&&this.invalidStringToken(n,`Code point out of bounds`)}else t=this.readHexChar(4);return t},Y.readString=function(e){for(var t=``,n=++this.pos;;){this.pos>=this.input.length&&this.raise(this.start,`Unterminated string constant`);var r=this.input.charCodeAt(this.pos);if(r===e)break;r===92?(t+=this.input.slice(n,this.pos),t+=this.readEscapedChar(!1),n=this.pos):r===8232||r===8233?(this.options.ecmaVersion<10&&this.raise(this.start,`Unterminated string constant`),++this.pos,this.options.locations&&(this.curLine++,this.lineStart=this.pos)):(pi(r)&&this.raise(this.start,`Unterminated string constant`),++this.pos)}return t+=this.input.slice(n,this.pos++),this.finishToken(H.string,t)};var po={};Y.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(e){if(e===po)this.readInvalidTemplateToken();else throw e}this.inTemplateElement=!1},Y.invalidStringToken=function(e,t){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw po;this.raise(e,t)},Y.readTmplToken=function(){for(var e=``,t=this.pos;;){this.pos>=this.input.length&&this.raise(this.start,`Unterminated template`);var n=this.input.charCodeAt(this.pos);if(n===96||n===36&&this.input.charCodeAt(this.pos+1)===123)return this.pos===this.start&&(this.type===H.template||this.type===H.invalidTemplate)?n===36?(this.pos+=2,this.finishToken(H.dollarBraceL)):(++this.pos,this.finishToken(H.backQuote)):(e+=this.input.slice(t,this.pos),this.finishToken(H.template,e));if(n===92)e+=this.input.slice(t,this.pos),e+=this.readEscapedChar(!0),t=this.pos;else if(pi(n)){switch(e+=this.input.slice(t,this.pos),++this.pos,n){case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:e+=`
6
+ `;break;default:e+=String.fromCharCode(n)}this.options.locations&&(++this.curLine,this.lineStart=this.pos),t=this.pos}else++this.pos}},Y.readInvalidTemplateToken=function(){for(;this.pos<this.input.length;this.pos++)switch(this.input[this.pos]){case`\\`:++this.pos;break;case`$`:if(this.input[this.pos+1]!==`{`)break;case"`":return this.finishToken(H.invalidTemplate,this.input.slice(this.start,this.pos));case`\r`:this.input[this.pos+1]===`
7
+ `&&++this.pos;case`
8
+ `:case`\u2028`:case`\u2029`:++this.curLine,this.lineStart=this.pos+1}this.raise(this.start,`Unterminated template`)},Y.readEscapedChar=function(e){var t=this.input.charCodeAt(++this.pos);switch(++this.pos,t){case 110:return`
9
+ `;case 114:return`\r`;case 120:return String.fromCharCode(this.readHexChar(2));case 117:return Ci(this.readCodePoint());case 116:return` `;case 98:return`\b`;case 118:return`\v`;case 102:return`\f`;case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:return this.options.locations&&(this.lineStart=this.pos,++this.curLine),``;case 56:case 57:if(this.strict&&this.invalidStringToken(this.pos-1,`Invalid escape sequence`),e){var n=this.pos-1;this.invalidStringToken(n,`Invalid escape sequence in template string`)}default:if(t>=48&&t<=55){var r=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],i=parseInt(r,8);return i>255&&(r=r.slice(0,-1),i=parseInt(r,8)),this.pos+=r.length-1,t=this.input.charCodeAt(this.pos),(r!==`0`||t===56||t===57)&&(this.strict||e)&&this.invalidStringToken(this.pos-1-r.length,e?`Octal literal in template string`:`Octal literal in strict mode`),String.fromCharCode(i)}return pi(t)?(this.options.locations&&(this.lineStart=this.pos,++this.curLine),``):String.fromCharCode(t)}},Y.readHexChar=function(e){var t=this.pos,n=this.readInt(16,e);return n===null&&this.invalidStringToken(t,`Bad character escape sequence`),n},Y.readWord1=function(){this.containsEsc=!1;for(var e=``,t=!0,n=this.pos,r=this.options.ecmaVersion>=6;this.pos<this.input.length;){var i=this.fullCharCodeAtPos();if(oi(i,r))this.pos+=i<=65535?1:2;else if(i===92){this.containsEsc=!0,e+=this.input.slice(n,this.pos);var a=this.pos;this.input.charCodeAt(++this.pos)!==117&&this.invalidStringToken(this.pos,`Expecting Unicode escape sequence \\uXXXX`),++this.pos;var o=this.readCodePoint();(t?ai:oi)(o,r)||this.invalidStringToken(a,`Invalid Unicode escape`),e+=Ci(o),n=this.pos}else break;t=!1}return e+this.input.slice(n,this.pos)},Y.readWord=function(){var e=this.readWord1(),t=H.name;return this.keywords.test(e)&&(t=ui[e]),this.finishToken(t,e)},W.acorn={Parser:W,version:`8.17.0`,defaultOptions:Oi,Position:Ti,SourceLocation:Ei,getLineInfo:Di,Node:va,TokenType:B,tokTypes:H,keywordTypes:ui,TokContext:ua,tokContexts:K,isIdentifierChar:oi,isIdentifierStart:ai,Token:lo,isNewLine:pi,lineBreak:di,lineBreakG:fi,nonASCIIwhitespace:hi};function mo(e,t){return W.parse(e,t)}function ho(e){if(e==null||e===``)return null;if(typeof e!=`string`||e.length>4096)return`Alias expression exceeds the supported size`;let t=0,n=0;try{return mo(`function alias(val) { ${e.includes(`return`)?e:`return ${e}`}\n}`,{ecmaVersion:2022,onToken:e=>{if(++t>1024)throw Error(`Alias token limit`);let r=e.type.label;if([`(`,`[`,`{`,"${"].includes(r)&&++n>64)throw Error(`Alias depth limit`);[`)`,`]`,`}`].includes(r)&&n--}}),null}catch{return`Alias syntax is invalid or exceeds the supported complexity`}}var go=new Set([`func`,`defaultFunc`,`validator`,`hidden`,`disabled`,`calculateFunc`,`condition`]),_o=new Set([`__proto__`,`prototype`,`constructor`]);function vo(e){if(!e||typeof e!=`object`||Array.isArray(e))return{ok:!1,reason:`Custom settings schema must be an object`};let t=[{value:e,depth:0}],n=new Set,r=0,i=0;for(;t.length;){let e=t.pop();if(!e)break;if(++r>1e4||e.depth>48)return{ok:!1,reason:`Custom settings schema exceeds safe complexity limits`};let a=e.value;if(typeof a==`string`){if(i+=a.length*2,i>2097152||a.length>65536)return{ok:!1,reason:`Custom settings schema exceeds safe size limits`};if(a.includes("${")||a.includes("`"))return{ok:!1,reason:`Executable custom settings are blocked; existing values are unchanged`}}else if(a&&typeof a==`object`){if(n.has(a)||!Array.isArray(a)&&Object.getPrototypeOf(a)!==Object.prototype&&Object.getPrototypeOf(a)!==null)return{ok:!1,reason:`Custom settings schema has an unsupported data structure`};n.add(a);for(let n of Object.getOwnPropertyNames(a)){if(Array.isArray(a)&&n===`length`)continue;let r=Object.getOwnPropertyDescriptor(a,n);if(_o.has(n)||!r||!(`value`in r))return{ok:!1,reason:`Custom settings schema contains unsafe properties`};let i=r.value;if(!e.fieldMap&&([`format`,`container`,`control`].includes(n)&&i===`html`||n===`html`&&i))return{ok:!1,reason:`Custom settings with active HTML are blocked; existing values are unchanged`};if(!e.fieldMap&&n===`type`&&(i===`custom`||i===`selectSendTo`))return{ok:!1,reason:`Custom settings that load executable components or dynamic options are blocked; existing values are unchanged`};if(!e.fieldMap&&go.has(n)&&(typeof i==`string`&&i.trim()||i&&typeof i==`object`))return{ok:!1,reason:`Executable custom settings are blocked; existing values are unchanged`};if(t.push({value:i,depth:e.depth+1,fieldMap:!e.fieldMap&&n===`items`}),t.length>1e4)return{ok:!1,reason:`Custom settings schema exceeds safe complexity limits`}}}else if(a!==null&&typeof a!=`boolean`&&(typeof a!=`number`||!Number.isFinite(a)))return{ok:!1,reason:`Custom settings schema contains non-JSON values`}}return{ok:!0}}c();var yo={paper:{height:`100%`,maxHeight:`100%`,maxWidth:`100%`,overflow:`hidden`},headingIcon:{marginRight:5,width:32,height:32},titleEnabled:{fontSize:16,color:`#7ff57f`,textTransform:`uppercase`,fontWeight:`bold`,paddingLeft:20},scrollDiv:{width:`100%`,height:`100%`,overflow:`auto`},fullWidth:{width:`100%`},enabledControl:{width:130,display:`inline-block`,verticalAlign:`top`},customControls:{width:`calc(100% - 130px)`,maxWidth:800,display:`inline-block`,verticalAlign:`top`,paddingTop:16},accordionOdd:{},accordionEven:{backgroundColor:`rgba(128, 128, 128, 0.1)`},accordionHeaderOdd:{backgroundColor:`rgba(128, 128, 128, 0.2)`},accordionHeaderEven:{backgroundColor:`rgba(128, 128, 128, 0.3)`},accordionHeaderEnabledOdd:{backgroundColor:`rgba(128, 255, 128, 0.2)`},accordionHeaderEnabledEven:{backgroundColor:`rgba(128, 255, 128, 0.2)`},enabledVisible:{display:`inline-block`},enabledInvisible:{display:`none`}},bo=`.`,xo=class e extends Le{constructor(e){super(e),u(this,`changedIds`,void 0),u(this,`scrollDivRef`,void 0),u(this,`jsonConfigs`,void 0),u(this,`refTemplate`,void 0),u(this,`customObj`,void 0),u(this,`commonConfig`,{}),u(this,`statesFilterFunctions`,{}),u(this,`validationErrors`,new Set),u(this,`schemaErrors`,new Map),u(this,`cb`,void 0),u(this,`cachedNewValues`,void 0),u(this,`onSave`,e=>{if(this.hasBlockedCustomChanges()){var t,n;(t=(n=this.props).onError)==null||t.call(n,!0)}else this.props.objectIDs.length>10&&!this.state.confirmed?(this.cb=e,this.setState({showConfirmation:!0})):this.saveOneState([...this.props.objectIDs],()=>{this.cachedNewValues={},this.commonConfig=this.getCommonConfig(),this.setState({confirmed:!1,hasChanges:void 0,newValues:{}},()=>{this.props.reportChangedIds(this.changedIds),this.props.onChange(!1,!0),e&&setTimeout(()=>e(),100)})})});let t;try{t=JSON.parse((window._localStorage||window.localStorage).getItem(`App.customsExpanded`)||`[]`)}catch{t=[]}this.changedIds=[],this.state={loaded:!1,expanded:t,newValues:{},confirmed:!1,showConfirmation:!1,maxOids:0,systemConfig:this.props.systemConfig},this.scrollDivRef=r(),this.jsonConfigs={},this.refTemplate={},this.props.customsInstances.map(e=>this.refTemplate[e]=r()),this.customObj=this.props.objectIDs.length>1?{common:{custom:{}},native:{}}:wt.deepClone(this.props.objects[this.props.objectIDs[0]]||null),this.customObj&&this.loadAllCustoms().then(()=>{this.commonConfig=this.getCommonConfig(),this.setState({loaded:!0,newValues:{}})})}async componentDidMount(){this.state.systemConfig||this.setState({systemConfig:await this.props.socket.getCompactSystemConfig()}),this.props.registerSaveFunc&&this.props.registerSaveFunc(this.onSave)}componentWillUnmount(){var e,t;this.props.registerSaveFunc&&this.props.registerSaveFunc(),this.validationErrors.clear(),(e=(t=this.props).onError)==null||e.call(t,!1)}setValidationError(e,t){let n=!!this.validationErrors.size;t?this.validationErrors.add(e):this.validationErrors.delete(e);let r=!!this.validationErrors.size;if(n!==r){var i,a;(i=(a=this.props).onError)==null||i.call(a,r)}}async loadAllCustoms(){let e=[];for(let t of this.props.customsInstances){if(t===`_`)continue;let n=t.replace(/\.\d+$/,``).replace(`system.adapter.`,``);this.jsonConfigs[n]===void 0&&(this.jsonConfigs[n]=null,e.push(this.getCustomTemplate(n)))}await Promise.all(e),this.props.customsInstances.forEach(e=>{let t=e.replace(/\.\d+$/,``).replace(`system.adapter.`,``);if(this.jsonConfigs[t]){var n,r;this.jsonConfigs[t].instanceObjs||={},this.jsonConfigs[t].instanceObjs[e]={_id:e,common:JSON.parse(JSON.stringify((n=this.props.objects[`system.adapter.${e}`])==null?void 0:n.common)),native:JSON.parse(JSON.stringify((r=this.props.objects[`system.adapter.${e}`])==null?void 0:r.native)),type:`instance`,instanceObjects:[],objects:[]}}})}getStatesFilterFunction(e){var t;if(this.statesFilterFunctions[e])return this.statesFilterFunctions[e];let n=e.split(`.`)[0],r=(t=this.jsonConfigs[n])==null||(t=t.json)==null?void 0:t.statesFilter,i;if(r===void 0)i=()=>!0;else if(r===!0){let t=`${e}.`;i=e=>e.startsWith(t)}else try{let e=new RegExp(r);i=t=>e.test(t)}catch{console.error(`Invalid statesFilter regex: ${r}`),i=()=>!0}return this.statesFilterFunctions[e]=i,i}getFilteredObjectIDs(e){let t=this.getStatesFilterFunction(e);return this.props.objectIDs.filter(t)}async getCustomTemplate(e){var t;let n=this.props.objects[`system.adapter.${e}`]?wt.deepClone(this.props.objects[`system.adapter.${e}`]):null;if(!n)console.error(`Cannot find adapter "${e}"`);else{if(wt.fixAdminUI(n),((t=n.common)==null?void 0:t.adminUI.custom)===`json`)try{let t=await this.props.socket.fileExists(`${e}.admin`,`jsonCustom.json5`),n,r;r=t?await this.props.socket.readFile(`${e}.admin`,`jsonCustom.json5`):await this.props.socket.readFile(`${e}.admin`,`jsonCustom.json`),n=r.file===void 0?r:r.file;let i;try{if(typeof n!=`string`||n.length>1048576)throw Error(`Custom settings schema exceeds the size limit`);i=qr.default.parse(n);let t=vo(i);if(!t.ok){this.schemaErrors.set(e,t.reason),this.jsonConfigs[e]={disabled:!0};return}this.schemaErrors.delete(e),this.jsonConfigs[e]=this.jsonConfigs[e]||{},this.jsonConfigs[e].json=i}catch{this.schemaErrors.set(e,`Custom settings schema is invalid or exceeds safe limits; existing values are unchanged`),this.jsonConfigs[e]={disabled:!0};return}await x.loadI18n(this.props.socket,i==null?void 0:i.i18n,e);return}catch{this.schemaErrors.set(e,`Custom settings schema could not be loaded; existing values are unchanged`),this.jsonConfigs[e]={disabled:!0};return}console.error(`Adapter ${e} is not yet supported by this version of admin`),window.alert(`Adapter ${e} is not yet supported by this version of admin`)}}static flattenItems(t,n={}){return t&&Object.keys(t).forEach(r=>{t[r].items?e.flattenItems(t[r].items,n):n[r]=t[r]}),n}getDefaultValues(t,n){let r={enabled:!1},i=t.split(`.`)[0];if(this.jsonConfigs[i]&&!this.jsonConfigs[i].disabled){var a;let t=e.flattenItems((a=this.jsonConfigs[i])==null||(a=a.json)==null?void 0:a.items);t&&Object.keys(t).filter(e=>t[e]).forEach(e=>{t[e].defaultFunc===void 0?t[e].default!==void 0&&(r[e]=t[e].default):r[e]=t[e].defaultFunc})}return r}getCommonConfig(){let e=this.props.objects,t={};return this.props.customsInstances.forEach(n=>{let r=n.split(`.`)[0];if(this.jsonConfigs[r]&&this.jsonConfigs[r].disabled)return;let i=this.getFilteredObjectIDs(n);t[n]={},i.forEach(r=>{var i;let a=e[r],o=a!=null&&(i=a.common)!=null&&i.custom&&a.common.custom[n]||null;if(o)Object.keys(o).forEach(e=>{e.startsWith(`_`)||(t[n][e]===void 0?t[n][e]=o[e]:t[n][e]!==o[e]&&(Array.isArray(t[n][e])||(t[n][e]=[t[n][e]]),t[n][e].includes(o[e])||t[n][e].push(o[e])))});else{let e=this.getDefaultValues(n,a);e.enabled=!1,Object.keys(e).forEach(r=>{r.startsWith(`_`)||(t[n][r]===void 0?t[n][r]=e[r]:t[n][r]!==e[r]&&(Array.isArray(t[n][r])||(t[n][r]=[t[n][r]]),t[n][r].includes(e[r])||t[n][r].push(e[r])))})}}),Object.keys(t[n]).forEach(e=>{Array.isArray(t[n][e])&&t[n][e].sort()})}),t}isChanged(e){return e||=this.state.newValues,Object.keys(e).find(t=>e[t]===null||e[t]&&Object.keys(e[t]).find(e=>!e.startsWith(`_`)))}combineNewAndOld(e,t=!1){let n={...this.commonConfig[e]||{},...this.state.newValues[e]||{}};return t&&Object.keys(n).forEach(e=>{e.startsWith(`_`)&&delete n[e]}),this.state.newValues[e]===null&&(n.enabled=!1),n}renderOneCustom(e,t,n,r){var a,o,s,c,u,d;let f=e.split(`.`)[0],p=this.schemaErrors.get(f);if(p)return E(qe,{role:`alert`,"data-eos-custom-schema-blocked":e,style:{padding:16},children:[T(we,{children:this.props.t(`Settings %s`,e)}),T(we,{children:this.props.t(p)})]},e);if(this.getFilteredObjectIDs(e).length===0)return null;let m=`${bo}/adapter/${f}/${this.props.objects[`system.adapter.${f}`].common.icon}`,g=this.state.newValues[e]!==void 0&&(!this.state.newValues[e]||this.state.newValues[e].enabled!==void 0)?!!(this.state.newValues[e]&&this.state.newValues[e].enabled):this.state.newValues[e]!==null&&this.commonConfig[e].enabled,v=Array.isArray(g)&&(!this.state.newValues[e]||this.state.newValues[e].enabled===void 0),y=(a=this.jsonConfigs[f])==null||(a=a.json)==null?void 0:a.disabled,b=this.combineNewAndOld(e),S=(o=this.jsonConfigs[f])==null||(o=o.json)==null?void 0:o.hidden;if(y&&S===!0)return null;let C=null,te=(s=this.jsonConfigs[f])==null||(s=s.json)==null?void 0:s.help;return y&&te&&(C=typeof te==`object`?te[this.props.lang]||te.en:this.props.t(te)),E(_,{id:`Accordion_${e}`,style:r%2?yo.accordionOdd:yo.accordionEven,expanded:this.state.expanded.includes(e),ref:this.refTemplate[e],onChange:()=>{let t=[...this.state.expanded],n=t.indexOf(e);n===-1?t.push(e):t.splice(n,1),(window._localStorage||window.localStorage).setItem(`App.customsExpanded`,JSON.stringify(t)),n===-1&&(window._localStorage||window.localStorage).setItem(`App.customsLastExpanded`,e),this.setState({expanded:t})},children:[E(ee,{expandIcon:T(i,{}),"data-id":e,sx:{"& .MuiAccordionSummary-content":{alignItems:`center`}},style:r%2?g?yo.accordionHeaderEnabledOdd:yo.accordionHeaderOdd:g?yo.accordionHeaderEnabledEven:yo.accordionHeaderEven,children:[T(`img`,{src:m,style:yo.headingIcon,alt:``}),T(we,{style:yo.heading,children:this.props.t(`Settings %s`,e)}),T(`div`,{className:`titleEnabled`,style:{...yo.titleEnabled,...g?yo.enabledVisible:yo.enabledInvisible},children:this.props.t(`Enabled`)})]}),E(Me,{children:[T(`div`,{style:yo.enabledControl,children:T(h,{style:yo.formControl,control:T(l,{indeterminate:v,checked:!!g,disabled:!!y,onChange:t=>{this.cachedNewValues=this.cachedNewValues||this.state.newValues;let n=wt.deepClone(this.cachedNewValues),r=v||t.target.checked;n[e]=n[e]||{},r?n[e].enabled=!0:g&&this.commonConfig[e].enabled?n[e]=null:delete n[e],r||this.setValidationError(e,!1),this.cachedNewValues=n,this.setState({newValues:n,hasChanges:this.isChanged(n)},()=>{this.cachedNewValues=void 0,this.props.onChange&&this.props.onChange(!!this.state.hasChanges)})}}),label:this.props.t(`Enabled`)})}),E(`div`,{style:yo.customControls,children:[!y&&(g||v)&&this.state.systemConfig?T(x,{instanceObj:t,customObj:n,custom:!0,adapterName:f,instance:parseInt((e==null?void 0:e.split(`.`).pop())??`0`,10)||0,socket:this.props.socket,themeName:this.props.themeName,themeType:this.props.themeType,theme:this.props.theme,multiEdit:this.props.objectIDs.length>1,schema:(c=this.jsonConfigs[f])==null?void 0:c.json,data:b,isFloatComma:!!((u=this.props.systemConfig)!=null&&u.common.isFloatComma),dateFormat:((d=this.props.systemConfig)==null?void 0:d.common.dateFormat)||``,onError:t=>this.setValidationError(e,t),onValueChange:(t,n)=>{var r;this.cachedNewValues=this.cachedNewValues||this.state.newValues,console.log(`${t} => ${n}`);let i=wt.deepClone(this.cachedNewValues);i[e]=i[e]||{},JSON.stringify(tt.getValue((r=this.commonConfig)==null?void 0:r[e],t))===JSON.stringify(n)?(tt.setValue(i[e],t,null),Object.keys(i[e]).length||delete i[e]):tt.setValue(i[e],t,n),this.cachedNewValues=i,this.setState({newValues:i,hasChanges:this.isChanged(i)},()=>{this.cachedNewValues=void 0,this.props.onChange&&this.props.onChange(!!this.state.hasChanges)})},AceEditor:Tt}):null,C]})]})]},e)}getObject(e,t,n){return e[n]?Promise.resolve(e[n]):this.props.socket.getObject(n).then(r=>{let i=r;return t[n]=wt.deepClone(i),e[n]=i,i})}saveOneState(e,t,n,r){if(this.hasBlockedCustomChanges()){var i,a;(i=(a=this.props).onError)==null||i.call(a,!0)}else if(n||={},r||={},e!=null&&e.length){let i=this.state.maxOids||e.length;this.state.maxOids===null&&this.setState({maxOids:e.length},()=>this.props.onProgress(!0)),this.setState({progress:Math.round((i-e.length)/i*50)});let a=e.shift();this.getObject(n,r,a).then(i=>{var o;if(!i){window.alert(`Invalid object ${a}`);return}(o=i.common)!=null&&o.custom&&Object.keys(i.common.custom).forEach(e=>{this.schemaErrors.has(e.split(`.`)[0])||i.common.custom[e]&&i.common.custom[e].enabled||(i.common.custom[e]=null)});let s=Object.keys(this.state.newValues);for(let e=0;e<s.length;e++){let t=s[e];if(!this.getStatesFilterFunction(t)(a))continue;let n=this.combineNewAndOld(t,!0);if(n.enabled===!1){var c;(c=i.common)!=null&&(c=c.custom)!=null&&c[t]&&(i.common.custom[t]=null)}else if(n.enabled){if(i.common=i.common||{},Array.isArray(n.enabled)&&(!i.common.custom||!i.common.custom[t]||!i.common.custom[t].enabled)){i.common.custom&&i.common.custom[t]&&(i.common.custom[t]=null);continue}if(i.common.custom=i.common.custom||{},!i.common.custom[t]||!i.common.custom[t].enabled){let e=this.getDefaultValues(t,i);i.common.custom[t]=JSON.parse(JSON.stringify(e||{})),Object.keys(i.common.custom[t]).forEach(e=>{e.startsWith(`_`)&&delete i.common.custom[t][e]})}let e=this.props.objectIDs.length>1;i.common.custom[t].enabled=!0,Object.keys(n).forEach(r=>{if(!r.startsWith(`_`)){if(Array.isArray(n[r])&&e)return;i.common.custom[t][r]=n[r]}})}}setTimeout(()=>this.saveOneState(e,t,n,r),0)}).catch(e=>{console.error(`Cannot get object ${a}: ${e}`),window.alert(`Cannot get object ${a}: ${e}`)})}else{let i=Object.keys(n);if(!i.length)this.setState({maxOids:0},()=>this.props.onProgress(!1)),t&&t();else{this.setState({progress:Math.round((this.state.maxOids-i.length)/this.state.maxOids*50)+50});let a=i.shift();if(JSON.stringify(n[a].common)!==JSON.stringify(r[a].common)){this.changedIds.includes(a)||this.changedIds.push(a),this.props.socket.setObject(a,n[a]).then(async()=>{delete n[a],delete r[a],this.props.objects[a]=await this.props.socket.getObject(a),setTimeout(()=>this.saveOneState(e,t,n,r),0)});return}delete n[a],delete r[a],setTimeout(()=>this.saveOneState(e,t,n,r),0)}}}renderConfirmationDialog(){return this.state.showConfirmation?T(We,{text:this.props.t(`The changes will be applied to %s states. Are you sure?`,this.props.objectIDs.length.toString()),ok:this.props.t(`Yes`),onClose:e=>{e?this.setState({showConfirmation:!1,confirmed:!0},()=>{let e=this.cb;this.cb=void 0,this.onSave(e)}):(this.cb=void 0,this.setState({showConfirmation:!1}))}}):null}hasBlockedCustomChanges(){return Object.keys(this.state.newValues).some(e=>this.schemaErrors.has(e.split(`.`)[0]||``))}render(){if(this.customObj===null)return T(`div`,{style:{color:`#F55`,fontSize:32},children:this.props.t(`Object does not exist!`)});if(!this.state.loaded)return T(pe,{});let e=0;return E(qe,{style:yo.paper,children:[this.state.maxOids>1&&T(pe,{color:`secondary`,variant:`determinate`,value:this.state.progress}),T(`div`,{style:yo.scrollDiv,ref:this.scrollDivRef,children:this.state.maxOids===0&&Object.values(this.jsonConfigs).map(t=>t?Object.keys(t.instanceObjs||{}).map(n=>{var r;return this.renderOneCustom(n,(r=t.instanceObjs)==null?void 0:r[n],this.customObj,e++)}):null)}),this.renderConfirmationDialog()]})}},So={en:ft,fr:Ct,ru:_t,de:gt,es:ht,br:pt,nl:mt,it:vt,pt:bt,pl:St,uk:xt,"zh-cn":yt};c();var X={paper:{height:`100%`,maxHeight:`100%`,maxWidth:`100%`,overflow:`hidden`},tableDiv:e=>({height:`calc(100% - ${parseInt(e.mixins.toolbar.minHeight,10)+8}px)`,overflow:`hidden`,width:`100%`}),container:{height:`100%`},table:e=>({minWidth:960,width:`100%`,"& td:nth-of-type(5)":{overflow:`hidden`,whiteSpace:`nowrap`},"& tr:nth-child(even)":{backgroundColor:e.palette.mode===`dark`?`#383838`:`#b2b2b2`}}),row:{userSelect:`none`,position:`relative`,"&:hover":{opacity:.7},"& td":{position:`relative`}},updatedRow:{animation:`updated 1s`},rowInterpolated:{opacity:.5},selectHistoryControl:{width:130},selectRelativeTime:{marginLeft:10,width:200},notAliveInstance:{opacity:.5},customRange:e=>({color:e.palette.primary.main}),rowSelected:e=>({backgroundColor:e.palette.secondary.main,color:e.palette.secondary.contrastText,"& td":{color:e.palette.secondary.contrastText,backgroundColor:e.palette.secondary.main}}),rowFocused:e=>({position:`absolute`,pointerEvents:`none`,top:0,bottom:0,left:0,right:0,m:`3px`,border:`1px dotted ${e.palette.action.active}`}),grow:{flexGrow:1},msInput:{width:50,pt:`10px`,ml:`5px`,"& label":{mt:`15px`}},cellAckTrue:e=>({color:e.palette.mode===`dark`?`#66ff7f`:`#04a821`}),cellAckFalse:{color:`#FF6666`},toolbarDate:{width:108,mt:`6px`,"& fieldset":{display:`none`},"& input":{padding:`6px 0 0 0`,fontSize:`0.875rem`},"& .MuiInputAdornment-root":{ml:0,mt:`5px`},"& .MuiIconButton-root":{padding:`2px`},"& .MuiSvgIcon-root":{fontSize:`1.125rem`}},toolbarTime:{width:116,mt:`6px`,"& fieldset":{display:`none`},"& input":{padding:`6px 0 0 0`,fontSize:`0.875rem`},"& .MuiInputAdornment-root":{ml:0,mt:`5px`},"& .MuiIconButton-root":{padding:`2px`},"& .MuiSvgIcon-root":{fontSize:`1.125rem`}},toolbarTimeGrid:{position:`relative`,marginLeft:8,paddingLeft:8,paddingRight:8,paddingTop:4,paddingBottom:4,border:`1px dotted #AAAAAA`,borderRadius:8,display:`flex`},toolbarTimeLabel:{position:`absolute`,padding:8,fontSize:`0.8rem`,left:2,top:-9},noLoadingProgress:{width:`100%`,height:4},colValue:{},colAck:{},colFrom:{},colLastChange:{},colTs:{}},Co=class e extends Le{constructor(e){super(e),u(this,`adminInstance`,void 0),u(this,`supportedFeaturesPromises`,void 0),u(this,`unit`,void 0),u(this,`timeTimer`,void 0),u(this,`readSupportedFeaturesTimeout`,void 0),u(this,`rangeValues`,void 0),u(this,`rangeRef`,void 0),u(this,`subscribes`,void 0),u(this,`localStorage`,void 0),u(this,`onChange`,(e,t)=>{if(e===this.props.obj._id&&t&&this.state.values&&(!this.state.values.length||this.state.values[this.state.values.length-1].ts<t.ts)){let e=[...this.state.values,t];this.setState({values:e})}else if(e.startsWith(`system.adapter.`)&&e.endsWith(`.alive`)){let n=e.substring(15,e.length-6),r=this.state.historyInstances||[],i=r.findIndex(e=>e.id===n);if(i!==-1&&r[i].alive!==!!(t!=null&&t.val)){let e=JSON.parse(JSON.stringify(r));e[i].alive=!!(t!=null&&t.val),this.setState({historyInstances:e},()=>{e[i].alive&&this.state.historyInstance===n&&this.readHistoryRange().then(()=>this.readHistory())})}}}),this.localStorage=window._localStorage||window.localStorage;let t=this.localStorage.getItem(`App.relativeRange`)||`absolute`,n=parseInt(this.localStorage.getItem(`App.absoluteStart`)||``,10)||0,r=parseInt(this.localStorage.getItem(`App.absoluteEnd`)||``,10)||0,i=this.localStorage.getItem(`App.historySelected`)||``,a=parseInt(this.localStorage.getItem(`App.historyLastSelected`)||``,10)||null,o=this.localStorage.getItem(`App.historyLastSelectedColumn`)||null;n&&r||t&&t!==`absolute`||(t=`30`),n&&r&&(t=`absolute`);let s;try{s=JSON.parse(i)}catch{s=[]}this.state={start:n,end:r,values:null,relativeRange:t,selected:s,lastSelected:a,lastSelectedColumn:o,historyInstance:``,updateOpened:!1,insertOpened:!1,historyInstances:null,lcVisible:!0,ackVisible:!0,fromVisible:!0,supportedFeatures:[],ampm:!1,edit:{}},this.adminInstance=parseInt(window.location.search.slice(1),10)||0,this.supportedFeaturesPromises={},this.unit=this.props.obj.common&&this.props.obj.common.unit?` ${this.props.obj.common.unit}`:``,this.timeTimer=void 0,this.subscribes=[],this.prepareData().then(()=>this.readHistoryRange()).then(()=>{t===`absolute`?this.readHistory():this.setRelativeInterval(this.state.relativeRange,!0)})}readSupportedFeatures(e){return e||=this.state.historyInstance,e?(this.supportedFeaturesPromises[e]instanceof Promise||(this.supportedFeaturesPromises[e]=new Promise(t=>{this.readSupportedFeaturesTimeout&&clearTimeout(this.readSupportedFeaturesTimeout),this.readSupportedFeaturesTimeout=setTimeout(()=>{this.readSupportedFeaturesTimeout=void 0,t([])},2e3),this.props.socket.sendTo(e,`features`,null).then(e=>{this.readSupportedFeaturesTimeout?(clearTimeout(this.readSupportedFeaturesTimeout),this.readSupportedFeaturesTimeout=void 0,t(e&&e.supportedFeatures||[])):this.setState({supportedFeatures:e&&e.supportedFeatures||[]})})})),this.supportedFeaturesPromises[e]):Promise.resolve([])}async componentDidMount(){await this.props.socket.subscribeState(this.props.obj._id,this.onChange)}componentWillUnmount(){this.timeTimer&&=(clearTimeout(this.timeTimer),void 0);for(let e=0;e<this.subscribes.length;e++)this.props.socket.unsubscribeState(this.subscribes[e],this.onChange);this.subscribes=[],this.props.socket.unsubscribeState(this.props.obj._id,this.onChange)}async prepareData(){var e;let t=await this.getHistoryInstances(),n=await this.props.socket.getCompactSystemConfig(),r=n==null||(e=n.common)==null?void 0:e.defaultHistory,i=this.localStorage.getItem(`App.historyInstance`)||``;if(i&&t.find(e=>e.id===i&&e.alive)||(i=r),!i||!t.find(e=>e.id===i&&e.alive)){let e=t.find(e=>e.alive);e&&(i=e.id)}!i&&t.length&&(i=r);let a=await this.readSupportedFeatures(i);await new Promise(e=>{this.setState({ampm:(n.common.dateFormat||``).includes(`/`),historyInstances:t,historyInstance:i,supportedFeatures:a},()=>e())})}getHistoryInstances(){let e=[],t=[];return this.props.customsInstances.forEach(n=>{let r=this.props.objects[`system.adapter.${n}`];if(r&&r.common&&r.common.getHistory){let r={id:n,alive:!1};e.push(r),t.push(`system.adapter.${n}.alive`)}}),t.length?this.props.socket.getForeignStates(t).then(async n=>{Object.keys(n).forEach(t=>{let r=e.find(e=>t.endsWith(`${e.id}.alive`));if(r){var i;r.alive=!!((i=n[t])!=null&&i.val)}}),this.subscribes=t;for(let e=0;e<t.length;e++)await this.props.socket.subscribeState(t[e],this.onChange);return e}):Promise.resolve(e)}readHistory(e,t){var n;return e||=this.state.start,t||=this.state.end,!this.state.historyInstance||!((n=this.state.historyInstances)!=null&&n.find(e=>e.id===this.state.historyInstance&&e.alive))?Promise.resolve(null):(this.setState({loading:!0}),this.props.socket.getHistory(this.props.obj._id,{instance:this.state.historyInstance,start:e,end:t,from:!0,ack:!0,q:!0,addId:!1,aggregate:`none`,returnNewestEntries:!0}).then(e=>{let t=[],n=this.rangeValues,r=!1,i=!1,a=!1;if(n&&n.length&&(!e||!e.length||n[0].ts<e[0].ts)&&(t.push(n[0]),t.push({ts:n[0].ts+1,e:!0}),console.log(`add ${new Date(n[0].ts).toISOString()}: ${n[0].val}`),!i&&n[0].ack!==void 0&&(i=!0),!a&&n[0].from&&(a=!0)),e!=null&&e.length)for(let n=0;n<e.length;n++)e[n]&&(!t.length||t[t.length-1].ts<e[n].ts)?(t.push(e[n]),e[n].from&&(e[n].from.startsWith(`system.adapter.`)?e[n].from=e[n].from.substring(15):e[n].from.startsWith(`system.host.`)&&(e[n].from=e[n].from.substring(7))),!r&&e[n].lc&&(r=!0),!i&&e[n].ack!==void 0&&(i=!0),!a&&e[n].from&&(a=!0),console.log(`add value ${new Date(e[n].ts).toISOString()}: ${e[n].val}`)):t[t.length-1].ts===e[n].ts&&t[t.length-1].val!==e[n].ts&&console.error(`Strange data!`);else t.push({noDataForPeriod:!0});t.length||t.push({noData:!0}),this.setState({loading:!1,values:t,lcVisible:r,fromVisible:a,ackVisible:i})}))}readHistoryRange(){var e;let t=new Date,n=new Date(2e3,0,1);return!this.state.historyInstance||!((e=this.state.historyInstances)!=null&&e.find(e=>e.id===this.state.historyInstance&&e.alive))?Promise.resolve():(this.setState({loading:!0}),this.props.socket.getHistory(this.props.obj._id,{instance:this.state.historyInstance,start:n.getTime(),end:t.getTime(),limit:1,from:!1,ack:!1,q:!1,addId:!1,aggregate:`none`}).then(e=>{e.length?((e[0].val===null||e[0].ts===n.getTime())&&e.shift(),e.forEach(e=>e.i=!0),this.rangeValues=e,this.setState({loading:!1})):(this.rangeValues=[],this.setState({loading:!1}))}))}onToggleSelect(e,t,n){let r=this.state.values||[],i=[...this.state.selected],a=i.indexOf(t);if(e.shiftKey&&this.state.lastSelected){let e=-1,n=-1;i=[];for(let a=0;a<r.length&&!(r[a].ts===t&&(e=a,n!==e&&i.push(r[a].ts),e!==-1&&n!==-1)||r[a].ts===this.state.lastSelected&&(n=a,n!==e&&i.push(r[a].ts),e!==-1&&n!==-1));a++)(e!==-1||n!==-1)&&i.push(r[a].ts)}else e.ctrlKey?(a===-1?i.push(t):i.splice(a,1),i.sort()):i=[t];this.localStorage.setItem(`App.historyLastSelected`,t.toString()),this.localStorage.setItem(`App.historyLastSelectedColumn`,n),this.localStorage.setItem(`App.historySelected`,JSON.stringify(i)),this.setState({selected:i,lastSelected:t,lastSelectedColumn:n})}getTableRows(){let t=[],n=this.state.values||[];for(let r=n.length-1;r>=0;r--){let i=n[r],a=i.ts;if(i.e)t.push(E(Re,{sx:{...X.row,...X.updatedRow,...X.rowInterpolated},hover:!0,children:[T(M,{}),T(M,{children:`...`}),this.state.ackVisible?T(M,{}):null,this.state.fromVisible?T(M,{}):null,this.state.lcVisible?T(M,{}):null]},a));else if(i.noData||i.noDataForPeriod)t.push(E(Re,{sx:{...X.row,...X.updatedRow,...X.rowNoData},hover:!0,children:[T(M,{}),T(M,{children:i.noData?this.props.t(`No data in history`):this.props.t(`No data in history for selected period`)}),this.state.ackVisible?T(M,{}):null,this.state.fromVisible?T(M,{}):null,this.state.lcVisible?T(M,{}):null]},i.noData?`nodata`:``));else{let n=i.i,r=this.state.lastSelected===a,o=i.val;this.props.isFloatComma&&this.props.obj.common.type===`number`&&o&&(o=o.toString().replace(`.`,`,`)),o===null&&(o=`null`),o===void 0&&(o=`_`);let s=this.state.selected.includes(a);t.push(E(Re,{sx:{...X.row,...X.updatedRow,...n?X.rowInterpolated:void 0,...s?X.rowSelected:void 0},children:[E(M,{onClick:e=>!n&&this.onToggleSelect(e,a,`ts`),children:[`${e.formatTimestamp(i.ts)}`,r&&this.state.lastSelectedColumn===`ts`?T(D,{component:`div`,sx:X.rowFocused}):``]}),E(M,{onClick:e=>!n&&this.onToggleSelect(e,a,`val`),children:[o+this.unit,r&&this.state.lastSelectedColumn===`val`?T(D,{component:`div`,sx:X.rowFocused}):``]}),this.state.ackVisible?E(M,{onClick:e=>!n&&this.onToggleSelect(e,a,`ack`),sx:i.ack?X.cellAckTrue:X.cellAckFalse,children:[i.ack?`true`:`false`,r&&this.state.lastSelectedColumn===`ack`?T(D,{component:`div`,sx:X.rowFocused}):``]}):null,this.state.fromVisible?E(M,{onClick:e=>!n&&this.onToggleSelect(e,a,`from`),children:[i.from||``,r&&this.state.lastSelectedColumn===`from`?T(D,{component:`div`,sx:X.rowFocused}):``]}):null,this.state.lcVisible?E(M,{onClick:e=>!n&&this.onToggleSelect(e,a,`lc`),children:[i.lc?`${new Date(i.lc).toLocaleDateString()} ${new Date(i.lc).toLocaleTimeString()}.${(i.ts%1e3).toString().padStart(3,`0`)}`:``,r&&this.state.lastSelectedColumn===`lc`?T(D,{component:`div`,sx:X.rowFocused}):``]}):null]},a.toString()+(i.val||``).toString()))}}return t}shiftTime(){let e=new Date,t=6e4-e.getSeconds()-(1e3-e.getMilliseconds());e.getMilliseconds()&&e.setMilliseconds(1e3),e.getSeconds()&&e.setSeconds(60);let n=e.getTime(),r,i=this.state.relativeRange;if(i===`day`)e.setHours(0),e.setMinutes(0),e.setSeconds(0),r=e.getTime();else if(i===`week`){e.setHours(0),e.setMinutes(0),e.setSeconds(0),e.setMilliseconds(0);let t=e.getDay()||7;t!==1&&e.setHours(-24*(t-1)),r=e.getTime()}else if(i===`2weeks`){e.setHours(0),e.setMinutes(0),e.setSeconds(0),e.setDate(e.getDate()-7);let t=e.getDay()||7;t!==1&&e.setHours(-24*(t-1)),r=e.getTime()}else i===`month`?(e.setHours(0),e.setMinutes(0),e.setSeconds(0),e.setDate(1),r=e.getTime()):i===`year`?(e.setHours(0),e.setMinutes(0),e.setSeconds(0),e.setDate(1),e.setMonth(0),r=e.getTime()):i===`12months`?(e.setHours(0),e.setMinutes(0),e.setSeconds(0),e.setFullYear(e.getFullYear()-1),r=e.getTime()):r=n-parseInt(i,10)*6e4;this.setState({start:r,end:n},()=>this.readHistory()),this.timeTimer=setTimeout(()=>{this.timeTimer=void 0,this.shiftTime()},t||6e4)}setRelativeInterval(e,t){if(t||(this.localStorage.setItem(`App.relativeRange`,e.toString()),this.setState({relativeRange:e})),e===`absolute`){this.timeTimer&&=(clearTimeout(this.timeTimer),void 0);return}this.localStorage.removeItem(`App.absoluteStart`),this.localStorage.removeItem(`App.absolute`);let n=new Date;if(!this.timeTimer){let e=6e4-n.getSeconds()-(1e3-n.getMilliseconds());this.timeTimer=setTimeout(()=>{this.timeTimer=void 0,this.shiftTime()},e||6e4)}n.getMilliseconds()&&n.setMilliseconds(1e3),n.getSeconds()&&n.setSeconds(60);let r=n.getTime(),i;if(e===`day`)n.setHours(0),n.setMinutes(0),n.setSeconds(0),i=n.getTime();else if(e===`week`){n.setHours(0),n.setMinutes(0),n.setSeconds(0);let e=n.getDay()||7;e!==1&&n.setHours(-24*(e-1)),i=n.getTime()}else if(e===`2weeks`){n.setHours(0),n.setMinutes(0),n.setSeconds(0),n.setDate(n.getDate()-7);let e=n.getDay()||7;e!==1&&n.setHours(-24*(e-1)),i=n.getTime()}else e===`month`?(n.setHours(0),n.setMinutes(0),n.setSeconds(0),n.setDate(1),i=n.getTime()):e===`year`?(n.setHours(0),n.setMinutes(0),n.setSeconds(0),n.setDate(1),n.setMonth(0),i=n.getTime()):e===`12months`?(n.setHours(0),n.setMinutes(0),n.setSeconds(0),n.setFullYear(n.getFullYear()-1),i=n.getTime()):(e=Number(e),i=r-e*6e4);this.setState({start:i,end:r},()=>this.readHistory())}renderTable(){var e;if(!this.state.historyInstance)return T(`div`,{style:{marginTop:20,fontSize:24},children:this.props.t(`History instance not selected`)});if(!((e=this.state.historyInstances)!=null&&e.find(e=>e.id===this.state.historyInstance&&e.alive)))return T(`div`,{style:{marginTop:20,fontSize:24},children:this.props.t(`History instance not alive`)});if(this.state.values){let e=[200,`auto`],t=[190,100];return this.state.ackVisible&&(e.push(50),t.push(50)),this.state.fromVisible&&(e.push(150),t.push(150)),this.state.lcVisible&&(e.push(200),t.push(190)),T(Ve,{style:X.container,children:E(ce,{stickyHeader:!0,sx:X.table,initialWidths:e,minWidths:t,dblTitle:this.props.t(`ra_Double click to reset table layout`),children:[T(De,{children:E(Re,{children:[T(M,{style:X.colTs,children:this.props.t(`Timestamp`)}),T(M,{style:X.colValue,children:this.props.t(`Value`)}),this.state.ackVisible?T(M,{style:X.colAck,children:this.props.t(`Ack`)}):null,this.state.fromVisible?T(M,{style:X.colFrom,children:this.props.t(`From`)}):null,this.state.lcVisible?T(M,{style:X.colLastChange,children:this.props.t(`lc`)}):null]})}),T(Ke,{children:this.getTableRows()})]})})}return T(pe,{})}renderDialogConfirm(){return E(k,{open:!!this.state.areYouSure,onClose:()=>this.setState({areYouSure:!1}),"aria-labelledby":`alert-dialog-title`,"aria-describedby":`alert-dialog-description`,children:[T(d,{id:`alert-dialog-title`}),E(C,{children:[T(te,{id:`alert-dialog-description`,children:this.props.t(`Are you sure?`)}),T(h,{control:T(l,{value:this.state.suppressMessage,onChange:()=>this.setState({suppressMessage:!0})}),label:this.props.t(`Suppress for 5 minutes`)})]}),E(S,{children:[T(O,{variant:`contained`,onClick:()=>this.setState({areYouSure:!1,suppressMessage:this.state.suppressMessage&&Date.now()},()=>this.onDelete()),color:`primary`,autoFocus:!0,startIcon:T(oe,{}),children:this.props.t(`Delete`)}),T(O,{variant:`contained`,onClick:()=>this.setState({areYouSure:!1}),color:`secondary`,startIcon:T(N,{}),children:this.props.t(`Cancel`)})]})]})}onDelete(){let e=this.state.selected.map(e=>({state:{ts:e},id:this.props.obj._id}));this.props.socket.sendTo(this.state.historyInstance,`delete`,e).then(()=>this.readHistory())}onUpdate(){var e;let t=(e=this.state.edit)==null?void 0:e.val;this.props.obj.common&&(this.props.obj.common.type===`number`?typeof t!=`number`&&(t=parseFloat((t??``).toString().replace(`,`,`.`))):this.props.obj.common.type===`boolean`&&(t=t===`true`||t===`TRUE`||t===!0||t===`1`||t===1));let n={val:t,ack:this.state.edit.ack,ts:this.state.selected[0],from:`system.adapter.eos-admin.${this.adminInstance}`,q:this.state.edit.q};for(let[e,t]of Object.entries(n))t===void 0&&delete n[e];!this.state.lcVisible&&n.lc&&delete n.lc,this.props.socket.sendTo(this.state.historyInstance,`update`,[{id:this.props.obj._id,state:n}]).then(()=>this.readHistory())}onInsert(){var e;let t=(e=this.state.edit)==null?void 0:e.val;this.props.obj.common&&(this.props.obj.common.type===`number`?t=parseFloat((t??``).toString().replace(`,`,`.`)):this.props.obj.common.type===`boolean`&&(t=t===`true`||t===`TRUE`||t===!0||t===`1`||t===1));let n=this.state.edit,r=n==null?void 0:n.date,i=n==null?void 0:n.time;if(!r||!n||!i)return;r.setHours(i.getHours()),r.setMinutes(i.getMinutes()),r.setSeconds(i.getSeconds()),r.setMilliseconds(parseInt(n.ms,10));let a={ts:r.getTime(),val:t,ack:this.state.edit.ack,from:`system.adapter.eos-admin.${this.adminInstance}`,q:this.state.edit.q||0};!this.state.lcVisible&&a.lc&&delete a.lc;for(let[e,t]of Object.entries(a))t===void 0&&delete a[e];this.props.socket.sendTo(this.state.historyInstance,`insert`,[{id:this.props.obj._id,state:a}]).then(()=>this.readHistory())}updateEdit(e,t){let n=JSON.parse(JSON.stringify(this.state.edit));n.time=new Date(n.time),n.date=new Date(n.date),n[e]=t,this.setState({edit:n})}renderEditDialog(){var e,t;return E(k,{open:this.state.updateOpened||this.state.insertOpened,onClose:()=>this.setState({updateOpened:!1,insertOpened:!1}),"aria-labelledby":`edit-dialog-title`,"aria-describedby":`edit-dialog-description`,children:[T(d,{id:`edit-dialog-title`,children:this.state.updateOpened?this.props.t(`Update entry`):this.props.t(`Insert entry`)}),T(C,{children:E(`form`,{noValidate:!0,autoComplete:`off`,onSubmit:e=>e.preventDefault(),children:[typeof this.state.edit.val==`boolean`?T(h,{control:T(l,{checked:this.state.edit.val,onChange:e=>this.updateEdit(`val`,e.target.checked)}),label:this.props.t(`Value`)}):T(I,{variant:`standard`,label:this.props.t(`Value`),value:this.state.edit.val,onChange:e=>this.updateEdit(`val`,e.target.value)}),T(`br`,{}),T(h,{control:T(l,{checked:this.state.edit.ack,onChange:e=>this.updateEdit(`ack`,e.target.checked)}),label:this.props.t(`Acknowledged`)}),this.state.insertOpened?T(ge,{dateAdapter:Ot,adapterLocale:So[this.props.lang],children:E(`div`,{style:X.toolbarTimeGrid,children:[T(`div`,{style:X.toolbarTimeLabel,children:this.props.t(`Time`)}),T(Ze,{sx:X.toolbarDate,value:(e=this.state.edit)==null?void 0:e.date,onChange:e=>e&&this.updateEdit(`date`,e)}),T(ie,{sx:X.toolbarTime,ampm:this.state.ampm,views:[`hours`,`minutes`,`seconds`],value:(t=this.state.edit)==null?void 0:t.time,onChange:e=>e&&this.updateEdit(`time`,e)}),T(I,{variant:`standard`,sx:X.msInput,helperText:this.props.t(`ms`),type:`number`,slotProps:{htmlInput:{max:999,min:0}},value:this.state.edit.ms,onChange:e=>this.updateEdit(`ms`,e.target.value)})]})}):null]})}),E(S,{children:[T(O,{variant:`contained`,disabled:this.state.edit.val===``,onClick:()=>{let e=this.state.updateOpened;this.setState({updateOpened:!1,insertOpened:!1},()=>e?this.onUpdate():this.onInsert())},color:`primary`,autoFocus:!0,children:this.state.updateOpened?this.props.t(`Update`):this.props.t(`Add`)}),T(O,{variant:`contained`,onClick:()=>this.setState({updateOpened:!1,insertOpened:!1}),color:`grey`,children:this.props.t(`Cancel`)})]})]})}setStartDate(e){let t=e.getTime();this.timeTimer&&=(clearTimeout(this.timeTimer),void 0),this.localStorage.setItem(`App.relativeRange`,`absolute`),this.localStorage.setItem(`App.absoluteStart`,t.toString()),this.localStorage.setItem(`App.absoluteEnd`,this.state.end.toString()),this.setState({start:t,relativeRange:`absolute`},()=>this.readHistory())}setEndDate(e){let t=e.getTime();this.localStorage.setItem(`App.relativeRange`,`absolute`),this.localStorage.setItem(`App.absoluteStart`,this.state.start.toString()),this.localStorage.setItem(`App.absoluteEnd`,t.toString()),this.timeTimer&&=(clearTimeout(this.timeTimer),void 0),this.setState({end:t,relativeRange:`absolute`},()=>this.readHistory())}renderToolbar(){var e,t;return E(Be,{children:[E(se,{variant:`standard`,style:X.selectHistoryControl,children:[T(de,{children:this.props.t(`History instance`)}),T(Ie,{variant:`standard`,value:this.state.historyInstance||``,onChange:e=>{let t=e.target.value;this.localStorage.setItem(`App.historyInstance`,t),this.readSupportedFeatures(t).then(e=>this.setState({historyInstance:t,supportedFeatures:e},()=>this.readHistory()))},children:(e=this.state.historyInstances)==null?void 0:e.map(e=>T(F,{value:e.id,style:e.alive?void 0:X.notAliveInstance,children:e.id},e.id))})]}),E(se,{variant:`standard`,style:X.selectRelativeTime,children:[T(de,{children:this.props.t(`Relative`)}),E(Ie,{variant:`standard`,ref:this.rangeRef,value:this.state.relativeRange,onChange:e=>this.setRelativeInterval(e.target.value),children:[T(F,{value:`absolute`,sx:X.customRange,children:this.props.t(`custom range`)},`custom`),T(F,{value:10,children:this.props.t(`last 10 minutes`)},`1`),T(F,{value:30,children:this.props.t(`last 30 minutes`)},`2`),T(F,{value:60,children:this.props.t(`last hour`)},`3`),T(F,{value:`day`,children:this.props.t(`this day`)},`4`),T(F,{value:1440,children:this.props.t(`last 24 hours`)},`5`),T(F,{value:`week`,children:this.props.t(`this week`)},`6`),T(F,{value:10080,children:this.props.t(`last week`)},`7`),T(F,{value:`2weeks`,children:this.props.t(`this 2 weeks`)},`8`),T(F,{value:20160,children:this.props.t(`last 2 weeks`)},`9`),T(F,{value:`month`,children:this.props.t(`this month`)},`10`),T(F,{value:43200,children:this.props.t(`last 30 days`)},`11`),T(F,{value:`year`,children:this.props.t(`this year`)},`12`),T(F,{value:`12months`,children:this.props.t(`last 12 months`)},`13`)]})]}),E(ge,{dateAdapter:Ot,adapterLocale:So[this.props.lang],children:[E(`div`,{style:X.toolbarTimeGrid,children:[T(`div`,{style:{...X.toolbarTimeLabel,opacity:this.state.relativeRange===`absolute`?void 0:.5},children:this.props.t(`Start time`)}),T(Ze,{sx:X.toolbarDate,disabled:this.state.relativeRange!==`absolute`,value:new Date(this.state.start),onChange:e=>e&&this.setStartDate(e)}),T(ie,{disabled:this.state.relativeRange!==`absolute`,sx:X.toolbarTime,ampm:this.state.ampm,value:new Date(this.state.start),onChange:e=>e&&this.setStartDate(e)})]}),E(`div`,{style:X.toolbarTimeGrid,children:[T(`div`,{style:{...X.toolbarTimeLabel,opacity:this.state.relativeRange===`absolute`?void 0:.5},children:this.props.t(`End time`)}),T(Ze,{disabled:this.state.relativeRange!==`absolute`,sx:X.toolbarDate,value:new Date(this.state.end),onChange:e=>e&&this.setEndDate(e)}),T(ie,{disabled:this.state.relativeRange!==`absolute`,sx:X.toolbarTime,ampm:this.state.ampm,value:new Date(this.state.end),onChange:e=>e&&this.setEndDate(e)})]})]}),T(D,{component:`div`,sx:X.grow}),(t=this.state.values)!=null&&t.length?T(P,{size:`large`,onClick:()=>this.exportData(),title:this.props.t(`Save data as csv`),children:T(a,{})}):null,this.state.supportedFeatures.includes(`insert`)&&this.props.expertMode?T(P,{size:`large`,onClick:()=>{var e,t;let n=new Date,r={ack:(e=this.state.values)==null?void 0:e[this.state.values.length-1].ack,val:((t=this.state.values)==null?void 0:t[this.state.values.length-1].val)??void 0,date:new Date(n),ms:0,time:new Date(n),q:0};this.setState({edit:r,insertOpened:!0})},children:T(ue,{})}):null,this.state.supportedFeatures.includes(`update`)&&this.props.expertMode?T(P,{size:`large`,disabled:this.state.selected.length!==1,onClick:()=>{var e;let t=JSON.parse(JSON.stringify((e=this.state.values)==null?void 0:e.find(e=>e.ts===this.state.lastSelected))),n=new Date(t.ts);t.date=new Date(n),t.time=new Date(n),this.setState({edit:t,updateOpened:!0})},children:T(Xe,{})}):null,this.state.supportedFeatures.includes(`delete`)&&this.props.expertMode?T(P,{size:`large`,disabled:!this.state.selected.length,onClick:()=>{typeof this.state.suppressMessage==`number`&&Date.now()-this.state.suppressMessage<3e5?this.onDelete():this.setState({areYouSure:!0})},children:T(oe,{})}):null]})}exportData(){var t;let n=window.document.getElementById(`export-file`);n||(n=document.createElement(`a`),n.setAttribute(`id`,`export-file`),n.style.display=`none`,document.body.appendChild(n));let r=[`timestamp;value;acknowledged;from;`];(t=this.state.values)==null||t.forEach(t=>!t.i&&!t.e&&r.push([e.formatTimestamp(t.ts),t.val===null||t.val===void 0?`null`:t.val.toString(),t.ack?`true`:`false`,t.from||``].join(`;`))),n.setAttribute(`href`,`data:text/plain;charset=utf-8,${encodeURIComponent(r.join(`
10
+ `))}`),n.setAttribute(`download`,`${m.getObjectName({[this.props.obj._id]:this.props.obj},this.props.obj._id,this.props.lang)}.csv`),n.click(),document.body.removeChild(n)}render(){return this.state.historyInstances?E(qe,{style:X.paper,children:[this.state.loading?T(pe,{}):T(`div`,{style:X.noLoadingProgress}),this.renderToolbar(),T(D,{component:`div`,sx:X.tableDiv,children:this.renderTable()}),this.renderDialogConfirm(),this.renderEditDialog()]}):T(pe,{})}static formatTimestamp(e){return`${new Date(e).toLocaleDateString()} ${new Date(e).toLocaleTimeString()}.${(e%1e3).toString().padStart(3,`0`)}`}},wo=gr();function To(e,t,n){wo(e)[t]=n}function Eo(e,t,n){var r=wo(e);r[t]===n&&(r[t]=null)}Ln({type:`takeGlobalCursor`,event:`globalCursorTaken`,update:`update`},Cr);var Do={axisPointer:1,tooltip:1,brush:1};function Oo(e,t,n){var r=t.getComponentByElement(e.topTarget);if(!r||r===n||Do.hasOwnProperty(r.mainType))return!1;var i=r.coordinateSystem;if(!i||i.model===n)return!1;var a=un(r),o=un(n);return!((a.zlevel-o.zlevel||a.z-o.z)<=0)}function ko(e){return e}var Ao=`view`;(function(e){z(t,e);function t(t,n,r){var i=e.call(this)||this;i.type=Ao,i.dimensions=[`x`,`y`];var a=ko(i);a.invertY=t,a.lgCt=n,a.lgGeo=r;var o=a.trans=[];return o[0]=cr(),o[1]=cr(),o[2]=cr(),a.mtRaw=kn(),a.mtRawInv=kn(),a.mtOverall=kn(),a.mtOverallInv=kn(),a.zoom=1,i}return t.prototype.getBoundingRect=function(){return No(null,this)},t.prototype.getViewRect=function(){return Po(null,this)},t.prototype.getRoamTransform=function(){return hn(ko(this).trans[1])},t.prototype.dataToPoint=function(e,t,n){var r=t?ko(this).mtRaw:ko(this).mtOverall;return n||=[],r?dn(n,e,r):Er(n,e)},t.prototype.pointToData=function(e,t,n){n||=[];var r=ko(this).mtOverallInv;return r?dn(n,e,r):Er(n,e)},t.prototype.convertToPixel=function(e,t,n){var r=Fo(t);return r===this?r.dataToPoint(n):null},t.prototype.convertFromPixel=function(e,t,n){var r=Fo(t);return r===this?r.pointToData(n):null},t.prototype.containPoint=function(e){var t=ko(this);return Sn(jo,t.dataRect),sn(jo,jo,t.mtOverall),pn(jo,e[0],e[1])},t.dimensions=[`x`,`y`],t})(Gt);var jo=Kr();function Mo(e,t){return qt(e||[],ko(t).mtOverall)}function No(e,t){return Sn(e||Kr(),ko(t).dataRect)}function Po(e,t){return Sn(e||Kr(),ko(t).viewRect)}kn(),kn(),Kr(),kn(),kn();function Fo(e){var t=e.seriesModel;return t?t.coordinateSystem:null}cr(),cr();function Io(e,t,n,r,i,a){e||=0;var o=Rn(n[1],-n[0]);if(i!=null&&(i=Ro(i,[0,o])),a!=null&&(a=Math.max(a,i??0)),r===`all`){var s=Math.abs(Rn(t[1],-t[0]));s=Ro(s,[0,o]),i=a=Ro(s,[i,a]),r=0}t[0]=Ro(t[0],n),t[1]=Ro(t[1],n);var c=Lo(t,r);t[r]+=e;var l=i||0,u=n.slice();c.sign<0?u[0]=Rn(u[0],l):u[1]=Rn(u[1],-l),t[r]=Ro(t[r],u);var d=Lo(t,r);return i!=null&&(d.sign!==c.sign||d.span<i)&&(t[1-r]=Rn(t[r],c.sign*i)),d=Lo(t,r),a!=null&&d.span>a&&(t[1-r]=Rn(t[r],d.sign*a)),t}function Lo(e,t){var n=e[t]-e[1-t];return{span:Math.abs(n),sign:n>0?-1:n<0?1:t?-1:1}}function Ro(e,t){return Math.min(t[1]==null?1/0:t[1],Math.max(t[0]==null?-1/0:t[0],e))}var zo=!0,Bo=Math.min,Vo=Math.max,Ho=Math.pow,Uo=1e4,Wo=6,Go=6,Ko=`globalPan`,qo={w:[0,0],e:[0,1],n:[1,0],s:[1,1]},Jo={w:`ew`,e:`ew`,n:`ns`,s:`ns`,ne:`nesw`,sw:`nesw`,nw:`nwse`,se:`nwse`},Yo={brushStyle:{lineWidth:2,stroke:R.color.backgroundTint,fill:R.color.borderTint},transformable:!0,brushMode:`single`,removeOnClick:!1},Xo=0,Zo=function(e){z(t,e);function t(t){var n=e.call(this)||this;return n._track=[],n._covers=[],n._handlers={},n._zr=t,n.group=new Xt,n._uid=`brushController_`+Xo++,L(ks,function(e,t){this._handlers[t]=ln(e,this)},n),n}return t.prototype.enableBrush=function(e){return this._brushType&&this._doDisableBrush(),e.brushType&&this._doEnableBrush(e),this},t.prototype._doEnableBrush=function(e){var t=this._zr;this._enableGlobalPan||To(t,Ko,this._uid),L(this._handlers,function(e,n){t.on(n,e)}),this._brushType=e.brushType,this._brushOption=qn(Pn(Yo),e,!0)},t.prototype._doDisableBrush=function(){var e=this._zr;Eo(e,Ko,this._uid),L(this._handlers,function(t,n){e.off(n,t)}),this._brushType=this._brushOption=null},t.prototype.setPanels=function(e){if(e&&e.length){var t=this._panels={};L(e,function(e){t[e.panelId]=Pn(e)})}else this._panels=null;return this},t.prototype.mount=function(e){e||={},this._enableGlobalPan=e.enableGlobalPan;var t=this.group;return this._zr.add(t),t.attr({x:e.x||0,y:e.y||0,rotation:e.rotation||0,scaleX:e.scaleX||1,scaleY:e.scaleY||1}),this._transform=t.getLocalTransform(),this},t.prototype.updateCovers=function(e){e=Ir(e,function(e){return qn(Pn(Yo),e,!0)});var t=`\0-brush-index-`,n=this._covers,r=this._covers=[],i=this,a=this._creatingCover;return new $n(n,e,s,o).add(c).update(c).remove(l).execute(),this;function o(e,n){return(e.id==null?t+n:e.id)+`-`+e.brushType}function s(e,t){return o(e.__brushOption,t)}function c(t,o){var s=e[t];o!=null&&n[o]===a?r[t]=n[o]:ns(i,r[t]=o==null?$o(i,Qo(i,s)):(n[o].__brushOption=s,n[o]))}function l(e){n[e]!==a&&i.group.remove(n[e])}},t.prototype.unmount=function(){return this.enableBrush(!1),os(this),this._zr.remove(this.group),this},t.prototype.dispose=function(){this.unmount(),this.off()},t}(nn);function Qo(e,t){var n=Ms[t.brushType].createCover(e,t);return n.__brushOption=t,ts(n,t),e.group.add(n),n}function $o(e,t){var n=rs(t);return n.endCreating&&(n.endCreating(e,t),ts(t,t.__brushOption)),t}function es(e,t){var n=t.__brushOption;rs(t).updateCoverShape(e,t,n.range,n)}function ts(e,t){var n=t.z;n??=Uo,e.traverse(function(e){e.z=n,e.z2=n})}function ns(e,t){rs(t).updateCommon(e,t),es(e,t)}function rs(e){return Ms[e.__brushOption.brushType]}function is(e,t,n){var r=e._panels;if(!r)return zo;var i,a=e._transform;return L(r,function(e){e.isTargetByCursor(t,n,a)&&(i=e)}),i}function as(e,t){var n=e._panels;if(!n)return zo;var r=t.__brushOption.panelId;return r==null?zo:n[r]}function os(e){var t=e._covers,n=t.length;return L(t,function(t){e.group.remove(t)},e),t.length=0,!!n}function ss(e,t){var n=Ir(e._covers,function(e){var t=e.__brushOption,n=Pn(t.range);return{brushType:t.brushType,panelId:t.panelId,range:n}});e.trigger(`brush`,{areas:n,isEnd:!!t.isEnd,removeOnClick:!!t.removeOnClick})}function cs(e){var t=e._track;if(!t.length)return!1;var n=t[t.length-1],r=t[0],i=n[0]-r[0],a=n[1]-r[1];return Ho(i*i+a*a,.5)>Wo}function ls(e){var t=e.length-1;return t<0&&(t=0),[e[0],e[t]]}function us(e,t,n,r){var i=new Xt;return i.add(new sr({name:`main`,style:ms(n),silent:!0,draggable:!0,cursor:`move`,drift:In(ys,e,t,i,[`n`,`s`,`w`,`e`]),ondragend:In(ss,t,{isEnd:!0})})),L(r,function(n){i.add(new sr({name:n.join(``),style:{opacity:0},draggable:!0,silent:!0,invisible:!0,drift:In(ys,e,t,i,n),ondragend:In(ss,t,{isEnd:!0})}))}),i}function ds(e,t,n,r){var i=r.brushStyle.lineWidth||0,a=Vo(i,Go),o=n[0][0],s=n[1][0],c=o-i/2,l=s-i/2,u=n[0][1],d=n[1][1],f=u-a+i/2,p=d-a+i/2,m=u-o,h=d-s,g=m+i,_=h+i;ps(e,t,`main`,o,s,m,h),r.transformable&&(ps(e,t,`w`,c,l,a,_),ps(e,t,`e`,f,l,a,_),ps(e,t,`n`,c,l,g,a),ps(e,t,`s`,c,p,g,a),ps(e,t,`nw`,c,l,a,a),ps(e,t,`ne`,f,l,a,a),ps(e,t,`sw`,c,p,a,a),ps(e,t,`se`,f,p,a,a))}function fs(e,t){var n=t.__brushOption,r=n.transformable,i=t.childAt(0);i.useStyle(ms(n)),i.attr({silent:!r,cursor:r?`move`:`default`}),L([[`w`],[`e`],[`n`],[`s`],[`s`,`e`],[`s`,`w`],[`n`,`e`],[`n`,`w`]],function(n){var i=t.childOfName(n.join(``)),a=n.length===1?_s(e,n[0]):vs(e,n);i&&i.attr({silent:!r,invisible:!r,cursor:r?Jo[a]+`-resize`:null})})}function ps(e,t,n,r,i,a,o){var s=t.childOfName(n);s&&s.setShape(Cs(Ss(e,t,[[r,i],[r+a,i+o]])))}function ms(e){return bn({strokeNoScale:!0},e.brushStyle)}function hs(e,t,n,r){var i=[Bo(e,n),Bo(t,r)],a=[Vo(e,n),Vo(t,r)];return[[i[0],a[0]],[i[1],a[1]]]}function gs(e){return tn(e.group)}function _s(e,t){return{left:`w`,right:`e`,top:`n`,bottom:`s`}[cn({w:`left`,e:`right`,n:`top`,s:`bottom`}[t],gs(e))]}function vs(e,t){var n=[_s(e,t[0]),_s(e,t[1])];return(n[0]===`e`||n[0]===`w`)&&n.reverse(),n.join(``)}function ys(e,t,n,r,i,a){var o=n.__brushOption,s=e.toRectRange(o.range),c=xs(t,i,a);L(r,function(e){var t=qo[e];s[t[0]][t[1]]+=c[t[0]]}),o.range=e.fromRectRange(hs(s[0][0],s[1][0],s[0][1],s[1][1])),ns(t,n),ss(t,{isEnd:!1})}function bs(e,t,n,r){var i=t.__brushOption.range,a=xs(e,n,r);L(i,function(e){e[0]+=a[0],e[1]+=a[1]}),ns(e,t),ss(e,{isEnd:!1})}function xs(e,t,n){var r=e.group,i=r.transformCoordToLocal(t,n),a=r.transformCoordToLocal(0,0);return[i[0]-a[0],i[1]-a[1]]}function Ss(e,t,n){var r=as(e,t);return r&&r!==zo?r.clipPath(n,e._transform):Pn(n)}function Cs(e){var t=Bo(e[0][0],e[1][0]),n=Bo(e[0][1],e[1][1]),r=Vo(e[0][0],e[1][0]),i=Vo(e[0][1],e[1][1]);return{x:t,y:n,width:r-t,height:i-n}}function ws(e,t,n){if(e._brushType&&!js(e,t.offsetX,t.offsetY)){var r=e._zr,i=e._covers,a=is(e,t,n);if(!e._dragging)for(var o=0;o<i.length;o++){var s=i[o].__brushOption;if(a&&(a===zo||s.panelId===a.panelId)&&Ms[s.brushType].contain(i[o],n[0],n[1]))return}a&&r.setCursorStyle(`crosshair`)}}function Ts(e){var t=e.event;t.preventDefault&&t.preventDefault()}function Es(e,t,n){return e.childOfName(`main`).contain(t,n)}function Ds(e,t,n,r){var i=e._creatingCover,a=e._creatingPanel,o=e._brushOption,s;if(e._track.push(n.slice()),cs(e)||i){if(a&&!i){o.brushMode===`single`&&os(e);var c=Pn(o);c.brushType=Os(c.brushType,a),c.panelId=a===zo?null:a.panelId,i=e._creatingCover=Qo(e,c),e._covers.push(i)}if(i){var l=Ms[Os(e._brushType,a)],u=i.__brushOption;u.range=l.getCreatingRange(Ss(e,i,e._track)),r&&($o(e,i),l.updateCommon(e,i)),es(e,i),s={isEnd:r}}}else r&&o.brushMode===`single`&&o.removeOnClick&&is(e,t,n)&&os(e)&&(s={isEnd:r,removeOnClick:!0});return s}function Os(e,t){return e===`auto`?t.defaultBrushType:e}var ks={mousedown:function(e){if(this._dragging)As(this,e);else if(!e.target||!e.target.draggable){Ts(e);var t=this.group.transformCoordToLocal(e.offsetX,e.offsetY);this._creatingCover=null,(this._creatingPanel=is(this,e,t))&&(this._dragging=!0,this._track=[t.slice()])}},mousemove:function(e){var t=e.offsetX,n=e.offsetY,r=this.group.transformCoordToLocal(t,n);if(ws(this,e,r),this._dragging){Ts(e);var i=Ds(this,e,r,!1);i&&ss(this,i)}},mouseup:function(e){As(this,e)}};function As(e,t){if(e._dragging){Ts(t);var n=t.offsetX,r=t.offsetY,i=Ds(e,t,e.group.transformCoordToLocal(n,r),!0);e._dragging=!1,e._track=[],e._creatingCover=null,i&&ss(e,i)}}function js(e,t,n){var r=e._zr;return t<0||t>r.getWidth()||n<0||n>r.getHeight()}var Ms={lineX:Ns(0),lineY:Ns(1),rect:{createCover:function(e,t){function n(e){return e}return us({toRectRange:n,fromRectRange:n},e,t,[[`w`],[`e`],[`n`],[`s`],[`s`,`e`],[`s`,`w`],[`n`,`e`],[`n`,`w`]])},getCreatingRange:function(e){var t=ls(e);return hs(t[1][0],t[1][1],t[0][0],t[0][1])},updateCoverShape:function(e,t,n,r){ds(e,t,n,r)},updateCommon:fs,contain:Es},polygon:{createCover:function(e,t){var n=new Xt;return n.add(new Fn({name:`main`,style:ms(t),silent:!0})),n},getCreatingRange:function(e){return e},endCreating:function(e,t){t.remove(t.childAt(0)),t.add(new yn({name:`main`,draggable:!0,drift:In(bs,e,t),ondragend:In(ss,e,{isEnd:!0})}))},updateCoverShape:function(e,t,n,r){t.childAt(0).setShape({points:Ss(e,t,n)})},updateCommon:fs,contain:Es}};function Ns(e){return{createCover:function(t,n){return us({toRectRange:function(t){var n=[t,[0,100]];return e&&n.reverse(),n},fromRectRange:function(t){return t[e]}},t,n,[[[`w`],[`e`]],[[`n`],[`s`]]][e])},getCreatingRange:function(t){var n=ls(t);return[Bo(n[0][e],n[1][e]),Vo(n[0][e],n[1][e])]},updateCoverShape:function(t,n,r,i){var a,o=as(t,n);if(o!==zo&&o.getLinearBrushOtherExtent)a=o.getLinearBrushOtherExtent(e);else{var s=t._zr;a=[0,[s.getWidth(),s.getHeight()][1-e]]}var c=[r,a];e&&c.reverse(),ds(t,n,c,i)},updateCommon:fs,contain:Es}}function Ps(e){return e=Ls(e),function(t){return Dn(t,e)}}function Fs(e,t){return e=Ls(e),function(n){var r=t??n,i=r?e.width:e.height,a=r?e.x:e.y;return[a,a+(i||0)]}}function Is(e,t,n){var r=Ls(e);return function(e,i){return r.contain(i[0],i[1])&&!Oo(e,t,n)}}function Ls(e){return en.create(e)}var Rs=[`x`,`y`,`radius`,`angle`,`single`],zs=gr(),Bs=[`cartesian2d`,`polar`,`singleAxis`];function Vs(e){var t=e.get(`coordinateSystem`);return Or(Bs,t)>=0}function Hs(e){return e+`Axis`}function Us(e,t){var n=Nn(),r=[],i=Nn();e.eachComponent({mainType:`dataZoom`,query:t},function(e){i.get(e.uid)||s(e)});var a;do a=!1,e.eachComponent(`dataZoom`,o);while(a);function o(e){!i.get(e.uid)&&c(e)&&(s(e),a=!0)}function s(e){i.set(e.uid,!0),r.push(e),l(e)}function c(e){var t=!1;return e.eachTargetAxis(function(e,r){var i=n.get(e);i&&i[r]&&(t=!0)}),t}function l(e){e.eachTargetAxis(function(e,t){(n.get(e)||n.set(e,[]))[t]=!0})}return r}function Ws(e){var t=zs(Cn(e));return t.axisProxyMap||=Nn()}function Gs(e){if(e)return Ws(e.ecModel).get(e.uid)}function Ks(e,t){Ws(e.ecModel).set(e.uid,t)}function qs(e,t){var n=t.getAxisModel().axis.__alignTo;return n&&e.getAxisProxy(n.dim,n.model.componentIndex)?Gs(n.model):null}var Js=function(){function e(){this.indexList=[],this.indexMap=[]}return e.prototype.add=function(e){this.indexMap[e]||(this.indexList.push(e),this.indexMap[e]=!0)},e}(),Ys=function(e){z(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n._autoThrottle=!0,n._noTarget=!0,n._rangePropMode=[`percent`,`percent`],n}return t.prototype.init=function(e,t,n){var r=Xs(e);this.settledOption=r,this.mergeDefaultAndTheme(e,n),this._doInit(r)},t.prototype.mergeOption=function(e){var t=Xs(e);qn(this.option,e,!0),qn(this.settledOption,t,!0),this._doInit(t)},t.prototype._doInit=function(e){var t=this.option;this._setDefaultThrottle(e),this._updateRangeUse(e);var n=this.settledOption;L([[`start`,`startValue`],[`end`,`endValue`]],function(e,r){this._rangePropMode[r]===`value`&&(t[e[0]]=n[e[0]]=null)},this),this._resetTarget()},t.prototype._resetTarget=function(){var e=this.get(`orient`,!0),t=this._targetAxisInfoMap=Nn();this._fillSpecifiedTargetAxis(t)?this._orient=e||this._makeAutoOrientByTargetAxis():(this._orient=e||`horizontal`,this._fillAutoTargetAxisByOrient(t,this._orient)),this._noTarget=!0,t.each(function(e){e.indexList.length&&(this._noTarget=!1)},this)},t.prototype._fillSpecifiedTargetAxis=function(e){var t=!1;return L(Rs,function(n){var r=this.getReferringComponents(Hs(n),Vn);if(r.specified){t=!0;var i=new Js;L(r.models,function(e){i.add(e.componentIndex)}),e.set(n,i)}},this),t},t.prototype._fillAutoTargetAxisByOrient=function(e,t){var n=this.ecModel,r=!0;if(r){var i=t===`vertical`?`y`:`x`,a=n.findComponents({mainType:i+`Axis`});o(a,i)}if(r){var a=n.findComponents({mainType:`singleAxis`,filter:function(e){return e.get(`orient`,!0)===t}});o(a,`single`)}function o(t,n){var i=t[0];if(i){var a=new Js;if(a.add(i.componentIndex),e.set(n,a),r=!1,n===`x`||n===`y`){var o=i.getReferringComponents(`grid`,xr).models[0];o&&L(t,function(e){i.componentIndex!==e.componentIndex&&o===e.getReferringComponents(`grid`,xr).models[0]&&a.add(e.componentIndex)})}}}r&&L(Rs,function(t){if(r){var i=n.findComponents({mainType:Hs(t),filter:function(e){return e.get(`type`,!0)===`category`}});if(i[0]){var a=new Js;a.add(i[0].componentIndex),e.set(t,a),r=!1}}},this)},t.prototype._makeAutoOrientByTargetAxis=function(){var e;return this.eachTargetAxis(function(t){!e&&(e=t)},this),e===`y`?`vertical`:`horizontal`},t.prototype._setDefaultThrottle=function(e){if(e.hasOwnProperty(`throttle`)&&(this._autoThrottle=!1),this._autoThrottle){var t=this.ecModel.option;this.option.throttle=t.animation&&t.animationDurationUpdate>0?100:20}},t.prototype._updateRangeUse=function(e){var t=this._rangePropMode,n=this.get(`rangeMode`);L([[`start`,`startValue`],[`end`,`endValue`]],function(r,i){var a=e[r[0]]!=null,o=e[r[1]]!=null;a&&!o?t[i]=`percent`:!a&&o?t[i]=`value`:n?t[i]=n[i]:a&&(t[i]=`percent`)})},t.prototype.noTarget=function(){return this._noTarget},t.prototype.getFirstTargetAxisModel=function(){var e;return this.eachTargetAxis(function(t,n){e??=this.ecModel.getComponent(Hs(t),n)},this),e},t.prototype.eachTargetAxis=function(e,t){this._targetAxisInfoMap.each(function(n,r){L(n.indexList,function(n){e.call(t,r,n)})})},t.prototype.getAxisProxy=function(e,t){return Gs(this.getAxisModel(e,t))},t.prototype.getAxisModel=function(e,t){var n=this._targetAxisInfoMap.get(e);if(n&&n.indexMap[t])return this.ecModel.getComponent(Hs(e),t)},t.prototype.setRawRange=function(e){var t=this.option,n=this.settledOption;L([[`start`,`startValue`],[`end`,`endValue`]],function(r){(e[r[0]]!=null||e[r[1]]!=null)&&(t[r[0]]=n[r[0]]=e[r[0]],t[r[1]]=n[r[1]]=e[r[1]])},this),this._updateRangeUse(e)},t.prototype.setCalculatedRange=function(e){var t=this.option;L([`start`,`startValue`,`end`,`endValue`],function(n){t[n]=e[n]})},t.prototype.getPercentRange=function(){var e=this.findRepresentativeAxisProxy();if(e)return e.getWindow().percent},t.prototype.getValueRange=function(e,t){if(e==null&&t==null){var n=this.findRepresentativeAxisProxy();if(n)return n.getWindow().value}else return this.getAxisProxy(e,t).getWindow().value},t.prototype.findRepresentativeAxisProxy=function(e){if(e)return Gs(e);for(var t,n=this._targetAxisInfoMap.keys(),r=0;r<n.length;r++)for(var i=n[r],a=this._targetAxisInfoMap.get(i),o=0;o<a.indexList.length;o++){var s=this.getAxisProxy(i,a.indexList[o]);if(s.hostedBy(this))return s;t||=s}return t},t.prototype.getRangePropMode=function(){return this._rangePropMode.slice()},t.prototype.getOrient=function(){return this._orient},t.type=`dataZoom`,t.dependencies=[`xAxis`,`yAxis`,`radiusAxis`,`angleAxis`,`singleAxis`,`series`,`toolbox`],t.defaultOption={z:4,filterMode:`filter`,start:0,end:100},t}(gn);function Xs(e){var t={};return L([`start`,`end`,`startValue`,`endValue`,`throttle`],function(n){e.hasOwnProperty(n)&&(t[n]=e[n])}),t}var Zs=function(e){z(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.type=`dataZoom.select`,t}(Ys),Qs=function(e){z(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.type=`dataZoom.select`,t}(function(e){z(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.render=function(e,t,n,r){this.dataZoomModel=e,this.ecModel=t,this.api=n},t.type=`dataZoom`,t}(Jt)),$s=function(){function e(e,t,n,r){this._dimName=e,this._axisIndex=t,this.ecModel=r,this._dataZoomModel=n}return e.prototype.hostedBy=function(e){return this._dataZoomModel===e},e.prototype.getWindow=function(){return Pn(this._window)},e.prototype.getTargetSeriesModels=function(){var e=[];return this.ecModel.eachSeries(function(t){if(Vs(t)){var n=Hs(this._dimName),r=t.getReferringComponents(n,xr).models[0];r&&this._axisIndex===r.componentIndex&&e.push(t)}},this),e},e.prototype.getAxisModel=function(){return this.ecModel.getComponent(this._dimName+`Axis`,this._axisIndex)},e.prototype.getMinMaxSpan=function(){return Pn(this._minMaxSpan)},e.prototype.calculateDataWindow=function(e){var t=this._extent,n=this.getAxisModel().axis,r=n.scale,i=this._dataZoomModel.getRangePropMode(),a=[0,100],o=[],s=[],c,l=[!1,!1];L([`start`,`end`],function(n,u){var d=e[n],f=e[n+`Value`];i[u]===`percent`?(d??=a[u],f=Un(d,a,t),l[u]=!0):(c=!0,f==null?f=t[u]:(f=r.parse(f),r.sanitize&&(f=r.sanitize(f,t))),d=Un(f,t,a)),s[u]=f==null||isNaN(f)?t[u]:f,o[u]=d==null||isNaN(d)?a[u]:d}),Rr(s),Rr(o);var u=this._minMaxSpan;c?d(s,o,t,a,!1):d(o,s,a,t,!0);function d(e,t,n,r,i){var a=i?`Span`:`ValueSpan`;Io(0,e,n,`all`,u[`min`+a],u[`max`+a]);for(var o=0;o<2;o++)t[o]=Un(e[o],n,r,!0),i&&(t[o]=t[o],l[o]=!0);pr(t)}var f=Sr(r)||mr(r),p=n.getExtent(),m=Hr(p[1]-p[0]),h=f?0:Wr(s,m,.5);L([[0,wn],[1,Yt]],function(e){var n=e[0],r=e[1];l[n]&&isFinite(h)&&(s[n]=Qt(s[n],h),s[n]=En(t[1],Br(t[0],s[n])),o[n]===a[n]&&(s[n]=t[n],f&&(s[n]=r(s[n]))))}),pr(s);var g=[Un(s[0],t,a,!0),Un(s[1],t,a,!0)];return pr(g),{value:s,percent:o,percentInverted:g,valuePrecision:h}},e.prototype.reset=function(e,t){if(this.hostedBy(e)){var n=this.getAxisModel().axis;Kn(n,2);var r=n.scale.rawExtentInfo;this._extent=r.makeNoZoom(),this._updateMinMaxSpan();var i=e.settledOption;t&&(i=bn({start:t[0],end:t[1]},i));var a=this._window=this.calculateDataWindow(i),o=a.percent,s=a.value;o[0]!==0&&r.setZoomMM(0,s[0]),o[1]!==100&&r.setZoomMM(1,s[1])}},e.prototype.filterData=function(e,t){if(!this.hostedBy(e))return;var n=this._dimName,r=this.getTargetSeriesModels(),i=e.get(`filterMode`),a=this._window.value;if(i===`none`)return;L(r,function(e){var t=e.getData(),r=t.mapDimensionsAll(n);if(r.length){if(i===`weakFilter`){var s=t.getStore(),c=Ir(r,function(e){return t.getDimensionIndex(e)},t);t.filterSelf(function(e){for(var t,n,i,o=0;o<r.length;o++){var l=s.get(c[o],e),u=!isNaN(l),d=l<a[0],f=l>a[1];if(u&&!d&&!f)return!0;u&&(i=!0),d&&(t=!0),f&&(n=!0)}return i&&t&&n})}else L(r,function(n){if(i===`empty`)e.setData(t=t.map(n,function(e){return o(e)?e:NaN}));else{var r={};r[n]=a,t.selectRange(r)}});L(r,function(e){t.setApproximateExtent(a,e)})}});function o(e){return e>=a[0]&&e<=a[1]}},e.prototype._updateMinMaxSpan=function(){var e=this._minMaxSpan={},t=this._dataZoomModel,n=this._extent;L([`min`,`max`],function(r){var i=t.get(r+`Span`),a=t.get(r+`ValueSpan`);a!=null&&(a=this.getAxisModel().axis.scale.parse(a)),a==null?i!=null&&(a=Un(i,[0,100],n,!0)-n[0]):i=Un(n[0]+a,n,[0,100],!0),e[r+`Span`]=i,e[r+`ValueSpan`]=a},this)},e}(),ec={dirtyOnOverallProgress:!0,getTargetSeries:function(e){function t(t){e.eachComponent(`dataZoom`,function(n){n.eachTargetAxis(function(r,i){t(r,i,e.getComponent(Hs(r),i),n)})})}var n=[];t(function(t,r,i,a){if(!Gs(i)){var o=new $s(t,r,a,e);n.push(o),Ks(i,o)}});var r=Nn();return L(n,function(e){L(e.getTargetSeriesModels(),function(e){r.set(e.uid,e)})}),r},overallReset:function(e,t){e.eachComponent(`dataZoom`,function(e){var n=[];e.eachTargetAxis(function(t,r){var i=e.getAxisProxy(t,r),a=qs(e,i);a?n.push([i,a]):i.reset(e,null)}),L(n,function(t){t[0].reset(e,t[1].getWindow().percentInverted)}),e.eachTargetAxis(function(n,r){e.getAxisProxy(n,r).filterData(e,t)})}),e.eachComponent(`dataZoom`,function(e){var t=e.findRepresentativeAxisProxy();if(t){var n=t.getWindow(),r=n.percent,i=n.value;e.setCalculatedRange({start:r[0],end:r[1],startValue:i[0],endValue:i[1]})}})}};function tc(e){e.registerAction(`dataZoom`,function(e,t){var n=Us(t,e);L(n,function(t){t.setRawRange({start:e.start,end:e.end,startValue:e.startValue,endValue:e.endValue})})})}var nc=wr();function rc(e){nc(e,function(){e.registerProcessor(e.PRIORITY.PROCESSOR.FILTER,ec),tc(e),e.registerSubTypeDefaulter(`dataZoom`,function(){return`slider`})})}function ic(e){e.registerComponentModel(Zs),e.registerComponentView(Qs),rc(e)}var ac=function(){function e(){}return e}(),oc={};function sc(e,t){oc[e]=t}function cc(e){return oc[e]}var lc=function(e){z(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.init=function(t,n,r){var i=r.getTheme().get(`toolbox`),a=i?i.feature:null;a&&(this._themeFeatureOption=Yn({},a),i.feature={}),e.prototype.init.call(this,t,n,r),a&&(i.feature=a)},t.prototype.optionUpdated=function(){L(this.option.feature,function(e,t){var n=this._themeFeatureOption,r=cc(t);r&&(r.getDefaultOption&&(r.defaultOption=r.getDefaultOption(this.ecModel)),n&&n[t]&&(qn(e,n[t]),n[t]=null),qn(e,r.defaultOption))},this)},t.type=`toolbox`,t.layoutMode={type:`box`,ignoreSize:!0},t.defaultOption={show:!0,z:6,orient:`horizontal`,left:`right`,top:`top`,backgroundColor:`transparent`,borderColor:R.color.border,borderRadius:0,borderWidth:0,padding:R.size.m,itemSize:15,itemGap:R.size.s,showTitle:!0,iconStyle:{borderColor:R.color.accent50,color:`none`},emphasis:{iconStyle:{borderColor:R.color.accent70}},tooltip:{show:!1,position:`bottom`}},t}(gn),uc=function(e){z(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.render=function(e,t,n,r){var i=this.group;if(i.removeAll(),!e.get(`show`))return;var a=+e.get(`itemSize`),o=e.get(`orient`)===`vertical`,s=e.get(`feature`)||{},c=this._features||=Nn(),l=[];L(s,function(e,t){l.push(t)}),new $n(this._featureNames||[],l).add(u).update(u).remove(In(u,null)).execute(),this._featureNames=Nr(l,function(e){return c.hasKey(e)});function u(i,a){var o=i!=null&&a==null,u=i!=null&&a!=null,f=i==null,p=o||u?l[i]:l[a],m=s[p],h=o||u?new xn(m,e,t):null,g=h&&h.get(`show`),_;if(o){if(!g)return;if(dc(p))_={onclick:h.option.onclick,featureName:p};else{var v=cc(p);if(!v)return;_=new v}c.set(p,_)}else _=c.get(p);f||!g?(fc(_)&&_.dispose&&_.dispose(t,n),c.removeKey(p)):(r&&r.newTitle!=null&&r.featureName===p&&(m.title=r.newTitle),o&&(_.uid=on(`toolbox-feature`)),_.model=h,_.ecModel=t,_.api=n,d(h,_,p),h.setIconStatus=function(e,t){var n=this.option,r=this.iconPaths;n.iconStatus=n.iconStatus||{},n.iconStatus[e]=t,r[e]&&(t===`emphasis`?Xn:Pr)(r[e])},fc(_)&&_.render&&_.render(h,t,n,r))}function d(r,s,c){var l=r.getModel(`iconStyle`),u=r.getModel([`emphasis`,`iconStyle`]),d=s instanceof ac&&s.getIcons?s.getIcons():r.get(`icon`),f=r.get(`title`)||{},p,m;fr(d)?(p={},p[c]=d):p=d,fr(f)?(m={},m[c]=f):m=f;var h=r.iconPaths={};L(p,function(c,d){var f=An(c,{},{x:-a/2,y:-a/2,width:a,height:a});f.setStyle(l.getItemStyle());var p=f.ensureState(`emphasis`);p.style=u.getItemStyle();var g=new kr({style:{text:m[d],align:u.get(`textAlign`),borderRadius:u.get(`textBorderRadius`),padding:u.get(`textPadding`),fill:null,font:Kt({fontStyle:u.get(`textFontStyle`),fontFamily:u.get(`textFontFamily`),fontSize:u.get(`textFontSize`),fontWeight:u.get(`textFontWeight`)},t)},ignore:!0});f.setTextContent(g),Tr({el:f,componentModel:e,itemName:d,formatterParamsExtra:{title:m[d]}}),f.__title=m[d],f.on(`mouseover`,function(){var t=u.getItemStyle(),r=o?e.get(`right`)==null&&e.get(`left`)!==`right`?`right`:`left`:e.get(`bottom`)==null&&e.get(`top`)!==`bottom`?`bottom`:`top`;g.setStyle({fill:u.get(`textFill`)||t.fill||t.stroke||R.color.neutral99,backgroundColor:u.get(`textBackgroundColor`)}),f.setTextConfig({position:u.get(`textPosition`)||r}),g.ignore=!e.get(`showTitle`),n.enterEmphasis(this)}).on(`mouseout`,function(){r.get([`iconStatus`,d])!==`emphasis`&&n.leaveEmphasis(this),g.hide()}),(r.get([`iconStatus`,d])===`emphasis`?Xn:Pr)(f),i.add(f),f.on(`click`,ln(s.onclick,s,t,n,d)),h[d]=f})}var f=Wt(e,n).refContainer,p=e.getBoxLayoutParams(),m=e.get(`padding`),h=mn(p,f,m);lr(e.get(`orient`),i,e.get(`itemGap`),h.width,h.height),vn(i,p,f,m),i.add(Dr(i.getBoundingRect(),e)),o||i.eachChild(function(e){var t=e.__title,r=e.ensureState(`emphasis`),o=r.textConfig||={},s=e.getTextContent(),c=s&&s.ensureState(`emphasis`);if(c&&!br(c)&&t){var l=c.style||={},u=_n(t,kr.makeFont(l)),d=e.x+i.x,f=e.y+i.y+a,p=!1;f+u.height>n.getHeight()&&(o.position=`top`,p=!0);var m=p?-5-u.height:a+10;d+u.width/2>n.getWidth()?(o.position=[`100%`,m],l.align=`right`):d-u.width/2<0&&(o.position=[0,m],l.align=`left`)}})},t.prototype.updateView=function(e,t,n,r){L(this._features,function(e){e&&e instanceof ac&&e.updateView&&e.updateView(e.model,t,n,r)})},t.prototype.dispose=function(e,t){L(this._features,function(n){n&&n instanceof ac&&n.dispose&&n.dispose(e,t)})},t.type=`toolbox`,t}(Jt);function dc(e){return e.indexOf(`my`)===0}function fc(e){return e instanceof ac}var pc=function(e){z(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.onclick=function(e,t){var n=this.model,r=n.get(`name`)||e.get(`title.0.text`)||`echarts`,i=t.getZr().painter.getType()===`svg`,a=i?`svg`:n.get(`type`,!0)||`png`,o=t.getConnectedDataURL({type:a,backgroundColor:n.get(`backgroundColor`,!0)||e.get(`backgroundColor`)||R.color.neutral00,connectedBackgroundColor:n.get(`connectedBackgroundColor`),excludeComponents:n.get(`excludeComponents`),pixelRatio:n.get(`pixelRatio`)}),s=rr.browser;if(typeof MouseEvent==`function`&&(s.newEdge||!s.ie&&!s.edge)){var c=document.createElement(`a`);c.download=r+`.`+a,c.target=`_blank`,c.href=o;var l=new MouseEvent(`click`,{view:document.defaultView,bubbles:!0,cancelable:!1});c.dispatchEvent(l)}else if(window.navigator.msSaveOrOpenBlob||i){var u=o.split(`,`),d=u[0].indexOf(`base64`)>-1,f=i?decodeURIComponent(u[1]):u[1];d&&(f=window.atob(f));var p=r+`.`+a;if(window.navigator.msSaveOrOpenBlob){for(var m=f.length,h=new Uint8Array(m);m--;)h[m]=f.charCodeAt(m);var g=new Blob([h]);window.navigator.msSaveOrOpenBlob(g,p)}else{var _=document.createElement(`iframe`);document.body.appendChild(_);var v=_.contentWindow,y=v.document;y.open(`image/svg+xml`,`replace`),y.write(f),y.close(),v.focus(),y.execCommand(`SaveAs`,!0,p),document.body.removeChild(_)}}else{var b=n.get(`lang`),ee=`<body style="margin:0;"><img src="`+o+`" style="max-width:100%;" title="`+(b&&b[0]||``)+`" /></body>`,x=window.open();x.document.write(ee),x.document.title=r}},t.getDefaultOption=function(e){return{show:!0,icon:`M4.7,22.9L29.3,45.5L54.7,23.4M4.6,43.6L4.6,58L53.8,58L53.8,43.6M29.2,45.1L29.2,0`,title:e.getLocaleModel().get([`toolbox`,`saveAsImage`,`title`]),type:`png`,connectedBackgroundColor:R.color.neutral00,name:``,excludeComponents:[`toolbox`],lang:e.getLocaleModel().get([`toolbox`,`saveAsImage`,`lang`])}},t}(ac),mc=`__ec_magicType_stack__`,hc=[[`line`,`bar`],[`stack`]],gc=function(e){z(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.getIcons=function(){var e=this.model,t=e.get(`icon`),n={};return L(e.get(`type`),function(e){t[e]&&(n[e]=t[e])}),n},t.getDefaultOption=function(e){return{show:!0,type:[],icon:{line:`M4.1,28.9h7.1l9.3-22l7.4,38l9.7-19.7l3,12.8h14.9M4.1,58h51.4`,bar:`M6.7,22.9h10V48h-10V22.9zM24.9,13h10v35h-10V13zM43.2,2h10v46h-10V2zM3.1,58h53.7`,stack:`M8.2,38.4l-8.4,4.1l30.6,15.3L60,42.5l-8.1-4.1l-21.5,11L8.2,38.4z M51.9,30l-8.1,4.2l-13.4,6.9l-13.9-6.9L8.2,30l-8.4,4.2l8.4,4.2l22.2,11l21.5-11l8.1-4.2L51.9,30z M51.9,21.7l-8.1,4.2L35.7,30l-5.3,2.8L24.9,30l-8.4-4.1l-8.3-4.2l-8.4,4.2L8.2,30l8.3,4.2l13.9,6.9l13.4-6.9l8.1-4.2l8.1-4.1L51.9,21.7zM30.4,2.2L-0.2,17.5l8.4,4.1l8.3,4.2l8.4,4.2l5.5,2.7l5.3-2.7l8.1-4.2l8.1-4.2l8.1-4.1L30.4,2.2z`},title:e.getLocaleModel().get([`toolbox`,`magicType`,`title`]),option:{},seriesIndex:{}}},t.prototype.onclick=function(e,t,n){var r=this.model,i=r.get([`seriesIndex`,n]);if(_c[n]){var a={series:[]};L(hc,function(e){Or(e,n)>=0&&L(e,function(e){r.setIconStatus(e,`normal`)})}),r.setIconStatus(n,`emphasis`),e.eachComponent({mainType:`series`,query:i==null?null:{seriesIndex:i}},function(e){var t=e.subType,i=e.id,o=_c[n](t,i,e,r);o&&(bn(o,e.option),a.series.push(o));var s=e.coordinateSystem;if(s&&s.type===`cartesian2d`&&(n===`line`||n===`bar`)){var c=s.getAxesByScale(`ordinal`)[0];if(c){var l=c.dim+`Axis`,u=e.getReferringComponents(l,xr).models[0].componentIndex;a[l]=a[l]||[];for(var d=0;d<=u;d++)a[l][u]=a[l][u]||{};a[l][u].boundaryGap=n===`bar`}}});var o,s=n;n===`stack`&&(o=qn({stack:r.option.title.tiled,tiled:r.option.title.stack},r.option.title),r.get([`iconStatus`,n])!==`emphasis`&&(s=`tiled`)),t.dispatchAction({type:`changeMagicType`,currentType:s,newOption:a,newTitle:o,featureName:`magicType`})}},t}(ac),_c={line:function(e,t,n,r){if(e===`bar`)return qn({id:t,type:`line`,data:n.get(`data`),stack:n.get(`stack`),markPoint:n.get(`markPoint`),markLine:n.get(`markLine`)},r.get([`option`,`line`])||{},!0)},bar:function(e,t,n,r){if(e===`line`)return qn({id:t,type:`bar`,data:n.get(`data`),stack:n.get(`stack`),markPoint:n.get(`markPoint`),markLine:n.get(`markLine`)},r.get([`option`,`bar`])||{},!0)},stack:function(e,t,n,r){var i=n.get(`stack`)===mc;if(e===`line`||e===`bar`)return r.setIconStatus(`stack`,i?`normal`:`emphasis`),qn({id:t,stack:i?``:mc},r.get([`option`,`stack`])||{},!0)}};Ln({type:`changeMagicType`,event:`magicTypeChanged`,update:`prepareAndUpdate`},function(e,t){t.mergeOption(e.newOption)});var vc=Array(60).join(`-`),yc=` `;function bc(e){var t={},n=[],r=[];return e.eachRawSeries(function(e){var i=e.coordinateSystem;if(i&&(i.type===`cartesian2d`||i.type===`polar`)){var a=i.getBaseAxis();if(a.type===`category`){var o=zn(a);t[o]||(t[o]={categoryAxis:a,valueAxis:i.getOtherAxis(a),series:[]},r.push({axisDim:a.dim,axisIndex:a.index})),t[o].series.push(e)}else n.push(e)}else n.push(e)}),{seriesGroupByCategoryAxis:t,other:n,meta:r}}function xc(e){var t=[];return L(e,function(e,n){var r=e.categoryAxis,i=e.valueAxis.dim,a=[` `].concat(Ir(e.series,function(e){return e.name})),o=[r.model.getCategories()];L(e.series,function(e){var t=e.getRawData();o.push(e.getRawData().mapArray(t.mapDimension(i),function(e){return e}))});for(var s=[a.join(yc)],c=0;c<o[0].length;c++){for(var l=[],u=0;u<o.length;u++)l.push(o[u][c]);s.push(l.join(yc))}t.push(s.join(`
11
+ `))}),t.join(`
12
+
13
+ `+vc+`
14
+
15
+ `)}function Sc(e){return Ir(e,function(e){var t=e.getRawData(),n=[e.name],r=[];return t.each(t.dimensions,function(){for(var e=arguments.length,i=arguments[e-1],a=t.getName(i),o=0;o<e-1;o++)r[o]=arguments[o];n.push((a?a+yc:``)+r.join(yc))}),n.join(`
16
+ `)}).join(`
17
+
18
+ `+vc+`
19
+
20
+ `)}function Cc(e){var t=bc(e);return{value:Nr([xc(t.seriesGroupByCategoryAxis),Sc(t.other)],function(e){return!!e.replace(/[\n\t\s]/g,``)}).join(`
21
+
22
+ `+vc+`
23
+
24
+ `),meta:t.meta}}function wc(e){return e.replace(/^\s\s*/,``).replace(/\s\s*$/,``)}function Tc(e){if(e.slice(0,e.indexOf(`
25
+ `)).indexOf(yc)>=0)return!0}var Ec=RegExp(`[`+yc+`]+`,`g`);function Dc(e){for(var t=e.split(/\n+/g),n=wc(t.shift()).split(Ec),r=[],i=Ir(n,function(e){return{name:e,data:[]}}),a=0;a<t.length;a++){var o=wc(t[a]).split(Ec);r.push(o.shift());for(var s=0;s<o.length;s++)i[s]&&(i[s].data[a]=o[s])}return{series:i,categories:r}}function Oc(e){for(var t=e.split(/\n+/g),n=wc(t.shift()),r=[],i=0;i<t.length;i++){var a=wc(t[i]);if(a){var o=a.split(Ec),s=``,c=void 0,l=!1;isNaN(o[0])?(l=!0,s=o[0],o=o.slice(1),r[i]={name:s,value:[]},c=r[i].value):c=r[i]=[];for(var u=0;u<o.length;u++)c.push(+o[u]);c.length===1&&(l?r[i].value=c[0]:r[i]=c[0])}}return{name:n,data:r}}function kc(e,t){var n=e.split(RegExp(`
26
+ *`+vc+`
27
+ *`,`g`)),r={series:[]};return L(n,function(e,n){if(Tc(e)){var i=Dc(e),a=t[n],o=a.axisDim+`Axis`;a&&(r[o]=r[o]||[],r[o][a.axisIndex]={data:i.categories},r.series=r.series.concat(i.series))}else{var i=Oc(e);r.series.push(i)}}),r}var Ac=function(e){z(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.onclick=function(e,t){setTimeout(function(){t.dispatchAction({type:`hideTip`})});var n=t.getDom(),r=this.model;this._dom&&n.removeChild(this._dom);var i=document.createElement(`div`);i.style.cssText=`position:absolute;top:0;bottom:0;left:0;right:0;padding:5px`,i.style.backgroundColor=r.get(`backgroundColor`)||R.color.neutral00;var a=document.createElement(`h4`),o=r.get(`lang`)||[];a.innerHTML=o[0]||r.get(`title`),a.style.cssText=`margin:10px 20px`,a.style.color=r.get(`textColor`);var s=document.createElement(`div`),c=document.createElement(`textarea`);s.style.cssText=`overflow:auto`;var l=r.get(`optionToContent`),u=r.get(`contentToOption`),d=Cc(e);if(br(l)){var f=l(t.getOption());fr(f)?s.innerHTML=f:Bn(f)&&s.appendChild(f)}else{c.readOnly=r.get(`readOnly`);var p=c.style;p.cssText=`display:block;width:100%;height:100%;font-family:monospace;font-size:14px;line-height:1.6rem;resize:none;box-sizing:border-box;outline:none`,p.color=r.get(`textColor`),p.borderColor=r.get(`textareaBorderColor`),p.backgroundColor=r.get(`textareaColor`),c.value=d.value,s.appendChild(c)}var m=d.meta,h=document.createElement(`div`);h.style.cssText=`position:absolute;bottom:5px;left:0;right:0`;var g=`float:right;margin-right:20px;border:none;cursor:pointer;padding:2px 5px;font-size:12px;border-radius:3px`,_=document.createElement(`div`),v=document.createElement(`div`);g+=`;background-color:`+r.get(`buttonColor`),g+=`;color:`+r.get(`buttonTextColor`);var y=this;function b(){n.removeChild(i),y._dom=null}jn(_,`click`,b),jn(v,`click`,function(){if(u==null&&l!=null||u!=null&&l==null)b();else{var e;try{e=br(u)?u(s,t.getOption()):kc(c.value,m)}catch(e){throw b(),Error(`Data view format error `+e)}e&&t.dispatchAction({type:`changeDataView`,newOption:e}),b()}}),_.innerHTML=o[1],v.innerHTML=o[2],v.style.cssText=_.style.cssText=g,!r.get(`readOnly`)&&h.appendChild(v),h.appendChild(_),i.appendChild(a),i.appendChild(s),i.appendChild(h),s.style.height=n.clientHeight-80+`px`,n.appendChild(i),this._dom=i},t.prototype.dispose=function(e,t){this._dom&&t.getDom().removeChild(this._dom)},t.getDefaultOption=function(e){return{show:!0,readOnly:!1,optionToContent:null,contentToOption:null,icon:`M17.5,17.3H33 M17.5,17.3H33 M45.4,29.5h-28 M11.5,2v56H51V14.8L38.4,2H11.5z M38.4,2.2v12.7H51 M45.4,41.7h-28`,title:e.getLocaleModel().get([`toolbox`,`dataView`,`title`]),lang:e.getLocaleModel().get([`toolbox`,`dataView`,`lang`]),backgroundColor:R.color.background,textColor:R.color.primary,textareaColor:R.color.background,textareaBorderColor:R.color.border,buttonColor:R.color.accent50,buttonTextColor:R.color.neutral00}},t}(ac);function jc(e,t){return Ir(e,function(e,n){var r=t&&t[n];if(Gn(r)&&!or(r)){(!Gn(e)||or(e))&&(e={value:e});var i=r.name!=null&&e.name==null;return e=bn(e,r),i&&delete e.name,e}return e})}Ln({type:`changeDataView`,event:`dataViewChanged`,update:`prepareAndUpdate`},function(e,t){var n=[];L(e.newOption.series,function(e){var r=t.getSeriesByName(e.name)[0];if(!r)n.push(Yn({type:`scatter`},e));else{var i=r.get(`data`);n.push({name:e.name,data:jc(e.data,i)})}}),t.mergeOption(bn({series:n},e.newOption))});var Mc=L,Nc=gr();function Pc(e,t){var n=Rc(e);Mc(t,function(t,r){for(var i=n.length-1;i>=0&&!n[i][r];i--);if(i<0){var a=e.queryComponents({mainType:`dataZoom`,subType:`select`,id:r})[0];if(a){var o=a.getPercentRange();n[0][r]={dataZoomId:r,start:o[0],end:o[1]}}}}),n.push(t)}function Fc(e){var t=Rc(e),n=t[t.length-1];t.length>1&&t.pop();var r={};return Mc(n,function(e,n){for(var i=t.length-1;i>=0;i--)if(e=t[i][n],e){r[n]=e;break}}),r}function Ic(e){Nc(e).snapshots=null}function Lc(e){return Rc(e).length}function Rc(e){var t=Nc(e);return t.snapshots||=[{}],t.snapshots}var zc=function(e){z(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.onclick=function(e,t){Ic(e),t.dispatchAction({type:`restore`,from:this.uid})},t.getDefaultOption=function(e){return{show:!0,icon:`M3.8,33.4 M47,18.9h9.8V8.7 M56.3,20.1 C52.1,9,40.5,0.6,26.8,2.1C12.6,3.7,1.6,16.2,2.1,30.6 M13,41.1H3.1v10.2 M3.7,39.9c4.2,11.1,15.8,19.5,29.5,18 c14.2-1.6,25.2-14.1,24.7-28.5`,title:e.getLocaleModel().get([`toolbox`,`restore`,`title`])}},t}(ac);Ln({type:`restore`,event:`restore`,update:`prepareAndUpdate`},function(e,t){t.resetOption(`recreate`)});var Bc=[`grid`,`xAxis`,`yAxis`,`geo`,`graph`,`polar`,`radiusAxis`,`angleAxis`,`bmap`],Vc=function(){function e(e,t,n){var r=this;this._targetInfoList=[];var i=Uc(t,e);L(Wc,function(e,t){(!n||!n.include||Or(n.include,t)>=0)&&e(i,r._targetInfoList)})}return e.prototype.setOutputRanges=function(e,t){return this.matchOutputRanges(e,t,function(e,t,n){if((e.coordRanges||=[]).push(t),!e.coordRange){e.coordRange=t;var r=qc[e.brushType](0,n,t);e.__rangeOffset={offset:Yc[e.brushType](r.values,e.range,[1,1]),xyMinMax:r.xyMinMax}}}),e},e.prototype.matchOutputRanges=function(e,t,n){L(e,function(e){var r=this.findTargetInfo(e,t);r&&r!==!0&&L(r.coordSyses,function(r){n(e,qc[e.brushType](1,r,e.range,!0).values,r,t)})},this)},e.prototype.setInputRanges=function(e,t){L(e,function(e){var n=this.findTargetInfo(e,t);if(e.range=e.range||[],n&&n!==!0){e.panelId=n.panelId;var r=qc[e.brushType](0,n.coordSys,e.coordRange),i=e.__rangeOffset;e.range=i?Yc[e.brushType](r.values,i.offset,Zc(r.xyMinMax,i.xyMinMax)):r.values}},this)},e.prototype.makePanelOpts=function(e,t){return Ir(this._targetInfoList,function(n){var r=n.getPanelRect();return{panelId:n.panelId,defaultBrushType:t?t(n):null,clipPath:Ps(r),isTargetByCursor:Is(r,e,n.coordSysModel),getLinearBrushOtherExtent:Fs(r)}})},e.prototype.controlSeries=function(e,t,n){var r=this.findTargetInfo(e,n);return r===!0||r&&Or(r.coordSyses,t.coordinateSystem)>=0},e.prototype.findTargetInfo=function(e,t){for(var n=this._targetInfoList,r=Uc(t,e),i=0;i<n.length;i++){var a=n[i],o=e.panelId;if(o){if(a.panelId===o)return a}else for(var s=0;s<Gc.length;s++)if(Gc[s](r,a))return a}return!0},e}();function Hc(e){return e[0]>e[1]&&e.reverse(),e}function Uc(e,t){return tr(e,t,{includeMainTypes:Bc})}var Wc={grid:function(e,t){var n=e.xAxisModels,r=e.yAxisModels,i=e.gridModels,a=Nn(),o={},s={};(n||r||i)&&(L(n,function(e){var t=e.axis.grid.model;a.set(t.id,t),o[t.id]=!0}),L(r,function(e){var t=e.axis.grid.model;a.set(t.id,t),s[t.id]=!0}),L(i,function(e){a.set(e.id,e),o[e.id]=!0,s[e.id]=!0}),a.each(function(e){var i=e.coordinateSystem,a=[];L(i.getCartesians(),function(e,t){(Or(n,e.getAxis(`x`).model)>=0||Or(r,e.getAxis(`y`).model)>=0)&&a.push(e)}),t.push({panelId:`grid--`+e.id,gridModel:e,coordSysModel:e,coordSys:a[0],coordSyses:a,getPanelRect:Kc.grid,xAxisDeclared:o[e.id],yAxisDeclared:s[e.id]})}))},geo:function(e,t){L(e.geoModels,function(e){var n=e.coordinateSystem;t.push({panelId:`geo--`+e.id,geoModel:e,coordSysModel:e,coordSys:n,coordSyses:[n],getPanelRect:Kc.geo})})}},Gc=[function(e,t){var n=e.xAxisModel,r=e.yAxisModel,i=e.gridModel;return!i&&n&&(i=n.axis.grid.model),!i&&r&&(i=r.axis.grid.model),i&&i===t.gridModel},function(e,t){var n=e.geoModel;return n&&n===t.geoModel}],Kc={grid:function(){return this.coordSys.master.getRect().clone()},geo:function(){var e=this.coordSys.view,t=No(null,e);return sn(t,t,Mo(null,e)),t}},qc={lineX:In(Jc,0),lineY:In(Jc,1),rect:function(e,t,n,r){var i=e?t.pointToData([n[0][0],n[1][0]],r):t.dataToPoint([n[0][0],n[1][0]],r),a=e?t.pointToData([n[0][1],n[1][1]],r):t.dataToPoint([n[0][1],n[1][1]],r),o=[Hc([i[0],a[0]]),Hc([i[1],a[1]])];return{values:o,xyMinMax:o}},polygon:function(e,t,n,r){var i=[Jn(),Jn()];return{values:Ir(n,function(n){var a=e?t.pointToData(n,r):t.dataToPoint(n,r);return i[0][0]=Math.min(i[0][0],a[0]),i[1][0]=Math.min(i[1][0],a[1]),i[0][1]=Math.max(i[0][1],a[0]),i[1][1]=Math.max(i[1][1],a[1]),a}),xyMinMax:i}}};function Jc(e,t,n,r){var i=n.getAxis([`x`,`y`][e]),a=Hc(Ir([0,1],function(e){return t?i.coordToData(i.toLocalCoord(r[e]),!0):i.toGlobalCoord(i.dataToCoord(r[e]))})),o=[];return o[e]=a,o[1-e]=[NaN,NaN],{values:a,xyMinMax:o}}var Yc={lineX:In(Xc,0),lineY:In(Xc,1),rect:function(e,t,n){return[[e[0][0]-n[0]*t[0][0],e[0][1]-n[0]*t[0][1]],[e[1][0]-n[1]*t[1][0],e[1][1]-n[1]*t[1][1]]]},polygon:function(e,t,n){return Ir(e,function(e,r){return[e[0]-n[0]*t[r][0],e[1]-n[1]*t[r][1]]})}};function Xc(e,t,n,r){return[t[0]-r[e]*n[0],t[1]-r[e]*n[1]]}function Zc(e,t){var n=Qc(e),r=Qc(t),i=[n[0]/r[0],n[1]/r[1]];return isNaN(i[0])&&(i[0]=1),isNaN(i[1])&&(i[1]=1),i}function Qc(e){return e?[e[0][1]-e[0][0],e[1][1]-e[1][0]]:[NaN,NaN]}var $c=L,el=ir(`toolbox-dataZoom_`),tl={x:`width`,y:`height`},nl=function(e){z(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.render=function(e,t,n,r){this._brushController||(this._brushController=new Zo(n.getZr()),this._brushController.on(`brush`,ln(this._onBrush,this)).mount()),ol(e,t,this,r,n),al(e,t)},t.prototype.onclick=function(e,t,n){rl[n].call(this)},t.prototype.dispose=function(e,t){this._brushController&&this._brushController.dispose()},t.prototype._onBrush=function(e){var t=e.areas;if(!e.isEnd||!t.length)return;var n={},r=this.ecModel;this._brushController.updateCovers([]),new Vc(il(this.model),r,{include:[`grid`]}).matchOutputRanges(t,r,function(e,t,n){if(n.type===`cartesian2d`){var r=n.master.getRect().clone(),a=e.brushType;a===`rect`?(i(`x`,n,r,t[0]),i(`y`,n,r,t[1])):i({lineX:`x`,lineY:`y`}[a],n,r,t)}}),Pc(r,n),this._dispatchZoomAction(n);function i(e,t,i,o){var s=t.getAxis(e),c=s.model,l=a(e,c,r),u=l.findRepresentativeAxisProxy(c).getMinMaxSpan(),d=s.scale.getExtent();(u.minValueSpan!=null||u.maxValueSpan!=null)&&(o=Io(0,o.slice(),d,0,u.minValueSpan,u.maxValueSpan));var f=Wr(d,i[tl[e]],.5);l&&(n[l.id]={dataZoomId:l.id,startValue:isFinite(f)?Qt(o[0],f):o[0],endValue:isFinite(f)?Qt(o[1],f):o[1]})}function a(e,t,n){var r;return n.eachComponent({mainType:`dataZoom`,subType:`select`},function(n){n.getAxisModel(e,t.componentIndex)&&(r=n)}),r}},t.prototype._dispatchZoomAction=function(e){var t=[];$c(e,function(e,n){t.push(Pn(e))}),t.length&&this.api.dispatchAction({type:`dataZoom`,from:this.uid,batch:t})},t.getDefaultOption=function(e){return{show:!0,filterMode:`filter`,icon:{zoom:`M0,13.5h26.9 M13.5,26.9V0 M32.1,13.5H58V58H13.5 V32.1`,back:`M22,1.4L9.9,13.5l12.3,12.3 M10.3,13.5H54.9v44.6 H10.3v-26`},title:e.getLocaleModel().get([`toolbox`,`dataZoom`,`title`]),brushStyle:{borderWidth:0,color:R.color.backgroundTint}}},t}(ac),rl={zoom:function(){var e=!this._isZoomActive;this.api.dispatchAction({type:`takeGlobalCursor`,key:`dataZoomSelect`,dataZoomSelectActive:e})},back:function(){this._dispatchZoomAction(Fc(this.ecModel))}};function il(e){var t={xAxisIndex:e.get(`xAxisIndex`,!0),yAxisIndex:e.get(`yAxisIndex`,!0),xAxisId:e.get(`xAxisId`,!0),yAxisId:e.get(`yAxisId`,!0)};return t.xAxisIndex==null&&t.xAxisId==null&&(t.xAxisIndex=`all`),t.yAxisIndex==null&&t.yAxisId==null&&(t.yAxisIndex=`all`),t}function al(e,t){e.setIconStatus(`back`,Lc(t)>1?`emphasis`:`normal`)}function ol(e,t,n,r,i){var a=n._isZoomActive;r&&r.type===`takeGlobalCursor`&&(a=r.key===`dataZoomSelect`&&r.dataZoomSelectActive),n._isZoomActive=a,e.setIconStatus(`zoom`,a?`emphasis`:`normal`);var o=new Vc(il(e),t,{include:[`grid`]}).makePanelOpts(i,function(e){return e.xAxisDeclared&&!e.yAxisDeclared?`lineX`:!e.xAxisDeclared&&e.yAxisDeclared?`lineY`:`rect`});n._brushController.setPanels(o).enableBrush(a&&o.length?{brushType:`auto`,brushStyle:e.getModel(`brushStyle`).getItemStyle()}:!1)}Zt(`dataZoom`,function(e){var t=e.getComponent(`toolbox`,0),n=[`feature`,`dataZoom`];if(!t||t.get(n)==null)return;var r=t.getModel(n),i=[],a=il(r),o=tr(e,a);$c(o.xAxisModels,function(e){return s(e,`xAxis`,`xAxisIndex`)}),$c(o.yAxisModels,function(e){return s(e,`yAxis`,`yAxisIndex`)});function s(e,t,n){var a=e.componentIndex,o={type:`select`,$fromToolbox:!0,filterMode:r.get(`filterMode`,!0)||`filter`,id:el+t+a};o[n]=a,i.push(o)}return i});function sl(e){e.registerComponentModel(lc),e.registerComponentView(uc),sc(`saveAsImage`,pc),sc(`magicType`,gc),sc(`dataView`,Ac),sc(`dataZoom`,nl),sc(`restore`,zc),dr(ic)}var cl=function(e){z(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n.layoutMode={type:`box`,ignoreSize:!0},n}return t.type=`title`,t.defaultOption={z:6,show:!0,text:``,target:`blank`,subtext:``,subtarget:`blank`,left:`center`,top:R.size.m,backgroundColor:R.color.transparent,borderColor:R.color.primary,borderWidth:0,padding:5,itemGap:10,textStyle:{fontSize:18,fontWeight:`bold`,color:R.color.primary},subtextStyle:{fontSize:12,color:R.color.quaternary}},t}(gn),ll=function(e){z(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.render=function(e,t,n){if(this.group.removeAll(),e.get(`show`)){var r=this.group,i=e.getModel(`textStyle`),a=e.getModel(`subtextStyle`),o=e.get(`textAlign`),s=hr(e.get(`textBaseline`),e.get(`textVerticalAlign`)),c=new kr({style:Gr(i,{text:e.get(`text`),fill:i.getTextColor()},{disableBox:!0}),z2:10}),l=c.getBoundingRect(),u=e.get(`subtext`),d=new kr({style:Gr(a,{text:u,fill:a.getTextColor(),y:l.height+e.get(`itemGap`),verticalAlign:`top`},{disableBox:!0}),z2:10}),f=e.get(`link`),p=e.get(`sublink`),m=e.get(`triggerEvent`,!0);c.silent=!f&&!m,d.silent=!p&&!m,f&&c.on(`click`,function(){$t(f,`_`+e.get(`target`))}),p&&d.on(`click`,function(){$t(p,`_`+e.get(`subtarget`))}),vr(c).eventData=vr(d).eventData=m?{componentType:`title`,componentIndex:e.componentIndex}:null,r.add(c),u&&r.add(d);var h=r.getBoundingRect(),g=e.getBoxLayoutParams();g.width=h.width,g.height=h.height;var _=Wt(e,n),v=mn(g,_.refContainer,e.get(`padding`));o||(o=e.get(`left`)||e.get(`right`),o===`middle`&&(o=`center`),o===`right`?v.x+=v.width:o===`center`&&(v.x+=v.width/2)),s||(s=e.get(`top`)||e.get(`bottom`),s===`center`&&(s=`middle`),s===`bottom`?v.y+=v.height:s===`middle`&&(v.y+=v.height/2),s||=`top`),r.x=v.x,r.y=v.y,r.markRedraw();var y={align:o,verticalAlign:s};c.setStyle(y),d.setStyle(y),h=r.getBoundingRect();var b=v.margin,ee=e.getItemStyle([`color`,`opacity`]);ee.fill=e.get(`backgroundColor`);var x=new sr({shape:{x:h.x-b[3],y:h.y-b[0],width:h.width+b[1]+b[3],height:h.height+b[0]+b[2],r:e.get(`borderRadius`)},style:ee,subPixelOptimize:!0,silent:!0});r.add(x)}},t.type=`title`,t}(Jt);function ul(e){e.registerComponentModel(cl),e.registerComponentView(ll)}var dl=function(e){z(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n.layoutMode=`box`,n}return t.prototype.init=function(e,t,n){this.mergeDefaultAndTheme(e,n),this._initData()},t.prototype.mergeOption=function(t){e.prototype.mergeOption.apply(this,arguments),this._initData()},t.prototype.setCurrentIndex=function(e){e??=this.option.currentIndex;var t=this._data.count();this.option.loop?e=(e%t+t)%t:(e>=t&&(e=t-1),e<0&&(e=0)),this.option.currentIndex=e},t.prototype.getCurrentIndex=function(){return this.option.currentIndex},t.prototype.isIndexMax=function(){return this.getCurrentIndex()>=this._data.count()-1},t.prototype.setPlayState=function(e){this.option.autoPlay=!!e},t.prototype.getPlayState=function(){return!!this.option.autoPlay},t.prototype._initData=function(){var e=this.option,t=e.data||[],n=e.axisType,r=this._names=[],i;n===`category`?(i=[],L(t,function(e,t){var n=jr(Lr(e),``),a;Gn(e)?(a=Pn(e),a.value=t):a=t,i.push(a),r.push(n)})):i=t;var a={category:`ordinal`,time:`time`,value:`number`}[n]||`number`;(this._data=new nr([{name:`value`,type:a}],this)).initData(i,r)},t.prototype.getData=function(){return this._data},t.prototype.getCategories=function(){if(this.get(`axisType`)===`category`)return this._names.slice()},t.type=`timeline`,t.defaultOption={z:4,show:!0,axisType:`time`,realtime:!0,left:`20%`,top:null,right:`20%`,bottom:0,width:null,height:40,padding:R.size.m,controlPosition:`left`,autoPlay:!1,rewind:!1,loop:!0,playInterval:2e3,currentIndex:0,itemStyle:{},label:{color:R.color.secondary},data:[]},t}(gn),fl=function(e){z(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.type=`timeline.slider`,t.defaultOption=fn(dl.defaultOption,{backgroundColor:`rgba(0,0,0,0)`,borderColor:R.color.border,borderWidth:0,orient:`horizontal`,inverse:!1,tooltip:{trigger:`item`},symbol:`circle`,symbolSize:12,lineStyle:{show:!0,width:2,color:R.color.accent10},label:{position:`auto`,show:!0,interval:`auto`,rotate:0,color:R.color.tertiary},itemStyle:{color:R.color.accent20,borderWidth:0},checkpointStyle:{symbol:`circle`,symbolSize:15,color:R.color.accent50,borderColor:R.color.accent50,borderWidth:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,shadowColor:`rgba(0, 0, 0, 0)`,animation:!0,animationDuration:300,animationEasing:`quinticInOut`},controlStyle:{show:!0,showPlayBtn:!0,showPrevBtn:!0,showNextBtn:!0,itemSize:24,itemGap:12,position:`left`,playIcon:`path://M15 0C23.2843 0 30 6.71573 30 15C30 23.2843 23.2843 30 15 30C6.71573 30 0 23.2843 0 15C0 6.71573 6.71573 0 15 0ZM15 3C8.37258 3 3 8.37258 3 15C3 21.6274 8.37258 27 15 27C21.6274 27 27 21.6274 27 15C27 8.37258 21.6274 3 15 3ZM11.5 10.6699C11.5 9.90014 12.3333 9.41887 13 9.80371L20.5 14.1338C21.1667 14.5187 21.1667 15.4813 20.5 15.8662L13 20.1963C12.3333 20.5811 11.5 20.0999 11.5 19.3301V10.6699Z`,stopIcon:`path://M15 0C23.2843 0 30 6.71573 30 15C30 23.2843 23.2843 30 15 30C6.71573 30 0 23.2843 0 15C0 6.71573 6.71573 0 15 0ZM15 3C8.37258 3 3 8.37258 3 15C3 21.6274 8.37258 27 15 27C21.6274 27 27 21.6274 27 15C27 8.37258 21.6274 3 15 3ZM11.5 10C12.3284 10 13 10.6716 13 11.5V18.5C13 19.3284 12.3284 20 11.5 20C10.6716 20 10 19.3284 10 18.5V11.5C10 10.6716 10.6716 10 11.5 10ZM18.5 10C19.3284 10 20 10.6716 20 11.5V18.5C20 19.3284 19.3284 20 18.5 20C17.6716 20 17 19.3284 17 18.5V11.5C17 10.6716 17.6716 10 18.5 10Z`,nextIcon:`path://M0.838834 18.7383C0.253048 18.1525 0.253048 17.2028 0.838834 16.617L7.55635 9.89949L0.838834 3.18198C0.253048 2.59619 0.253048 1.64645 0.838834 1.06066C1.42462 0.474874 2.37437 0.474874 2.96015 1.06066L10.7383 8.83883L10.8412 8.95277C11.2897 9.50267 11.2897 10.2963 10.8412 10.8462L10.7383 10.9602L2.96015 18.7383C2.37437 19.3241 1.42462 19.3241 0.838834 18.7383Z`,prevIcon:`path://M10.9602 1.06066C11.5459 1.64645 11.5459 2.59619 10.9602 3.18198L4.24264 9.89949L10.9602 16.617C11.5459 17.2028 11.5459 18.1525 10.9602 18.7383C10.3744 19.3241 9.42462 19.3241 8.83883 18.7383L1.06066 10.9602L0.957771 10.8462C0.509245 10.2963 0.509245 9.50267 0.957771 8.95277L1.06066 8.83883L8.83883 1.06066C9.42462 0.474874 10.3744 0.474874 10.9602 1.06066Z`,prevBtnSize:18,nextBtnSize:18,color:R.color.accent50,borderColor:R.color.accent50,borderWidth:0},emphasis:{label:{show:!0,color:R.color.accent60},itemStyle:{color:R.color.accent60,borderColor:R.color.accent60},controlStyle:{color:R.color.accent70,borderColor:R.color.accent70}},progress:{lineStyle:{color:R.color.accent30},itemStyle:{color:R.color.accent40}},data:[]}),t}(dl);Qn(fl,Tn.prototype);var pl=function(e){z(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.type=`timeline`,t}(Jt),ml=function(e){z(t,e);function t(t,n,r,i){var a=e.call(this,t,n,r)||this;return a.type=i||`value`,a}return t.prototype.getLabelModel=function(){return this.model.getModel(`label`)},t.prototype.isHorizontal=function(){return this.model.get(`orient`)===`horizontal`},t}(Wn),hl=Math.PI,gl=gr(),_l=function(e){z(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.init=function(e,t){this.api=t},t.prototype.render=function(e,t,n){if(this.model=e,this.api=n,this.ecModel=t,this.group.removeAll(),e.get(`show`,!0)){var r=this._layout(e,n),i=this._createGroup(`_mainGroup`),a=this._createGroup(`_labelGroup`),o=this._axis=this._createAxis(r,e);e.formatTooltip=function(e){var t=o.scale.getLabel({value:e});return zr(`nameValue`,{noName:!0,value:t})},L([`AxisLine`,`AxisTick`,`Control`,`CurrentPointer`],function(t){this[`_render`+t](r,i,o,e)},this),this._renderAxisLabel(r,a,o,e),this._position(r,e)}this._doPlayStop(),this._updateTicksStatus()},t.prototype.remove=function(){this._clearTimer(),this.group.removeAll()},t.prototype.dispose=function(){this._clearTimer()},t.prototype._layout=function(e,t){var n=e.get([`label`,`position`]),r=e.get(`orient`),i=vl(e,t),a=n==null||n===`auto`?r===`horizontal`?i.y+i.height/2<t.getHeight()/2?`-`:`+`:i.x+i.width/2<t.getWidth()/2?`+`:`-`:fr(n)?{horizontal:{top:`-`,bottom:`+`},vertical:{left:`-`,right:`+`}}[r][n]:n,o={horizontal:`center`,vertical:a>=0||a===`+`?`left`:`right`},s={horizontal:a>=0||a===`+`?`top`:`bottom`,vertical:`middle`},c={horizontal:0,vertical:hl/2},l=r===`vertical`?i.height:i.width,u=e.getModel(`controlStyle`),d=u.get(`show`,!0),f=d?u.get(`itemSize`):0,p=d?u.get(`itemGap`):0,m=f+p,h=e.get([`label`,`rotate`])||0;h=h*hl/180;var g,_,v,y=u.get(`position`,!0),b=d&&u.get(`showPlayBtn`,!0),ee=d&&u.get(`showPrevBtn`,!0),x=d&&u.get(`showNextBtn`,!0),S=0,C=l;y===`left`||y===`bottom`?(b&&(g=[0,0],S+=m),ee&&(_=[S,0],S+=m),x&&(v=[C-f,0],C-=m)):(b&&(g=[C-f,0],C-=m),ee&&(_=[0,0],S+=m),x&&(v=[C-f,0],C-=m));var te=[S,C];return e.get(`inverse`)&&te.reverse(),{viewRect:i,mainLength:l,orient:r,rotation:c[r],labelRotation:h,labelPosOpt:a,labelAlign:e.get([`label`,`align`])||o[r],labelBaseline:e.get([`label`,`verticalAlign`])||e.get([`label`,`baseline`])||s[r],playPosition:g,prevBtnPosition:_,nextBtnPosition:v,axisExtent:te,controlSize:f,controlGap:p}},t.prototype._position=function(e,t){var n=this._mainGroup,r=this._labelGroup,i=e.viewRect;if(e.orient===`vertical`){var a=kn(),o=i.x,s=i.y+i.height;On(a,a,[-o,-s]),an(a,a,-hl/2),On(a,a,[o,s]),i=i.clone(),i.applyTransform(a)}var c=g(i),l=g(n.getBoundingRect()),u=g(r.getBoundingRect()),d=[n.x,n.y],f=[r.x,r.y];f[0]=d[0]=c[0][0];var p=e.labelPosOpt;if(p==null||fr(p)){var m=p===`+`?0:1;_(d,l,c,1,m),_(f,u,c,1,1-m)}else{var m=p>=0?0:1;_(d,l,c,1,m),f[1]=d[1]+p}n.setPosition(d),r.setPosition(f),n.rotation=r.rotation=e.rotation,h(n),h(r);function h(e){e.originX=c[0][0]-e.x,e.originY=c[1][0]-e.y}function g(e){return[[e.x,e.x+e.width],[e.y,e.y+e.height]]}function _(e,t,n,r,i){e[r]+=n[r][i]-t[r][i]}},t.prototype._createAxis=function(e,t){var n=t.getData(),r=t.get(`axisType`)||t.get(`type`);r!==`category`&&r!==`time`&&(r=`value`);var i=Zn(t,r,!1);i.getTicks=function(){return n.mapArray([`value`],function(e){return{value:e}})};var a=n.getDataExtent(`value`);i.setExtent(a[0],a[1]),Fr(i,{fixMinMax:[!0,!0]});var o=new ml(`value`,i,e.axisExtent,r);return o.model=t,o},t.prototype._createGroup=function(e){var t=this[e]=new Xt;return this.group.add(t),t},t.prototype._renderAxisLine=function(e,t,n,r){var i=n.getExtent();if(r.get([`lineStyle`,`show`])){var a=new Mn({shape:{x1:i[0],y1:0,x2:i[1],y2:0},style:Yn({lineCap:`round`},r.getModel(`lineStyle`).getLineStyle()),silent:!0,z2:1});t.add(a);var o=this._progressLine=new Mn({shape:{x1:i[0],x2:this._currentPointer?this._currentPointer.x:i[0],y1:0,y2:0},style:bn({lineCap:`round`,lineWidth:a.style.lineWidth},r.getModel([`progress`,`lineStyle`]).getLineStyle()),silent:!0,z2:1});t.add(o)}},t.prototype._renderAxisTick=function(e,t,n,r){var i=this,a=r.getData(),o=n.scale.getTicks();this._tickSymbols=[],L(o,function(e){var o=n.dataToCoord(e.value),s=a.getItemModel(e.value),c=s.getModel(`itemStyle`),l=s.getModel([`emphasis`,`itemStyle`]),u=s.getModel([`progress`,`itemStyle`]),d=bl(s,c,t,{x:o,y:0,onclick:ln(i._changeTimeline,i,e.value)});d.ensureState(`emphasis`).style=l.getItemStyle(),d.ensureState(`progress`).style=u.getItemStyle(),Ut(d);var f=vr(d);s.get(`tooltip`)?(f.dataIndex=e.value,f.dataModel=r):f.dataIndex=f.dataModel=null,i._tickSymbols.push(d)})},t.prototype._renderAxisLabel=function(e,t,n,r){var i=this;if(n.getLabelModel().get(`show`)){var a=r.getData(),o=n.getViewLabels();this._tickLabels=[],L(o,function(r){if(!r.tick.offInterval){var o=r.tick.value,s=a.getItemModel(o),c=s.getModel(`label`),l=s.getModel([`emphasis`,`label`]),u=s.getModel([`progress`,`label`]),d=n.dataToCoord(o),f=new kr({x:d,y:0,rotation:e.labelRotation-e.rotation,onclick:ln(i._changeTimeline,i,o),silent:!1,style:Gr(c,{text:r.formattedLabel,align:e.labelAlign,verticalAlign:e.labelBaseline})});f.ensureState(`emphasis`).style=Gr(l),f.ensureState(`progress`).style=Gr(u),t.add(f),Ut(f),gl(f).dataIndex=o,i._tickLabels.push(f)}})}},t.prototype._renderControl=function(e,t,n,r){var i=e.controlSize,a=e.rotation,o=r.getModel(`controlStyle`).getItemStyle(),s=r.getModel([`emphasis`,`controlStyle`]).getItemStyle(),c=r.getPlayState(),l=r.get(`inverse`,!0);u(e.nextBtnPosition,`next`,ln(this._changeTimeline,this,l?`-`:`+`)),u(e.prevBtnPosition,`prev`,ln(this._changeTimeline,this,l?`+`:`-`)),u(e.playPosition,c?`stop`:`play`,ln(this._handlePlayClick,this,!c),!0);function u(e,n,c,l){if(e){var u=ur(hr(r.get([`controlStyle`,n+`BtnSize`]),i),i),d=[0,-u/2,u,u],f=yl(r,n+`Icon`,d,{x:e[0],y:e[1],originX:i/2,originY:0,rotation:l?-a:0,rectHover:!0,style:o,onclick:c});f.ensureState(`emphasis`).style=s,t.add(f),Ut(f)}}},t.prototype._renderCurrentPointer=function(e,t,n,r){var i=r.getData(),a=r.getCurrentIndex(),o=i.getItemModel(a).getModel(`checkpointStyle`),s=this,c={onCreate:function(e){e.draggable=!0,e.drift=ln(s._handlePointerDrag,s),e.ondragend=ln(s._handlePointerDragend,s),xl(e,s._progressLine,a,n,r,!0)},onUpdate:function(e){xl(e,s._progressLine,a,n,r)}};this._currentPointer=bl(o,o,this._mainGroup,{},this._currentPointer,c)},t.prototype._handlePlayClick=function(e){this._clearTimer(),this.api.dispatchAction({type:`timelinePlayChange`,playState:e,from:this.uid})},t.prototype._handlePointerDrag=function(e,t,n){this._clearTimer(),this._pointerChangeTimeline([n.offsetX,n.offsetY])},t.prototype._handlePointerDragend=function(e){this._pointerChangeTimeline([e.offsetX,e.offsetY],!0)},t.prototype._pointerChangeTimeline=function(e,t){var n=this._toAxisCoord(e)[0],r=this._axis,i=Rr(r.getExtent().slice());n>i[1]&&(n=i[1]),n<i[0]&&(n=i[0]),this._currentPointer.x=n,this._currentPointer.markRedraw();var a=this._progressLine;a&&(a.shape.x2=n,a.dirty());var o=this._findNearestTick(n),s=this.model;(t||o!==s.getCurrentIndex()&&s.get(`realtime`))&&this._changeTimeline(o)},t.prototype._doPlayStop=function(){var e=this;this._clearTimer(),this.model.getPlayState()&&(this._timer=setTimeout(function(){var t=e.model;e._changeTimeline(t.getCurrentIndex()+(t.get(`rewind`,!0)?-1:1))},this.model.get(`playInterval`)))},t.prototype._toAxisCoord=function(e){var t=this._mainGroup.getLocalTransform();return rn(e,t,!0)},t.prototype._findNearestTick=function(e){var t=this.model.getData(),n=1/0,r,i=this._axis;return t.each([`value`],function(t,a){var o=i.dataToCoord(t),s=Math.abs(o-e);s<n&&(n=s,r=a)}),r},t.prototype._clearTimer=function(){this._timer&&=(clearTimeout(this._timer),null)},t.prototype._changeTimeline=function(e){var t=this.model.getCurrentIndex();e===`+`?e=t+1:e===`-`&&(e=t-1),this.api.dispatchAction({type:`timelineChange`,currentIndex:e,from:this.uid})},t.prototype._updateTicksStatus=function(){var e=this.model.getCurrentIndex(),t=this._tickSymbols,n=this._tickLabels;if(t)for(var r=0;r<t.length;r++)t&&t[r]&&t[r].toggleState(`progress`,r<e);if(n)for(var r=0;r<n.length;r++)n&&n[r]&&n[r].toggleState(`progress`,gl(n[r]).dataIndex<=e)},t.type=`timeline.slider`,t}(pl);function vl(e,t){return mn(e.getBoxLayoutParams(),Wt(e,t).refContainer,e.get(`padding`))}function yl(e,t,n,r){var i=r.style,a=An(e.get([`controlStyle`,t]),r||{},new en(n[0],n[1],n[2],n[3]));return i&&a.setStyle(i),a}function bl(e,t,n,r,i,a){var o=t.get(`color`);if(i)i.setColor(o),n.add(i),a&&a.onUpdate(i);else{var s=e.get(`symbol`);i=Ur(s,-1,-1,2,2,o),i.setStyle(`strokeNoScale`,!0),n.add(i),a&&a.onCreate(i)}var c=t.getItemStyle([`color`]);i.setStyle(c),r=qn({rectHover:!0,z2:100},r,!0);var l=Vr(e.get(`symbolSize`));r.scaleX=l[0]/2,r.scaleY=l[1]/2;var u=Hn(e.get(`symbolOffset`),l);u&&(r.x=(r.x||0)+u[0],r.y=(r.y||0)+u[1]);var d=e.get(`symbolRotate`);return r.rotation=(d||0)*Math.PI/180||0,i.attr(r),i.updateTransform(),i}function xl(e,t,n,r,i,a){if(!e.dragging){var o=i.getModel(`checkpointStyle`),s=r.dataToCoord(i.getData().get(`value`,n));if(a||!o.get(`animation`,!0))e.attr({x:s,y:0}),t&&t.attr({shape:{x2:s}});else{var c={duration:o.get(`animationDuration`,!0),easing:o.get(`animationEasing`,!0)};e.stopAnimation(null,!0),e.animateTo({x:s,y:0},c),t&&t.animateTo({shape:{x2:s}},c)}}}function Sl(e){e.registerAction({type:`timelineChange`,event:`timelineChanged`,update:`prepareAndUpdate`},function(e,t,n){var r=t.getComponent(`timeline`);return r&&e.currentIndex!=null&&(r.setCurrentIndex(e.currentIndex),!r.get(`loop`,!0)&&r.isIndexMax()&&r.getPlayState()&&(r.setPlayState(!1),n.dispatchAction({type:`timelinePlayChange`,playState:!1,from:e.from}))),t.resetOption(`timeline`,{replaceMerge:r.get(`replaceMerge`,!0)}),bn({currentIndex:r.option.currentIndex},e)}),e.registerAction({type:`timelinePlayChange`,event:`timelinePlayChanged`,update:`update`},function(e,t){var n=t.getComponent(`timeline`);n&&e.playState!=null&&n.setPlayState(e.playState)})}function Cl(e){var t=e&&e.timeline;or(t)||(t=t?[t]:[]),L(t,function(e){e&&wl(e)})}function wl(e){var t=e.type,n={number:`value`,time:`time`};if(n[t]&&(e.axisType=n[t],delete e.type),Tl(e),El(e,`controlPosition`)){var r=e.controlStyle||={};El(r,`position`)||(r.position=e.controlPosition),r.position===`none`&&!El(r,`show`)&&(r.show=!1,delete r.position),delete e.controlPosition}L(e.data||[],function(e){Gn(e)&&!or(e)&&(!El(e,`value`)&&El(e,`name`)&&(e.value=e.name),Tl(e))})}function Tl(e){var t=e.itemStyle||={},n=t.emphasis||={},r=e.label||e.label||{},i=r.normal||={},a={normal:1,emphasis:1};L(r,function(e,t){!a[t]&&!El(i,t)&&(i[t]=e)}),n.label&&!El(r,`emphasis`)&&(r.emphasis=n.label,delete n.label)}function El(e,t){return e.hasOwnProperty(t)}function Dl(e){e.registerComponentModel(fl),e.registerComponentView(_l),e.registerSubTypeDefaulter(`timeline`,function(){return`slider`}),Sl(e),e.registerPreprocessor(Cl)}var Ol=new URL(`echarts-BDq-rBJC.png`,import.meta.url).href;c(),dr([Dl,sl,ul,_r,ar,yr,Mr]);var Z={paper:{height:`100%`,maxHeight:`100%`,maxWidth:`100%`,overflow:`hidden`,width:`100%`},chart:{width:`100%`,overflow:`hidden`},chartWithToolbar:e=>({height:`calc(100% - ${parseInt(e.mixins.toolbar.minHeight,10)+8}px)`}),chartWithoutToolbar:{height:`100%`},selectHistoryControl:{width:130},selectRelativeTime:{marginLeft:10,width:200},notAliveInstance:{opacity:.5},customRange:e=>({color:e.palette.primary.main}),splitLineButtonIcon:{marginRight:8},grow:{flexGrow:1},toolbarDate:{width:108,mt:`6px`,"& fieldset":{display:`none`},"& input":{padding:`6px 0 0 0`,fontSize:`0.875rem`},"& .MuiInputAdornment-root":{ml:0,mt:`5px`},"& .MuiIconButton-root":{padding:`2px`},"& .MuiSvgIcon-root":{fontSize:`1.125rem`}},toolbarTime:{width:92,mt:`6px`,"& fieldset":{display:`none`},"& input":{padding:`6px 0 0 0`,fontSize:`0.875rem`},"& .MuiInputAdornment-root":{ml:0,mt:`5px`},"& .MuiIconButton-root":{padding:`2px`},"& .MuiSvgIcon-root":{fontSize:`1.125rem`}},toolbarTimeLabel:{position:`absolute`,padding:8,fontSize:`0.8rem`,left:2,top:-9},toolbarTimeGrid:{position:`relative`,marginLeft:8,paddingLeft:8,paddingRight:8,paddingTop:4,paddingBottom:4,border:`1px dotted #AAAAAA`,borderRadius:8,display:`flex`},buttonIcon:{width:24,height:24},echartsButton:{marginRight:8,height:34,width:34}},kl=80,Al=25,jl=class extends Le{constructor(e){if(super(e),u(this,`echartsReact`,void 0),u(this,`rangeRef`,void 0),u(this,`readTimeout`,null),u(this,`chartValues`,void 0),u(this,`rangeValues`,void 0),u(this,`subscribes`,void 0),u(this,`unit`,void 0),u(this,`divRef`,void 0),u(this,`chart`,void 0),u(this,`timerResize`,null),u(this,`updateTimer`,null),u(this,`minY`,void 0),u(this,`maxY`,void 0),u(this,`timeTimer`,null),u(this,`maxYLenTimeout`,null),u(this,`mouseDown`,!1),u(this,`start`,void 0),u(this,`end`,void 0),u(this,`localStorage`,void 0),u(this,`onResize`,()=>{this.timerResize&&clearTimeout(this.timerResize),this.timerResize=setTimeout(()=>{this.timerResize=null,this.setState({windowWidth:window.innerWidth}),this.componentDidUpdate()})}),u(this,`onChange`,(e,t)=>{if(e===this.props.obj._id&&t&&this.rangeValues&&(!this.rangeValues.length||this.rangeValues[this.rangeValues.length-1].ts<t.ts))(!this.state.max||t.ts-this.state.max<12e4)&&(this.chartValues&&this.chartValues.push({val:t.val,ts:t.ts}),this.rangeValues.push({val:t.val,ts:t.ts}),t.ts>=this.chart.min&&t.ts<=this.chart.max+3e5&&this.updateChart());else if(e.startsWith(`system.adapter.`)&&e.endsWith(`.alive`)&&this.state.historyInstances){let n=e.substring(15,e.length-6),r=this.state.historyInstances,i=r.findIndex(e=>e.id===n);if(i!==-1&&r[i].alive!==!!(t!=null&&t.val)){let e=JSON.parse(JSON.stringify(r));e[i].alive=!!(t!=null&&t.val),this.setState({historyInstances:e},()=>{e[i].alive&&this.state.historyInstance===n&&this.readHistoryRange().then(()=>this.updateChart())})}}}),this.localStorage=window._localStorage||window.localStorage,this.props.from)this.start=this.props.from;else{let e=new Date;e.setHours(e.getHours()-168),this.start=e.getTime()}this.end=this.props.end?this.props.end:Date.now();let t=this.localStorage.getItem(`App.relativeRange`)||`30`,n=parseInt(this.localStorage.getItem(`App.absoluteStart`)||``,10)||0,i=parseInt(this.localStorage.getItem(`App.absoluteEnd`)||``,10)||0;n&&i||t&&t!==`absolute`||(t=`30`),i&&n&&(t=`absolute`),this.state={historyInstance:this.props.historyInstance||``,historyInstances:null,defaultHistory:``,chartHeight:300,chartWidth:500,windowWidth:window.innerWidth,ampm:!1,relativeRange:t,splitLine:this.localStorage.getItem(`App.splitLine`)===`true`,min:n,max:i,maxYLen:0,stepType:``,echartsJump:!1},this.echartsReact=null,this.rangeRef=r(),this.readTimeout=null,this.chartValues=null,this.rangeValues=null,this.subscribes=[],this.unit=this.props.obj.common&&this.props.obj.common.unit?` ${this.props.obj.common.unit}`:``,this.divRef=r(),this.chart={min:0,max:0}}componentDidMount(){this.props.socket.subscribeState(this.props.obj._id,this.onChange),window.addEventListener(`resize`,this.onResize),this.prepareData().then(async()=>{this.props.noToolbar||await this.readHistoryRange()}).then(()=>this.setRelativeInterval(this.state.relativeRange,!0,()=>this.forceUpdate()))}componentWillUnmount(){this.readTimeout&&=(clearTimeout(this.readTimeout),null),this.timeTimer&&=(clearTimeout(this.timeTimer),null),this.maxYLenTimeout&&=(clearTimeout(this.maxYLenTimeout),null),this.timerResize&&=(clearTimeout(this.timerResize),null),this.updateTimer&&=(clearTimeout(this.updateTimer),null),this.echartsReact&&this.echartsReact.getEchartsInstance().dispose();for(let e=0;e<this.subscribes.length;e++)this.props.socket.unsubscribeState(this.subscribes[e],this.onChange);this.subscribes=[],this.props.socket.unsubscribeState(this.props.obj._id,this.onChange),window.removeEventListener(`resize`,this.onResize)}async prepareData(){var e,t;if(this.props.noToolbar){let e=this.props.defaultHistory&&await this.props.socket.getState(`system.adapter.${this.props.defaultHistory}.alive`);this.subscribes.length||(this.subscribes=[`system.adapter.${this.props.defaultHistory}.alive`],await this.props.socket.subscribeState(`system.adapter.${this.props.defaultHistory}.alive`,this.onChange)),await new Promise(t=>{this.setState({defaultHistory:this.props.defaultHistory||``,historyInstance:this.props.defaultHistory||``,historyInstances:[{id:this.props.defaultHistory||``,alive:!!(e!=null&&e.val)}]},()=>t(null))});return}let n=await this.getHistoryInstances(),r=await this.props.socket.getCompactSystemConfig(),i=[];this.props.showJumpToEchart&&(i=await this.props.socket.getAdapterInstances(`echarts`,!0));let a=!!i.find(e=>e._id.startsWith(`system.adapter.echarts.`)),o=r==null||(e=r.common)==null?void 0:e.defaultHistory;this.props.obj.common.custom&&(n=n.filter(e=>{var t;return(t=this.props.obj.common.custom)==null?void 0:t[e.id]}));let s=this.localStorage.getItem(`App.historyInstance`)||``;if(s&&n.find(e=>e.id===s&&e.alive)||(s=o),!s||!n.find(e=>e.id===s&&e.alive)){let e=n.find(e=>e.alive);e&&(s=e.id)}!s&&n.length&&(s=o),this.setState({ampm:r.common.dateFormat.includes(`/`),historyInstances:n,defaultHistory:o,historyInstance:s,echartsJump:a,stepType:this.props.obj.common.custom&&((t=this.props.obj.common.custom[s])==null?void 0:t.chartStep)||``})}getHistoryInstances(){var e;if(this.props.historyInstance)return Promise.resolve([]);let t=[],n=[];return(e=this.props.customsInstances)==null||e.forEach(e=>{var r;let i=this.props.objects[`system.adapter.${e}`];if(i!=null&&(r=i.common)!=null&&r.getHistory){let r={id:e,alive:!1};t.push(r),n.push(`system.adapter.${e}.alive`)}}),n.length?this.props.socket.getForeignStates(n).then(async e=>{Object.keys(e).forEach(n=>{let r=t.find(e=>n.endsWith(`${e.id}.alive`));if(r){var i;r.alive=!!((i=e[n])!=null&&i.val)}}),this.subscribes=n;for(let e=0;e<n.length;e++)await this.props.socket.subscribeState(n[e],this.onChange);return t}):Promise.resolve(t)}readHistoryRange(){var e;let t=new Date,n=new Date(2e3,0,1);return(e=this.state.historyInstances)!=null&&e.find(e=>e.id===this.state.historyInstance&&e.alive)?this.props.socket.getHistory(this.props.obj._id,{instance:this.state.historyInstance,start:n.getTime(),end:t.getTime(),limit:1,from:!1,ack:!1,q:!1,addId:!1,aggregate:`none`}).then(e=>{var t;e&&((t=e[0])==null?void 0:t.val)===null&&e.shift(),this.rangeValues=e}):Promise.resolve()}readHistory(e,t){var n;if(!this.state.historyInstance||!((n=this.state.historyInstances)!=null&&n.find(e=>e.id===this.state.historyInstance&&e.alive)))return Promise.resolve([]);let r={instance:this.state.historyInstance,start:e,end:t,from:!1,ack:!1,q:!1,addId:!1,aggregate:`none`,returnNewestEntries:!0};return(t||0)-(e||0)>144e4&&!(this.props.obj.common.type===`boolean`||this.props.obj.common.type===`number`&&this.props.obj.common.states)&&(r.aggregate=`minmax`),this.props.socket.getHistory(this.props.obj._id,r).then(e=>{let t=[],n=0,r=this.rangeValues,i=null,a=null;for(let o=0;o<e.length;o++){if(r)for(;n<r.length&&r[n].ts<e[o].ts;)t.push(r[n]),n++;!t.length||t[t.length-1].ts<e[o].ts?t.push(e[o]):t[t.length-1].ts===e[o].ts&&t[t.length-1].val!==e[o].ts&&console.error(`Strange data!`),(i===null||e[o].val<i)&&(i=e[o].val),(a===null||e[o].val>a)&&(a=e[o].val)}if(r)for(;n<r.length;)t.push(r[n]),console.log(`add range ${new Date(r[n].ts).toISOString()}: ${r[n].val}`),n++;return t.sort((e,t)=>e.ts>t.ts?1:e.ts<t.ts?-1:0),this.chartValues=t,this.minY=i,this.maxY=a,this.minY=this.minY<10?Math.round(this.minY*10)/10:Math.ceil(this.minY),this.maxY=this.maxY<10?Math.round(this.maxY*10)/10:Math.ceil(this.maxY||0),t})}convertData(e){e=e||this.chartValues||[];let t=[];if(!e.length)return[];for(let n=0;n<e.length;n++){let r={value:[e[n].ts,e[n].val]};e[n].i&&(r.exact=!1),t.push(r)}return this.chart.min||(this.chart.min=e[0].ts,this.chart.max=e[e.length-1].ts),t}getOption(){let e=0;if(this.minY!==null&&this.minY!==void 0&&(e=(this.minY.toString()+this.unit).length*9+12),this.maxY!==null&&this.maxY!==void 0){let t=(this.maxY.toString()+this.unit).length*9+12;t>e&&(e=t)}if(this.state.maxYLen){let t=this.state.maxYLen*9+12;t>e&&(e=t)}let t={xAxisIndex:0,type:`line`,step:this.state.stepType===`stepStart`?`end`:this.state.stepType===`stepMiddle`?`middle`:this.state.stepType===`stepEnd`?`start`:void 0,showSymbol:!1,hoverAnimation:!0,animation:!1,data:this.convertData(),lineStyle:{color:`#4dabf5`},areaStyle:{}},n={type:`value`,boundaryGap:[0,`100%`],splitLine:{show:this.props.noToolbar||!!this.state.splitLine},splitNumber:Math.round(this.state.chartHeight/50),axisLabel:{formatter:e=>{let t;return t=this.props.isFloatComma?e.toString().replace(`,`,`.`)+this.unit:e+this.unit,this.state.maxYLen<t.length&&(this.maxYLenTimeout&&clearTimeout(this.maxYLenTimeout),this.maxYLenTimeout=setTimeout(e=>{this.maxYLenTimeout=null,this.setState({maxYLen:e})},200,t.length)),t},showMaxLabel:!0,showMinLabel:!0},axisTick:{alignWithLabel:!0}};if(this.props.obj.common.type===`boolean`)t.step=`end`,n.axisLabel=n.axisLabel||{},n.axisLabel.showMaxLabel=!1,n.axisLabel.formatter=e=>e===1?`TRUE`:`FALSE`,n.max=1.5,n.interval=1,e=50;else if(this.props.obj.common.type===`number`&&this.props.obj.common.states){t.step=`end`,n.axisLabel=n.axisLabel||{},n.axisLabel.showMaxLabel=!1;let r=this.props.obj.common.states;n.axisLabel.formatter=e=>r[e]===void 0?e:r[e];let i=Object.keys(this.props.obj.common.states);i.sort(),n.max=parseFloat(i[i.length-1])+.5,n.interval=1;let a=``;for(let e=0;e<i.length;e++)typeof r[i[e]]==`string`&&r[i[e]].length>a.length&&(a=r[i[e]]);e=(a.length*9||50)+12}let r=this.chart.withSeconds?Math.round((this.state.chartWidth-Al-kl)/100):Math.round((this.state.chartWidth-Al-kl)/60);return{backgroundColor:`transparent`,title:{text:this.props.noToolbar?``:m.getObjectNameFromObj(this.props.obj,this.props.lang),padding:[10,0,0,e?e+10:90]},grid:{left:e||kl,top:8,right:this.props.noToolbar?5:Al,bottom:40},tooltip:{trigger:`axis`,formatter:e=>{let t=e[0],n=new Date(t.value[0]),r=t.value[1];return r!==null&&this.props.isFloatComma&&(r=r.toString().replace(`.`,`,`)),`${t.exact===!1?`i`:``}${n.toLocaleString()}.${n.getMilliseconds().toString().padStart(3,`0`)}: ${r}${this.unit}`},axisPointer:{animation:!0}},xAxis:{splitLine:{show:!1},splitNumber:r,min:this.chart.min,max:this.chart.max,axisTick:{alignWithLabel:!0},axisLabel:{formatter:e=>{let t=new Date(e);return this.chart.withSeconds?`${t.getHours().toString().padStart(2,`0`)}:${t.getMinutes().toString().padStart(2,`0`)}:${t.getSeconds().toString().padStart(2,`0`)}`:this.chart.withTime?`${t.getHours().toString().padStart(2,`0`)}:${t.getMinutes().toString().padStart(2,`0`)}\n${t.getDate().toString().padStart(2,`0`)}.${(t.getMonth()+1).toString().padStart(2,`0`)}`:`${t.getDate().toString().padStart(2,`0`)}.${(t.getMonth()+1).toString().padStart(2,`0`)}\n${t.getFullYear()}`}}},yAxis:n,toolbox:{left:`right`,feature:this.props.noToolbar?void 0:{saveAsImage:{title:this.props.t(`Save as image`),show:!0}}},series:[t]}}static getDerivedStateFromProps(e,t){return null}updateChart(e,t,n,r){e&&(this.start=e),t&&(this.end=t),e||=this.start,t||=this.end,this.readTimeout&&clearTimeout(this.readTimeout),this.readTimeout=setTimeout(()=>{this.readTimeout=null;let i=this.chart.max-this.chart.min;if(i!==this.chart.diff&&(this.chart.diff=i,this.chart.withTime=this.chart.diff<6048e5,this.chart.withSeconds=this.chart.diff<18e5),n)this.readHistory(e,t).then(e=>{var t;typeof((t=this.echartsReact)==null?void 0:t.getEchartsInstance)==`function`&&this.echartsReact.getEchartsInstance().setOption({series:[{data:this.convertData(e)}],xAxis:{min:this.chart.min,max:this.chart.max}}),r&&r()});else{var a;typeof((a=this.echartsReact)==null?void 0:a.getEchartsInstance)==`function`&&this.echartsReact.getEchartsInstance().setOption({series:[{data:this.convertData()}],xAxis:{min:this.chart.min,max:this.chart.max}}),r&&r()}},400)}setNewRange(e){var t;this.chart.diff=this.chart.max-this.chart.min,this.chart.withTime=this.chart.diff<6048e5,this.chart.withSeconds=this.chart.diff<18e5,this.state.relativeRange===`absolute`?typeof((t=this.echartsReact)==null?void 0:t.getEchartsInstance)==`function`&&(this.echartsReact.getEchartsInstance().setOption({xAxis:{min:this.chart.min,max:this.chart.max}}),e&&this.updateChart(this.chart.min,this.chart.max,!0)):(this.setState({relativeRange:`absolute`}),this.timeTimer&&=(clearTimeout(this.timeTimer),null))}shiftTime(){let e=new Date,t=6e4-e.getSeconds()-(1e3-e.getMilliseconds());e.getMilliseconds()&&e.setMilliseconds(1e3),e.getSeconds()&&e.setSeconds(60);let n=e.getTime(),r,i=this.state.relativeRange;if(i===`day`)e.setHours(0),e.setMinutes(0),e.setSeconds(0),r=e.getTime();else if(i===`week`){e.setHours(0),e.setMinutes(0),e.setSeconds(0);let t=e.getDay()||7;t!==1&&e.setHours(-24*(t-1)),r=e.getTime()}else if(i===`2weeks`){e.setHours(0),e.setMinutes(0),e.setSeconds(0),e.setDate(e.getDate()-7);let t=e.getDay()||7;t!==1&&e.setHours(-24*(t-1)),r=e.getTime()}else i===`month`?(e.setHours(0),e.setMinutes(0),e.setSeconds(0),e.setDate(1),r=e.getTime()):i===`year`?(e.setHours(0),e.setMinutes(0),e.setSeconds(0),e.setDate(1),e.setMonth(0),r=e.getTime()):i===`12months`?(e.setHours(0),e.setMinutes(0),e.setSeconds(0),e.setFullYear(e.getFullYear()-1),r=e.getTime()):r=n-parseInt(i,10)*6e4;this.chart.min=r,this.chart.max=n,this.setState({min:r,max:n},()=>this.updateChart(this.chart.min,this.chart.max,!0)),this.timeTimer=setTimeout(()=>{this.timeTimer=null,this.shiftTime()},t||6e4)}setRelativeInterval(e,t,n){if(t||(this.localStorage.setItem(`App.relativeRange`,e),this.setState({relativeRange:e})),e===`absolute`){this.timeTimer&&=(clearTimeout(this.timeTimer),null),this.updateChart(this.chart.min,this.chart.max,!0,n);return}this.localStorage.removeItem(`App.absoluteStart`),this.localStorage.removeItem(`App.absoluteEnd`);let r=new Date;if(!this.timeTimer){let e=6e4-r.getSeconds()-(1e3-r.getMilliseconds());this.timeTimer=setTimeout(()=>{this.timeTimer=null,this.shiftTime()},e||6e4)}if(r.getMilliseconds()&&r.setMilliseconds(1e3),r.getSeconds()&&r.setSeconds(60),this.chart.max=r.getTime(),e===`day`)r.setHours(0),r.setMinutes(0),r.setSeconds(0),this.chart.min=r.getTime();else if(e===`week`){r.setHours(0),r.setMinutes(0),r.setSeconds(0);let e=r.getDay()||7;e!==1&&r.setHours(-24*(e-1)),this.chart.min=r.getTime()}else if(e===`2weeks`){r.setHours(0),r.setMinutes(0),r.setSeconds(0),r.setDate(r.getDate()-7);let e=r.getDay()||7;e!==1&&r.setHours(-24*(e-1)),this.chart.min=r.getTime()}else e===`month`?(r.setHours(0),r.setMinutes(0),r.setSeconds(0),r.setDate(1),this.chart.min=r.getTime()):e===`year`?(r.setHours(0),r.setMinutes(0),r.setSeconds(0),r.setDate(1),r.setMonth(0),this.chart.min=r.getTime()):e===`12months`?(r.setHours(0),r.setMinutes(0),r.setSeconds(0),r.setFullYear(r.getFullYear()-1),this.chart.min=r.getTime()):this.chart.min=this.chart.max-parseInt(e,10)*6e4;this.setState({min:this.chart.min,max:this.chart.max},()=>this.updateChart(this.chart.min,this.chart.max,!0,n))}installEventHandlers(){if(!this.echartsReact||typeof this.echartsReact.getEchartsInstance!=`function`)return;let e=this.echartsReact.getEchartsInstance().getZr();e._iobInstalled||(e._iobInstalled=!0,e.on(`mousedown`,e=>{console.log(`mouse down`),this.mouseDown=!0,this.chart.lastX=e.offsetX}),e.on(`mouseup`,()=>{console.log(`mouse up`),this.mouseDown=!1,this.setNewRange(!0)}),e.on(`mousewheel`,e=>{let t=this.chart.max-this.chart.min,n=this.state.chartWidth-Al-kl,r=(e.offsetX-kl)/n,i=t,a=e.wheelDelta>0?1.1:.9;t*=a;let o=i-t;this.chart.max+=o*(1-r),this.chart.min-=o*r,this.setNewRange()}),e.on(`mousemove`,e=>{if(this.mouseDown){let t=(this.chart.lastX||0)-(e.offsetX-kl);this.chart.lastX=e.offsetX-kl;let n=this.chart.max-this.chart.min,r=this.state.chartWidth-Al-kl,i=Math.round(t*n/r);this.chart.min+=i,this.chart.max+=i,this.setNewRange()}}),e.on(`touchstart`,e=>{e.preventDefault(),this.mouseDown=!0;let t=e.touches||e.originalEvent.touches;t&&(this.chart.lastX=t[t.length-1].pageX,t.length>1?this.chart.lastWidth=Math.abs(t[0].pageX-t[1].pageX):this.chart.lastWidth=void 0)}),e.on(`touchend`,e=>{e.preventDefault(),this.mouseDown=!1,this.setNewRange(!0)}),e.on(`touchmove`,e=>{e.preventDefault();let t=e.touches||e.originalEvent.touches;if(!t)return;let n=t[t.length-1].pageX-kl;if(this.mouseDown){if(t.length>1){let e=Math.abs(t[0].pageX-t[1].pageX);if(this.chart.lastWidth!==void 0&&e!==this.chart.lastWidth){let n=this.chart.max-this.chart.min,r=this.state.chartWidth-Al-kl,i=e>(this.chart.lastWidth||0)?1.1:.9,a=(t[0].pageX>t[1].pageX?t[1].pageX-kl+e/2:t[0].pageX-kl+e/2)/r,o=n;n*=i;let s=o-n;this.chart.max+=s*(1-a),this.chart.min-=s*a,this.setNewRange()}this.chart.lastWidth=e}else{let e=(this.chart.lastX||0)-n,t=this.chart.max-this.chart.min,r=this.state.chartWidth-Al-kl,i=Math.round(e*t/r);this.chart.min+=i,this.chart.max+=i,this.setNewRange()}}this.chart.lastX=n}))}renderChart(){var e;return this.state.historyInstance?(e=this.state.historyInstances)!=null&&e.find(e=>e.id===this.state.historyInstance&&e.alive)?this.chartValues?T(er,{ref:e=>{this.echartsReact=e},echarts:Ar,option:this.getOption(),notMerge:!0,lazyUpdate:!0,theme:this.props.themeType===`dark`?`dark`:``,style:{height:`${this.state.chartHeight}px`,width:`100%`},opts:{renderer:`svg`},onEvents:{rendered:()=>this.installEventHandlers()}}):T(pe,{}):T(`div`,{style:{marginTop:20,fontSize:24,marginLeft:24},children:this.props.t(`History instance not alive`)}):T(`div`,{style:{marginTop:20,fontSize:24,marginLeft:24},children:this.props.t(`History instance not selected`)})}componentDidUpdate(){if(this.divRef.current){let e=this.divRef.current.offsetWidth,t=this.divRef.current.offsetHeight;this.state.chartHeight!==t&&(this.updateTimer&&clearTimeout(this.updateTimer),this.updateTimer=setTimeout(()=>{this.updateTimer=null,this.setState({chartHeight:t,chartWidth:e})},100))}}setStartDate(e){let t=e.getTime();this.timeTimer&&=(clearTimeout(this.timeTimer),null),this.localStorage.setItem(`App.relativeRange`,`absolute`),this.localStorage.setItem(`App.absoluteStart`,t.toString()),this.localStorage.setItem(`App.absoluteEnd`,this.state.max.toString()),this.chart.min=t,this.setState({min:t,relativeRange:`absolute`},()=>this.updateChart(this.chart.min,this.chart.max,!0))}setEndDate(e){let t=e.getTime();this.localStorage.setItem(`App.relativeRange`,`absolute`),this.localStorage.setItem(`App.absoluteStart`,this.state.min.toString()),this.localStorage.setItem(`App.absoluteEnd`,t.toString()),this.timeTimer&&=(clearTimeout(this.timeTimer),null),this.chart.max=t,this.setState({max:t,relativeRange:`absolute`},()=>this.updateChart(this.chart.min,this.chart.max,!0))}openEcharts(){let e=[`id=${window.encodeURIComponent(this.props.obj._id)}`,`instance=${window.encodeURIComponent(this.state.historyInstance)}`,`menuOpened=false`];this.state.relativeRange===`absolute`?(e.push(`start=${this.chart.min}`),e.push(`end=${this.chart.max}`)):e.push(`range=${this.state.relativeRange}`),window.open(`${window.location.protocol}//${window.location.host}/adapter/echarts/tab.html#${e.join(`&`)}`,`echarts`)}async onStepChanged(e){let t=await this.props.socket.getObject(this.props.obj._id);t!=null&&t.common.custom&&t.common.custom[this.state.historyInstance]&&t.common.custom[this.state.historyInstance].chartStep!==e&&(t.common.custom[this.state.historyInstance].chartStep=e,await this.props.socket.setObject(t._id,t)),this.setState({stepType:e,showStepMenu:null})}renderToolbar(){var e;if(this.props.noToolbar)return null;let t=this.state.windowWidth<960;return E(Be,{children:[!this.props.historyInstance&&E(se,{variant:`standard`,style:Z.selectHistoryControl,children:[T(de,{children:this.props.t(`History instance`)}),T(Ie,{variant:`standard`,value:this.state.historyInstance,onChange:e=>{this.localStorage.setItem(`App.historyInstance`,e.target.value),this.setState({historyInstance:e.target.value})},children:(e=this.state.historyInstances)==null?void 0:e.map(e=>T(F,{value:e.id,style:e.alive?void 0:Z.notAliveInstance,children:e.id},e.id))})]}),E(se,{variant:`standard`,style:Z.selectRelativeTime,children:[T(de,{children:this.props.t(`Relative`)}),E(Ie,{variant:`standard`,ref:this.rangeRef,value:this.state.relativeRange,onChange:e=>this.setRelativeInterval(e.target.value),children:[T(F,{value:`absolute`,sx:Z.customRange,children:this.props.t(`custom range`)},`custom`),T(F,{value:10,children:this.props.t(`last 10 minutes`)},`1`),T(F,{value:30,children:this.props.t(`last 30 minutes`)},`2`),T(F,{value:60,children:this.props.t(`last hour`)},`3`),T(F,{value:`day`,children:this.props.t(`this day`)},`4`),T(F,{value:1440,children:this.props.t(`last 24 hours`)},`5`),T(F,{value:`week`,children:this.props.t(`this week`)},`6`),T(F,{value:10080,children:this.props.t(`last week`)},`7`),T(F,{value:`2weeks`,children:this.props.t(`this 2 weeks`)},`8`),T(F,{value:20160,children:this.props.t(`last 2 weeks`)},`9`),T(F,{value:`month`,children:this.props.t(`this month`)},`10`),T(F,{value:43200,children:this.props.t(`last 30 days`)},`11`),T(F,{value:`year`,children:this.props.t(`this year`)},`12`),T(F,{value:`12months`,children:this.props.t(`last 12 months`)},`13`)]})]}),E(ge,{dateAdapter:Ot,adapterLocale:So[this.props.lang],children:[E(`div`,{style:Z.toolbarTimeGrid,children:[T(`div`,{style:{...Z.toolbarTimeLabel,opacity:this.state.relativeRange===`absolute`?void 0:.5},children:this.props.t(`Start time`)}),T(Ze,{sx:Z.toolbarDate,disabled:this.state.relativeRange!==`absolute`,value:new Date(this.state.min),onChange:e=>e&&this.setStartDate(e)}),T(ie,{disabled:this.state.relativeRange!==`absolute`,sx:Z.toolbarTime,ampm:this.state.ampm,value:new Date(this.state.min),onChange:e=>e&&this.setStartDate(e)})]}),E(`div`,{style:Z.toolbarTimeGrid,children:[T(`div`,{style:{...Z.toolbarTimeLabel,opacity:this.state.relativeRange===`absolute`?void 0:.5},children:this.props.t(`End time`)}),T(Ze,{disabled:this.state.relativeRange!==`absolute`,sx:Z.toolbarDate,value:new Date(this.state.max),onChange:e=>e&&this.setEndDate(e)}),T(ie,{disabled:this.state.relativeRange!==`absolute`,sx:Z.toolbarTime,ampm:this.state.ampm,value:new Date(this.state.max),onChange:e=>e&&this.setEndDate(e)})]})]}),T(`div`,{style:Z.grow}),T(O,{style:{marginRight:10},variant:`outlined`,onClick:e=>this.setState({showStepMenu:e.target}),children:t?this.state.stepType===``?T(dt,{}):this.state.stepType===`stepStart`?T(ut,{}):this.state.stepType===`stepMiddle`?T(ct,{}):this.state.stepType===`stepEnd`?T(it,{}):this.props.t(`Step type`):this.state.stepType?this.props.t(this.state.stepType):this.props.t(`Step type`)}),this.state.showStepMenu?E(ze,{open:!0,anchorEl:this.state.showStepMenu,onClose:()=>this.setState({showStepMenu:null}),children:[T(F,{selected:this.state.stepType===``,onClick:()=>this.onStepChanged(``),children:t?T(dt,{}):this.props.t(`None`)}),T(F,{selected:this.state.stepType===`stepStart`,onClick:()=>this.onStepChanged(`stepStart`),children:t?T(ut,{}):this.props.t(`stepStart`)}),T(F,{selected:this.state.stepType===`stepMiddle`,onClick:()=>this.onStepChanged(`stepMiddle`),children:t?T(ct,{}):this.props.t(`stepMiddle`)}),T(F,{selected:this.state.stepType===`stepEnd`,onClick:()=>this.onStepChanged(`stepEnd`),children:t?T(it,{}):this.props.t(`stepEnd`)})]}):null,this.props.showJumpToEchart&&this.state.echartsJump&&T(et,{style:Z.echartsButton,size:`small`,onClick:()=>this.openEcharts(),title:this.props.t(`Open charts in new window`),children:T(`img`,{src:Ol,alt:`echarts`,style:Z.buttonIcon})}),E(et,{variant:`extended`,size:`small`,color:this.state.splitLine?`primary`:`default`,"aria-label":`show lines`,onClick:()=>{this.localStorage.setItem(`App.splitLine`,this.state.splitLine?`false`:`true`),this.setState({splitLine:!this.state.splitLine})},children:[T(re,{style:Z.splitLineButtonIcon}),this.props.t(`Show lines`)]})]})}render(){return!this.state.historyInstances&&!this.state.defaultHistory?T(pe,{}):E(qe,{style:Z.paper,children:[this.renderToolbar(),T(`div`,{ref:this.divRef,style:m.getStyle(this.props.theme,Z.chart,this.props.noToolbar?Z.chartWithoutToolbar:Z.chartWithToolbar),children:this.renderChart()})]})}};c();var Ml={dialog:{height:`100%`},paper:{height:`calc(100% - 64px)`},content:{textAlign:`center`,overflow:`hidden`},tabPanel:e=>({width:`100%`,overflow:`hidden`,height:`calc(100% - ${e.mixins.toolbar.minHeight}px)`}),tabSelected:e=>({color:e.palette.mode===`dark`?e.palette.secondary.contrastText:`#FFFFFF !important`}),tabsIndicator:e=>({backgroundColor:e.palette.secondary.main})},Nl=class extends At{constructor(e){super(e),u(this,`chartAvailable`,void 0),u(this,`saveFunc`,null),u(this,`onCtrlEnter`,()=>{this.state.confirmDialog||this.state.showWarning||this.state.currentTab!==0||this.state.hasChanges&&!this.state.error&&!this.state.progressRunning&&(this.saveFunc?this.saveFunc(e=>!e&&this.onClose()):this.onClose())});let t=parseInt((window._localStorage||window.localStorage).getItem(`App.objectCustomTab`)||`0`,10);if(this.chartAvailable=this.isChartAvailable(),this.chartAvailable){let e=Ae.getLocation();e.arg===`chart`?t=2:e.arg===`table`&&(t=1)}else t=0;this.state={hasChanges:!1,error:!1,currentTab:t,confirmDialog:!1,mobile:At.isMobile(),progressRunning:!1,showWarning:this.props.allVisibleObjects}}isChartAvailable(){let e=this.props.objectIDs.length===1;if(e){var t;let n=this.props.objectIDs[0];e=(t=this.props.objects[n])!=null&&(t=t.common)!=null&&t.custom?!!Object.keys(this.props.objects[n].common.custom).find(e=>{let t=this.props.objects[`system.adapter.${e}`];return t&&t.common&&t.common.getHistory}):!1}return e}renderCharts(){return T(jl,{isFloatComma:this.props.isFloatComma,showJumpToEchart:!0,t:this.props.t,lang:this.props.lang,socket:this.props.socket,obj:this.props.objects[this.props.objectIDs[0]],customsInstances:this.props.customsInstances,themeType:this.props.themeType,theme:this.props.theme,objects:this.props.objects})}renderTable(){return T(Co,{t:this.props.t,isFloatComma:this.props.isFloatComma,lang:this.props.lang,expertMode:!!this.props.expertMode,socket:this.props.socket,obj:this.props.objects[this.props.objectIDs[0]],customsInstances:this.props.customsInstances,objects:this.props.objects})}renderCustomEditor(){return T(xo,{registerSaveFunc:e=>this.saveFunc=e,t:this.props.t,lang:this.props.lang,socket:this.props.socket,objectIDs:this.props.objectIDs,customsInstances:this.props.customsInstances,objects:this.props.objects,onProgress:e=>this.setState({progressRunning:e}),onError:e=>this.setState({error:!!e}),reportChangedIds:this.props.reportChangedIds,onChange:(e,t)=>{this.setState({hasChanges:!!e},()=>{if(t){let e=this.isChartAvailable();e!==this.chartAvailable&&(this.chartAvailable=e,this.forceUpdate())}})},theme:this.props.theme,themeName:this.props.themeName,themeType:this.props.themeType,systemConfig:this.props.systemConfig})}renderDialogConfirm(){return this.state.confirmDialog?T(We,{title:w.t(`You have unsaved changes`),text:w.t(`Discard?`),ok:w.t(`Yes`),cancel:w.t(`Cancel`),onClose:e=>this.setState({confirmDialog:!1},()=>e&&this.props.onClose())}):null}onClose(){this.state.hasChanges?this.setState({confirmDialog:!0}):this.props.onClose()}renderWarningDialog(){return this.state.showWarning?T(We,{text:T(`div`,{style:{color:`#F00`},children:this.props.t(`Your are intend to edit ALL objects. Are you sure?`)}),ok:this.props.t(`Yes`),onClose:e=>{this.setState({showWarning:!1}),e||this.onClose()}}):null}render(){var e;let t=(e=this.props.objects[this.props.objectIDs[0]])==null||(e=e.common)==null?void 0:e.type;return E(k,{sx:{"&.MuiDialog-scrollPaper":Ml.dialog,"& .MuiDialog-paper":Ml.paper},scroll:`paper`,open:!0,onClose:()=>this.props.onClose(),onKeyDown:e=>Et(e,this.onCtrlEnter),fullWidth:!0,maxWidth:`xl`,"aria-labelledby":`form-dialog-title`,children:[this.renderDialogConfirm(),this.renderWarningDialog(),T(d,{children:this.props.objectIDs.length>1?this.props.t(`Edit config for %s states`,this.props.objectIDs.length):this.props.t(`Edit config: %s`,this.props.objectIDs[0])}),E(C,{style:Ml.content,children:[T(he,{position:`static`,children:E(ye,{value:this.state.currentTab,onChange:(e,t)=>{Ae.doNavigate(null,null,null,t===1?`table`:t===2?`chart`:`config`),this.setState({currentTab:t}),(window._localStorage||window.localStorage).setItem(`App.objectCustomTab`,t)},sx:{"& .MuiTabs-indicator":Ml.tabsIndicator},indicatorColor:`secondary`,children:[T(n,{disabled:this.state.progressRunning,label:this.props.t(`Custom settings`),id:`custom-settings-tab`,"aria-controls":`custom-tabpanel-settings`,sx:{"&.Mui-selected":Ml.tabSelected}}),this.props.objectIDs.length===1&&this.chartAvailable?T(n,{disabled:this.state.progressRunning,label:this.props.t(`History data`),id:`history-data-tab`,"aria-controls":`custom-tabpanel-history`,sx:{"&.Mui-selected":Ml.tabSelected}}):null,(t===`number`||t===`boolean`)&&this.props.objectIDs.length===1&&this.chartAvailable?T(n,{disabled:this.state.progressRunning,label:this.props.t(`Chart`),id:`chart-tab`,"aria-controls":`custom-tabpanel-chart`,sx:{"&.Mui-selected":Ml.tabSelected}}):null]})}),this.state.currentTab===0?T(D,{component:`div`,sx:Ml.tabPanel,children:this.renderCustomEditor()}):null,this.props.objectIDs.length===1&&this.chartAvailable&&this.state.currentTab===1?T(D,{component:`div`,sx:Ml.tabPanel,children:this.renderTable()}):null,(t===`number`||t===`boolean`)&&this.props.objectIDs.length===1&&this.chartAvailable&&this.state.currentTab===2?T(D,{component:`div`,sx:Ml.tabPanel,children:this.renderCharts()}):null]}),E(S,{children:[this.state.currentTab===0&&T(O,{id:`object-custom-dialog-save`,variant:`contained`,color:`primary`,disabled:!this.state.hasChanges||this.state.error||this.state.progressRunning,onClick:()=>this.saveFunc&&this.saveFunc(),children:this.getButtonTitle(T(b,{}),this.props.t(`Save`))}),this.state.currentTab===0&&T(j,{title:this.props.t(`Press CTRL+ENTER to confirm`),children:T(`span`,{children:T(O,{id:`object-custom-dialog-save-close`,variant:`contained`,color:`primary`,disabled:!this.state.hasChanges||this.state.error||this.state.progressRunning,onClick:this.onCtrlEnter,children:this.getButtonTitle(T(b,{}),this.props.t(`Save & close`),T(N,{}))})})}),T(O,{id:`object-custom-dialog-close`,disabled:this.state.progressRunning,variant:`contained`,onClick:()=>this.onClose(),color:`grey`,children:this.getButtonTitle(T(N,{}),this.props.t(`Close`))})]})]})}};c();function Pl(e){if(e==null)return``;if(typeof e==`string`)return e;if(typeof e==`number`||typeof e==`boolean`)return String(e);try{return JSON.stringify(e)||``}catch{return``}}var Fl={dialogForm:{margin:0},formControl:{minWidth:100},quality:{width:`calc(100% - 88px)`},expire:{ml:1,width:80},readOnly:{backgroundColor:`#b74848`},readOnlyText:{color:`#b74848`,marginLeft:8},wrapperButton:{"@media screen and (max-width: 465px)":{"& *":{fontSize:12}},"@media screen and (max-width: 380px)":{"& *":{fontSize:11}}},ackCheckbox:{marginLeft:4},dialog:{minHeight:Math.min(window.innerHeight-50,500)},tooltip:{pointerEvents:`none`}},Il=class e extends Le{static hasStatesOptions(e){return!!e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length>0}constructor(t){super(t),u(this,`propsValue`,void 0),u(this,`chartFrom`,void 0),u(this,`ack`,void 0),u(this,`inputRef`,y.createRef()),u(this,`q`,void 0),u(this,`expire`,void 0),u(this,`writePending`,!1),u(this,`onCtrlEnter`,()=>{this.state.valid&&this.onUpdate()});let n=ke(),r=e.hasStatesOptions(this.props.states),i=n.prepareEditor(this.props.object,this.props.value),a=r?`states`:i.editorType,o=i.value;this.propsValue=o,a===`json`&&typeof o!=`string`?(o=JSON.stringify(o??null,null,2),this.propsValue=o):(a===`number`&&o==null||a===`string`&&o==null)&&(o=``),this.state={type:a,chart:!1,chartEnabled:(window._localStorage||window.localStorage).getItem(`App.chartSetValue`)!==`false`,fullScreen:(window._localStorage||window.localStorage).getItem(`App.fullScreen`)===`true`,targetValue:o,valid:!0,jsonError:!1,writing:!1},this.ack=!1,this.q=0,this.expire=0,this.inputRef=y.createRef(),this.chartFrom=Date.now()-72e5}componentDidMount(){var e,t;this.props.defaultHistory&&(e=this.props.object)!=null&&(e=e.common)!=null&&e.custom&&(t=this.props.object.common.custom[this.props.defaultHistory])!=null&&t.enabled&&this.props.socket.getState(`system.adapter.${this.props.defaultHistory}.alive`).then(e=>this.setState({chart:!!(e!=null&&e.val)})),setTimeout(()=>{var e;if((e=this.inputRef)!=null&&e.current){let e=this.inputRef.current,t=e.value||``,n=e.type;e.type===`number`&&(e.type=`text`),e.setSelectionRange(0,t.length),n===`number`&&(e.type=n)}},200)}static parseBoolean(e){if(e===!0||e===1)return!0;if(typeof e==`string`){let t=e.trim().toLowerCase();return t===`true`||t===`1`||t===`on`||t===`yes`}return!1}async onUpdate(e){var t;if(e&&(e.stopPropagation(),e.preventDefault()),!(this.writePending||this.state.writing||!this.state.valid||this.state.jsonError)){if(((t=this.props.object.common)==null?void 0:t.write)===!1)window.alert(`Cannot write state "${this.props.object._id}": common.write=false`);else try{let e=ke(),t=e.getWriteBehavior(this.props.object._id,this.props.object,void 0,this.props.expertMode);if(t===`readonly`||t===`expert-only`||t===`file`)throw Error(`State writing is not permitted`);let n=e.parseEditorValue(this.props.object,this.state.type,this.state.targetValue);this.writePending=!0,this.setState({writing:!0}),await Promise.resolve(this.props.onClose({val:n,ack:this.ack,q:this.q,expire:this.expire||void 0,editorType:this.state.type}))}catch(e){window.alert(`Cannot write state "${this.props.object._id}": ${e instanceof Error?e.message:Pl(e)}`),this.writePending=!1,this.setState({writing:!1})}}}static isNumberValid(e){let{common:t,value:n}=e;if(n===``)return!1;let r=Number(typeof n==`string`?n.replace(`,`,`.`):n);return!Number.isFinite(r)||typeof t.min==`number`&&r<t.min?!1:!(typeof t.max==`number`&&r>t.max)}renderTimePicker(){return E(ge,{adapterLocale:So[this.props.lang],dateAdapter:Ot,children:[T(Ze,{value:new Date(Number(this.state.targetValue)),onChange:e=>{e&&this.setState({targetValue:Math.round(e.getTime())})}}),T(ie,{value:new Date(Number(this.state.targetValue)),views:[`hours`,`minutes`,`seconds`],onChange:e=>{e&&this.setState({targetValue:Math.round(e.getTime())})}})]})}renderChart(){return T(jl,{t:this.props.t,isFloatComma:this.props.isFloatComma,showJumpToEchart:!1,lang:this.props.lang,socket:this.props.socket,obj:this.props.object,themeType:this.props.themeType,theme:this.props.theme,from:this.chartFrom,end:Date.now(),noToolbar:!0,defaultHistory:this.props.defaultHistory,customsInstances:[],objects:{},historyInstance:``})}static checkJsonError(e){try{return JSON.parse(e),!1}catch{return!0}}renderJsonEditor(){return T(kt,{error:this.state.jsonError,onCtrlEnter:this.onCtrlEnter,editValueMode:!0,themeType:this.props.themeType,defaultValue:Pl(this.state.targetValue),onChange:t=>this.setState({targetValue:t,jsonError:e.checkJsonError(t)})})}renderStates(){if(!e.hasStatesOptions(this.props.states))return null;if(this.props.type===`number`&&this.props.object.common.max!==void 0&&this.props.object.common.min!==void 0){let e=Object.keys(this.props.states||{}).map(e=>{var t;return{label:(t=this.props.states)==null?void 0:t[e],value:e}}),t=this.state.targetValue&&typeof this.state.targetValue==`object`&&`value`in this.state.targetValue?this.state.targetValue.value:this.state.targetValue,n=e.find(e=>String(e.value)===Pl(t))??Pl(t);return T(Pe,{style:Fl.formControl,disablePortal:!0,value:n,options:e,noOptionsText:``,freeSolo:!0,isOptionEqualToValue:(e,t)=>String(typeof e==`string`?e:e.value)===String(typeof t==`string`?t:t.value),getOptionLabel:e=>typeof e==`string`?e:e.label||String(e.value),onChange:(e,t)=>this.setState({targetValue:t}),onInputChange:(e,t,n)=>{n===`input`&&this.setState({targetValue:t})},onKeyUp:e=>e.key===`Enter`&&this.onUpdate(e),renderInput:e=>T(I,{...e,label:this.props.t(`Value`),variant:`standard`})})}return E(se,{variant:`standard`,style:Fl.formControl,children:[T(de,{children:this.props.t(`Value`)}),T(Ie,{variant:`standard`,value:this.state.targetValue==null?``:typeof this.state.targetValue==`object`&&`value`in this.state.targetValue?Pl(this.state.targetValue.value):Pl(this.state.targetValue),onChange:e=>this.setState({targetValue:e.target.value}),children:Object.keys(this.props.states||{}).map((e,t)=>{var n;return T(F,{value:e,children:(n=this.props.states)==null?void 0:n[e]},t)})})]})}render(){var t,n,r,i;let a=e.hasStatesOptions(this.props.states),o=E(`div`,{style:{display:`flex`,alignItems:`center`},children:[T(h,{style:{...Fl.formControl,...this.props.expertMode?void 0:Fl.ackCheckbox},control:T(l,{defaultChecked:!1,onChange:e=>this.ack=e.target.checked}),label:this.props.t(`Acknowledged`)}),T(j,{title:this.props.t(`Acknowledged explanation`),slotProps:{popper:{sx:Fl.tooltip}},children:T(Ge,{color:`primary`})})]});return E(k,{className:`eos-object-value-dialog`,open:!0,maxWidth:this.state.type===`number`||this.state.type===`boolean`||this.state.type===`states`?this.state.chart&&this.state.chartEnabled?`lg`:void 0:`md`,fullWidth:this.state.type===`json`&&this.state.fullScreen||this.state.type!==`number`&&this.state.type!==`boolean`&&this.state.type!==`states`||this.state.chart&&this.state.chartEnabled,fullScreen:this.state.type===`json`&&this.state.fullScreen,onClose:()=>{this.writePending||this.props.onClose()},onKeyDown:e=>Et(e,this.onCtrlEnter),"aria-labelledby":`edit-value-dialog-title`,"aria-describedby":`edit-value-dialog-description`,sx:{zIndex:1e4,"& .MuiDialog-paper":this.state.type===`json`?Fl.dialog:void 0},children:[E(d,{id:`edit-value-dialog-title`,children:[this.props.t(`Write value`),((t=this.props.object.common)==null?void 0:t.write)===!1?E(`span`,{style:Fl.readOnlyText,children:[`(`,this.props.t(`read only`),`)`]}):null,this.state.chart?T(et,{style:{float:`right`},size:`small`,color:this.state.chartEnabled?`primary`:`default`,onClick:()=>{(window._localStorage||window.localStorage).setItem(`App.chartSetValue`,this.state.chartEnabled?`false`:`true`),this.setState({chartEnabled:!this.state.chartEnabled})},children:T(ae,{})}):null,this.state.type===`json`?T(P,{style:{float:`right`},onClick:()=>{(window._localStorage||window.localStorage).setItem(`App.fullScreen`,this.state.fullScreen?`false`:`true`),this.setState({fullScreen:!this.state.fullScreen})},children:this.state.fullScreen?T(rt,{}):T(nt,{})}):null]}),T(C,{children:T(`form`,{noValidate:!0,autoComplete:`off`,onSubmit:e=>e.preventDefault(),style:{...Fl.dialogForm,height:`100%`},children:E(p,{container:!0,direction:`row`,spacing:2,style:{height:`100%`},children:[T(p,{size:{xs:12,md:this.state.chart&&this.state.chartEnabled?6:12},style:{height:`100%`},children:E(p,{container:!0,spacing:2,style:{marginTop:0,height:`100%`},sx:{flexDirection:`column`},children:[this.props.expertMode?T(p,{children:E(p,{container:!0,direction:`row`,spacing:2,style:{marginTop:0},children:[this.props.expertMode?T(p,{children:E(se,{style:Fl.formControl,children:[T(de,{style:{marginTop:10,marginLeft:-14},children:this.props.t(`Value type`)}),E(Ie,{variant:`standard`,value:this.state.type,onChange:t=>{this.setState({type:t.target.value,valid:t.target.value!==`number`||e.isNumberValid({value:this.state.targetValue,common:this.props.object.common}),jsonError:!1},()=>{this.state.type===`json`&&this.setState({targetValue:Pl(this.state.targetValue),jsonError:e.checkJsonError(Pl(this.state.targetValue))})})},children:[T(F,{value:`string`,children:`String`}),T(F,{value:`number`,children:`Number`}),T(F,{value:`boolean`,children:`Boolean`}),T(F,{value:`json`,children:`JSON/Object`}),a?T(F,{value:`states`,children:`States`}):null]})]})}):null,this.state.type===`json`?T(p,{sx:{flex:1}}):null]})}):null,T(p,{sx:{flex:this.state.type===`json`&&this.state.fullScreen?1:void 0},style:{paddingTop:0},children:this.state.type===`boolean`?T(we,{component:`div`,style:this.props.expertMode?{marginTop:20,width:`100%`,backgroundColor:this.props.themeType===`dark`?`#595959`:`#dadada`,borderRadius:5,padding:5}:void 0,children:E(p,{component:`label`,container:!0,spacing:1,sx:{alignItems:`center`},children:[E(p,{style:{marginRight:10},children:[this.props.t(`Value`),`:`]}),T(p,{children:`FALSE`}),T(p,{children:T(ne,{autoFocus:!0,checked:e.parseBoolean(this.state.targetValue),onKeyUp:e=>e.key===`Enter`&&this.onUpdate(e),onChange:e=>this.setState({targetValue:e.target.checked})})}),T(p,{children:`TRUE`})]})}):this.state.type===`number`?T(I,{variant:`standard`,fullWidth:!0,autoFocus:!0,error:!this.state.valid,type:`text`,slotProps:{htmlInput:{inputMode:`decimal`,step:this.props.object.common.step,min:this.props.object.common.min,max:this.props.object.common.max}},inputRef:this.inputRef,helperText:this.props.t(`Press ENTER to write the value, when focused`),value:Pl(this.state.targetValue),label:this.props.t(`Value`)+(this.props.object.common.min!==void 0||this.props.object.common.unit===`%`?`, ${this.props.t(`min:`)} ${this.props.object.common.min===void 0?0:this.props.object.common.min}`:``)+(this.props.object.common.max!==void 0||this.props.object.common.unit===`%`?`, ${this.props.t(`max:`)} ${this.props.object.common.max===void 0?100:this.props.object.common.max}`:``),onKeyUp:e=>e.key===`Enter`&&this.state.valid&&this.onUpdate(e),onChange:t=>{this.setState({targetValue:t.target.value,valid:e.isNumberValid({value:t.target.value,common:this.props.object.common})})}}):this.state.type===`json`?this.renderJsonEditor():this.state.type===`states`?this.renderStates():T(I,{variant:`standard`,fullWidth:!0,inputRef:this.inputRef,autoFocus:!0,helperText:this.props.t(`Press CTRL+ENTER to write the value, when focused`),label:this.props.t(`Value`),multiline:!0,onKeyDown:e=>e.ctrlKey&&e.key===`Enter`&&this.onUpdate(e),defaultValue:Pl(this.propsValue),onChange:e=>this.setState({targetValue:e.target.value})})}),(this.props.role===`date`||(n=this.props.role)!=null&&n.startsWith(`date.`))&&this.state.type===`number`?T(p,{style:{display:`flex`,gap:`5px`},size:{xs:6},children:this.renderTimePicker()}):null,this.props.expertMode?T(p,{children:o}):null,this.props.expertMode?E(p,{children:[E(se,{variant:`standard`,style:Fl.quality,children:[T(de,{children:this.props.t(`Quality`)}),E(Ie,{variant:`standard`,defaultValue:0,onChange:e=>this.q=Number(e.target.value),children:[T(F,{value:0,children:`0x00 - good`}),T(F,{value:1,children:`0x01 - general problem`}),T(F,{value:2,children:`0x02 - no connection problem`}),T(F,{value:16,children:`0x10 - substitute value from controller`}),T(F,{value:32,children:`0x20 - substitute initial value`}),T(F,{value:64,children:`0x40 - substitute value from device or instance`}),T(F,{value:128,children:`0x80 - substitute value from sensor`}),T(F,{value:17,children:`0x11 - general problem by instance`}),T(F,{value:65,children:`0x41 - general problem by device`}),T(F,{value:129,children:`0x81 - general problem by sensor`}),T(F,{value:18,children:`0x12 - instance not connected`}),T(F,{value:66,children:`0x42 - device not connected`}),T(F,{value:130,children:`0x82 - sensor not connected`}),T(F,{value:68,children:`0x44 - device reports error`}),T(F,{value:132,children:`0x84 - sensor reports error`})]})]}),T(I,{variant:`standard`,title:this.props.t(`0 - no expiration`),sx:{"&.MuiTextField-root":Fl.expire},label:this.props.t(`Expire`),type:`text`,slotProps:{htmlInput:{inputMode:`decimal`,min:0}},helperText:this.props.t(`in seconds`),defaultValue:this.expire,onChange:e=>this.expire=Number(e.target.value)})]}):null]})}),this.state.chart&&this.state.chartEnabled&&this.state.type!==`json`?T(p,{size:{xs:12,md:6},style:{minHeight:300},sx:{display:{xs:`none`,md:`inline-block`}},children:this.renderChart()}):null]})})}),E(S,{sx:Fl.wrapperButton,children:[this.props.expertMode?null:o,this.props.expertMode?null:T(`div`,{style:{flexGrow:1}}),T(O,{variant:`contained`,disabled:!this.state.valid||!!this.state.jsonError||this.state.writing||((r=this.props.object.common)==null?void 0:r.write)===!1,onClick:e=>this.onUpdate(e),color:`primary`,startIcon:this.props.width===`xs`?void 0:T(f,{}),style:((i=this.props.object.common)==null?void 0:i.write)===!1?Fl.readOnly:void 0,children:this.props.width===`xs`?T(f,{fontSize:`large`}):this.state.writing?this.props.t(`Please wait...`):this.props.t(`Set value`)}),T(O,{variant:`contained`,disabled:this.state.writing,onClick:()=>{this.writePending||this.props.onClose()},color:`grey`,startIcon:this.props.width===`xs`?void 0:T(N,{}),children:this.props.width===`xs`?T(N,{fontSize:`large`}):this.props.t(`Cancel`)})]})]})}};Vt(),Ft(),Mt(),zt(),Lt(),jt(),Pt(),Rt(),It(),Bt(),c();var Q={divWithoutTitle:{width:`100%`,height:`100%`,border:`2px solid #00000000`},divWithoutTitleAndTab:{height:`calc(100% - 48px)`},error:{border:`2px solid #FF0000`},id:{fontStyle:`italic`},dialog:{height:`calc(100% - 64px)`},aliasIdEdit:{width:368},button:{marginTop:20,marginLeft:8},funcDivEdit:{width:`100%`},funcEditName:{display:`inline-block`,width:85},funcEdit:{width:400},funcIcon:{width:16,height:16},marginTop:{marginTop:20},commonTabWrapper:{flexFlow:`wrap`,display:`flex`,gap:8},commonWrapper:{width:500,minWidth:300},flexDrop:{width:`100%`,maxWidth:500,margin:`auto`,display:`flex`},marginBlock:{marginTop:20},buttonAdd:{minWidth:150},textField:{width:`100%`},flex:{display:`flex`,"& > div":{mr:`8px`}},removeButton:{mt:`23px`,alignSelf:`flex-start`,flexShrink:0},color:{width:70},buttonRemoveWrapper:{position:`absolute`,zIndex:222,right:0},tabsPadding:{padding:`0px 24px`},wrapperButton:{"@media screen and (max-width: 465px)":{"& *":{fontSize:10}},"@media screen and (max-width: 380px)":{"& *":{fontSize:9}}},commonDeleteTip:{color:`#fa4a4a`},typeNameEng:{marginLeft:8,opacity:.7,fontStyle:`italic`,fontSize:`smaller`},tooltip:{pointerEvents:`none`},stateRow:{width:`100%`,display:`flex`,justifyContent:`space-between`,padding:3},stateTitle:{minWidth:150,fontWeight:`bold`},stateUnit:{opacity:.7,marginLeft:4},stateValue:{animation:`newStateEditorAnimation 2s ease-in-out`},stateTime:{fontStyle:`italic`},stateImage:{maxWidth:200,maxHeight:200}};function Ll(e,t){return{"@keyframes newStateEditorAnimation":{"0%":{color:e.palette.mode===`dark`?`#27cf00`:`#174e00`},"100%":{color:t||(e.palette.mode===`dark`?`#ffffff`:`#000000`)}}}}var Rl=[{role:`button`,type:`boolean`,r:!1,w:!0},{role:`button.close.blind`,type:`boolean`,r:!1,w:!0},{role:`button.close.tilt`,type:`boolean`,r:!1,w:!0},{role:`button.fastforward`,type:`boolean`,r:!1,w:!0},{role:`button.forward`,type:`boolean`,r:!1,w:!0},{role:`button.long`,type:`boolean`,r:!1,w:!0},{role:`button.mode`,type:`boolean`,r:!1,w:!0},{role:`button.mode.auto`,type:`boolean`,r:!1,w:!0},{role:`button.mode.manual`,type:`boolean`,r:!1,w:!0},{role:`button.mode.silent`,type:`boolean`,r:!1,w:!0},{role:`button.next`,type:`boolean`,r:!1,w:!0},{role:`button.open.blind`,type:`boolean`,r:!1,w:!0},{role:`button.open.door`,type:`boolean`,r:!1,w:!0},{role:`button.open.tilt`,type:`boolean`,r:!1,w:!0},{role:`button.open.window`,type:`boolean`,r:!1,w:!0},{role:`button.pause`,type:`boolean`,w:!0},{role:`button.play`,type:`boolean`,w:!0},{role:`button.press`,type:`boolean`,r:!1,w:!0},{role:`button.press`,type:`boolean`,r:!0,w:!1},{role:`button.prev`,type:`boolean`,w:!0},{role:`button.resume`,type:`boolean`,r:!1,w:!0},{role:`button.start`,type:`boolean`,r:!1,w:!0},{role:`button.pause`,type:`boolean`,r:!1,w:!0},{role:`button.stop`,type:`boolean`,r:!1,w:!0},{role:`button.stop.tilt`,type:`boolean`,r:!1,w:!0},{role:`button.volume.up`,type:`boolean`,r:!1,w:!0},{role:`chart`,type:`string`},{role:`date`,type:`number`},{role:`date`,type:`string`},{role:`date.end`,type:`number`},{role:`date.end`,type:`string`},{role:`date.forecast.1`,type:`string`},{role:`date.start`,type:`number`},{role:`date.start`,type:`string`},{role:`date.sunrise`,type:`number`},{role:`date.sunrise`,type:`string`},{role:`date.sunset`,type:`number`},{role:`date.sunset`,type:`string`},{role:`dayofweek`,type:`number`},{role:`html`,type:`string`},{role:`indicator`,type:`boolean`,w:!1},{role:`indicator.alarm`,type:`boolean`,w:!1},{role:`indicator.alarm.fire`,type:`boolean`,w:!1},{role:`indicator.alarm.flood`,type:`boolean`,w:!1},{role:`indicator.alarm.health`,type:`boolean`,w:!1},{role:`indicator.alarm.secure`,type:`boolean`,w:!1},{role:`indicator.connected`,type:`boolean`,w:!1},{role:`indicator.maintenance`,type:`boolean`,w:!1},{role:`indicator.maintenance.alarm`,type:`boolean`,w:!1},{role:`indicator.maintenance.lowbat`,type:`boolean`,w:!1},{role:`indicator.maintenance.waste`,type:`boolean`,w:!1},{role:`indicator.reachable`,type:`boolean`,w:!1},{role:`info.address`,type:`string`,w:!1},{role:`info.display`,type:`string`,w:!1},{role:`info.firmware`,type:`string`,w:!1},{role:`info.hardware`,type:`string`,w:!1},{role:`info.ip`,type:`string`,w:!1},{role:`info.mac`,type:`string`,w:!1},{role:`info.model`,type:`string`,w:!1},{role:`info.name`,type:`string`,w:!1},{role:`info.port`,type:`number`,w:!1},{role:`info.port`,type:`string`,w:!1},{role:`info.serial`,type:`string`,w:!1},{role:`info.standby`,type:`string`,w:!1},{role:`info.status`,w:!1},{role:`json`,type:`string`},{role:`level`,type:`number`,w:!0},{role:`level.bass`,type:`number`,w:!0},{role:`level.blind`,type:`number`,w:!0},{role:`level.brightness`,type:`number`,w:!0},{role:`level.color.blue`,type:`number`,w:!0},{role:`level.color.hue`,type:`number`,w:!0},{role:`level.color.luminance`,type:`number`,w:!0},{role:`level.color.red`,type:`number`,w:!0},{role:`level.color.rgb`,type:`string`,w:!0},{role:`level.color.rgbw`,type:`string`,w:!0},{role:`level.color.saturation`,type:`number`,w:!0},{role:`level.color.temperature`,type:`number`,w:!0},{role:`level.curtain`,type:`number`,w:!0},{role:`level.mode.airconditioner`,type:`number`,w:!0},{role:`level.mode.cleanup`,type:`number`,w:!0},{role:`level.mode.fan`,type:`number`,w:!0},{role:`level.mode.swing`,type:`number`,w:!0},{role:`level.mode.thermostat`,type:`number`,w:!0},{role:`level.mode.work`,type:`number`,w:!0},{role:`level.temperature`,type:`number`,w:!0},{role:`level.tilt`,type:`number`,w:!0},{role:`level.timer`,type:`number`,w:!0},{role:`level.treble`,type:`number`,w:!0},{role:`level.valve`,type:`number`,w:!0},{role:`level.volume`,type:`number`,w:!0},{role:`level.volume.group`,type:`number`,w:!0},{role:`list`,type:`array`},{role:`list`,type:`string`},{role:`location`,type:`string`},{role:`media.add`,type:`string`},{role:`media.bitrate`,type:`number`},{role:`media.bitrate`,type:`string`},{role:`media.broadcastDate`,type:`string`},{role:`media.browser`,type:`string`},{role:`media.clear`,type:`boolean`},{role:`media.content`,type:`string`},{role:`media.cover`,type:`string`},{role:`media.cover.big`,type:`string`},{role:`media.cover.small`,type:`string`},{role:`media.date`,type:`string`},{role:`media.duration`,type:`number`},{role:`media.duration`,type:`string`},{role:`media.duration.text`,type:`string`},{role:`media.elapsed`,type:`number`},{role:`media.elapsed`,type:`string`},{role:`media.elapsed.text`,type:`string`},{role:`media.episode`,type:`number`},{role:`media.episode`,type:`string`},{role:`media.genre`,type:`string`},{role:`media.input`,type:`string`},{role:`media.jump`,type:`string`},{role:`media.link`,type:`string`},{role:`media.mode.repeat`,type:`string`},{role:`media.mode.shuffle`,type:`string`},{role:`media.mute`,type:`string`},{role:`media.mute.group`,type:`string`},{role:`media.playid`,type:`string`},{role:`media.playlist`,type:`string`},{role:`media.season`,type:`string`},{role:`media.seek`,type:`string`},{role:`media.state`,type:`string`},{role:`media.titel`,type:`string`},{role:`media.track`,type:`string`},{role:`media.tts`,type:`string`},{role:`media.url`,type:`string`},{role:`media.url.announcement`,type:`string`},{role:`medien.artist`,type:`string`},{role:`sensor.alarm`,type:`boolean`,w:!1},{role:`sensor.alarm.fire`,type:`boolean`,w:!1},{role:`sensor.alarm.flood`,type:`boolean`,w:!1},{role:`sensor.alarm.power`,type:`boolean`,w:!1},{role:`sensor.alarm.secure`,type:`boolean`,w:!1},{role:`sensor.contact`,type:`boolean`,w:!1},{role:`sensor.door`,type:`boolean`,w:!1},{role:`sensor.light`,type:`boolean`,w:!1},{role:`sensor.lock`,type:`boolean`,w:!1},{role:`sensor.motion`,type:`boolean`,w:!1},{role:`sensor.noise`,type:`boolean`,w:!1},{role:`sensor.rain`,type:`boolean`,w:!1},{role:`sensor.window`,type:`boolean`,w:!1},{role:`state`,type:`mixed`},{role:`string.date`,type:`number`},{role:`switch`,type:`boolean`,w:!0},{role:`switch.enable`,type:`boolean`,w:!0},{role:`switch.gate`,type:`boolean`,w:!0},{role:`switch.gate`,type:`boolean`,w:!0},{role:`switch.light`,type:`boolean`,w:!0},{role:`switch.lock`,type:`boolean`,w:!0},{role:`switch.lock.door`,type:`boolean`,w:!0},{role:`switch.lock.window`,type:`boolean`,w:!0},{role:`switch.mode`,type:`boolean`,w:!0},{role:`switch.mode.auto`,type:`boolean`,w:!0},{role:`switch.mode.boost`,type:`boolean`,w:!0},{role:`switch.mode.color`,type:`boolean`,w:!0},{role:`switch.mode.manual`,type:`boolean`,w:!0},{role:`switch.mode.moonlight`,type:`boolean`,w:!0},{role:`switch.mode.party`,type:`boolean`,w:!0},{role:`switch.mode.silent`,type:`boolean`,w:!0},{role:`switch.power`,type:`boolean`,w:!0},{role:`switch.power.zone`,type:`boolean`,w:!0},{role:`text`,type:`string`},{role:`text.phone`,type:`string`},{role:`text.url`,type:`string`},{role:`time.interval`,type:`number`},{role:`time.span`,type:`number`},{role:`time.timeout`,type:`number`},{role:`url`,type:`string`},{role:`url.audio`,type:`string`},{role:`url.blank`,type:`string`},{role:`url.cam`,type:`string`},{role:`url.icon`,type:`string`},{role:`url.same`,type:`string`},{role:`value`,type:`number`,w:!1},{role:`value.battery`,type:`number`,w:!1},{role:`value.blind`,type:`number`,w:!1},{role:`value.blood.sugar`,type:`number`,w:!1},{role:`value.brightness`,type:`number`,w:!1},{role:`value.co2`,type:`number`,w:!1},{role:`value.clouds`,type:`number`,w:!1},{role:`value.current`,type:`number`,w:!1},{role:`value.curtain`,type:`number`,w:!1},{role:`value.date`,type:`string`,w:!1},{role:`value.datetime`,type:`string`,w:!1},{role:`value.default`,type:`number`,w:!1},{role:`value.direction`,type:`number`,w:!1},{role:`value.direction.max.wind`,type:`number`,w:!1},{role:`value.direction.min.wind`,type:`number`,w:!1},{role:`value.direction.wind`,type:`number`,w:!1},{role:`value.direction.wind.forecast.0`,type:`number`,w:!1},{role:`value.direction.wind.forecast.1`,type:`number`,w:!1},{role:`value.distance`,type:`number`,w:!1},{role:`value.energy`,type:`number`,w:!1},{role:`value.fill`,type:`number`,w:!1},{role:`value.gate`,type:`number`,w:!1},{role:`value.gps`,type:`number`,w:!1},{role:`value.gps.accuracy`,type:`number`,w:!1},{role:`value.gps.elevation`,type:`number`,w:!1},{role:`value.gps.latitude`,type:`number`,w:!1},{role:`value.gps.longitude`,type:`number`,w:!1},{role:`value.gps.radius`,type:`number`,w:!1},{role:`value.health.bmi`,type:`number`,w:!1},{role:`value.health.bpm`,type:`number`,w:!1},{role:`value.health.calories`,type:`number`,w:!1},{role:`value.health.fat`,type:`number`,w:!1},{role:`value.health.steps`,type:`number`,w:!1},{role:`value.health.weight`,type:`number`,w:!1},{role:`value.humidity`,type:`number`,w:!1},{role:`value.humidity`,type:`number`,w:!1},{role:`value.humidity.max`,type:`number`,w:!1},{role:`value.humidity.min`,type:`number`,w:!1},{role:`value.interval`,type:`number`,w:!1},{role:`value.lock`,type:`number`,w:!1},{role:`value.min`,type:`number`,w:!1},{role:`value.position`,type:`number`,w:!1},{role:`value.power`,type:`number`,w:!1},{role:`value.power.consumption`,type:`number`,w:!1},{role:`value.power.production`,type:`number`,w:!1},{role:`value.power.reactive`,type:`number`,w:!1},{role:`value.precipitation`,type:`number`,w:!1},{role:`value.precipitation.chance`,type:`number`,w:!1},{role:`value.precipitation.day.forecast.0`,type:`number`,w:!1},{role:`value.precipitation.forecast.0`,type:`number`,w:!1},{role:`value.precipitation.forecast.0`,type:`number`,w:!1},{role:`value.precipitation.forecast.1`,type:`number`,w:!1},{role:`value.precipitation.forecast.1`,type:`number`,w:!1},{role:`value.precipitation.hour`,type:`number`,w:!1},{role:`value.precipitation.night.forecast.0`,type:`number`,w:!1},{role:`value.precipitation.today`,type:`number`,w:!1},{role:`value.precipitation.type`,type:`number`,w:!1},{role:`value.pressure`,type:`number`,w:!1},{role:`value.pressure.forecast.0`,type:`number`,w:!1},{role:`value.pressure.forecast.1`,type:`number`,w:!1},{role:`value.radiation`,type:`number`,w:!1},{role:`value.rain`,type:`number`,w:!1},{role:`value.rain.hour`,type:`number`,w:!1},{role:`value.rain.today`,type:`number`,w:!1},{role:`value.severity`,type:`number`,w:!1},{role:`value.snow`,type:`number`,w:!1},{role:`value.snow.hour`,type:`number`,w:!1},{role:`value.snow.today`,type:`number`,w:!1},{role:`value.snowline`,type:`number`,w:!1},{role:`value.speed`,type:`number`,w:!1},{role:`value.speed.max.wind`,type:`number`,w:!1},{role:`value.speed.min.wind`,type:`number`,w:!1},{role:`value.speed.wind`,type:`number`,w:!1},{role:`value.speed.wind.forecast.0`,type:`number`,w:!1},{role:`value.speed.wind.gust`,type:`number`,w:!1},{role:`value.state`,type:`number`,w:!1},{role:`value.sun.azimuth`,type:`number`,w:!1},{role:`value.sun.elevation`,type:`number`,w:!1},{role:`value.temperature`,type:`number`,w:!1},{role:`value.temperature`,type:`number`,w:!1},{role:`value.temperature.dewpoint`,type:`number`,w:!1},{role:`value.temperature.feelslike`,type:`number`,w:!1},{role:`value.temperature.max`,type:`number`,w:!1},{role:`value.temperature.max.forecast.0`,type:`number`,w:!1},{role:`value.temperature.min`,type:`number`,w:!1},{role:`value.temperature.min.forecast.0`,type:`number`,w:!1},{role:`value.temperature.min.forecast.1`,type:`number`,w:!1},{role:`value.temperature.windchill`,type:`number`,w:!1},{role:`value.tilt`,type:`number`,w:!1},{role:`value.time`,type:`number`,w:!1},{role:`value.uv`,type:`number`,w:!1},{role:`value.valve`,type:`number`,w:!1},{role:`value.voltage`,type:`number`,w:!1},{role:`value.warning`,type:`number`,w:!1},{role:`value.waste`,type:`number`,w:!1},{role:`value.water`,type:`number`,w:!1},{role:`weather.chart.url`,type:`string`,w:!1},{role:`weather.chart.url.forecast`,type:`string`,w:!1},{role:`weather.direction.wind`,type:`number`,w:!1},{role:`weather.direction.wind.forecast.0`,type:`number`,w:!1},{role:`weather.html`,type:`string`,w:!1},{role:`weather.icon`,type:`string`,w:!1},{role:`weather.icon.forecast.1`,type:`string`,w:!1},{role:`weather.icon.name`,type:`string`,w:!1},{role:`weather.icon.wind`,type:`string`,w:!1},{role:`weather.json`,type:`string`,w:!1},{role:`weather.state`,type:`number`,w:!1},{role:`weather.state`,type:`string`,w:!1},{role:`weather.state.forecast.0`,type:`string`,w:!1},{role:`weather.sunrise`,type:`string`,w:!1},{role:`weather.sunset`,type:`string`,w:!1},{role:`weather.state.forecast.1`,type:`string`,w:!1},{role:`weather.temperature`,type:`number`,w:!1},{role:`weather.title`,type:`string`,w:!1},{role:`weather.title.forecast.0`,type:`string`,w:!1},{role:`weather.title.short`,type:`string`,w:!1},{role:`weather.type`,type:`number`,w:!1},{role:`weather.type`,type:`string`,w:!1}],zl=class e extends Le{constructor(e){super(e),u(this,`originalObj`,void 0),u(this,`subscribed`,!1),u(this,`updateTimer`,null),u(this,`onObjectUpdated`,(e,t)=>{let n=t;this.originalObj!==JSON.stringify(n,null,2)&&(this.originalObj=JSON.stringify(n,null,2),this.state.changed?this.forceUpdate():this.setState({text:this.originalObj}))}),u(this,`onCtrlEnter`,()=>{this.state.showCopyDialog||this.state.selectId||this.state.selectRead||this.state.selectWrite||!this.state.error&&this.state.changed&&!this.state.customError&&this.onUpdate()}),u(this,`onStateChange`,(e,t)=>{JSON.stringify(t)!==JSON.stringify(this.state.value)&&this.setState({value:t})});let t=this.props.obj._id.startsWith(`alias.0`)&&this.props.obj.type===`state`,n=(window._localStorage||window.localStorage).getItem(`${this.props.dialogName||`App`}.editTab`)||`object`,r=Ae.getLocation();r.tab===`tab-objects`&&r.dialog===`edit`&&r.id===this.props.obj._id&&r.arg&&(n=r.arg),n===`alias`&&!t&&(n=`common`),this.props.aliasTab&&t&&(n=`alias`);let i=this.props.obj,a=i.common&&`type`in i.common&&`alias`in i.common?i.common.alias.read:void 0,o=i.common&&`type`in i.common&&`alias`in i.common?i.common.alias.write:void 0;this.state={text:JSON.stringify(this.props.obj,null,2),error:!1,customError:!1,changed:!1,readError:this.checkFunction(a),writeError:this.checkFunction(o),tab:n,showCopyDialog:``,showCommonDeleteMessage:!1,selectId:!1,selectRead:!1,selectWrite:!1,newId:``,lang:w.getLanguage(),value:void 0},Nt.locale(this.state.lang),this.originalObj=JSON.stringify(this.props.obj,null,2)}async componentDidMount(){var e,t;let n=((e=this.props.obj)==null||(e=e.common)==null?void 0:e.editSchemas)||((t=this.props.obj)==null?void 0:t.editSchemas),r=[];if(n){if(typeof n==`object`){let e=Object.keys(n);for(let t=0;t<e.length;t++)try{let i=await me(n[e[t]],this.props.socket);if(i.key=e[t],i&&typeof i==`object`&&r.push(i),i.icon)try{let e=Ce(i.icon);if(e.type!==`base64`&&e.type!==`http`){let t=await me(e,this.props.socket);t&&(i.icon=t)}}catch(e){console.warn(`Cannot get icon for schema from "${i.icon}": ${e instanceof Error?e.message:String(e)}`),i.icon=void 0}}catch(r){console.warn(`Cannot get edit schema for "${n[e[t]]}": ${r instanceof Error?r.message:String(r)}`)}r.length&&(r.sort((e,t)=>e.order!==void 0&&t.order!==void 0?e.order-t.order:e.order===void 0?t.order===void 0?(e.key||``)>(t.key||``)?1:-1:1:-1),this.setState({customEditTabs:r}))}else console.warn(`Invalid edit schema for "${String(n)}": expected object, but got ${typeof n}`)}(this.state.tab===`alias`&&(!this.props.obj._id.startsWith(`alias.0`)||this.props.obj.type!==`state`)||this.state.tab===`state`&&this.props.obj.type!==`state`||this.state.tab!==`object`&&this.state.tab!==`common`&&this.state.tab!==`alias`&&this.state.tab!==`state`&&!r.find(e=>e.key===this.state.tab))&&this.setState({tab:`object`}),this.state.tab===`state`&&this.subscribeOnState(!0),this.props.socket.subscribeObject(this.props.obj._id,this.onObjectUpdated),this.isRouted()&&setTimeout(()=>{this.isRouted()&&Ae.getLocation().arg!==this.state.tab&&Ae.doNavigate(null,null,null,this.state.tab)},0)}componentWillUnmount(){this.updateTimer&&=(clearInterval(this.updateTimer),null),this.subscribeOnState(!1),this.props.socket.unsubscribeObject(this.props.obj._id,this.onObjectUpdated)}checkFunction(e){let t=ho(e);return t?this.props.t(t):``}prepareObject(e){e||=this.state.text;try{var t,n,r,i;let a=JSON.parse(e);return a._id=this.props.obj._id,(t=a.common)!=null&&t.alias&&(a.common.alias.id||delete a.common.alias.id,(!a.common.alias.read&&a.common.alias.read!==void 0||a.common.alias.read===`val`)&&delete a.common.alias.read,(!a.common.alias.write&&a.common.alias.write!==void 0||a.common.alias.write===`val`)&&delete a.common.alias.write,a.common.alias.id||a.common.alias.read||a.common.alias.write||delete a.common.alias),((n=a.common)==null?void 0:n.min)!==void 0&&typeof a.common.min!=`number`&&(a.common.min=parseFloat(a.common.min)),((r=a.common)==null?void 0:r.max)!==void 0&&typeof a.common.max!=`number`&&(a.common.max=parseFloat(a.common.max)),((i=a.common)==null?void 0:i.step)!==void 0&&typeof a.common.step!=`number`&&(a.common.step=parseFloat(a.common.step)),a}catch{return null}}onChange(e,t){let n=this.prepareObject(e),r={text:e};if(n){var i,a;r.changed=this.originalObj!==JSON.stringify(n,null,2),r.showCommonDeleteMessage=!1;let e=JSON.parse(this.originalObj);n.common&&Object.keys(e.common||{}).forEach(e=>{n.common[e]===void 0&&(r.showCommonDeleteMessage=!0)}),r.error=!1,r.readError=this.checkFunction((i=n.common)==null||(i=i.alias)==null?void 0:i.read),r.writeError=this.checkFunction((a=n.common)==null||(a=a.alias)==null?void 0:a.write)}else r.showCommonDeleteMessage=!1,r.error=!0;this.setState(r,()=>t&&t())}onUpdate(){try{var e,t,n,r;let i=JSON.parse(this.state.text);i._id=this.props.obj._id,(e=i.common)!=null&&e.alias&&(i.common.alias.id||delete i.common.alias.id,(!i.common.alias.read&&i.common.alias.read!==void 0||i.common.alias.read===`val`)&&delete i.common.alias.read,(!i.common.alias.write&&i.common.alias.write!==void 0||i.common.alias.write===`val`)&&delete i.common.alias.write,i.common.alias.id||i.common.alias.read||i.common.alias.write||delete i.common.alias),((t=i.common)==null?void 0:t.min)!==void 0&&typeof i.common.min!=`number`&&(i.common.min=parseFloat(i.common.min)),((n=i.common)==null?void 0:n.max)!==void 0&&typeof i.common.max!=`number`&&(i.common.max=parseFloat(i.common.max)),((r=i.common)==null?void 0:r.step)!==void 0&&typeof i.common.step!=`number`&&(i.common.step=parseFloat(i.common.step)),this.props.onClose(i)}catch{console.error(`Cannot parse: ${this.state.text}`)}}static getPartOfObject(e,t){return t?Fe(JSON.parse(e),t.split(`.`)):JSON.parse(e)}static setPartOfObject(e,t,n){let r=JSON.parse(e);return r===void 0?e:(r=Te(r,(n||``).split(`.`),t),JSON.stringify(r,null,2))}renderCustomPanel(){var t;let n=(t=this.state.customEditTabs)==null?void 0:t.find(e=>e.key===this.state.tab);if(!n)return null;let r;try{r=e.getPartOfObject(this.state.text,n.path)}catch(e){return console.error(`Cannot get data for ${n.path}: ${e instanceof Error?e.message:String(e)}`),T(`div`,{children:w.t(`Cannot get data for %s: %s`,n.path,e)})}return r?T(x,{theme:this.props.theme,socket:this.props.socket,themeName:this.props.theme.palette.mode,themeType:this.props.theme.palette.mode,dateFormat:this.props.dateFormat,isFloatComma:this.props.isFloatComma,schema:n.json,data:r,onChange:t=>{try{let r=e.setPartOfObject(this.state.text,t,n.path);this.onChange(r)}catch(e){console.error(`Cannot set data for ${n.path}: ${e instanceof Error?e.message:String(e)}`)}},adapterName:``,instance:0,onError:e=>{console.warn(`Error in JSON editor: ${e}`),this.state.customError!==e&&this.setState({customError:e})},AceEditor:Tt}):T(`div`,{children:w.t(`Cannot get data for %s`,n.path)})}renderCustomTab(e,t){var r;let i;if(!t||!Fe(t,(r=e.path)==null?void 0:r.split(`.`)))return null;e.color&&(i={backgroundColor:e.color,color:m.invertColor(e.color||``,!0)});let a=e.label&&typeof e.label==`object`?e.label[this.state.lang]||e.label.en||``:e.noTranslation?e.label||e.key||``:this.props.t(e.label||e.key||``);return T(n,{disabled:this.state.error||this.state.customError,value:e.key,label:a,style:i,iconPosition:`start`,icon:e.icon?T(_e,{src:e.icon,style:Q.funcIcon}):void 0})}renderStateTab(){return this.props.obj.type!==`state`||this.props.obj.common.type===`file`?null:T(n,{disabled:this.state.customError||this.state.error,value:`state`,label:this.props.t(`State`)})}renderStatePanel(){var e,t;if(this.state.value===void 0||this.state.value===null)return T(`div`,{children:this.props.t(`State does not exist`)});if(typeof this.state.value!=`object`)return E(`div`,{style:{maxWidth:700},children:[T(`div`,{children:this.props.t(`State is invalid`)}),T(`div`,{children:T(`pre`,{children:JSON.stringify(this.state.value,null,4)})})]});let n,r={},i=this.state.value.val,a=typeof i;if(i===void 0)n=`[undef]`,r.color=`#bc6400`,r.fontStyle=`italic`;else if(i===null)n=`(null)`,r.color=`#0047b1`,r.fontStyle=`italic`;else if(typeof((e=this.props.obj.common)==null?void 0:e.role)==`string`&&this.props.obj.common.role.match(/^value\.time|^date/)){if(i&&a===`string`){if(m.isStringInteger(i))n=new Date(parseInt(i,10)).toString();else try{let e=new Date(i);m.isValidDate(e)&&(n=e.toString())}catch{}}else i&&a===`number`&&(i>946681200&&i<9466812e5?n=new Date(i*1e3).toString():i>9466812e8&&(n=new Date(i).toString()))}return n||(a===`number`?Number.isInteger(i)||(n=(Math.round(i*1e9)/1e9).toString(),this.props.isFloatComma&&(n=n.toString().replace(`.`,`,`))):a===`boolean`?(n=i?w.t(`true`):w.t(`false`),r.color=i?`#139800`:`#cd6b55`):n=a===`object`?JSON.stringify(i):a===`string`&&i.startsWith(`data:image/`)?T(`img`,{src:i,alt:`img`,style:Q.stateImage}):i==null?void 0:i.toString()),Object.assign(r,Ll(this.props.theme,r.color)),E(D,{style:{...Q.divWithoutTitle,padding:`24px 24px 0 24px`,fontSize:16,maxWidth:400},sx:{"& .value-line:hover":{backgroundColor:`#00000030`}},children:[E(`div`,{className:`value-line`,style:{...Q.stateRow,marginBottom:24},children:[E(`div`,{style:Q.stateTitle,children:[w.t(`ra_tooltip_value`),`:`]}),E(D,{component:`div`,sx:r,style:Q.stateValue,children:[n,(t=this.props.obj.common)!=null&&t.unit?T(`span`,{style:Q.stateUnit,children:this.props.obj.common.unit}):null]},typeof n==`string`?n:`image`)]}),E(`div`,{style:Q.stateRow,className:`value-line`,children:[E(`div`,{style:Q.stateTitle,children:[w.t(`Type`),`:`]}),T(`div`,{style:Q.stateValue,children:a})]}),E(`div`,{style:Q.stateRow,className:`value-line`,children:[E(`div`,{style:Q.stateTitle,children:[w.t(`ra_tooltip_ts`),`:`]}),T(j,{title:new Date(this.state.value.ts).toLocaleString(),slotProps:{popper:{sx:Q.tooltip}},children:T(`div`,{style:Q.stateValue,children:T(`span`,{style:Q.stateTime,children:Nt(this.state.value.ts).fromNow()})})})]}),E(`div`,{style:Q.stateRow,className:`value-line`,children:[E(`div`,{style:Q.stateTitle,children:[w.t(`ra_tooltip_ack`),`:`]}),E(`div`,{style:{...Q.stateValue,color:this.state.value.ack?`green`:`red`},children:[this.state.value.ack?w.t(`Acknowledged`):w.t(`Command`),this.state.value.ack?` (true)`:` (false)`]})]}),E(`div`,{style:Q.stateRow,className:`value-line`,children:[E(`div`,{style:Q.stateTitle,children:[w.t(`ra_tooltip_lc`),`:`]}),T(j,{title:new Date(this.state.value.lc).toLocaleString(),slotProps:{popper:{sx:Q.tooltip}},children:T(`div`,{style:Q.stateValue,children:T(`span`,{style:Q.stateTime,children:Nt(this.state.value.lc).fromNow()})})})]}),E(`div`,{style:Q.stateRow,className:`value-line`,children:[E(`div`,{style:Q.stateTitle,children:[w.t(`ra_tooltip_quality`),`:`]}),T(`div`,{style:Q.stateValue,children:m.quality2text(this.state.value.q||0).join(`, `)})]}),E(`div`,{style:Q.stateRow,className:`value-line`,children:[E(`div`,{style:Q.stateTitle,children:[w.t(`ra_tooltip_from`),`:`]}),T(`div`,{style:Q.stateValue,children:this.state.value.from})]}),E(`div`,{style:Q.stateRow,className:`value-line`,children:[E(`div`,{style:Q.stateTitle,children:[w.t(`ra_tooltip_user`),`:`]}),T(`div`,{style:Q.stateValue,children:this.state.value.user||`--`})]}),this.state.value.expire?E(`div`,{style:Q.stateRow,className:`value-line`,children:[E(`div`,{style:Q.stateTitle,children:[w.t(`ra_tooltip_expire`),`:`]}),E(`div`,{style:Q.stateValue,children:[this.state.value.expire,` `,w.t(`sc_seconds`)]})]}):null,this.state.value.c?E(`div`,{style:Q.stateRow,className:`value-line`,children:[E(`div`,{style:Q.stateTitle,children:[w.t(`ra_tooltip_comment`),`:`]}),T(`div`,{style:Q.stateValue,children:this.state.value.c})]}):null]})}subscribeOnState(e){e?this.subscribed||(this.updateTimer||=setInterval(()=>{this.forceUpdate()},5e3),this.subscribed=!0,this.props.socket.subscribeState(this.props.obj._id,this.onStateChange)):this.subscribed&&(this.updateTimer&&=(clearInterval(this.updateTimer),null),this.subscribed=!1,this.props.socket.unsubscribeState(this.props.obj._id,this.onStateChange))}isRouted(){let e=Ae.getLocation();return e.tab===`tab-objects`&&e.dialog===`edit`&&e.id===this.props.obj._id}renderTabs(e){var t;return E(ye,{style:Q.tabsPadding,value:this.state.tab,onChange:(e,t)=>{if((window._localStorage||window.localStorage).setItem(`${this.props.dialogName||`App`}.editTab`,t),this.isRouted()&&Ae.doNavigate(null,null,null,t),t===`object`){try{var n,r,i;let e=JSON.parse(this.state.text),t=!1;((n=e.common)==null?void 0:n.min)!==void 0&&typeof e.common.min!=`number`&&(e.common.min=parseFloat(e.common.min),t=!0),((r=e.common)==null?void 0:r.max)!==void 0&&typeof e.common.max!=`number`&&(e.common.max=parseFloat(e.common.max),t=!0),((i=e.common)==null?void 0:i.step)!==void 0&&typeof e.common.step!=`number`&&(e.common.step=parseFloat(e.common.step),t=!0),t&&this.setState({text:JSON.stringify(e,null,2)})}catch{}this.subscribeOnState(!1)}else t===`state`?this.subscribeOnState(!0):this.subscribeOnState(!1);this.setState({tab:t})},children:[T(n,{value:`common`,disabled:this.state.customError||this.state.error,label:this.props.t(`common`)}),T(n,{value:`object`,disabled:this.state.customError,label:this.props.t(`Object data`)}),this.renderStateTab(),this.props.obj._id.startsWith(`alias.0`)&&this.props.obj.type===`state`&&T(n,{disabled:this.state.customError||this.state.error,value:`alias`,label:this.props.t(`Alias`)}),(t=this.state.customEditTabs)==null?void 0:t.map(t=>this.renderCustomTab(t,e))]})}renderSelectDialog(){if(!this.state.selectId&&!this.state.selectRead&&!this.state.selectWrite)return null;let e=``,t;try{var n,r;t=JSON.parse(this.state.text);let a=t.common&&`type`in t.common&&`alias`in t.common?(n=t.common.alias)==null?void 0:n.read:``,o=t.common&&`type`in t.common&&`alias`in t.common?(r=t.common.alias)==null?void 0:r.write:``;if(this.state.selectId){var i;e=((i=t.common)==null||(i=i.alias)==null?void 0:i.id)||``}else this.state.selectRead?e=a??``:this.state.selectWrite&&(e=o??``)}catch{console.error(`Cannot parse ${this.state.text}`)}return T(be,{imagePrefix:`.`,dateFormat:this.props.dateFormat,theme:this.props.theme,isFloatComma:this.props.isFloatComma,socket:this.props.socket,dialogName:`aliasesEdit`,title:`${this.props.t(`Select for`)} ${this.props.obj._id}`,selected:e,onOk:e=>{let n=this.state.selectRead,r=this.state.selectWrite,i=this.state.selectId,a=Array.isArray(e)?e[0]:e;this.setState({selectId:!1,selectRead:!1,selectWrite:!1},()=>{n?this.setAliasItem(t,`id.read`,a||``):r?this.setAliasItem(t,`id.write`,a||``):i&&this.setAliasItem(t,`id`,a||``)})},onClose:()=>this.setState({selectId:!1,selectRead:!1,selectWrite:!1})},`selectDialog`)}setAliasItem(e,t,n,r){e.common=e.common||{};let i=e.common.alias||{};t===`id.read`?i.id&&typeof i.id==`object`?i.id.read=n:i.id={read:n,write:n}:t===`id.write`?i.id&&typeof i.id==`object`?i.id.write=n:i.id={read:n,write:n}:i[t]=n,e.common.alias=i,this.onChange(JSON.stringify(e,null,2),r)}setCommonItem(e,t,n){e.common[t]=n,this.onChange(JSON.stringify(e,null,2))}removeCommonItem(e,t){delete e.common[t],this.onChange(JSON.stringify(e,null,2))}static buttonAddKey(e,t){return T(`div`,{style:Q.marginBlock,children:T(O,{style:Q.buttonAdd,variant:`contained`,color:`secondary`,startIcon:T(Ye,{}),onClick:t,children:w.t(e)})})}buttonRemoveKey(e,t,n){let{t:r}=this.props;return T(j,{title:r(`Remove attribute %s`,r(e)),slotProps:{popper:{sx:Q.tooltip}},children:T(P,{size:`small`,sx:Q.removeButton,style:n,onClick:t,children:T(N,{})})})}static filterRoles(e,t){let n=[];return e.forEach(e=>(e.type===`mixed`||e.type)===t&&!n.includes(e.role)&&n.push(e.role)),Rl.forEach(e=>(e.type===`mixed`||e.type)===t&&!n.includes(e.role)&&n.push(e.role)),n.sort(),n}renderCommonEdit(){try{let t=JSON.parse(this.state.text),n=[`number`,`string`,`boolean`,`array`,`object`,`mixed`],{t:r,obj:i}=this.props,a=i.type===`state`,o=i.type===`channel`||i.type===`device`||a,s=e.filterRoles(this.props.roleArray,t.common.type),c;if(t.common.icon&&(c=t.type===`instance`||t.type===`adapter`?`./adapter/${t.common.name}/${t.common.icon}`:t.common.icon,!c.startsWith(`.`)&&!c.startsWith(`/`)&&!c.startsWith(`data:`))){let e=i._id.split(`.`);c=e[0]===`system`?`adapter/${e[2]}${c.startsWith(`/`)?``:`/`}${c}`:`adapter/${e[0]}${c.startsWith(`/`)?``:`/`}${c}`}let u=typeof t.common.desc==`object`&&t.common.desc?t.common.desc[w.getLanguage()]||t.common.desc.en||``:t.common.desc||``,d=m.getObjectNameFromObj(t,w.getLanguage(),{},!1,!0);return E(D,{style:Q.commonTabWrapper,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),e.stopPropagation(),this.onUpdate())},children:[E(D,{style:{...Q.commonWrapper,width:this.props.width===`xs`?`100%`:void 0,minWidth:this.props.width===`xs`?`100%`:void 0,gap:this.props.width===`xs`?10:8,display:this.props.width===`xs`?`flex`:void 0,flexDirection:this.props.width===`xs`?`column`:void 0},children:[t.common.name===void 0?e.buttonAddKey(`Name`,()=>this.setCommonItem(t,`name`,``)):T(I,{variant:`standard`,disabled:!1,label:r(`Name`),style:{...Q.textField,marginTop:8},fullWidth:!0,slotProps:{input:{endAdornment:d?T(v,{position:`end`,children:T(j,{title:w.t(`Clear text`),slotProps:{popper:{sx:Q.tooltip}},children:T(P,{tabIndex:-1,size:`small`,onClick:()=>this.setCommonItem(t,`name`,``),children:T(N,{})})})}):null}},value:d,onChange:e=>this.setCommonItem(t,`name`,e.target.value)}),t.common.desc===void 0?e.buttonAddKey(`Description`,()=>this.setCommonItem(t,`desc`,``)):E(D,{component:`div`,sx:Q.flex,children:[T(I,{variant:`standard`,disabled:!1,label:r(`Description`),style:{...Q.textField,marginTop:8},fullWidth:!0,slotProps:{input:{endAdornment:u?T(v,{position:`end`,children:T(j,{title:w.t(`Clear text`),slotProps:{popper:{sx:Q.tooltip}},children:T(P,{tabIndex:-1,size:`small`,onClick:()=>this.setCommonItem(t,`desc`,``),children:T(N,{})})})}):null}},value:u,onChange:e=>this.setCommonItem(t,`desc`,e.target.value)}),this.buttonRemoveKey(`Description`,()=>this.removeCommonItem(t,`desc`))]}),a?t.common.type===void 0?e.buttonAddKey(`State type`,()=>this.setCommonItem(t,`type`,`string`)):E(D,{component:`div`,sx:Q.flex,children:[E(se,{style:Q.marginBlock,fullWidth:!0,children:[T(de,{style:{transform:`scale(0.75)`},children:r(`State type`)}),T(Ie,{variant:`standard`,disabled:!1,value:t.common.type,onChange:e=>this.setCommonItem(t,`type`,e.target.value),children:n.map(e=>E(F,{value:e,children:[r(e),E(`span`,{style:Q.typeNameEng,children:[`(`,e,`)`]})]},e))})]}),this.buttonRemoveKey(`State type`,()=>this.removeCommonItem(t,`type`),{marginTop:33})]}):null,E(D,{component:`div`,sx:{...Q.flex,flexWrap:this.props.width===`xs`?`wrap`:void 0},children:[a?t.common.read===void 0?e.buttonAddKey(`Readable`,()=>this.setCommonItem(t,`read`,!0)):E(D,{component:`div`,sx:Q.flex,children:[T(h,{style:Q.marginBlock,control:T(l,{disabled:!1,checked:t.common.read,onChange:e=>this.setCommonItem(t,`read`,e.target.checked)}),label:r(`Readable`)}),this.buttonRemoveKey(`Readable`,()=>this.removeCommonItem(t,`read`))]}):null,a?t.common.write===void 0?e.buttonAddKey(`Writeable`,()=>this.setCommonItem(t,`write`,!0)):E(D,{component:`div`,sx:Q.flex,children:[T(h,{style:Q.marginBlock,control:T(l,{disabled:!1,checked:t.common.write,onChange:e=>this.setCommonItem(t,`write`,e.target.checked)}),label:r(`Writeable`)}),this.buttonRemoveKey(`Writeable`,()=>this.removeCommonItem(t,`write`))]}):null]}),o?t.common.role===void 0?e.buttonAddKey(`Role`,()=>this.setCommonItem(t,`role`,``)):E(D,{component:`div`,sx:Q.flex,children:[T(Pe,{style:Q.marginBlock,fullWidth:!0,disabled:!1,value:t.common.role,onChange:(e,n)=>{let r=Rl.find(e=>e.role===n);r&&(r.w!==void 0&&r.r!==void 0?(this.setCommonItem(t,`write`,r.w),this.setCommonItem(t,`read`,r.r)):r.w===void 0?r.r!==void 0&&this.setCommonItem(t,`read`,r.r):this.setCommonItem(t,`write`,r.w)),n.startsWith(`level`)||n.startsWith(`indicator`)||n.startsWith(`sensor`)||n.startsWith(`weather`)||n.startsWith(`value`)||n.startsWith(`indicator`)||n.startsWith(`sensor`)||n.startsWith(`weather`)?t.common.write&&this.setCommonItem(t,`write`,!1):n.startsWith(`level`)||n.startsWith(`switch`)?t.common.write&&this.setCommonItem(t,`write`,!0):n.startsWith(`button`)&&t.common.read&&this.setCommonItem(t,`read`,!1),this.setCommonItem(t,`role`,n)},options:s,renderInput:e=>T(I,{variant:`standard`,...e,label:r(`Role`)})}),this.buttonRemoveKey(`Role`,()=>this.removeCommonItem(t,`role`),{marginTop:33})]}):null,t.common.color===void 0?e.buttonAddKey(`Color`,()=>this.setCommonItem(t,`color`,``)):E(D,{component:`div`,sx:Q.flex,children:[T(I,{variant:`standard`,disabled:!1,style:{...Q.marginBlock,...Q.color},label:r(`Color`),type:`color`,slotProps:{input:{endAdornment:t.common.color?T(v,{position:`end`,children:T(j,{title:w.t(`Clear field`),slotProps:{popper:{sx:Q.tooltip}},children:T(P,{tabIndex:-1,size:`small`,onClick:()=>this.setCommonItem(t,`color`,``),children:T(N,{})})})}):null}},value:t.common.color,onChange:e=>this.setCommonItem(t,`color`,e.target.value)}),this.buttonRemoveKey(`Color`,()=>this.removeCommonItem(t,`color`))]}),E(D,{component:`div`,sx:{...Q.flex,flexWrap:this.props.width===`xs`?`wrap`:void 0,gap:this.props.width===`xs`?`10px`:void 0},children:[t.common.type===`number`?t.common.min===void 0?T(D,{component:`div`,sx:Q.flex,children:e.buttonAddKey(`Min`,()=>this.setCommonItem(t,`min`,0))}):E(D,{component:`div`,sx:Q.flex,children:[T(I,{variant:`standard`,disabled:!1,className:{...Q.marginBlock,...Q.color},label:r(`Min`),value:t.common.min,onChange:e=>this.setCommonItem(t,`min`,e.target.value)}),this.buttonRemoveKey(`Min`,()=>this.removeCommonItem(t,`min`))]}):null,t.common.type===`number`?t.common.max===void 0?T(D,{component:`div`,sx:Q.flex,children:e.buttonAddKey(`Max`,()=>this.setCommonItem(t,`max`,100))}):E(D,{component:`div`,sx:Q.flex,children:[T(I,{variant:`standard`,disabled:!1,className:{...Q.marginBlock,...Q.color},label:r(`Max`),value:t.common.max,onChange:e=>this.setCommonItem(t,`max`,e.target.value)}),this.buttonRemoveKey(`Max`,()=>this.removeCommonItem(t,`max`))]}):null,t.common.type===`number`?t.common.step===void 0?T(D,{component:`div`,sx:Q.flex,children:e.buttonAddKey(`Step`,()=>this.setCommonItem(t,`step`,1))}):E(D,{component:`div`,sx:Q.flex,children:[T(I,{variant:`standard`,disabled:!1,className:{...Q.marginBlock,...Q.color},label:r(`Step`),value:t.common.step,onChange:e=>this.setCommonItem(t,`step`,e.target.value)}),this.buttonRemoveKey(`Step`,()=>this.removeCommonItem(t,`step`))]}):null]}),t.common.type===`number`?t.common.unit===void 0?T(`div`,{style:Q.flexDrop,children:e.buttonAddKey(`Unit`,()=>this.setCommonItem(t,`unit`,``))}):E(D,{component:`div`,sx:Q.flex,children:[T(I,{variant:`standard`,disabled:!1,className:{...Q.marginBlock,...Q.color},label:r(`Unit`),slotProps:{input:{endAdornment:t.common.unit?T(v,{position:`end`,children:T(j,{title:w.t(`Clear field`),slotProps:{popper:{sx:Q.tooltip}},children:T(P,{tabIndex:-1,size:`small`,onClick:()=>this.setCommonItem(t,`unit`,``),children:T(N,{})})})}):null}},value:t.common.unit,onChange:e=>this.setCommonItem(t,`unit`,e.target.value)}),this.buttonRemoveKey(`Unit`,()=>this.removeCommonItem(t,`unit`))]}):null]}),t.common.icon===void 0?T(D,{component:`div`,sx:Q.flex,children:e.buttonAddKey(`Icon`,()=>this.setCommonItem(t,`icon`,``))}):E(D,{component:`div`,sx:Q.flex,style:{flexGrow:1,minWidth:158},children:[T(le,{disabled:!1,maxSize:10240,icon:c,removeIconFunc:()=>this.setCommonItem(t,`icon`,``),onChange:e=>this.setCommonItem(t,`icon`,e)}),this.buttonRemoveKey(`Icon`,()=>this.removeCommonItem(t,`icon`))]})]})}catch{return T(`div`,{children:this.props.t(`Cannot parse JSON!`)})}}renderAliasEdit(){try{var e,t,n,r,i,a,o,s,c,u,d,f,m,g,_,y,b,ee;let x=JSON.parse(this.state.text),S=((e=x.common)==null||(e=e.alias)==null?void 0:e.read)!==void 0||((t=x.common)==null||(t=t.alias)==null?void 0:t.write)!==void 0;return E(p,{container:!0,style:Q.marginTop,sx:{flexDirection:`column`},children:[T(p,{children:T(h,{control:T(l,{checked:typeof((n=x.common)==null||(n=n.alias)==null?void 0:n.id)==`object`,onChange:()=>{var e;if(typeof((e=x.common)==null||(e=e.alias)==null?void 0:e.id)==`object`){var t;this.setAliasItem(x,`id`,((t=x.common)==null||(t=t.alias)==null||(t=t.id)==null?void 0:t.read)||``)}else{var n;this.setAliasItem(x,`id.read`,((n=x.common)==null||(n=n.alias)==null?void 0:n.id)||``)}}}),label:this.props.t(`Different IDs for read and write`)})}),typeof((r=x.common)==null||(r=r.alias)==null?void 0:r.id)==`object`?null:E(p,{children:[T(I,{variant:`standard`,label:this.props.t(`Alias state`),value:((i=x.common)==null||(i=i.alias)==null?void 0:i.id)||``,style:Q.aliasIdEdit,slotProps:{input:{endAdornment:(a=x.common)!=null&&(a=a.alias)!=null&&a.id?T(v,{position:`end`,children:T(j,{title:w.t(`Clear field`),slotProps:{popper:{sx:Q.tooltip}},children:T(P,{tabIndex:-1,size:`large`,onClick:()=>this.setAliasItem(x,`id`,``),children:T(N,{})})})}):null}},onChange:e=>this.setAliasItem(x,`id`,e.target.value),margin:`normal`}),T(et,{style:Q.button,size:`small`,onClick:()=>this.setState({selectId:!0,selectRead:!1,selectWrite:!1}),children:`...`})]}),typeof((o=x.common)==null||(o=o.alias)==null?void 0:o.id)==`object`?E(p,{children:[T(I,{variant:`standard`,label:this.props.t(`Alias read state`),value:((s=x.common)==null||(s=s.alias)==null||(s=s.id)==null?void 0:s.read)||``,style:Q.aliasIdEdit,slotProps:{input:{endAdornment:(c=x.common)!=null&&(c=c.alias)!=null&&(c=c.id)!=null&&c.read?T(v,{position:`end`,children:T(j,{title:w.t(`Clear field`),slotProps:{popper:{sx:Q.tooltip}},children:T(P,{size:`large`,tabIndex:-1,onClick:()=>this.setAliasItem(x,`id.read`,``),children:T(N,{})})})}):null}},onChange:e=>this.setAliasItem(x,`id.read`,e.target.value),margin:`normal`}),T(et,{style:Q.button,size:`small`,onClick:()=>this.setState({selectId:!1,selectRead:!0,selectWrite:!1}),children:`...`})]}):null,typeof((u=x.common)==null||(u=u.alias)==null?void 0:u.id)==`object`?E(p,{children:[T(I,{variant:`standard`,label:this.props.t(`Alias write state`),value:((d=x.common)==null||(d=d.alias)==null||(d=d.id)==null?void 0:d.write)||``,style:Q.aliasIdEdit,slotProps:{input:{endAdornment:(f=x.common)!=null&&(f=f.alias)!=null&&(f=f.id)!=null&&f.write?T(v,{position:`end`,children:T(j,{title:w.t(`Clear field`),slotProps:{popper:{sx:Q.tooltip}},children:T(P,{size:`large`,tabIndex:-1,onClick:()=>this.setAliasItem(x,`id.write`,``),children:T(N,{})})})}):null}},onChange:e=>this.setAliasItem(x,`id.write`,e.target.value),margin:`normal`}),T(et,{style:Q.button,size:`small`,onClick:()=>this.setState({selectId:!1,selectRead:!1,selectWrite:!0}),children:`...`})]}):null,T(p,{style:Q.marginTop,children:T(h,{control:T(l,{checked:((m=x.common)==null||(m=m.alias)==null?void 0:m.read)!==void 0||((g=x.common)==null||(g=g.alias)==null?void 0:g.write)!==void 0,onChange:()=>{S?(delete x.common.alias.read,delete x.common.alias.write):(x.common=x.common||{},x.common.alias=x.common.alias||{},x.common.alias.read=`val`,x.common.alias.write=`val`),this.onChange(JSON.stringify(x,null,2))}}),label:this.props.t(`Use convert functions`)})}),S?T(p,{children:T(I,{variant:`standard`,label:this.props.t(`Read converter`),value:((_=x.common)==null||(_=_.alias)==null?void 0:_.read)||`val`,style:Q.funcEdit,error:!!this.state.readError,slotProps:{input:{endAdornment:(y=x.common)!=null&&(y=y.alias)!=null&&y.read?T(v,{position:`end`,children:T(j,{title:w.t(`Clear field`),slotProps:{popper:{sx:Q.tooltip}},children:T(P,{size:`large`,tabIndex:-1,onClick:()=>this.setAliasItem(x,`read`,``),children:T(N,{})})})}):null,startAdornment:T(v,{position:`start`,children:T(He,{style:Q.funcIcon})})}},onChange:e=>this.setAliasItem(x,`read`,e.target.value),helperText:this.state.readError||this.props.t(`Syntax only; converter code is not executed in the browser`),margin:`normal`})}):null,S?T(p,{children:T(I,{variant:`standard`,label:this.props.t(`Write converter`),error:!!this.state.writeError,value:((b=x.common)==null||(b=b.alias)==null?void 0:b.write)||`val`,helperText:this.state.writeError||this.props.t(`Syntax only; converter code is not executed in the browser`),style:Q.funcEdit,slotProps:{input:{endAdornment:(ee=x.common)!=null&&(ee=ee.alias)!=null&&ee.write?T(v,{position:`end`,children:T(j,{title:w.t(`Clear field`),slotProps:{popper:{sx:Q.tooltip}},children:T(P,{size:`large`,tabIndex:-1,onClick:()=>this.setAliasItem(x,`write`,``),children:T(N,{})})})}):null,startAdornment:T(v,{position:`start`,children:T(He,{style:Q.funcIcon})})}},onChange:e=>this.setAliasItem(x,`write`,e.target.value),margin:`normal`})}):null]})}catch{return T(`div`,{children:this.props.t(`Cannot parse JSON!`)})}}onCopy(e){m.copyToClipboard(this.state.text,e),window.alert(this.props.t(`ra_Copied`))}onClone(e,t){let n=JSON.parse(JSON.stringify(this.props.objects[e]));delete n.from,delete n.ts,delete n.user,n._id=t,this.props.objects[n._id]=n,this.props.onNewObject(n)}renderCopyDialog(){return this.state.showCopyDialog?E(k,{open:!0,maxWidth:`md`,fullWidth:!0,onClose:()=>this.setState({showCopyDialog:``}),onKeyDown:e=>Et(e,()=>{this.props.objects[this.state.newId]||(this.setState({showCopyDialog:``}),this.onClone(this.state.showCopyDialog,this.state.newId))}),children:[T(d,{children:this.props.t(`Enter new ID for this object`)}),T(C,{children:T(I,{variant:`standard`,autoFocus:!0,fullWidth:!0,label:this.props.t(`New object ID`),value:this.state.newId,slotProps:{input:{endAdornment:this.state.newId?T(v,{position:`end`,children:T(j,{title:w.t(`Clear field`),slotProps:{popper:{sx:Q.tooltip}},children:T(P,{size:`small`,tabIndex:-1,onClick:()=>this.setState({newId:``}),children:T(N,{})})})}):null}},onKeyDown:e=>{e.key===`Enter`&&!this.props.objects[this.state.newId]&&(this.setState({showCopyDialog:``}),this.onClone(this.state.showCopyDialog,this.state.newId))},onChange:e=>this.setState({newId:e.target.value})})}),E(S,{children:[T(O,{disabled:!!this.props.objects[this.state.newId],onClick:()=>{this.setState({showCopyDialog:``}),this.onClone(this.state.showCopyDialog,this.state.newId)},color:`primary`,startIcon:T(lt,{}),children:this.props.t(`Clone`)}),T(O,{color:`grey`,onClick:()=>this.setState({showCopyDialog:``}),startIcon:T(N,{}),children:this.props.t(`Cancel`)})]})]}):null}renderPanelObject(e){return E(`div`,{style:{...Q.divWithoutTitle,...e?Q.divWithoutTitleAndTab:void 0,...this.state.error?Q.error:void 0},children:[T(kt,{value:this.state.text,onChange:e=>this.onChange(e),onCtrlEnter:this.onCtrlEnter,name:`UNIQUE_ID_OF_DIV`,themeType:this.props.themeType}),this.state.showCommonDeleteMessage?T(`div`,{style:Q.commonDeleteTip,children:w.t(`common_delete_tip`)}):null]})}render(){let e=this.props.obj,t=e._id.startsWith(`alias.0`)&&e.type===`state`,n=Q.dialog;window.innerWidth>1920&&(n={...n,maxWidth:`calc(100% - 150px)`});let r;try{r=JSON.parse(this.state.text)}catch{}return E(k,{sx:{"& .MuiPaper-root":n},open:!0,maxWidth:`xl`,fullWidth:!0,fullScreen:!1,onClose:()=>this.props.onClose(),onKeyDown:e=>Et(e,this.onCtrlEnter),"aria-labelledby":`edit-value-dialog-title`,"aria-describedby":`edit-value-dialog-description`,children:[E(d,{id:`edit-value-dialog-title`,style:{width:`calc(100% - 32px)`,overflow:`hidden`,textOverflow:`ellipsis`},children:[this.props.t(`Edit object:`),` `,T(D,{component:`span`,style:Q.id,sx:{fontSize:{xs:10}},children:this.props.obj._id})]}),this.renderTabs(r),this.renderCopyDialog(),E(C,{sx:{p:this.props.width===`xs`&&this.state.tab===`object`?`6px`:this.state.tab===`object`||this.state.tab===`common`||this.state.tab===`alias`?`0 24px`:`0 6px`,overflow:this.state.tab===`object`||this.state.tab===`common`||this.state.tab===`alias`?void 0:`hidden`},children:[this.state.tab===`object`?this.renderPanelObject(t):null,this.state.tab===`alias`&&this.props.obj._id.startsWith(`alias.0`)&&this.props.obj.type===`state`?this.renderAliasEdit():null,this.state.tab===`common`?this.renderCommonEdit():null,this.state.tab===`state`?this.renderStatePanel():null,this.renderCustomPanel(),this.renderSelectDialog()]}),E(S,{sx:Q.wrapperButton,children:[T(O,{color:`grey`,onClick:()=>this.setState({showCopyDialog:this.props.obj._id,newId:this.props.obj._id}),disabled:this.state.error||this.state.changed,title:this.props.t(`Create a copy of this object`),children:T(lt,{fontSize:this.props.width===`xs`?`large`:void 0})}),T(`div`,{style:{flexGrow:1}}),this.state.tab===`object`&&T(O,{color:`grey`,onClick:e=>this.onCopy(e),disabled:this.state.error,title:this.props.width===`xs`?this.props.t(`Copy into clipboard`):``,startIcon:this.props.width===`xs`?void 0:T($e,{}),children:this.props.width===`xs`?T($e,{fontSize:32}):this.props.t(`Copy into clipboard`)}),T(j,{title:this.props.t(`Press CTRL+ENTER to confirm`),slotProps:{popper:{sx:Q.tooltip}},children:T(`span`,{children:T(O,{variant:`contained`,disabled:this.state.error||!this.state.changed||this.state.customError,onClick:()=>this.onUpdate(),startIcon:this.props.width===`xs`?void 0:T(f,{}),color:`primary`,children:this.props.width===`xs`?T(f,{fontSize:`large`}):this.props.t(`Write`)})})}),T(O,{color:`grey`,variant:`contained`,onClick:()=>this.props.onClose(),startIcon:this.props.width===`xs`?void 0:T(N,{}),children:this.props.width===`xs`?T(N,{fontSize:`large`}):this.props.t(`Cancel`)})]})]})}};c();var Bl=class e extends Le{constructor(e){super(e),u(this,`object`,null),u(this,`onCtrlEnter`,()=>{this.state.initRole!==this.state.roleInput&&this.onUpdate()}),this.state={role:null,initRole:null,roleInput:null}}componentDidMount(){this.props.socket.getObject(this.props.id).then(e=>{var t;this.object=e||null;let n=(e==null||(t=e.common)==null?void 0:t.role)||``;this.setState({role:n,initRole:n,roleInput:n})}).catch(e=>console.error(e))}onUpdate(){let e=this.object;e&&(e.common=e.common||{},e.common.role=this.state.roleInput||void 0,this.props.socket.setObject(e._id,e).then(()=>this.props.onClose(e)))}static filterRoles(e,t){let n=[];return e.forEach(e=>(e.type===`mixed`||e.type)===t&&!n.includes(e.role)&&n.push(e.role)),Rl.forEach(e=>(e.type===`mixed`||e.type)===t&&!n.includes(e.role)&&n.push(e.role)),n.sort(),n}render(){return E(k,{open:!0,maxWidth:`sm`,fullWidth:!0,onClose:()=>this.props.onClose(),onKeyDown:e=>Et(e,this.onCtrlEnter),"aria-labelledby":`edit-role-dialog-title`,"aria-describedby":`edit-role-dialog-description`,children:[T(d,{id:`edit-role-dialog-title`,children:this.object?this.props.t(`Update role for %s`,this.object._id):null}),T(C,{children:T(Pe,{freeSolo:!0,options:e.filterRoles(this.props.roleArray,this.props.commonType),style:{width:`100%`},value:this.state.role,onChange:(e,t)=>this.setState({role:t,roleInput:t}),onInputChange:(e,t)=>this.setState({roleInput:t}),renderInput:e=>T(I,{variant:`standard`,...e,label:this.props.t(`Role`)})})}),E(S,{children:[T(j,{title:this.props.t(`Press CTRL+ENTER to confirm`),children:T(`span`,{children:T(O,{disabled:this.state.initRole===this.state.roleInput,variant:`contained`,onClick:()=>this.onUpdate(),color:`primary`,startIcon:T(f,{}),children:this.props.t(`Apply`)})})}),T(O,{variant:`contained`,onClick:()=>this.props.onClose(),color:`grey`,startIcon:T(N,{}),children:this.props.t(`Cancel`)})]})]},`objectBrowserEditRole`)}},Vl=[`array`,`boolean`,`file`,`json`,`mixed`,`number`,`object`,`string`],Hl={boolean:!1,string:``,number:0},Ul={state:{name:`State`,value:`state`},channel:{name:`Channel`,value:`channel`},device:{name:`Device`,value:`device`},folder:{name:`Folder`,value:`folder`}},Wl=({onClose:e,onApply:t,selected:n,setObject:r,objects:i,expertMode:a,initialType:o,initialStateType:s})=>{var c;let l={state:w.t(`New state`),channel:w.t(`New channel`),device:w.t(`New device`),folder:w.t(`New folder`)},u=[],p=(c=i[n])==null?void 0:c.type;i[n]?p===`channel`?(u.push(Ul.state),o||=`state`):p===`device`?(o||=`channel`,u.push(Ul.state),u.push(Ul.channel)):p===`state`?o||=``:(u.push(Ul.state),u.push(Ul.channel),u.push(Ul.device),n.startsWith(`0_userdata.`)||n.startsWith(`alias.0.`)||n===`0_userdata`||n===`alias.0`?(u.push(Ul.folder),o||=`folder`):o||=`state`):(u.push(Ul.folder),o||=`folder`,a&&(n.startsWith(`mqtt.`)||n.startsWith(`javascript.`))&&(u.push(Ul.state),u.push(Ul.channel),u.push(Ul.device)));let h=(window._localStorage||window.localStorage).getItem(`App.lastObjectType`);h&&u.find(e=>e.value===h)&&(o=h);function g(e){return`${n}.${e.toString().replace(m.FORBIDDEN_CHARS,`_`).replace(/\s/g,`_`).replace(/\./g,`_`)}`}let[_,y]=A(o),[b,ee]=A(l[o]),[x,te]=A(s||(window._localStorage||window.localStorage).getItem(`App.lastStateType`)||`string`),[ne,re]=A(!i[g(l.state)]),ie=()=>{let e={common:{name:b,desc:w.t(`Manually created`)},type:_};_===`state`?(e.common={...e.common,role:`state`,type:x,read:!0,write:!0,def:Hl[x]},e.native={}):_===`folder`?delete e.common.desc:e.common={...e.common,role:``,icon:``},r(`${n}.${b.split(` `).join(`_`)}`,e).then(()=>t())},ae=w.getLanguage(),oe=!b||!_||!ne||_===`state`&&!x;return E(k,{open:!0,fullWidth:!0,maxWidth:`md`,onClose:e,onKeyDown:e=>Et(e,()=>{oe||ie()}),children:[T(d,{children:E(`div`,{style:{margin:10,fontSize:20,display:`flex`,alignItems:`center`,gap:8},children:[T(st,{}),w.t(`Add new object:`),E(`span`,{style:{fontStyle:`italic`},children:[n,`.`,b]})]})}),T(C,{children:E(`div`,{style:{display:`flex`,flexDirection:`column`},children:[T(I,{variant:`standard`,label:w.t(`Parent`),style:{margin:`5px 0`},disabled:!0,value:n}),E(se,{variant:`standard`,style:{marginTop:10,marginBottom:16},children:[T(de,{children:w.t(`Type`)}),T(Ie,{variant:`standard`,value:_,onChange:e=>{(window._localStorage||window.localStorage).setItem(`App.lastObjectType`,e.target.value),b===l[_]&&(ee(l[e.target.value]),re(!!i[g(l[e.target.value])])),y(e.target.value)},children:u.map(e=>E(F,{value:e.value,children:[w.t(e.name),ae!==`en`&&E(`span`,{style:{fontSize:`smaller`,opacity:.6,marginLeft:4},children:[`(`,e.value,`)`]})]},e.value))})]}),_===`state`&&E(se,{style:{marginTop:10,marginBottom:16},children:[T(de,{style:{left:-14},children:w.t(`State type`)}),T(Ie,{style:{marginTop:6},variant:`standard`,value:x,onChange:e=>{(window._localStorage||window.localStorage).setItem(`App.lastStateType`,e.target.value),te(e.target.value)},children:Vl.map(e=>E(F,{value:e,children:[w.t(e),ae!==`en`&&w.t(e)!==e&&E(`span`,{style:{fontSize:`smaller`,opacity:.6,marginLeft:4},children:[`(`,e,`)`]})]},e))})]}),T(I,{variant:`standard`,label:w.t(`Name`),style:{margin:`5px 0`},autoFocus:!0,value:b,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),b&&ie())},slotProps:{input:{endAdornment:b?T(v,{position:`end`,children:T(P,{tabIndex:-1,size:`small`,onClick:()=>ee(``),children:T(N,{})})}):null}},onChange:e=>{re(!i[g(e.target.value)]),ee(e.target.value)}})]})}),E(S,{children:[T(j,{title:w.t(`Press CTRL+ENTER to confirm`),children:T(`span`,{children:T(O,{id:`add-new-object-dialog-add`,startIcon:T(f,{}),disabled:oe,onClick:()=>ie(),variant:`contained`,color:`primary`,children:w.t(`add`)})})}),T(O,{id:`add-new-object-dialog-cancel`,color:`grey`,onClick:e,variant:`contained`,startIcon:T(N,{}),children:w.t(`ra_Cancel`)})]})]})},Gl=[{Owner:[{name:`read`,valueNum:1024,title:`read owner`},{name:`write`,valueNum:512,title:`write owner`}]},{Group:[{name:`read`,valueNum:64,title:`read group`},{name:`write`,valueNum:32,title:`write group`}]},{Everyone:[{name:`read`,valueNum:4,title:`read everyone`},{name:`write`,valueNum:2,title:`write everyone`}]}];function Kl(e,t,n){return e|=t&n,e&=t|~n&65535,e}var ql=({value:e,setValue:t,t:n,differentValues:r,applyToChildren:i,mask:a,setMask:o,disabled:s})=>{ve(()=>{if(i){let t=0;for(let n=0;n<r.length;n++)t|=e^r[n];o(t)}else o(0)},[r,i,o,e]);let c=new Set,u=e;for(let e of Gl)for(let t of e[Object.keys(e)[0]])u-t.valueNum>=0&&(u-=t.valueNum,c.add(t.valueNum));return T(`div`,{style:{display:`flex`,width:`fit-content`,margin:20,border:`1px solid`,borderLeft:0},children:Gl.map(r=>{let i=Object.keys(r)[0];return E(`div`,{style:{width:150,height:150,display:`flex`,flexDirection:`column`,alignItems:`center`,borderLeft:`1px solid`},children:[T(`div`,{style:{height:50,display:`flex`,alignItems:`center`,fontSize:18,borderBottom:`1px solid silver`,width:`100%`,justifyContent:`center`},children:n(i)}),T(`div`,{style:{display:`flex`,width:`100%`},children:r[i].map((r,i)=>{let u=c.has(r.valueNum),d=a&r.valueNum;return E(`div`,{style:{display:`flex`,flexDirection:`column`,flex:1,alignItems:`center`,borderRight:i===0?`1px solid`:0},children:[T(`div`,{style:{height:50,borderBottom:`1px solid`,width:`100%`,justifyContent:`center`,display:`flex`,alignItems:`center`,color:`silver`},children:n(r.name)}),T(`div`,{style:{height:50,display:`flex`},children:T(l,{disabled:s,checked:u,color:d?`primary`:`secondary`,indeterminate:!!d,style:d?{opacity:.5}:void 0,onChange:n=>{d&&(a&=~r.valueNum&65535,o(a));let i=e;n.target.checked?i|=r.valueNum:i&=~r.valueNum&65535,t(i)}})})]},r.valueNum)})})]},i)})})},Jl=({onClose:e,onApply:t,selected:n,extendObject:r,objects:i,t:a,modalEmptyId:o,themeType:s,theme:c})=>{let[l,u]=A(void 0),[d,f]=A(void 0),[p,h]=A([]),[g,_]=A([]),[v,y]=A(!1),[b,ee]=A(!1),[x,S]=A(0),[C,te]=A(null),[re,ie]=A(null),[ae,oe]=A(!1),[ce,le]=A(!1),[ue,fe]=A([]),[D,me]=A([]),[he,ge]=A(0),[O,ye]=A(0),[be,xe]=A([]),[Se,Ce]=A(!1),[we,Te]=A(!0),Ee=a(`different`);return ve(()=>{let e=0,t=[],r=[],a=n||o,s=`${a}.`,c=Object.keys(i).sort(),l=!1,d=[],p=[],g=w.getLanguage(),v=!1,b=!1,x=null,C=null,ne=null,re=null,T=[];for(let n=0;n<c.length;n++){let o=c[n],u=i[o];if(u&&(o===a||o.startsWith(s))){var se,E,ue,de,pe,D,he,ge,O,_e,ve,ye,be,Se;if(e++,T.push(o),!u.acl)continue;if(ne===null&&((se=u.acl)==null?void 0:se.object)!==void 0){var Ce;ne=(Ce=u.acl)==null?void 0:Ce.object}if(re===null&&((E=u.acl)==null?void 0:E.state)!==void 0){var we;re=((we=u.acl)==null?void 0:we.state)??null}if(x===null&&((ue=u.acl)==null?void 0:ue.owner)!==void 0){var Te;x=(Te=u.acl)==null?void 0:Te.owner}if(C===null&&((de=u.acl)==null?void 0:de.ownerGroup)!==void 0){var Ee;C=(Ee=u.acl)==null?void 0:Ee.ownerGroup}if(!ae&&x!==((pe=u.acl)==null?void 0:pe.owner)&&((D=u.acl)==null?void 0:D.owner)!==void 0&&(v=!0),!ce&&C!==((he=u.acl)==null?void 0:he.ownerGroup)&&((ge=u.acl)==null?void 0:ge.ownerGroup)!==void 0&&(b=!0),((O=u.acl)==null?void 0:O.state)!==void 0&&re!==((_e=u.acl)==null?void 0:_e.state)&&!t.includes((ve=u.acl)==null?void 0:ve.state)){var De;t.push((De=u.acl)==null?void 0:De.state)}if(((ye=u.acl)==null?void 0:ye.object)!==void 0&&ne!==((be=u.acl)==null?void 0:be.object)&&!r.includes((Se=u.acl)==null?void 0:Se.object)){var Oe;r.push((Oe=u.acl)==null?void 0:Oe.object)}u.type===`state`&&(l=!0)}if(o.startsWith(`system.group.`)&&(u==null?void 0:u.type)===`group`){var ke,k;d.push({name:m.getObjectNameFromObj(u,g).replace(`system.group.`,``),value:o,icon:(ke=u.common)==null?void 0:ke.icon,color:(k=u.common)==null?void 0:k.color})}else if(o.startsWith(`system.user.`)&&(u==null?void 0:u.type)===`user`){var Ae,je;p.push({name:m.getObjectNameFromObj(u,g).replace(`system.user.`,``),value:o,icon:(Ae=u.common)==null?void 0:Ae.icon,color:(je=u.common)==null?void 0:je.color})}}x||=i[`system.config`].common.defaultNewAcl.owner,C||=i[`system.config`].common.defaultNewAcl.ownerGroup,ne||=i[`system.config`].common.defaultNewAcl.object,te(Number.isNaN(ne)?i[`system.config`].common.defaultNewAcl.object:ne),l&&(re||=i[`system.config`].common.defaultNewAcl.state,ie(Number.isNaN(re)?i[`system.config`].common.defaultNewAcl.state:re));let Me=p.find(e=>e.value===x),Ne=d.find(e=>e.value===C);u(Me),f(Ne),oe(v),le(b),h(p),_(d),l&&ee(!0),o&&y(!0),S(e),fe(t),me(r),xe(T)},[i,n,ce,ae,o]),ve(()=>{if(v)ce&&((d==null?void 0:d.value)!==`different`&&f({name:Ee,value:`different`}),g.find(e=>e.value===`different`)||_(e=>[{name:Ee,value:`different`},...e])),ae&&(l&&l.value===`different`||u({name:Ee,value:`different`}),p.find(e=>e.value===`different`)||h(e=>[{name:Ee,value:`different`},...e]));else{if(l&&l.value===`different`){var e;u((e=i[n].acl)==null?void 0:e.owner)}if(d&&d.value===`different`){var t;f((t=i[n].acl)==null?void 0:t.ownerGroup)}_(e=>e.filter(({value:e})=>e!==`different`)),h(e=>e.filter(({value:e})=>e!==`different`))}},[p,v,ae,ce,i,n,d,l,Ee,g]),be.length?T(Ht,{theme:c,titleButtonApply:`apply`,overflowHidden:!0,disableApply:we,progress:Se,onClose:e,onApply:()=>{Ce(!0),setTimeout(()=>{if(v){let t=~he&65535,n=~O&65535;for(let o=0;o<be.length;o++){var e;let s=be[o],c=i[s],u=m.clone(c.acl||{});if(u.object=Kl(((e=c.acl)==null?void 0:e.object)??0,C??0,t),l&&l.value!==`different`&&(u.owner=l.value),d&&d.value!==`different`&&(u.ownerGroup=d.value),c.type===`state`){var a;u.state=Kl(((a=c.acl)==null?void 0:a.state)??0,re??0,n)}r(s,{acl:u})}}else{let e=m.clone(i[n].acl||{});e.object=C??0,e.owner=l?l.value:`system.user.admin`,e.ownerGroup=d?d.value:`system.group.administrator`,i[n].type===`state`&&(e.state=re??0),r(n,{acl:e})}Ce(!1),t()},200)},children:E(`div`,{style:{display:`flex`,flexDirection:`column`},children:[T(`div`,{style:{margin:10,fontSize:20},children:a(`Access control list: %s`,n||o)}),E(`div`,{style:{display:`flex`},children:[E(se,{variant:`standard`,fullWidth:!0,style:{marginRight:10},children:[T(de,{children:a(`Owner user`)}),T(Ie,{variant:`standard`,disabled:Se,value:l?l.value:``,renderValue:()=>E(`span`,{children:[l!=null&&l.icon?T(_e,{src:l.icon,style:{width:16,height:16,marginRight:8}}):null,l?l.name:``]}),style:(l==null?void 0:l.value)===`different`?{opacity:.5}:{color:(l==null?void 0:l.color)||void 0,backgroundColor:m.getInvertedColor(l==null?void 0:l.color,s)},onChange:e=>{let t=p.find(t=>t.value===e.target.value);u(t),Te(!1)},children:p.map(e=>E(F,{style:e.value===`different`?{opacity:.5}:{color:e.color||void 0,backgroundColor:m.getInvertedColor(e.color,s)},value:e.value,children:[e.icon?T(_e,{src:e.icon,style:{width:16,height:16,marginRight:8}}):null,e.name]},e.value))})]}),E(se,{variant:`standard`,fullWidth:!0,children:[T(de,{children:a(`Owner group`)}),T(Ie,{variant:`standard`,disabled:Se,value:d?d.value:``,renderValue:()=>E(`span`,{children:[d!=null&&d.icon?T(_e,{src:d.icon,style:{width:16,height:16,marginRight:8}}):null,d?d.name:``]}),style:(d==null?void 0:d.value)===`different`?{opacity:.5}:{color:(d==null?void 0:d.color)||void 0,backgroundColor:m.getInvertedColor(d==null?void 0:d.color,s)},onChange:e=>{let t=g.find(t=>t.value===e.target.value);f(t),Te(!1)},children:g.map(e=>E(F,{value:e.value,style:e.value===`different`?{opacity:.5}:{color:e.color||void 0,backgroundColor:m.getInvertedColor(e.color,s)},children:[e.icon?T(_e,{src:e.icon,style:{width:16,height:16,marginRight:8}}):null,e.name]},e.value))})]})]}),E(`div`,{style:{display:`flex`,margin:10,alignItems:`center`,fontSize:10,marginLeft:0,color:`silver`},children:[T(`div`,{style:v?void 0:{color:`green`},children:a(`to apply one item`)}),T(ne,{disabled:Se||!!o||x===1,checked:!!o||v,onChange:e=>{y(e.target.checked),Te(!1)},color:`primary`}),E(`div`,{style:v?{color:`green`}:void 0,children:[a(`to apply with children`),` `,o||x>1?`(${x} ${a(`object(s)`)})`:``]})]}),Se&&T(pe,{}),E(`div`,{style:{overflowY:`auto`},children:[E(`div`,{children:[T(`h2`,{children:a(`Object rights`)}),T(ql,{mask:O,disabled:Se,setMask:ye,applyToChildren:v,differentValues:D,t:a,setValue:e=>{te(e),Te(!1)},value:C??0})]}),b&&E(`div`,{children:[T(`h2`,{children:a(`States rights`)}),T(ql,{mask:he,disabled:Se,setMask:ge,applyToChildren:v,differentValues:v?ue:[],t:a,setValue:e=>{ie(e),Te(!1)},value:re??0})]})]})]})}):T(pe,{})};c();var Yl={dialog:{height:`100%`,maxHeight:`100%`,maxWidth:`100%`},content:{textAlign:`center`},error:e=>({color:e.palette.mode===`dark`?`#ff7777`:`#c20000`}),image:{height:`100%`,width:`auto`},text:{fontFamily:`Lucida Console, Courier, monospace`,width:`100%`},download:{textDecoration:`none`,textTransform:`uppercase`,fontSize:14,color:`white`,border:`1px solid white`,borderRadius:5,padding:`8px 16px`,marginRight:8}},Xl=class extends Le{constructor(e){super(e),u(this,`audioRef`,void 0);let t=this.props.obj._id.split(`.`);this.state={error:``,image:!1,text:null,binary:null,fileName:`${t[t.length-2]}.${t[t.length-1]}`},this.audioRef=y.createRef()}componentDidMount(){this.props.socket.getBinaryState(this.props.obj._id).then(e=>{e||=``;let t=this.props.obj._id.toLowerCase().split(`.`).pop(),n=m.detectMimeType(e);if(n&&(t=n),t===`jpg`)this.setState({image:!0,binary:e,mime:`image/jpeg`});else if(t===`svg`)this.setState({image:!0,binary:e,mime:`image/svg+xml`});else if(t===`png`||t===`bmp`)this.setState({image:!0,binary:e,mime:`image/${t}`});else if(t===`mp3`)this.setState({audio:!0,binary:e,mime:`audio/mpeg`});else if(t===`ogg`)this.setState({audio:!0,binary:e,mime:`audio/ogg`});else if(t===`txt`||t===`log`)try{let t=btoa(e);this.setState({text:t,binary:e,mime:`text/plain`})}catch{}}).catch(e=>this.setState({error:e}))}render(){return E(k,{style:Yl.dialog,open:!0,maxWidth:this.state.audio?`sm`:`md`,onClose:()=>this.props.onClose(),fullWidth:!0,"aria-labelledby":`object-view-dialog-title`,children:[T(d,{id:`object-view-dialog-title`,children:this.props.t(`View file in state: %s`,this.props.obj._id)}),E(C,{style:Yl.content,children:[this.state.error?T(D,{component:`div`,sx:Yl.error,children:this.state.error===`State is not binary`?this.props.t(`No file stored yet`):this.props.t(this.state.error)}):null,this.state.audio?T(`audio`,{ref:this.audioRef,src:`data:${this.state.mime};base64,${this.state.binary}`}):null,this.state.audio?T(et,{color:`primary`,onClick:()=>this.audioRef.current&&this.audioRef.current.play(),children:T(g,{})}):null,this.state.image?T(`img`,{src:`data:${this.state.mime};base64,${this.state.binary}`,alt:this.props.obj._id,style:Yl.image}):null,this.state.text===null?null:T(`pre`,{style:Yl.text,children:this.state.text})]}),E(S,{children:[E(`a`,{style:Yl.download,download:this.state.fileName,href:`data:${this.state.mime};base64,${this.state.binary}`,children:[T(ot,{style:{paddingRight:8,height:12}}),T(`span`,{children:this.props.t(`Download`)})]}),T(O,{variant:`contained`,onClick:()=>this.props.onClose(),startIcon:T(N,{}),color:`grey`,children:this.props.t(`Close`)})]})]})}};c();var $={funcIcon:{width:16,height:16},formControlLabel:{marginBottom:16},color:{width:70},typeNameEng:{marginLeft:8,opacity:.7,fontStyle:`italic`,fontSize:`smaller`},usedInAlias:{},addNewAlias:e=>({backgroundColor:e.palette.primary.main})},Zl=[`array`,`boolean`,`file`,`json`,`mixed`,`number`,`object`,`string`],Ql=o(),$l=class e extends Le{constructor(t){super(t),u(this,`aliasIDs`,void 0),u(this,`aliasFolders`,void 0),u(this,`sourceName`,void 0),u(this,`onCreateAlias`,async()=>{let e={_id:`alias.0.${this.state.newAliasId}`,type:`state`,common:{name:this.state.newAliasName,type:this.props.obj.common.type,alias:{id:this.props.obj._id}},native:{}};this.state.newAliasDesc&&(e.common.desc=this.state.newAliasDesc),this.state.newAliasType&&(e.common.type=this.state.newAliasType),this.state.newAliasType===`number`&&this.state.newAliasUnit&&(e.common.unit=this.state.newAliasUnit),this.state.newAliasRole&&(e.common.role=this.state.newAliasRole),this.state.newAliasType===`number`&&this.state.newAliasMin&&(e.common.min=parseFloat(this.state.newAliasMin)),this.state.newAliasType===`number`&&this.state.newAliasMax&&(e.common.max=parseFloat(this.state.newAliasMax)),this.state.newAliasRole&&(e.common.role=this.state.newAliasRole),this.state.newAliasRead!==void 0&&this.state.newAliasRead!==null&&(e.common.read=this.state.newAliasRead),this.state.newAliasWrite!==void 0&&this.state.newAliasWrite!==null&&(e.common.write=this.state.newAliasWrite),this.state.newAliasColor&&(e.common.color=this.state.newAliasColor),this.state.newAliasIcon&&(e.common.icon=this.state.newAliasIcon),this.state.newAliasCopyStates&&this.props.obj.common.states&&(e.common.states=this.props.obj.common.states),this.state.newAliasUseFormula&&(e.common.read!==!1&&this.state.newAliasReadFormula&&this.state.newAliasReadFormula!==`val`&&(e.common.alias.read=this.state.newAliasReadFormula),e.common.write!==!1&&this.state.newAliasWriteFormula&&this.state.newAliasWriteFormula!==`val`&&(e.common.alias.write=this.state.newAliasWriteFormula)),await this.props.socket.setObject(e._id,e),this.setState({showAddNewAlias:!1}),this.props.onRedirect(e._id,2e3),this.props.onClose()});let n=[],r=this.props.obj._id;this.aliasIDs=Object.keys(this.props.objects).filter(e=>e.startsWith(`alias.0`));for(let e=0;e<this.aliasIDs.length;e++){let t=this.props.objects[this.aliasIDs[e]],i=(t==null?void 0:t.type)===`state`?t.common.alias:void 0;((i==null?void 0:i.id)===r||typeof(i==null?void 0:i.id)==`object`&&(i.id.read===r||i.id.write===r))&&n.push(this.aliasIDs[e])}this.aliasFolders=e.getAliasFolders(this.aliasIDs,this.props.objects),this.sourceName=r.split(`.`).pop()||``,this.state={usedInAliases:n,showAddNewAlias:!n.length,newAliasId:this.props.obj._id,newAliasName:e.getText(this.props.obj.common.name||this.props.obj._id)||``,newAliasRole:this.props.obj.common.role||``,newAliasRead:this.props.obj.common.read,newAliasWrite:this.props.obj.common.write,newAliasUnit:this.props.obj.common.unit||``,newAliasDesc:e.getText(this.props.obj.common.desc)||``,newAliasType:this.props.obj.common.type||`mixed`,newAliasMin:this.props.obj.common.min===void 0?``:this.props.obj.common.min.toString(),newAliasMax:this.props.obj.common.max===void 0?``:this.props.obj.common.max.toString(),newAliasUseFormula:!1,newAliasReadFormula:`val`,newAliasWriteFormula:`val`,newAliasColor:this.props.obj.common.color||``,newAliasIcon:this.props.obj.common.icon||``,newAliasCopyStates:!!this.props.obj.common.states}}static getText(e){return e?typeof e==`object`?e[w.getLanguage()]||e.en||``:e.toString():``}static getAliasFolders(e,t){let n=[];for(let i=0;i<e.length;i++){var r;let a=e[i];if(!a.startsWith(`alias.0.`))continue;let o=a.substring(8).split(`.`);((r=t[a])==null?void 0:r.type)===`state`&&o.pop();let s=``;for(let e=0;e<o.length;e++)s+=`${o[e]}.`,n.includes(s)||n.push(s)}return n.sort(),n}static filterRoles(e,t){let n=[];return Rl.forEach(e=>(e.type===`mixed`||e.type===t)&&!n.includes(e.role)&&n.push(e.role)),e.forEach(e=>(e.type===`mixed`||e.type)===t&&!n.includes(e.role)&&n.push(e.role)),n.sort(),n}renderAddNewAlias(){return this.state.showAddNewAlias?E(k,{open:!0,onClose:()=>this.setState({showAddNewAlias:!1}),onKeyDown:e=>Et(e,()=>{this.state.newAliasId&&!this.props.objects[`alias.0.${this.state.newAliasId}`]&&this.onCreateAlias()}),children:[T(d,{children:w.t(`Create new alias: %s`,`alias.0.${this.state.newAliasId}`)}),E(C,{children:[T(Pe,{style:$.formControlLabel,freeSolo:!0,options:this.aliasFolders,value:this.state.newAliasId,inputValue:this.state.newAliasId,onChange:(e,t,n)=>this.setState({newAliasId:n===`selectOption`&&t?t+this.sourceName:t||``}),onInputChange:(e,t)=>this.setState({newAliasId:t}),disableCloseOnSelect:!0,filterOptions:(e,t)=>{let n=this.state.newAliasId,r=n.substring(0,n.lastIndexOf(`.`)+1),i=Ql(e.filter(e=>e.length>r.length&&e.startsWith(r)&&!e.slice(r.length,-1).includes(`.`)),{...t,inputValue:n===r+this.sourceName?r:n});return!i.length&&r&&!e.includes(r)?e.filter(e=>!e.slice(0,-1).includes(`.`)):i},renderInput:e=>T(I,{variant:`standard`,...e,label:w.t(`Alias ID`),helperText:`alias.0.${this.state.newAliasId}`}),fullWidth:!0}),T(I,{style:$.formControlLabel,variant:`standard`,value:this.state.newAliasName,slotProps:{input:{endAdornment:this.state.newAliasName?T(v,{position:`end`,children:T(P,{tabIndex:-1,size:`small`,onClick:()=>this.setState({newAliasName:``}),children:T(N,{})})}):null}},onChange:e=>this.setState({newAliasName:e.target.value}),label:w.t(`Alias name`),fullWidth:!0}),T(I,{style:$.formControlLabel,variant:`standard`,value:this.state.newAliasDesc,slotProps:{input:{endAdornment:this.state.newAliasDesc?T(v,{position:`end`,children:T(P,{tabIndex:-1,size:`small`,onClick:()=>this.setState({newAliasDesc:``}),children:T(N,{})})}):null}},onChange:e=>this.setState({newAliasDesc:e.target.value}),label:w.t(`Alias description`),fullWidth:!0}),E(se,{style:$.formControlLabel,fullWidth:!0,children:[T(de,{children:w.t(`State type`)}),T(Ie,{variant:`standard`,value:this.state.newAliasType,onChange:e=>this.setState({newAliasType:e.target.value}),children:Zl.map(e=>E(F,{value:e,children:[w.t(e),E(`span`,{style:$.typeNameEng,children:[`(`,e,`)`]})]},e))})]}),this.state.newAliasType===`number`?T(I,{style:$.formControlLabel,variant:`standard`,value:this.state.newAliasUnit||``,slotProps:{input:{endAdornment:this.state.newAliasUnit?T(v,{position:`end`,children:T(P,{tabIndex:-1,size:`small`,onClick:()=>this.setState({newAliasUnit:``}),children:T(N,{})})}):null}},onChange:e=>this.setState({newAliasUnit:e.target.value}),label:w.t(`Alias units`),fullWidth:!0}):null,this.state.newAliasType===`number`?T(I,{variant:`standard`,value:this.state.newAliasMin,type:`number`,error:this.state.newAliasMin?isNaN(parseFloat(this.state.newAliasMin)):!1,onChange:e=>this.setState({newAliasMin:e.target.value}),label:w.t(`Min`),style:{width:`calc(50% - 4px)`,marginBottom:16,marginRight:8}}):null,this.state.newAliasType===`number`?T(I,{variant:`standard`,value:this.state.newAliasMax,type:`number`,error:this.state.newAliasMax?isNaN(parseFloat(this.state.newAliasMax)):!1,onChange:e=>this.setState({newAliasMax:e.target.value}),label:w.t(`Max`),fullWidth:!0,style:{width:`calc(50% - 4px)`,marginBottom:16}}):null,T(I,{variant:`standard`,style:{...$.formControlLabel,...$.color},label:w.t(`Color`),type:`color`,value:this.state.newAliasColor,onChange:e=>this.setState({newAliasColor:e.target.value})}),T(Pe,{style:{...$.formControlLabel},fullWidth:!0,value:this.state.newAliasRole,onChange:(e,t)=>{let n=t||``,r=Rl.find(e=>e.role===n);if(r){if(r.w!==void 0&&r.r!==void 0){this.setState({newAliasRole:n||``,newAliasRead:r.r,newAliasWrite:r.w});return}if(r.w!==void 0){this.setState({newAliasRole:n,newAliasWrite:r.w});return}if(r.r!==void 0){this.setState({newAliasRole:n,newAliasRead:r.r});return}}if(n.startsWith(`value`)||n.startsWith(`indicator`)||n.startsWith(`sensor`)||n.startsWith(`weather`)){if(this.state.newAliasWrite){this.setState({newAliasRole:n,newAliasWrite:!1});return}}else if(n.startsWith(`level`)||n.startsWith(`switch`)){if(!this.state.newAliasWrite){this.setState({newAliasRole:n,newAliasWrite:!0});return}}else if(n.startsWith(`button`)&&this.state.newAliasRead){this.setState({newAliasRole:n,newAliasRead:!1});return}this.setState({newAliasRole:n})},options:e.filterRoles(this.props.roleArray,this.state.newAliasType),renderInput:e=>T(I,{variant:`standard`,...e,label:w.t(`Role`)})}),T(h,{style:{...$.formControlLabel,marginLeft:16},control:T(l,{indeterminate:this.state.newAliasRead===void 0||this.state.newAliasRead===null,checked:this.state.newAliasRead,onChange:e=>{let t={newAliasRead:e.target.checked};t.newAliasRead===!1&&this.state.newAliasWrite===!1&&(t.newAliasWrite=!0),this.setState(t)}}),label:w.t(`Alias read`)}),T(h,{style:$.formControlLabel,control:T(l,{indeterminate:this.state.newAliasWrite===void 0||this.state.newAliasWrite===null,checked:this.state.newAliasWrite,onChange:e=>{let t={newAliasWrite:e.target.checked};t.newAliasRead===!1&&this.state.newAliasWrite===!1&&(t.newAliasRead=!0),this.setState(t)}}),label:w.t(`Alias write`)}),this.props.obj.common.states?T(h,{style:$.formControlLabel,control:T(l,{checked:this.state.newAliasCopyStates,onChange:e=>this.setState({newAliasCopyStates:e.target.checked})}),label:w.t(`Copy states`)}):null,T(h,{style:$.formControlLabel,control:T(l,{checked:this.state.newAliasUseFormula,onChange:e=>this.setState({newAliasUseFormula:e.target.checked})}),label:w.t(`Use convert functions`)}),this.state.newAliasUseFormula&&this.state.newAliasRead?T(I,{style:$.formControlLabel,variant:`standard`,value:this.state.newAliasReadFormula,onChange:e=>this.setState({newAliasReadFormula:e.target.value}),label:w.t(`Read formula`),helperText:`${w.t(`JS function like`)} "val / 5 + 21"`,slotProps:{input:{endAdornment:this.state.newAliasReadFormula&&this.state.newAliasReadFormula!==`val`?T(v,{position:`end`,children:T(P,{tabIndex:-1,size:`small`,onClick:()=>this.setState({newAliasReadFormula:`val`}),children:T(N,{})})}):null,startAdornment:T(v,{position:`start`,children:T(He,{style:$.funcIcon})})}},fullWidth:!0}):null,this.state.newAliasUseFormula&&this.state.newAliasWrite?T(I,{style:$.formControlLabel,variant:`standard`,value:this.state.newAliasWriteFormula,onChange:e=>this.setState({newAliasWriteFormula:e.target.value}),label:w.t(`Write formula`),slotProps:{input:{endAdornment:this.state.newAliasWriteFormula&&this.state.newAliasWriteFormula!==`val`?T(v,{position:`end`,children:T(P,{tabIndex:-1,size:`small`,onClick:()=>this.setState({newAliasWriteFormula:`val`}),children:T(N,{})})}):null,startAdornment:T(v,{position:`start`,children:T(He,{style:$.funcIcon})})}},helperText:`${w.t(`JS function like`)} "val / 5 + 21"`,fullWidth:!0}):null]}),E(S,{children:[T(j,{title:w.t(`Press CTRL+ENTER to confirm`),children:T(`span`,{children:T(O,{variant:`contained`,disabled:!this.state.newAliasId||!!this.props.objects[`alias.0.${this.state.newAliasId}`],onClick:()=>void this.onCreateAlias(),startIcon:T(at,{}),color:`primary`,children:this.props.t(`Create`)})})}),T(O,{variant:`contained`,onClick:()=>this.setState({showAddNewAlias:!1}),startIcon:T(N,{}),color:`grey`,children:this.props.t(`Close`)})]})]}):null}render(){return E(k,{open:!0,maxWidth:`sm`,onClose:()=>this.props.onClose(),fullWidth:!0,"aria-labelledby":`object-alias-dialog-title`,children:[this.renderAddNewAlias(),T(d,{id:`object-alias-dialog-title`,children:this.state.usedInAliases.length?w.t(`This object is used in aliases`):w.t(`This object does not used in any aliases yet`)}),T(C,{children:E(xe,{style:{maxWidth:400},children:[this.state.usedInAliases.map(e=>E(F,{style:$.usedInAlias,onClick:()=>this.props.onRedirect(e),children:[T(Ue,{children:T(je,{fontSize:`small`})}),T(Oe,{children:e})]},e)),E(F,{onClick:()=>this.setState({showAddNewAlias:!0}),sx:$.addNewAlias,children:[T(Ue,{children:T(at,{fontSize:`small`})}),T(Oe,{children:w.t(`Create alias from this ID`)})]})]})}),T(S,{children:T(O,{variant:`contained`,onClick:()=>this.props.onClose(),startIcon:T(N,{}),color:`grey`,children:this.props.t(`Close`)})})]},`editAlias`)}};c();var eu=class e extends Le{constructor(e){super(e),u(this,`checkTimer`,null),u(this,`objects`,{}),u(this,`onCtrlEnter`,async()=>{if(this.state.showParentDialog||this.state.showHistoryWarning)return;let e=`${this.state.parentId}.${this.state.name}`;this.state.name&&e!==this.props.id&&await this.checkHistory()&&(await this.renameCopyObject(this.props.id,e,!!this.props.childrenIds.length&&this.state.renameAllChildren,!1),this.props.onClose())}),u(this,`onConfirmHistoryWarning`,async()=>{await this.renameCopyObject(this.props.id,`${this.state.parentId}.${this.state.name}`,!!this.props.childrenIds.length&&this.state.renameAllChildren,!1),this.props.onClose()});let t=this.props.id.split(`.`),n=t.pop()||``;this.state={name:n,parentId:t.join(`.`),renameAllChildren:!0,newExists:!0,showParentDialog:!1,showHistoryWarning:!1,withHistory:[]}}componentWillUnmount(){this.checkTimer&&=(clearTimeout(this.checkTimer),null)}static calculateNewId(e,t,n){let r=e.split(`.`),i=t.split(`.`),a=0;for(;r[a]===i[a];)a++;let o=n.split(`.`);return o.splice(0,a+1),`${t}.${o.join(`.`)}`}async getInstancesWithHistory(){let e=await this.props.socket.getAdapterInstances();return e==null?void 0:e.filter(e=>e.common.getHistory).map(e=>e._id.replace(`system.adapter.`,``))}async checkHistory(){this.objects={};let e=await this.getInstancesWithHistory(),t=[];try{let e=await this.props.socket.getObject(this.props.id);e&&(this.objects[e._id]=e)}catch{}for(let e of this.props.childrenIds)try{let t=await this.props.socket.getObject(e);t&&(this.objects[t._id]=t)}catch{}return Object.values(this.objects).forEach(n=>{var r;(r=n.common)!=null&&r.custom&&Object.keys(n.common.custom).find(t=>{var r;return e.includes(t)&&!((r=n.common.custom)!=null&&r[t].aliasId)})&&t.push(n._id)}),!t.length||(this.setState({showHistoryWarning:!0,withHistory:t}),!1)}showHistoryWarning(){return this.state.showHistoryWarning?E(k,{open:!0,onClose:()=>this.setState({showHistoryWarning:!1}),onKeyDown:e=>Et(e,()=>void this.onConfirmHistoryWarning()),children:[T(d,{children:this.props.t(`Found states with history`)}),E(C,{children:[this.state.withHistory.length>2?this.props.t(`You want to move %s states with enabled history`,this.state.withHistory.length):`${this.props.t(`Following states have history enabled`)}: ${this.state.withHistory.join(`, `)}`,T(`div`,{children:this.props.t(`move_states_with_history_warning`)})]}),E(S,{children:[T(j,{title:this.props.t(`Press CTRL+ENTER to confirm`),children:T(O,{variant:`contained`,color:`primary`,onClick:()=>void this.onConfirmHistoryWarning(),startIcon:T(f,{}),children:this.props.t(`Confirm`)})}),T(O,{color:`grey`,variant:`contained`,startIcon:T(N,{}),onClick:()=>this.setState({showHistoryWarning:!1}),children:this.props.t(`ra_Cancel`)})]})]}):null}async renameCopyObject(t,n,r,i){if(t===n)return;let a;try{var o;a=((o=this.objects)==null?void 0:o[t])||await this.props.socket.getObject(t)}catch{}let s;if((a==null?void 0:a.type)===`state`&&(s=await this.props.socket.getState(t)||void 0),r)for(let r of this.props.childrenIds){let a=e.calculateNewId(t,n,r);await this.renameCopyObject(r,a,!1,i)}a&&(await this.props.socket.setObject(n,a),s&&await this.props.socket.setState(n,s),i||await this.props.socket.delObject(t))}checkIfNewExists(){let e=`${this.state.parentId}.${this.state.name}`;this.checkTimer&&=(clearTimeout(this.checkTimer),null),this.props.id===e?this.state.newExists||(this.checkTimer=setTimeout(()=>{this.checkTimer=null,this.setState({newExists:!0})},50)):this.checkTimer=setTimeout(async()=>{this.checkTimer=null;try{let t=await this.props.socket.getObject(e);t&&!this.state.newExists?this.setState({newExists:!0}):!t&&this.state.newExists&&this.setState({newExists:!1})}catch{this.state.newExists&&this.setState({newExists:!1})}},300)}renderParentSelectorDialog(){return this.state.showParentDialog?T(Ne,{foldersFirst:!0,imagePrefix:`../..`,expertMode:this.props.expertMode,socket:this.props.socket,columns:[`name`,`type`,`role`,`room`,`func`],types:[`folder`,`channel`,`device`,`meta`],notEditable:!0,selected:this.state.parentId,allowNonObjects:!0,filterFunc:e=>this.props.expertMode?!0:e._id.startsWith(`0_userdata.0`)||e._id.startsWith(`javascript.`),theme:this.props.theme,onSelectConfirm:(e,t)=>{var n;let r;return r=Array.isArray(e)?e[0]:e,r.split(`.`).length<=1||t[r]&&(((n=t[r])==null?void 0:n.type)===`state`||r.startsWith(`system.`))?Promise.resolve(!1):Promise.resolve(!0)},onClose:()=>this.setState({showParentDialog:!1}),onOk:e=>{let t;t=Array.isArray(e)?e[0]:e||``,t&&t.split(`.`).length>1&&this.setState({parentId:t})}}):null}render(){let e=`${this.state.parentId}.${this.state.name}`;return E(k,{open:!0,maxWidth:`md`,fullWidth:!0,onClose:()=>this.props.onClose(),onKeyDown:e=>Et(e,()=>void this.onCtrlEnter()),children:[this.renderParentSelectorDialog(),this.showHistoryWarning(),E(d,{children:[E(`span`,{style:{opacity:.6,marginRight:8},children:[this.props.t(`Rename or copy object`),` -`]}),T(`span`,{style:{fontWeight:`bold`},children:this.props.id})]}),E(C,{children:[E(`div`,{style:{display:`flex`,gap:8,alignItems:`end`,opacity:.7},children:[T(I,{fullWidth:!0,variant:`standard`,label:this.props.t(`Parent ID`),value:`${this.state.parentId}.`,slotProps:{input:{readOnly:!0}}}),T(O,{variant:`outlined`,style:{maxWidth:40,width:40,height:32},onClick:()=>this.setState({showParentDialog:!0}),children:`...`})]}),T(I,{value:this.state.name,onChange:e=>{let t=e.target.value.replace(m.FORBIDDEN_CHARS,`_`).replace(/\./g,`_`).replace(/\s/g,`_`).replace(/,/g,`_`).replace(/__/g,`_`).replace(/__/g,`_`);this.setState({name:t},()=>this.checkIfNewExists())},style:{marginTop:20},autoFocus:!0,variant:`standard`,fullWidth:!0,label:this.props.t(`New object ID`)}),this.props.childrenIds.length?T(h,{control:T(l,{checked:this.state.renameAllChildren,onChange:()=>{this.setState({renameAllChildren:!this.state.renameAllChildren})}}),label:this.props.t(`Rename all children`)}):null,E(`div`,{children:[E(`span`,{style:{opacity:.6,marginRight:8,fontSize:16},children:[this.props.t(`New object ID`),`:`]}),T(`span`,{style:{fontWeight:`bold`,fontSize:16},children:e})]})]}),E(S,{children:[T(O,{disabled:!this.state.name||e===this.props.id,color:`primary`,variant:`outlined`,onClick:async()=>{await this.renameCopyObject(this.props.id,e,!!this.props.childrenIds.length&&this.state.renameAllChildren,!0),this.props.onClose()},children:this.props.t(`Create a copy`)}),T(j,{title:this.props.t(`Press CTRL+ENTER to confirm`),children:T(`span`,{children:T(O,{disabled:!this.state.name||e===this.props.id,color:`primary`,variant:`contained`,onClick:()=>void this.onCtrlEnter(),children:e!==this.props.id&&this.state.newExists?this.props.t(`Replace`):this.props.t(`Rename`)})})}),T(O,{variant:`contained`,color:`grey`,onClick:()=>this.props.onClose(),startIcon:T(N,{}),children:this.props.t(`ra_Cancel`)})]})]})}},tu=t(((e,t)=>{ace.define(`ace/mode/json_highlight_rules`,[`require`,`exports`,`module`,`ace/lib/oop`,`ace/mode/text_highlight_rules`],function(e,t,n){var r=e("../lib/oop"),i=e("./text_highlight_rules").TextHighlightRules,a=function(){this.$rules={start:[{token:`variable`,regex:`["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]\\s*(?=:)`},{token:`string`,regex:`"`,next:`string`},{token:`constant.numeric`,regex:`0[xX][0-9a-fA-F]+\\b`},{token:`constant.numeric`,regex:`[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b`},{token:`constant.language.boolean`,regex:`(?:true|false)\\b`},{token:`text`,regex:`['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']`},{token:`comment`,regex:`\\/\\/.*$`},{token:`comment.start`,regex:`\\/\\*`,next:`comment`},{token:`paren.lparen`,regex:`[[({]`},{token:`paren.rparen`,regex:`[\\])}]`},{token:`punctuation.operator`,regex:/[,]/},{token:`text`,regex:`\\s+`}],string:[{token:`constant.language.escape`,regex:/\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|["\\\/bfnrt])/},{token:`string`,regex:`"|$`,next:`start`},{defaultToken:`string`}],comment:[{token:`comment.end`,regex:`\\*\\/`,next:`start`},{defaultToken:`comment`}]}};r.inherits(a,i),t.JsonHighlightRules=a}),ace.define(`ace/mode/matching_brace_outdent`,[`require`,`exports`,`module`,`ace/range`],function(e,t,n){var r=e("../range").Range,i=function(){};(function(){this.checkOutdent=function(e,t){return/^\s+$/.test(e)?/^\s*\}/.test(t):!1},this.autoOutdent=function(e,t){var n=e.getLine(t).match(/^(\s*\})/);if(!n)return 0;var i=n[1].length,a=e.findMatchingBracket({row:t,column:i});if(!a||a.row==t)return 0;var o=this.$getIndent(e.getLine(a.row));e.replace(new r(t,0,t,i-1),o)},this.$getIndent=function(e){return e.match(/^\s*/)[0]}}).call(i.prototype),t.MatchingBraceOutdent=i}),ace.define(`ace/mode/folding/cstyle`,[`require`,`exports`,`module`,`ace/lib/oop`,`ace/range`,`ace/mode/folding/fold_mode`],function(e,t,n){var r=e("../../lib/oop"),i=e("../../range").Range,a=e("./fold_mode").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/,`|`+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/,`|`+e.end)))};r.inherits(o,a),(function(){this.foldingStartMarker=/([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/,this.foldingStopMarker=/^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/,this.singleLineBlockCommentRe=/^\s*(\/\*).*\*\/\s*$/,this.tripleStarBlockCommentRe=/^\s*(\/\*\*\*).*\*\/\s*$/,this.startRegionRe=/^\s*(\/\*|\/\/)#?region\b/,this._getFoldWidgetBase=this.getFoldWidget,this.getFoldWidget=function(e,t,n){var r=e.getLine(n);if(this.singleLineBlockCommentRe.test(r)&&!this.startRegionRe.test(r)&&!this.tripleStarBlockCommentRe.test(r))return``;var i=this._getFoldWidgetBase(e,t,n);return!i&&this.startRegionRe.test(r)?`start`:i},this.getFoldWidgetRange=function(e,t,n,r){var i=e.getLine(n);if(this.startRegionRe.test(i))return this.getCommentRegionBlock(e,i,n);var a=i.match(this.foldingStartMarker);if(a){var o=a.index;if(a[1])return this.openingBracketBlock(e,a[1],n,o);var s=e.getCommentFoldRange(n,o+a[0].length,1);return s&&!s.isMultiLine()&&(r?s=this.getSectionRange(e,n):t!=`all`&&(s=null)),s}if(t!==`markbegin`){var a=i.match(this.foldingStopMarker);if(a){var o=a.index+a[0].length;return a[1]?this.closingBracketBlock(e,a[1],n,o):e.getCommentFoldRange(n,o,-1)}}},this.getSectionRange=function(e,t){var n=e.getLine(t),r=n.search(/\S/),a=t,o=n.length;t+=1;for(var s=t,c=e.getLength();++t<c;){n=e.getLine(t);var l=n.search(/\S/);if(l!==-1){if(r>l)break;var u=this.getFoldWidgetRange(e,`all`,t);if(u){if(u.start.row<=a)break;if(u.isMultiLine())t=u.end.row;else if(r==l)break}s=t}}return new i(a,o,s,e.getLine(s).length)},this.getCommentRegionBlock=function(e,t,n){for(var r=t.search(/\s*$/),a=e.getLength(),o=n,s=/^\s*(?:\/\*|\/\/|--)#?(end)?region\b/,c=1;++n<a;){t=e.getLine(n);var l=s.exec(t);if(l&&(l[1]?c--:c++,!c))break}var u=n;if(u>o)return new i(o,r,u,t.length)}}).call(o.prototype)}),ace.define(`ace/mode/json`,[`require`,`exports`,`module`,`ace/lib/oop`,`ace/mode/text`,`ace/mode/json_highlight_rules`,`ace/mode/matching_brace_outdent`,`ace/mode/folding/cstyle`,`ace/worker/worker_client`],function(e,t,n){var r=e("../lib/oop"),i=e("./text").Mode,a=e("./json_highlight_rules").JsonHighlightRules,o=e("./matching_brace_outdent").MatchingBraceOutdent,s=e("./folding/cstyle").FoldMode,c=e("../worker/worker_client").WorkerClient,l=function(){this.HighlightRules=a,this.$outdent=new o,this.$behaviour=this.$defaultBehaviour,this.foldingRules=new s};r.inherits(l,i),(function(){this.lineCommentStart=`//`,this.blockComment={start:`/*`,end:`*/`},this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t);return e==`start`&&t.match(/^.*[\{\(\[]\s*$/)&&(r+=n),r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.createWorker=function(e){var t=new c([`ace`],`ace/mode/json_worker`,`JsonWorker`);return t.attachToDocument(e.getDocument()),t.on(`annotate`,function(t){e.setAnnotations(t.data)}),t.on(`terminate`,function(){e.clearAnnotations()}),t},this.$id=`ace/mode/json`}).call(l.prototype),t.Mode=l}),(function(){ace.require([`ace/mode/json`],function(n){typeof t==`object`&&typeof e==`object`&&t&&(t.exports=n)})})()})),nu=t(((e,t)=>{ace.define(`ace/theme/clouds_midnight-css`,[`require`,`exports`,`module`],function(e,t,n){n.exports=`.ace-clouds-midnight .ace_gutter {
28
+ background: #232323;
29
+ color: #929292
30
+ }
31
+
32
+ .ace-clouds-midnight .ace_print-margin {
33
+ width: 1px;
34
+ background: #232323
35
+ }
36
+
37
+ .ace-clouds-midnight {
38
+ background-color: #191919;
39
+ color: #929292
40
+ }
41
+
42
+ .ace-clouds-midnight .ace_cursor {
43
+ color: #7DA5DC
44
+ }
45
+
46
+ .ace-clouds-midnight .ace_marker-layer .ace_selection {
47
+ background: #000000
48
+ }
49
+
50
+ .ace-clouds-midnight.ace_multiselect .ace_selection.ace_start {
51
+ box-shadow: 0 0 3px 0px #191919;
52
+ }
53
+
54
+ .ace-clouds-midnight .ace_marker-layer .ace_step {
55
+ background: rgb(102, 82, 0)
56
+ }
57
+
58
+ .ace-clouds-midnight .ace_marker-layer .ace_bracket {
59
+ margin: -1px 0 0 -1px;
60
+ border: 1px solid #BFBFBF
61
+ }
62
+
63
+ .ace-clouds-midnight .ace_marker-layer .ace_active-line {
64
+ background: rgba(215, 215, 215, 0.031)
65
+ }
66
+
67
+ .ace-clouds-midnight .ace_gutter-active-line {
68
+ background-color: rgba(215, 215, 215, 0.031)
69
+ }
70
+
71
+ .ace-clouds-midnight .ace_marker-layer .ace_selected-word {
72
+ border: 1px solid #000000
73
+ }
74
+
75
+ .ace-clouds-midnight .ace_invisible {
76
+ color: #666
77
+ }
78
+
79
+ .ace-clouds-midnight .ace_keyword,
80
+ .ace-clouds-midnight .ace_meta,
81
+ .ace-clouds-midnight .ace_support.ace_constant.ace_property-value {
82
+ color: #927C5D
83
+ }
84
+
85
+ .ace-clouds-midnight .ace_keyword.ace_operator {
86
+ color: #4B4B4B
87
+ }
88
+
89
+ .ace-clouds-midnight .ace_keyword.ace_other.ace_unit {
90
+ color: #366F1A
91
+ }
92
+
93
+ .ace-clouds-midnight .ace_constant.ace_language {
94
+ color: #39946A
95
+ }
96
+
97
+ .ace-clouds-midnight .ace_constant.ace_numeric {
98
+ color: #46A609
99
+ }
100
+
101
+ .ace-clouds-midnight .ace_constant.ace_character.ace_entity {
102
+ color: #A165AC
103
+ }
104
+
105
+ .ace-clouds-midnight .ace_invalid {
106
+ color: #FFFFFF;
107
+ background-color: #E92E2E
108
+ }
109
+
110
+ .ace-clouds-midnight .ace_fold {
111
+ background-color: #927C5D;
112
+ border-color: #929292
113
+ }
114
+
115
+ .ace-clouds-midnight .ace_storage,
116
+ .ace-clouds-midnight .ace_support.ace_class,
117
+ .ace-clouds-midnight .ace_support.ace_function,
118
+ .ace-clouds-midnight .ace_support.ace_other,
119
+ .ace-clouds-midnight .ace_support.ace_type {
120
+ color: #E92E2E
121
+ }
122
+
123
+ .ace-clouds-midnight .ace_string {
124
+ color: #5D90CD
125
+ }
126
+
127
+ .ace-clouds-midnight .ace_comment {
128
+ color: #3C403B
129
+ }
130
+
131
+ .ace-clouds-midnight .ace_entity.ace_name.ace_tag,
132
+ .ace-clouds-midnight .ace_entity.ace_other.ace_attribute-name {
133
+ color: #606060
134
+ }
135
+
136
+ .ace-clouds-midnight .ace_indent-guide {
137
+ background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWNgYGBgYHB3d/8PAAOIAdULw8qMAAAAAElFTkSuQmCC) right repeat-y
138
+ }
139
+
140
+ .ace-clouds-midnight .ace_indent-guide-active {
141
+ background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQIW2PQ1dX9zzBz5sz/ABCcBFFentLlAAAAAElFTkSuQmCC) right repeat-y;
142
+ }
143
+ `}),ace.define(`ace/theme/clouds_midnight`,[`require`,`exports`,`module`,`ace/theme/clouds_midnight-css`,`ace/lib/dom`],function(e,t,n){t.isDark=!0,t.cssClass=`ace-clouds-midnight`,t.cssText=e("./clouds_midnight-css"),e("../lib/dom").importCssString(t.cssText,t.cssClass,!1)}),(function(){ace.require([`ace/theme/clouds_midnight`],function(n){typeof t==`object`&&typeof e==`object`&&t&&(t.exports=n)})})()})),ru=t(((e,t)=>{ace.define(`ace/theme/chrome-css`,[`require`,`exports`,`module`],function(e,t,n){n.exports=`.ace-chrome .ace_gutter {
144
+ background: #ebebeb;
145
+ color: #333;
146
+ overflow : hidden;
147
+ }
148
+
149
+ .ace-chrome .ace_print-margin {
150
+ width: 1px;
151
+ background: #e8e8e8;
152
+ }
153
+
154
+ .ace-chrome {
155
+ background-color: #FFFFFF;
156
+ color: black;
157
+ }
158
+
159
+ .ace-chrome .ace_cursor {
160
+ color: black;
161
+ }
162
+
163
+ .ace-chrome .ace_invisible {
164
+ color: rgb(191, 191, 191);
165
+ }
166
+
167
+ .ace-chrome .ace_constant.ace_buildin {
168
+ color: rgb(88, 72, 246);
169
+ }
170
+
171
+ .ace-chrome .ace_constant.ace_language {
172
+ color: rgb(88, 92, 246);
173
+ }
174
+
175
+ .ace-chrome .ace_constant.ace_library {
176
+ color: rgb(6, 150, 14);
177
+ }
178
+
179
+ .ace-chrome .ace_invalid {
180
+ background-color: rgb(153, 0, 0);
181
+ color: white;
182
+ }
183
+
184
+ .ace-chrome .ace_fold {
185
+ }
186
+
187
+ .ace-chrome .ace_support.ace_function {
188
+ color: rgb(60, 76, 114);
189
+ }
190
+
191
+ .ace-chrome .ace_support.ace_constant {
192
+ color: rgb(6, 150, 14);
193
+ }
194
+
195
+ .ace-chrome .ace_support.ace_type,
196
+ .ace-chrome .ace_support.ace_class
197
+ .ace-chrome .ace_support.ace_other {
198
+ color: rgb(109, 121, 222);
199
+ }
200
+
201
+ .ace-chrome .ace_variable.ace_parameter {
202
+ font-style:italic;
203
+ color:#FD971F;
204
+ }
205
+ .ace-chrome .ace_keyword.ace_operator {
206
+ color: rgb(104, 118, 135);
207
+ }
208
+
209
+ .ace-chrome .ace_comment {
210
+ color: #236e24;
211
+ }
212
+
213
+ .ace-chrome .ace_comment.ace_doc {
214
+ color: #236e24;
215
+ }
216
+
217
+ .ace-chrome .ace_comment.ace_doc.ace_tag {
218
+ color: #236e24;
219
+ }
220
+
221
+ .ace-chrome .ace_constant.ace_numeric {
222
+ color: rgb(0, 0, 205);
223
+ }
224
+
225
+ .ace-chrome .ace_variable {
226
+ color: rgb(49, 132, 149);
227
+ }
228
+
229
+ .ace-chrome .ace_xml-pe {
230
+ color: rgb(104, 104, 91);
231
+ }
232
+
233
+ .ace-chrome .ace_entity.ace_name.ace_function {
234
+ color: #0000A2;
235
+ }
236
+
237
+
238
+ .ace-chrome .ace_heading {
239
+ color: rgb(12, 7, 255);
240
+ }
241
+
242
+ .ace-chrome .ace_list {
243
+ color:rgb(185, 6, 144);
244
+ }
245
+
246
+ .ace-chrome .ace_marker-layer .ace_selection {
247
+ background: rgb(181, 213, 255);
248
+ }
249
+
250
+ .ace-chrome .ace_marker-layer .ace_step {
251
+ background: rgb(252, 255, 0);
252
+ }
253
+
254
+ .ace-chrome .ace_marker-layer .ace_stack {
255
+ background: rgb(164, 229, 101);
256
+ }
257
+
258
+ .ace-chrome .ace_marker-layer .ace_bracket {
259
+ margin: -1px 0 0 -1px;
260
+ border: 1px solid rgb(192, 192, 192);
261
+ }
262
+
263
+ .ace-chrome .ace_marker-layer .ace_active-line {
264
+ background: rgba(0, 0, 0, 0.07);
265
+ }
266
+
267
+ .ace-chrome .ace_gutter-active-line {
268
+ background-color : #dcdcdc;
269
+ }
270
+
271
+ .ace-chrome .ace_marker-layer .ace_selected-word {
272
+ background: rgb(250, 250, 255);
273
+ border: 1px solid rgb(200, 200, 250);
274
+ }
275
+
276
+ .ace-chrome .ace_storage,
277
+ .ace-chrome .ace_keyword,
278
+ .ace-chrome .ace_meta.ace_tag {
279
+ color: rgb(147, 15, 128);
280
+ }
281
+
282
+ .ace-chrome .ace_string.ace_regex {
283
+ color: rgb(255, 0, 0)
284
+ }
285
+
286
+ .ace-chrome .ace_string {
287
+ color: #1A1AA6;
288
+ }
289
+
290
+ .ace-chrome .ace_entity.ace_other.ace_attribute-name {
291
+ color: #994409;
292
+ }
293
+
294
+ .ace-chrome .ace_indent-guide {
295
+ background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bLly//BwAmVgd1/w11/gAAAABJRU5ErkJggg==") right repeat-y;
296
+ }
297
+
298
+ .ace-chrome .ace_indent-guide-active {
299
+ background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAIGNIUk0AAHolAACAgwAA+f8AAIDpAAB1MAAA6mAAADqYAAAXb5JfxUYAAAAZSURBVHjaYvj///9/hivKyv8BAAAA//8DACLqBhbvk+/eAAAAAElFTkSuQmCC") right repeat-y;
300
+ }
301
+ `}),ace.define(`ace/theme/chrome`,[`require`,`exports`,`module`,`ace/theme/chrome-css`,`ace/lib/dom`],function(e,t,n){t.isDark=!1,t.cssClass=`ace-chrome`,t.cssText=e("./chrome-css"),e("../lib/dom").importCssString(t.cssText,t.cssClass,!1)}),(function(){ace.require([`ace/theme/chrome`],function(n){typeof t==`object`&&typeof e==`object`&&t&&(t.exports=n)})})()}));tu(),nu(),ru();var iu={dialog:{height:`100%`,maxHeight:`100%`,maxWidth:`100%`},content:{textAlign:`center`},error:e=>({color:e.palette.mode===`dark`?`#ff7777`:`#c20000`}),image:{height:`100%`,width:`auto`},text:{fontFamily:`Lucida Console, Courier, monospace`,width:`100%`},download:{textDecoration:`none`,textTransform:`uppercase`,fontSize:14,color:`white`,border:`1px solid white`,borderRadius:5,padding:`8px 16px`,marginRight:8}};function au(e){let[t,n]=y.useState(``),r=y.useRef(()=>{}),i=!1;try{JSON.parse(t)}catch{i=!0}let a=()=>{!i&&t.trim()&&e.onClose(t)};return r.current=a,E(k,{style:iu.dialog,open:!0,maxWidth:`lg`,onClose:()=>e.onClose(),onKeyDown:e=>Et(e,a),fullWidth:!0,children:[T(d,{children:e.t(`Insert JSON with objects here`)}),T(C,{style:{minHeight:500},children:T(Ee,{width:`100%`,height:`500px`,mode:`json`,theme:e.themeType===`dark`?`clouds_midnight`:`chrome`,value:t,onChange:e=>n(e),name:`eos-object-import-json`,onLoad:e=>e.focus(),commands:[{name:`eosImportObjects`,bindKey:Dt,exec:()=>r.current()}]})}),E(S,{children:[T(j,{title:e.t(`Press CTRL+ENTER to confirm`),children:T(`span`,{children:T(O,{variant:`contained`,disabled:i||!t.trim(),onClick:()=>e.onClose(t),startIcon:T(Qe,{}),color:`primary`,children:e.t(`Import objects`)})})}),T(O,{variant:`contained`,onClick:()=>e.onClose(),startIcon:T(N,{}),color:`grey`,children:e.t(`Close`)})]})]})}c();var ou=oe,su={buttonIcon:{marginRight:4},buttonAll:{color:`#FF0000`},id:{fontStyle:`italic`},buttonText:{whiteSpace:`nowrap`}},cu=[`select`,`edit`,`settings`,`view`],lu=class e extends Le{static parseFilters(e){if(!e||typeof e!=`object`||Array.isArray(e))return{};let t={},n=Object.entries(e);for(let[e,r]of n)(e===`id`||e===`name`)&&typeof r==`string`&&(t[e]=r),(e===`room`||e===`func`||e===`role`||e===`type`||e===`custom`)&&Array.isArray(r)&&r.every(e=>typeof e==`string`)&&(t[e]=r),e===`expertMode`&&typeof r==`boolean`&&(t.expertMode=r);return t}constructor(t){super(t),u(this,`dialogName`,void 0),u(this,`filters`,void 0),u(this,`t`,void 0),u(this,`wordCache`,void 0),u(this,`navigateTo`,null),u(this,`customDialog`,e=>T(Nl,{...e,socket:this.props.socket})),u(this,`valueDialog`,e=>T(Il,{...e,socket:this.props.socket,width:e.width??`md`})),u(this,`editObjectDialog`,e=>T(zl,{...e,socket:this.props.socket,width:e.width??`md`})),u(this,`editRoleDialog`,e=>T(Bl,{...e,socket:this.props.socket})),u(this,`viewFileDialog`,e=>T(Xl,{...e,socket:this.props.socket})),u(this,`aliasEditor`,e=>e.obj.type===`state`?T($l,{...e,obj:e.obj,socket:this.props.socket}):E(k,{open:!0,onClose:e.onClose,children:[T(d,{children:this.t(`Alias`)}),T(C,{children:this.t(`Object is not a state`)}),T(S,{children:T(O,{onClick:e.onClose,children:this.t(`Close`)})})]})),u(this,`translate`,(e,...t)=>t.length?this.props.t(e,...t):(this.wordCache[e]||(this.wordCache[e]=this.props.t(e)),this.wordCache[e])),this.dialogName=`AdminObjects`;let n=(window._localStorage||window.localStorage).getItem(`${this.dialogName||`App`}.filters`)||`{}`;try{this.filters=e.parseFilters(JSON.parse(n))}catch{this.filters={}}let r=(window._localStorage||window.localStorage).getItem(`${this.dialogName||`App`}.selected`)||``;this.state={selected:r,name:``,toast:``,deleteObjectShow:null},this.t=this.translate,this.wordCache={}}static isAppDialogOpen(){let e=Ae.getLocation().dialog;return!!e&&!cu.includes(e)}onDelete(e){var t;let n=(t=this.state.deleteObjectShow)==null?void 0:t.id;n&&(e?(this.props.socket.delObjects(n,!0).then(()=>this.setState({toast:this.t(`All deleted`)})).catch(e=>window.alert(`Cannot delete object: ${e}`)),this.setState({deleteObjectShow:null})):(this.props.socket.delObject(n,!1).catch(e=>window.alert(`Cannot delete object: ${e}`)),this.setState({deleteObjectShow:null})))}renderToast(){return T(Je,{anchorOrigin:{vertical:`bottom`,horizontal:`right`},open:!!this.state.toast,autoHideDuration:3e3,onClose:()=>this.setState({toast:``}),message:this.state.toast,action:T(P,{size:`small`,"aria-label":`close`,color:`inherit`,onClick:()=>this.setState({toast:``}),children:T(Se,{fontSize:`small`})})},`toast`)}renderDeleteDialog(){return this.state.deleteObjectShow?E(k,{maxWidth:`md`,open:!0,onClose:()=>this.setState({deleteObjectShow:null}),"aria-labelledby":`delete-object-dialog-title`,"aria-describedby":`delete-object-dialog-description`,children:[E(d,{id:`delete-object-dialog-title`,children:[this.state.deleteObjectShow.hasChildren?this.t(`Delete object(s)`):this.t(`Delete object`),`:`,` `,T(`span`,{style:su.id,children:this.state.deleteObjectShow.id})]}),T(C,{children:T(te,{children:this.t(`Are you sure?`)})}),E(S,{children:[this.state.deleteObjectShow.hasChildren?T(O,{variant:`contained`,color:`grey`,sx:{"& .MuiButton-text":su.buttonText},onClick:()=>this.onDelete(!0),startIcon:T(ou,{style:su.buttonAll}),children:this.t(`Delete with children`,this.state.deleteObjectShow.childrenCount)}):null,this.state.deleteObjectShow.exists?T(O,{variant:`contained`,sx:{"& .MuiButton-text":su.buttonText},onClick:()=>this.onDelete(!1),color:`primary`,startIcon:T(oe,{}),autoFocus:!0,children:this.t(`Delete one item`)}):null,T(O,{variant:`contained`,color:`grey`,onClick:()=>this.setState({deleteObjectShow:null}),startIcon:T(Se,{}),children:this.t(`ra_Cancel`)})]})]},`delete`):null}render(){let t=String(window.NEXOWATT_EOS_ACCESS_ROLE||`unknown`).toLowerCase(),n=![`admin`,`service`,`installer`].includes(t);if(!e.isAppDialogOpen()){let e=Ae.getLocation();this.navigateTo=e.tab===`tab-objects`&&e.id?{mode:e.dialog===`view`?`viewFile`:e.dialog||`select`,id:e.id}:null}let r=this.navigateTo;return[this.renderToast(),T(s,{navigateTo:r,onNavigateTo:t=>{e.isAppDialogOpen()||(t!=null&&t.id?Ae.doNavigate(`tab-objects`,t.mode===`viewFile`?`view`:t.mode,t.id):Ae.doNavigate(`tab-objects`))},dialogName:`admin`,objectsWorker:this.props.objectsWorker,defaultFilters:this.filters,style:{width:`100%`,height:`100%`},socket:this.props.socket,selected:(r==null?void 0:r.id)||this.state.selected,expertMode:this.props.expertMode,isFloatComma:this.props.isFloatComma,dateFormat:this.props.dateFormat,t:this.t,lang:this.props.lang,themeName:this.props.themeName,themeType:this.props.themeType,theme:this.props.theme,objectCustomDialog:this.customDialog,objectBrowserValue:this.valueDialog,objectBrowserEditObject:this.editObjectDialog,objectBrowserEditRole:this.editRoleDialog,objectBrowserViewFile:this.viewFileDialog,objectBrowserAliasEditor:this.aliasEditor,objectMoveRenameDialog:eu,objectBrowserInsertJsonObjects:au,router:Ae,notEditable:n,onObjectDelete:n?void 0:(e,t,n,r)=>this.setState({deleteObjectShow:{id:e,hasChildren:t,exists:n,childrenCount:r}}),onFilterChanged:e=>{this.filters=e,(window._localStorage||window.localStorage).setItem(`${this.dialogName||`App`}.filters`,JSON.stringify(e))},onSelect:e=>{Array.isArray(e)?(window._localStorage||window.localStorage).setItem(`${this.dialogName||`App`}.selected`,e[0]||``):(window._localStorage||window.localStorage).setItem(`${this.dialogName||`App`}.selected`,e||``)},objectEditBoolean:!n,objectAddBoolean:!n,objectStatesView:!0,objectImportExport:!n,objectEditOfAccessControl:!n,modalNewObject:e=>{var t,n,r;return T(Wl,{objects:e.objects,expertMode:this.props.expertMode,setObject:(e,t)=>this.props.socket.setObject(e,t).catch(e=>window.alert(e)),selected:((t=e.state.modalNewObj)==null?void 0:t.id)||``,initialType:(n=e.state.modalNewObj)==null?void 0:n.initialType,initialStateType:(r=e.state.modalNewObj)==null?void 0:r.initialStateType,onClose:()=>e.setState({modalNewObj:null}),onApply:()=>e.setState({modalNewObj:null})})},modalEditOfAccessControl:(e,t)=>T(Jl,{theme:this.props.theme,themeType:this.props.themeType,extendObject:(e,n)=>{this.props.socket.extendObject(e,n).catch(e=>window.alert(e)),t.aclTooltip=void 0},selected:e.state.selected[0],modalEmptyId:t.obj?``:t.id,objects:e.objects,t:this.t,onClose:()=>e.setState({modalEditOfAccess:!1,modalEditOfAccessObjData:void 0}),onApply:()=>e.setState({modalEditOfAccess:!1,modalEditOfAccessObjData:void 0})})},`browser`),n?null:this.renderDeleteDialog()]}};export{lu as default};