iobroker.eos-admin 9.0.27 → 9.0.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NEXOWATT_EOS_BUILD_INFO.json +9 -12
- package/README.md +17 -227
- package/adminWww/.vite/manifest.json +224 -233
- package/adminWww/NEXOWATT_EOS_FRONTEND_MANIFEST.json +13887 -13897
- package/adminWww/assets/{AdapterUpdateDialog-L3aqW3ID.js → AdapterUpdateDialog-DBLX7GoO.js} +5 -5
- package/adminWww/assets/{Adapters-Db3kbmAj.js → Adapters-c250DTTU.js} +5 -5
- package/adminWww/assets/AddLink-0L0E-LsA.js +1 -0
- package/adminWww/assets/ColorLens-DA51K29x.js +1 -0
- package/adminWww/assets/ConfigManager-BBUXk8hZ.js +1 -0
- package/adminWww/assets/Enums-CWJJ2zNF.js +92 -0
- package/adminWww/assets/Fields-CNefAzNH.js +1 -0
- package/adminWww/assets/FileCopy-B16lEuur.js +1 -0
- package/adminWww/assets/Files-Bf8oZSk6.js +1 -0
- package/adminWww/assets/{Hosts-DimiJ78g.js → Hosts-8gg41ODb.js} +6 -6
- package/adminWww/assets/Instances-PPTEPJQN.js +4 -0
- package/adminWww/assets/Intro-9c_ynpJu.js +2 -0
- package/adminWww/assets/Lens-9lkeoWGk.js +1 -0
- package/adminWww/assets/LinearScale-Be5h2beh.js +1 -0
- package/adminWww/assets/{Logs-D9dqF5Ag.js → Logs-Brgb9kR_.js} +2 -2
- package/adminWww/assets/North-C2whbHM-.js +1 -0
- package/adminWww/assets/{Objects-oliB7_Se.js → Objects-DHVNfs_x.js} +4 -4
- package/adminWww/assets/Overview-CgnpH8e8.js +3 -0
- package/adminWww/assets/PersonOff-DqBq0Fho.js +1 -0
- package/adminWww/assets/PlaylistAdd-O8k92YBd.js +1 -0
- package/adminWww/assets/State-vVobamei.js +1 -0
- package/adminWww/assets/UsedResources-1fEUqiQ6.js +2 -0
- package/adminWww/assets/Users-oRpvFtQR.js +1 -0
- package/adminWww/assets/{bootstrap-BVw0diuj.js → bootstrap-st8VxLDc.js} +25 -25
- package/adminWww/assets/date-fns-C1dqkno9.js +1 -0
- package/adminWww/assets/{hostInit-C_7OBoza.js → hostInit-OQMl4yOT.js} +1 -1
- package/adminWww/assets/icons-material-DeF0gQyK.js +1 -0
- package/adminWww/assets/{index-DwDSxDMx.js → index-D4lV2S7J.js} +2 -2
- package/adminWww/assets/{installSVGRenderer--VTzKbml.js → installSVGRenderer-1WdbDz-H.js} +1 -1
- package/adminWww/assets/isSameWeek-Crh37s7U.js +1 -0
- package/adminWww/assets/isWithinInterval-Bo1WiDfq.js +1 -0
- package/adminWww/assets/locale-hLcz_Xh2.js +1 -0
- package/adminWww/assets/{mf-entry-bootstrap-0-6f3e4c6b.js → mf-entry-bootstrap-0-3b253ab0.js} +2 -2
- package/adminWww/assets/sentry-DwQQLI7N.js +1 -0
- package/adminWww/assets/startOfWeek-DJph8SIW.js +1 -0
- package/adminWww/index.html +23 -23
- package/adminWww/mf-manifest.json +1 -1
- package/adminWww/mf-stats.json +1 -1
- package/adminWww/remoteEntry-eos-9.0.28.js +12 -0
- package/adminWww/remoteEntry.js +1 -1
- package/docs/DOKUMENTATION_9.0.27.md +7 -0
- package/docs/README.md +13 -0
- package/docs/UMSORTIERTE_DATEIEN.tsv +153 -0
- package/docs/reports/unified-9.0.14/PRUEFBERICHT.md +1 -1
- package/docs/reports/unified-9.0.16/PRUEFBERICHT.md +1 -1
- package/docs/reports/unified-9.0.17/PRUEFBERICHT.md +1 -1
- package/docs/reports/unified-9.0.18/PRUEFBERICHT.md +1 -1
- package/docs/reports/unified-9.0.21/PRUEFBERICHT.md +1 -1
- package/docs/reports/unified-9.0.22/PRUEFBERICHT.md +1 -1
- package/docs/reports/unified-9.0.28/PRUEFBERICHT.md +40 -0
- package/docs/reports/unified-9.0.28/PRUEFERGEBNISSE.json +112 -0
- package/docs/reports/unified-9.0.28/raw/INDEX.json +87 -0
- package/docs/reports/unified-9.0.28/raw/backend.log +5 -0
- package/docs/reports/unified-9.0.28/raw/frontend.log +151 -0
- package/docs/reports/unified-9.0.28/raw/installer.log +26 -0
- package/docs/reports/unified-9.0.28/raw/lint.log +5 -0
- package/docs/reports/unified-9.0.28/raw/modules.log +5 -0
- package/docs/reports/unified-9.0.28/raw/node22-tests-final.log +17060 -0
- package/docs/reports/unified-9.0.28/raw/node22-version.log +1 -0
- package/docs/reports/unified-9.0.28/raw/node24-tests-final.log +2845 -0
- package/docs/reports/unified-9.0.28/raw/node24-version.log +1 -0
- package/docs/reports/unified-9.0.28/raw/npm-audit-runtime.json +77 -0
- package/docs/reports/unified-9.0.28/raw/runtime-mirror-check.log +1 -0
- package/docs/reports/unified-9.0.28/raw/typecheck.log +5 -0
- package/docs/reports/unified-9.0.28/raw/ui-runtime.log +7 -0
- package/docs/reports/unified-9.0.4/PRUEFBERICHT.md +1 -1
- package/docs/reports/unified-9.0.5/PRUEFBERICHT.md +1 -1
- package/docs/reports/unified-9.0.6/PRUEFBERICHT.md +1 -1
- package/docs/reports/unified-9.0.7/PRUEFBERICHT.md +1 -1
- package/docs/reports/unified-9.0.8/PRUEFBERICHT.md +1 -1
- package/docs/reports/unified-9.0.9/PRUEFBERICHT.md +1 -1
- package/{START_HIER_9.0.1.md → docs/start/START_HIER_9.0.1.md} +5 -5
- package/{START_HIER_9.0.10.md → docs/start/START_HIER_9.0.10.md} +1 -1
- package/{START_HIER_9.0.11.md → docs/start/START_HIER_9.0.11.md} +1 -1
- package/{START_HIER_9.0.12.md → docs/start/START_HIER_9.0.12.md} +1 -1
- package/{START_HIER_9.0.13.md → docs/start/START_HIER_9.0.13.md} +2 -2
- package/{START_HIER_9.0.14.md → docs/start/START_HIER_9.0.14.md} +1 -1
- package/{START_HIER_9.0.15.md → docs/start/START_HIER_9.0.15.md} +2 -2
- package/{START_HIER_9.0.16.md → docs/start/START_HIER_9.0.16.md} +1 -1
- package/{START_HIER_9.0.17.md → docs/start/START_HIER_9.0.17.md} +2 -2
- package/{START_HIER_9.0.18.md → docs/start/START_HIER_9.0.18.md} +4 -4
- package/{START_HIER_9.0.19.md → docs/start/START_HIER_9.0.19.md} +2 -2
- package/{START_HIER_9.0.2.md → docs/start/START_HIER_9.0.2.md} +2 -2
- package/{START_HIER_9.0.20.md → docs/start/START_HIER_9.0.20.md} +1 -1
- package/{START_HIER_9.0.21.md → docs/start/START_HIER_9.0.21.md} +1 -1
- package/{START_HIER_9.0.22.md → docs/start/START_HIER_9.0.22.md} +4 -4
- package/{START_HIER_9.0.24.md → docs/start/START_HIER_9.0.24.md} +1 -1
- package/{START_HIER_9.0.25.md → docs/start/START_HIER_9.0.25.md} +1 -1
- package/{START_HIER_9.0.26.md → docs/start/START_HIER_9.0.26.md} +1 -1
- package/{START_HIER_9.0.27.md → docs/start/START_HIER_9.0.27.md} +3 -3
- package/docs/start/START_HIER_9.0.28.md +20 -0
- package/{START_HIER_9.0.3.md → docs/start/START_HIER_9.0.3.md} +3 -3
- package/{START_HIER_9.0.4.md → docs/start/START_HIER_9.0.4.md} +3 -3
- package/{START_HIER_9.0.5.md → docs/start/START_HIER_9.0.5.md} +2 -2
- package/{START_HIER_9.0.6.md → docs/start/START_HIER_9.0.6.md} +3 -3
- package/{START_HIER_9.0.7.md → docs/start/START_HIER_9.0.7.md} +4 -4
- package/{START_HIER_9.0.8.md → docs/start/START_HIER_9.0.8.md} +3 -3
- package/{START_HIER_9.0.9.md → docs/start/START_HIER_9.0.9.md} +1 -1
- package/docs/unified/ARCHITECTURE.md +37 -1
- package/docs/unified/BESTANDSUEBERNAHME_9_0_7.md +1 -1
- package/docs/unified/INSTALL_PUBLISH.md +2 -2
- package/io-package.json +8 -8
- package/package.json +35 -30
- package/release-manifests/unified/build-environment.cdx.json +6 -6
- package/release-manifests/unified/files.json +269 -126
- package/release-manifests/unified/frontend.cdx.json +6 -6
- package/release-manifests/unified/installer.cdx.json +6 -6
- package/release-manifests/unified/obsolete-admin-assets.json +89 -6
- package/release-manifests/unified/runtime.cdx.json +26 -26
- package/release-manifests/unified/validation.json +15 -15
- package/tools/eos-release-manifest.cjs +2 -2
- package/ui/io-package.json +5 -1
- package/ui/lib/smarthome-device-detection.js +177 -4
- package/ui/main.js +69 -5
- package/ui/package.json +1 -1
- package/ui/www/licenses/smarthome-markdown-components.json +156 -156
- package/ui/www/manifest.webmanifest +2 -2
- package/ui/www/smarthome-config-workspace.css +7 -0
- package/ui/www/smarthome-config.html +4 -4
- package/ui/www/smarthome-config.js +178 -163
- package/ui/www/smarthome-device-config.js +131 -6
- package/ui/www/smarthome-setup.js +252 -59
- package/adminWww/assets/AccessTime-CuR73YC3.js +0 -1
- package/adminWww/assets/ConfigManager-D33l1qlC.js +0 -1
- package/adminWww/assets/Enums-HlPEZ4AF.js +0 -92
- package/adminWww/assets/Fields-BWBgNDOp.js +0 -1
- package/adminWww/assets/Files-BYaJp3AG.js +0 -1
- package/adminWww/assets/Instances-C5kAjcqw.js +0 -4
- package/adminWww/assets/Intro-B8keS0Ph.js +0 -2
- package/adminWww/assets/KeyboardArrowRight-ifvmV1ZL.js +0 -1
- package/adminWww/assets/MoreHoriz-CS7nODK8.js +0 -1
- package/adminWww/assets/Overview-BmjcCFve.js +0 -3
- package/adminWww/assets/Pageview-wzrLQZ-j.js +0 -1
- package/adminWww/assets/PersonOff-YtHcY0sV.js +0 -1
- package/adminWww/assets/Star-D8VNXawT.js +0 -1
- package/adminWww/assets/State-DQz1O54D.js +0 -1
- package/adminWww/assets/UsedResources-DOAuH0-U.js +0 -2
- package/adminWww/assets/Users-Dv1iXiRk.js +0 -1
- package/adminWww/assets/ViewCompact-D7bHgn99.js +0 -1
- package/adminWww/assets/ViewSidebar-CjClbCI5.js +0 -1
- package/adminWww/assets/WifiTethering-DJ9VO12W.js +0 -1
- package/adminWww/assets/date-fns-BtR4dG_j.js +0 -1
- package/adminWww/assets/en-US-BjjaEI6N.js +0 -1
- package/adminWww/assets/icons-material-Apny8Mbp.js +0 -1
- package/adminWww/assets/isSameWeek-WMSJR5Qs.js +0 -1
- package/adminWww/assets/locale-DN6Bdkdt.js +0 -1
- package/adminWww/assets/sentry-CPzCHrwe.js +0 -1
- package/adminWww/assets/setYear-DDSuW45e.js +0 -1
- package/adminWww/remoteEntry-eos-9.0.27.js +0 -12
- /package/{START_HIER_9.0.23.md → docs/start/START_HIER_9.0.23.md} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as e,t}from"./rolldown-runtime-sJBDdmOt.js";import{$r as n,Ai as r,An as i,Ao as a,Ar as o,Bo as s,Br as c,Ci as l,Er as u,Es as d,Ga as f,Ha as p,Hs as m,In as h,Io as g,Ji as _,Jo as v,Jr as y,Ka as b,Ko as x,Li as S,Lt as ee,Mo as C,No as te,Oi as ne,Oo as re,Po as w,Qa as ie,Qs as ae,Ri as oe,Ro as se,Sn as ce,So as le,To as ue,Tr as T,Ts as E,Ur as de,Us as D,Vo as fe,Wa as pe,Wo as O,Wr as k,Xo as me,Za as he,_r as ge,_s as _e,ao as ve,as as ye,ba as be,bn as xe,br as Se,cr as Ce,cs as we,ea as Te,eo as Ee,fo as De,go as A,gr as Oe,hr as ke,i as Ae,is as je,jo as Me,lo as j,lr as Ne,ls as Pe,mo as Fe,mr as Ie,no as Le,ns as Re,os as M,pc as N,po as P,ps as ze,qa as Be,qo as F,qs as Ve,ro as He,rr as Ue,rs as We,sc as Ge,so as Ke,sr as qe,ss as Je,tc as Ye,to as I,vi as Xe,wi as Ze,xn as Qe,yo as L,zi as $e,zt as et}from"./loadShare-eager-dmdYQhAl.js";import{a as tt,i as nt,n as rt,o as it,r as at,s as ot,t as st}from"./MoreHoriz-CS7nODK8.js";import{n as ct,t as lt}from"./KeyboardArrowRight-ifvmV1ZL.js";import{t as ut}from"./Remove-IN7ZNaCF.js";import{t as dt}from"./en-US-BjjaEI6N.js";import{a as ft,c as pt,d as mt,f as ht,i as gt,l as _t,n as vt,o as yt,r as bt,s as xt,u as St}from"./locale-DN6Bdkdt.js";import{t as Ct}from"./AdminUtils-Dc1eHsx5.js";import{t as wt}from"./AceEditor-BgLZBrSD.js";import{n as Tt,t as Et}from"./ctrlEnter-CruFIPb_.js";import{G as Dt,M as Ot,r as kt}from"./bootstrap-BVw0diuj.js";import{a as At,c as jt,d as Mt,i as Nt,l as Pt,n as Ft,o as It,r as Lt,s as Rt,t as zt,u as Bt}from"./zh-cn-B6dBxOyw.js";import{t as Vt}from"./CustomModal-Do2qVZr7.js";import{$ as Ht,$t as R,A as Ut,At as Wt,B as Gt,Bt as Kt,C as qt,Ct as Jt,D as z,Dt as Yt,E as Xt,Et as Zt,F as Qt,Ft as $t,G as en,Gt as tn,H as nn,Ht as rn,I as an,It as on,J as sn,Jt as cn,K as ln,Kt as un,L as dn,Lt as fn,M as pn,Mt as mn,O as hn,Ot as gn,P as _n,Q as vn,Qt as yn,R as bn,Rt as xn,S as Sn,St as Cn,T as wn,Tt as Tn,U as En,Ut as Dn,Vt as On,W as kn,Wt as An,X as jn,Xt as Mn,Yt as Nn,Z as Pn,Zt as Fn,_ as In,_n as B,_t as Ln,a as Rn,an as zn,at as Bn,b as Vn,bt as Hn,c as Un,cn as Wn,d as Gn,dn as Kn,dt as qn,en as Jn,et as Yn,f as Xn,fn as Zn,g as Qn,gn as $n,gt as er,h as tr,hn as nr,ht as rr,i as ir,in as ar,it as or,jt as sr,k as cr,kt as lr,l as ur,ln as dr,lt as fr,m as pr,mn as mr,mt as hr,n as gr,nt as _r,o as vr,on as yr,ot as br,p as xr,pn as Sr,pt as Cr,q as wr,qt as Tr,r as Er,rn as Dr,rt as Or,s as kr,st as Ar,t as jr,tn as Mr,tt as Nr,u as Pr,un as Fr,ut as Ir,vt as Lr,w as Rr,wt as zr,x as Br,xt as Vr,y as Hr,yt as Ur,z as Wr,zt as Gr}from"./installSVGRenderer--VTzKbml.js";var Kr=e(y(),1),qr=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,7,9,32,4,318,1,78,5,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,68,8,2,0,3,0,2,3,2,4,2,0,15,1,83,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,7,19,58,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,199,7,137,9,54,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,55,9,266,3,10,1,2,0,49,6,4,4,14,10,5350,0,7,14,11465,27,2343,9,87,9,39,4,60,6,26,9,535,9,470,0,2,54,8,3,82,0,12,1,19628,1,4178,9,519,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,245,1,2,9,233,0,3,0,8,1,6,0,475,6,110,6,6,9,4759,9,787719,239],Jr=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,4,51,13,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,7,25,39,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,39,27,10,22,251,41,7,1,17,5,57,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,31,9,2,0,3,0,2,37,2,0,26,0,2,0,45,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,200,32,32,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,24,43,261,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,26,3994,6,582,6842,29,1763,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,433,44,212,63,33,24,3,24,45,74,6,0,67,12,65,1,2,0,15,4,10,7381,42,31,98,114,8702,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,229,29,3,0,208,30,2,2,2,1,2,6,3,4,10,1,225,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4381,3,5773,3,7472,16,621,2467,541,1507,4938,6,8489],Yr=`·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ--ᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・`,Xr=`ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-ࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽ-ೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-Ა-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ--ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ`,Zr={3:`abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile`,5:`class enum extends super const export import`,6:`enum`,strict:`implements interface let package private protected public static yield`,strictBind:`eval arguments`},Qr=`break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this`,$r={5:Qr,"5module":Qr+` export import`,6:Qr+` const class extends export import super`},ei=/^in(stanceof)?$/,ti=RegExp(`[`+Xr+`]`),ni=RegExp(`[`+Xr+Yr+`]`);function ri(e,t){for(var n=65536,r=0;r<t.length;r+=2){if(n+=t[r],n>e)return!1;if(n+=t[r+1],n>=e)return!0}return!1}function ii(e,t){return e<65?e===36:e<91?!0:e<97?e===95:e<123?!0:e<=65535?e>=170&&ti.test(String.fromCharCode(e)):t!==!1&&ri(e,Jr)}function ai(e,t){return e<48?e===36:e<58?!0:e<65?!1:e<91?!0:e<97?e===95:e<123?!0:e<=65535?e>=170&&ni.test(String.fromCharCode(e)):t===!1?!1:ri(e,Jr)||ri(e,qr)}var V=function(e,t){t===void 0&&(t={}),this.label=e,this.keyword=t.keyword,this.beforeExpr=!!t.beforeExpr,this.startsExpr=!!t.startsExpr,this.isLoop=!!t.isLoop,this.isAssign=!!t.isAssign,this.prefix=!!t.prefix,this.postfix=!!t.postfix,this.binop=t.binop||null,this.updateContext=null};function oi(e,t){return new V(e,{beforeExpr:!0,binop:t})}var si={beforeExpr:!0},ci={startsExpr:!0},li={};function H(e,t){return t===void 0&&(t={}),t.keyword=e,li[e]=new V(e,t)}var U={num:new V(`num`,ci),regexp:new V(`regexp`,ci),string:new V(`string`,ci),name:new V(`name`,ci),privateId:new V(`privateId`,ci),eof:new V(`eof`),bracketL:new V(`[`,{beforeExpr:!0,startsExpr:!0}),bracketR:new V(`]`),braceL:new V(`{`,{beforeExpr:!0,startsExpr:!0}),braceR:new V(`}`),parenL:new V(`(`,{beforeExpr:!0,startsExpr:!0}),parenR:new V(`)`),comma:new V(`,`,si),semi:new V(`;`,si),colon:new V(`:`,si),dot:new V(`.`),question:new V(`?`,si),questionDot:new V(`?.`),arrow:new V(`=>`,si),template:new V(`template`),invalidTemplate:new V(`invalidTemplate`),ellipsis:new V(`...`,si),backQuote:new V("`",ci),dollarBraceL:new V("${",{beforeExpr:!0,startsExpr:!0}),eq:new V(`=`,{beforeExpr:!0,isAssign:!0}),assign:new V(`_=`,{beforeExpr:!0,isAssign:!0}),incDec:new V(`++/--`,{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new V(`!/~`,{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:oi(`||`,1),logicalAND:oi(`&&`,2),bitwiseOR:oi(`|`,3),bitwiseXOR:oi(`^`,4),bitwiseAND:oi(`&`,5),equality:oi(`==/!=/===/!==`,6),relational:oi(`</>/<=/>=`,7),bitShift:oi(`<</>>/>>>`,8),plusMin:new V(`+/-`,{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:oi(`%`,10),star:oi(`*`,10),slash:oi(`/`,10),starstar:new V(`**`,{beforeExpr:!0}),coalesce:oi(`??`,1),_break:H(`break`),_case:H(`case`,si),_catch:H(`catch`),_continue:H(`continue`),_debugger:H(`debugger`),_default:H(`default`,si),_do:H(`do`,{isLoop:!0,beforeExpr:!0}),_else:H(`else`,si),_finally:H(`finally`),_for:H(`for`,{isLoop:!0}),_function:H(`function`,ci),_if:H(`if`),_return:H(`return`,si),_switch:H(`switch`),_throw:H(`throw`,si),_try:H(`try`),_var:H(`var`),_const:H(`const`),_while:H(`while`,{isLoop:!0}),_with:H(`with`),_new:H(`new`,{beforeExpr:!0,startsExpr:!0}),_this:H(`this`,ci),_super:H(`super`,ci),_class:H(`class`,ci),_extends:H(`extends`,si),_export:H(`export`),_import:H(`import`,ci),_null:H(`null`,ci),_true:H(`true`,ci),_false:H(`false`,ci),_in:H(`in`,{beforeExpr:!0,binop:7}),_instanceof:H(`instanceof`,{beforeExpr:!0,binop:7}),_typeof:H(`typeof`,{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:H(`void`,{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:H(`delete`,{beforeExpr:!0,prefix:!0,startsExpr:!0})},ui=/\r\n?|\n|\u2028|\u2029/,di=new RegExp(ui.source,`g`);function fi(e){return e===10||e===13||e===8232||e===8233}function pi(e,t,n){n===void 0&&(n=e.length);for(var r=t;r<n;r++){var i=e.charCodeAt(r);if(fi(i))return r<n-1&&i===13&&e.charCodeAt(r+1)===10?r+2:r+1}return-1}var mi=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,hi=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,gi=Object.prototype,_i=gi.hasOwnProperty,vi=gi.toString,yi=Object.hasOwn||(function(e,t){return _i.call(e,t)}),bi=Array.isArray||(function(e){return vi.call(e)===`[object Array]`}),xi=Object.create(null);function Si(e){return xi[e]||(xi[e]=RegExp(`^(?:`+e.replace(/ /g,`|`)+`)$`))}function Ci(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}var wi=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,Ti=function(e,t){this.line=e,this.column=t};Ti.prototype.offset=function(e){return new Ti(this.line,this.column+e)};var Ei=function(e,t,n){this.start=t,this.end=n,e.sourceFile!==null&&(this.source=e.sourceFile)};function Di(e,t){for(var n=1,r=0;;){var i=pi(e,r,t);if(i<0)return new Ti(n,t-r);++n,r=i}}var Oi={ecmaVersion:null,sourceType:`script`,strict:!1,onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowAwaitOutsideFunction:null,allowSuperOutsideMethod:null,allowHashBang:!1,checkPrivateFields:!0,locations:!1,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1},ki=!1;function Ai(e){var t={};for(var n in Oi)t[n]=e&&yi(e,n)?e[n]:Oi[n];if(t.ecmaVersion===`latest`?t.ecmaVersion=1e8:t.ecmaVersion==null?(!ki&&typeof console==`object`&&console.warn&&(ki=!0,console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required.
|
|
1
|
+
import{a as e,t}from"./rolldown-runtime-sJBDdmOt.js";import{$r as n,Ai as r,An as i,Ao as a,Ar as o,Bo as s,Br as c,Ci as l,Er as u,Es as d,Ga as f,Ha as p,Hs as m,In as h,Io as g,Ji as _,Jo as v,Jr as y,Ka as b,Ko as x,Li as S,Lt as ee,Mo as C,No as te,Oi as ne,Oo as re,Po as w,Qa as ie,Qs as ae,Ri as oe,Ro as se,Sn as ce,So as le,To as ue,Tr as T,Ts as E,Ur as de,Us as D,Vo as fe,Wa as pe,Wo as O,Wr as k,Xo as me,Za as he,_r as ge,_s as _e,ao as ve,as as ye,ba as be,bn as xe,br as Se,cr as Ce,cs as we,ea as Te,eo as Ee,fo as De,go as A,gr as Oe,hr as ke,i as Ae,is as je,jo as Me,lo as j,lr as Ne,ls as Pe,mo as Fe,mr as Ie,no as Le,ns as Re,os as M,pc as N,po as P,ps as ze,qa as Be,qo as F,qs as Ve,ro as He,rr as Ue,rs as We,sc as Ge,so as Ke,sr as qe,ss as Je,tc as Ye,to as I,vi as Xe,wi as Ze,xn as Qe,yo as L,zi as $e,zt as et}from"./loadShare-eager-dmdYQhAl.js";import{r as tt}from"./startOfWeek-DJph8SIW.js";import{t as nt}from"./AdminUtils-Dc1eHsx5.js";import{t as rt}from"./AceEditor-BgLZBrSD.js";import{n as it,t as at}from"./ctrlEnter-CruFIPb_.js";import{kt as ot,r as st,tt as ct}from"./bootstrap-st8VxLDc.js";import{a as lt,c as ut,d as dt,i as ft,l as pt,n as mt,o as ht,r as gt,s as _t,t as vt,u as yt}from"./zh-cn-B6dBxOyw.js";import{t as bt}from"./Remove-IN7ZNaCF.js";import{t as xt}from"./CustomModal-Do2qVZr7.js";import{n as St,t as Ct}from"./FileCopy-B16lEuur.js";import{a as wt,c as Tt,d as Et,f as Dt,i as Ot,l as kt,n as At,o as jt,r as Mt,s as Nt,u as Pt}from"./locale-hLcz_Xh2.js";import{a as Ft,i as It,n as Lt,o as Rt,r as zt,s as Bt,t as Vt}from"./AddLink-0L0E-LsA.js";import{$ as Ht,$t as R,A as Ut,At as Wt,B as Gt,Bt as Kt,C as qt,Ct as Jt,D as z,Dt as Yt,E as Xt,Et as Zt,F as Qt,Ft as $t,G as en,Gt as tn,H as nn,Ht as rn,I as an,It as on,J as sn,Jt as cn,K as ln,Kt as un,L as dn,Lt as fn,M as pn,Mt as mn,O as hn,Ot as gn,P as _n,Q as vn,Qt as yn,R as bn,Rt as xn,S as Sn,St as Cn,T as wn,Tt as Tn,U as En,Ut as Dn,Vt as On,W as kn,Wt as An,X as jn,Xt as Mn,Yt as Nn,Z as Pn,Zt as Fn,_ as In,_n as B,_t as Ln,a as Rn,an as zn,at as Bn,b as Vn,bt as Hn,c as Un,cn as Wn,d as Gn,dn as Kn,dt as qn,en as Jn,et as Yn,f as Xn,fn as Zn,g as Qn,gn as $n,gt as er,h as tr,hn as nr,ht as rr,i as ir,in as ar,it as or,jt as sr,k as cr,kt as lr,l as ur,ln as dr,lt as fr,m as pr,mn as mr,mt as hr,n as gr,nt as _r,o as vr,on as yr,ot as br,p as xr,pn as Sr,pt as Cr,q as wr,qt as Tr,r as Er,rn as Dr,rt as Or,s as kr,st as Ar,t as jr,tn as Mr,tt as Nr,u as Pr,un as Fr,ut as Ir,vt as Lr,w as Rr,wt as zr,x as Br,xt as Vr,y as Hr,yt as Ur,z as Wr,zt as Gr}from"./installSVGRenderer-1WdbDz-H.js";var Kr=e(y(),1),qr=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,7,9,32,4,318,1,78,5,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,68,8,2,0,3,0,2,3,2,4,2,0,15,1,83,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,7,19,58,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,199,7,137,9,54,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,55,9,266,3,10,1,2,0,49,6,4,4,14,10,5350,0,7,14,11465,27,2343,9,87,9,39,4,60,6,26,9,535,9,470,0,2,54,8,3,82,0,12,1,19628,1,4178,9,519,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,245,1,2,9,233,0,3,0,8,1,6,0,475,6,110,6,6,9,4759,9,787719,239],Jr=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,4,51,13,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,7,25,39,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,39,27,10,22,251,41,7,1,17,5,57,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,31,9,2,0,3,0,2,37,2,0,26,0,2,0,45,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,200,32,32,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,24,43,261,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,26,3994,6,582,6842,29,1763,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,433,44,212,63,33,24,3,24,45,74,6,0,67,12,65,1,2,0,15,4,10,7381,42,31,98,114,8702,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,229,29,3,0,208,30,2,2,2,1,2,6,3,4,10,1,225,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4381,3,5773,3,7472,16,621,2467,541,1507,4938,6,8489],Yr=`·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ--ᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・`,Xr=`ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-ࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽ-ೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-Ა-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ--ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ`,Zr={3:`abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile`,5:`class enum extends super const export import`,6:`enum`,strict:`implements interface let package private protected public static yield`,strictBind:`eval arguments`},Qr=`break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this`,$r={5:Qr,"5module":Qr+` export import`,6:Qr+` const class extends export import super`},ei=/^in(stanceof)?$/,ti=RegExp(`[`+Xr+`]`),ni=RegExp(`[`+Xr+Yr+`]`);function ri(e,t){for(var n=65536,r=0;r<t.length;r+=2){if(n+=t[r],n>e)return!1;if(n+=t[r+1],n>=e)return!0}return!1}function ii(e,t){return e<65?e===36:e<91?!0:e<97?e===95:e<123?!0:e<=65535?e>=170&&ti.test(String.fromCharCode(e)):t!==!1&&ri(e,Jr)}function ai(e,t){return e<48?e===36:e<58?!0:e<65?!1:e<91?!0:e<97?e===95:e<123?!0:e<=65535?e>=170&&ni.test(String.fromCharCode(e)):t===!1?!1:ri(e,Jr)||ri(e,qr)}var V=function(e,t){t===void 0&&(t={}),this.label=e,this.keyword=t.keyword,this.beforeExpr=!!t.beforeExpr,this.startsExpr=!!t.startsExpr,this.isLoop=!!t.isLoop,this.isAssign=!!t.isAssign,this.prefix=!!t.prefix,this.postfix=!!t.postfix,this.binop=t.binop||null,this.updateContext=null};function oi(e,t){return new V(e,{beforeExpr:!0,binop:t})}var si={beforeExpr:!0},ci={startsExpr:!0},li={};function H(e,t){return t===void 0&&(t={}),t.keyword=e,li[e]=new V(e,t)}var U={num:new V(`num`,ci),regexp:new V(`regexp`,ci),string:new V(`string`,ci),name:new V(`name`,ci),privateId:new V(`privateId`,ci),eof:new V(`eof`),bracketL:new V(`[`,{beforeExpr:!0,startsExpr:!0}),bracketR:new V(`]`),braceL:new V(`{`,{beforeExpr:!0,startsExpr:!0}),braceR:new V(`}`),parenL:new V(`(`,{beforeExpr:!0,startsExpr:!0}),parenR:new V(`)`),comma:new V(`,`,si),semi:new V(`;`,si),colon:new V(`:`,si),dot:new V(`.`),question:new V(`?`,si),questionDot:new V(`?.`),arrow:new V(`=>`,si),template:new V(`template`),invalidTemplate:new V(`invalidTemplate`),ellipsis:new V(`...`,si),backQuote:new V("`",ci),dollarBraceL:new V("${",{beforeExpr:!0,startsExpr:!0}),eq:new V(`=`,{beforeExpr:!0,isAssign:!0}),assign:new V(`_=`,{beforeExpr:!0,isAssign:!0}),incDec:new V(`++/--`,{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new V(`!/~`,{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:oi(`||`,1),logicalAND:oi(`&&`,2),bitwiseOR:oi(`|`,3),bitwiseXOR:oi(`^`,4),bitwiseAND:oi(`&`,5),equality:oi(`==/!=/===/!==`,6),relational:oi(`</>/<=/>=`,7),bitShift:oi(`<</>>/>>>`,8),plusMin:new V(`+/-`,{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:oi(`%`,10),star:oi(`*`,10),slash:oi(`/`,10),starstar:new V(`**`,{beforeExpr:!0}),coalesce:oi(`??`,1),_break:H(`break`),_case:H(`case`,si),_catch:H(`catch`),_continue:H(`continue`),_debugger:H(`debugger`),_default:H(`default`,si),_do:H(`do`,{isLoop:!0,beforeExpr:!0}),_else:H(`else`,si),_finally:H(`finally`),_for:H(`for`,{isLoop:!0}),_function:H(`function`,ci),_if:H(`if`),_return:H(`return`,si),_switch:H(`switch`),_throw:H(`throw`,si),_try:H(`try`),_var:H(`var`),_const:H(`const`),_while:H(`while`,{isLoop:!0}),_with:H(`with`),_new:H(`new`,{beforeExpr:!0,startsExpr:!0}),_this:H(`this`,ci),_super:H(`super`,ci),_class:H(`class`,ci),_extends:H(`extends`,si),_export:H(`export`),_import:H(`import`,ci),_null:H(`null`,ci),_true:H(`true`,ci),_false:H(`false`,ci),_in:H(`in`,{beforeExpr:!0,binop:7}),_instanceof:H(`instanceof`,{beforeExpr:!0,binop:7}),_typeof:H(`typeof`,{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:H(`void`,{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:H(`delete`,{beforeExpr:!0,prefix:!0,startsExpr:!0})},ui=/\r\n?|\n|\u2028|\u2029/,di=new RegExp(ui.source,`g`);function fi(e){return e===10||e===13||e===8232||e===8233}function pi(e,t,n){n===void 0&&(n=e.length);for(var r=t;r<n;r++){var i=e.charCodeAt(r);if(fi(i))return r<n-1&&i===13&&e.charCodeAt(r+1)===10?r+2:r+1}return-1}var mi=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,hi=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,gi=Object.prototype,_i=gi.hasOwnProperty,vi=gi.toString,yi=Object.hasOwn||(function(e,t){return _i.call(e,t)}),bi=Array.isArray||(function(e){return vi.call(e)===`[object Array]`}),xi=Object.create(null);function Si(e){return xi[e]||(xi[e]=RegExp(`^(?:`+e.replace(/ /g,`|`)+`)$`))}function Ci(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}var wi=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,Ti=function(e,t){this.line=e,this.column=t};Ti.prototype.offset=function(e){return new Ti(this.line,this.column+e)};var Ei=function(e,t,n){this.start=t,this.end=n,e.sourceFile!==null&&(this.source=e.sourceFile)};function Di(e,t){for(var n=1,r=0;;){var i=pi(e,r,t);if(i<0)return new Ti(n,t-r);++n,r=i}}var Oi={ecmaVersion:null,sourceType:`script`,strict:!1,onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowAwaitOutsideFunction:null,allowSuperOutsideMethod:null,allowHashBang:!1,checkPrivateFields:!0,locations:!1,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1},ki=!1;function Ai(e){var t={};for(var n in Oi)t[n]=e&&yi(e,n)?e[n]:Oi[n];if(t.ecmaVersion===`latest`?t.ecmaVersion=1e8:t.ecmaVersion==null?(!ki&&typeof console==`object`&&console.warn&&(ki=!0,console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required.
|
|
2
2
|
Defaulting to 2020, but this will stop working in the future.`)),t.ecmaVersion=11):t.ecmaVersion>=2015&&(t.ecmaVersion-=2009),t.allowReserved??=t.ecmaVersion<5,e&&e.allowHashBang!=null||(t.allowHashBang=t.ecmaVersion>=14),bi(t.onToken)){var r=t.onToken;t.onToken=function(e){return r.push(e)}}if(bi(t.onComment)&&(t.onComment=ji(t,t.onComment)),t.sourceType===`commonjs`&&t.allowAwaitOutsideFunction)throw Error(`Cannot use allowAwaitOutsideFunction with sourceType: commonjs`);return t}function ji(e,t){return function(n,r,i,a,o,s){var c={type:n?`Block`:`Line`,value:r,start:i,end:a};e.locations&&(c.loc=new Ei(this,o,s)),e.ranges&&(c.range=[i,a]),t.push(c)}}var Mi=1,Ni=2,Pi=4,Fi=8,Ii=16,Li=32,Ri=64,zi=128,Bi=256,Vi=512,Hi=1024,Ui=Mi|Ni|Bi;function Wi(e,t){return Ni|(e?Pi:0)|(t?Fi:0)}var Gi=0,Ki=1,qi=2,Ji=3,Yi=4,Xi=5,W=function(e,t,n){this.options=e=Ai(e),this.sourceFile=e.sourceFile,this.keywords=Si($r[e.ecmaVersion>=6?6:e.sourceType===`module`?`5module`:5]);var r=``;e.allowReserved!==!0&&(r=Zr[e.ecmaVersion>=6?6:e.ecmaVersion===5?5:3],e.sourceType===`module`&&(r+=` await`)),this.reservedWords=Si(r);var i=(r?r+` `:``)+Zr.strict;this.reservedWordsStrict=Si(i),this.reservedWordsStrictBind=Si(i+` `+Zr.strictBind),this.input=String(t),this.containsEsc=!1,n?(this.pos=n,this.lineStart=this.input.lastIndexOf(`
|
|
3
3
|
`,n-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(ui).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=U.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.inModule=e.sourceType===`module`,this.strict=this.inModule||e.strict===!0||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.potentialArrowInForAwait=!1,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels=[],this.undefinedExports=Object.create(null),this.pos===0&&e.allowHashBang&&this.input.slice(0,2)===`#!`&&this.skipLineComment(2),this.scopeStack=[],this.enterScope(this.options.sourceType===`commonjs`?Ni:Mi),this.regexpState=null,this.privateNameStack=[]},Zi={inFunction:{configurable:!0},inGenerator:{configurable:!0},inAsync:{configurable:!0},canAwait:{configurable:!0},allowReturn:{configurable:!0},allowSuper:{configurable:!0},allowDirectSuper:{configurable:!0},treatFunctionsAsVar:{configurable:!0},allowNewDotTarget:{configurable:!0},allowUsing:{configurable:!0},inClassStaticBlock:{configurable:!0}};W.prototype.parse=function(){var e=this,t=this.options.program||this.startNode();return this.nextToken(),this.catchStackOverflow(function(){return e.parseTopLevel(t)})},Zi.inFunction.get=function(){return(this.currentVarScope().flags&Ni)>0},Zi.inGenerator.get=function(){return(this.currentVarScope().flags&Fi)>0},Zi.inAsync.get=function(){return(this.currentVarScope().flags&Pi)>0},Zi.canAwait.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e].flags;if(t&(Bi|Vi))return!1;if(t&Ni)return(t&Pi)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction},Zi.allowReturn.get=function(){return!!(this.inFunction||this.options.allowReturnOutsideFunction&&this.currentVarScope().flags&Mi)},Zi.allowSuper.get=function(){return(this.currentThisScope().flags&Ri)>0||this.options.allowSuperOutsideMethod},Zi.allowDirectSuper.get=function(){return(this.currentThisScope().flags&zi)>0},Zi.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())},Zi.allowNewDotTarget.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e].flags;if(t&(Bi|Vi)||t&Ni&&!(t&Ii))return!0}return!1},Zi.allowUsing.get=function(){var e=this.currentScope().flags;return!(e&Hi||!this.inModule&&e&Mi)},Zi.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&Bi)>0},W.extend=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];for(var n=this,r=0;r<e.length;r++)n=e[r](n);return n},W.parse=function(e,t){return new this(t,e).parse()},W.parseExpressionAt=function(e,t,n){var r=new this(n,e,t);return r.nextToken(),r.parseExpression()},W.tokenizer=function(e,t){return new this(t,e)},Object.defineProperties(W.prototype,Zi);var Qi=W.prototype,$i=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;Qi.strictDirective=function(e){if(this.options.ecmaVersion<5)return!1;for(;;){hi.lastIndex=e,e+=hi.exec(this.input)[0].length;var t=$i.exec(this.input.slice(e));if(!t)return!1;if((t[1]||t[2])===`use strict`){hi.lastIndex=e+t[0].length;var n=hi.exec(this.input),r=n.index+n[0].length,i=this.input.charAt(r);return i===`;`||i===`}`||ui.test(n[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(i)||i===`!`&&this.input.charAt(r+1)===`=`)}e+=t[0].length,hi.lastIndex=e,e+=hi.exec(this.input)[0].length,this.input[e]===`;`&&e++}},Qi.eat=function(e){return this.type===e&&(this.next(),!0)},Qi.isContextual=function(e){return this.type===U.name&&this.value===e&&!this.containsEsc},Qi.eatContextual=function(e){return this.isContextual(e)?(this.next(),!0):!1},Qi.catchStackOverflow=function(e){try{return e()}catch(e){if(e instanceof Error&&(/\bstack\b.*\b(exceeded|overflow)\b/i.test(e.message)||/\btoo much recursion\b/i.test(e.message)))this.raise(this.start,`Not enough stack space to parse input`);else throw e}},Qi.expectContextual=function(e){this.eatContextual(e)||this.unexpected()},Qi.canInsertSemicolon=function(){return this.type===U.eof||this.type===U.braceR||ui.test(this.input.slice(this.lastTokEnd,this.start))},Qi.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0},Qi.semicolon=function(){!this.eat(U.semi)&&!this.insertSemicolon()&&this.unexpected()},Qi.afterTrailingComma=function(e,t){if(this.type===e)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),t||this.next(),!0},Qi.expect=function(e){this.eat(e)||this.unexpected()},Qi.unexpected=function(e){this.raise(e??this.start,`Unexpected token`)};var ea=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};Qi.checkPatternErrors=function(e,t){if(e){e.trailingComma>-1&&this.raiseRecoverable(e.trailingComma,`Comma is not permitted after the rest element`);var n=t?e.parenthesizedAssign:e.parenthesizedBind;n>-1&&this.raiseRecoverable(n,t?`Assigning to rvalue`:`Parenthesized pattern`)}},Qi.checkExpressionErrors=function(e,t){if(!e)return!1;var n=e.shorthandAssign,r=e.doubleProto;if(!t)return n>=0||r>=0;n>=0&&this.raise(n,`Shorthand property assignments are valid only in destructuring patterns`),r>=0&&this.raiseRecoverable(r,`Redefinition of __proto__ property`)},Qi.checkYieldAwaitInDefaultParams=function(){this.yieldPos&&(!this.awaitPos||this.yieldPos<this.awaitPos)&&this.raise(this.yieldPos,`Yield expression cannot be a default value`),this.awaitPos&&this.raise(this.awaitPos,`Await expression cannot be a default value`)},Qi.isSimpleAssignTarget=function(e){return e.type===`ParenthesizedExpression`?this.isSimpleAssignTarget(e.expression):e.type===`Identifier`||e.type===`MemberExpression`};var G=W.prototype;G.parseTopLevel=function(e){var t=Object.create(null);for(e.body||=[];this.type!==U.eof;){var n=this.parseStatement(null,!0,t);e.body.push(n)}if(this.inModule)for(var r=0,i=Object.keys(this.undefinedExports);r<i.length;r+=1){var a=i[r];this.raiseRecoverable(this.undefinedExports[a].start,`Export '`+a+`' is not defined`)}return this.adaptDirectivePrologue(e.body),this.next(),e.sourceType=this.options.sourceType===`commonjs`?`script`:this.options.sourceType,this.finishNode(e,`Program`)};var ta={kind:`loop`},na={kind:`switch`};G.isLet=function(e){if(this.options.ecmaVersion<6||!this.isContextual(`let`))return!1;hi.lastIndex=this.pos;var t=hi.exec(this.input),n=this.pos+t[0].length,r=this.fullCharCodeAt(n);if(r===91||r===92)return!0;if(e)return!1;if(r===123)return!0;if(ii(r)){var i=n;do n+=r<=65535?1:2;while(ai(r=this.fullCharCodeAt(n)));if(r===92)return!0;var a=this.input.slice(i,n);if(!ei.test(a))return!0}return!1},G.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual(`async`))return!1;hi.lastIndex=this.pos;var e=hi.exec(this.input),t=this.pos+e[0].length,n;return!ui.test(this.input.slice(this.pos,t))&&this.input.slice(t,t+8)===`function`&&(t+8===this.input.length||!(ai(n=this.fullCharCodeAt(t+8))||n===92))},G.isUsingKeyword=function(e,t){if(this.options.ecmaVersion<17||!this.isContextual(e?`await`:`using`))return!1;hi.lastIndex=this.pos;var n=hi.exec(this.input),r=this.pos+n[0].length;if(ui.test(this.input.slice(this.pos,r)))return!1;if(e){var i=r+5,a;if(this.input.slice(r,i)!==`using`||i===this.input.length||ai(a=this.fullCharCodeAt(i))||a===92)return!1;hi.lastIndex=i;var o=hi.exec(this.input);if(r=i+o[0].length,o&&ui.test(this.input.slice(i,r)))return!1}var s=this.fullCharCodeAt(r);if(!ii(s)&&s!==92)return!1;var c=r;do r+=s<=65535?1:2;while(ai(s=this.fullCharCodeAt(r)));if(s===92)return!0;var l=this.input.slice(c,r);if(ei.test(l))return!1;if(t&&!e&&l===`of`){hi.lastIndex=r;var u=hi.exec(this.input);if(r+=u[0].length,this.input.charCodeAt(r)!==61||(s=this.input.charCodeAt(r+1))===61||s===62)return!1}return!0},G.isAwaitUsing=function(e){return this.isUsingKeyword(!0,e)},G.isUsing=function(e){return this.isUsingKeyword(!1,e)},G.parseStatement=function(e,t,n){var r=this.type,i=this.startNode(),a;switch(this.isLet(e)&&(r=U._var,a=`let`),r){case U._break:case U._continue:return this.parseBreakContinueStatement(i,r.keyword);case U._debugger:return this.parseDebuggerStatement(i);case U._do:return this.parseDoStatement(i);case U._for:return this.parseForStatement(i);case U._function:return e&&(this.strict||e!==`if`&&e!==`label`)&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(i,!1,!e);case U._class:return e&&this.unexpected(),this.parseClass(i,!0);case U._if:return this.parseIfStatement(i);case U._return:return this.parseReturnStatement(i);case U._switch:return this.parseSwitchStatement(i);case U._throw:return this.parseThrowStatement(i);case U._try:return this.parseTryStatement(i);case U._const:case U._var:return a||=this.value,e&&a!==`var`&&this.unexpected(),this.parseVarStatement(i,a);case U._while:return this.parseWhileStatement(i);case U._with:return this.parseWithStatement(i);case U.braceL:return this.parseBlock(!0,i);case U.semi:return this.parseEmptyStatement(i);case U._export:case U._import:if(this.options.ecmaVersion>10&&r===U._import){hi.lastIndex=this.pos;var o=hi.exec(this.input),s=this.pos+o[0].length,c=this.input.charCodeAt(s);if(c===40||c===46)return this.parseExpressionStatement(i,this.parseExpression())}return this.options.allowImportExportEverywhere||(t||this.raise(this.start,`'import' and 'export' may only appear at the top level`),this.inModule||this.raise(this.start,`'import' and 'export' may appear only with 'sourceType: module'`)),r===U._import?this.parseImport(i):this.parseExport(i,n);default:if(this.isAsyncFunction())return e&&this.unexpected(),this.next(),this.parseFunctionStatement(i,!0,!e);var l=this.isAwaitUsing(!1)?`await using`:this.isUsing(!1)?`using`:null;if(l)return this.allowUsing||this.raise(this.start,"Using declaration cannot appear in the top level when source type is `script` or in the bare case statement"),e&&this.raise(this.start,`Using declaration is not allowed in single-statement positions`),l===`await using`&&(this.canAwait||this.raise(this.start,`Await using cannot appear outside of async function`),this.next()),this.next(),this.parseVar(i,!1,l),this.semicolon(),this.finishNode(i,`VariableDeclaration`);var u=this.value,d=this.parseExpression();return r===U.name&&d.type===`Identifier`&&this.eat(U.colon)?this.parseLabeledStatement(i,u,d,e):this.parseExpressionStatement(i,d)}},G.parseBreakContinueStatement=function(e,t){var n=t===`break`;this.next(),this.eat(U.semi)||this.insertSemicolon()?e.label=null:this.type===U.name?(e.label=this.parseIdent(),this.semicolon()):this.unexpected();for(var r=0;r<this.labels.length;++r){var i=this.labels[r];if((e.label==null||i.name===e.label.name)&&(i.kind!=null&&(n||i.kind===`loop`)||e.label&&n))break}return r===this.labels.length&&this.raise(e.start,`Unsyntactic `+t),this.finishNode(e,n?`BreakStatement`:`ContinueStatement`)},G.parseDebuggerStatement=function(e){return this.next(),this.semicolon(),this.finishNode(e,`DebuggerStatement`)},G.parseDoStatement=function(e){return this.next(),this.labels.push(ta),e.body=this.parseStatement(`do`),this.labels.pop(),this.expect(U._while),e.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(U.semi):this.semicolon(),this.finishNode(e,`DoWhileStatement`)},G.parseForStatement=function(e){this.next();var t=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual(`await`)?this.lastTokStart:-1;if(this.labels.push(ta),this.enterScope(0),this.expect(U.parenL),this.type===U.semi)return t>-1&&this.unexpected(t),this.parseFor(e,null);var n=this.isLet();if(this.type===U._var||this.type===U._const||n){var r=this.startNode(),i=n?`let`:this.value;return this.next(),this.parseVar(r,!0,i),this.finishNode(r,`VariableDeclaration`),this.parseForAfterInit(e,r,t)}var a=this.isContextual(`let`),o=!1,s=this.isUsing(!0)?`using`:this.isAwaitUsing(!0)?`await using`:null;if(s){var c=this.startNode();return this.next(),s===`await using`&&(this.canAwait||this.raise(this.start,`Await using cannot appear outside of async function`),this.next()),this.parseVar(c,!0,s),this.finishNode(c,`VariableDeclaration`),this.parseForAfterInit(e,c,t)}var l=this.containsEsc,u=new ea,d=this.start,f=t>-1?this.parseExprSubscripts(u,`await`):this.parseExpression(!0,u);return this.type===U._in||(o=this.options.ecmaVersion>=6&&this.isContextual(`of`))?(t>-1?(this.type===U._in&&this.unexpected(t),e.await=!0):o&&this.options.ecmaVersion>=8&&(f.start===d&&!l&&f.type===`Identifier`&&f.name===`async`?this.unexpected():this.options.ecmaVersion>=9&&(e.await=!1)),a&&o&&this.raise(f.start,`The left-hand side of a for-of loop may not start with 'let'.`),this.toAssignable(f,!1,u),this.checkLValPattern(f),this.parseForIn(e,f)):(this.checkExpressionErrors(u,!0),t>-1&&this.unexpected(t),this.parseFor(e,f))},G.parseForAfterInit=function(e,t,n){return(this.type===U._in||this.options.ecmaVersion>=6&&this.isContextual(`of`))&&t.declarations.length===1?(this.type===U._in?(t.kind!==`using`&&t.kind!==`await using`||t.declarations[0].init||this.raise(this.start,`Using declaration is not allowed in for-in loops`),this.options.ecmaVersion>=9&&n>-1&&this.unexpected(n)):this.options.ecmaVersion>=9&&(e.await=n>-1),this.parseForIn(e,t)):(n>-1&&this.unexpected(n),this.parseFor(e,t))},G.parseFunctionStatement=function(e,t,n){return this.next(),this.parseFunction(e,ia|(n?0:aa),!1,t)},G.parseIfStatement=function(e){return this.next(),e.test=this.parseParenExpression(),e.consequent=this.parseStatement(`if`),e.alternate=this.eat(U._else)?this.parseStatement(`if`):null,this.finishNode(e,`IfStatement`)},G.parseReturnStatement=function(e){return this.allowReturn||this.raise(this.start,`'return' outside of function`),this.next(),this.eat(U.semi)||this.insertSemicolon()?e.argument=null:(e.argument=this.parseExpression(),this.semicolon()),this.finishNode(e,`ReturnStatement`)},G.parseSwitchStatement=function(e){this.next(),e.discriminant=this.parseParenExpression(),e.cases=[],this.expect(U.braceL),this.labels.push(na),this.enterScope(Hi);for(var t,n=!1;this.type!==U.braceR;)if(this.type===U._case||this.type===U._default){var r=this.type===U._case;t&&this.finishNode(t,`SwitchCase`),e.cases.push(t=this.startNode()),t.consequent=[],this.next(),r?t.test=this.parseExpression():(n&&this.raiseRecoverable(this.lastTokStart,`Multiple default clauses`),n=!0,t.test=null),this.expect(U.colon)}else t||this.unexpected(),t.consequent.push(this.parseStatement(null));return this.exitScope(),t&&this.finishNode(t,`SwitchCase`),this.next(),this.labels.pop(),this.finishNode(e,`SwitchStatement`)},G.parseThrowStatement=function(e){return this.next(),ui.test(this.input.slice(this.lastTokEnd,this.start))&&this.raise(this.lastTokEnd,`Illegal newline after throw`),e.argument=this.parseExpression(),this.semicolon(),this.finishNode(e,`ThrowStatement`)};var ra=[];G.parseCatchClauseParam=function(){var e=this.parseBindingAtom(),t=e.type===`Identifier`;return this.enterScope(t?Li:0),this.checkLValPattern(e,t?Yi:qi),this.expect(U.parenR),e},G.parseTryStatement=function(e){if(this.next(),e.block=this.parseBlock(),e.handler=null,this.type===U._catch){var t=this.startNode();this.next(),this.eat(U.parenL)?t.param=this.parseCatchClauseParam():(this.options.ecmaVersion<10&&this.unexpected(),t.param=null,this.enterScope(0)),t.body=this.parseBlock(!1),this.exitScope(),e.handler=this.finishNode(t,`CatchClause`)}return e.finalizer=this.eat(U._finally)?this.parseBlock():null,!e.handler&&!e.finalizer&&this.raise(e.start,`Missing catch or finally clause`),this.finishNode(e,`TryStatement`)},G.parseVarStatement=function(e,t,n){return this.next(),this.parseVar(e,!1,t,n),this.semicolon(),this.finishNode(e,`VariableDeclaration`)},G.parseWhileStatement=function(e){return this.next(),e.test=this.parseParenExpression(),this.labels.push(ta),e.body=this.parseStatement(`while`),this.labels.pop(),this.finishNode(e,`WhileStatement`)},G.parseWithStatement=function(e){return this.strict&&this.raise(this.start,`'with' in strict mode`),this.next(),e.object=this.parseParenExpression(),e.body=this.parseStatement(`with`),this.finishNode(e,`WithStatement`)},G.parseEmptyStatement=function(e){return this.next(),this.finishNode(e,`EmptyStatement`)},G.parseLabeledStatement=function(e,t,n,r){for(var i=0,a=this.labels;i<a.length;i+=1)a[i].name===t&&this.raise(n.start,`Label '`+t+`' is already declared`);for(var o=this.type.isLoop?`loop`:this.type===U._switch?`switch`:null,s=this.labels.length-1;s>=0;s--){var c=this.labels[s];if(c.statementStart===e.start)c.statementStart=this.start,c.kind=o;else break}return this.labels.push({name:t,kind:o,statementStart:this.start}),e.body=this.parseStatement(r?r.indexOf(`label`)===-1?r+`label`:r:`label`),this.labels.pop(),e.label=n,this.finishNode(e,`LabeledStatement`)},G.parseExpressionStatement=function(e,t){return e.expression=t,this.semicolon(),this.finishNode(e,`ExpressionStatement`)},G.parseBlock=function(e,t,n){for(e===void 0&&(e=!0),t===void 0&&(t=this.startNode()),t.body=[],this.expect(U.braceL),e&&this.enterScope(0);this.type!==U.braceR;){var r=this.parseStatement(null);t.body.push(r)}return n&&(this.strict=!1),this.next(),e&&this.exitScope(),this.finishNode(t,`BlockStatement`)},G.parseFor=function(e,t){return e.init=t,this.expect(U.semi),e.test=this.type===U.semi?null:this.parseExpression(),this.expect(U.semi),e.update=this.type===U.parenR?null:this.parseExpression(),this.expect(U.parenR),e.body=this.parseStatement(`for`),this.exitScope(),this.labels.pop(),this.finishNode(e,`ForStatement`)},G.parseForIn=function(e,t){var n=this.type===U._in;return this.next(),t.type===`VariableDeclaration`&&t.declarations[0].init!=null&&(!n||this.options.ecmaVersion<8||this.strict||t.kind!==`var`||t.declarations[0].id.type!==`Identifier`)&&this.raise(t.start,(n?`for-in`:`for-of`)+` loop variable declaration may not have an initializer`),e.left=t,e.right=n?this.parseExpression():this.parseMaybeAssign(),this.expect(U.parenR),e.body=this.parseStatement(`for`),this.exitScope(),this.labels.pop(),this.finishNode(e,n?`ForInStatement`:`ForOfStatement`)},G.parseVar=function(e,t,n,r){for(e.declarations=[],e.kind=n;;){var i=this.startNode();if(this.parseVarId(i,n),this.eat(U.eq)?i.init=this.parseMaybeAssign(t):!r&&n===`const`&&!(this.type===U._in||this.options.ecmaVersion>=6&&this.isContextual(`of`))?this.unexpected():!r&&(n===`using`||n===`await using`)&&this.options.ecmaVersion>=17&&this.type!==U._in&&!this.isContextual(`of`)?this.raise(this.lastTokEnd,`Missing initializer in `+n+` declaration`):!r&&i.id.type!==`Identifier`&&(!t||this.type!==U._in&&!this.isContextual(`of`))?this.raise(this.lastTokEnd,`Complex binding patterns require an initialization value`):i.init=null,e.declarations.push(this.finishNode(i,`VariableDeclarator`)),!this.eat(U.comma))break}return e},G.parseVarId=function(e,t){e.id=t===`using`||t===`await using`?this.parseIdent():this.parseBindingAtom(),this.checkLValPattern(e.id,t===`var`?Ki:qi,!1)};var ia=1,aa=2,oa=4;G.parseFunction=function(e,t,n,r,i){this.initFunction(e),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!r)&&(this.type===U.star&&t&aa&&this.unexpected(),e.generator=this.eat(U.star)),this.options.ecmaVersion>=8&&(e.async=!!r),t&ia&&(e.id=t&oa&&this.type!==U.name?null:this.parseIdent(),e.id&&!(t&aa)&&this.checkLValSimple(e.id,this.strict||e.generator||e.async?this.treatFunctionsAsVar?Ki:qi:Ji));var a=this.yieldPos,o=this.awaitPos,s=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Wi(e.async,e.generator)),t&ia||(e.id=this.type===U.name?this.parseIdent():null),this.parseFunctionParams(e),this.parseFunctionBody(e,n,!1,i),this.yieldPos=a,this.awaitPos=o,this.awaitIdentPos=s,this.finishNode(e,t&ia?`FunctionDeclaration`:`FunctionExpression`)},G.parseFunctionParams=function(e){this.expect(U.parenL),e.params=this.parseBindingList(U.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()},G.parseClass=function(e,t){this.next();var n=this.strict;this.strict=!0,this.parseClassId(e,t),this.parseClassSuper(e);var r=this.enterClassBody(),i=this.startNode(),a=!1;for(i.body=[],this.expect(U.braceL);this.type!==U.braceR;){var o=this.parseClassElement(e.superClass!==null);o&&(i.body.push(o),o.type===`MethodDefinition`&&o.kind===`constructor`?(a&&this.raiseRecoverable(o.start,`Duplicate constructor in the same class`),a=!0):o.key&&o.key.type===`PrivateIdentifier`&&sa(r,o)&&this.raiseRecoverable(o.key.start,`Identifier '#`+o.key.name+`' has already been declared`))}return this.strict=n,this.next(),e.body=this.finishNode(i,`ClassBody`),this.exitClassBody(),this.finishNode(e,t?`ClassDeclaration`:`ClassExpression`)},G.parseClassElement=function(e){if(this.eat(U.semi))return null;var t=this.options.ecmaVersion,n=this.startNode(),r=``,i=!1,a=!1,o=`method`,s=!1;if(this.eatContextual(`static`)){if(t>=13&&this.eat(U.braceL))return this.parseClassStaticBlock(n),n;this.isClassElementNameStart()||this.type===U.star?s=!0:r=`static`}if(n.static=s,!r&&t>=8&&this.eatContextual(`async`)&&((this.isClassElementNameStart()||this.type===U.star)&&!this.canInsertSemicolon()?a=!0:r=`async`),!r&&(t>=9||!a)&&this.eat(U.star)&&(i=!0),!r&&!a&&!i){var c=this.value;(this.eatContextual(`get`)||this.eatContextual(`set`))&&(this.isClassElementNameStart()?o=c:r=c)}if(r?(n.computed=!1,n.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),n.key.name=r,this.finishNode(n.key,`Identifier`)):this.parseClassElementName(n),t<13||this.type===U.parenL||o!==`method`||i||a){var l=!n.static&&ca(n,`constructor`),u=l&&e;l&&o!==`method`&&this.raise(n.key.start,`Constructor can't have get/set modifier`),n.kind=l?`constructor`:o,this.parseClassMethod(n,i,a,u)}else this.parseClassField(n);return n},G.isClassElementNameStart=function(){return this.type===U.name||this.type===U.privateId||this.type===U.num||this.type===U.string||this.type===U.bracketL||this.type.keyword},G.parseClassElementName=function(e){this.type===U.privateId?(this.value===`constructor`&&this.raise(this.start,`Classes can't have an element named '#constructor'`),e.computed=!1,e.key=this.parsePrivateIdent()):this.parsePropertyName(e)},G.parseClassMethod=function(e,t,n,r){var i=e.key;e.kind===`constructor`?(t&&this.raise(i.start,`Constructor can't be a generator`),n&&this.raise(i.start,`Constructor can't be an async method`)):e.static&&ca(e,`prototype`)&&this.raise(i.start,`Classes may not have a static property named prototype`);var a=e.value=this.parseMethod(t,n,r);return e.kind===`get`&&a.params.length!==0&&this.raiseRecoverable(a.start,`getter should have no params`),e.kind===`set`&&a.params.length!==1&&this.raiseRecoverable(a.start,`setter should have exactly one param`),e.kind===`set`&&a.params[0].type===`RestElement`&&this.raiseRecoverable(a.params[0].start,`Setter cannot use rest params`),this.finishNode(e,`MethodDefinition`)},G.parseClassField=function(e){return ca(e,`constructor`)?this.raise(e.key.start,`Classes can't have a field named 'constructor'`):e.static&&ca(e,`prototype`)&&this.raise(e.key.start,`Classes can't have a static field named 'prototype'`),this.eat(U.eq)?(this.enterScope(Vi|Ri),e.value=this.parseMaybeAssign(),this.exitScope()):e.value=null,this.semicolon(),this.finishNode(e,`PropertyDefinition`)},G.parseClassStaticBlock=function(e){e.body=[];var t=this.labels;for(this.labels=[],this.enterScope(Bi|Ri);this.type!==U.braceR;){var n=this.parseStatement(null);e.body.push(n)}return this.next(),this.exitScope(),this.labels=t,this.finishNode(e,`StaticBlock`)},G.parseClassId=function(e,t){this.type===U.name?(e.id=this.parseIdent(),t&&this.checkLValSimple(e.id,qi,!1)):(t===!0&&this.unexpected(),e.id=null)},G.parseClassSuper=function(e){e.superClass=this.eat(U._extends)?this.parseExprSubscripts(null,!1):null},G.enterClassBody=function(){var e={declared:Object.create(null),used:[]};return this.privateNameStack.push(e),e.declared},G.exitClassBody=function(){var e=this.privateNameStack.pop(),t=e.declared,n=e.used;if(this.options.checkPrivateFields)for(var r=this.privateNameStack.length,i=r===0?null:this.privateNameStack[r-1],a=0;a<n.length;++a){var o=n[a];yi(t,o.name)||(i?i.used.push(o):this.raiseRecoverable(o.start,`Private field '#`+o.name+`' must be declared in an enclosing class`))}};function sa(e,t){var n=t.key.name,r=e[n],i=`true`;return t.type===`MethodDefinition`&&(t.kind===`get`||t.kind===`set`)&&(i=(t.static?`s`:`i`)+t.kind),r===`iget`&&i===`iset`||r===`iset`&&i===`iget`||r===`sget`&&i===`sset`||r===`sset`&&i===`sget`?(e[n]=`true`,!1):r?!0:(e[n]=i,!1)}function ca(e,t){var n=e.computed,r=e.key;return!n&&(r.type===`Identifier`&&r.name===t||r.type===`Literal`&&r.value===t)}G.parseExportAllDeclaration=function(e,t){return this.options.ecmaVersion>=11&&(this.eatContextual(`as`)?(e.exported=this.parseModuleExportName(),this.checkExport(t,e.exported,this.lastTokStart)):e.exported=null),this.expectContextual(`from`),this.type!==U.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,`ExportAllDeclaration`)},G.parseExport=function(e,t){if(this.next(),this.eat(U.star))return this.parseExportAllDeclaration(e,t);if(this.eat(U._default))return this.checkExport(t,`default`,this.lastTokStart),e.declaration=this.parseExportDefaultDeclaration(),this.finishNode(e,`ExportDefaultDeclaration`);if(this.shouldParseExportStatement())e.declaration=this.parseExportDeclaration(e),e.declaration.type===`VariableDeclaration`?this.checkVariableExport(t,e.declaration.declarations):this.checkExport(t,e.declaration.id,e.declaration.id.start),e.specifiers=[],e.source=null,this.options.ecmaVersion>=16&&(e.attributes=[]);else{if(e.declaration=null,e.specifiers=this.parseExportSpecifiers(t),this.eatContextual(`from`))this.type!==U.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause());else{for(var n=0,r=e.specifiers;n<r.length;n+=1){var i=r[n];this.checkUnreserved(i.local),this.checkLocalExport(i.local),i.local.type===`Literal`&&this.raise(i.local.start,"A string literal cannot be used as an exported binding without `from`.")}e.source=null,this.options.ecmaVersion>=16&&(e.attributes=[])}this.semicolon()}return this.finishNode(e,`ExportNamedDeclaration`)},G.parseExportDeclaration=function(e){return this.parseStatement(null)},G.parseExportDefaultDeclaration=function(){var e;if(this.type===U._function||(e=this.isAsyncFunction())){var t=this.startNode();return this.next(),e&&this.next(),this.parseFunction(t,ia|oa,!1,e)}if(this.type===U._class){var n=this.startNode();return this.parseClass(n,`nullableID`)}var r=this.parseMaybeAssign();return this.semicolon(),r},G.checkExport=function(e,t,n){e&&(typeof t!=`string`&&(t=t.type===`Identifier`?t.name:t.value),yi(e,t)&&this.raiseRecoverable(n,`Duplicate export '`+t+`'`),e[t]=!0)},G.checkPatternExport=function(e,t){var n=t.type;if(n===`Identifier`)this.checkExport(e,t,t.start);else if(n===`ObjectPattern`)for(var r=0,i=t.properties;r<i.length;r+=1){var a=i[r];this.checkPatternExport(e,a)}else if(n===`ArrayPattern`)for(var o=0,s=t.elements;o<s.length;o+=1){var c=s[o];c&&this.checkPatternExport(e,c)}else n===`Property`?this.checkPatternExport(e,t.value):n===`AssignmentPattern`?this.checkPatternExport(e,t.left):n===`RestElement`&&this.checkPatternExport(e,t.argument)},G.checkVariableExport=function(e,t){if(e)for(var n=0,r=t;n<r.length;n+=1){var i=r[n];this.checkPatternExport(e,i.id)}},G.shouldParseExportStatement=function(){return this.type.keyword===`var`||this.type.keyword===`const`||this.type.keyword===`class`||this.type.keyword===`function`||this.isLet()||this.isAsyncFunction()},G.parseExportSpecifier=function(e){var t=this.startNode();return t.local=this.parseModuleExportName(),t.exported=this.eatContextual(`as`)?this.parseModuleExportName():t.local,this.checkExport(e,t.exported,t.exported.start),this.finishNode(t,`ExportSpecifier`)},G.parseExportSpecifiers=function(e){var t=[],n=!0;for(this.expect(U.braceL);!this.eat(U.braceR);){if(n)n=!1;else if(this.expect(U.comma),this.afterTrailingComma(U.braceR))break;t.push(this.parseExportSpecifier(e))}return t},G.parseImport=function(e){return this.next(),this.type===U.string?(e.specifiers=ra,e.source=this.parseExprAtom()):(e.specifiers=this.parseImportSpecifiers(),this.expectContextual(`from`),e.source=this.type===U.string?this.parseExprAtom():this.unexpected()),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,`ImportDeclaration`)},G.parseImportSpecifier=function(){var e=this.startNode();return e.imported=this.parseModuleExportName(),this.eatContextual(`as`)?e.local=this.parseIdent():(this.checkUnreserved(e.imported),e.local=e.imported),this.checkLValSimple(e.local,qi),this.finishNode(e,`ImportSpecifier`)},G.parseImportDefaultSpecifier=function(){var e=this.startNode();return e.local=this.parseIdent(),this.checkLValSimple(e.local,qi),this.finishNode(e,`ImportDefaultSpecifier`)},G.parseImportNamespaceSpecifier=function(){var e=this.startNode();return this.next(),this.expectContextual(`as`),e.local=this.parseIdent(),this.checkLValSimple(e.local,qi),this.finishNode(e,`ImportNamespaceSpecifier`)},G.parseImportSpecifiers=function(){var e=[],t=!0;if(this.type===U.name&&(e.push(this.parseImportDefaultSpecifier()),!this.eat(U.comma)))return e;if(this.type===U.star)return e.push(this.parseImportNamespaceSpecifier()),e;for(this.expect(U.braceL);!this.eat(U.braceR);){if(t)t=!1;else if(this.expect(U.comma),this.afterTrailingComma(U.braceR))break;e.push(this.parseImportSpecifier())}return e},G.parseWithClause=function(){var e=[];if(!this.eat(U._with))return e;this.expect(U.braceL);for(var t={},n=!0;!this.eat(U.braceR);){if(n)n=!1;else if(this.expect(U.comma),this.afterTrailingComma(U.braceR))break;var r=this.parseImportAttribute(),i=r.key.type===`Identifier`?r.key.name:r.key.value;yi(t,i)&&this.raiseRecoverable(r.key.start,`Duplicate attribute key '`+i+`'`),t[i]=!0,e.push(r)}return e},G.parseImportAttribute=function(){var e=this.startNode();return e.key=this.type===U.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!==`never`),this.expect(U.colon),this.type!==U.string&&this.unexpected(),e.value=this.parseExprAtom(),this.finishNode(e,`ImportAttribute`)},G.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===U.string){var e=this.parseLiteral(this.value);return wi.test(e.value)&&this.raise(e.start,`An export name cannot include a lone surrogate.`),e}return this.parseIdent(!0)},G.adaptDirectivePrologue=function(e){for(var t=0;t<e.length&&this.isDirectiveCandidate(e[t]);++t)e[t].directive=e[t].expression.raw.slice(1,-1)},G.isDirectiveCandidate=function(e){return this.options.ecmaVersion>=5&&e.type===`ExpressionStatement`&&e.expression.type===`Literal`&&typeof e.expression.value==`string`&&(this.input[e.start]===`"`||this.input[e.start]===`'`)};var la=W.prototype;la.toAssignable=function(e,t,n){if(this.options.ecmaVersion>=6&&e)switch(e.type){case`Identifier`:this.inAsync&&e.name===`await`&&this.raise(e.start,`Cannot use 'await' as identifier inside an async function`);break;case`ObjectPattern`:case`ArrayPattern`:case`AssignmentPattern`:case`RestElement`:break;case`ObjectExpression`:e.type=`ObjectPattern`,n&&this.checkPatternErrors(n,!0);for(var r=0,i=e.properties;r<i.length;r+=1){var a=i[r];this.toAssignable(a,t),a.type===`RestElement`&&(a.argument.type===`ArrayPattern`||a.argument.type===`ObjectPattern`)&&this.raise(a.argument.start,`Unexpected token`)}break;case`Property`:e.kind!==`init`&&this.raise(e.key.start,`Object pattern can't contain getter or setter`),this.toAssignable(e.value,t);break;case`ArrayExpression`:e.type=`ArrayPattern`,n&&this.checkPatternErrors(n,!0),this.toAssignableList(e.elements,t);break;case`SpreadElement`:e.type=`RestElement`,this.toAssignable(e.argument,t),e.argument.type===`AssignmentPattern`&&this.raise(e.argument.start,`Rest elements cannot have a default value`);break;case`AssignmentExpression`:e.operator!==`=`&&this.raise(e.left.end,`Only '=' operator can be used for specifying default value.`),e.type=`AssignmentPattern`,delete e.operator,this.toAssignable(e.left,t);break;case`ParenthesizedExpression`:this.toAssignable(e.expression,t,n);break;case`ChainExpression`:this.raiseRecoverable(e.start,`Optional chaining cannot appear in left-hand side`);break;case`MemberExpression`:if(!t)break;default:this.raise(e.start,`Assigning to rvalue`)}else n&&this.checkPatternErrors(n,!0);return e},la.toAssignableList=function(e,t){for(var n=e.length,r=0;r<n;r++){var i=e[r];i&&this.toAssignable(i,t)}if(n){var a=e[n-1];this.options.ecmaVersion===6&&t&&a&&a.type===`RestElement`&&a.argument.type!==`Identifier`&&this.unexpected(a.argument.start)}return e},la.parseSpread=function(e){var t=this.startNode();return this.next(),t.argument=this.parseMaybeAssign(!1,e),this.finishNode(t,`SpreadElement`)},la.parseRestBinding=function(){var e=this.startNode();return this.next(),this.options.ecmaVersion===6&&this.type!==U.name&&this.unexpected(),e.argument=this.parseBindingAtom(),this.finishNode(e,`RestElement`)},la.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case U.bracketL:var e=this.startNode();return this.next(),e.elements=this.parseBindingList(U.bracketR,!0,!0),this.finishNode(e,`ArrayPattern`);case U.braceL:return this.parseObj(!0)}return this.parseIdent()},la.parseBindingList=function(e,t,n,r){for(var i=[],a=!0;!this.eat(e);)if(a?a=!1:this.expect(U.comma),t&&this.type===U.comma)i.push(null);else if(n&&this.afterTrailingComma(e))break;else if(this.type===U.ellipsis){var o=this.parseRestBinding();this.parseBindingListItem(o),i.push(o),this.type===U.comma&&this.raiseRecoverable(this.start,`Comma is not permitted after the rest element`),this.expect(e);break}else i.push(this.parseAssignableListItem(r));return i},la.parseAssignableListItem=function(e){var t=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(t),t},la.parseBindingListItem=function(e){return e},la.parseMaybeDefault=function(e,t,n){if(n||=this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(U.eq))return n;var r=this.startNodeAt(e,t);return r.left=n,r.right=this.parseMaybeAssign(),this.finishNode(r,`AssignmentPattern`)},la.checkLValSimple=function(e,t,n){t===void 0&&(t=Gi);var r=t!==Gi;switch(e.type){case`Identifier`:this.strict&&this.reservedWordsStrictBind.test(e.name)&&this.raiseRecoverable(e.start,(r?`Binding `:`Assigning to `)+e.name+` in strict mode`),r&&(t===qi&&e.name===`let`&&this.raiseRecoverable(e.start,`let is disallowed as a lexically bound name`),n&&(yi(n,e.name)&&this.raiseRecoverable(e.start,`Argument name clash`),n[e.name]=!0),t!==Xi&&this.declareName(e.name,t,e.start));break;case`ChainExpression`:this.raiseRecoverable(e.start,`Optional chaining cannot appear in left-hand side`);break;case`MemberExpression`:r&&this.raiseRecoverable(e.start,`Binding member expression`);break;case`ParenthesizedExpression`:return r&&this.raiseRecoverable(e.start,`Binding parenthesized expression`),this.checkLValSimple(e.expression,t,n);default:this.raise(e.start,(r?`Binding`:`Assigning to`)+` rvalue`)}},la.checkLValPattern=function(e,t,n){switch(t===void 0&&(t=Gi),e.type){case`ObjectPattern`:for(var r=0,i=e.properties;r<i.length;r+=1){var a=i[r];this.checkLValInnerPattern(a,t,n)}break;case`ArrayPattern`:for(var o=0,s=e.elements;o<s.length;o+=1){var c=s[o];c&&this.checkLValInnerPattern(c,t,n)}break;default:this.checkLValSimple(e,t,n)}},la.checkLValInnerPattern=function(e,t,n){switch(t===void 0&&(t=Gi),e.type){case`Property`:this.checkLValInnerPattern(e.value,t,n);break;case`AssignmentPattern`:this.checkLValPattern(e.left,t,n);break;case`RestElement`:this.checkLValPattern(e.argument,t,n);break;default:this.checkLValPattern(e,t,n)}};var ua=function(e,t,n,r,i){this.token=e,this.isExpr=!!t,this.preserveSpace=!!n,this.override=r,this.generator=!!i},K={b_stat:new ua(`{`,!1),b_expr:new ua(`{`,!0),b_tmpl:new ua("${",!1),p_stat:new ua(`(`,!1),p_expr:new ua(`(`,!0),q_tmpl:new ua("`",!0,!0,function(e){return e.tryReadTemplateToken()}),f_stat:new ua(`function`,!1),f_expr:new ua(`function`,!0),f_expr_gen:new ua(`function`,!0,!1,null,!0),f_gen:new ua(`function`,!1,!1,null,!0)},da=W.prototype;da.initialContext=function(){return[K.b_stat]},da.curContext=function(){return this.context[this.context.length-1]},da.braceIsBlock=function(e){var t=this.curContext();return t===K.f_expr||t===K.f_stat?!0:e===U.colon&&(t===K.b_stat||t===K.b_expr)?!t.isExpr:e===U._return||e===U.name&&this.exprAllowed?ui.test(this.input.slice(this.lastTokEnd,this.start)):e===U._else||e===U.semi||e===U.eof||e===U.parenR||e===U.arrow?!0:e===U.braceL?t===K.b_stat:e===U._var||e===U._const||e===U.name?!1:!this.exprAllowed},da.inGeneratorContext=function(){for(var e=this.context.length-1;e>=1;e--){var t=this.context[e];if(t.token===`function`)return t.generator}return!1},da.updateContext=function(e){var t,n=this.type;n.keyword&&e===U.dot?this.exprAllowed=!1:(t=n.updateContext)?t.call(this,e):this.exprAllowed=n.beforeExpr},da.overrideContext=function(e){this.curContext()!==e&&(this.context[this.context.length-1]=e)},U.parenR.updateContext=U.braceR.updateContext=function(){if(this.context.length===1)this.exprAllowed=!0;else{var e=this.context.pop();e===K.b_stat&&this.curContext().token===`function`&&(e=this.context.pop()),this.exprAllowed=!e.isExpr}},U.braceL.updateContext=function(e){this.context.push(this.braceIsBlock(e)?K.b_stat:K.b_expr),this.exprAllowed=!0},U.dollarBraceL.updateContext=function(){this.context.push(K.b_tmpl),this.exprAllowed=!0},U.parenL.updateContext=function(e){var t=e===U._if||e===U._for||e===U._with||e===U._while;this.context.push(t?K.p_stat:K.p_expr),this.exprAllowed=!0},U.incDec.updateContext=function(){},U._function.updateContext=U._class.updateContext=function(e){e.beforeExpr&&e!==U._else&&(e!==U.semi||this.curContext()===K.p_stat)&&!(e===U._return&&ui.test(this.input.slice(this.lastTokEnd,this.start)))&&(e!==U.colon&&e!==U.braceL||this.curContext()!==K.b_stat)?this.context.push(K.f_expr):this.context.push(K.f_stat),this.exprAllowed=!1},U.colon.updateContext=function(){this.curContext().token===`function`&&this.context.pop(),this.exprAllowed=!0},U.backQuote.updateContext=function(){this.curContext()===K.q_tmpl?this.context.pop():this.context.push(K.q_tmpl),this.exprAllowed=!1},U.star.updateContext=function(e){if(e===U._function){var t=this.context.length-1;this.context[t]===K.f_expr?this.context[t]=K.f_expr_gen:this.context[t]=K.f_gen}this.exprAllowed=!0},U.name.updateContext=function(e){var t=!1;this.options.ecmaVersion>=6&&e!==U.dot&&(this.value===`of`&&!this.exprAllowed||this.value===`yield`&&this.inGeneratorContext())&&(t=!0),this.exprAllowed=t};var q=W.prototype;q.checkPropClash=function(e,t,n){if(!(this.options.ecmaVersion>=9&&e.type===`SpreadElement`)&&!(this.options.ecmaVersion>=6&&(e.computed||e.method||e.shorthand))){var r=e.key,i;switch(r.type){case`Identifier`:i=r.name;break;case`Literal`:i=String(r.value);break;default:return}var a=e.kind;if(this.options.ecmaVersion>=6)i===`__proto__`&&a===`init`&&(t.proto&&(n?n.doubleProto<0&&(n.doubleProto=r.start):this.raiseRecoverable(r.start,`Redefinition of __proto__ property`)),t.proto=!0);else{i=`$`+i;var o=t[i];o?(a===`init`?this.strict&&o.init||o.get||o.set:o.init||o[a])&&this.raiseRecoverable(r.start,`Redefinition of property`):o=t[i]={init:!1,get:!1,set:!1},o[a]=!0}}},q.parseExpression=function(e,t){var n=this;return this.catchStackOverflow(function(){var r=n.start,i=n.startLoc,a=n.parseMaybeAssign(e,t);if(n.type===U.comma){var o=n.startNodeAt(r,i);for(o.expressions=[a];n.eat(U.comma);)o.expressions.push(n.parseMaybeAssign(e,t));return n.finishNode(o,`SequenceExpression`)}return a})},q.parseMaybeAssign=function(e,t,n){if(this.isContextual(`yield`)){if(this.inGenerator)return this.parseYield(e);this.exprAllowed=!1}var r=!1,i=-1,a=-1,o=-1;t?(i=t.parenthesizedAssign,a=t.trailingComma,o=t.doubleProto,t.parenthesizedAssign=t.trailingComma=-1):(t=new ea,r=!0);var s=this.start,c=this.startLoc;(this.type===U.parenL||this.type===U.name)&&(this.potentialArrowAt=this.start,this.potentialArrowInForAwait=e===`await`);var l=this.parseMaybeConditional(e,t);if(n&&(l=n.call(this,l,s,c)),this.type.isAssign){var u=this.startNodeAt(s,c);return u.operator=this.value,this.type===U.eq&&(l=this.toAssignable(l,!1,t)),r||(t.parenthesizedAssign=t.trailingComma=t.doubleProto=-1),t.shorthandAssign>=l.start&&(t.shorthandAssign=-1),this.type===U.eq?this.checkLValPattern(l):this.checkLValSimple(l),u.left=l,this.next(),u.right=this.parseMaybeAssign(e),o>-1&&(t.doubleProto=o),this.finishNode(u,`AssignmentExpression`)}return r&&this.checkExpressionErrors(t,!0),i>-1&&(t.parenthesizedAssign=i),a>-1&&(t.trailingComma=a),l},q.parseMaybeConditional=function(e,t){var n=this.start,r=this.startLoc,i=this.parseExprOps(e,t);if(this.checkExpressionErrors(t))return i;if((i.type!==`ArrowFunctionExpression`||i.start!==n)&&this.eat(U.question)){var a=this.startNodeAt(n,r);return a.test=i,a.consequent=this.parseMaybeAssign(),this.expect(U.colon),a.alternate=this.parseMaybeAssign(e),this.finishNode(a,`ConditionalExpression`)}return i},q.parseExprOps=function(e,t){var n=this.start,r=this.startLoc,i=this.parseMaybeUnary(t,!1,!1,e);return this.checkExpressionErrors(t)||i.start===n&&i.type===`ArrowFunctionExpression`?i:this.parseExprOp(i,n,r,-1,e)},q.parseExprOp=function(e,t,n,r,i){var a=this.type.binop;if(a!=null&&(!i||this.type!==U._in)&&a>r){var o=this.type===U.logicalOR||this.type===U.logicalAND,s=this.type===U.coalesce;s&&(a=U.logicalAND.binop);var c=this.value;this.next();var l=this.start,u=this.startLoc,d=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,i),l,u,a,i),f=this.buildBinary(t,n,e,d,c,o||s);return(o&&this.type===U.coalesce||s&&(this.type===U.logicalOR||this.type===U.logicalAND))&&this.raiseRecoverable(this.start,`Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses`),this.parseExprOp(f,t,n,r,i)}return e},q.buildBinary=function(e,t,n,r,i,a){r.type===`PrivateIdentifier`&&this.raise(r.start,`Private identifier can only be left side of binary expression`);var o=this.startNodeAt(e,t);return o.left=n,o.operator=i,o.right=r,this.finishNode(o,a?`LogicalExpression`:`BinaryExpression`)},q.parseMaybeUnary=function(e,t,n,r){var i=this.start,a=this.startLoc,o;if(this.isContextual(`await`)&&this.canAwait)o=this.parseAwait(r),t=!0;else if(this.type.prefix){var s=this.startNode(),c=this.type===U.incDec;s.operator=this.value,s.prefix=!0,this.next(),s.argument=this.parseMaybeUnary(null,!0,c,r),this.checkExpressionErrors(e,!0),c?this.checkLValSimple(s.argument):this.strict&&s.operator===`delete`&&fa(s.argument)?this.raiseRecoverable(s.start,`Deleting local variable in strict mode`):s.operator===`delete`&&pa(s.argument)?this.raiseRecoverable(s.start,`Private fields can not be deleted`):t=!0,o=this.finishNode(s,c?`UpdateExpression`:`UnaryExpression`)}else if(!t&&this.type===U.privateId)(r||this.privateNameStack.length===0)&&this.options.checkPrivateFields&&this.unexpected(),o=this.parsePrivateIdent(),this.type!==U._in&&this.unexpected();else{if(o=this.parseExprSubscripts(e,r),this.checkExpressionErrors(e))return o;for(;this.type.postfix&&!this.canInsertSemicolon();){var l=this.startNodeAt(i,a);l.operator=this.value,l.prefix=!1,l.argument=o,this.checkLValSimple(o),this.next(),o=this.finishNode(l,`UpdateExpression`)}}if(!n&&this.eat(U.starstar)){if(t)this.unexpected(this.lastTokStart);else return this.buildBinary(i,a,o,this.parseMaybeUnary(null,!1,!1,r),`**`,!1)}else return o};function fa(e){return e.type===`Identifier`||e.type===`ParenthesizedExpression`&&fa(e.expression)}function pa(e){return e.type===`MemberExpression`&&e.property.type===`PrivateIdentifier`||e.type===`ChainExpression`&&pa(e.expression)||e.type===`ParenthesizedExpression`&&pa(e.expression)}q.parseExprSubscripts=function(e,t){var n=this.start,r=this.startLoc,i=this.parseExprAtom(e,t);if(i.type===`ArrowFunctionExpression`&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==`)`)return i;var a=this.parseSubscripts(i,n,r,!1,t);return e&&a.type===`MemberExpression`&&(e.parenthesizedAssign>=a.start&&(e.parenthesizedAssign=-1),e.parenthesizedBind>=a.start&&(e.parenthesizedBind=-1),e.trailingComma>=a.start&&(e.trailingComma=-1)),a},q.parseSubscripts=function(e,t,n,r,i){for(var a=this.options.ecmaVersion>=8&&e.type===`Identifier`&&e.name===`async`&&this.lastTokEnd===e.end&&!this.canInsertSemicolon()&&e.end-e.start===5&&this.potentialArrowAt===e.start,o=!1;;){var s=this.parseSubscript(e,t,n,r,a,o,i);if(s.optional&&(o=!0),s===e||s.type===`ArrowFunctionExpression`){if(o){var c=this.startNodeAt(t,n);c.expression=s,s=this.finishNode(c,`ChainExpression`)}return s}e=s}},q.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(U.arrow)},q.parseSubscriptAsyncArrow=function(e,t,n,r){return this.parseArrowExpression(this.startNodeAt(e,t),n,!0,r)},q.parseSubscript=function(e,t,n,r,i,a,o){var s=this.options.ecmaVersion>=11,c=s&&this.eat(U.questionDot);r&&c&&this.raise(this.lastTokStart,`Optional chaining cannot appear in the callee of new expressions`);var l=this.eat(U.bracketL);if(l||c&&this.type!==U.parenL&&this.type!==U.backQuote||this.eat(U.dot)){var u=this.startNodeAt(t,n);u.object=e,l?(u.property=this.parseExpression(),this.expect(U.bracketR)):u.property=this.type===U.privateId&&e.type!==`Super`?this.parsePrivateIdent():this.parseIdent(this.options.allowReserved!==`never`),u.computed=!!l,s&&(u.optional=c),e=this.finishNode(u,`MemberExpression`)}else if(!r&&this.eat(U.parenL)){var d=new ea,f=this.yieldPos,p=this.awaitPos,m=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var h=this.parseExprList(U.parenR,this.options.ecmaVersion>=8,!1,d);if(i&&!c&&this.shouldParseAsyncArrow())return this.checkPatternErrors(d,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0&&this.raise(this.awaitIdentPos,`Cannot use 'await' as identifier inside an async function`),this.yieldPos=f,this.awaitPos=p,this.awaitIdentPos=m,this.parseSubscriptAsyncArrow(t,n,h,o);this.checkExpressionErrors(d,!0),this.yieldPos=f||this.yieldPos,this.awaitPos=p||this.awaitPos,this.awaitIdentPos=m||this.awaitIdentPos;var g=this.startNodeAt(t,n);g.callee=e,g.arguments=h,s&&(g.optional=c),e=this.finishNode(g,`CallExpression`)}else if(this.type===U.backQuote){(c||a)&&this.raise(this.start,`Optional chaining cannot appear in the tag of tagged template expressions`);var _=this.startNodeAt(t,n);_.tag=e,_.quasi=this.parseTemplate({isTagged:!0}),e=this.finishNode(_,`TaggedTemplateExpression`)}return e},q.parseExprAtom=function(e,t,n){this.type===U.slash&&this.readRegexp();var r,i=this.potentialArrowAt===this.start;switch(this.type){case U._super:return this.allowSuper||this.raise(this.start,`'super' keyword outside a method`),r=this.startNode(),this.next(),this.type===U.parenL&&!this.allowDirectSuper&&this.raise(r.start,`super() call outside constructor of a subclass`),this.type!==U.dot&&this.type!==U.bracketL&&this.type!==U.parenL&&this.unexpected(),this.finishNode(r,`Super`);case U._this:return r=this.startNode(),this.next(),this.finishNode(r,`ThisExpression`);case U.name:var a=this.start,o=this.startLoc,s=this.containsEsc,c=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!s&&c.name===`async`&&!this.canInsertSemicolon()&&this.eat(U._function))return this.overrideContext(K.f_expr),this.parseFunction(this.startNodeAt(a,o),0,!1,!0,t);if(i&&!this.canInsertSemicolon()){if(this.eat(U.arrow))return this.parseArrowExpression(this.startNodeAt(a,o),[c],!1,t);if(this.options.ecmaVersion>=8&&c.name===`async`&&this.type===U.name&&!s&&(!this.potentialArrowInForAwait||this.value!==`of`||this.containsEsc))return c=this.parseIdent(!1),(this.canInsertSemicolon()||!this.eat(U.arrow))&&this.unexpected(),this.parseArrowExpression(this.startNodeAt(a,o),[c],!0,t)}return c;case U.regexp:var l=this.value;return r=this.parseLiteral(l.value),r.regex={pattern:l.pattern,flags:l.flags},r;case U.num:case U.string:return this.parseLiteral(this.value);case U._null:case U._true:case U._false:return r=this.startNode(),r.value=this.type===U._null?null:this.type===U._true,r.raw=this.type.keyword,this.next(),this.finishNode(r,`Literal`);case U.parenL:var u=this.start,d=this.parseParenAndDistinguishExpression(i,t);return e&&(e.parenthesizedAssign<0&&!this.isSimpleAssignTarget(d)&&(e.parenthesizedAssign=u),e.parenthesizedBind<0&&(e.parenthesizedBind=u)),d;case U.bracketL:return r=this.startNode(),this.next(),r.elements=this.parseExprList(U.bracketR,!0,!0,e),this.finishNode(r,`ArrayExpression`);case U.braceL:return this.overrideContext(K.b_expr),this.parseObj(!1,e);case U._function:return r=this.startNode(),this.next(),this.parseFunction(r,0);case U._class:return this.parseClass(this.startNode(),!1);case U._new:return this.parseNew();case U.backQuote:return this.parseTemplate();case U._import:return this.options.ecmaVersion>=11?this.parseExprImport(n):this.unexpected();default:return this.parseExprAtomDefault()}},q.parseExprAtomDefault=function(){this.unexpected()},q.parseExprImport=function(e){var t=this.startNode();if(this.containsEsc&&this.raiseRecoverable(this.start,`Escape sequence in keyword import`),this.next(),this.type===U.parenL&&!e)return this.parseDynamicImport(t);if(this.type===U.dot){var n=this.startNodeAt(t.start,t.loc&&t.loc.start);return n.name=`import`,t.meta=this.finishNode(n,`Identifier`),this.parseImportMeta(t)}this.unexpected()},q.parseDynamicImport=function(e){if(this.next(),e.source=this.parseMaybeAssign(),this.options.ecmaVersion>=16)this.eat(U.parenR)?e.options=null:(this.expect(U.comma),this.afterTrailingComma(U.parenR)?e.options=null:(e.options=this.parseMaybeAssign(),this.eat(U.parenR)||(this.expect(U.comma),this.afterTrailingComma(U.parenR)||this.unexpected())));else if(!this.eat(U.parenR)){var t=this.start;this.eat(U.comma)&&this.eat(U.parenR)?this.raiseRecoverable(t,`Trailing comma is not allowed in import()`):this.unexpected(t)}return this.finishNode(e,`ImportExpression`)},q.parseImportMeta=function(e){this.next();var t=this.containsEsc;return e.property=this.parseIdent(!0),e.property.name!==`meta`&&this.raiseRecoverable(e.property.start,`The only valid meta property for import is 'import.meta'`),t&&this.raiseRecoverable(e.start,`'import.meta' must not contain escaped characters`),this.options.sourceType!==`module`&&!this.options.allowImportExportEverywhere&&this.raiseRecoverable(e.start,`Cannot use 'import.meta' outside a module`),this.finishNode(e,`MetaProperty`)},q.parseLiteral=function(e){var t=this.startNode();return t.value=e,t.raw=this.input.slice(this.start,this.end),t.raw.charCodeAt(t.raw.length-1)===110&&(t.bigint=t.value==null?t.raw.slice(0,-1).replace(/_/g,``):t.value.toString()),this.next(),this.finishNode(t,`Literal`)},q.parseParenExpression=function(){this.expect(U.parenL);var e=this.parseExpression();return this.expect(U.parenR),e},q.shouldParseArrow=function(e){return!this.canInsertSemicolon()},q.parseParenAndDistinguishExpression=function(e,t){var n=this.start,r=this.startLoc,i,a=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var o=this.start,s=this.startLoc,c=[],l=!0,u=!1,d=new ea,f=this.yieldPos,p=this.awaitPos,m;for(this.yieldPos=0,this.awaitPos=0;this.type!==U.parenR;){if(l?l=!1:this.expect(U.comma),a&&this.afterTrailingComma(U.parenR,!0)){u=!0;break}if(this.type===U.ellipsis){m=this.start,c.push(this.parseParenItem(this.parseRestBinding())),this.type===U.comma&&this.raiseRecoverable(this.start,`Comma is not permitted after the rest element`);break}c.push(this.parseMaybeAssign(!1,d,this.parseParenItem))}var h=this.lastTokEnd,g=this.lastTokEndLoc;if(this.expect(U.parenR),e&&this.shouldParseArrow(c)&&this.eat(U.arrow))return this.checkPatternErrors(d,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=f,this.awaitPos=p,this.parseParenArrowList(n,r,c,t);(!c.length||u)&&this.unexpected(this.lastTokStart),m&&this.unexpected(m),this.checkExpressionErrors(d,!0),this.yieldPos=f||this.yieldPos,this.awaitPos=p||this.awaitPos,c.length>1?(i=this.startNodeAt(o,s),i.expressions=c,this.finishNodeAt(i,`SequenceExpression`,h,g)):i=c[0]}else i=this.parseParenExpression();if(this.options.preserveParens){var _=this.startNodeAt(n,r);return _.expression=i,this.finishNode(_,`ParenthesizedExpression`)}return i},q.parseParenItem=function(e){return e},q.parseParenArrowList=function(e,t,n,r){return this.parseArrowExpression(this.startNodeAt(e,t),n,!1,r)};var ma=[];q.parseNew=function(){this.containsEsc&&this.raiseRecoverable(this.start,`Escape sequence in keyword new`);var e=this.startNode();if(this.next(),this.options.ecmaVersion>=6&&this.type===U.dot){var t=this.startNodeAt(e.start,e.loc&&e.loc.start);t.name=`new`,e.meta=this.finishNode(t,`Identifier`),this.next();var n=this.containsEsc;return e.property=this.parseIdent(!0),e.property.name!==`target`&&this.raiseRecoverable(e.property.start,`The only valid meta property for new is 'new.target'`),n&&this.raiseRecoverable(e.start,`'new.target' must not contain escaped characters`),this.allowNewDotTarget||this.raiseRecoverable(e.start,`'new.target' can only be used in functions and class static block`),this.finishNode(e,`MetaProperty`)}var r=this.start,i=this.startLoc;return e.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),r,i,!0,!1),e.callee.type===`Super`&&this.raiseRecoverable(r,`Invalid use of 'super'`),e.arguments=this.eat(U.parenL)?this.parseExprList(U.parenR,this.options.ecmaVersion>=8,!1):ma,this.finishNode(e,`NewExpression`)},q.parseTemplateElement=function(e){var t=e.isTagged,n=this.startNode();return this.type===U.invalidTemplate?(t||this.raiseRecoverable(this.start,`Bad escape sequence in untagged template literal`),n.value={raw:this.value.replace(/\r\n?/g,`
|
|
4
4
|
`),cooked:null}):n.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,`
|
|
@@ -6,7 +6,7 @@ Defaulting to 2020, but this will stop working in the future.`)),t.ecmaVersion=1
|
|
|
6
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(U.invalidTemplate,this.input.slice(this.start,this.pos));case`\r`:this.input[this.pos+1]===`
|
|
7
7
|
`&&++this.pos;case`
|
|
8
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 fi(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(ai(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?ii:ai)(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=U.name;return this.keywords.test(e)&&(t=li[e]),this.finishToken(t,e)},W.acorn={Parser:W,version:`8.17.0`,defaultOptions:Oi,Position:Ti,SourceLocation:Ei,getLineInfo:Di,Node:va,TokenType:V,tokTypes:U,keywordTypes:li,TokContext:ua,tokContexts:K,isIdentifierChar:ai,isIdentifierStart:ii,Token:lo,isNewLine:fi,lineBreak:ui,lineBreakG:di,nonASCIIwhitespace:mi};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}}d();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 Ye{constructor(e){super(e),E(this,`changedIds`,void 0),E(this,`scrollDivRef`,void 0),E(this,`jsonConfigs`,void 0),E(this,`refTemplate`,void 0),E(this,`customObj`,void 0),E(this,`commonConfig`,{}),E(this,`statesFilterFunctions`,{}),E(this,`validationErrors`,new Set),E(this,`schemaErrors`,new Map),E(this,`cb`,void 0),E(this,`cachedNewValues`,void 0),E(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=ae(),this.jsonConfigs={},this.refTemplate={},this.props.customsInstances.map(e=>this.refTemplate[e]=ae()),this.customObj=this.props.objectIDs.length>1?{common:{custom:{}},native:{}}:Ct.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}`]?Ct.deepClone(this.props.objects[`system.adapter.${e}`]):null;if(!n)console.error(`Cannot find adapter "${e}"`);else{if(Ct.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=Kr.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 ee.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,l,u;let d=e.split(`.`)[0],f=this.schemaErrors.get(d);if(f)return D(Pe,{role:`alert`,"data-eos-custom-schema-blocked":e,style:{padding:16},children:[m(Fe,{children:this.props.t(`Settings %s`,e)}),m(Fe,{children:this.props.t(f)})]},e);if(this.getFilteredObjectIDs(e).length===0)return null;let p=`${bo}/adapter/${d}/${this.props.objects[`system.adapter.${d}`].common.icon}`,h=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,_=Array.isArray(h)&&(!this.state.newValues[e]||this.state.newValues[e].enabled===void 0),v=(a=this.jsonConfigs[d])==null||(a=a.json)==null?void 0:a.disabled,y=this.combineNewAndOld(e),b=(o=this.jsonConfigs[d])==null||(o=o.json)==null?void 0:o.hidden;if(v&&b===!0)return null;let x=null,S=(s=this.jsonConfigs[d])==null||(s=s.json)==null?void 0:s.help;return v&&S&&(x=typeof S==`object`?S[this.props.lang]||S.en:this.props.t(S)),D(Be,{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:[D(g,{expandIcon:m(i,{}),"data-id":e,sx:{"& .MuiAccordionSummary-content":{alignItems:`center`}},style:r%2?h?yo.accordionHeaderEnabledOdd:yo.accordionHeaderOdd:h?yo.accordionHeaderEnabledEven:yo.accordionHeaderEven,children:[m(`img`,{src:p,style:yo.headingIcon,alt:``}),m(Fe,{style:yo.heading,children:this.props.t(`Settings %s`,e)}),m(`div`,{className:`titleEnabled`,style:{...yo.titleEnabled,...h?yo.enabledVisible:yo.enabledInvisible},children:this.props.t(`Enabled`)})]}),D(re,{children:[m(`div`,{style:yo.enabledControl,children:m(fe,{style:yo.formControl,control:m(ue,{indeterminate:_,checked:!!h,disabled:!!v,onChange:t=>{this.cachedNewValues=this.cachedNewValues||this.state.newValues;let n=Ct.deepClone(this.cachedNewValues),r=_||t.target.checked;n[e]=n[e]||{},r?n[e].enabled=!0:h&&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`)})}),D(`div`,{style:yo.customControls,children:[!v&&(h||_)&&this.state.systemConfig?m(ee,{instanceObj:t,customObj:n,custom:!0,adapterName:d,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[d])==null?void 0:c.json,data:y,isFloatComma:!!((l=this.props.systemConfig)!=null&&l.common.isFloatComma),dateFormat:((u=this.props.systemConfig)==null?void 0:u.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=Ct.deepClone(this.cachedNewValues);i[e]=i[e]||{},JSON.stringify(et.getValue((r=this.commonConfig)==null?void 0:r[e],t))===JSON.stringify(n)?(et.setValue(i[e],t,null),Object.keys(i[e]).length||delete i[e]):et.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:wt}):null,x]})]})]},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]=Ct.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?m(qe,{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 m(`div`,{style:{color:`#F55`,fontSize:32},children:this.props.t(`Object does not exist!`)});if(!this.state.loaded)return m(me,{});let e=0;return D(Pe,{style:yo.paper,children:[this.state.maxOids>1&&m(me,{color:`secondary`,variant:`determinate`,value:this.state.progress}),m(`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:dt,fr:St,ru:gt,de:ht,es:mt,br:ft,nl:pt,it:_t,pt:yt,pl:xt,uk:bt,"zh-cn":vt};d();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 Ye{constructor(e){super(e),E(this,`adminInstance`,void 0),E(this,`supportedFeaturesPromises`,void 0),E(this,`unit`,void 0),E(this,`timeTimer`,void 0),E(this,`readSupportedFeaturesTimeout`,void 0),E(this,`rangeValues`,void 0),E(this,`rangeRef`,void 0),E(this,`subscribes`,void 0),E(this,`localStorage`,void 0),E(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(D(ve,{sx:{...X.row,...X.updatedRow,...X.rowInterpolated},hover:!0,children:[m(I,{}),m(I,{children:`...`}),this.state.ackVisible?m(I,{}):null,this.state.fromVisible?m(I,{}):null,this.state.lcVisible?m(I,{}):null]},a));else if(i.noData||i.noDataForPeriod)t.push(D(ve,{sx:{...X.row,...X.updatedRow,...X.rowNoData},hover:!0,children:[m(I,{}),m(I,{children:i.noData?this.props.t(`No data in history`):this.props.t(`No data in history for selected period`)}),this.state.ackVisible?m(I,{}):null,this.state.fromVisible?m(I,{}):null,this.state.lcVisible?m(I,{}):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(D(ve,{sx:{...X.row,...X.updatedRow,...n?X.rowInterpolated:void 0,...s?X.rowSelected:void 0},children:[D(I,{onClick:e=>!n&&this.onToggleSelect(e,a,`ts`),children:[`${e.formatTimestamp(i.ts)}`,r&&this.state.lastSelectedColumn===`ts`?m(A,{component:`div`,sx:X.rowFocused}):``]}),D(I,{onClick:e=>!n&&this.onToggleSelect(e,a,`val`),children:[o+this.unit,r&&this.state.lastSelectedColumn===`val`?m(A,{component:`div`,sx:X.rowFocused}):``]}),this.state.ackVisible?D(I,{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`?m(A,{component:`div`,sx:X.rowFocused}):``]}):null,this.state.fromVisible?D(I,{onClick:e=>!n&&this.onToggleSelect(e,a,`from`),children:[i.from||``,r&&this.state.lastSelectedColumn===`from`?m(A,{component:`div`,sx:X.rowFocused}):``]}):null,this.state.lcVisible?D(I,{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`?m(A,{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 m(`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 m(`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)),m(Le,{style:X.container,children:D(c,{stickyHeader:!0,sx:X.table,initialWidths:e,minWidths:t,dblTitle:this.props.t(`ra_Double click to reset table layout`),children:[m(He,{children:D(ve,{children:[m(I,{style:X.colTs,children:this.props.t(`Timestamp`)}),m(I,{style:X.colValue,children:this.props.t(`Value`)}),this.state.ackVisible?m(I,{style:X.colAck,children:this.props.t(`Ack`)}):null,this.state.fromVisible?m(I,{style:X.colFrom,children:this.props.t(`From`)}):null,this.state.lcVisible?m(I,{style:X.colLastChange,children:this.props.t(`lc`)}):null]})}),m(Ee,{children:this.getTableRows()})]})})}return m(me,{})}renderDialogConfirm(){return D(a,{open:!!this.state.areYouSure,onClose:()=>this.setState({areYouSure:!1}),"aria-labelledby":`alert-dialog-title`,"aria-describedby":`alert-dialog-description`,children:[m(w,{id:`alert-dialog-title`}),D(C,{children:[m(te,{id:`alert-dialog-description`,children:this.props.t(`Are you sure?`)}),m(fe,{control:m(ue,{value:this.state.suppressMessage,onChange:()=>this.setState({suppressMessage:!0})}),label:this.props.t(`Suppress for 5 minutes`)})]}),D(Me,{children:[m(L,{variant:`contained`,onClick:()=>this.setState({areYouSure:!1,suppressMessage:this.state.suppressMessage&&Date.now()},()=>this.onDelete()),color:`primary`,autoFocus:!0,startIcon:m(p,{}),children:this.props.t(`Delete`)}),m(L,{variant:`contained`,onClick:()=>this.setState({areYouSure:!1}),color:`secondary`,startIcon:m(b,{}),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 D(a,{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:[m(w,{id:`edit-dialog-title`,children:this.state.updateOpened?this.props.t(`Update entry`):this.props.t(`Insert entry`)}),m(C,{children:D(`form`,{noValidate:!0,autoComplete:`off`,onSubmit:e=>e.preventDefault(),children:[typeof this.state.edit.val==`boolean`?m(fe,{control:m(ue,{checked:this.state.edit.val,onChange:e=>this.updateEdit(`val`,e.target.checked)}),label:this.props.t(`Value`)}):m(j,{variant:`standard`,label:this.props.t(`Value`),value:this.state.edit.val,onChange:e=>this.updateEdit(`val`,e.target.value)}),m(`br`,{}),m(fe,{control:m(ue,{checked:this.state.edit.ack,onChange:e=>this.updateEdit(`ack`,e.target.checked)}),label:this.props.t(`Acknowledged`)}),this.state.insertOpened?m(xe,{dateAdapter:Dt,adapterLocale:So[this.props.lang],children:D(`div`,{style:X.toolbarTimeGrid,children:[m(`div`,{style:X.toolbarTimeLabel,children:this.props.t(`Time`)}),m(Qe,{sx:X.toolbarDate,value:(e=this.state.edit)==null?void 0:e.date,onChange:e=>e&&this.updateEdit(`date`,e)}),m(ce,{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)}),m(j,{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]})}),D(Me,{children:[m(L,{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`)}),m(L,{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 D(De,{children:[D(s,{variant:`standard`,style:X.selectHistoryControl,children:[m(v,{children:this.props.t(`History instance`)}),m(ze,{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=>m(M,{value:e.id,style:e.alive?void 0:X.notAliveInstance,children:e.id},e.id))})]}),D(s,{variant:`standard`,style:X.selectRelativeTime,children:[m(v,{children:this.props.t(`Relative`)}),D(ze,{variant:`standard`,ref:this.rangeRef,value:this.state.relativeRange,onChange:e=>this.setRelativeInterval(e.target.value),children:[m(M,{value:`absolute`,sx:X.customRange,children:this.props.t(`custom range`)},`custom`),m(M,{value:10,children:this.props.t(`last 10 minutes`)},`1`),m(M,{value:30,children:this.props.t(`last 30 minutes`)},`2`),m(M,{value:60,children:this.props.t(`last hour`)},`3`),m(M,{value:`day`,children:this.props.t(`this day`)},`4`),m(M,{value:1440,children:this.props.t(`last 24 hours`)},`5`),m(M,{value:`week`,children:this.props.t(`this week`)},`6`),m(M,{value:10080,children:this.props.t(`last week`)},`7`),m(M,{value:`2weeks`,children:this.props.t(`this 2 weeks`)},`8`),m(M,{value:20160,children:this.props.t(`last 2 weeks`)},`9`),m(M,{value:`month`,children:this.props.t(`this month`)},`10`),m(M,{value:43200,children:this.props.t(`last 30 days`)},`11`),m(M,{value:`year`,children:this.props.t(`this year`)},`12`),m(M,{value:`12months`,children:this.props.t(`last 12 months`)},`13`)]})]}),D(xe,{dateAdapter:Dt,adapterLocale:So[this.props.lang],children:[D(`div`,{style:X.toolbarTimeGrid,children:[m(`div`,{style:{...X.toolbarTimeLabel,opacity:this.state.relativeRange===`absolute`?void 0:.5},children:this.props.t(`Start time`)}),m(Qe,{sx:X.toolbarDate,disabled:this.state.relativeRange!==`absolute`,value:new Date(this.state.start),onChange:e=>e&&this.setStartDate(e)}),m(ce,{disabled:this.state.relativeRange!==`absolute`,sx:X.toolbarTime,ampm:this.state.ampm,value:new Date(this.state.start),onChange:e=>e&&this.setStartDate(e)})]}),D(`div`,{style:X.toolbarTimeGrid,children:[m(`div`,{style:{...X.toolbarTimeLabel,opacity:this.state.relativeRange===`absolute`?void 0:.5},children:this.props.t(`End time`)}),m(Qe,{disabled:this.state.relativeRange!==`absolute`,sx:X.toolbarDate,value:new Date(this.state.end),onChange:e=>e&&this.setEndDate(e)}),m(ce,{disabled:this.state.relativeRange!==`absolute`,sx:X.toolbarTime,ampm:this.state.ampm,value:new Date(this.state.end),onChange:e=>e&&this.setEndDate(e)})]})]}),m(A,{component:`div`,sx:X.grow}),(t=this.state.values)!=null&&t.length?m(x,{size:`large`,onClick:()=>this.exportData(),title:this.props.t(`Save data as csv`),children:m($e,{})}):null,this.state.supportedFeatures.includes(`insert`)&&this.props.expertMode?m(x,{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:m(_,{})}):null,this.state.supportedFeatures.includes(`update`)&&this.props.expertMode?m(x,{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:m(be,{})}):null,this.state.supportedFeatures.includes(`delete`)&&this.props.expertMode?m(x,{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:m(p,{})}):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(`
|
|
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 fi(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(ai(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?ii:ai)(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=U.name;return this.keywords.test(e)&&(t=li[e]),this.finishToken(t,e)},W.acorn={Parser:W,version:`8.17.0`,defaultOptions:Oi,Position:Ti,SourceLocation:Ei,getLineInfo:Di,Node:va,TokenType:V,tokTypes:U,keywordTypes:li,TokContext:ua,tokContexts:K,isIdentifierChar:ai,isIdentifierStart:ii,Token:lo,isNewLine:fi,lineBreak:ui,lineBreakG:di,nonASCIIwhitespace:mi};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}}d();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 Ye{constructor(e){super(e),E(this,`changedIds`,void 0),E(this,`scrollDivRef`,void 0),E(this,`jsonConfigs`,void 0),E(this,`refTemplate`,void 0),E(this,`customObj`,void 0),E(this,`commonConfig`,{}),E(this,`statesFilterFunctions`,{}),E(this,`validationErrors`,new Set),E(this,`schemaErrors`,new Map),E(this,`cb`,void 0),E(this,`cachedNewValues`,void 0),E(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=ae(),this.jsonConfigs={},this.refTemplate={},this.props.customsInstances.map(e=>this.refTemplate[e]=ae()),this.customObj=this.props.objectIDs.length>1?{common:{custom:{}},native:{}}:nt.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}`]?nt.deepClone(this.props.objects[`system.adapter.${e}`]):null;if(!n)console.error(`Cannot find adapter "${e}"`);else{if(nt.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=Kr.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 ee.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,l,u;let d=e.split(`.`)[0],f=this.schemaErrors.get(d);if(f)return D(Pe,{role:`alert`,"data-eos-custom-schema-blocked":e,style:{padding:16},children:[m(Fe,{children:this.props.t(`Settings %s`,e)}),m(Fe,{children:this.props.t(f)})]},e);if(this.getFilteredObjectIDs(e).length===0)return null;let p=`${bo}/adapter/${d}/${this.props.objects[`system.adapter.${d}`].common.icon}`,h=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,_=Array.isArray(h)&&(!this.state.newValues[e]||this.state.newValues[e].enabled===void 0),v=(a=this.jsonConfigs[d])==null||(a=a.json)==null?void 0:a.disabled,y=this.combineNewAndOld(e),b=(o=this.jsonConfigs[d])==null||(o=o.json)==null?void 0:o.hidden;if(v&&b===!0)return null;let x=null,S=(s=this.jsonConfigs[d])==null||(s=s.json)==null?void 0:s.help;return v&&S&&(x=typeof S==`object`?S[this.props.lang]||S.en:this.props.t(S)),D(Be,{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:[D(g,{expandIcon:m(i,{}),"data-id":e,sx:{"& .MuiAccordionSummary-content":{alignItems:`center`}},style:r%2?h?yo.accordionHeaderEnabledOdd:yo.accordionHeaderOdd:h?yo.accordionHeaderEnabledEven:yo.accordionHeaderEven,children:[m(`img`,{src:p,style:yo.headingIcon,alt:``}),m(Fe,{style:yo.heading,children:this.props.t(`Settings %s`,e)}),m(`div`,{className:`titleEnabled`,style:{...yo.titleEnabled,...h?yo.enabledVisible:yo.enabledInvisible},children:this.props.t(`Enabled`)})]}),D(re,{children:[m(`div`,{style:yo.enabledControl,children:m(fe,{style:yo.formControl,control:m(ue,{indeterminate:_,checked:!!h,disabled:!!v,onChange:t=>{this.cachedNewValues=this.cachedNewValues||this.state.newValues;let n=nt.deepClone(this.cachedNewValues),r=_||t.target.checked;n[e]=n[e]||{},r?n[e].enabled=!0:h&&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`)})}),D(`div`,{style:yo.customControls,children:[!v&&(h||_)&&this.state.systemConfig?m(ee,{instanceObj:t,customObj:n,custom:!0,adapterName:d,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[d])==null?void 0:c.json,data:y,isFloatComma:!!((l=this.props.systemConfig)!=null&&l.common.isFloatComma),dateFormat:((u=this.props.systemConfig)==null?void 0:u.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=nt.deepClone(this.cachedNewValues);i[e]=i[e]||{},JSON.stringify(et.getValue((r=this.commonConfig)==null?void 0:r[e],t))===JSON.stringify(n)?(et.setValue(i[e],t,null),Object.keys(i[e]).length||delete i[e]):et.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:rt}):null,x]})]})]},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]=nt.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?m(qe,{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 m(`div`,{style:{color:`#F55`,fontSize:32},children:this.props.t(`Object does not exist!`)});if(!this.state.loaded)return m(me,{});let e=0;return D(Pe,{style:yo.paper,children:[this.state.maxOids>1&&m(me,{color:`secondary`,variant:`determinate`,value:this.state.progress}),m(`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:tt,fr:Pt,ru:Ot,de:Dt,es:Et,br:wt,nl:Tt,it:kt,pt:jt,pl:Nt,uk:Mt,"zh-cn":At};d();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 Ye{constructor(e){super(e),E(this,`adminInstance`,void 0),E(this,`supportedFeaturesPromises`,void 0),E(this,`unit`,void 0),E(this,`timeTimer`,void 0),E(this,`readSupportedFeaturesTimeout`,void 0),E(this,`rangeValues`,void 0),E(this,`rangeRef`,void 0),E(this,`subscribes`,void 0),E(this,`localStorage`,void 0),E(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(D(ve,{sx:{...X.row,...X.updatedRow,...X.rowInterpolated},hover:!0,children:[m(I,{}),m(I,{children:`...`}),this.state.ackVisible?m(I,{}):null,this.state.fromVisible?m(I,{}):null,this.state.lcVisible?m(I,{}):null]},a));else if(i.noData||i.noDataForPeriod)t.push(D(ve,{sx:{...X.row,...X.updatedRow,...X.rowNoData},hover:!0,children:[m(I,{}),m(I,{children:i.noData?this.props.t(`No data in history`):this.props.t(`No data in history for selected period`)}),this.state.ackVisible?m(I,{}):null,this.state.fromVisible?m(I,{}):null,this.state.lcVisible?m(I,{}):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(D(ve,{sx:{...X.row,...X.updatedRow,...n?X.rowInterpolated:void 0,...s?X.rowSelected:void 0},children:[D(I,{onClick:e=>!n&&this.onToggleSelect(e,a,`ts`),children:[`${e.formatTimestamp(i.ts)}`,r&&this.state.lastSelectedColumn===`ts`?m(A,{component:`div`,sx:X.rowFocused}):``]}),D(I,{onClick:e=>!n&&this.onToggleSelect(e,a,`val`),children:[o+this.unit,r&&this.state.lastSelectedColumn===`val`?m(A,{component:`div`,sx:X.rowFocused}):``]}),this.state.ackVisible?D(I,{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`?m(A,{component:`div`,sx:X.rowFocused}):``]}):null,this.state.fromVisible?D(I,{onClick:e=>!n&&this.onToggleSelect(e,a,`from`),children:[i.from||``,r&&this.state.lastSelectedColumn===`from`?m(A,{component:`div`,sx:X.rowFocused}):``]}):null,this.state.lcVisible?D(I,{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`?m(A,{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 m(`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 m(`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)),m(Le,{style:X.container,children:D(c,{stickyHeader:!0,sx:X.table,initialWidths:e,minWidths:t,dblTitle:this.props.t(`ra_Double click to reset table layout`),children:[m(He,{children:D(ve,{children:[m(I,{style:X.colTs,children:this.props.t(`Timestamp`)}),m(I,{style:X.colValue,children:this.props.t(`Value`)}),this.state.ackVisible?m(I,{style:X.colAck,children:this.props.t(`Ack`)}):null,this.state.fromVisible?m(I,{style:X.colFrom,children:this.props.t(`From`)}):null,this.state.lcVisible?m(I,{style:X.colLastChange,children:this.props.t(`lc`)}):null]})}),m(Ee,{children:this.getTableRows()})]})})}return m(me,{})}renderDialogConfirm(){return D(a,{open:!!this.state.areYouSure,onClose:()=>this.setState({areYouSure:!1}),"aria-labelledby":`alert-dialog-title`,"aria-describedby":`alert-dialog-description`,children:[m(w,{id:`alert-dialog-title`}),D(C,{children:[m(te,{id:`alert-dialog-description`,children:this.props.t(`Are you sure?`)}),m(fe,{control:m(ue,{value:this.state.suppressMessage,onChange:()=>this.setState({suppressMessage:!0})}),label:this.props.t(`Suppress for 5 minutes`)})]}),D(Me,{children:[m(L,{variant:`contained`,onClick:()=>this.setState({areYouSure:!1,suppressMessage:this.state.suppressMessage&&Date.now()},()=>this.onDelete()),color:`primary`,autoFocus:!0,startIcon:m(p,{}),children:this.props.t(`Delete`)}),m(L,{variant:`contained`,onClick:()=>this.setState({areYouSure:!1}),color:`secondary`,startIcon:m(b,{}),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 D(a,{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:[m(w,{id:`edit-dialog-title`,children:this.state.updateOpened?this.props.t(`Update entry`):this.props.t(`Insert entry`)}),m(C,{children:D(`form`,{noValidate:!0,autoComplete:`off`,onSubmit:e=>e.preventDefault(),children:[typeof this.state.edit.val==`boolean`?m(fe,{control:m(ue,{checked:this.state.edit.val,onChange:e=>this.updateEdit(`val`,e.target.checked)}),label:this.props.t(`Value`)}):m(j,{variant:`standard`,label:this.props.t(`Value`),value:this.state.edit.val,onChange:e=>this.updateEdit(`val`,e.target.value)}),m(`br`,{}),m(fe,{control:m(ue,{checked:this.state.edit.ack,onChange:e=>this.updateEdit(`ack`,e.target.checked)}),label:this.props.t(`Acknowledged`)}),this.state.insertOpened?m(xe,{dateAdapter:ot,adapterLocale:So[this.props.lang],children:D(`div`,{style:X.toolbarTimeGrid,children:[m(`div`,{style:X.toolbarTimeLabel,children:this.props.t(`Time`)}),m(Qe,{sx:X.toolbarDate,value:(e=this.state.edit)==null?void 0:e.date,onChange:e=>e&&this.updateEdit(`date`,e)}),m(ce,{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)}),m(j,{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]})}),D(Me,{children:[m(L,{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`)}),m(L,{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 D(De,{children:[D(s,{variant:`standard`,style:X.selectHistoryControl,children:[m(v,{children:this.props.t(`History instance`)}),m(ze,{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=>m(M,{value:e.id,style:e.alive?void 0:X.notAliveInstance,children:e.id},e.id))})]}),D(s,{variant:`standard`,style:X.selectRelativeTime,children:[m(v,{children:this.props.t(`Relative`)}),D(ze,{variant:`standard`,ref:this.rangeRef,value:this.state.relativeRange,onChange:e=>this.setRelativeInterval(e.target.value),children:[m(M,{value:`absolute`,sx:X.customRange,children:this.props.t(`custom range`)},`custom`),m(M,{value:10,children:this.props.t(`last 10 minutes`)},`1`),m(M,{value:30,children:this.props.t(`last 30 minutes`)},`2`),m(M,{value:60,children:this.props.t(`last hour`)},`3`),m(M,{value:`day`,children:this.props.t(`this day`)},`4`),m(M,{value:1440,children:this.props.t(`last 24 hours`)},`5`),m(M,{value:`week`,children:this.props.t(`this week`)},`6`),m(M,{value:10080,children:this.props.t(`last week`)},`7`),m(M,{value:`2weeks`,children:this.props.t(`this 2 weeks`)},`8`),m(M,{value:20160,children:this.props.t(`last 2 weeks`)},`9`),m(M,{value:`month`,children:this.props.t(`this month`)},`10`),m(M,{value:43200,children:this.props.t(`last 30 days`)},`11`),m(M,{value:`year`,children:this.props.t(`this year`)},`12`),m(M,{value:`12months`,children:this.props.t(`last 12 months`)},`13`)]})]}),D(xe,{dateAdapter:ot,adapterLocale:So[this.props.lang],children:[D(`div`,{style:X.toolbarTimeGrid,children:[m(`div`,{style:{...X.toolbarTimeLabel,opacity:this.state.relativeRange===`absolute`?void 0:.5},children:this.props.t(`Start time`)}),m(Qe,{sx:X.toolbarDate,disabled:this.state.relativeRange!==`absolute`,value:new Date(this.state.start),onChange:e=>e&&this.setStartDate(e)}),m(ce,{disabled:this.state.relativeRange!==`absolute`,sx:X.toolbarTime,ampm:this.state.ampm,value:new Date(this.state.start),onChange:e=>e&&this.setStartDate(e)})]}),D(`div`,{style:X.toolbarTimeGrid,children:[m(`div`,{style:{...X.toolbarTimeLabel,opacity:this.state.relativeRange===`absolute`?void 0:.5},children:this.props.t(`End time`)}),m(Qe,{disabled:this.state.relativeRange!==`absolute`,sx:X.toolbarDate,value:new Date(this.state.end),onChange:e=>e&&this.setEndDate(e)}),m(ce,{disabled:this.state.relativeRange!==`absolute`,sx:X.toolbarTime,ampm:this.state.ampm,value:new Date(this.state.end),onChange:e=>e&&this.setEndDate(e)})]})]}),m(A,{component:`div`,sx:X.grow}),(t=this.state.values)!=null&&t.length?m(x,{size:`large`,onClick:()=>this.exportData(),title:this.props.t(`Save data as csv`),children:m($e,{})}):null,this.state.supportedFeatures.includes(`insert`)&&this.props.expertMode?m(x,{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:m(_,{})}):null,this.state.supportedFeatures.includes(`update`)&&this.props.expertMode?m(x,{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:m(be,{})}):null,this.state.supportedFeatures.includes(`delete`)&&this.props.expertMode?m(x,{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:m(p,{})}):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
10
|
`))}`),n.setAttribute(`download`,`${k.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?D(Pe,{style:X.paper,children:[this.state.loading?m(me,{}):m(`div`,{style:X.noLoadingProgress}),this.renderToolbar(),m(A,{component:`div`,sx:X.tableDiv,children:this.renderTable()}),this.renderDialogConfirm(),this.renderEditDialog()]}):m(me,{})}static formatTimestamp(e){return`${new Date(e).toLocaleDateString()} ${new Date(e).toLocaleTimeString()}.${(e%1e3).toString().padStart(3,`0`)}`}},wo=hr();function To(e,t,n){wo(e)[t]=n}function Eo(e,t,n){var r=wo(e);r[t]===n&&(r[t]=null)}In({type:`takeGlobalCursor`,event:`globalCursorTaken`,update:`update`},Sr);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=ln(r),o=ln(n);return!((a.zlevel-o.zlevel||a.z-o.z)<=0)}function ko(e){return e}var Ao=`view`;(function(e){B(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]=sr(),o[1]=sr(),o[2]=sr(),a.mtRaw=On(),a.mtRawInv=On(),a.mtOverall=On(),a.mtOverallInv=On(),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 mn(ko(this).trans[1])},t.prototype.dataToPoint=function(e,t,n){var r=t?ko(this).mtRaw:ko(this).mtOverall;return n||=[],r?un(n,e,r):Tr(n,e)},t.prototype.pointToData=function(e,t,n){n||=[];var r=ko(this).mtOverallInv;return r?un(n,e,r):Tr(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 xn(jo,t.dataRect),on(jo,jo,t.mtOverall),fn(jo,e[0],e[1])},t.dimensions=[`x`,`y`],t})(Wt);var jo=Gr();function Mo(e,t){return Kt(e||[],ko(t).mtOverall)}function No(e,t){return xn(e||Gr(),ko(t).dataRect)}function Po(e,t){return xn(e||Gr(),ko(t).viewRect)}On(),On(),Gr(),On(),On();function Fo(e){var t=e.seriesModel;return t?t.coordinateSystem:null}sr(),sr();function Io(e,t,n,r,i,a){e||=0;var o=Ln(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(Ln(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]=Ln(u[0],l):u[1]=Ln(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]=Ln(t[r],c.sign*i)),d=Lo(t,r),a!=null&&d.span>a&&(t[1-r]=Ln(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:z.color.backgroundTint,fill:z.color.borderTint},transformable:!0,brushMode:`single`,removeOnClick:!1},Xo=0,Zo=function(e){B(t,e);function t(t){var n=e.call(this)||this;return n._track=[],n._covers=[],n._handlers={},n._zr=t,n.group=new Yt,n._uid=`brushController_`+Xo++,R(ks,function(e,t){this._handlers[t]=cn(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),R(this._handlers,function(e,n){t.on(n,e)}),this._brushType=e.brushType,this._brushOption=Kn(Nn(Yo),e,!0)},t.prototype._doDisableBrush=function(){var e=this._zr;Eo(e,Ko,this._uid),R(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={};R(e,function(e){t[e.panelId]=Nn(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=Fr(e,function(e){return Kn(Nn(Yo),e,!0)});var t=`\0-brush-index-`,n=this._covers,r=this._covers=[],i=this,a=this._creatingCover;return new Qn(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}(tn);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 R(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 R(t,function(t){e.group.remove(t)},e),t.length=0,!!n}function ss(e,t){var n=Fr(e._covers,function(e){var t=e.__brushOption,n=Nn(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 Yt;return i.add(new or({name:`main`,style:ms(n),silent:!0,draggable:!0,cursor:`move`,drift:Fn(ys,e,t,i,[`n`,`s`,`w`,`e`]),ondragend:Fn(ss,t,{isEnd:!0})})),R(r,function(n){i.add(new or({name:n.join(``),style:{opacity:0},draggable:!0,silent:!0,invisible:!0,drift:Fn(ys,e,t,i,n),ondragend:Fn(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`}),R([[`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 yn({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 en(e.group)}function _s(e,t){return{left:`w`,right:`e`,top:`n`,bottom:`s`}[sn({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);R(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);R(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):Nn(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=Nn(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 Yt;return n.add(new Pn({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 vn({name:`main`,draggable:!0,drift:Fn(bs,e,t),ondragend:Fn(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 En(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 $t.create(e)}var Rs=[`x`,`y`,`radius`,`angle`,`single`],zs=hr(),Bs=[`cartesian2d`,`polar`,`singleAxis`];function Vs(e){var t=e.get(`coordinateSystem`);return Dr(Bs,t)>=0}function Hs(e){return e+`Axis`}function Us(e,t){var n=Mn(),r=[],i=Mn();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(Sn(e));return t.axisProxyMap||=Mn()}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){B(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);Kn(this.option,e,!0),Kn(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;R([[`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=Mn();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 R(Rs,function(n){var r=this.getReferringComponents(Hs(n),Bn);if(r.specified){t=!0;var i=new Js;R(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`,br).models[0];o&&R(t,function(e){i.componentIndex!==e.componentIndex&&o===e.getReferringComponents(`grid`,br).models[0]&&a.add(e.componentIndex)})}}}r&&R(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`);R([[`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){R(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;R([[`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;R([`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}(hn);function Xs(e){var t={};return R([`start`,`end`,`startValue`,`endValue`,`throttle`],function(n){e.hasOwnProperty(n)&&(t[n]=e[n])}),t}var Zs=function(e){B(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){B(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){B(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}(qt)),$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 Nn(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,br).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 Nn(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];R([`start`,`end`],function(n,u){var d=e[n],f=e[n+`Value`];i[u]===`percent`?(d??=a[u],f=Hn(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=Hn(f,t,a)),s[u]=f==null||isNaN(f)?t[u]:f,o[u]=d==null||isNaN(d)?a[u]:d}),Lr(s),Lr(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]=Hn(e[o],n,r,!0),i&&(t[o]=t[o],l[o]=!0);fr(t)}var f=xr(r)||pr(r),p=n.getExtent(),m=Vr(p[1]-p[0]),h=f?0:Ur(s,m,.5);R([[0,Cn],[1,Jt]],function(e){var n=e[0],r=e[1];l[n]&&isFinite(h)&&(s[n]=Zt(s[n],h),s[n]=Tn(t[1],zr(t[0],s[n])),o[n]===a[n]&&(s[n]=t[n],f&&(s[n]=r(s[n]))))}),fr(s);var g=[Hn(s[0],t,a,!0),Hn(s[1],t,a,!0)];return fr(g),{value:s,percent:o,percentInverted:g,valuePrecision:h}},e.prototype.reset=function(e,t){if(this.hostedBy(e)){var n=this.getAxisModel().axis;Gn(n,2);var r=n.scale.rawExtentInfo;this._extent=r.makeNoZoom(),this._updateMinMaxSpan();var i=e.settledOption;t&&(i=yn({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;R(r,function(e){var t=e.getData(),r=t.mapDimensionsAll(n);if(r.length){if(i===`weakFilter`){var s=t.getStore(),c=Fr(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 R(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)}});R(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;R([`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=Hn(i,[0,100],n,!0)-n[0]):i=Hn(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=Mn();return R(n,function(e){R(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)}),R(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);R(n,function(t){t.setRawRange({start:e.start,end:e.end,startValue:e.startValue,endValue:e.endValue})})})}var nc=Cr();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){B(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=Jn({},a),i.feature={}),e.prototype.init.call(this,t,n,r),a&&(i.feature=a)},t.prototype.optionUpdated=function(){R(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]&&(Kn(e,n[t]),n[t]=null),Kn(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:z.color.border,borderRadius:0,borderWidth:0,padding:z.size.m,itemSize:15,itemGap:z.size.s,showTitle:!0,iconStyle:{borderColor:z.color.accent50,color:`none`},emphasis:{iconStyle:{borderColor:z.color.accent70}},tooltip:{show:!1,position:`bottom`}},t}(hn),uc=function(e){B(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||=Mn(),l=[];R(s,function(e,t){l.push(t)}),new Qn(this._featureNames||[],l).add(u).update(u).remove(Fn(u,null)).execute(),this._featureNames=Mr(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 bn(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=an(`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`?Yn:Nr)(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;dr(d)?(p={},p[c]=d):p=d,dr(f)?(m={},m[c]=f):m=f;var h=r.iconPaths={};R(p,function(c,d){var f=kn(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 Or({style:{text:m[d],align:u.get(`textAlign`),borderRadius:u.get(`textBorderRadius`),padding:u.get(`textPadding`),fill:null,font:Gt({fontStyle:u.get(`textFontStyle`),fontFamily:u.get(`textFontFamily`),fontSize:u.get(`textFontSize`),fontWeight:u.get(`textFontWeight`)},t)},ignore:!0});f.setTextContent(g),wr({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||z.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`?Yn:Nr)(f),i.add(f),f.on(`click`,cn(s.onclick,s,t,n,d)),h[d]=f})}var f=Ut(e,n).refContainer,p=e.getBoxLayoutParams(),m=e.get(`padding`),h=pn(p,f,m);cr(e.get(`orient`),i,e.get(`itemGap`),h.width,h.height),_n(i,p,f,m),i.add(Er(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&&!yr(c)&&t){var l=c.style||={},u=gn(t,Or.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){R(this._features,function(e){e&&e instanceof ac&&e.updateView&&e.updateView(e.model,t,n,r)})},t.prototype.dispose=function(e,t){R(this._features,function(n){n&&n instanceof ac&&n.dispose&&n.dispose(e,t)})},t.type=`toolbox`,t}(qt);function dc(e){return e.indexOf(`my`)===0}function fc(e){return e instanceof ac}var pc=function(e){B(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`)||z.color.neutral00,connectedBackgroundColor:n.get(`connectedBackgroundColor`),excludeComponents:n.get(`excludeComponents`),pixelRatio:n.get(`pixelRatio`)}),s=nr.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`),x=`<body style="margin:0;"><img src="`+o+`" style="max-width:100%;" title="`+(b&&b[0]||``)+`" /></body>`,S=window.open();S.document.write(x),S.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:z.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){B(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 R(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:[]};R(hc,function(e){Dr(e,n)>=0&&R(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&&(yn(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,br).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=Kn({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 Kn({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 Kn({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`),Kn({id:t,stack:i?``:mc},r.get([`option`,`stack`])||{},!0)}};In({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=Rn(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 R(e,function(e,n){var r=e.categoryAxis,i=e.valueAxis.dim,a=[` `].concat(Fr(e.series,function(e){return e.name})),o=[r.model.getCategories()];R(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
11
|
`))}),t.join(`
|
|
12
12
|
|
|
@@ -24,7 +24,7 @@ Defaulting to 2020, but this will stop working in the future.`)),t.ecmaVersion=1
|
|
|
24
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
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=Fr(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
26
|
*`+vc+`
|
|
27
|
-
*`,`g`)),r={series:[]};return R(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){B(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`)||z.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(yr(l)){var f=l(t.getOption());dr(f)?s.innerHTML=f:zn(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}An(_,`click`,b),An(v,`click`,function(){if(u==null&&l!=null||u!=null&&l==null)b();else{var e;try{e=yr(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:z.color.background,textColor:z.color.primary,textareaColor:z.color.background,textareaBorderColor:z.color.border,buttonColor:z.color.accent50,buttonTextColor:z.color.neutral00}},t}(ac);function jc(e,t){return Fr(e,function(e,n){var r=t&&t[n];if(Wn(r)&&!ar(r)){(!Wn(e)||ar(e))&&(e={value:e});var i=r.name!=null&&e.name==null;return e=yn(e,r),i&&delete e.name,e}return e})}In({type:`changeDataView`,event:`dataViewChanged`,update:`prepareAndUpdate`},function(e,t){var n=[];R(e.newOption.series,function(e){var r=t.getSeriesByName(e.name)[0];if(!r)n.push(Jn({type:`scatter`},e));else{var i=r.get(`data`);n.push({name:e.name,data:jc(e.data,i)})}}),t.mergeOption(yn({series:n},e.newOption))});var Mc=R,Nc=hr();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){B(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);In({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);R(Wc,function(e,t){(!n||!n.include||Dr(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){R(e,function(e){var r=this.findTargetInfo(e,t);r&&r!==!0&&R(r.coordSyses,function(r){n(e,qc[e.brushType](1,r,e.range,!0).values,r,t)})},this)},e.prototype.setInputRanges=function(e,t){R(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 Fr(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&&Dr(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 er(e,t,{includeMainTypes:Bc})}var Wc={grid:function(e,t){var n=e.xAxisModels,r=e.yAxisModels,i=e.gridModels,a=Mn(),o={},s={};(n||r||i)&&(R(n,function(e){var t=e.axis.grid.model;a.set(t.id,t),o[t.id]=!0}),R(r,function(e){var t=e.axis.grid.model;a.set(t.id,t),s[t.id]=!0}),R(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=[];R(i.getCartesians(),function(e,t){(Dr(n,e.getAxis(`x`).model)>=0||Dr(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){R(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 on(t,t,Mo(null,e)),t}},qc={lineX:Fn(Jc,0),lineY:Fn(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=[qn(),qn()];return{values:Fr(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(Fr([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:Fn(Xc,0),lineY:Fn(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 Fr(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=R,el=rr(`toolbox-dataZoom_`),tl={x:`width`,y:`height`},nl=function(e){B(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`,cn(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=Ur(d,i[tl[e]],.5);l&&(n[l.id]={dataZoomId:l.id,startValue:isFinite(f)?Zt(o[0],f):o[0],endValue:isFinite(f)?Zt(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(Nn(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:z.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)}Xt(`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=er(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),ur(ic)}var cl=function(e){B(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:z.size.m,backgroundColor:z.color.transparent,borderColor:z.color.primary,borderWidth:0,padding:5,itemGap:10,textStyle:{fontSize:18,fontWeight:`bold`,color:z.color.primary},subtextStyle:{fontSize:12,color:z.color.quaternary}},t}(hn),ll=function(e){B(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=mr(e.get(`textBaseline`),e.get(`textVerticalAlign`)),c=new Or({style:Wr(i,{text:e.get(`text`),fill:i.getTextColor()},{disableBox:!0}),z2:10}),l=c.getBoundingRect(),u=e.get(`subtext`),d=new Or({style:Wr(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(){Qt(f,`_`+e.get(`target`))}),p&&d.on(`click`,function(){Qt(p,`_`+e.get(`subtarget`))}),_r(c).eventData=_r(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 _=Ut(e,n),v=pn(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,x=e.getItemStyle([`color`,`opacity`]);x.fill=e.get(`backgroundColor`);var S=new or({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:x,subPixelOptimize:!0,silent:!0});r.add(S)}},t.type=`title`,t}(qt);function ul(e){e.registerComponentModel(cl),e.registerComponentView(ll)}var dl=function(e){B(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=[],R(t,function(e,t){var n=Ar(Ir(e),``),a;Wn(e)?(a=Nn(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 tr([{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:z.size.m,controlPosition:`left`,autoPlay:!1,rewind:!1,loop:!0,playInterval:2e3,currentIndex:0,itemStyle:{},label:{color:z.color.secondary},data:[]},t}(hn),fl=function(e){B(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=dn(dl.defaultOption,{backgroundColor:`rgba(0,0,0,0)`,borderColor:z.color.border,borderWidth:0,orient:`horizontal`,inverse:!1,tooltip:{trigger:`item`},symbol:`circle`,symbolSize:12,lineStyle:{show:!0,width:2,color:z.color.accent10},label:{position:`auto`,show:!0,interval:`auto`,rotate:0,color:z.color.tertiary},itemStyle:{color:z.color.accent20,borderWidth:0},checkpointStyle:{symbol:`circle`,symbolSize:15,color:z.color.accent50,borderColor:z.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:z.color.accent50,borderColor:z.color.accent50,borderWidth:0},emphasis:{label:{show:!0,color:z.color.accent60},itemStyle:{color:z.color.accent60,borderColor:z.color.accent60},controlStyle:{color:z.color.accent70,borderColor:z.color.accent70}},progress:{lineStyle:{color:z.color.accent30},itemStyle:{color:z.color.accent40}},data:[]}),t}(dl);Zn(fl,wn.prototype);var pl=function(e){B(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.type=`timeline`,t}(qt),ml=function(e){B(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}(Un),hl=Math.PI,gl=hr(),_l=function(e){B(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 Rr(`nameValue`,{noName:!0,value:t})},R([`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?`+`:`-`:dr(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),x=d&&u.get(`showPrevBtn`,!0),S=d&&u.get(`showNextBtn`,!0),ee=0,C=l;y===`left`||y===`bottom`?(b&&(g=[0,0],ee+=m),x&&(_=[ee,0],ee+=m),S&&(v=[C-f,0],C-=m)):(b&&(g=[C-f,0],C-=m),x&&(_=[0,0],ee+=m),S&&(v=[C-f,0],C-=m));var te=[ee,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=On(),o=i.x,s=i.y+i.height;Dn(a,a,[-o,-s]),rn(a,a,-hl/2),Dn(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||dr(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=Xn(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]),Pr(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 Yt;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 jn({shape:{x1:i[0],y1:0,x2:i[1],y2:0},style:Jn({lineCap:`round`},r.getModel(`lineStyle`).getLineStyle()),silent:!0,z2:1});t.add(a);var o=this._progressLine=new jn({shape:{x1:i[0],x2:this._currentPointer?this._currentPointer.x:i[0],y1:0,y2:0},style:yn({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=[],R(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:cn(i._changeTimeline,i,e.value)});d.ensureState(`emphasis`).style=l.getItemStyle(),d.ensureState(`progress`).style=u.getItemStyle(),Ht(d);var f=_r(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=[],R(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 Or({x:d,y:0,rotation:e.labelRotation-e.rotation,onclick:cn(i._changeTimeline,i,o),silent:!1,style:Wr(c,{text:r.formattedLabel,align:e.labelAlign,verticalAlign:e.labelBaseline})});f.ensureState(`emphasis`).style=Wr(l),f.ensureState(`progress`).style=Wr(u),t.add(f),Ht(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`,cn(this._changeTimeline,this,l?`-`:`+`)),u(e.prevBtnPosition,`prev`,cn(this._changeTimeline,this,l?`+`:`-`)),u(e.playPosition,c?`stop`:`play`,cn(this._handlePlayClick,this,!c),!0);function u(e,n,c,l){if(e){var u=lr(mr(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),Ht(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=cn(s._handlePointerDrag,s),e.ondragend=cn(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=Lr(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 nn(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 pn(e.getBoxLayoutParams(),Ut(e,t).refContainer,e.get(`padding`))}function yl(e,t,n,r){var i=r.style,a=kn(e.get([`controlStyle`,t]),r||{},new $t(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=Hr(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=Kn({rectHover:!0,z2:100},r,!0);var l=Br(e.get(`symbolSize`));r.scaleX=l[0]/2,r.scaleY=l[1]/2;var u=Vn(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)}),yn({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;ar(t)||(t=t?[t]:[]),R(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}R(e.data||[],function(e){Wn(e)&&!ar(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};R(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;d(),ur([Dl,sl,ul,gr,ir,vr,jr]);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 Ye{constructor(e){if(super(e),E(this,`echartsReact`,void 0),E(this,`rangeRef`,void 0),E(this,`readTimeout`,null),E(this,`chartValues`,void 0),E(this,`rangeValues`,void 0),E(this,`subscribes`,void 0),E(this,`unit`,void 0),E(this,`divRef`,void 0),E(this,`chart`,void 0),E(this,`timerResize`,null),E(this,`updateTimer`,null),E(this,`minY`,void 0),E(this,`maxY`,void 0),E(this,`timeTimer`,null),E(this,`maxYLenTimeout`,null),E(this,`mouseDown`,!1),E(this,`start`,void 0),E(this,`end`,void 0),E(this,`localStorage`,void 0),E(this,`onResize`,()=>{this.timerResize&&clearTimeout(this.timerResize),this.timerResize=setTimeout(()=>{this.timerResize=null,this.setState({windowWidth:window.innerWidth}),this.componentDidUpdate()})}),E(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,r=parseInt(this.localStorage.getItem(`App.absoluteEnd`)||``,10)||0;n&&r||t&&t!==`absolute`||(t=`30`),r&&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:r,maxYLen:0,stepType:``,echartsJump:!1},this.echartsReact=null,this.rangeRef=ae(),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=ae(),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?``:k.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?m($n,{ref:e=>{this.echartsReact=e},echarts:kr,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()}}):m(me,{}):m(`div`,{style:{marginTop:20,fontSize:24,marginLeft:24},children:this.props.t(`History instance not alive`)}):m(`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 D(De,{children:[!this.props.historyInstance&&D(s,{variant:`standard`,style:Z.selectHistoryControl,children:[m(v,{children:this.props.t(`History instance`)}),m(ze,{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=>m(M,{value:e.id,style:e.alive?void 0:Z.notAliveInstance,children:e.id},e.id))})]}),D(s,{variant:`standard`,style:Z.selectRelativeTime,children:[m(v,{children:this.props.t(`Relative`)}),D(ze,{variant:`standard`,ref:this.rangeRef,value:this.state.relativeRange,onChange:e=>this.setRelativeInterval(e.target.value),children:[m(M,{value:`absolute`,sx:Z.customRange,children:this.props.t(`custom range`)},`custom`),m(M,{value:10,children:this.props.t(`last 10 minutes`)},`1`),m(M,{value:30,children:this.props.t(`last 30 minutes`)},`2`),m(M,{value:60,children:this.props.t(`last hour`)},`3`),m(M,{value:`day`,children:this.props.t(`this day`)},`4`),m(M,{value:1440,children:this.props.t(`last 24 hours`)},`5`),m(M,{value:`week`,children:this.props.t(`this week`)},`6`),m(M,{value:10080,children:this.props.t(`last week`)},`7`),m(M,{value:`2weeks`,children:this.props.t(`this 2 weeks`)},`8`),m(M,{value:20160,children:this.props.t(`last 2 weeks`)},`9`),m(M,{value:`month`,children:this.props.t(`this month`)},`10`),m(M,{value:43200,children:this.props.t(`last 30 days`)},`11`),m(M,{value:`year`,children:this.props.t(`this year`)},`12`),m(M,{value:`12months`,children:this.props.t(`last 12 months`)},`13`)]})]}),D(xe,{dateAdapter:Dt,adapterLocale:So[this.props.lang],children:[D(`div`,{style:Z.toolbarTimeGrid,children:[m(`div`,{style:{...Z.toolbarTimeLabel,opacity:this.state.relativeRange===`absolute`?void 0:.5},children:this.props.t(`Start time`)}),m(Qe,{sx:Z.toolbarDate,disabled:this.state.relativeRange!==`absolute`,value:new Date(this.state.min),onChange:e=>e&&this.setStartDate(e)}),m(ce,{disabled:this.state.relativeRange!==`absolute`,sx:Z.toolbarTime,ampm:this.state.ampm,value:new Date(this.state.min),onChange:e=>e&&this.setStartDate(e)})]}),D(`div`,{style:Z.toolbarTimeGrid,children:[m(`div`,{style:{...Z.toolbarTimeLabel,opacity:this.state.relativeRange===`absolute`?void 0:.5},children:this.props.t(`End time`)}),m(Qe,{disabled:this.state.relativeRange!==`absolute`,sx:Z.toolbarDate,value:new Date(this.state.max),onChange:e=>e&&this.setEndDate(e)}),m(ce,{disabled:this.state.relativeRange!==`absolute`,sx:Z.toolbarTime,ampm:this.state.ampm,value:new Date(this.state.max),onChange:e=>e&&this.setEndDate(e)})]})]}),m(`div`,{style:Z.grow}),m(L,{style:{marginRight:10},variant:`outlined`,onClick:e=>this.setState({showStepMenu:e.target}),children:t?this.state.stepType===``?m(ut,{}):this.state.stepType===`stepStart`?m(lt,{}):this.state.stepType===`stepMiddle`?m(st,{}):this.state.stepType===`stepEnd`?m(rt,{}):this.props.t(`Step type`):this.state.stepType?this.props.t(this.state.stepType):this.props.t(`Step type`)}),this.state.showStepMenu?D(ye,{open:!0,anchorEl:this.state.showStepMenu,onClose:()=>this.setState({showStepMenu:null}),children:[m(M,{selected:this.state.stepType===``,onClick:()=>this.onStepChanged(``),children:t?m(ut,{}):this.props.t(`None`)}),m(M,{selected:this.state.stepType===`stepStart`,onClick:()=>this.onStepChanged(`stepStart`),children:t?m(lt,{}):this.props.t(`stepStart`)}),m(M,{selected:this.state.stepType===`stepMiddle`,onClick:()=>this.onStepChanged(`stepMiddle`),children:t?m(st,{}):this.props.t(`stepMiddle`)}),m(M,{selected:this.state.stepType===`stepEnd`,onClick:()=>this.onStepChanged(`stepEnd`),children:t?m(rt,{}):this.props.t(`stepEnd`)})]}):null,this.props.showJumpToEchart&&this.state.echartsJump&&m(se,{style:Z.echartsButton,size:`small`,onClick:()=>this.openEcharts(),title:this.props.t(`Open charts in new window`),children:m(`img`,{src:Ol,alt:`echarts`,style:Z.buttonIcon})}),D(se,{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:[m(S,{style:Z.splitLineButtonIcon}),this.props.t(`Show lines`)]})]})}render(){return!this.state.historyInstances&&!this.state.defaultHistory?m(me,{}):D(Pe,{style:Z.paper,children:[this.renderToolbar(),m(`div`,{ref:this.divRef,style:k.getStyle(this.props.theme,Z.chart,this.props.noToolbar?Z.chartWithoutToolbar:Z.chartWithToolbar),children:this.renderChart()})]})}};d();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 kt{constructor(e){super(e),E(this,`chartAvailable`,void 0),E(this,`saveFunc`,null),E(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=o.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:kt.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 m(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 m(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 m(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?m(qe,{title:T.t(`You have unsaved changes`),text:T.t(`Discard?`),ok:T.t(`Yes`),cancel:T.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?m(qe,{text:m(`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 D(a,{sx:{"&.MuiDialog-scrollPaper":Ml.dialog,"& .MuiDialog-paper":Ml.paper},scroll:`paper`,open:!0,onClose:()=>this.props.onClose(),onKeyDown:e=>Tt(e,this.onCtrlEnter),fullWidth:!0,maxWidth:`xl`,"aria-labelledby":`form-dialog-title`,children:[this.renderDialogConfirm(),this.renderWarningDialog(),m(w,{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])}),D(C,{style:Ml.content,children:[m(je,{position:`static`,children:D(Ke,{value:this.state.currentTab,onChange:(e,t)=>{o.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:[m(ie,{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?m(ie,{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?m(ie,{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?m(A,{component:`div`,sx:Ml.tabPanel,children:this.renderCustomEditor()}):null,this.props.objectIDs.length===1&&this.chartAvailable&&this.state.currentTab===1?m(A,{component:`div`,sx:Ml.tabPanel,children:this.renderTable()}):null,(t===`number`||t===`boolean`)&&this.props.objectIDs.length===1&&this.chartAvailable&&this.state.currentTab===2?m(A,{component:`div`,sx:Ml.tabPanel,children:this.renderCharts()}):null]}),D(Me,{children:[this.state.currentTab===0&&m(L,{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(m(f,{}),this.props.t(`Save`))}),this.state.currentTab===0&&m(P,{title:this.props.t(`Press CTRL+ENTER to confirm`),children:m(`span`,{children:m(L,{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(m(f,{}),this.props.t(`Save & close`),m(b,{}))})})}),m(L,{id:`object-custom-dialog-close`,disabled:this.state.progressRunning,variant:`contained`,onClick:()=>this.onClose(),color:`grey`,children:this.getButtonTitle(m(b,{}),this.props.t(`Close`))})]})]})}};d();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 Ye{static hasStatesOptions(e){return!!e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length>0}constructor(t){super(t),E(this,`propsValue`,void 0),E(this,`chartFrom`,void 0),E(this,`ack`,void 0),E(this,`inputRef`,Ve.createRef()),E(this,`q`,void 0),E(this,`expire`,void 0),E(this,`writePending`,!1),E(this,`onCtrlEnter`,()=>{this.state.valid&&this.onUpdate()});let n=r(),i=e.hasStatesOptions(this.props.states),a=n.prepareEditor(this.props.object,this.props.value),o=i?`states`:a.editorType,s=a.value;this.propsValue=s,o===`json`&&typeof s!=`string`?(s=JSON.stringify(s??null,null,2),this.propsValue=s):(o===`number`&&s==null||o===`string`&&s==null)&&(s=``),this.state={type:o,chart:!1,chartEnabled:(window._localStorage||window.localStorage).getItem(`App.chartSetValue`)!==`false`,fullScreen:(window._localStorage||window.localStorage).getItem(`App.fullScreen`)===`true`,targetValue:s,valid:!0,jsonError:!1,writing:!1},this.ack=!1,this.q=0,this.expire=0,this.inputRef=Ve.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=r(),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 D(xe,{adapterLocale:So[this.props.lang],dateAdapter:Dt,children:[m(Qe,{value:new Date(Number(this.state.targetValue)),onChange:e=>{e&&this.setState({targetValue:Math.round(e.getTime())})}}),m(ce,{value:new Date(Number(this.state.targetValue)),views:[`hours`,`minutes`,`seconds`],onChange:e=>{e&&this.setState({targetValue:Math.round(e.getTime())})}})]})}renderChart(){return m(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 m(Ot,{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 m(we,{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=>m(j,{...e,label:this.props.t(`Value`),variant:`standard`})})}return D(s,{variant:`standard`,style:Fl.formControl,children:[m(v,{children:this.props.t(`Value`)}),m(ze,{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 m(M,{value:e,children:(n=this.props.states)==null?void 0:n[e]},t)})})]})}render(){var t,n,r,i;let o=e.hasStatesOptions(this.props.states),c=D(`div`,{style:{display:`flex`,alignItems:`center`},children:[m(fe,{style:{...Fl.formControl,...this.props.expertMode?void 0:Fl.ackCheckbox},control:m(ue,{defaultChecked:!1,onChange:e=>this.ack=e.target.checked}),label:this.props.t(`Acknowledged`)}),m(P,{title:this.props.t(`Acknowledged explanation`),slotProps:{popper:{sx:Fl.tooltip}},children:m(Te,{color:`primary`})})]});return D(a,{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=>Tt(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:[D(w,{id:`edit-value-dialog-title`,children:[this.props.t(`Write value`),((t=this.props.object.common)==null?void 0:t.write)===!1?D(`span`,{style:Fl.readOnlyText,children:[`(`,this.props.t(`read only`),`)`]}):null,this.state.chart?m(se,{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:m(Ze,{})}):null,this.state.type===`json`?m(x,{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?m(nt,{}):m(tt,{})}):null]}),m(C,{children:m(`form`,{noValidate:!0,autoComplete:`off`,onSubmit:e=>e.preventDefault(),style:{...Fl.dialogForm,height:`100%`},children:D(O,{container:!0,direction:`row`,spacing:2,style:{height:`100%`},children:[m(O,{size:{xs:12,md:this.state.chart&&this.state.chartEnabled?6:12},style:{height:`100%`},children:D(O,{container:!0,spacing:2,style:{marginTop:0,height:`100%`},sx:{flexDirection:`column`},children:[this.props.expertMode?m(O,{children:D(O,{container:!0,direction:`row`,spacing:2,style:{marginTop:0},children:[this.props.expertMode?m(O,{children:D(s,{style:Fl.formControl,children:[m(v,{style:{marginTop:10,marginLeft:-14},children:this.props.t(`Value type`)}),D(ze,{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:[m(M,{value:`string`,children:`String`}),m(M,{value:`number`,children:`Number`}),m(M,{value:`boolean`,children:`Boolean`}),m(M,{value:`json`,children:`JSON/Object`}),o?m(M,{value:`states`,children:`States`}):null]})]})}):null,this.state.type===`json`?m(O,{sx:{flex:1}}):null]})}):null,m(O,{sx:{flex:this.state.type===`json`&&this.state.fullScreen?1:void 0},style:{paddingTop:0},children:this.state.type===`boolean`?m(Fe,{component:`div`,style:this.props.expertMode?{marginTop:20,width:`100%`,backgroundColor:this.props.themeType===`dark`?`#595959`:`#dadada`,borderRadius:5,padding:5}:void 0,children:D(O,{component:`label`,container:!0,spacing:1,sx:{alignItems:`center`},children:[D(O,{style:{marginRight:10},children:[this.props.t(`Value`),`:`]}),m(O,{children:`FALSE`}),m(O,{children:m(he,{autoFocus:!0,checked:e.parseBoolean(this.state.targetValue),onKeyUp:e=>e.key===`Enter`&&this.onUpdate(e),onChange:e=>this.setState({targetValue:e.target.checked})})}),m(O,{children:`TRUE`})]})}):this.state.type===`number`?m(j,{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():m(j,{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`?m(O,{style:{display:`flex`,gap:`5px`},size:{xs:6},children:this.renderTimePicker()}):null,this.props.expertMode?m(O,{children:c}):null,this.props.expertMode?D(O,{children:[D(s,{variant:`standard`,style:Fl.quality,children:[m(v,{children:this.props.t(`Quality`)}),D(ze,{variant:`standard`,defaultValue:0,onChange:e=>this.q=Number(e.target.value),children:[m(M,{value:0,children:`0x00 - good`}),m(M,{value:1,children:`0x01 - general problem`}),m(M,{value:2,children:`0x02 - no connection problem`}),m(M,{value:16,children:`0x10 - substitute value from controller`}),m(M,{value:32,children:`0x20 - substitute initial value`}),m(M,{value:64,children:`0x40 - substitute value from device or instance`}),m(M,{value:128,children:`0x80 - substitute value from sensor`}),m(M,{value:17,children:`0x11 - general problem by instance`}),m(M,{value:65,children:`0x41 - general problem by device`}),m(M,{value:129,children:`0x81 - general problem by sensor`}),m(M,{value:18,children:`0x12 - instance not connected`}),m(M,{value:66,children:`0x42 - device not connected`}),m(M,{value:130,children:`0x82 - sensor not connected`}),m(M,{value:68,children:`0x44 - device reports error`}),m(M,{value:132,children:`0x84 - sensor reports error`})]})]}),m(j,{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`?m(O,{size:{xs:12,md:6},style:{minHeight:300},sx:{display:{xs:`none`,md:`inline-block`}},children:this.renderChart()}):null]})})}),D(Me,{sx:Fl.wrapperButton,children:[this.props.expertMode?null:c,this.props.expertMode?null:m(`div`,{style:{flexGrow:1}}),m(L,{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:m(pe,{}),style:((i=this.props.object.common)==null?void 0:i.write)===!1?Fl.readOnly:void 0,children:this.props.width===`xs`?m(pe,{fontSize:`large`}):this.state.writing?this.props.t(`Please wait...`):this.props.t(`Set value`)}),m(L,{variant:`contained`,disabled:this.state.writing,onClick:()=>{this.writePending||this.props.onClose()},color:`grey`,startIcon:this.props.width===`xs`?void 0:m(b,{}),children:this.props.width===`xs`?m(b,{fontSize:`large`}):this.props.t(`Cancel`)})]})]})}};Bt(),Pt(),jt(),Rt(),It(),At(),Nt(),Lt(),Ft(),zt(),d();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 Ye{constructor(e){super(e),E(this,`originalObj`,void 0),E(this,`subscribed`,!1),E(this,`updateTimer`,null),E(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}))}),E(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()}),E(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=o.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,s=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(s),tab:n,showCopyDialog:``,showCommonDeleteMessage:!1,selectId:!1,selectRead:!1,selectWrite:!1,newId:``,lang:T.getLanguage(),value:void 0},Mt.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 ge(n[e[t]],this.props.socket);if(i.key=e[t],i&&typeof i==`object`&&r.push(i),i.icon)try{let e=Oe(i.icon);if(e.type!==`base64`&&e.type!==`http`){let t=await ge(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()&&o.getLocation().arg!==this.state.tab&&o.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?Ie(JSON.parse(e),t.split(`.`)):JSON.parse(e)}static setPartOfObject(e,t,n){let r=JSON.parse(e);return r===void 0?e:(r=ke(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)}`),m(`div`,{children:T.t(`Cannot get data for %s: %s`,n.path,e)})}return r?m(ee,{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:wt}):m(`div`,{children:T.t(`Cannot get data for %s`,n.path)})}renderCustomTab(e,t){var n;let r;if(!t||!Ie(t,(n=e.path)==null?void 0:n.split(`.`)))return null;e.color&&(r={backgroundColor:e.color,color:k.invertColor(e.color||``,!0)});let i=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 m(ie,{disabled:this.state.error||this.state.customError,value:e.key,label:i,style:r,iconPosition:`start`,icon:e.icon?m(Se,{src:e.icon,style:Q.funcIcon}):void 0})}renderStateTab(){return this.props.obj.type!==`state`||this.props.obj.common.type===`file`?null:m(ie,{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 m(`div`,{children:this.props.t(`State does not exist`)});if(typeof this.state.value!=`object`)return D(`div`,{style:{maxWidth:700},children:[m(`div`,{children:this.props.t(`State is invalid`)}),m(`div`,{children:m(`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(k.isStringInteger(i))n=new Date(parseInt(i,10)).toString();else try{let e=new Date(i);k.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?T.t(`true`):T.t(`false`),r.color=i?`#139800`:`#cd6b55`):n=a===`object`?JSON.stringify(i):a===`string`&&i.startsWith(`data:image/`)?m(`img`,{src:i,alt:`img`,style:Q.stateImage}):i==null?void 0:i.toString()),Object.assign(r,Ll(this.props.theme,r.color)),D(A,{style:{...Q.divWithoutTitle,padding:`24px 24px 0 24px`,fontSize:16,maxWidth:400},sx:{"& .value-line:hover":{backgroundColor:`#00000030`}},children:[D(`div`,{className:`value-line`,style:{...Q.stateRow,marginBottom:24},children:[D(`div`,{style:Q.stateTitle,children:[T.t(`ra_tooltip_value`),`:`]}),D(A,{component:`div`,sx:r,style:Q.stateValue,children:[n,(t=this.props.obj.common)!=null&&t.unit?m(`span`,{style:Q.stateUnit,children:this.props.obj.common.unit}):null]},typeof n==`string`?n:`image`)]}),D(`div`,{style:Q.stateRow,className:`value-line`,children:[D(`div`,{style:Q.stateTitle,children:[T.t(`Type`),`:`]}),m(`div`,{style:Q.stateValue,children:a})]}),D(`div`,{style:Q.stateRow,className:`value-line`,children:[D(`div`,{style:Q.stateTitle,children:[T.t(`ra_tooltip_ts`),`:`]}),m(P,{title:new Date(this.state.value.ts).toLocaleString(),slotProps:{popper:{sx:Q.tooltip}},children:m(`div`,{style:Q.stateValue,children:m(`span`,{style:Q.stateTime,children:Mt(this.state.value.ts).fromNow()})})})]}),D(`div`,{style:Q.stateRow,className:`value-line`,children:[D(`div`,{style:Q.stateTitle,children:[T.t(`ra_tooltip_ack`),`:`]}),D(`div`,{style:{...Q.stateValue,color:this.state.value.ack?`green`:`red`},children:[this.state.value.ack?T.t(`Acknowledged`):T.t(`Command`),this.state.value.ack?` (true)`:` (false)`]})]}),D(`div`,{style:Q.stateRow,className:`value-line`,children:[D(`div`,{style:Q.stateTitle,children:[T.t(`ra_tooltip_lc`),`:`]}),m(P,{title:new Date(this.state.value.lc).toLocaleString(),slotProps:{popper:{sx:Q.tooltip}},children:m(`div`,{style:Q.stateValue,children:m(`span`,{style:Q.stateTime,children:Mt(this.state.value.lc).fromNow()})})})]}),D(`div`,{style:Q.stateRow,className:`value-line`,children:[D(`div`,{style:Q.stateTitle,children:[T.t(`ra_tooltip_quality`),`:`]}),m(`div`,{style:Q.stateValue,children:k.quality2text(this.state.value.q||0).join(`, `)})]}),D(`div`,{style:Q.stateRow,className:`value-line`,children:[D(`div`,{style:Q.stateTitle,children:[T.t(`ra_tooltip_from`),`:`]}),m(`div`,{style:Q.stateValue,children:this.state.value.from})]}),D(`div`,{style:Q.stateRow,className:`value-line`,children:[D(`div`,{style:Q.stateTitle,children:[T.t(`ra_tooltip_user`),`:`]}),m(`div`,{style:Q.stateValue,children:this.state.value.user||`--`})]}),this.state.value.expire?D(`div`,{style:Q.stateRow,className:`value-line`,children:[D(`div`,{style:Q.stateTitle,children:[T.t(`ra_tooltip_expire`),`:`]}),D(`div`,{style:Q.stateValue,children:[this.state.value.expire,` `,T.t(`sc_seconds`)]})]}):null,this.state.value.c?D(`div`,{style:Q.stateRow,className:`value-line`,children:[D(`div`,{style:Q.stateTitle,children:[T.t(`ra_tooltip_comment`),`:`]}),m(`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=o.getLocation();return e.tab===`tab-objects`&&e.dialog===`edit`&&e.id===this.props.obj._id}renderTabs(e){var t;return D(Ke,{style:Q.tabsPadding,value:this.state.tab,onChange:(e,t)=>{if((window._localStorage||window.localStorage).setItem(`${this.props.dialogName||`App`}.editTab`,t),this.isRouted()&&o.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:[m(ie,{value:`common`,disabled:this.state.customError||this.state.error,label:this.props.t(`common`)}),m(ie,{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`&&m(ie,{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 m(Ce,{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 m(`div`,{style:Q.marginBlock,children:m(L,{style:Q.buttonAdd,variant:`contained`,color:`secondary`,startIcon:m(l,{}),onClick:t,children:T.t(e)})})}buttonRemoveKey(e,t,n){let{t:r}=this.props;return m(P,{title:r(`Remove attribute %s`,r(e)),slotProps:{popper:{sx:Q.tooltip}},children:m(x,{size:`small`,sx:Q.removeButton,style:n,onClick:t,children:m(b,{})})})}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,c=e.filterRoles(this.props.roleArray,t.common.type),l;if(t.common.icon&&(l=t.type===`instance`||t.type===`adapter`?`./adapter/${t.common.name}/${t.common.icon}`:t.common.icon,!l.startsWith(`.`)&&!l.startsWith(`/`)&&!l.startsWith(`data:`))){let e=i._id.split(`.`);l=e[0]===`system`?`adapter/${e[2]}${l.startsWith(`/`)?``:`/`}${l}`:`adapter/${e[0]}${l.startsWith(`/`)?``:`/`}${l}`}let u=typeof t.common.desc==`object`&&t.common.desc?t.common.desc[T.getLanguage()]||t.common.desc.en||``:t.common.desc||``,d=k.getObjectNameFromObj(t,T.getLanguage(),{},!1,!0);return D(A,{style:Q.commonTabWrapper,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),e.stopPropagation(),this.onUpdate())},children:[D(A,{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`,``)):m(j,{variant:`standard`,disabled:!1,label:r(`Name`),style:{...Q.textField,marginTop:8},fullWidth:!0,slotProps:{input:{endAdornment:d?m(F,{position:`end`,children:m(P,{title:T.t(`Clear text`),slotProps:{popper:{sx:Q.tooltip}},children:m(x,{tabIndex:-1,size:`small`,onClick:()=>this.setCommonItem(t,`name`,``),children:m(b,{})})})}):null}},value:d,onChange:e=>this.setCommonItem(t,`name`,e.target.value)}),t.common.desc===void 0?e.buttonAddKey(`Description`,()=>this.setCommonItem(t,`desc`,``)):D(A,{component:`div`,sx:Q.flex,children:[m(j,{variant:`standard`,disabled:!1,label:r(`Description`),style:{...Q.textField,marginTop:8},fullWidth:!0,slotProps:{input:{endAdornment:u?m(F,{position:`end`,children:m(P,{title:T.t(`Clear text`),slotProps:{popper:{sx:Q.tooltip}},children:m(x,{tabIndex:-1,size:`small`,onClick:()=>this.setCommonItem(t,`desc`,``),children:m(b,{})})})}):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`)):D(A,{component:`div`,sx:Q.flex,children:[D(s,{style:Q.marginBlock,fullWidth:!0,children:[m(v,{style:{transform:`scale(0.75)`},children:r(`State type`)}),m(ze,{variant:`standard`,disabled:!1,value:t.common.type,onChange:e=>this.setCommonItem(t,`type`,e.target.value),children:n.map(e=>D(M,{value:e,children:[r(e),D(`span`,{style:Q.typeNameEng,children:[`(`,e,`)`]})]},e))})]}),this.buttonRemoveKey(`State type`,()=>this.removeCommonItem(t,`type`),{marginTop:33})]}):null,D(A,{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)):D(A,{component:`div`,sx:Q.flex,children:[m(fe,{style:Q.marginBlock,control:m(ue,{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)):D(A,{component:`div`,sx:Q.flex,children:[m(fe,{style:Q.marginBlock,control:m(ue,{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`,``)):D(A,{component:`div`,sx:Q.flex,children:[m(we,{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:c,renderInput:e=>m(j,{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`,``)):D(A,{component:`div`,sx:Q.flex,children:[m(j,{variant:`standard`,disabled:!1,style:{...Q.marginBlock,...Q.color},label:r(`Color`),type:`color`,slotProps:{input:{endAdornment:t.common.color?m(F,{position:`end`,children:m(P,{title:T.t(`Clear field`),slotProps:{popper:{sx:Q.tooltip}},children:m(x,{tabIndex:-1,size:`small`,onClick:()=>this.setCommonItem(t,`color`,``),children:m(b,{})})})}):null}},value:t.common.color,onChange:e=>this.setCommonItem(t,`color`,e.target.value)}),this.buttonRemoveKey(`Color`,()=>this.removeCommonItem(t,`color`))]}),D(A,{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?m(A,{component:`div`,sx:Q.flex,children:e.buttonAddKey(`Min`,()=>this.setCommonItem(t,`min`,0))}):D(A,{component:`div`,sx:Q.flex,children:[m(j,{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?m(A,{component:`div`,sx:Q.flex,children:e.buttonAddKey(`Max`,()=>this.setCommonItem(t,`max`,100))}):D(A,{component:`div`,sx:Q.flex,children:[m(j,{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?m(A,{component:`div`,sx:Q.flex,children:e.buttonAddKey(`Step`,()=>this.setCommonItem(t,`step`,1))}):D(A,{component:`div`,sx:Q.flex,children:[m(j,{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?m(`div`,{style:Q.flexDrop,children:e.buttonAddKey(`Unit`,()=>this.setCommonItem(t,`unit`,``))}):D(A,{component:`div`,sx:Q.flex,children:[m(j,{variant:`standard`,disabled:!1,className:{...Q.marginBlock,...Q.color},label:r(`Unit`),slotProps:{input:{endAdornment:t.common.unit?m(F,{position:`end`,children:m(P,{title:T.t(`Clear field`),slotProps:{popper:{sx:Q.tooltip}},children:m(x,{tabIndex:-1,size:`small`,onClick:()=>this.setCommonItem(t,`unit`,``),children:m(b,{})})})}):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?m(A,{component:`div`,sx:Q.flex,children:e.buttonAddKey(`Icon`,()=>this.setCommonItem(t,`icon`,``))}):D(A,{component:`div`,sx:Q.flex,style:{flexGrow:1,minWidth:158},children:[m(de,{disabled:!1,maxSize:10240,icon:l,removeIconFunc:()=>this.setCommonItem(t,`icon`,``),onChange:e=>this.setCommonItem(t,`icon`,e)}),this.buttonRemoveKey(`Icon`,()=>this.removeCommonItem(t,`icon`))]})]})}catch{return m(`div`,{children:this.props.t(`Cannot parse JSON!`)})}}renderAliasEdit(){try{var e,t,n,r,i,a,o,s,c,l,u,d,f,p,h,g,_,v;let y=JSON.parse(this.state.text),S=((e=y.common)==null||(e=e.alias)==null?void 0:e.read)!==void 0||((t=y.common)==null||(t=t.alias)==null?void 0:t.write)!==void 0;return D(O,{container:!0,style:Q.marginTop,sx:{flexDirection:`column`},children:[m(O,{children:m(fe,{control:m(ue,{checked:typeof((n=y.common)==null||(n=n.alias)==null?void 0:n.id)==`object`,onChange:()=>{var e;if(typeof((e=y.common)==null||(e=e.alias)==null?void 0:e.id)==`object`){var t;this.setAliasItem(y,`id`,((t=y.common)==null||(t=t.alias)==null||(t=t.id)==null?void 0:t.read)||``)}else{var n;this.setAliasItem(y,`id.read`,((n=y.common)==null||(n=n.alias)==null?void 0:n.id)||``)}}}),label:this.props.t(`Different IDs for read and write`)})}),typeof((r=y.common)==null||(r=r.alias)==null?void 0:r.id)==`object`?null:D(O,{children:[m(j,{variant:`standard`,label:this.props.t(`Alias state`),value:((i=y.common)==null||(i=i.alias)==null?void 0:i.id)||``,style:Q.aliasIdEdit,slotProps:{input:{endAdornment:(a=y.common)!=null&&(a=a.alias)!=null&&a.id?m(F,{position:`end`,children:m(P,{title:T.t(`Clear field`),slotProps:{popper:{sx:Q.tooltip}},children:m(x,{tabIndex:-1,size:`large`,onClick:()=>this.setAliasItem(y,`id`,``),children:m(b,{})})})}):null}},onChange:e=>this.setAliasItem(y,`id`,e.target.value),margin:`normal`}),m(se,{style:Q.button,size:`small`,onClick:()=>this.setState({selectId:!0,selectRead:!1,selectWrite:!1}),children:`...`})]}),typeof((o=y.common)==null||(o=o.alias)==null?void 0:o.id)==`object`?D(O,{children:[m(j,{variant:`standard`,label:this.props.t(`Alias read state`),value:((s=y.common)==null||(s=s.alias)==null||(s=s.id)==null?void 0:s.read)||``,style:Q.aliasIdEdit,slotProps:{input:{endAdornment:(c=y.common)!=null&&(c=c.alias)!=null&&(c=c.id)!=null&&c.read?m(F,{position:`end`,children:m(P,{title:T.t(`Clear field`),slotProps:{popper:{sx:Q.tooltip}},children:m(x,{size:`large`,tabIndex:-1,onClick:()=>this.setAliasItem(y,`id.read`,``),children:m(b,{})})})}):null}},onChange:e=>this.setAliasItem(y,`id.read`,e.target.value),margin:`normal`}),m(se,{style:Q.button,size:`small`,onClick:()=>this.setState({selectId:!1,selectRead:!0,selectWrite:!1}),children:`...`})]}):null,typeof((l=y.common)==null||(l=l.alias)==null?void 0:l.id)==`object`?D(O,{children:[m(j,{variant:`standard`,label:this.props.t(`Alias write state`),value:((u=y.common)==null||(u=u.alias)==null||(u=u.id)==null?void 0:u.write)||``,style:Q.aliasIdEdit,slotProps:{input:{endAdornment:(d=y.common)!=null&&(d=d.alias)!=null&&(d=d.id)!=null&&d.write?m(F,{position:`end`,children:m(P,{title:T.t(`Clear field`),slotProps:{popper:{sx:Q.tooltip}},children:m(x,{size:`large`,tabIndex:-1,onClick:()=>this.setAliasItem(y,`id.write`,``),children:m(b,{})})})}):null}},onChange:e=>this.setAliasItem(y,`id.write`,e.target.value),margin:`normal`}),m(se,{style:Q.button,size:`small`,onClick:()=>this.setState({selectId:!1,selectRead:!1,selectWrite:!0}),children:`...`})]}):null,m(O,{style:Q.marginTop,children:m(fe,{control:m(ue,{checked:((f=y.common)==null||(f=f.alias)==null?void 0:f.read)!==void 0||((p=y.common)==null||(p=p.alias)==null?void 0:p.write)!==void 0,onChange:()=>{S?(delete y.common.alias.read,delete y.common.alias.write):(y.common=y.common||{},y.common.alias=y.common.alias||{},y.common.alias.read=`val`,y.common.alias.write=`val`),this.onChange(JSON.stringify(y,null,2))}}),label:this.props.t(`Use convert functions`)})}),S?m(O,{children:m(j,{variant:`standard`,label:this.props.t(`Read converter`),value:((h=y.common)==null||(h=h.alias)==null?void 0:h.read)||`val`,style:Q.funcEdit,error:!!this.state.readError,slotProps:{input:{endAdornment:(g=y.common)!=null&&(g=g.alias)!=null&&g.read?m(F,{position:`end`,children:m(P,{title:T.t(`Clear field`),slotProps:{popper:{sx:Q.tooltip}},children:m(x,{size:`large`,tabIndex:-1,onClick:()=>this.setAliasItem(y,`read`,``),children:m(b,{})})})}):null,startAdornment:m(F,{position:`start`,children:m(Ue,{style:Q.funcIcon})})}},onChange:e=>this.setAliasItem(y,`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?m(O,{children:m(j,{variant:`standard`,label:this.props.t(`Write converter`),error:!!this.state.writeError,value:((_=y.common)==null||(_=_.alias)==null?void 0:_.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:(v=y.common)!=null&&(v=v.alias)!=null&&v.write?m(F,{position:`end`,children:m(P,{title:T.t(`Clear field`),slotProps:{popper:{sx:Q.tooltip}},children:m(x,{size:`large`,tabIndex:-1,onClick:()=>this.setAliasItem(y,`write`,``),children:m(b,{})})})}):null,startAdornment:m(F,{position:`start`,children:m(Ue,{style:Q.funcIcon})})}},onChange:e=>this.setAliasItem(y,`write`,e.target.value),margin:`normal`})}):null]})}catch{return m(`div`,{children:this.props.t(`Cannot parse JSON!`)})}}onCopy(e){k.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?D(a,{open:!0,maxWidth:`md`,fullWidth:!0,onClose:()=>this.setState({showCopyDialog:``}),onKeyDown:e=>Tt(e,()=>{this.props.objects[this.state.newId]||(this.setState({showCopyDialog:``}),this.onClone(this.state.showCopyDialog,this.state.newId))}),children:[m(w,{children:this.props.t(`Enter new ID for this object`)}),m(C,{children:m(j,{variant:`standard`,autoFocus:!0,fullWidth:!0,label:this.props.t(`New object ID`),value:this.state.newId,slotProps:{input:{endAdornment:this.state.newId?m(F,{position:`end`,children:m(P,{title:T.t(`Clear field`),slotProps:{popper:{sx:Q.tooltip}},children:m(x,{size:`small`,tabIndex:-1,onClick:()=>this.setState({newId:``}),children:m(b,{})})})}):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})})}),D(Me,{children:[m(L,{disabled:!!this.props.objects[this.state.newId],onClick:()=>{this.setState({showCopyDialog:``}),this.onClone(this.state.showCopyDialog,this.state.newId)},color:`primary`,startIcon:m(ct,{}),children:this.props.t(`Clone`)}),m(L,{color:`grey`,onClick:()=>this.setState({showCopyDialog:``}),startIcon:m(b,{}),children:this.props.t(`Cancel`)})]})]}):null}renderPanelObject(e){return D(`div`,{style:{...Q.divWithoutTitle,...e?Q.divWithoutTitleAndTab:void 0,...this.state.error?Q.error:void 0},children:[m(Ot,{value:this.state.text,onChange:e=>this.onChange(e),onCtrlEnter:this.onCtrlEnter,name:`UNIQUE_ID_OF_DIV`,themeType:this.props.themeType}),this.state.showCommonDeleteMessage?m(`div`,{style:Q.commonDeleteTip,children:T.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 D(a,{sx:{"& .MuiPaper-root":n},open:!0,maxWidth:`xl`,fullWidth:!0,fullScreen:!1,onClose:()=>this.props.onClose(),onKeyDown:e=>Tt(e,this.onCtrlEnter),"aria-labelledby":`edit-value-dialog-title`,"aria-describedby":`edit-value-dialog-description`,children:[D(w,{id:`edit-value-dialog-title`,style:{width:`calc(100% - 32px)`,overflow:`hidden`,textOverflow:`ellipsis`},children:[this.props.t(`Edit object:`),` `,m(A,{component:`span`,style:Q.id,sx:{fontSize:{xs:10}},children:this.props.obj._id})]}),this.renderTabs(r),this.renderCopyDialog(),D(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()]}),D(Me,{sx:Q.wrapperButton,children:[m(L,{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:m(ct,{fontSize:this.props.width===`xs`?`large`:void 0})}),m(`div`,{style:{flexGrow:1}}),this.state.tab===`object`&&m(L,{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:m(oe,{}),children:this.props.width===`xs`?m(oe,{fontSize:32}):this.props.t(`Copy into clipboard`)}),m(P,{title:this.props.t(`Press CTRL+ENTER to confirm`),slotProps:{popper:{sx:Q.tooltip}},children:m(`span`,{children:m(L,{variant:`contained`,disabled:this.state.error||!this.state.changed||this.state.customError,onClick:()=>this.onUpdate(),startIcon:this.props.width===`xs`?void 0:m(pe,{}),color:`primary`,children:this.props.width===`xs`?m(pe,{fontSize:`large`}):this.props.t(`Write`)})})}),m(L,{color:`grey`,variant:`contained`,onClick:()=>this.props.onClose(),startIcon:this.props.width===`xs`?void 0:m(b,{}),children:this.props.width===`xs`?m(b,{fontSize:`large`}):this.props.t(`Cancel`)})]})]})}};d();var Bl=class e extends Ye{constructor(e){super(e),E(this,`object`,null),E(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 D(a,{open:!0,maxWidth:`sm`,fullWidth:!0,onClose:()=>this.props.onClose(),onKeyDown:e=>Tt(e,this.onCtrlEnter),"aria-labelledby":`edit-role-dialog-title`,"aria-describedby":`edit-role-dialog-description`,children:[m(w,{id:`edit-role-dialog-title`,children:this.object?this.props.t(`Update role for %s`,this.object._id):null}),m(C,{children:m(we,{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=>m(j,{variant:`standard`,...e,label:this.props.t(`Role`)})})}),D(Me,{children:[m(P,{title:this.props.t(`Press CTRL+ENTER to confirm`),children:m(`span`,{children:m(L,{disabled:this.state.initRole===this.state.roleInput,variant:`contained`,onClick:()=>this.onUpdate(),color:`primary`,startIcon:m(pe,{}),children:this.props.t(`Apply`)})})}),m(L,{variant:`contained`,onClick:()=>this.props.onClose(),color:`grey`,startIcon:m(b,{}),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:o,initialType:c,initialStateType:l})=>{var u;let d={state:T.t(`New state`),channel:T.t(`New channel`),device:T.t(`New device`),folder:T.t(`New folder`)},f=[],p=(u=i[n])==null?void 0:u.type;i[n]?p===`channel`?(f.push(Ul.state),c||=`state`):p===`device`?(c||=`channel`,f.push(Ul.state),f.push(Ul.channel)):p===`state`?c||=``:(f.push(Ul.state),f.push(Ul.channel),f.push(Ul.device),n.startsWith(`0_userdata.`)||n.startsWith(`alias.0.`)||n===`0_userdata`||n===`alias.0`?(f.push(Ul.folder),c||=`folder`):c||=`state`):(f.push(Ul.folder),c||=`folder`,o&&(n.startsWith(`mqtt.`)||n.startsWith(`javascript.`))&&(f.push(Ul.state),f.push(Ul.channel),f.push(Ul.device)));let h=(window._localStorage||window.localStorage).getItem(`App.lastObjectType`);h&&f.find(e=>e.value===h)&&(c=h);function g(e){return`${n}.${e.toString().replace(k.FORBIDDEN_CHARS,`_`).replace(/\s/g,`_`).replace(/\./g,`_`)}`}let[_,y]=N(c),[S,ee]=N(d[c]),[te,ne]=N(l||(window._localStorage||window.localStorage).getItem(`App.lastStateType`)||`string`),[re,ie]=N(!i[g(d.state)]),ae=()=>{let e={common:{name:S,desc:T.t(`Manually created`)},type:_};_===`state`?(e.common={...e.common,role:`state`,type:te,read:!0,write:!0,def:Hl[te]},e.native={}):_===`folder`?delete e.common.desc:e.common={...e.common,role:``,icon:``},r(`${n}.${S.split(` `).join(`_`)}`,e).then(()=>t())},oe=T.getLanguage(),se=!S||!_||!re||_===`state`&&!te;return D(a,{open:!0,fullWidth:!0,maxWidth:`md`,onClose:e,onKeyDown:e=>Tt(e,()=>{se||ae()}),children:[m(w,{children:D(`div`,{style:{margin:10,fontSize:20,display:`flex`,alignItems:`center`,gap:8},children:[m(ot,{}),T.t(`Add new object:`),D(`span`,{style:{fontStyle:`italic`},children:[n,`.`,S]})]})}),m(C,{children:D(`div`,{style:{display:`flex`,flexDirection:`column`},children:[m(j,{variant:`standard`,label:T.t(`Parent`),style:{margin:`5px 0`},disabled:!0,value:n}),D(s,{variant:`standard`,style:{marginTop:10,marginBottom:16},children:[m(v,{children:T.t(`Type`)}),m(ze,{variant:`standard`,value:_,onChange:e=>{(window._localStorage||window.localStorage).setItem(`App.lastObjectType`,e.target.value),S===d[_]&&(ee(d[e.target.value]),ie(!!i[g(d[e.target.value])])),y(e.target.value)},children:f.map(e=>D(M,{value:e.value,children:[T.t(e.name),oe!==`en`&&D(`span`,{style:{fontSize:`smaller`,opacity:.6,marginLeft:4},children:[`(`,e.value,`)`]})]},e.value))})]}),_===`state`&&D(s,{style:{marginTop:10,marginBottom:16},children:[m(v,{style:{left:-14},children:T.t(`State type`)}),m(ze,{style:{marginTop:6},variant:`standard`,value:te,onChange:e=>{(window._localStorage||window.localStorage).setItem(`App.lastStateType`,e.target.value),ne(e.target.value)},children:Vl.map(e=>D(M,{value:e,children:[T.t(e),oe!==`en`&&T.t(e)!==e&&D(`span`,{style:{fontSize:`smaller`,opacity:.6,marginLeft:4},children:[`(`,e,`)`]})]},e))})]}),m(j,{variant:`standard`,label:T.t(`Name`),style:{margin:`5px 0`},autoFocus:!0,value:S,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),S&&ae())},slotProps:{input:{endAdornment:S?m(F,{position:`end`,children:m(x,{tabIndex:-1,size:`small`,onClick:()=>ee(``),children:m(b,{})})}):null}},onChange:e=>{ie(!i[g(e.target.value)]),ee(e.target.value)}})]})}),D(Me,{children:[m(P,{title:T.t(`Press CTRL+ENTER to confirm`),children:m(`span`,{children:m(L,{id:`add-new-object-dialog-add`,startIcon:m(pe,{}),disabled:se,onClick:()=>ae(),variant:`contained`,color:`primary`,children:T.t(`add`)})})}),m(L,{id:`add-new-object-dialog-cancel`,color:`grey`,onClick:e,variant:`contained`,startIcon:m(b,{}),children:T.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})=>{Ge(()=>{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,l=e;for(let e of Gl)for(let t of e[Object.keys(e)[0]])l-t.valueNum>=0&&(l-=t.valueNum,c.add(t.valueNum));return m(`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 D(`div`,{style:{width:150,height:150,display:`flex`,flexDirection:`column`,alignItems:`center`,borderLeft:`1px solid`},children:[m(`div`,{style:{height:50,display:`flex`,alignItems:`center`,fontSize:18,borderBottom:`1px solid silver`,width:`100%`,justifyContent:`center`},children:n(i)}),m(`div`,{style:{display:`flex`,width:`100%`},children:r[i].map((r,i)=>{let l=c.has(r.valueNum),u=a&r.valueNum;return D(`div`,{style:{display:`flex`,flexDirection:`column`,flex:1,alignItems:`center`,borderRight:i===0?`1px solid`:0},children:[m(`div`,{style:{height:50,borderBottom:`1px solid`,width:`100%`,justifyContent:`center`,display:`flex`,alignItems:`center`,color:`silver`},children:n(r.name)}),m(`div`,{style:{height:50,display:`flex`},children:m(ue,{disabled:s,checked:l,color:u?`primary`:`secondary`,indeterminate:!!u,style:u?{opacity:.5}:void 0,onChange:n=>{u&&(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:c,theme:l})=>{let[u,d]=N(void 0),[f,p]=N(void 0),[h,g]=N([]),[_,y]=N([]),[b,x]=N(!1),[S,ee]=N(!1),[C,te]=N(0),[ne,re]=N(null),[w,ie]=N(null),[ae,oe]=N(!1),[se,ce]=N(!1),[le,ue]=N([]),[E,de]=N([]),[fe,pe]=N(0),[O,ge]=N(0),[_e,ve]=N([]),[ye,be]=N(!1),[xe,Ce]=N(!0),we=a(`different`);return Ge(()=>{let e=0,t=[],r=[],a=n||o,s=`${a}.`,c=Object.keys(i).sort(),l=!1,u=[],f=[],m=T.getLanguage(),h=!1,_=!1,v=null,b=null,S=null,C=null,ne=[];for(let n=0;n<c.length;n++){let o=c[n],d=i[o];if(d&&(o===a||o.startsWith(s))){var w,le,E,D,fe,pe,O,me,he,ge,_e,ye,be,xe;if(e++,ne.push(o),!d.acl)continue;if(S===null&&((w=d.acl)==null?void 0:w.object)!==void 0){var Se;S=(Se=d.acl)==null?void 0:Se.object}if(C===null&&((le=d.acl)==null?void 0:le.state)!==void 0){var Ce;C=((Ce=d.acl)==null?void 0:Ce.state)??null}if(v===null&&((E=d.acl)==null?void 0:E.owner)!==void 0){var we;v=(we=d.acl)==null?void 0:we.owner}if(b===null&&((D=d.acl)==null?void 0:D.ownerGroup)!==void 0){var Te;b=(Te=d.acl)==null?void 0:Te.ownerGroup}if(!ae&&v!==((fe=d.acl)==null?void 0:fe.owner)&&((pe=d.acl)==null?void 0:pe.owner)!==void 0&&(h=!0),!se&&b!==((O=d.acl)==null?void 0:O.ownerGroup)&&((me=d.acl)==null?void 0:me.ownerGroup)!==void 0&&(_=!0),((he=d.acl)==null?void 0:he.state)!==void 0&&C!==((ge=d.acl)==null?void 0:ge.state)&&!t.includes((_e=d.acl)==null?void 0:_e.state)){var Ee;t.push((Ee=d.acl)==null?void 0:Ee.state)}if(((ye=d.acl)==null?void 0:ye.object)!==void 0&&S!==((be=d.acl)==null?void 0:be.object)&&!r.includes((xe=d.acl)==null?void 0:xe.object)){var De;r.push((De=d.acl)==null?void 0:De.object)}d.type===`state`&&(l=!0)}if(o.startsWith(`system.group.`)&&(d==null?void 0:d.type)===`group`){var A,Oe;u.push({name:k.getObjectNameFromObj(d,m).replace(`system.group.`,``),value:o,icon:(A=d.common)==null?void 0:A.icon,color:(Oe=d.common)==null?void 0:Oe.color})}else if(o.startsWith(`system.user.`)&&(d==null?void 0:d.type)===`user`){var ke,Ae;f.push({name:k.getObjectNameFromObj(d,m).replace(`system.user.`,``),value:o,icon:(ke=d.common)==null?void 0:ke.icon,color:(Ae=d.common)==null?void 0:Ae.color})}}v||=i[`system.config`].common.defaultNewAcl.owner,b||=i[`system.config`].common.defaultNewAcl.ownerGroup,S||=i[`system.config`].common.defaultNewAcl.object,re(Number.isNaN(S)?i[`system.config`].common.defaultNewAcl.object:S),l&&(C||=i[`system.config`].common.defaultNewAcl.state,ie(Number.isNaN(C)?i[`system.config`].common.defaultNewAcl.state:C));let je=f.find(e=>e.value===v),Me=u.find(e=>e.value===b);d(je),p(Me),oe(h),ce(_),g(f),y(u),l&&ee(!0),o&&x(!0),te(e),ue(t),de(r),ve(ne)},[i,n,se,ae,o]),Ge(()=>{if(b)se&&((f==null?void 0:f.value)!==`different`&&p({name:we,value:`different`}),_.find(e=>e.value===`different`)||y(e=>[{name:we,value:`different`},...e])),ae&&(u&&u.value===`different`||d({name:we,value:`different`}),h.find(e=>e.value===`different`)||g(e=>[{name:we,value:`different`},...e]));else{if(u&&u.value===`different`){var e;d((e=i[n].acl)==null?void 0:e.owner)}if(f&&f.value===`different`){var t;p((t=i[n].acl)==null?void 0:t.ownerGroup)}y(e=>e.filter(({value:e})=>e!==`different`)),g(e=>e.filter(({value:e})=>e!==`different`))}},[h,b,ae,se,i,n,f,u,we,_]),_e.length?m(Vt,{theme:l,titleButtonApply:`apply`,overflowHidden:!0,disableApply:xe,progress:ye,onClose:e,onApply:()=>{be(!0),setTimeout(()=>{if(b){let t=~fe&65535,n=~O&65535;for(let o=0;o<_e.length;o++){var e;let s=_e[o],c=i[s],l=k.clone(c.acl||{});if(l.object=Kl(((e=c.acl)==null?void 0:e.object)??0,ne??0,t),u&&u.value!==`different`&&(l.owner=u.value),f&&f.value!==`different`&&(l.ownerGroup=f.value),c.type===`state`){var a;l.state=Kl(((a=c.acl)==null?void 0:a.state)??0,w??0,n)}r(s,{acl:l})}}else{let e=k.clone(i[n].acl||{});e.object=ne??0,e.owner=u?u.value:`system.user.admin`,e.ownerGroup=f?f.value:`system.group.administrator`,i[n].type===`state`&&(e.state=w??0),r(n,{acl:e})}be(!1),t()},200)},children:D(`div`,{style:{display:`flex`,flexDirection:`column`},children:[m(`div`,{style:{margin:10,fontSize:20},children:a(`Access control list: %s`,n||o)}),D(`div`,{style:{display:`flex`},children:[D(s,{variant:`standard`,fullWidth:!0,style:{marginRight:10},children:[m(v,{children:a(`Owner user`)}),m(ze,{variant:`standard`,disabled:ye,value:u?u.value:``,renderValue:()=>D(`span`,{children:[u!=null&&u.icon?m(Se,{src:u.icon,style:{width:16,height:16,marginRight:8}}):null,u?u.name:``]}),style:(u==null?void 0:u.value)===`different`?{opacity:.5}:{color:(u==null?void 0:u.color)||void 0,backgroundColor:k.getInvertedColor(u==null?void 0:u.color,c)},onChange:e=>{let t=h.find(t=>t.value===e.target.value);d(t),Ce(!1)},children:h.map(e=>D(M,{style:e.value===`different`?{opacity:.5}:{color:e.color||void 0,backgroundColor:k.getInvertedColor(e.color,c)},value:e.value,children:[e.icon?m(Se,{src:e.icon,style:{width:16,height:16,marginRight:8}}):null,e.name]},e.value))})]}),D(s,{variant:`standard`,fullWidth:!0,children:[m(v,{children:a(`Owner group`)}),m(ze,{variant:`standard`,disabled:ye,value:f?f.value:``,renderValue:()=>D(`span`,{children:[f!=null&&f.icon?m(Se,{src:f.icon,style:{width:16,height:16,marginRight:8}}):null,f?f.name:``]}),style:(f==null?void 0:f.value)===`different`?{opacity:.5}:{color:(f==null?void 0:f.color)||void 0,backgroundColor:k.getInvertedColor(f==null?void 0:f.color,c)},onChange:e=>{let t=_.find(t=>t.value===e.target.value);p(t),Ce(!1)},children:_.map(e=>D(M,{value:e.value,style:e.value===`different`?{opacity:.5}:{color:e.color||void 0,backgroundColor:k.getInvertedColor(e.color,c)},children:[e.icon?m(Se,{src:e.icon,style:{width:16,height:16,marginRight:8}}):null,e.name]},e.value))})]})]}),D(`div`,{style:{display:`flex`,margin:10,alignItems:`center`,fontSize:10,marginLeft:0,color:`silver`},children:[m(`div`,{style:b?void 0:{color:`green`},children:a(`to apply one item`)}),m(he,{disabled:ye||!!o||C===1,checked:!!o||b,onChange:e=>{x(e.target.checked),Ce(!1)},color:`primary`}),D(`div`,{style:b?{color:`green`}:void 0,children:[a(`to apply with children`),` `,o||C>1?`(${C} ${a(`object(s)`)})`:``]})]}),ye&&m(me,{}),D(`div`,{style:{overflowY:`auto`},children:[D(`div`,{children:[m(`h2`,{children:a(`Object rights`)}),m(ql,{mask:O,disabled:ye,setMask:ge,applyToChildren:b,differentValues:E,t:a,setValue:e=>{re(e),Ce(!1)},value:ne??0})]}),S&&D(`div`,{children:[m(`h2`,{children:a(`States rights`)}),m(ql,{mask:fe,disabled:ye,setMask:pe,applyToChildren:b,differentValues:b?le:[],t:a,setValue:e=>{ie(e),Ce(!1)},value:w??0})]})]})]})}):m(me,{})};d();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 Ye{constructor(e){super(e),E(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=Ve.createRef()}componentDidMount(){this.props.socket.getBinaryState(this.props.obj._id).then(e=>{e||=``;let t=this.props.obj._id.toLowerCase().split(`.`).pop(),n=k.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 D(a,{style:Yl.dialog,open:!0,maxWidth:this.state.audio?`sm`:`md`,onClose:()=>this.props.onClose(),fullWidth:!0,"aria-labelledby":`object-view-dialog-title`,children:[m(w,{id:`object-view-dialog-title`,children:this.props.t(`View file in state: %s`,this.props.obj._id)}),D(C,{style:Yl.content,children:[this.state.error?m(A,{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?m(`audio`,{ref:this.audioRef,src:`data:${this.state.mime};base64,${this.state.binary}`}):null,this.state.audio?m(se,{color:`primary`,onClick:()=>this.audioRef.current&&this.audioRef.current.play(),children:m(h,{})}):null,this.state.image?m(`img`,{src:`data:${this.state.mime};base64,${this.state.binary}`,alt:this.props.obj._id,style:Yl.image}):null,this.state.text===null?null:m(`pre`,{style:Yl.text,children:this.state.text})]}),D(Me,{children:[D(`a`,{style:Yl.download,download:this.state.fileName,href:`data:${this.state.mime};base64,${this.state.binary}`,children:[m(at,{style:{paddingRight:8,height:12}}),m(`span`,{children:this.props.t(`Download`)})]}),m(L,{variant:`contained`,onClick:()=>this.props.onClose(),startIcon:m(b,{}),color:`grey`,children:this.props.t(`Close`)})]})]})}};d();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=le(),$l=class e extends Ye{constructor(t){super(t),E(this,`aliasIDs`,void 0),E(this,`aliasFolders`,void 0),E(this,`sourceName`,void 0),E(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[T.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?D(a,{open:!0,onClose:()=>this.setState({showAddNewAlias:!1}),onKeyDown:e=>Tt(e,()=>{this.state.newAliasId&&!this.props.objects[`alias.0.${this.state.newAliasId}`]&&this.onCreateAlias()}),children:[m(w,{children:T.t(`Create new alias: %s`,`alias.0.${this.state.newAliasId}`)}),D(C,{children:[m(we,{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=>m(j,{variant:`standard`,...e,label:T.t(`Alias ID`),helperText:`alias.0.${this.state.newAliasId}`}),fullWidth:!0}),m(j,{style:$.formControlLabel,variant:`standard`,value:this.state.newAliasName,slotProps:{input:{endAdornment:this.state.newAliasName?m(F,{position:`end`,children:m(x,{tabIndex:-1,size:`small`,onClick:()=>this.setState({newAliasName:``}),children:m(b,{})})}):null}},onChange:e=>this.setState({newAliasName:e.target.value}),label:T.t(`Alias name`),fullWidth:!0}),m(j,{style:$.formControlLabel,variant:`standard`,value:this.state.newAliasDesc,slotProps:{input:{endAdornment:this.state.newAliasDesc?m(F,{position:`end`,children:m(x,{tabIndex:-1,size:`small`,onClick:()=>this.setState({newAliasDesc:``}),children:m(b,{})})}):null}},onChange:e=>this.setState({newAliasDesc:e.target.value}),label:T.t(`Alias description`),fullWidth:!0}),D(s,{style:$.formControlLabel,fullWidth:!0,children:[m(v,{children:T.t(`State type`)}),m(ze,{variant:`standard`,value:this.state.newAliasType,onChange:e=>this.setState({newAliasType:e.target.value}),children:Zl.map(e=>D(M,{value:e,children:[T.t(e),D(`span`,{style:$.typeNameEng,children:[`(`,e,`)`]})]},e))})]}),this.state.newAliasType===`number`?m(j,{style:$.formControlLabel,variant:`standard`,value:this.state.newAliasUnit||``,slotProps:{input:{endAdornment:this.state.newAliasUnit?m(F,{position:`end`,children:m(x,{tabIndex:-1,size:`small`,onClick:()=>this.setState({newAliasUnit:``}),children:m(b,{})})}):null}},onChange:e=>this.setState({newAliasUnit:e.target.value}),label:T.t(`Alias units`),fullWidth:!0}):null,this.state.newAliasType===`number`?m(j,{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:T.t(`Min`),style:{width:`calc(50% - 4px)`,marginBottom:16,marginRight:8}}):null,this.state.newAliasType===`number`?m(j,{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:T.t(`Max`),fullWidth:!0,style:{width:`calc(50% - 4px)`,marginBottom:16}}):null,m(j,{variant:`standard`,style:{...$.formControlLabel,...$.color},label:T.t(`Color`),type:`color`,value:this.state.newAliasColor,onChange:e=>this.setState({newAliasColor:e.target.value})}),m(we,{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=>m(j,{variant:`standard`,...e,label:T.t(`Role`)})}),m(fe,{style:{...$.formControlLabel,marginLeft:16},control:m(ue,{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:T.t(`Alias read`)}),m(fe,{style:$.formControlLabel,control:m(ue,{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:T.t(`Alias write`)}),this.props.obj.common.states?m(fe,{style:$.formControlLabel,control:m(ue,{checked:this.state.newAliasCopyStates,onChange:e=>this.setState({newAliasCopyStates:e.target.checked})}),label:T.t(`Copy states`)}):null,m(fe,{style:$.formControlLabel,control:m(ue,{checked:this.state.newAliasUseFormula,onChange:e=>this.setState({newAliasUseFormula:e.target.checked})}),label:T.t(`Use convert functions`)}),this.state.newAliasUseFormula&&this.state.newAliasRead?m(j,{style:$.formControlLabel,variant:`standard`,value:this.state.newAliasReadFormula,onChange:e=>this.setState({newAliasReadFormula:e.target.value}),label:T.t(`Read formula`),helperText:`${T.t(`JS function like`)} "val / 5 + 21"`,slotProps:{input:{endAdornment:this.state.newAliasReadFormula&&this.state.newAliasReadFormula!==`val`?m(F,{position:`end`,children:m(x,{tabIndex:-1,size:`small`,onClick:()=>this.setState({newAliasReadFormula:`val`}),children:m(b,{})})}):null,startAdornment:m(F,{position:`start`,children:m(Ue,{style:$.funcIcon})})}},fullWidth:!0}):null,this.state.newAliasUseFormula&&this.state.newAliasWrite?m(j,{style:$.formControlLabel,variant:`standard`,value:this.state.newAliasWriteFormula,onChange:e=>this.setState({newAliasWriteFormula:e.target.value}),label:T.t(`Write formula`),slotProps:{input:{endAdornment:this.state.newAliasWriteFormula&&this.state.newAliasWriteFormula!==`val`?m(F,{position:`end`,children:m(x,{tabIndex:-1,size:`small`,onClick:()=>this.setState({newAliasWriteFormula:`val`}),children:m(b,{})})}):null,startAdornment:m(F,{position:`start`,children:m(Ue,{style:$.funcIcon})})}},helperText:`${T.t(`JS function like`)} "val / 5 + 21"`,fullWidth:!0}):null]}),D(Me,{children:[m(P,{title:T.t(`Press CTRL+ENTER to confirm`),children:m(`span`,{children:m(L,{variant:`contained`,disabled:!this.state.newAliasId||!!this.props.objects[`alias.0.${this.state.newAliasId}`],onClick:()=>void this.onCreateAlias(),startIcon:m(it,{}),color:`primary`,children:this.props.t(`Create`)})})}),m(L,{variant:`contained`,onClick:()=>this.setState({showAddNewAlias:!1}),startIcon:m(b,{}),color:`grey`,children:this.props.t(`Close`)})]})]}):null}render(){return D(a,{open:!0,maxWidth:`sm`,onClose:()=>this.props.onClose(),fullWidth:!0,"aria-labelledby":`object-alias-dialog-title`,children:[this.renderAddNewAlias(),m(w,{id:`object-alias-dialog-title`,children:this.state.usedInAliases.length?T.t(`This object is used in aliases`):T.t(`This object does not used in any aliases yet`)}),m(C,{children:D(Je,{style:{maxWidth:400},children:[this.state.usedInAliases.map(e=>D(M,{style:$.usedInAlias,onClick:()=>this.props.onRedirect(e),children:[m(Re,{children:m(ne,{fontSize:`small`})}),m(We,{children:e})]},e)),D(M,{onClick:()=>this.setState({showAddNewAlias:!0}),sx:$.addNewAlias,children:[m(Re,{children:m(it,{fontSize:`small`})}),m(We,{children:T.t(`Create alias from this ID`)})]})]})}),m(Me,{children:m(L,{variant:`contained`,onClick:()=>this.props.onClose(),startIcon:m(b,{}),color:`grey`,children:this.props.t(`Close`)})})]},`editAlias`)}};d();var eu=class e extends Ye{constructor(e){super(e),E(this,`checkTimer`,null),E(this,`objects`,{}),E(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())}),E(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?D(a,{open:!0,onClose:()=>this.setState({showHistoryWarning:!1}),onKeyDown:e=>Tt(e,()=>void this.onConfirmHistoryWarning()),children:[m(w,{children:this.props.t(`Found states with history`)}),D(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(`, `)}`,m(`div`,{children:this.props.t(`move_states_with_history_warning`)})]}),D(Me,{children:[m(P,{title:this.props.t(`Press CTRL+ENTER to confirm`),children:m(L,{variant:`contained`,color:`primary`,onClick:()=>void this.onConfirmHistoryWarning(),startIcon:m(pe,{}),children:this.props.t(`Confirm`)})}),m(L,{color:`grey`,variant:`contained`,startIcon:m(b,{}),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?m(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 D(a,{open:!0,maxWidth:`md`,fullWidth:!0,onClose:()=>this.props.onClose(),onKeyDown:e=>Tt(e,()=>void this.onCtrlEnter()),children:[this.renderParentSelectorDialog(),this.showHistoryWarning(),D(w,{children:[D(`span`,{style:{opacity:.6,marginRight:8},children:[this.props.t(`Rename or copy object`),` -`]}),m(`span`,{style:{fontWeight:`bold`},children:this.props.id})]}),D(C,{children:[D(`div`,{style:{display:`flex`,gap:8,alignItems:`end`,opacity:.7},children:[m(j,{fullWidth:!0,variant:`standard`,label:this.props.t(`Parent ID`),value:`${this.state.parentId}.`,slotProps:{input:{readOnly:!0}}}),m(L,{variant:`outlined`,style:{maxWidth:40,width:40,height:32},onClick:()=>this.setState({showParentDialog:!0}),children:`...`})]}),m(j,{value:this.state.name,onChange:e=>{let t=e.target.value.replace(k.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?m(fe,{control:m(ue,{checked:this.state.renameAllChildren,onChange:()=>{this.setState({renameAllChildren:!this.state.renameAllChildren})}}),label:this.props.t(`Rename all children`)}):null,D(`div`,{children:[D(`span`,{style:{opacity:.6,marginRight:8,fontSize:16},children:[this.props.t(`New object ID`),`:`]}),m(`span`,{style:{fontWeight:`bold`,fontSize:16},children:e})]})]}),D(Me,{children:[m(L,{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`)}),m(P,{title:this.props.t(`Press CTRL+ENTER to confirm`),children:m(`span`,{children:m(L,{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`)})})}),m(L,{variant:`contained`,color:`grey`,onClick:()=>this.props.onClose(),startIcon:m(b,{}),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 {
|
|
27
|
+
*`,`g`)),r={series:[]};return R(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){B(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`)||z.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(yr(l)){var f=l(t.getOption());dr(f)?s.innerHTML=f:zn(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}An(_,`click`,b),An(v,`click`,function(){if(u==null&&l!=null||u!=null&&l==null)b();else{var e;try{e=yr(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:z.color.background,textColor:z.color.primary,textareaColor:z.color.background,textareaBorderColor:z.color.border,buttonColor:z.color.accent50,buttonTextColor:z.color.neutral00}},t}(ac);function jc(e,t){return Fr(e,function(e,n){var r=t&&t[n];if(Wn(r)&&!ar(r)){(!Wn(e)||ar(e))&&(e={value:e});var i=r.name!=null&&e.name==null;return e=yn(e,r),i&&delete e.name,e}return e})}In({type:`changeDataView`,event:`dataViewChanged`,update:`prepareAndUpdate`},function(e,t){var n=[];R(e.newOption.series,function(e){var r=t.getSeriesByName(e.name)[0];if(!r)n.push(Jn({type:`scatter`},e));else{var i=r.get(`data`);n.push({name:e.name,data:jc(e.data,i)})}}),t.mergeOption(yn({series:n},e.newOption))});var Mc=R,Nc=hr();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){B(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);In({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);R(Wc,function(e,t){(!n||!n.include||Dr(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){R(e,function(e){var r=this.findTargetInfo(e,t);r&&r!==!0&&R(r.coordSyses,function(r){n(e,qc[e.brushType](1,r,e.range,!0).values,r,t)})},this)},e.prototype.setInputRanges=function(e,t){R(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 Fr(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&&Dr(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 er(e,t,{includeMainTypes:Bc})}var Wc={grid:function(e,t){var n=e.xAxisModels,r=e.yAxisModels,i=e.gridModels,a=Mn(),o={},s={};(n||r||i)&&(R(n,function(e){var t=e.axis.grid.model;a.set(t.id,t),o[t.id]=!0}),R(r,function(e){var t=e.axis.grid.model;a.set(t.id,t),s[t.id]=!0}),R(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=[];R(i.getCartesians(),function(e,t){(Dr(n,e.getAxis(`x`).model)>=0||Dr(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){R(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 on(t,t,Mo(null,e)),t}},qc={lineX:Fn(Jc,0),lineY:Fn(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=[qn(),qn()];return{values:Fr(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(Fr([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:Fn(Xc,0),lineY:Fn(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 Fr(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=R,el=rr(`toolbox-dataZoom_`),tl={x:`width`,y:`height`},nl=function(e){B(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`,cn(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=Ur(d,i[tl[e]],.5);l&&(n[l.id]={dataZoomId:l.id,startValue:isFinite(f)?Zt(o[0],f):o[0],endValue:isFinite(f)?Zt(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(Nn(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:z.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)}Xt(`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=er(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),ur(ic)}var cl=function(e){B(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:z.size.m,backgroundColor:z.color.transparent,borderColor:z.color.primary,borderWidth:0,padding:5,itemGap:10,textStyle:{fontSize:18,fontWeight:`bold`,color:z.color.primary},subtextStyle:{fontSize:12,color:z.color.quaternary}},t}(hn),ll=function(e){B(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=mr(e.get(`textBaseline`),e.get(`textVerticalAlign`)),c=new Or({style:Wr(i,{text:e.get(`text`),fill:i.getTextColor()},{disableBox:!0}),z2:10}),l=c.getBoundingRect(),u=e.get(`subtext`),d=new Or({style:Wr(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(){Qt(f,`_`+e.get(`target`))}),p&&d.on(`click`,function(){Qt(p,`_`+e.get(`subtarget`))}),_r(c).eventData=_r(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 _=Ut(e,n),v=pn(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,x=e.getItemStyle([`color`,`opacity`]);x.fill=e.get(`backgroundColor`);var S=new or({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:x,subPixelOptimize:!0,silent:!0});r.add(S)}},t.type=`title`,t}(qt);function ul(e){e.registerComponentModel(cl),e.registerComponentView(ll)}var dl=function(e){B(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=[],R(t,function(e,t){var n=Ar(Ir(e),``),a;Wn(e)?(a=Nn(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 tr([{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:z.size.m,controlPosition:`left`,autoPlay:!1,rewind:!1,loop:!0,playInterval:2e3,currentIndex:0,itemStyle:{},label:{color:z.color.secondary},data:[]},t}(hn),fl=function(e){B(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=dn(dl.defaultOption,{backgroundColor:`rgba(0,0,0,0)`,borderColor:z.color.border,borderWidth:0,orient:`horizontal`,inverse:!1,tooltip:{trigger:`item`},symbol:`circle`,symbolSize:12,lineStyle:{show:!0,width:2,color:z.color.accent10},label:{position:`auto`,show:!0,interval:`auto`,rotate:0,color:z.color.tertiary},itemStyle:{color:z.color.accent20,borderWidth:0},checkpointStyle:{symbol:`circle`,symbolSize:15,color:z.color.accent50,borderColor:z.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:z.color.accent50,borderColor:z.color.accent50,borderWidth:0},emphasis:{label:{show:!0,color:z.color.accent60},itemStyle:{color:z.color.accent60,borderColor:z.color.accent60},controlStyle:{color:z.color.accent70,borderColor:z.color.accent70}},progress:{lineStyle:{color:z.color.accent30},itemStyle:{color:z.color.accent40}},data:[]}),t}(dl);Zn(fl,wn.prototype);var pl=function(e){B(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.type=`timeline`,t}(qt),ml=function(e){B(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}(Un),hl=Math.PI,gl=hr(),_l=function(e){B(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 Rr(`nameValue`,{noName:!0,value:t})},R([`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?`+`:`-`:dr(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),x=d&&u.get(`showPrevBtn`,!0),S=d&&u.get(`showNextBtn`,!0),ee=0,C=l;y===`left`||y===`bottom`?(b&&(g=[0,0],ee+=m),x&&(_=[ee,0],ee+=m),S&&(v=[C-f,0],C-=m)):(b&&(g=[C-f,0],C-=m),x&&(_=[0,0],ee+=m),S&&(v=[C-f,0],C-=m));var te=[ee,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=On(),o=i.x,s=i.y+i.height;Dn(a,a,[-o,-s]),rn(a,a,-hl/2),Dn(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||dr(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=Xn(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]),Pr(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 Yt;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 jn({shape:{x1:i[0],y1:0,x2:i[1],y2:0},style:Jn({lineCap:`round`},r.getModel(`lineStyle`).getLineStyle()),silent:!0,z2:1});t.add(a);var o=this._progressLine=new jn({shape:{x1:i[0],x2:this._currentPointer?this._currentPointer.x:i[0],y1:0,y2:0},style:yn({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=[],R(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:cn(i._changeTimeline,i,e.value)});d.ensureState(`emphasis`).style=l.getItemStyle(),d.ensureState(`progress`).style=u.getItemStyle(),Ht(d);var f=_r(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=[],R(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 Or({x:d,y:0,rotation:e.labelRotation-e.rotation,onclick:cn(i._changeTimeline,i,o),silent:!1,style:Wr(c,{text:r.formattedLabel,align:e.labelAlign,verticalAlign:e.labelBaseline})});f.ensureState(`emphasis`).style=Wr(l),f.ensureState(`progress`).style=Wr(u),t.add(f),Ht(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`,cn(this._changeTimeline,this,l?`-`:`+`)),u(e.prevBtnPosition,`prev`,cn(this._changeTimeline,this,l?`+`:`-`)),u(e.playPosition,c?`stop`:`play`,cn(this._handlePlayClick,this,!c),!0);function u(e,n,c,l){if(e){var u=lr(mr(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),Ht(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=cn(s._handlePointerDrag,s),e.ondragend=cn(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=Lr(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 nn(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 pn(e.getBoxLayoutParams(),Ut(e,t).refContainer,e.get(`padding`))}function yl(e,t,n,r){var i=r.style,a=kn(e.get([`controlStyle`,t]),r||{},new $t(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=Hr(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=Kn({rectHover:!0,z2:100},r,!0);var l=Br(e.get(`symbolSize`));r.scaleX=l[0]/2,r.scaleY=l[1]/2;var u=Vn(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)}),yn({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;ar(t)||(t=t?[t]:[]),R(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}R(e.data||[],function(e){Wn(e)&&!ar(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};R(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;d(),ur([Dl,sl,ul,gr,ir,vr,jr]);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 Ye{constructor(e){if(super(e),E(this,`echartsReact`,void 0),E(this,`rangeRef`,void 0),E(this,`readTimeout`,null),E(this,`chartValues`,void 0),E(this,`rangeValues`,void 0),E(this,`subscribes`,void 0),E(this,`unit`,void 0),E(this,`divRef`,void 0),E(this,`chart`,void 0),E(this,`timerResize`,null),E(this,`updateTimer`,null),E(this,`minY`,void 0),E(this,`maxY`,void 0),E(this,`timeTimer`,null),E(this,`maxYLenTimeout`,null),E(this,`mouseDown`,!1),E(this,`start`,void 0),E(this,`end`,void 0),E(this,`localStorage`,void 0),E(this,`onResize`,()=>{this.timerResize&&clearTimeout(this.timerResize),this.timerResize=setTimeout(()=>{this.timerResize=null,this.setState({windowWidth:window.innerWidth}),this.componentDidUpdate()})}),E(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,r=parseInt(this.localStorage.getItem(`App.absoluteEnd`)||``,10)||0;n&&r||t&&t!==`absolute`||(t=`30`),r&&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:r,maxYLen:0,stepType:``,echartsJump:!1},this.echartsReact=null,this.rangeRef=ae(),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=ae(),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?``:k.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?m($n,{ref:e=>{this.echartsReact=e},echarts:kr,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()}}):m(me,{}):m(`div`,{style:{marginTop:20,fontSize:24,marginLeft:24},children:this.props.t(`History instance not alive`)}):m(`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 D(De,{children:[!this.props.historyInstance&&D(s,{variant:`standard`,style:Z.selectHistoryControl,children:[m(v,{children:this.props.t(`History instance`)}),m(ze,{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=>m(M,{value:e.id,style:e.alive?void 0:Z.notAliveInstance,children:e.id},e.id))})]}),D(s,{variant:`standard`,style:Z.selectRelativeTime,children:[m(v,{children:this.props.t(`Relative`)}),D(ze,{variant:`standard`,ref:this.rangeRef,value:this.state.relativeRange,onChange:e=>this.setRelativeInterval(e.target.value),children:[m(M,{value:`absolute`,sx:Z.customRange,children:this.props.t(`custom range`)},`custom`),m(M,{value:10,children:this.props.t(`last 10 minutes`)},`1`),m(M,{value:30,children:this.props.t(`last 30 minutes`)},`2`),m(M,{value:60,children:this.props.t(`last hour`)},`3`),m(M,{value:`day`,children:this.props.t(`this day`)},`4`),m(M,{value:1440,children:this.props.t(`last 24 hours`)},`5`),m(M,{value:`week`,children:this.props.t(`this week`)},`6`),m(M,{value:10080,children:this.props.t(`last week`)},`7`),m(M,{value:`2weeks`,children:this.props.t(`this 2 weeks`)},`8`),m(M,{value:20160,children:this.props.t(`last 2 weeks`)},`9`),m(M,{value:`month`,children:this.props.t(`this month`)},`10`),m(M,{value:43200,children:this.props.t(`last 30 days`)},`11`),m(M,{value:`year`,children:this.props.t(`this year`)},`12`),m(M,{value:`12months`,children:this.props.t(`last 12 months`)},`13`)]})]}),D(xe,{dateAdapter:ot,adapterLocale:So[this.props.lang],children:[D(`div`,{style:Z.toolbarTimeGrid,children:[m(`div`,{style:{...Z.toolbarTimeLabel,opacity:this.state.relativeRange===`absolute`?void 0:.5},children:this.props.t(`Start time`)}),m(Qe,{sx:Z.toolbarDate,disabled:this.state.relativeRange!==`absolute`,value:new Date(this.state.min),onChange:e=>e&&this.setStartDate(e)}),m(ce,{disabled:this.state.relativeRange!==`absolute`,sx:Z.toolbarTime,ampm:this.state.ampm,value:new Date(this.state.min),onChange:e=>e&&this.setStartDate(e)})]}),D(`div`,{style:Z.toolbarTimeGrid,children:[m(`div`,{style:{...Z.toolbarTimeLabel,opacity:this.state.relativeRange===`absolute`?void 0:.5},children:this.props.t(`End time`)}),m(Qe,{disabled:this.state.relativeRange!==`absolute`,sx:Z.toolbarDate,value:new Date(this.state.max),onChange:e=>e&&this.setEndDate(e)}),m(ce,{disabled:this.state.relativeRange!==`absolute`,sx:Z.toolbarTime,ampm:this.state.ampm,value:new Date(this.state.max),onChange:e=>e&&this.setEndDate(e)})]})]}),m(`div`,{style:Z.grow}),m(L,{style:{marginRight:10},variant:`outlined`,onClick:e=>this.setState({showStepMenu:e.target}),children:t?this.state.stepType===``?m(bt,{}):this.state.stepType===`stepStart`?m(St,{}):this.state.stepType===`stepMiddle`?m(Bt,{}):this.state.stepType===`stepEnd`?m(Rt,{}):this.props.t(`Step type`):this.state.stepType?this.props.t(this.state.stepType):this.props.t(`Step type`)}),this.state.showStepMenu?D(ye,{open:!0,anchorEl:this.state.showStepMenu,onClose:()=>this.setState({showStepMenu:null}),children:[m(M,{selected:this.state.stepType===``,onClick:()=>this.onStepChanged(``),children:t?m(bt,{}):this.props.t(`None`)}),m(M,{selected:this.state.stepType===`stepStart`,onClick:()=>this.onStepChanged(`stepStart`),children:t?m(St,{}):this.props.t(`stepStart`)}),m(M,{selected:this.state.stepType===`stepMiddle`,onClick:()=>this.onStepChanged(`stepMiddle`),children:t?m(Bt,{}):this.props.t(`stepMiddle`)}),m(M,{selected:this.state.stepType===`stepEnd`,onClick:()=>this.onStepChanged(`stepEnd`),children:t?m(Rt,{}):this.props.t(`stepEnd`)})]}):null,this.props.showJumpToEchart&&this.state.echartsJump&&m(se,{style:Z.echartsButton,size:`small`,onClick:()=>this.openEcharts(),title:this.props.t(`Open charts in new window`),children:m(`img`,{src:Ol,alt:`echarts`,style:Z.buttonIcon})}),D(se,{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:[m(S,{style:Z.splitLineButtonIcon}),this.props.t(`Show lines`)]})]})}render(){return!this.state.historyInstances&&!this.state.defaultHistory?m(me,{}):D(Pe,{style:Z.paper,children:[this.renderToolbar(),m(`div`,{ref:this.divRef,style:k.getStyle(this.props.theme,Z.chart,this.props.noToolbar?Z.chartWithoutToolbar:Z.chartWithToolbar),children:this.renderChart()})]})}};d();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 st{constructor(e){super(e),E(this,`chartAvailable`,void 0),E(this,`saveFunc`,null),E(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=o.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:st.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 m(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 m(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 m(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?m(qe,{title:T.t(`You have unsaved changes`),text:T.t(`Discard?`),ok:T.t(`Yes`),cancel:T.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?m(qe,{text:m(`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 D(a,{sx:{"&.MuiDialog-scrollPaper":Ml.dialog,"& .MuiDialog-paper":Ml.paper},scroll:`paper`,open:!0,onClose:()=>this.props.onClose(),onKeyDown:e=>it(e,this.onCtrlEnter),fullWidth:!0,maxWidth:`xl`,"aria-labelledby":`form-dialog-title`,children:[this.renderDialogConfirm(),this.renderWarningDialog(),m(w,{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])}),D(C,{style:Ml.content,children:[m(je,{position:`static`,children:D(Ke,{value:this.state.currentTab,onChange:(e,t)=>{o.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:[m(ie,{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?m(ie,{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?m(ie,{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?m(A,{component:`div`,sx:Ml.tabPanel,children:this.renderCustomEditor()}):null,this.props.objectIDs.length===1&&this.chartAvailable&&this.state.currentTab===1?m(A,{component:`div`,sx:Ml.tabPanel,children:this.renderTable()}):null,(t===`number`||t===`boolean`)&&this.props.objectIDs.length===1&&this.chartAvailable&&this.state.currentTab===2?m(A,{component:`div`,sx:Ml.tabPanel,children:this.renderCharts()}):null]}),D(Me,{children:[this.state.currentTab===0&&m(L,{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(m(f,{}),this.props.t(`Save`))}),this.state.currentTab===0&&m(P,{title:this.props.t(`Press CTRL+ENTER to confirm`),children:m(`span`,{children:m(L,{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(m(f,{}),this.props.t(`Save & close`),m(b,{}))})})}),m(L,{id:`object-custom-dialog-close`,disabled:this.state.progressRunning,variant:`contained`,onClick:()=>this.onClose(),color:`grey`,children:this.getButtonTitle(m(b,{}),this.props.t(`Close`))})]})]})}};d();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 Ye{static hasStatesOptions(e){return!!e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length>0}constructor(t){super(t),E(this,`propsValue`,void 0),E(this,`chartFrom`,void 0),E(this,`ack`,void 0),E(this,`inputRef`,Ve.createRef()),E(this,`q`,void 0),E(this,`expire`,void 0),E(this,`writePending`,!1),E(this,`onCtrlEnter`,()=>{this.state.valid&&this.onUpdate()});let n=r(),i=e.hasStatesOptions(this.props.states),a=n.prepareEditor(this.props.object,this.props.value),o=i?`states`:a.editorType,s=a.value;this.propsValue=s,o===`json`&&typeof s!=`string`?(s=JSON.stringify(s??null,null,2),this.propsValue=s):(o===`number`&&s==null||o===`string`&&s==null)&&(s=``),this.state={type:o,chart:!1,chartEnabled:(window._localStorage||window.localStorage).getItem(`App.chartSetValue`)!==`false`,fullScreen:(window._localStorage||window.localStorage).getItem(`App.fullScreen`)===`true`,targetValue:s,valid:!0,jsonError:!1,writing:!1},this.ack=!1,this.q=0,this.expire=0,this.inputRef=Ve.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=r(),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 D(xe,{adapterLocale:So[this.props.lang],dateAdapter:ot,children:[m(Qe,{value:new Date(Number(this.state.targetValue)),onChange:e=>{e&&this.setState({targetValue:Math.round(e.getTime())})}}),m(ce,{value:new Date(Number(this.state.targetValue)),views:[`hours`,`minutes`,`seconds`],onChange:e=>{e&&this.setState({targetValue:Math.round(e.getTime())})}})]})}renderChart(){return m(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 m(ct,{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 m(we,{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=>m(j,{...e,label:this.props.t(`Value`),variant:`standard`})})}return D(s,{variant:`standard`,style:Fl.formControl,children:[m(v,{children:this.props.t(`Value`)}),m(ze,{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 m(M,{value:e,children:(n=this.props.states)==null?void 0:n[e]},t)})})]})}render(){var t,n,r,i;let o=e.hasStatesOptions(this.props.states),c=D(`div`,{style:{display:`flex`,alignItems:`center`},children:[m(fe,{style:{...Fl.formControl,...this.props.expertMode?void 0:Fl.ackCheckbox},control:m(ue,{defaultChecked:!1,onChange:e=>this.ack=e.target.checked}),label:this.props.t(`Acknowledged`)}),m(P,{title:this.props.t(`Acknowledged explanation`),slotProps:{popper:{sx:Fl.tooltip}},children:m(Te,{color:`primary`})})]});return D(a,{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=>it(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:[D(w,{id:`edit-value-dialog-title`,children:[this.props.t(`Write value`),((t=this.props.object.common)==null?void 0:t.write)===!1?D(`span`,{style:Fl.readOnlyText,children:[`(`,this.props.t(`read only`),`)`]}):null,this.state.chart?m(se,{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:m(Ze,{})}):null,this.state.type===`json`?m(x,{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?m(It,{}):m(Ft,{})}):null]}),m(C,{children:m(`form`,{noValidate:!0,autoComplete:`off`,onSubmit:e=>e.preventDefault(),style:{...Fl.dialogForm,height:`100%`},children:D(O,{container:!0,direction:`row`,spacing:2,style:{height:`100%`},children:[m(O,{size:{xs:12,md:this.state.chart&&this.state.chartEnabled?6:12},style:{height:`100%`},children:D(O,{container:!0,spacing:2,style:{marginTop:0,height:`100%`},sx:{flexDirection:`column`},children:[this.props.expertMode?m(O,{children:D(O,{container:!0,direction:`row`,spacing:2,style:{marginTop:0},children:[this.props.expertMode?m(O,{children:D(s,{style:Fl.formControl,children:[m(v,{style:{marginTop:10,marginLeft:-14},children:this.props.t(`Value type`)}),D(ze,{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:[m(M,{value:`string`,children:`String`}),m(M,{value:`number`,children:`Number`}),m(M,{value:`boolean`,children:`Boolean`}),m(M,{value:`json`,children:`JSON/Object`}),o?m(M,{value:`states`,children:`States`}):null]})]})}):null,this.state.type===`json`?m(O,{sx:{flex:1}}):null]})}):null,m(O,{sx:{flex:this.state.type===`json`&&this.state.fullScreen?1:void 0},style:{paddingTop:0},children:this.state.type===`boolean`?m(Fe,{component:`div`,style:this.props.expertMode?{marginTop:20,width:`100%`,backgroundColor:this.props.themeType===`dark`?`#595959`:`#dadada`,borderRadius:5,padding:5}:void 0,children:D(O,{component:`label`,container:!0,spacing:1,sx:{alignItems:`center`},children:[D(O,{style:{marginRight:10},children:[this.props.t(`Value`),`:`]}),m(O,{children:`FALSE`}),m(O,{children:m(he,{autoFocus:!0,checked:e.parseBoolean(this.state.targetValue),onKeyUp:e=>e.key===`Enter`&&this.onUpdate(e),onChange:e=>this.setState({targetValue:e.target.checked})})}),m(O,{children:`TRUE`})]})}):this.state.type===`number`?m(j,{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():m(j,{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`?m(O,{style:{display:`flex`,gap:`5px`},size:{xs:6},children:this.renderTimePicker()}):null,this.props.expertMode?m(O,{children:c}):null,this.props.expertMode?D(O,{children:[D(s,{variant:`standard`,style:Fl.quality,children:[m(v,{children:this.props.t(`Quality`)}),D(ze,{variant:`standard`,defaultValue:0,onChange:e=>this.q=Number(e.target.value),children:[m(M,{value:0,children:`0x00 - good`}),m(M,{value:1,children:`0x01 - general problem`}),m(M,{value:2,children:`0x02 - no connection problem`}),m(M,{value:16,children:`0x10 - substitute value from controller`}),m(M,{value:32,children:`0x20 - substitute initial value`}),m(M,{value:64,children:`0x40 - substitute value from device or instance`}),m(M,{value:128,children:`0x80 - substitute value from sensor`}),m(M,{value:17,children:`0x11 - general problem by instance`}),m(M,{value:65,children:`0x41 - general problem by device`}),m(M,{value:129,children:`0x81 - general problem by sensor`}),m(M,{value:18,children:`0x12 - instance not connected`}),m(M,{value:66,children:`0x42 - device not connected`}),m(M,{value:130,children:`0x82 - sensor not connected`}),m(M,{value:68,children:`0x44 - device reports error`}),m(M,{value:132,children:`0x84 - sensor reports error`})]})]}),m(j,{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`?m(O,{size:{xs:12,md:6},style:{minHeight:300},sx:{display:{xs:`none`,md:`inline-block`}},children:this.renderChart()}):null]})})}),D(Me,{sx:Fl.wrapperButton,children:[this.props.expertMode?null:c,this.props.expertMode?null:m(`div`,{style:{flexGrow:1}}),m(L,{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:m(pe,{}),style:((i=this.props.object.common)==null?void 0:i.write)===!1?Fl.readOnly:void 0,children:this.props.width===`xs`?m(pe,{fontSize:`large`}):this.state.writing?this.props.t(`Please wait...`):this.props.t(`Set value`)}),m(L,{variant:`contained`,disabled:this.state.writing,onClick:()=>{this.writePending||this.props.onClose()},color:`grey`,startIcon:this.props.width===`xs`?void 0:m(b,{}),children:this.props.width===`xs`?m(b,{fontSize:`large`}):this.props.t(`Cancel`)})]})]})}};yt(),pt(),ut(),_t(),ht(),lt(),ft(),gt(),mt(),vt(),d();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 Ye{constructor(e){super(e),E(this,`originalObj`,void 0),E(this,`subscribed`,!1),E(this,`updateTimer`,null),E(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}))}),E(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()}),E(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=o.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,s=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(s),tab:n,showCopyDialog:``,showCommonDeleteMessage:!1,selectId:!1,selectRead:!1,selectWrite:!1,newId:``,lang:T.getLanguage(),value:void 0},dt.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 ge(n[e[t]],this.props.socket);if(i.key=e[t],i&&typeof i==`object`&&r.push(i),i.icon)try{let e=Oe(i.icon);if(e.type!==`base64`&&e.type!==`http`){let t=await ge(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()&&o.getLocation().arg!==this.state.tab&&o.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?Ie(JSON.parse(e),t.split(`.`)):JSON.parse(e)}static setPartOfObject(e,t,n){let r=JSON.parse(e);return r===void 0?e:(r=ke(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)}`),m(`div`,{children:T.t(`Cannot get data for %s: %s`,n.path,e)})}return r?m(ee,{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:rt}):m(`div`,{children:T.t(`Cannot get data for %s`,n.path)})}renderCustomTab(e,t){var n;let r;if(!t||!Ie(t,(n=e.path)==null?void 0:n.split(`.`)))return null;e.color&&(r={backgroundColor:e.color,color:k.invertColor(e.color||``,!0)});let i=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 m(ie,{disabled:this.state.error||this.state.customError,value:e.key,label:i,style:r,iconPosition:`start`,icon:e.icon?m(Se,{src:e.icon,style:Q.funcIcon}):void 0})}renderStateTab(){return this.props.obj.type!==`state`||this.props.obj.common.type===`file`?null:m(ie,{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 m(`div`,{children:this.props.t(`State does not exist`)});if(typeof this.state.value!=`object`)return D(`div`,{style:{maxWidth:700},children:[m(`div`,{children:this.props.t(`State is invalid`)}),m(`div`,{children:m(`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(k.isStringInteger(i))n=new Date(parseInt(i,10)).toString();else try{let e=new Date(i);k.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?T.t(`true`):T.t(`false`),r.color=i?`#139800`:`#cd6b55`):n=a===`object`?JSON.stringify(i):a===`string`&&i.startsWith(`data:image/`)?m(`img`,{src:i,alt:`img`,style:Q.stateImage}):i==null?void 0:i.toString()),Object.assign(r,Ll(this.props.theme,r.color)),D(A,{style:{...Q.divWithoutTitle,padding:`24px 24px 0 24px`,fontSize:16,maxWidth:400},sx:{"& .value-line:hover":{backgroundColor:`#00000030`}},children:[D(`div`,{className:`value-line`,style:{...Q.stateRow,marginBottom:24},children:[D(`div`,{style:Q.stateTitle,children:[T.t(`ra_tooltip_value`),`:`]}),D(A,{component:`div`,sx:r,style:Q.stateValue,children:[n,(t=this.props.obj.common)!=null&&t.unit?m(`span`,{style:Q.stateUnit,children:this.props.obj.common.unit}):null]},typeof n==`string`?n:`image`)]}),D(`div`,{style:Q.stateRow,className:`value-line`,children:[D(`div`,{style:Q.stateTitle,children:[T.t(`Type`),`:`]}),m(`div`,{style:Q.stateValue,children:a})]}),D(`div`,{style:Q.stateRow,className:`value-line`,children:[D(`div`,{style:Q.stateTitle,children:[T.t(`ra_tooltip_ts`),`:`]}),m(P,{title:new Date(this.state.value.ts).toLocaleString(),slotProps:{popper:{sx:Q.tooltip}},children:m(`div`,{style:Q.stateValue,children:m(`span`,{style:Q.stateTime,children:dt(this.state.value.ts).fromNow()})})})]}),D(`div`,{style:Q.stateRow,className:`value-line`,children:[D(`div`,{style:Q.stateTitle,children:[T.t(`ra_tooltip_ack`),`:`]}),D(`div`,{style:{...Q.stateValue,color:this.state.value.ack?`green`:`red`},children:[this.state.value.ack?T.t(`Acknowledged`):T.t(`Command`),this.state.value.ack?` (true)`:` (false)`]})]}),D(`div`,{style:Q.stateRow,className:`value-line`,children:[D(`div`,{style:Q.stateTitle,children:[T.t(`ra_tooltip_lc`),`:`]}),m(P,{title:new Date(this.state.value.lc).toLocaleString(),slotProps:{popper:{sx:Q.tooltip}},children:m(`div`,{style:Q.stateValue,children:m(`span`,{style:Q.stateTime,children:dt(this.state.value.lc).fromNow()})})})]}),D(`div`,{style:Q.stateRow,className:`value-line`,children:[D(`div`,{style:Q.stateTitle,children:[T.t(`ra_tooltip_quality`),`:`]}),m(`div`,{style:Q.stateValue,children:k.quality2text(this.state.value.q||0).join(`, `)})]}),D(`div`,{style:Q.stateRow,className:`value-line`,children:[D(`div`,{style:Q.stateTitle,children:[T.t(`ra_tooltip_from`),`:`]}),m(`div`,{style:Q.stateValue,children:this.state.value.from})]}),D(`div`,{style:Q.stateRow,className:`value-line`,children:[D(`div`,{style:Q.stateTitle,children:[T.t(`ra_tooltip_user`),`:`]}),m(`div`,{style:Q.stateValue,children:this.state.value.user||`--`})]}),this.state.value.expire?D(`div`,{style:Q.stateRow,className:`value-line`,children:[D(`div`,{style:Q.stateTitle,children:[T.t(`ra_tooltip_expire`),`:`]}),D(`div`,{style:Q.stateValue,children:[this.state.value.expire,` `,T.t(`sc_seconds`)]})]}):null,this.state.value.c?D(`div`,{style:Q.stateRow,className:`value-line`,children:[D(`div`,{style:Q.stateTitle,children:[T.t(`ra_tooltip_comment`),`:`]}),m(`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=o.getLocation();return e.tab===`tab-objects`&&e.dialog===`edit`&&e.id===this.props.obj._id}renderTabs(e){var t;return D(Ke,{style:Q.tabsPadding,value:this.state.tab,onChange:(e,t)=>{if((window._localStorage||window.localStorage).setItem(`${this.props.dialogName||`App`}.editTab`,t),this.isRouted()&&o.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:[m(ie,{value:`common`,disabled:this.state.customError||this.state.error,label:this.props.t(`common`)}),m(ie,{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`&&m(ie,{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 m(Ce,{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 m(`div`,{style:Q.marginBlock,children:m(L,{style:Q.buttonAdd,variant:`contained`,color:`secondary`,startIcon:m(l,{}),onClick:t,children:T.t(e)})})}buttonRemoveKey(e,t,n){let{t:r}=this.props;return m(P,{title:r(`Remove attribute %s`,r(e)),slotProps:{popper:{sx:Q.tooltip}},children:m(x,{size:`small`,sx:Q.removeButton,style:n,onClick:t,children:m(b,{})})})}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,c=e.filterRoles(this.props.roleArray,t.common.type),l;if(t.common.icon&&(l=t.type===`instance`||t.type===`adapter`?`./adapter/${t.common.name}/${t.common.icon}`:t.common.icon,!l.startsWith(`.`)&&!l.startsWith(`/`)&&!l.startsWith(`data:`))){let e=i._id.split(`.`);l=e[0]===`system`?`adapter/${e[2]}${l.startsWith(`/`)?``:`/`}${l}`:`adapter/${e[0]}${l.startsWith(`/`)?``:`/`}${l}`}let u=typeof t.common.desc==`object`&&t.common.desc?t.common.desc[T.getLanguage()]||t.common.desc.en||``:t.common.desc||``,d=k.getObjectNameFromObj(t,T.getLanguage(),{},!1,!0);return D(A,{style:Q.commonTabWrapper,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),e.stopPropagation(),this.onUpdate())},children:[D(A,{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`,``)):m(j,{variant:`standard`,disabled:!1,label:r(`Name`),style:{...Q.textField,marginTop:8},fullWidth:!0,slotProps:{input:{endAdornment:d?m(F,{position:`end`,children:m(P,{title:T.t(`Clear text`),slotProps:{popper:{sx:Q.tooltip}},children:m(x,{tabIndex:-1,size:`small`,onClick:()=>this.setCommonItem(t,`name`,``),children:m(b,{})})})}):null}},value:d,onChange:e=>this.setCommonItem(t,`name`,e.target.value)}),t.common.desc===void 0?e.buttonAddKey(`Description`,()=>this.setCommonItem(t,`desc`,``)):D(A,{component:`div`,sx:Q.flex,children:[m(j,{variant:`standard`,disabled:!1,label:r(`Description`),style:{...Q.textField,marginTop:8},fullWidth:!0,slotProps:{input:{endAdornment:u?m(F,{position:`end`,children:m(P,{title:T.t(`Clear text`),slotProps:{popper:{sx:Q.tooltip}},children:m(x,{tabIndex:-1,size:`small`,onClick:()=>this.setCommonItem(t,`desc`,``),children:m(b,{})})})}):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`)):D(A,{component:`div`,sx:Q.flex,children:[D(s,{style:Q.marginBlock,fullWidth:!0,children:[m(v,{style:{transform:`scale(0.75)`},children:r(`State type`)}),m(ze,{variant:`standard`,disabled:!1,value:t.common.type,onChange:e=>this.setCommonItem(t,`type`,e.target.value),children:n.map(e=>D(M,{value:e,children:[r(e),D(`span`,{style:Q.typeNameEng,children:[`(`,e,`)`]})]},e))})]}),this.buttonRemoveKey(`State type`,()=>this.removeCommonItem(t,`type`),{marginTop:33})]}):null,D(A,{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)):D(A,{component:`div`,sx:Q.flex,children:[m(fe,{style:Q.marginBlock,control:m(ue,{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)):D(A,{component:`div`,sx:Q.flex,children:[m(fe,{style:Q.marginBlock,control:m(ue,{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`,``)):D(A,{component:`div`,sx:Q.flex,children:[m(we,{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:c,renderInput:e=>m(j,{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`,``)):D(A,{component:`div`,sx:Q.flex,children:[m(j,{variant:`standard`,disabled:!1,style:{...Q.marginBlock,...Q.color},label:r(`Color`),type:`color`,slotProps:{input:{endAdornment:t.common.color?m(F,{position:`end`,children:m(P,{title:T.t(`Clear field`),slotProps:{popper:{sx:Q.tooltip}},children:m(x,{tabIndex:-1,size:`small`,onClick:()=>this.setCommonItem(t,`color`,``),children:m(b,{})})})}):null}},value:t.common.color,onChange:e=>this.setCommonItem(t,`color`,e.target.value)}),this.buttonRemoveKey(`Color`,()=>this.removeCommonItem(t,`color`))]}),D(A,{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?m(A,{component:`div`,sx:Q.flex,children:e.buttonAddKey(`Min`,()=>this.setCommonItem(t,`min`,0))}):D(A,{component:`div`,sx:Q.flex,children:[m(j,{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?m(A,{component:`div`,sx:Q.flex,children:e.buttonAddKey(`Max`,()=>this.setCommonItem(t,`max`,100))}):D(A,{component:`div`,sx:Q.flex,children:[m(j,{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?m(A,{component:`div`,sx:Q.flex,children:e.buttonAddKey(`Step`,()=>this.setCommonItem(t,`step`,1))}):D(A,{component:`div`,sx:Q.flex,children:[m(j,{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?m(`div`,{style:Q.flexDrop,children:e.buttonAddKey(`Unit`,()=>this.setCommonItem(t,`unit`,``))}):D(A,{component:`div`,sx:Q.flex,children:[m(j,{variant:`standard`,disabled:!1,className:{...Q.marginBlock,...Q.color},label:r(`Unit`),slotProps:{input:{endAdornment:t.common.unit?m(F,{position:`end`,children:m(P,{title:T.t(`Clear field`),slotProps:{popper:{sx:Q.tooltip}},children:m(x,{tabIndex:-1,size:`small`,onClick:()=>this.setCommonItem(t,`unit`,``),children:m(b,{})})})}):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?m(A,{component:`div`,sx:Q.flex,children:e.buttonAddKey(`Icon`,()=>this.setCommonItem(t,`icon`,``))}):D(A,{component:`div`,sx:Q.flex,style:{flexGrow:1,minWidth:158},children:[m(de,{disabled:!1,maxSize:10240,icon:l,removeIconFunc:()=>this.setCommonItem(t,`icon`,``),onChange:e=>this.setCommonItem(t,`icon`,e)}),this.buttonRemoveKey(`Icon`,()=>this.removeCommonItem(t,`icon`))]})]})}catch{return m(`div`,{children:this.props.t(`Cannot parse JSON!`)})}}renderAliasEdit(){try{var e,t,n,r,i,a,o,s,c,l,u,d,f,p,h,g,_,v;let y=JSON.parse(this.state.text),S=((e=y.common)==null||(e=e.alias)==null?void 0:e.read)!==void 0||((t=y.common)==null||(t=t.alias)==null?void 0:t.write)!==void 0;return D(O,{container:!0,style:Q.marginTop,sx:{flexDirection:`column`},children:[m(O,{children:m(fe,{control:m(ue,{checked:typeof((n=y.common)==null||(n=n.alias)==null?void 0:n.id)==`object`,onChange:()=>{var e;if(typeof((e=y.common)==null||(e=e.alias)==null?void 0:e.id)==`object`){var t;this.setAliasItem(y,`id`,((t=y.common)==null||(t=t.alias)==null||(t=t.id)==null?void 0:t.read)||``)}else{var n;this.setAliasItem(y,`id.read`,((n=y.common)==null||(n=n.alias)==null?void 0:n.id)||``)}}}),label:this.props.t(`Different IDs for read and write`)})}),typeof((r=y.common)==null||(r=r.alias)==null?void 0:r.id)==`object`?null:D(O,{children:[m(j,{variant:`standard`,label:this.props.t(`Alias state`),value:((i=y.common)==null||(i=i.alias)==null?void 0:i.id)||``,style:Q.aliasIdEdit,slotProps:{input:{endAdornment:(a=y.common)!=null&&(a=a.alias)!=null&&a.id?m(F,{position:`end`,children:m(P,{title:T.t(`Clear field`),slotProps:{popper:{sx:Q.tooltip}},children:m(x,{tabIndex:-1,size:`large`,onClick:()=>this.setAliasItem(y,`id`,``),children:m(b,{})})})}):null}},onChange:e=>this.setAliasItem(y,`id`,e.target.value),margin:`normal`}),m(se,{style:Q.button,size:`small`,onClick:()=>this.setState({selectId:!0,selectRead:!1,selectWrite:!1}),children:`...`})]}),typeof((o=y.common)==null||(o=o.alias)==null?void 0:o.id)==`object`?D(O,{children:[m(j,{variant:`standard`,label:this.props.t(`Alias read state`),value:((s=y.common)==null||(s=s.alias)==null||(s=s.id)==null?void 0:s.read)||``,style:Q.aliasIdEdit,slotProps:{input:{endAdornment:(c=y.common)!=null&&(c=c.alias)!=null&&(c=c.id)!=null&&c.read?m(F,{position:`end`,children:m(P,{title:T.t(`Clear field`),slotProps:{popper:{sx:Q.tooltip}},children:m(x,{size:`large`,tabIndex:-1,onClick:()=>this.setAliasItem(y,`id.read`,``),children:m(b,{})})})}):null}},onChange:e=>this.setAliasItem(y,`id.read`,e.target.value),margin:`normal`}),m(se,{style:Q.button,size:`small`,onClick:()=>this.setState({selectId:!1,selectRead:!0,selectWrite:!1}),children:`...`})]}):null,typeof((l=y.common)==null||(l=l.alias)==null?void 0:l.id)==`object`?D(O,{children:[m(j,{variant:`standard`,label:this.props.t(`Alias write state`),value:((u=y.common)==null||(u=u.alias)==null||(u=u.id)==null?void 0:u.write)||``,style:Q.aliasIdEdit,slotProps:{input:{endAdornment:(d=y.common)!=null&&(d=d.alias)!=null&&(d=d.id)!=null&&d.write?m(F,{position:`end`,children:m(P,{title:T.t(`Clear field`),slotProps:{popper:{sx:Q.tooltip}},children:m(x,{size:`large`,tabIndex:-1,onClick:()=>this.setAliasItem(y,`id.write`,``),children:m(b,{})})})}):null}},onChange:e=>this.setAliasItem(y,`id.write`,e.target.value),margin:`normal`}),m(se,{style:Q.button,size:`small`,onClick:()=>this.setState({selectId:!1,selectRead:!1,selectWrite:!0}),children:`...`})]}):null,m(O,{style:Q.marginTop,children:m(fe,{control:m(ue,{checked:((f=y.common)==null||(f=f.alias)==null?void 0:f.read)!==void 0||((p=y.common)==null||(p=p.alias)==null?void 0:p.write)!==void 0,onChange:()=>{S?(delete y.common.alias.read,delete y.common.alias.write):(y.common=y.common||{},y.common.alias=y.common.alias||{},y.common.alias.read=`val`,y.common.alias.write=`val`),this.onChange(JSON.stringify(y,null,2))}}),label:this.props.t(`Use convert functions`)})}),S?m(O,{children:m(j,{variant:`standard`,label:this.props.t(`Read converter`),value:((h=y.common)==null||(h=h.alias)==null?void 0:h.read)||`val`,style:Q.funcEdit,error:!!this.state.readError,slotProps:{input:{endAdornment:(g=y.common)!=null&&(g=g.alias)!=null&&g.read?m(F,{position:`end`,children:m(P,{title:T.t(`Clear field`),slotProps:{popper:{sx:Q.tooltip}},children:m(x,{size:`large`,tabIndex:-1,onClick:()=>this.setAliasItem(y,`read`,``),children:m(b,{})})})}):null,startAdornment:m(F,{position:`start`,children:m(Ue,{style:Q.funcIcon})})}},onChange:e=>this.setAliasItem(y,`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?m(O,{children:m(j,{variant:`standard`,label:this.props.t(`Write converter`),error:!!this.state.writeError,value:((_=y.common)==null||(_=_.alias)==null?void 0:_.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:(v=y.common)!=null&&(v=v.alias)!=null&&v.write?m(F,{position:`end`,children:m(P,{title:T.t(`Clear field`),slotProps:{popper:{sx:Q.tooltip}},children:m(x,{size:`large`,tabIndex:-1,onClick:()=>this.setAliasItem(y,`write`,``),children:m(b,{})})})}):null,startAdornment:m(F,{position:`start`,children:m(Ue,{style:Q.funcIcon})})}},onChange:e=>this.setAliasItem(y,`write`,e.target.value),margin:`normal`})}):null]})}catch{return m(`div`,{children:this.props.t(`Cannot parse JSON!`)})}}onCopy(e){k.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?D(a,{open:!0,maxWidth:`md`,fullWidth:!0,onClose:()=>this.setState({showCopyDialog:``}),onKeyDown:e=>it(e,()=>{this.props.objects[this.state.newId]||(this.setState({showCopyDialog:``}),this.onClone(this.state.showCopyDialog,this.state.newId))}),children:[m(w,{children:this.props.t(`Enter new ID for this object`)}),m(C,{children:m(j,{variant:`standard`,autoFocus:!0,fullWidth:!0,label:this.props.t(`New object ID`),value:this.state.newId,slotProps:{input:{endAdornment:this.state.newId?m(F,{position:`end`,children:m(P,{title:T.t(`Clear field`),slotProps:{popper:{sx:Q.tooltip}},children:m(x,{size:`small`,tabIndex:-1,onClick:()=>this.setState({newId:``}),children:m(b,{})})})}):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})})}),D(Me,{children:[m(L,{disabled:!!this.props.objects[this.state.newId],onClick:()=>{this.setState({showCopyDialog:``}),this.onClone(this.state.showCopyDialog,this.state.newId)},color:`primary`,startIcon:m(Ct,{}),children:this.props.t(`Clone`)}),m(L,{color:`grey`,onClick:()=>this.setState({showCopyDialog:``}),startIcon:m(b,{}),children:this.props.t(`Cancel`)})]})]}):null}renderPanelObject(e){return D(`div`,{style:{...Q.divWithoutTitle,...e?Q.divWithoutTitleAndTab:void 0,...this.state.error?Q.error:void 0},children:[m(ct,{value:this.state.text,onChange:e=>this.onChange(e),onCtrlEnter:this.onCtrlEnter,name:`UNIQUE_ID_OF_DIV`,themeType:this.props.themeType}),this.state.showCommonDeleteMessage?m(`div`,{style:Q.commonDeleteTip,children:T.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 D(a,{sx:{"& .MuiPaper-root":n},open:!0,maxWidth:`xl`,fullWidth:!0,fullScreen:!1,onClose:()=>this.props.onClose(),onKeyDown:e=>it(e,this.onCtrlEnter),"aria-labelledby":`edit-value-dialog-title`,"aria-describedby":`edit-value-dialog-description`,children:[D(w,{id:`edit-value-dialog-title`,style:{width:`calc(100% - 32px)`,overflow:`hidden`,textOverflow:`ellipsis`},children:[this.props.t(`Edit object:`),` `,m(A,{component:`span`,style:Q.id,sx:{fontSize:{xs:10}},children:this.props.obj._id})]}),this.renderTabs(r),this.renderCopyDialog(),D(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()]}),D(Me,{sx:Q.wrapperButton,children:[m(L,{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:m(Ct,{fontSize:this.props.width===`xs`?`large`:void 0})}),m(`div`,{style:{flexGrow:1}}),this.state.tab===`object`&&m(L,{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:m(oe,{}),children:this.props.width===`xs`?m(oe,{fontSize:32}):this.props.t(`Copy into clipboard`)}),m(P,{title:this.props.t(`Press CTRL+ENTER to confirm`),slotProps:{popper:{sx:Q.tooltip}},children:m(`span`,{children:m(L,{variant:`contained`,disabled:this.state.error||!this.state.changed||this.state.customError,onClick:()=>this.onUpdate(),startIcon:this.props.width===`xs`?void 0:m(pe,{}),color:`primary`,children:this.props.width===`xs`?m(pe,{fontSize:`large`}):this.props.t(`Write`)})})}),m(L,{color:`grey`,variant:`contained`,onClick:()=>this.props.onClose(),startIcon:this.props.width===`xs`?void 0:m(b,{}),children:this.props.width===`xs`?m(b,{fontSize:`large`}):this.props.t(`Cancel`)})]})]})}};d();var Bl=class e extends Ye{constructor(e){super(e),E(this,`object`,null),E(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 D(a,{open:!0,maxWidth:`sm`,fullWidth:!0,onClose:()=>this.props.onClose(),onKeyDown:e=>it(e,this.onCtrlEnter),"aria-labelledby":`edit-role-dialog-title`,"aria-describedby":`edit-role-dialog-description`,children:[m(w,{id:`edit-role-dialog-title`,children:this.object?this.props.t(`Update role for %s`,this.object._id):null}),m(C,{children:m(we,{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=>m(j,{variant:`standard`,...e,label:this.props.t(`Role`)})})}),D(Me,{children:[m(P,{title:this.props.t(`Press CTRL+ENTER to confirm`),children:m(`span`,{children:m(L,{disabled:this.state.initRole===this.state.roleInput,variant:`contained`,onClick:()=>this.onUpdate(),color:`primary`,startIcon:m(pe,{}),children:this.props.t(`Apply`)})})}),m(L,{variant:`contained`,onClick:()=>this.props.onClose(),color:`grey`,startIcon:m(b,{}),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:o,initialType:c,initialStateType:l})=>{var u;let d={state:T.t(`New state`),channel:T.t(`New channel`),device:T.t(`New device`),folder:T.t(`New folder`)},f=[],p=(u=i[n])==null?void 0:u.type;i[n]?p===`channel`?(f.push(Ul.state),c||=`state`):p===`device`?(c||=`channel`,f.push(Ul.state),f.push(Ul.channel)):p===`state`?c||=``:(f.push(Ul.state),f.push(Ul.channel),f.push(Ul.device),n.startsWith(`0_userdata.`)||n.startsWith(`alias.0.`)||n===`0_userdata`||n===`alias.0`?(f.push(Ul.folder),c||=`folder`):c||=`state`):(f.push(Ul.folder),c||=`folder`,o&&(n.startsWith(`mqtt.`)||n.startsWith(`javascript.`))&&(f.push(Ul.state),f.push(Ul.channel),f.push(Ul.device)));let h=(window._localStorage||window.localStorage).getItem(`App.lastObjectType`);h&&f.find(e=>e.value===h)&&(c=h);function g(e){return`${n}.${e.toString().replace(k.FORBIDDEN_CHARS,`_`).replace(/\s/g,`_`).replace(/\./g,`_`)}`}let[_,y]=N(c),[S,ee]=N(d[c]),[te,ne]=N(l||(window._localStorage||window.localStorage).getItem(`App.lastStateType`)||`string`),[re,ie]=N(!i[g(d.state)]),ae=()=>{let e={common:{name:S,desc:T.t(`Manually created`)},type:_};_===`state`?(e.common={...e.common,role:`state`,type:te,read:!0,write:!0,def:Hl[te]},e.native={}):_===`folder`?delete e.common.desc:e.common={...e.common,role:``,icon:``},r(`${n}.${S.split(` `).join(`_`)}`,e).then(()=>t())},oe=T.getLanguage(),se=!S||!_||!re||_===`state`&&!te;return D(a,{open:!0,fullWidth:!0,maxWidth:`md`,onClose:e,onKeyDown:e=>it(e,()=>{se||ae()}),children:[m(w,{children:D(`div`,{style:{margin:10,fontSize:20,display:`flex`,alignItems:`center`,gap:8},children:[m(zt,{}),T.t(`Add new object:`),D(`span`,{style:{fontStyle:`italic`},children:[n,`.`,S]})]})}),m(C,{children:D(`div`,{style:{display:`flex`,flexDirection:`column`},children:[m(j,{variant:`standard`,label:T.t(`Parent`),style:{margin:`5px 0`},disabled:!0,value:n}),D(s,{variant:`standard`,style:{marginTop:10,marginBottom:16},children:[m(v,{children:T.t(`Type`)}),m(ze,{variant:`standard`,value:_,onChange:e=>{(window._localStorage||window.localStorage).setItem(`App.lastObjectType`,e.target.value),S===d[_]&&(ee(d[e.target.value]),ie(!!i[g(d[e.target.value])])),y(e.target.value)},children:f.map(e=>D(M,{value:e.value,children:[T.t(e.name),oe!==`en`&&D(`span`,{style:{fontSize:`smaller`,opacity:.6,marginLeft:4},children:[`(`,e.value,`)`]})]},e.value))})]}),_===`state`&&D(s,{style:{marginTop:10,marginBottom:16},children:[m(v,{style:{left:-14},children:T.t(`State type`)}),m(ze,{style:{marginTop:6},variant:`standard`,value:te,onChange:e=>{(window._localStorage||window.localStorage).setItem(`App.lastStateType`,e.target.value),ne(e.target.value)},children:Vl.map(e=>D(M,{value:e,children:[T.t(e),oe!==`en`&&T.t(e)!==e&&D(`span`,{style:{fontSize:`smaller`,opacity:.6,marginLeft:4},children:[`(`,e,`)`]})]},e))})]}),m(j,{variant:`standard`,label:T.t(`Name`),style:{margin:`5px 0`},autoFocus:!0,value:S,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),S&&ae())},slotProps:{input:{endAdornment:S?m(F,{position:`end`,children:m(x,{tabIndex:-1,size:`small`,onClick:()=>ee(``),children:m(b,{})})}):null}},onChange:e=>{ie(!i[g(e.target.value)]),ee(e.target.value)}})]})}),D(Me,{children:[m(P,{title:T.t(`Press CTRL+ENTER to confirm`),children:m(`span`,{children:m(L,{id:`add-new-object-dialog-add`,startIcon:m(pe,{}),disabled:se,onClick:()=>ae(),variant:`contained`,color:`primary`,children:T.t(`add`)})})}),m(L,{id:`add-new-object-dialog-cancel`,color:`grey`,onClick:e,variant:`contained`,startIcon:m(b,{}),children:T.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})=>{Ge(()=>{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,l=e;for(let e of Gl)for(let t of e[Object.keys(e)[0]])l-t.valueNum>=0&&(l-=t.valueNum,c.add(t.valueNum));return m(`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 D(`div`,{style:{width:150,height:150,display:`flex`,flexDirection:`column`,alignItems:`center`,borderLeft:`1px solid`},children:[m(`div`,{style:{height:50,display:`flex`,alignItems:`center`,fontSize:18,borderBottom:`1px solid silver`,width:`100%`,justifyContent:`center`},children:n(i)}),m(`div`,{style:{display:`flex`,width:`100%`},children:r[i].map((r,i)=>{let l=c.has(r.valueNum),u=a&r.valueNum;return D(`div`,{style:{display:`flex`,flexDirection:`column`,flex:1,alignItems:`center`,borderRight:i===0?`1px solid`:0},children:[m(`div`,{style:{height:50,borderBottom:`1px solid`,width:`100%`,justifyContent:`center`,display:`flex`,alignItems:`center`,color:`silver`},children:n(r.name)}),m(`div`,{style:{height:50,display:`flex`},children:m(ue,{disabled:s,checked:l,color:u?`primary`:`secondary`,indeterminate:!!u,style:u?{opacity:.5}:void 0,onChange:n=>{u&&(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:c,theme:l})=>{let[u,d]=N(void 0),[f,p]=N(void 0),[h,g]=N([]),[_,y]=N([]),[b,x]=N(!1),[S,ee]=N(!1),[C,te]=N(0),[ne,re]=N(null),[w,ie]=N(null),[ae,oe]=N(!1),[se,ce]=N(!1),[le,ue]=N([]),[E,de]=N([]),[fe,pe]=N(0),[O,ge]=N(0),[_e,ve]=N([]),[ye,be]=N(!1),[xe,Ce]=N(!0),we=a(`different`);return Ge(()=>{let e=0,t=[],r=[],a=n||o,s=`${a}.`,c=Object.keys(i).sort(),l=!1,u=[],f=[],m=T.getLanguage(),h=!1,_=!1,v=null,b=null,S=null,C=null,ne=[];for(let n=0;n<c.length;n++){let o=c[n],d=i[o];if(d&&(o===a||o.startsWith(s))){var w,le,E,D,fe,pe,O,me,he,ge,_e,ye,be,xe;if(e++,ne.push(o),!d.acl)continue;if(S===null&&((w=d.acl)==null?void 0:w.object)!==void 0){var Se;S=(Se=d.acl)==null?void 0:Se.object}if(C===null&&((le=d.acl)==null?void 0:le.state)!==void 0){var Ce;C=((Ce=d.acl)==null?void 0:Ce.state)??null}if(v===null&&((E=d.acl)==null?void 0:E.owner)!==void 0){var we;v=(we=d.acl)==null?void 0:we.owner}if(b===null&&((D=d.acl)==null?void 0:D.ownerGroup)!==void 0){var Te;b=(Te=d.acl)==null?void 0:Te.ownerGroup}if(!ae&&v!==((fe=d.acl)==null?void 0:fe.owner)&&((pe=d.acl)==null?void 0:pe.owner)!==void 0&&(h=!0),!se&&b!==((O=d.acl)==null?void 0:O.ownerGroup)&&((me=d.acl)==null?void 0:me.ownerGroup)!==void 0&&(_=!0),((he=d.acl)==null?void 0:he.state)!==void 0&&C!==((ge=d.acl)==null?void 0:ge.state)&&!t.includes((_e=d.acl)==null?void 0:_e.state)){var Ee;t.push((Ee=d.acl)==null?void 0:Ee.state)}if(((ye=d.acl)==null?void 0:ye.object)!==void 0&&S!==((be=d.acl)==null?void 0:be.object)&&!r.includes((xe=d.acl)==null?void 0:xe.object)){var De;r.push((De=d.acl)==null?void 0:De.object)}d.type===`state`&&(l=!0)}if(o.startsWith(`system.group.`)&&(d==null?void 0:d.type)===`group`){var A,Oe;u.push({name:k.getObjectNameFromObj(d,m).replace(`system.group.`,``),value:o,icon:(A=d.common)==null?void 0:A.icon,color:(Oe=d.common)==null?void 0:Oe.color})}else if(o.startsWith(`system.user.`)&&(d==null?void 0:d.type)===`user`){var ke,Ae;f.push({name:k.getObjectNameFromObj(d,m).replace(`system.user.`,``),value:o,icon:(ke=d.common)==null?void 0:ke.icon,color:(Ae=d.common)==null?void 0:Ae.color})}}v||=i[`system.config`].common.defaultNewAcl.owner,b||=i[`system.config`].common.defaultNewAcl.ownerGroup,S||=i[`system.config`].common.defaultNewAcl.object,re(Number.isNaN(S)?i[`system.config`].common.defaultNewAcl.object:S),l&&(C||=i[`system.config`].common.defaultNewAcl.state,ie(Number.isNaN(C)?i[`system.config`].common.defaultNewAcl.state:C));let je=f.find(e=>e.value===v),Me=u.find(e=>e.value===b);d(je),p(Me),oe(h),ce(_),g(f),y(u),l&&ee(!0),o&&x(!0),te(e),ue(t),de(r),ve(ne)},[i,n,se,ae,o]),Ge(()=>{if(b)se&&((f==null?void 0:f.value)!==`different`&&p({name:we,value:`different`}),_.find(e=>e.value===`different`)||y(e=>[{name:we,value:`different`},...e])),ae&&(u&&u.value===`different`||d({name:we,value:`different`}),h.find(e=>e.value===`different`)||g(e=>[{name:we,value:`different`},...e]));else{if(u&&u.value===`different`){var e;d((e=i[n].acl)==null?void 0:e.owner)}if(f&&f.value===`different`){var t;p((t=i[n].acl)==null?void 0:t.ownerGroup)}y(e=>e.filter(({value:e})=>e!==`different`)),g(e=>e.filter(({value:e})=>e!==`different`))}},[h,b,ae,se,i,n,f,u,we,_]),_e.length?m(xt,{theme:l,titleButtonApply:`apply`,overflowHidden:!0,disableApply:xe,progress:ye,onClose:e,onApply:()=>{be(!0),setTimeout(()=>{if(b){let t=~fe&65535,n=~O&65535;for(let o=0;o<_e.length;o++){var e;let s=_e[o],c=i[s],l=k.clone(c.acl||{});if(l.object=Kl(((e=c.acl)==null?void 0:e.object)??0,ne??0,t),u&&u.value!==`different`&&(l.owner=u.value),f&&f.value!==`different`&&(l.ownerGroup=f.value),c.type===`state`){var a;l.state=Kl(((a=c.acl)==null?void 0:a.state)??0,w??0,n)}r(s,{acl:l})}}else{let e=k.clone(i[n].acl||{});e.object=ne??0,e.owner=u?u.value:`system.user.admin`,e.ownerGroup=f?f.value:`system.group.administrator`,i[n].type===`state`&&(e.state=w??0),r(n,{acl:e})}be(!1),t()},200)},children:D(`div`,{style:{display:`flex`,flexDirection:`column`},children:[m(`div`,{style:{margin:10,fontSize:20},children:a(`Access control list: %s`,n||o)}),D(`div`,{style:{display:`flex`},children:[D(s,{variant:`standard`,fullWidth:!0,style:{marginRight:10},children:[m(v,{children:a(`Owner user`)}),m(ze,{variant:`standard`,disabled:ye,value:u?u.value:``,renderValue:()=>D(`span`,{children:[u!=null&&u.icon?m(Se,{src:u.icon,style:{width:16,height:16,marginRight:8}}):null,u?u.name:``]}),style:(u==null?void 0:u.value)===`different`?{opacity:.5}:{color:(u==null?void 0:u.color)||void 0,backgroundColor:k.getInvertedColor(u==null?void 0:u.color,c)},onChange:e=>{let t=h.find(t=>t.value===e.target.value);d(t),Ce(!1)},children:h.map(e=>D(M,{style:e.value===`different`?{opacity:.5}:{color:e.color||void 0,backgroundColor:k.getInvertedColor(e.color,c)},value:e.value,children:[e.icon?m(Se,{src:e.icon,style:{width:16,height:16,marginRight:8}}):null,e.name]},e.value))})]}),D(s,{variant:`standard`,fullWidth:!0,children:[m(v,{children:a(`Owner group`)}),m(ze,{variant:`standard`,disabled:ye,value:f?f.value:``,renderValue:()=>D(`span`,{children:[f!=null&&f.icon?m(Se,{src:f.icon,style:{width:16,height:16,marginRight:8}}):null,f?f.name:``]}),style:(f==null?void 0:f.value)===`different`?{opacity:.5}:{color:(f==null?void 0:f.color)||void 0,backgroundColor:k.getInvertedColor(f==null?void 0:f.color,c)},onChange:e=>{let t=_.find(t=>t.value===e.target.value);p(t),Ce(!1)},children:_.map(e=>D(M,{value:e.value,style:e.value===`different`?{opacity:.5}:{color:e.color||void 0,backgroundColor:k.getInvertedColor(e.color,c)},children:[e.icon?m(Se,{src:e.icon,style:{width:16,height:16,marginRight:8}}):null,e.name]},e.value))})]})]}),D(`div`,{style:{display:`flex`,margin:10,alignItems:`center`,fontSize:10,marginLeft:0,color:`silver`},children:[m(`div`,{style:b?void 0:{color:`green`},children:a(`to apply one item`)}),m(he,{disabled:ye||!!o||C===1,checked:!!o||b,onChange:e=>{x(e.target.checked),Ce(!1)},color:`primary`}),D(`div`,{style:b?{color:`green`}:void 0,children:[a(`to apply with children`),` `,o||C>1?`(${C} ${a(`object(s)`)})`:``]})]}),ye&&m(me,{}),D(`div`,{style:{overflowY:`auto`},children:[D(`div`,{children:[m(`h2`,{children:a(`Object rights`)}),m(ql,{mask:O,disabled:ye,setMask:ge,applyToChildren:b,differentValues:E,t:a,setValue:e=>{re(e),Ce(!1)},value:ne??0})]}),S&&D(`div`,{children:[m(`h2`,{children:a(`States rights`)}),m(ql,{mask:fe,disabled:ye,setMask:pe,applyToChildren:b,differentValues:b?le:[],t:a,setValue:e=>{ie(e),Ce(!1)},value:w??0})]})]})]})}):m(me,{})};d();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 Ye{constructor(e){super(e),E(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=Ve.createRef()}componentDidMount(){this.props.socket.getBinaryState(this.props.obj._id).then(e=>{e||=``;let t=this.props.obj._id.toLowerCase().split(`.`).pop(),n=k.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 D(a,{style:Yl.dialog,open:!0,maxWidth:this.state.audio?`sm`:`md`,onClose:()=>this.props.onClose(),fullWidth:!0,"aria-labelledby":`object-view-dialog-title`,children:[m(w,{id:`object-view-dialog-title`,children:this.props.t(`View file in state: %s`,this.props.obj._id)}),D(C,{style:Yl.content,children:[this.state.error?m(A,{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?m(`audio`,{ref:this.audioRef,src:`data:${this.state.mime};base64,${this.state.binary}`}):null,this.state.audio?m(se,{color:`primary`,onClick:()=>this.audioRef.current&&this.audioRef.current.play(),children:m(h,{})}):null,this.state.image?m(`img`,{src:`data:${this.state.mime};base64,${this.state.binary}`,alt:this.props.obj._id,style:Yl.image}):null,this.state.text===null?null:m(`pre`,{style:Yl.text,children:this.state.text})]}),D(Me,{children:[D(`a`,{style:Yl.download,download:this.state.fileName,href:`data:${this.state.mime};base64,${this.state.binary}`,children:[m(Lt,{style:{paddingRight:8,height:12}}),m(`span`,{children:this.props.t(`Download`)})]}),m(L,{variant:`contained`,onClick:()=>this.props.onClose(),startIcon:m(b,{}),color:`grey`,children:this.props.t(`Close`)})]})]})}};d();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=le(),$l=class e extends Ye{constructor(t){super(t),E(this,`aliasIDs`,void 0),E(this,`aliasFolders`,void 0),E(this,`sourceName`,void 0),E(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[T.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?D(a,{open:!0,onClose:()=>this.setState({showAddNewAlias:!1}),onKeyDown:e=>it(e,()=>{this.state.newAliasId&&!this.props.objects[`alias.0.${this.state.newAliasId}`]&&this.onCreateAlias()}),children:[m(w,{children:T.t(`Create new alias: %s`,`alias.0.${this.state.newAliasId}`)}),D(C,{children:[m(we,{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=>m(j,{variant:`standard`,...e,label:T.t(`Alias ID`),helperText:`alias.0.${this.state.newAliasId}`}),fullWidth:!0}),m(j,{style:$.formControlLabel,variant:`standard`,value:this.state.newAliasName,slotProps:{input:{endAdornment:this.state.newAliasName?m(F,{position:`end`,children:m(x,{tabIndex:-1,size:`small`,onClick:()=>this.setState({newAliasName:``}),children:m(b,{})})}):null}},onChange:e=>this.setState({newAliasName:e.target.value}),label:T.t(`Alias name`),fullWidth:!0}),m(j,{style:$.formControlLabel,variant:`standard`,value:this.state.newAliasDesc,slotProps:{input:{endAdornment:this.state.newAliasDesc?m(F,{position:`end`,children:m(x,{tabIndex:-1,size:`small`,onClick:()=>this.setState({newAliasDesc:``}),children:m(b,{})})}):null}},onChange:e=>this.setState({newAliasDesc:e.target.value}),label:T.t(`Alias description`),fullWidth:!0}),D(s,{style:$.formControlLabel,fullWidth:!0,children:[m(v,{children:T.t(`State type`)}),m(ze,{variant:`standard`,value:this.state.newAliasType,onChange:e=>this.setState({newAliasType:e.target.value}),children:Zl.map(e=>D(M,{value:e,children:[T.t(e),D(`span`,{style:$.typeNameEng,children:[`(`,e,`)`]})]},e))})]}),this.state.newAliasType===`number`?m(j,{style:$.formControlLabel,variant:`standard`,value:this.state.newAliasUnit||``,slotProps:{input:{endAdornment:this.state.newAliasUnit?m(F,{position:`end`,children:m(x,{tabIndex:-1,size:`small`,onClick:()=>this.setState({newAliasUnit:``}),children:m(b,{})})}):null}},onChange:e=>this.setState({newAliasUnit:e.target.value}),label:T.t(`Alias units`),fullWidth:!0}):null,this.state.newAliasType===`number`?m(j,{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:T.t(`Min`),style:{width:`calc(50% - 4px)`,marginBottom:16,marginRight:8}}):null,this.state.newAliasType===`number`?m(j,{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:T.t(`Max`),fullWidth:!0,style:{width:`calc(50% - 4px)`,marginBottom:16}}):null,m(j,{variant:`standard`,style:{...$.formControlLabel,...$.color},label:T.t(`Color`),type:`color`,value:this.state.newAliasColor,onChange:e=>this.setState({newAliasColor:e.target.value})}),m(we,{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=>m(j,{variant:`standard`,...e,label:T.t(`Role`)})}),m(fe,{style:{...$.formControlLabel,marginLeft:16},control:m(ue,{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:T.t(`Alias read`)}),m(fe,{style:$.formControlLabel,control:m(ue,{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:T.t(`Alias write`)}),this.props.obj.common.states?m(fe,{style:$.formControlLabel,control:m(ue,{checked:this.state.newAliasCopyStates,onChange:e=>this.setState({newAliasCopyStates:e.target.checked})}),label:T.t(`Copy states`)}):null,m(fe,{style:$.formControlLabel,control:m(ue,{checked:this.state.newAliasUseFormula,onChange:e=>this.setState({newAliasUseFormula:e.target.checked})}),label:T.t(`Use convert functions`)}),this.state.newAliasUseFormula&&this.state.newAliasRead?m(j,{style:$.formControlLabel,variant:`standard`,value:this.state.newAliasReadFormula,onChange:e=>this.setState({newAliasReadFormula:e.target.value}),label:T.t(`Read formula`),helperText:`${T.t(`JS function like`)} "val / 5 + 21"`,slotProps:{input:{endAdornment:this.state.newAliasReadFormula&&this.state.newAliasReadFormula!==`val`?m(F,{position:`end`,children:m(x,{tabIndex:-1,size:`small`,onClick:()=>this.setState({newAliasReadFormula:`val`}),children:m(b,{})})}):null,startAdornment:m(F,{position:`start`,children:m(Ue,{style:$.funcIcon})})}},fullWidth:!0}):null,this.state.newAliasUseFormula&&this.state.newAliasWrite?m(j,{style:$.formControlLabel,variant:`standard`,value:this.state.newAliasWriteFormula,onChange:e=>this.setState({newAliasWriteFormula:e.target.value}),label:T.t(`Write formula`),slotProps:{input:{endAdornment:this.state.newAliasWriteFormula&&this.state.newAliasWriteFormula!==`val`?m(F,{position:`end`,children:m(x,{tabIndex:-1,size:`small`,onClick:()=>this.setState({newAliasWriteFormula:`val`}),children:m(b,{})})}):null,startAdornment:m(F,{position:`start`,children:m(Ue,{style:$.funcIcon})})}},helperText:`${T.t(`JS function like`)} "val / 5 + 21"`,fullWidth:!0}):null]}),D(Me,{children:[m(P,{title:T.t(`Press CTRL+ENTER to confirm`),children:m(`span`,{children:m(L,{variant:`contained`,disabled:!this.state.newAliasId||!!this.props.objects[`alias.0.${this.state.newAliasId}`],onClick:()=>void this.onCreateAlias(),startIcon:m(Vt,{}),color:`primary`,children:this.props.t(`Create`)})})}),m(L,{variant:`contained`,onClick:()=>this.setState({showAddNewAlias:!1}),startIcon:m(b,{}),color:`grey`,children:this.props.t(`Close`)})]})]}):null}render(){return D(a,{open:!0,maxWidth:`sm`,onClose:()=>this.props.onClose(),fullWidth:!0,"aria-labelledby":`object-alias-dialog-title`,children:[this.renderAddNewAlias(),m(w,{id:`object-alias-dialog-title`,children:this.state.usedInAliases.length?T.t(`This object is used in aliases`):T.t(`This object does not used in any aliases yet`)}),m(C,{children:D(Je,{style:{maxWidth:400},children:[this.state.usedInAliases.map(e=>D(M,{style:$.usedInAlias,onClick:()=>this.props.onRedirect(e),children:[m(Re,{children:m(ne,{fontSize:`small`})}),m(We,{children:e})]},e)),D(M,{onClick:()=>this.setState({showAddNewAlias:!0}),sx:$.addNewAlias,children:[m(Re,{children:m(Vt,{fontSize:`small`})}),m(We,{children:T.t(`Create alias from this ID`)})]})]})}),m(Me,{children:m(L,{variant:`contained`,onClick:()=>this.props.onClose(),startIcon:m(b,{}),color:`grey`,children:this.props.t(`Close`)})})]},`editAlias`)}};d();var eu=class e extends Ye{constructor(e){super(e),E(this,`checkTimer`,null),E(this,`objects`,{}),E(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())}),E(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?D(a,{open:!0,onClose:()=>this.setState({showHistoryWarning:!1}),onKeyDown:e=>it(e,()=>void this.onConfirmHistoryWarning()),children:[m(w,{children:this.props.t(`Found states with history`)}),D(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(`, `)}`,m(`div`,{children:this.props.t(`move_states_with_history_warning`)})]}),D(Me,{children:[m(P,{title:this.props.t(`Press CTRL+ENTER to confirm`),children:m(L,{variant:`contained`,color:`primary`,onClick:()=>void this.onConfirmHistoryWarning(),startIcon:m(pe,{}),children:this.props.t(`Confirm`)})}),m(L,{color:`grey`,variant:`contained`,startIcon:m(b,{}),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?m(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 D(a,{open:!0,maxWidth:`md`,fullWidth:!0,onClose:()=>this.props.onClose(),onKeyDown:e=>it(e,()=>void this.onCtrlEnter()),children:[this.renderParentSelectorDialog(),this.showHistoryWarning(),D(w,{children:[D(`span`,{style:{opacity:.6,marginRight:8},children:[this.props.t(`Rename or copy object`),` -`]}),m(`span`,{style:{fontWeight:`bold`},children:this.props.id})]}),D(C,{children:[D(`div`,{style:{display:`flex`,gap:8,alignItems:`end`,opacity:.7},children:[m(j,{fullWidth:!0,variant:`standard`,label:this.props.t(`Parent ID`),value:`${this.state.parentId}.`,slotProps:{input:{readOnly:!0}}}),m(L,{variant:`outlined`,style:{maxWidth:40,width:40,height:32},onClick:()=>this.setState({showParentDialog:!0}),children:`...`})]}),m(j,{value:this.state.name,onChange:e=>{let t=e.target.value.replace(k.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?m(fe,{control:m(ue,{checked:this.state.renameAllChildren,onChange:()=>{this.setState({renameAllChildren:!this.state.renameAllChildren})}}),label:this.props.t(`Rename all children`)}):null,D(`div`,{children:[D(`span`,{style:{opacity:.6,marginRight:8,fontSize:16},children:[this.props.t(`New object ID`),`:`]}),m(`span`,{style:{fontWeight:`bold`,fontSize:16},children:e})]})]}),D(Me,{children:[m(L,{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`)}),m(P,{title:this.props.t(`Press CTRL+ENTER to confirm`),children:m(`span`,{children:m(L,{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`)})})}),m(L,{variant:`contained`,color:`grey`,onClick:()=>this.props.onClose(),startIcon:m(b,{}),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
28
|
background: #232323;
|
|
29
29
|
color: #929292
|
|
30
30
|
}
|
|
@@ -298,4 +298,4 @@ Defaulting to 2020, but this will stop working in the future.`)),t.ecmaVersion=1
|
|
|
298
298
|
.ace-chrome .ace_indent-guide-active {
|
|
299
299
|
background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAIGNIUk0AAHolAACAgwAA+f8AAIDpAAB1MAAA6mAAADqYAAAXb5JfxUYAAAAZSURBVHjaYvj///9/hivKyv8BAAAA//8DACLqBhbvk+/eAAAAAElFTkSuQmCC") right repeat-y;
|
|
300
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]=Ve.useState(``),r=Ve.useRef(()=>{}),i=!1;try{JSON.parse(t)}catch{i=!0}let o=()=>{!i&&t.trim()&&e.onClose(t)};return r.current=o,D(a,{style:iu.dialog,open:!0,maxWidth:`lg`,onClose:()=>e.onClose(),onKeyDown:e=>
|
|
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]=Ve.useState(``),r=Ve.useRef(()=>{}),i=!1;try{JSON.parse(t)}catch{i=!0}let o=()=>{!i&&t.trim()&&e.onClose(t)};return r.current=o,D(a,{style:iu.dialog,open:!0,maxWidth:`lg`,onClose:()=>e.onClose(),onKeyDown:e=>it(e,o),fullWidth:!0,children:[m(w,{children:e.t(`Insert JSON with objects here`)}),m(C,{style:{minHeight:500},children:m(Ae,{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:at,exec:()=>r.current()}]})}),D(Me,{children:[m(P,{title:e.t(`Press CTRL+ENTER to confirm`),children:m(`span`,{children:m(L,{variant:`contained`,disabled:i||!t.trim(),onClick:()=>e.onClose(t),startIcon:m(Xe,{}),color:`primary`,children:e.t(`Import objects`)})})}),m(L,{variant:`contained`,onClick:()=>e.onClose(),startIcon:m(b,{}),color:`grey`,children:e.t(`Close`)})]})]})}d();var ou=p,su={buttonIcon:{marginRight:4},buttonAll:{color:`#FF0000`},id:{fontStyle:`italic`},buttonText:{whiteSpace:`nowrap`}},cu=[`select`,`edit`,`settings`,`view`],lu=class e extends Ye{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),E(this,`dialogName`,void 0),E(this,`filters`,void 0),E(this,`t`,void 0),E(this,`wordCache`,void 0),E(this,`navigateTo`,null),E(this,`customDialog`,e=>m(Nl,{...e,socket:this.props.socket})),E(this,`valueDialog`,e=>m(Il,{...e,socket:this.props.socket,width:e.width??`md`})),E(this,`editObjectDialog`,e=>m(zl,{...e,socket:this.props.socket,width:e.width??`md`})),E(this,`editRoleDialog`,e=>m(Bl,{...e,socket:this.props.socket})),E(this,`viewFileDialog`,e=>m(Xl,{...e,socket:this.props.socket})),E(this,`aliasEditor`,e=>e.obj.type===`state`?m($l,{...e,obj:e.obj,socket:this.props.socket}):D(a,{open:!0,onClose:e.onClose,children:[m(w,{children:this.t(`Alias`)}),m(C,{children:this.t(`Object is not a state`)}),m(Me,{children:m(L,{onClick:e.onClose,children:this.t(`Close`)})})]})),E(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=o.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 m(_e,{anchorOrigin:{vertical:`bottom`,horizontal:`right`},open:!!this.state.toast,autoHideDuration:3e3,onClose:()=>this.setState({toast:``}),message:this.state.toast,action:m(x,{size:`small`,"aria-label":`close`,color:`inherit`,onClick:()=>this.setState({toast:``}),children:m(n,{fontSize:`small`})})},`toast`)}renderDeleteDialog(){return this.state.deleteObjectShow?D(a,{maxWidth:`md`,open:!0,onClose:()=>this.setState({deleteObjectShow:null}),"aria-labelledby":`delete-object-dialog-title`,"aria-describedby":`delete-object-dialog-description`,children:[D(w,{id:`delete-object-dialog-title`,children:[this.state.deleteObjectShow.hasChildren?this.t(`Delete object(s)`):this.t(`Delete object`),`:`,` `,m(`span`,{style:su.id,children:this.state.deleteObjectShow.id})]}),m(C,{children:m(te,{children:this.t(`Are you sure?`)})}),D(Me,{children:[this.state.deleteObjectShow.hasChildren?m(L,{variant:`contained`,color:`grey`,sx:{"& .MuiButton-text":su.buttonText},onClick:()=>this.onDelete(!0),startIcon:m(ou,{style:su.buttonAll}),children:this.t(`Delete with children`,this.state.deleteObjectShow.childrenCount)}):null,this.state.deleteObjectShow.exists?m(L,{variant:`contained`,sx:{"& .MuiButton-text":su.buttonText},onClick:()=>this.onDelete(!1),color:`primary`,startIcon:m(p,{}),autoFocus:!0,children:this.t(`Delete one item`)}):null,m(L,{variant:`contained`,color:`grey`,onClick:()=>this.setState({deleteObjectShow:null}),startIcon:m(n,{}),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=o.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(),m(u,{navigateTo:r,onNavigateTo:t=>{e.isAppDialogOpen()||(t!=null&&t.id?o.doNavigate(`tab-objects`,t.mode===`viewFile`?`view`:t.mode,t.id):o.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:o,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 m(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)=>m(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};
|