"use strict";

exports.__esModule = true;
exports["default"] = void 0;

var _react = _interopRequireWildcard(require("react"));

var _next = require("@alifd/next");

function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }

function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

var DemoWrapper = function DemoWrapper(props) {
  var id = props.id,
      children = props.children;

  var _useState = (0, _react.useState)('screen'),
      mode = _useState[0],
      setMode = _useState[1];

  var _useState2 = (0, _react.useState)('dark'),
      theme = _useState2[0],
      setTheme = _useState2[1];

  var onChange = function onChange(checked) {
    // @ts-ignore
    window.__changeTheme__(checked ? '@alifd/theme-2' : '@alifd/theme-1');

    setTheme(checked ? 'light' : 'dark');
  };

  return /*#__PURE__*/_react["default"].createElement("div", {
    id: id,
    className: "demo-container iot-screen-main-body",
    "data-mode": mode,
    "data-theme": theme
  }, /*#__PURE__*/_react["default"].createElement(_next.Switch, {
    checkedChildren: "\u5927\u76D8",
    unCheckedChildren: "\u5927\u5C4F",
    style: {
      width: 80
    },
    onChange: function onChange(val) {
      setMode(val ? 'dashboard' : 'screen');
    }
  }), /*#__PURE__*/_react["default"].createElement(_next.Switch, {
    checkedChildren: "\u6D45\u8272",
    unCheckedChildren: "\u6DF1\u8272",
    onChange: onChange,
    style: {
      width: 80
    }
  }), /*#__PURE__*/_react["default"].createElement("div", {
    className: "container"
  }, children));
};

var _default = DemoWrapper;
exports["default"] = _default;