@iobroker/adapter-react-v5 2.1.10 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/Components/FileBrowser.js +248 -222
  2. package/Components/FileBrowser.js.map +1 -1
  3. package/Components/FileViewer.js +219 -75
  4. package/Components/FileViewer.js.map +1 -1
  5. package/Components/JsonConfigComponent/ChipInput.js +926 -0
  6. package/Components/JsonConfigComponent/ChipInput.js.map +1 -0
  7. package/Components/JsonConfigComponent/ConfigAlive.js +135 -0
  8. package/Components/JsonConfigComponent/ConfigAlive.js.map +1 -0
  9. package/Components/JsonConfigComponent/ConfigAutocomplete.js +204 -0
  10. package/Components/JsonConfigComponent/ConfigAutocomplete.js.map +1 -0
  11. package/Components/JsonConfigComponent/ConfigAutocompleteSendTo.js +311 -0
  12. package/Components/JsonConfigComponent/ConfigAutocompleteSendTo.js.map +1 -0
  13. package/Components/JsonConfigComponent/ConfigCRON.js +195 -0
  14. package/Components/JsonConfigComponent/ConfigCRON.js.map +1 -0
  15. package/Components/JsonConfigComponent/ConfigCertificateSelect.js +178 -0
  16. package/Components/JsonConfigComponent/ConfigCertificateSelect.js.map +1 -0
  17. package/Components/JsonConfigComponent/ConfigCheckbox.js +112 -0
  18. package/Components/JsonConfigComponent/ConfigCheckbox.js.map +1 -0
  19. package/Components/JsonConfigComponent/ConfigChip.js +149 -0
  20. package/Components/JsonConfigComponent/ConfigChip.js.map +1 -0
  21. package/Components/JsonConfigComponent/ConfigColor.js +156 -0
  22. package/Components/JsonConfigComponent/ConfigColor.js.map +1 -0
  23. package/Components/JsonConfigComponent/ConfigCoordinates.js +165 -0
  24. package/Components/JsonConfigComponent/ConfigCoordinates.js.map +1 -0
  25. package/Components/JsonConfigComponent/ConfigCustomEasyAccess.js +180 -0
  26. package/Components/JsonConfigComponent/ConfigCustomEasyAccess.js.map +1 -0
  27. package/Components/JsonConfigComponent/ConfigDatePicker.js +117 -0
  28. package/Components/JsonConfigComponent/ConfigDatePicker.js.map +1 -0
  29. package/Components/JsonConfigComponent/ConfigGeneric.js +660 -0
  30. package/Components/JsonConfigComponent/ConfigGeneric.js.map +1 -0
  31. package/Components/JsonConfigComponent/ConfigIP.js +151 -0
  32. package/Components/JsonConfigComponent/ConfigIP.js.map +1 -0
  33. package/Components/JsonConfigComponent/ConfigImageUpload.js +215 -0
  34. package/Components/JsonConfigComponent/ConfigImageUpload.js.map +1 -0
  35. package/Components/JsonConfigComponent/ConfigInstanceSelect.js +197 -0
  36. package/Components/JsonConfigComponent/ConfigInstanceSelect.js.map +1 -0
  37. package/Components/JsonConfigComponent/ConfigJsonEditor.js +211 -0
  38. package/Components/JsonConfigComponent/ConfigJsonEditor.js.map +1 -0
  39. package/Components/JsonConfigComponent/ConfigLanguage.js +175 -0
  40. package/Components/JsonConfigComponent/ConfigLanguage.js.map +1 -0
  41. package/Components/JsonConfigComponent/ConfigNumber.js +194 -0
  42. package/Components/JsonConfigComponent/ConfigNumber.js.map +1 -0
  43. package/Components/JsonConfigComponent/ConfigObjectId.js +201 -0
  44. package/Components/JsonConfigComponent/ConfigObjectId.js.map +1 -0
  45. package/Components/JsonConfigComponent/ConfigPanel.js +421 -0
  46. package/Components/JsonConfigComponent/ConfigPanel.js.map +1 -0
  47. package/Components/JsonConfigComponent/ConfigPassword.js +236 -0
  48. package/Components/JsonConfigComponent/ConfigPassword.js.map +1 -0
  49. package/Components/JsonConfigComponent/ConfigPattern.js +94 -0
  50. package/Components/JsonConfigComponent/ConfigPattern.js.map +1 -0
  51. package/Components/JsonConfigComponent/ConfigSelect.js +163 -0
  52. package/Components/JsonConfigComponent/ConfigSelect.js.map +1 -0
  53. package/Components/JsonConfigComponent/ConfigSelectSendTo.js +258 -0
  54. package/Components/JsonConfigComponent/ConfigSelectSendTo.js.map +1 -0
  55. package/Components/JsonConfigComponent/ConfigSendto.js +282 -0
  56. package/Components/JsonConfigComponent/ConfigSendto.js.map +1 -0
  57. package/Components/JsonConfigComponent/ConfigSetState.js +266 -0
  58. package/Components/JsonConfigComponent/ConfigSetState.js.map +1 -0
  59. package/Components/JsonConfigComponent/ConfigStaticDivider.js +88 -0
  60. package/Components/JsonConfigComponent/ConfigStaticDivider.js.map +1 -0
  61. package/Components/JsonConfigComponent/ConfigStaticHeader.js +81 -0
  62. package/Components/JsonConfigComponent/ConfigStaticHeader.js.map +1 -0
  63. package/Components/JsonConfigComponent/ConfigStaticImage.js +88 -0
  64. package/Components/JsonConfigComponent/ConfigStaticImage.js.map +1 -0
  65. package/Components/JsonConfigComponent/ConfigStaticText.js +104 -0
  66. package/Components/JsonConfigComponent/ConfigStaticText.js.map +1 -0
  67. package/Components/JsonConfigComponent/ConfigTable.js +651 -0
  68. package/Components/JsonConfigComponent/ConfigTable.js.map +1 -0
  69. package/Components/JsonConfigComponent/ConfigTabs.js +166 -0
  70. package/Components/JsonConfigComponent/ConfigTabs.js.map +1 -0
  71. package/Components/JsonConfigComponent/ConfigText.js +170 -0
  72. package/Components/JsonConfigComponent/ConfigText.js.map +1 -0
  73. package/Components/JsonConfigComponent/ConfigTextSendTo.js +168 -0
  74. package/Components/JsonConfigComponent/ConfigTextSendTo.js.map +1 -0
  75. package/Components/JsonConfigComponent/ConfigTimePicker.js +111 -0
  76. package/Components/JsonConfigComponent/ConfigTimePicker.js.map +1 -0
  77. package/Components/JsonConfigComponent/ConfigTopic.js +140 -0
  78. package/Components/JsonConfigComponent/ConfigTopic.js.map +1 -0
  79. package/Components/JsonConfigComponent/ConfigUser.js +176 -0
  80. package/Components/JsonConfigComponent/ConfigUser.js.map +1 -0
  81. package/Components/JsonConfigComponent/index.js +511 -0
  82. package/Components/JsonConfigComponent/index.js.map +1 -0
  83. package/Components/Utils.js +25 -0
  84. package/Components/Utils.js.map +1 -1
  85. package/README.md +7 -1
  86. package/package.json +1 -1
@@ -0,0 +1,165 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports["default"] = void 0;
9
+
10
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
+
12
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
13
+
14
+ var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
15
+
16
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
17
+
18
+ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
19
+
20
+ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
21
+
22
+ var _react = _interopRequireDefault(require("react"));
23
+
24
+ var _propTypes = _interopRequireDefault(require("prop-types"));
25
+
26
+ var _styles = require("@mui/styles");
27
+
28
+ var _TextField = _interopRequireDefault(require("@mui/material/TextField"));
29
+
30
+ var _Fab = _interopRequireDefault(require("@mui/material/Fab"));
31
+
32
+ var _GpsFixed = _interopRequireDefault(require("@mui/icons-material/GpsFixed"));
33
+
34
+ var _i18n = _interopRequireDefault(require("@iobroker/adapter-react-v5/i18n"));
35
+
36
+ var _ConfigGeneric2 = _interopRequireDefault(require("./ConfigGeneric"));
37
+
38
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
39
+
40
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
41
+
42
+ var styles = function styles(theme) {
43
+ return {
44
+ width: {
45
+ width: 'calc(100% - 40px)'
46
+ }
47
+ };
48
+ };
49
+
50
+ var ConfigCoordinates = /*#__PURE__*/function (_ConfigGeneric) {
51
+ (0, _inherits2["default"])(ConfigCoordinates, _ConfigGeneric);
52
+
53
+ var _super = _createSuper(ConfigCoordinates);
54
+
55
+ function ConfigCoordinates() {
56
+ (0, _classCallCheck2["default"])(this, ConfigCoordinates);
57
+ return _super.apply(this, arguments);
58
+ }
59
+
60
+ (0, _createClass2["default"])(ConfigCoordinates, [{
61
+ key: "componentDidMount",
62
+ value: function componentDidMount() {
63
+ var _this = this;
64
+
65
+ (0, _get2["default"])((0, _getPrototypeOf2["default"])(ConfigCoordinates.prototype), "componentDidMount", this).call(this);
66
+
67
+ var value = _ConfigGeneric2["default"].getValue(this.props.data, this.props.attr);
68
+
69
+ if (!value && this.props.schema.autoInit) {
70
+ setTimeout(function () {
71
+ return _this.getCoordinates();
72
+ }, 300);
73
+ }
74
+ }
75
+ }, {
76
+ key: "getSystemCoordinates",
77
+ value: function getSystemCoordinates() {
78
+ var _this2 = this;
79
+
80
+ return this.props.socket.getSystemConfig().then(function (obj) {
81
+ if (obj && obj.common && (obj.common.longitude || obj.common.latitude)) {
82
+ window.alert(_i18n["default"].t('Used system settings'));
83
+
84
+ _this2.setState({
85
+ value: obj.common.latitude + (_this2.props.schema.divider || ',') + obj.common.longitude
86
+ });
87
+ } else {
88
+ window.alert(_i18n["default"].t('Cannot determine position: System settings are empty and GPS detection is disabled in browser'));
89
+ }
90
+ });
91
+ }
92
+ }, {
93
+ key: "getCoordinates",
94
+ value: function getCoordinates() {
95
+ var _this3 = this;
96
+
97
+ if (navigator.geolocation) {
98
+ navigator.geolocation.getCurrentPosition(function (position) {
99
+ if (position && position.coords) {
100
+ _this3.setState({
101
+ value: position.coords.latitude + (_this3.props.schema.divider || ',') + position.coords.longitude
102
+ });
103
+ } else {
104
+ _this3.getSystemCoordinates();
105
+ }
106
+ }, function (error) {
107
+ _this3.getSystemCoordinates();
108
+ });
109
+ } else {
110
+ this.getSystemCoordinates();
111
+ }
112
+ }
113
+ }, {
114
+ key: "renderItem",
115
+ value: function renderItem(error, disabled, defaultValue) {
116
+ var _this4 = this;
117
+
118
+ return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_TextField["default"], {
119
+ variant: "standard",
120
+ className: this.props.classes.width,
121
+ value: this.state.value === null || this.state.value === undefined ? '' : this.state.value,
122
+ error: !!error,
123
+ disabled: !!disabled,
124
+ inputProps: {
125
+ maxLength: this.props.schema.maxLength || this.props.schema.max || undefined
126
+ },
127
+ onChange: function onChange(e) {
128
+ var value = e.target.value;
129
+
130
+ _this4.setState({
131
+ value: value
132
+ }, function () {
133
+ return _this4.onChange(_this4.props.attr, (value || '').trim());
134
+ });
135
+ },
136
+ placeholder: this.getText(this.props.schema.placeholder),
137
+ label: this.getText(this.props.schema.label),
138
+ helperText: this.renderHelp(this.props.schema.help, this.props.schema.helpLink, this.props.schema.noTranslation)
139
+ }), /*#__PURE__*/_react["default"].createElement(_Fab["default"], {
140
+ size: "small",
141
+ onClick: function onClick() {
142
+ return _this4.getCoordinates();
143
+ }
144
+ }, /*#__PURE__*/_react["default"].createElement(_GpsFixed["default"], null)));
145
+ }
146
+ }]);
147
+ return ConfigCoordinates;
148
+ }(_ConfigGeneric2["default"]);
149
+
150
+ ConfigCoordinates.propTypes = {
151
+ socket: _propTypes["default"].object.isRequired,
152
+ themeType: _propTypes["default"].string,
153
+ themeName: _propTypes["default"].string,
154
+ style: _propTypes["default"].object,
155
+ className: _propTypes["default"].string,
156
+ data: _propTypes["default"].object.isRequired,
157
+ schema: _propTypes["default"].object,
158
+ onError: _propTypes["default"].func,
159
+ onChange: _propTypes["default"].func
160
+ };
161
+
162
+ var _default = (0, _styles.withStyles)(styles)(ConfigCoordinates);
163
+
164
+ exports["default"] = _default;
165
+ //# sourceMappingURL=ConfigCoordinates.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConfigCoordinates.js","names":["styles","theme","width","ConfigCoordinates","value","ConfigGeneric","getValue","props","data","attr","schema","autoInit","setTimeout","getCoordinates","socket","getSystemConfig","then","obj","common","longitude","latitude","window","alert","I18n","t","setState","divider","navigator","geolocation","getCurrentPosition","position","coords","getSystemCoordinates","error","disabled","defaultValue","classes","state","undefined","maxLength","max","e","target","onChange","trim","getText","placeholder","label","renderHelp","help","helpLink","noTranslation","propTypes","PropTypes","object","isRequired","themeType","string","themeName","style","className","onError","func","withStyles"],"sources":["JsonConfigComponent/ConfigCoordinates.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@mui/styles';\n\nimport TextField from '@mui/material/TextField';\nimport Fab from '@mui/material/Fab';\n\nimport IconGpsFixed from '@mui/icons-material/GpsFixed';\n\nimport I18n from '@iobroker/adapter-react-v5/i18n';\n\nimport ConfigGeneric from './ConfigGeneric';\n\nconst styles = theme => ({\n width: {\n width: 'calc(100% - 40px)',\n }\n});\n\nclass ConfigCoordinates extends ConfigGeneric {\n componentDidMount() {\n super.componentDidMount();\n const value = ConfigGeneric.getValue(this.props.data, this.props.attr);\n if (!value && this.props.schema.autoInit) {\n setTimeout(() => this.getCoordinates(), 300);\n }\n }\n\n getSystemCoordinates() {\n return this.props.socket.getSystemConfig()\n .then(obj => {\n if (obj && obj.common && (obj.common.longitude || obj.common.latitude)) {\n window.alert(I18n.t('Used system settings'));\n this.setState({value: obj.common.latitude + (this.props.schema.divider || ',') + obj.common.longitude});\n } else {\n window.alert(I18n.t('Cannot determine position: System settings are empty and GPS detection is disabled in browser'));\n }\n });\n }\n\n getCoordinates() {\n if (navigator.geolocation) {\n navigator.geolocation.getCurrentPosition(\n position => {\n if (position && position.coords) {\n this.setState({value: position.coords.latitude + (this.props.schema.divider || ',') + position.coords.longitude});\n } else {\n this.getSystemCoordinates();\n }\n },\n error => {\n this.getSystemCoordinates();\n }\n );\n } else {\n this.getSystemCoordinates();\n }\n }\n\n renderItem(error, disabled, defaultValue) {\n return <>\n <TextField\n variant=\"standard\"\n className={this.props.classes.width}\n value={this.state.value === null || this.state.value === undefined ? '' : this.state.value}\n error={!!error}\n disabled={!!disabled}\n inputProps={{maxLength: this.props.schema.maxLength || this.props.schema.max || undefined}}\n onChange={e => {\n const value = e.target.value;\n this.setState({value}, () =>\n this.onChange(this.props.attr, (value || '').trim()));\n }}\n placeholder={this.getText(this.props.schema.placeholder)}\n label={this.getText(this.props.schema.label)}\n helperText={this.renderHelp(this.props.schema.help, this.props.schema.helpLink, this.props.schema.noTranslation)}\n />\n <Fab size=\"small\" onClick={() => this.getCoordinates()}><IconGpsFixed /></Fab>\n </>;\n }\n}\n\nConfigCoordinates.propTypes = {\n socket: PropTypes.object.isRequired,\n themeType: PropTypes.string,\n themeName: PropTypes.string,\n style: PropTypes.object,\n className: PropTypes.string,\n data: PropTypes.object.isRequired,\n schema: PropTypes.object,\n onError: PropTypes.func,\n onChange: PropTypes.func,\n};\n\nexport default withStyles(styles)(ConfigCoordinates);"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AAEA;;AACA;;AAEA;;AAEA;;AAEA;;;;;;AAEA,IAAMA,MAAM,GAAG,SAATA,MAAS,CAAAC,KAAK;EAAA,OAAK;IACrBC,KAAK,EAAE;MACHA,KAAK,EAAE;IADJ;EADc,CAAL;AAAA,CAApB;;IAMMC,iB;;;;;;;;;;;;WACF,6BAAoB;MAAA;;MAChB;;MACA,IAAMC,KAAK,GAAGC,0BAAA,CAAcC,QAAd,CAAuB,KAAKC,KAAL,CAAWC,IAAlC,EAAwC,KAAKD,KAAL,CAAWE,IAAnD,CAAd;;MACA,IAAI,CAACL,KAAD,IAAU,KAAKG,KAAL,CAAWG,MAAX,CAAkBC,QAAhC,EAA0C;QACtCC,UAAU,CAAC;UAAA,OAAM,KAAI,CAACC,cAAL,EAAN;QAAA,CAAD,EAA8B,GAA9B,CAAV;MACH;IACJ;;;WAED,gCAAuB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,gCAAC,eAAD;QAAK,IAAI,EAAC,OAAV;QAAkB,OAAO,EAAE;UAAA,OAAM,MAAI,CAACtC,cAAL,EAAN;QAAA;MAA3B,gBAAwD,gCAAC,oBAAD,OAAxD,CAjBG,CAAP;IAmBH;;;EA5D2BR,0B;;AA+DhCF,iBAAiB,CAACiD,SAAlB,GAA8B;EAC1BtC,MAAM,EAAEuC,qBAAA,CAAUC,MAAV,CAAiBC,UADC;EAE1BC,SAAS,EAAEH,qBAAA,CAAUI,MAFK;EAG1BC,SAAS,EAAEL,qBAAA,CAAUI,MAHK;EAI1BE,KAAK,EAAEN,qBAAA,CAAUC,MAJS;EAK1BM,SAAS,EAAEP,qBAAA,CAAUI,MALK;EAM1BjD,IAAI,EAAE6C,qBAAA,CAAUC,MAAV,CAAiBC,UANG;EAO1B7C,MAAM,EAAE2C,qBAAA,CAAUC,MAPQ;EAQ1BO,OAAO,EAAER,qBAAA,CAAUS,IARO;EAS1BnB,QAAQ,EAAEU,qBAAA,CAAUS;AATM,CAA9B;;eAYe,IAAAC,kBAAA,EAAW/D,MAAX,EAAmBG,iBAAnB,C"}
@@ -0,0 +1,180 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports["default"] = void 0;
9
+
10
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
11
+
12
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
13
+
14
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
15
+
16
+ var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
17
+
18
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
19
+
20
+ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
21
+
22
+ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
23
+
24
+ var _propTypes = _interopRequireDefault(require("prop-types"));
25
+
26
+ var _styles = require("@mui/styles");
27
+
28
+ var _Table = _interopRequireDefault(require("@mui/material/Table"));
29
+
30
+ var _TableBody = _interopRequireDefault(require("@mui/material/TableBody"));
31
+
32
+ var _TableCell = _interopRequireDefault(require("@mui/material/TableCell"));
33
+
34
+ var _TableContainer = _interopRequireDefault(require("@mui/material/TableContainer"));
35
+
36
+ var _TableHead = _interopRequireDefault(require("@mui/material/TableHead"));
37
+
38
+ var _TableRow = _interopRequireDefault(require("@mui/material/TableRow"));
39
+
40
+ var _Checkbox = _interopRequireDefault(require("@mui/material/Checkbox"));
41
+
42
+ var _i18n = _interopRequireDefault(require("@iobroker/adapter-react-v5/i18n"));
43
+
44
+ var _ConfigGeneric2 = _interopRequireDefault(require("./ConfigGeneric"));
45
+
46
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
47
+
48
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
49
+
50
+ var styles = function styles(theme) {
51
+ return {
52
+ table: {
53
+ minWidth: 400
54
+ },
55
+ header: {
56
+ fontSize: 16,
57
+ fontWeight: 'bold'
58
+ }
59
+ };
60
+ };
61
+
62
+ var ConfigCustomEasyAccess = /*#__PURE__*/function (_ConfigGeneric) {
63
+ (0, _inherits2["default"])(ConfigCustomEasyAccess, _ConfigGeneric);
64
+
65
+ var _super = _createSuper(ConfigCustomEasyAccess);
66
+
67
+ function ConfigCustomEasyAccess() {
68
+ (0, _classCallCheck2["default"])(this, ConfigCustomEasyAccess);
69
+ return _super.apply(this, arguments);
70
+ }
71
+
72
+ (0, _createClass2["default"])(ConfigCustomEasyAccess, [{
73
+ key: "componentDidMount",
74
+ value: function componentDidMount() {
75
+ var _this = this;
76
+
77
+ (0, _get2["default"])((0, _getPrototypeOf2["default"])(ConfigCustomEasyAccess.prototype), "componentDidMount", this).call(this);
78
+ this.props.socket.getAdapterInstances().then(function (instances) {
79
+ instances = instances.filter(function (instance) {
80
+ var _instance$common;
81
+
82
+ return (instance === null || instance === void 0 ? void 0 : (_instance$common = instance.common) === null || _instance$common === void 0 ? void 0 : _instance$common.adminUI) && (instance.common.adminUI.config !== 'none' || instance.common.adminUI.tab);
83
+ }).map(function (instance) {
84
+ return {
85
+ id: instance._id.replace(/^system\.adapter\./, ''),
86
+ config: instance.common.adminUI.config !== 'none',
87
+ adminTab: instance.common.adminTab
88
+ };
89
+ }).sort(function (a, b) {
90
+ return a.id > b.id ? 1 : a.id < b.id ? -1 : 0;
91
+ });
92
+
93
+ _this.setState({
94
+ instances: instances
95
+ });
96
+ });
97
+ }
98
+ }, {
99
+ key: "renderItem",
100
+ value: function renderItem(error, disabled, defaultValue) {
101
+ var _this2 = this;
102
+
103
+ if (!this.state.instances) {
104
+ return null;
105
+ } else {
106
+ var accessAllowedConfigs = _ConfigGeneric2["default"].getValue(this.props.data, 'accessAllowedConfigs') || [];
107
+ var accessAllowedTabs = _ConfigGeneric2["default"].getValue(this.props.data, 'accessAllowedTabs') || [];
108
+ return /*#__PURE__*/React.createElement(_TableContainer["default"], null, /*#__PURE__*/React.createElement(_Table["default"], {
109
+ className: this.props.classes.table,
110
+ size: "small"
111
+ }, /*#__PURE__*/React.createElement(_TableHead["default"], null, /*#__PURE__*/React.createElement(_TableRow["default"], null, /*#__PURE__*/React.createElement(_TableCell["default"], {
112
+ className: this.props.classes.header
113
+ }, _i18n["default"].t('Instance')), /*#__PURE__*/React.createElement(_TableCell["default"], {
114
+ className: this.props.classes.header
115
+ }, _i18n["default"].t('Config')), /*#__PURE__*/React.createElement(_TableCell["default"], {
116
+ className: this.props.classes.header
117
+ }, _i18n["default"].t('Tab')))), /*#__PURE__*/React.createElement(_TableBody["default"], null, this.state.instances.map(function (row) {
118
+ return /*#__PURE__*/React.createElement(_TableRow["default"], {
119
+ key: row.id
120
+ }, /*#__PURE__*/React.createElement(_TableCell["default"], {
121
+ component: "th",
122
+ scope: "row"
123
+ }, row.id), /*#__PURE__*/React.createElement(_TableCell["default"], null, row.config ? /*#__PURE__*/React.createElement(_Checkbox["default"], {
124
+ checked: accessAllowedConfigs.includes(row.id),
125
+ onClick: function onClick() {
126
+ var _accessAllowedConfigs = (0, _toConsumableArray2["default"])(accessAllowedConfigs);
127
+
128
+ var pos = _accessAllowedConfigs.indexOf(row.id);
129
+
130
+ if (pos !== -1) {
131
+ _accessAllowedConfigs.splice(pos, 1);
132
+ } else {
133
+ _accessAllowedConfigs.push(row.id);
134
+
135
+ _accessAllowedConfigs.sort();
136
+ }
137
+
138
+ _this2.onChange('accessAllowedConfigs', _accessAllowedConfigs);
139
+ }
140
+ }) : null), /*#__PURE__*/React.createElement(_TableCell["default"], null, row.adminTab ? /*#__PURE__*/React.createElement(_Checkbox["default"], {
141
+ checked: accessAllowedTabs.includes(row.id),
142
+ onClick: function onClick() {
143
+ var _accessAllowedTabs = (0, _toConsumableArray2["default"])(accessAllowedTabs);
144
+
145
+ var pos = _accessAllowedTabs.indexOf(row.id);
146
+
147
+ if (pos !== -1) {
148
+ _accessAllowedTabs.splice(pos, 1);
149
+ } else {
150
+ _accessAllowedTabs.push(row.id);
151
+
152
+ _accessAllowedTabs.sort();
153
+ }
154
+
155
+ _this2.onChange('accessAllowedTabs', _accessAllowedTabs);
156
+ }
157
+ }) : null));
158
+ }))));
159
+ }
160
+ }
161
+ }]);
162
+ return ConfigCustomEasyAccess;
163
+ }(_ConfigGeneric2["default"]);
164
+
165
+ ConfigCustomEasyAccess.propTypes = {
166
+ socket: _propTypes["default"].object.isRequired,
167
+ themeType: _propTypes["default"].string,
168
+ themeName: _propTypes["default"].string,
169
+ style: _propTypes["default"].object,
170
+ className: _propTypes["default"].string,
171
+ data: _propTypes["default"].object.isRequired,
172
+ schema: _propTypes["default"].object,
173
+ onError: _propTypes["default"].func,
174
+ onChange: _propTypes["default"].func
175
+ };
176
+
177
+ var _default = (0, _styles.withStyles)(styles)(ConfigCustomEasyAccess);
178
+
179
+ exports["default"] = _default;
180
+ //# sourceMappingURL=ConfigCustomEasyAccess.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConfigCustomEasyAccess.js","names":["styles","theme","table","minWidth","header","fontSize","fontWeight","ConfigCustomEasyAccess","props","socket","getAdapterInstances","then","instances","filter","instance","common","adminUI","config","tab","map","id","_id","replace","adminTab","sort","a","b","setState","error","disabled","defaultValue","state","accessAllowedConfigs","ConfigGeneric","getValue","data","accessAllowedTabs","classes","I18n","t","row","includes","_accessAllowedConfigs","pos","indexOf","splice","push","onChange","_accessAllowedTabs","propTypes","PropTypes","object","isRequired","themeType","string","themeName","style","className","schema","onError","func","withStyles"],"sources":["JsonConfigComponent/ConfigCustomEasyAccess.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport { withStyles } from '@mui/styles';\n\nimport Table from '@mui/material/Table';\nimport TableBody from '@mui/material/TableBody';\nimport TableCell from '@mui/material/TableCell';\nimport TableContainer from '@mui/material/TableContainer';\nimport TableHead from '@mui/material/TableHead';\nimport TableRow from '@mui/material/TableRow';\nimport Checkbox from '@mui/material/Checkbox';\n\nimport I18n from '@iobroker/adapter-react-v5/i18n';\n\nimport ConfigGeneric from './ConfigGeneric';\n\nconst styles = theme => ({\n table: {\n minWidth: 400\n },\n header: {\n fontSize: 16,\n fontWeight: 'bold'\n }\n});\n\nclass ConfigCustomEasyAccess extends ConfigGeneric {\n componentDidMount() {\n super.componentDidMount();\n\n this.props.socket.getAdapterInstances()\n .then(instances => {\n instances = instances\n .filter(instance =>\n instance?.common?.adminUI && (instance.common.adminUI.config !== 'none' || instance.common.adminUI.tab))\n .map(instance => ({\n id: instance._id.replace(/^system\\.adapter\\./, ''),\n config: instance.common.adminUI.config !== 'none',\n adminTab: instance.common.adminTab\n }))\n .sort((a, b) => a.id > b.id ? 1 : (a.id < b.id ? -1 : 0));\n\n this.setState({instances});\n });\n }\n\n renderItem(error, disabled, defaultValue) {\n if (!this.state.instances) {\n return null;\n } else {\n const accessAllowedConfigs = ConfigGeneric.getValue(this.props.data, 'accessAllowedConfigs') || [];\n const accessAllowedTabs = ConfigGeneric.getValue(this.props.data, 'accessAllowedTabs') || [];\n\n return <TableContainer>\n <Table className={this.props.classes.table} size=\"small\">\n <TableHead>\n <TableRow>\n <TableCell className={this.props.classes.header}>{I18n.t('Instance')}</TableCell>\n <TableCell className={this.props.classes.header}>{I18n.t('Config')}</TableCell>\n <TableCell className={this.props.classes.header}>{I18n.t('Tab')}</TableCell>\n </TableRow>\n </TableHead>\n <TableBody>\n {this.state.instances.map((row) => (\n <TableRow key={row.id}>\n <TableCell component=\"th\" scope=\"row\">{row.id}</TableCell>\n <TableCell>\n {row.config ?\n <Checkbox checked={accessAllowedConfigs.includes(row.id)}\n onClick={() => {\n const _accessAllowedConfigs = [...accessAllowedConfigs];\n const pos = _accessAllowedConfigs.indexOf(row.id);\n if (pos !== -1) {\n _accessAllowedConfigs.splice(pos, 1);\n } else {\n _accessAllowedConfigs.push(row.id);\n _accessAllowedConfigs.sort();\n }\n this.onChange('accessAllowedConfigs', _accessAllowedConfigs);\n }}\n />\n : null}</TableCell>\n <TableCell>\n {row.adminTab ?\n <Checkbox\n checked={accessAllowedTabs.includes(row.id)}\n onClick={() => {\n const _accessAllowedTabs = [...accessAllowedTabs];\n const pos = _accessAllowedTabs.indexOf(row.id);\n if (pos !== -1) {\n _accessAllowedTabs.splice(pos, 1);\n } else {\n _accessAllowedTabs.push(row.id);\n _accessAllowedTabs.sort();\n }\n this.onChange('accessAllowedTabs', _accessAllowedTabs);\n }}\n /> : null}\n </TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n </TableContainer>;\n }\n }\n}\n\nConfigCustomEasyAccess.propTypes = {\n socket: PropTypes.object.isRequired,\n themeType: PropTypes.string,\n themeName: PropTypes.string,\n style: PropTypes.object,\n className: PropTypes.string,\n data: PropTypes.object.isRequired,\n schema: PropTypes.object,\n onError: PropTypes.func,\n onChange: PropTypes.func,\n};\n\nexport default withStyles(styles)(ConfigCustomEasyAccess);"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AAEA;;;;;;AAEA,IAAMA,MAAM,GAAG,SAATA,MAAS,CAAAC,KAAK;EAAA,OAAK;IACrBC,KAAK,EAAE;MACHC,QAAQ,EAAE;IADP,CADc;IAIrBC,MAAM,EAAE;MACJC,QAAQ,EAAE,EADN;MAEJC,UAAU,EAAE;IAFR;EAJa,CAAL;AAAA,CAApB;;IAUMC,sB;;;;;;;;;;;;WACF,6BAAoB;MAAA;;MAChB;MAEA,KAAKC,KAAL,CAAWC,MAAX,CAAkBC,mBAAlB,GACKC,IADL,CACU,UAAAC,SAAS,EAAI;QACfA,SAAS,GAAGA,SAAS,CAChBC,MADO,CACA,UAAAC,QAAQ;UAAA;;UAAA,OACZ,CAAAA,QAAQ,SAAR,IAAAA,QAAQ,WAAR,gCAAAA,QAAQ,CAAEC,MAAV,sEAAkBC,OAAlB,MAA8BF,QAAQ,CAACC,MAAT,CAAgBC,OAAhB,CAAwBC,MAAxB,KAAmC,MAAnC,IAA6CH,QAAQ,CAACC,MAAT,CAAgBC,OAAhB,CAAwBE,GAAnG,CADY;QAAA,CADR,EAGPC,GAHO,CAGH,UAAAL,QAAQ;UAAA,OAAK;YACdM,EAAE,EAAEN,QAAQ,CAACO,GAAT,CAAaC,OAAb,CAAqB,oBAArB,EAA2C,EAA3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,CADb;YAEK,OAAO,EAAE,mBAAM;cACX,IAAM4B,kBAAkB,uCAAOZ,iBAAP,CAAxB;;cACA,IAAMO,GAAG,GAAGK,kBAAkB,CAACJ,OAAnB,CAA2BJ,GAAG,CAACpB,EAA/B,CAAZ;;cACA,IAAIuB,GAAG,KAAK,CAAC,CAAb,EAAgB;gBACZK,kBAAkB,CAACH,MAAnB,CAA0BF,GAA1B,EAA+B,CAA/B;cACH,CAFD,MAEO;gBACHK,kBAAkB,CAACF,IAAnB,CAAwBN,GAAG,CAACpB,EAA5B;;gBACA4B,kBAAkB,CAACxB,IAAnB;cACH;;cACD,MAAI,CAACuB,QAAL,CAAc,mBAAd,EAAmCC,kBAAnC;YACH;UAZN,EADH,GAcQ,IAfb,CAlBJ,CADsB;QAAA,CAAzB,CADL,CARJ,CADG,CAAP;MAmDH;IACJ;;;EA/EgCf,0B;;AAkFrC1B,sBAAsB,CAAC0C,SAAvB,GAAmC;EAC/BxC,MAAM,EAAEyC,qBAAA,CAAUC,MAAV,CAAiBC,UADM;EAE/BC,SAAS,EAAEH,qBAAA,CAAUI,MAFU;EAG/BC,SAAS,EAAEL,qBAAA,CAAUI,MAHU;EAI/BE,KAAK,EAAEN,qBAAA,CAAUC,MAJc;EAK/BM,SAAS,EAAEP,qBAAA,CAAUI,MALU;EAM/BnB,IAAI,EAAEe,qBAAA,CAAUC,MAAV,CAAiBC,UANQ;EAO/BM,MAAM,EAAER,qBAAA,CAAUC,MAPa;EAQ/BQ,OAAO,EAAET,qBAAA,CAAUU,IARY;EAS/Bb,QAAQ,EAAEG,qBAAA,CAAUU;AATW,CAAnC;;eAYe,IAAAC,kBAAA,EAAW7D,MAAX,EAAmBO,sBAAnB,C"}
@@ -0,0 +1,117 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports["default"] = void 0;
9
+
10
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
+
12
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
13
+
14
+ var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
15
+
16
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
17
+
18
+ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
19
+
20
+ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
21
+
22
+ var _react = _interopRequireDefault(require("react"));
23
+
24
+ var _propTypes = _interopRequireDefault(require("prop-types"));
25
+
26
+ var _styles = require("@mui/styles");
27
+
28
+ var _xDatePickers = require("@mui/x-date-pickers");
29
+
30
+ var _ConfigGeneric2 = _interopRequireDefault(require("./ConfigGeneric"));
31
+
32
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
33
+
34
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
35
+
36
+ var styles = function styles(theme) {
37
+ return {
38
+ indeterminate: {
39
+ opacity: 0.5
40
+ }
41
+ };
42
+ };
43
+
44
+ var ConfigDatePicker = /*#__PURE__*/function (_ConfigGeneric) {
45
+ (0, _inherits2["default"])(ConfigDatePicker, _ConfigGeneric);
46
+
47
+ var _super = _createSuper(ConfigDatePicker);
48
+
49
+ function ConfigDatePicker() {
50
+ (0, _classCallCheck2["default"])(this, ConfigDatePicker);
51
+ return _super.apply(this, arguments);
52
+ }
53
+
54
+ (0, _createClass2["default"])(ConfigDatePicker, [{
55
+ key: "componentDidMount",
56
+ value: function componentDidMount() {
57
+ (0, _get2["default"])((0, _getPrototypeOf2["default"])(ConfigDatePicker.prototype), "componentDidMount", this).call(this);
58
+
59
+ var value = _ConfigGeneric2["default"].getValue(this.props.data, this.props.attr);
60
+
61
+ this.setState({
62
+ value: value
63
+ });
64
+ }
65
+ }, {
66
+ key: "renderItem",
67
+ value: function renderItem(error, disabled, defaultValue) {
68
+ var _this = this;
69
+
70
+ return /*#__PURE__*/_react["default"].createElement(_xDatePickers.DatePicker, {
71
+ fullWidth: true,
72
+ margin: "normal",
73
+ format: this.props.systemConfig.dateFormat.toLowerCase().replace('mm', 'MM'),
74
+ error: !!error,
75
+ disabled: !!disabled,
76
+ value: this.state.value === null || this.state.value === undefined ? new Date() : this.state.value,
77
+ KeyboardButtonProps: {
78
+ 'aria-label': 'change date'
79
+ },
80
+ inputProps: {
81
+ maxLength: this.props.schema.maxLength || this.props.schema.max || undefined
82
+ },
83
+ onChange: function onChange(value) {
84
+ _this.setState({
85
+ value: value
86
+ }, function () {
87
+ return _this.onChange(_this.props.attr, value);
88
+ });
89
+ },
90
+ InputLabelProps: {
91
+ shrink: true
92
+ },
93
+ placeholder: this.getText(this.props.schema.placeholder),
94
+ label: this.getText(this.props.schema.label),
95
+ helperText: this.renderHelp(this.props.schema.help, this.props.schema.helpLink, this.props.schema.noTranslation)
96
+ });
97
+ }
98
+ }]);
99
+ return ConfigDatePicker;
100
+ }(_ConfigGeneric2["default"]);
101
+
102
+ ConfigDatePicker.propTypes = {
103
+ socket: _propTypes["default"].object.isRequired,
104
+ themeType: _propTypes["default"].string,
105
+ themeName: _propTypes["default"].string,
106
+ style: _propTypes["default"].object,
107
+ className: _propTypes["default"].string,
108
+ data: _propTypes["default"].object.isRequired,
109
+ schema: _propTypes["default"].object,
110
+ onError: _propTypes["default"].func,
111
+ onChange: _propTypes["default"].func
112
+ };
113
+
114
+ var _default = (0, _styles.withStyles)(styles)(ConfigDatePicker);
115
+
116
+ exports["default"] = _default;
117
+ //# sourceMappingURL=ConfigDatePicker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConfigDatePicker.js","names":["styles","theme","indeterminate","opacity","ConfigDatePicker","value","ConfigGeneric","getValue","props","data","attr","setState","error","disabled","defaultValue","systemConfig","dateFormat","toLowerCase","replace","state","undefined","Date","maxLength","schema","max","onChange","shrink","getText","placeholder","label","renderHelp","help","helpLink","noTranslation","propTypes","socket","PropTypes","object","isRequired","themeType","string","themeName","style","className","onError","func","withStyles"],"sources":["JsonConfigComponent/ConfigDatePicker.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@mui/styles';\n\nimport { DatePicker } from '@mui/x-date-pickers';\n\nimport ConfigGeneric from './ConfigGeneric';\n\nconst styles = theme => ({\n indeterminate: {\n opacity: 0.5\n }\n});\n\nclass ConfigDatePicker extends ConfigGeneric {\n componentDidMount() {\n super.componentDidMount();\n const value = ConfigGeneric.getValue(this.props.data, this.props.attr);\n this.setState({ value });\n }\n\n renderItem(error, disabled, defaultValue) {\n return <DatePicker\n fullWidth\n margin=\"normal\"\n format={this.props.systemConfig.dateFormat.toLowerCase().replace('mm','MM')}\n error={!!error}\n disabled={!!disabled}\n value={this.state.value === null || this.state.value === undefined ? new Date() : this.state.value}\n KeyboardButtonProps={{\n 'aria-label': 'change date',\n }}\n inputProps={{ maxLength: this.props.schema.maxLength || this.props.schema.max || undefined }}\n onChange={value => {\n this.setState({ value }, () =>\n this.onChange(this.props.attr, value));\n }}\n InputLabelProps={{\n shrink: true,\n }}\n placeholder={this.getText(this.props.schema.placeholder)}\n label={this.getText(this.props.schema.label)}\n helperText={this.renderHelp(this.props.schema.help, this.props.schema.helpLink, this.props.schema.noTranslation)}\n />;\n }\n}\n\nConfigDatePicker.propTypes = {\n socket: PropTypes.object.isRequired,\n themeType: PropTypes.string,\n themeName: PropTypes.string,\n style: PropTypes.object,\n className: PropTypes.string,\n data: PropTypes.object.isRequired,\n schema: PropTypes.object,\n onError: PropTypes.func,\n onChange: PropTypes.func,\n};\n\nexport default withStyles(styles)(ConfigDatePicker);"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AAEA;;AAEA;;;;;;AAEA,IAAMA,MAAM,GAAG,SAATA,MAAS,CAAAC,KAAK;EAAA,OAAK;IACrBC,aAAa,EAAE;MACXC,OAAO,EAAE;IADE;EADM,CAAL;AAAA,CAApB;;IAMMC,gB;;;;;;;;;;;;WACF,6BAAoB;MAChB;;MACA,IAAMC,KAAK,GAAGC,0BAAA,CAAcC,QAAd,CAAuB,KAAKC,KAAL,CAAWC,IAAlC,EAAwC,KAAKD,KAAL,CAAWE,IAAnD,CAAd;;MACA,KAAKC,QAAL,CAAc;QAAEN,KAAK,EAALA;MAAF,CAAd;IACH;;;WAED,oBAAWO,KAAX,EAAkBC,QAAlB,EAA4BC,YAA5B,EAA0C;MAAA;;MACtC,oBAAO,gCAAC,wBAAD;QACH,SAAS,MADN;QAEH,MAAM,EAAC,QAFJ;QAGH,MAAM,EAAE,KAAKN,KAAL,CAAWO,YAAX,CAAwBC,UAAxB,CAAmCC,WAAnC,GAAiDC,OAAjD,CAAyD,IAAzD,EAA8D,IAA9D,CAHL;QAIH,KAAK,EAAE,CAAC,CAACN,KAJN;QAKH,QAAQ,EAAE,CAAC,CAACC,QALT;QAMH,KAAK,EAAE,KAAKM,KAAL,CAAWd,KAAX,KAAqB,IAArB,IAA6B,KAAKc,KAAL,CAAWd,KAAX,KAAqBe,SAAlD,GAA8D,IAAIC,IAAJ,EAA9D,GAA2E,KAAKF,KAAL,CAAWd,KAN1F;QAOH,mBAAmB,EAAE;UACjB,cAAc;QADG,CAPlB;QAUH,UAAU,EAAE;UAAEiB,SAAS,EAAE,KAAKd,KAAL,CAAWe,MAAX,CAAkBD,SAAlB,IAA+B,KAAKd,KAAL,CAAWe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