(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[433],{3388:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/app/data",function(){return t(2525)}])},2525:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return C}});var r=t(5893),a=t(7294),o=t(7948),i=t(4051),c=t.n(i),s=t(1163),u=t(2734),l=t(6886),d=t(1703),p=t(44),f=t(8456),m=t(6486),y=t(9375),b=t(5152),g=t(4267),h=t(5861),v=(0,b.default)((function(){return t.e(171).then(t.t.bind(t,5171,23))}),{loadableGenerated:{webpack:function(){return[5171]}},ssr:!1});var x=function(e){var n=e.name,t=e.data;return(0,r.jsxs)(g.Z,{children:[(0,r.jsx)(h.Z,{gutterBottom:!0,variant:"h4",component:"h3",children:n}),t?(0,r.jsx)(v,{src:t,displayDataTypes:!1,displayObjectSize:!0,enableClipboard:!0,iconStyle:"triangle",name:null,collapseStringsAfterLength:140,style:{background:"initial",maxWidth:"100%"},theme:"google"}):(0,r.jsx)(l.ZP,{container:!0,direction:"row",justifyContent:"center",children:(0,r.jsx)(f.Z,{})})]})};function j(e,n,t,r,a,o,i){try{var c=e[o](i),s=c.value}catch(u){return void t(u)}c.done?n(s):Promise.resolve(s).then(r,a)}function w(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}var k=["battery","bridge","cpu","disk","display","gpu","memory","network","sensors","system"],P={battery:"Battery",bridge:"Bridge",cpu:"CPU",disk:"Disk",display:"Display",gpu:"GPU",memory:"Memory",network:"Network",sensors:"Sensors",system:"System"},Z={battery:{},cpu:{},disk:{},memory:{},network:{},sensors:{},system:{}};var S=function(){var e=(0,a.useState)(Z),n=e[0],t=e[1],o=(0,a.useState)(!1),i=o[0],b=o[1],g=(0,a.useState)(0),h=g[0],v=g[1],S=(0,s.useRouter)().query,_=(0,a.useCallback)((function(e){console.log("Event:",e),"DATA_UPDATE"===e.type&&(console.log("Data update:",e.module,e.data),t((function(n){var t=(0,m.cloneDeep)(n);return"string"==typeof e.module&&(t[e.module]=e.data),t})))}),[]),C=(0,a.useCallback)((function(e,n){console.log("Setup WebSocketConnection");var t,r=new y.C(e,n,(t=c().mark((function e(){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r.getData(k),r.registerDataListener(k);case 2:case"end":return e.stop()}}),e)})),function(){var e=this,n=arguments;return new Promise((function(r,a){var o=t.apply(e,n);function i(e){j(o,r,a,i,c,"next",e)}function c(e){j(o,r,a,i,c,"throw",e)}i(void 0)}))}));r.onEvent=_}),[_]);(0,a.useEffect)((function(){!i&&S&&S.apiKey&&(b(!0),C(Number(S.apiPort)||9170,String(S.apiKey)))}),[i,C,S]);var D=(0,u.Z)();return(0,r.jsx)(r.Fragment,{children:(0,r.jsx)(l.ZP,{container:!0,direction:"column",spacing:2,alignItems:"stretch",sx:{padding:D.spacing(2)},children:(0,r.jsxs)(l.ZP,{container:!0,direction:"row",item:!0,xs:!0,children:[(0,r.jsx)(l.ZP,{item:!0,children:(0,r.jsx)(d.Z,{orientation:"vertical",variant:"scrollable",value:h,onChange:function(e,n){v(n)},children:k.map((function(e,n){return(0,r.jsx)(p.Z,function(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{},r=Object.keys(t);"function"===typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(t).filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})))),r.forEach((function(n){w(e,n,t[n])}))}return e}({label:P[e]},function(e){return{id:"scrollable-auto-tab-".concat(e),"aria-controls":"scrollable-auto-tabpanel-".concat(e)}}(n)),n)}))})}),(0,r.jsx)(l.ZP,{item:!0,xs:!0,children:k.map((function(e,t){return(0,r.jsx)(a.Fragment,{children:h===t?(0,r.jsx)(r.Fragment,{children:n[e]?(0,r.jsx)(x,{data:n[e],name:P[e]}):(0,r.jsx)(l.ZP,{container:!0,direction:"row",justifyContent:"center",sx:{margin:D.spacing(8,0,14)},children:(0,r.jsx)(f.Z,{})})}):""},t)}))})]})})})},_=t(2315);var C=function(){return(0,r.jsx)(_.Z,{title:"Data",url:"https://system-bridge.timmo.dev",description:"Frontend for System Bridge",children:(0,r.jsx)(o.Z,{component:"article",maxWidth:"xl",children:(0,r.jsx)(S,{})})})}}},function(e){e.O(0,[702,662,964,524,398,471,774,888,179],(function(){return n=3388,e(e.s=n);var n}));var n=e.O();_N_E=n}]);