{"ast":null,"code":"import _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport _regeneratorRuntime from \"@babel/runtime/regenerator\";\nimport _asyncToGenerator from \"@babel/runtime/helpers/esm/asyncToGenerator\";\nimport _classCallCheck from \"@babel/runtime/helpers/esm/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/esm/createClass\";\nimport _assertThisInitialized from \"@babel/runtime/helpers/esm/assertThisInitialized\";\nimport _inherits from \"@babel/runtime/helpers/esm/inherits\";\nimport _possibleConstructorReturn from \"@babel/runtime/helpers/esm/possibleConstructorReturn\";\nimport _getPrototypeOf from \"@babel/runtime/helpers/esm/getPrototypeOf\";\nimport _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nimport { jsxs as _jsxs } from \"react/jsx-runtime\";\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }\n\nimport React from \"react\";\nimport Head from \"next/head\";\nimport api from \"../src/api\";\nexport var __N_SSP = true;\n\nvar Dashboard = /*#__PURE__*/function (_React$Component) {\n  _inherits(Dashboard, _React$Component);\n\n  var _super = _createSuper(Dashboard);\n\n  function Dashboard(props) {\n    var _this;\n\n    _classCallCheck(this, Dashboard);\n\n    _this = _super.call(this, props);\n\n    _defineProperty(_assertThisInitialized(_this), \"state\", {\n      dashboad: []\n    });\n\n    _defineProperty(_assertThisInitialized(_this), \"api\", void 0);\n\n    return _this;\n  }\n\n  _createClass(Dashboard, [{\n    key: \"render\",\n    value: function render() {\n      return /*#__PURE__*/_jsxs(\"div\", {\n        style: {\n          height: \"100%\",\n          width: \"100%\"\n        },\n        children: [/*#__PURE__*/_jsx(Head, {\n          children: /*#__PURE__*/_jsx(\"title\", {\n            children: \"dashboard\"\n          })\n        }), /*#__PURE__*/_jsx(\"div\", {\n          style: page,\n          children: this.state.dashboad\n        })]\n      });\n    }\n  }, {\n    key: \"componentDidMount\",\n    value: function () {\n      var _componentDidMount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {\n        return _regeneratorRuntime.wrap(function _callee$(_context) {\n          while (1) {\n            switch (_context.prev = _context.next) {\n              case 0:\n                this.api = new api(this.props.endpoint);\n                _context.next = 3;\n                return this.makeChild();\n\n              case 3:\n              case \"end\":\n                return _context.stop();\n            }\n          }\n        }, _callee, this);\n      }));\n\n      function componentDidMount() {\n        return _componentDidMount.apply(this, arguments);\n      }\n\n      return componentDidMount;\n    }()\n  }, {\n    key: \"makeChild\",\n    value: function () {\n      var _makeChild = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {\n        var result, data, views;\n        return _regeneratorRuntime.wrap(function _callee2$(_context2) {\n          while (1) {\n            switch (_context2.prev = _context2.next) {\n              case 0:\n                _context2.prev = 0;\n                _context2.next = 3;\n                return this.api.getDevices();\n\n              case 3:\n                result = _context2.sent;\n\n                if (result) {\n                  _context2.next = 6;\n                  break;\n                }\n\n                return _context2.abrupt(\"return\", null);\n\n              case 6:\n                data = result.data;\n\n                if (data) {\n                  views = [];\n                  Object.entries(data).filter(function (_ref) {\n                    var _ref2 = _slicedToArray(_ref, 2),\n                        key = _ref2[0],\n                        value = _ref2[1];\n\n                    var nodeAddress = key.split(\":\")[0];\n                    var status = value.showInDashboard ? \"DASHBOARD\" : value.status;\n\n                    if (value.platform === \"android\" && nodeAddress) {\n                      var view = /*#__PURE__*/_jsxs(\"div\", {\n                        style: page_view,\n                        children: [/*#__PURE__*/_jsx(\"div\", {\n                          style: {\n                            width: \"fit-content\",\n                            height: \"fit-content\"\n                          },\n                          children: /*#__PURE__*/_jsxs(\"div\", {\n                            children: [value.name, \" [\", status, \"]\"]\n                          })\n                        }), /*#__PURE__*/_jsx(\"iframe\", {\n                          height: \"750px\",\n                          width: \"500px\",\n                          src: \"http://\".concat(nodeAddress, \":8000/#!action=stream&udid=\").concat(value.udid, \"&player=mse&ws=ws%3A%2F%2F\").concat(nodeAddress, \"%3A8000%2F%3Faction%3Dproxy-adb%26remote%3Dtcp%253A8886%26udid%3D\").concat(value.udid),\n                          frameBorder: \"0\"\n                        })]\n                      }, \"\".concat(value.udid));\n\n                      views.push(view);\n                    }\n                  });\n                  this.setState({\n                    dashboad: views\n                  });\n                }\n\n                _context2.next = 13;\n                break;\n\n              case 10:\n                _context2.prev = 10;\n                _context2.t0 = _context2[\"catch\"](0);\n                console.error(_context2.t0);\n\n              case 13:\n              case \"end\":\n                return _context2.stop();\n            }\n          }\n        }, _callee2, this, [[0, 10]]);\n      }));\n\n      function makeChild() {\n        return _makeChild.apply(this, arguments);\n      }\n\n      return makeChild;\n    }()\n  }]);\n\n  return Dashboard;\n}(React.Component);\n\nexport { Dashboard as default };\nvar page = {\n  backgroundColor: \"rgb(248, 248, 248)\",\n  height: \"auto\",\n  width: \"auto\",\n  display: \"inline\"\n};\nvar page_view = {\n  height: \"fit-content\",\n  width: \"500px\",\n  display: \"inline-block\",\n  paddingTop: \"40px\",\n  alignItems: \"center\"\n};","map":null,"metadata":{},"sourceType":"module"}