@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.
- package/Components/FileBrowser.js +248 -222
- package/Components/FileBrowser.js.map +1 -1
- package/Components/FileViewer.js +219 -75
- package/Components/FileViewer.js.map +1 -1
- package/Components/JsonConfigComponent/ChipInput.js +926 -0
- package/Components/JsonConfigComponent/ChipInput.js.map +1 -0
- package/Components/JsonConfigComponent/ConfigAlive.js +135 -0
- package/Components/JsonConfigComponent/ConfigAlive.js.map +1 -0
- package/Components/JsonConfigComponent/ConfigAutocomplete.js +204 -0
- package/Components/JsonConfigComponent/ConfigAutocomplete.js.map +1 -0
- package/Components/JsonConfigComponent/ConfigAutocompleteSendTo.js +311 -0
- package/Components/JsonConfigComponent/ConfigAutocompleteSendTo.js.map +1 -0
- package/Components/JsonConfigComponent/ConfigCRON.js +195 -0
- package/Components/JsonConfigComponent/ConfigCRON.js.map +1 -0
- package/Components/JsonConfigComponent/ConfigCertificateSelect.js +178 -0
- package/Components/JsonConfigComponent/ConfigCertificateSelect.js.map +1 -0
- package/Components/JsonConfigComponent/ConfigCheckbox.js +112 -0
- package/Components/JsonConfigComponent/ConfigCheckbox.js.map +1 -0
- package/Components/JsonConfigComponent/ConfigChip.js +149 -0
- package/Components/JsonConfigComponent/ConfigChip.js.map +1 -0
- package/Components/JsonConfigComponent/ConfigColor.js +156 -0
- package/Components/JsonConfigComponent/ConfigColor.js.map +1 -0
- package/Components/JsonConfigComponent/ConfigCoordinates.js +165 -0
- package/Components/JsonConfigComponent/ConfigCoordinates.js.map +1 -0
- package/Components/JsonConfigComponent/ConfigCustomEasyAccess.js +180 -0
- package/Components/JsonConfigComponent/ConfigCustomEasyAccess.js.map +1 -0
- package/Components/JsonConfigComponent/ConfigDatePicker.js +117 -0
- package/Components/JsonConfigComponent/ConfigDatePicker.js.map +1 -0
- package/Components/JsonConfigComponent/ConfigGeneric.js +660 -0
- package/Components/JsonConfigComponent/ConfigGeneric.js.map +1 -0
- package/Components/JsonConfigComponent/ConfigIP.js +151 -0
- package/Components/JsonConfigComponent/ConfigIP.js.map +1 -0
- package/Components/JsonConfigComponent/ConfigImageUpload.js +215 -0
- package/Components/JsonConfigComponent/ConfigImageUpload.js.map +1 -0
- package/Components/JsonConfigComponent/ConfigInstanceSelect.js +197 -0
- package/Components/JsonConfigComponent/ConfigInstanceSelect.js.map +1 -0
- package/Components/JsonConfigComponent/ConfigJsonEditor.js +211 -0
- package/Components/JsonConfigComponent/ConfigJsonEditor.js.map +1 -0
- package/Components/JsonConfigComponent/ConfigLanguage.js +175 -0
- package/Components/JsonConfigComponent/ConfigLanguage.js.map +1 -0
- package/Components/JsonConfigComponent/ConfigNumber.js +194 -0
- package/Components/JsonConfigComponent/ConfigNumber.js.map +1 -0
- package/Components/JsonConfigComponent/ConfigObjectId.js +201 -0
- package/Components/JsonConfigComponent/ConfigObjectId.js.map +1 -0
- package/Components/JsonConfigComponent/ConfigPanel.js +421 -0
- package/Components/JsonConfigComponent/ConfigPanel.js.map +1 -0
- package/Components/JsonConfigComponent/ConfigPassword.js +236 -0
- package/Components/JsonConfigComponent/ConfigPassword.js.map +1 -0
- package/Components/JsonConfigComponent/ConfigPattern.js +94 -0
- package/Components/JsonConfigComponent/ConfigPattern.js.map +1 -0
- package/Components/JsonConfigComponent/ConfigSelect.js +163 -0
- package/Components/JsonConfigComponent/ConfigSelect.js.map +1 -0
- package/Components/JsonConfigComponent/ConfigSelectSendTo.js +258 -0
- package/Components/JsonConfigComponent/ConfigSelectSendTo.js.map +1 -0
- package/Components/JsonConfigComponent/ConfigSendto.js +282 -0
- package/Components/JsonConfigComponent/ConfigSendto.js.map +1 -0
- package/Components/JsonConfigComponent/ConfigSetState.js +266 -0
- package/Components/JsonConfigComponent/ConfigSetState.js.map +1 -0
- package/Components/JsonConfigComponent/ConfigStaticDivider.js +88 -0
- package/Components/JsonConfigComponent/ConfigStaticDivider.js.map +1 -0
- package/Components/JsonConfigComponent/ConfigStaticHeader.js +81 -0
- package/Components/JsonConfigComponent/ConfigStaticHeader.js.map +1 -0
- package/Components/JsonConfigComponent/ConfigStaticImage.js +88 -0
- package/Components/JsonConfigComponent/ConfigStaticImage.js.map +1 -0
- package/Components/JsonConfigComponent/ConfigStaticText.js +104 -0
- package/Components/JsonConfigComponent/ConfigStaticText.js.map +1 -0
- package/Components/JsonConfigComponent/ConfigTable.js +651 -0
- package/Components/JsonConfigComponent/ConfigTable.js.map +1 -0
- package/Components/JsonConfigComponent/ConfigTabs.js +166 -0
- package/Components/JsonConfigComponent/ConfigTabs.js.map +1 -0
- package/Components/JsonConfigComponent/ConfigText.js +170 -0
- package/Components/JsonConfigComponent/ConfigText.js.map +1 -0
- package/Components/JsonConfigComponent/ConfigTextSendTo.js +168 -0
- package/Components/JsonConfigComponent/ConfigTextSendTo.js.map +1 -0
- package/Components/JsonConfigComponent/ConfigTimePicker.js +111 -0
- package/Components/JsonConfigComponent/ConfigTimePicker.js.map +1 -0
- package/Components/JsonConfigComponent/ConfigTopic.js +140 -0
- package/Components/JsonConfigComponent/ConfigTopic.js.map +1 -0
- package/Components/JsonConfigComponent/ConfigUser.js +176 -0
- package/Components/JsonConfigComponent/ConfigUser.js.map +1 -0
- package/Components/JsonConfigComponent/index.js +511 -0
- package/Components/JsonConfigComponent/index.js.map +1 -0
- package/Components/Utils.js +25 -0
- package/Components/Utils.js.map +1 -1
- package/README.md +7 -1
- package/package.json +1 -1
package/Components/FileViewer.js
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
|
|
5
7
|
Object.defineProperty(exports, "__esModule", {
|
|
6
8
|
value: true
|
|
7
9
|
});
|
|
@@ -11,20 +13,26 @@ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/cl
|
|
|
11
13
|
|
|
12
14
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
15
|
|
|
16
|
+
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
17
|
+
|
|
14
18
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
15
19
|
|
|
16
20
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
17
21
|
|
|
18
22
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
19
23
|
|
|
20
|
-
var
|
|
24
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
25
|
+
|
|
26
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
21
27
|
|
|
22
|
-
var
|
|
28
|
+
var _styles = require("@mui/styles");
|
|
23
29
|
|
|
24
|
-
var
|
|
30
|
+
var _withWidth = _interopRequireDefault(require("./withWidth"));
|
|
25
31
|
|
|
26
32
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
27
33
|
|
|
34
|
+
var _TextField = _interopRequireDefault(require("@mui/material/TextField"));
|
|
35
|
+
|
|
28
36
|
var _Button = _interopRequireDefault(require("@mui/material/Button"));
|
|
29
37
|
|
|
30
38
|
var _Dialog = _interopRequireDefault(require("@mui/material/Dialog"));
|
|
@@ -35,7 +43,7 @@ var _DialogContent = _interopRequireDefault(require("@mui/material/DialogContent
|
|
|
35
43
|
|
|
36
44
|
var _DialogTitle = _interopRequireDefault(require("@mui/material/DialogTitle"));
|
|
37
45
|
|
|
38
|
-
var
|
|
46
|
+
var _material = require("@mui/material");
|
|
39
47
|
|
|
40
48
|
var _no_icon = _interopRequireDefault(require("../assets/no_icon.svg"));
|
|
41
49
|
|
|
@@ -43,29 +51,27 @@ var _Utils = _interopRequireDefault(require("./Utils"));
|
|
|
43
51
|
|
|
44
52
|
var _fa = require("react-icons/fa");
|
|
45
53
|
|
|
54
|
+
var _Brightness = _interopRequireDefault(require("@mui/icons-material/Brightness6"));
|
|
55
|
+
|
|
46
56
|
var _Close = _interopRequireDefault(require("@mui/icons-material/Close"));
|
|
47
57
|
|
|
58
|
+
var _Save = _interopRequireDefault(require("@mui/icons-material/Save"));
|
|
59
|
+
|
|
60
|
+
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); }
|
|
61
|
+
|
|
62
|
+
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; }
|
|
63
|
+
|
|
48
64
|
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); }; }
|
|
49
65
|
|
|
50
66
|
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; } }
|
|
51
67
|
|
|
52
|
-
// FIXME checkout https://mui.com/components/use-media-query/#migrating-from-withwidth
|
|
53
|
-
var withWidth = function withWidth() {
|
|
54
|
-
return function (WrappedComponent) {
|
|
55
|
-
return function (props) {
|
|
56
|
-
return /*#__PURE__*/_react["default"].createElement(WrappedComponent, (0, _extends2["default"])({}, props, {
|
|
57
|
-
width: "xs"
|
|
58
|
-
}));
|
|
59
|
-
};
|
|
60
|
-
};
|
|
61
|
-
};
|
|
62
|
-
|
|
63
68
|
var styles = function styles(theme) {
|
|
64
69
|
return {
|
|
65
70
|
dialog: {
|
|
66
|
-
height: '100%'
|
|
67
|
-
|
|
68
|
-
|
|
71
|
+
height: '100%'
|
|
72
|
+
},
|
|
73
|
+
paper: {
|
|
74
|
+
height: 'calc(100% - 64px)'
|
|
69
75
|
},
|
|
70
76
|
content: {
|
|
71
77
|
textAlign: 'center'
|
|
@@ -78,15 +84,32 @@ var styles = function styles(theme) {
|
|
|
78
84
|
width: 'auto',
|
|
79
85
|
height: 'calc(100% - 5px)',
|
|
80
86
|
objectFit: 'contain'
|
|
87
|
+
},
|
|
88
|
+
dialogTitle: {
|
|
89
|
+
justifyContent: 'space-between',
|
|
90
|
+
display: 'flex'
|
|
81
91
|
}
|
|
82
92
|
};
|
|
83
93
|
};
|
|
84
94
|
|
|
85
95
|
var EXTENSIONS = {
|
|
86
|
-
images: ['png', 'jpg', 'svg', 'jpeg', '
|
|
87
|
-
code: ['js', 'json'],
|
|
96
|
+
images: ['png', 'jpg', 'svg', 'jpeg', 'bmp'],
|
|
97
|
+
code: ['js', 'json', 'md'],
|
|
88
98
|
txt: ['log', 'txt', 'html', 'css', 'xml']
|
|
89
99
|
};
|
|
100
|
+
exports.EXTENSIONS = EXTENSIONS;
|
|
101
|
+
|
|
102
|
+
function bufferToBase64(buffer) {
|
|
103
|
+
var binary = '';
|
|
104
|
+
var bytes = new Uint8Array(buffer);
|
|
105
|
+
var len = bytes.byteLength;
|
|
106
|
+
|
|
107
|
+
for (var i = 0; i < len && i < 50; i++) {
|
|
108
|
+
binary += String.fromCharCode(bytes[i]);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
return window.btoa(binary);
|
|
112
|
+
}
|
|
90
113
|
/**
|
|
91
114
|
* @typedef {object} FileViewerProps
|
|
92
115
|
* @property {string} [key] The key to identify this component.
|
|
@@ -99,10 +122,9 @@ var EXTENSIONS = {
|
|
|
99
122
|
* @extends {React.Component<FileViewerProps>}
|
|
100
123
|
*/
|
|
101
124
|
|
|
102
|
-
exports.EXTENSIONS = EXTENSIONS;
|
|
103
125
|
|
|
104
|
-
var FileViewer = /*#__PURE__*/function (
|
|
105
|
-
(0, _inherits2["default"])(FileViewer,
|
|
126
|
+
var FileViewer = /*#__PURE__*/function (_Component) {
|
|
127
|
+
(0, _inherits2["default"])(FileViewer, _Component);
|
|
106
128
|
|
|
107
129
|
var _super = _createSuper(FileViewer);
|
|
108
130
|
|
|
@@ -114,63 +136,167 @@ var FileViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
114
136
|
|
|
115
137
|
(0, _classCallCheck2["default"])(this, FileViewer);
|
|
116
138
|
_this = _super.call(this, props);
|
|
117
|
-
|
|
139
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onFileChanged", function (id, fileName, size) {
|
|
140
|
+
if (!_this.state.changed) {
|
|
141
|
+
_this.timeout && clearTimeout(_this.timeout);
|
|
142
|
+
_this.timeout = setTimeout(function () {
|
|
143
|
+
_this.timeout = null;
|
|
144
|
+
|
|
145
|
+
if (size === null) {
|
|
146
|
+
window.alert('Show file was deleted!');
|
|
147
|
+
} else if (_this.state.text !== null || _this.state.code !== null) {
|
|
148
|
+
_this.readFile();
|
|
149
|
+
} else {
|
|
150
|
+
_this.setState({
|
|
151
|
+
forceUpdate: Date.now()
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
}, 300);
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "writeFile64", function () {
|
|
158
|
+
var parts = _this.props.href.split('/');
|
|
159
|
+
|
|
160
|
+
var data = _this.state.editingValue;
|
|
161
|
+
parts.splice(0, 2);
|
|
162
|
+
var adapter = parts[0];
|
|
163
|
+
var name = parts.splice(1).join('/');
|
|
164
|
+
|
|
165
|
+
_this.props.socket.writeFile64(adapter, name, Buffer.from(data).toString('base64')).then(function (_) {
|
|
166
|
+
return _this.props.onClose();
|
|
167
|
+
})["catch"](function (e) {
|
|
168
|
+
return window.alert('Cannot write file: ' + e);
|
|
169
|
+
});
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
var ext = _Utils["default"].getFileExtension(_this.props.href);
|
|
173
|
+
|
|
118
174
|
_this.state = {
|
|
119
175
|
text: null,
|
|
120
176
|
code: null,
|
|
121
|
-
|
|
177
|
+
ext: ext,
|
|
178
|
+
editing: !!_this.props.formatEditFile || false,
|
|
179
|
+
editingValue: null,
|
|
180
|
+
copyPossible: EXTENSIONS.code.includes(ext) || EXTENSIONS.txt.includes(ext),
|
|
181
|
+
forceUpdate: Date.now(),
|
|
182
|
+
changed: false
|
|
122
183
|
};
|
|
123
|
-
|
|
124
|
-
if (_this.state.copyPossible) {
|
|
125
|
-
fetch(_this.props.href).then(function (response) {
|
|
126
|
-
return response.text();
|
|
127
|
-
}).then(function (data) {
|
|
128
|
-
if (EXTENSIONS.txt.includes(_this.ext)) {
|
|
129
|
-
_this.setState({
|
|
130
|
-
text: data
|
|
131
|
-
});
|
|
132
|
-
} else if (EXTENSIONS.code.includes(_this.ext)) {
|
|
133
|
-
_this.setState({
|
|
134
|
-
code: data
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
|
|
140
184
|
return _this;
|
|
141
185
|
}
|
|
142
186
|
|
|
143
187
|
(0, _createClass2["default"])(FileViewer, [{
|
|
188
|
+
key: "readFile",
|
|
189
|
+
value: function readFile() {
|
|
190
|
+
var _this2 = this;
|
|
191
|
+
|
|
192
|
+
if (this.props.href) {
|
|
193
|
+
var parts = this.props.href.split('/');
|
|
194
|
+
parts.splice(0, 2);
|
|
195
|
+
var adapter = parts[0];
|
|
196
|
+
var name = parts.splice(1).join('/');
|
|
197
|
+
this.props.socket.readFile(adapter, name).then(function (data) {
|
|
198
|
+
if (data.file !== undefined) {
|
|
199
|
+
data = data.file;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
var newState = {
|
|
203
|
+
copyPossible: _this2.state.copyPossible
|
|
204
|
+
}; // try to detect valid extension
|
|
205
|
+
|
|
206
|
+
if (data.type === 'Buffer') {
|
|
207
|
+
var ext = AdminUtils.detectMimeType(bufferToBase64(data.data));
|
|
208
|
+
|
|
209
|
+
if (ext) {
|
|
210
|
+
newState.ext = ext;
|
|
211
|
+
newState.copyPossible = EXTENSIONS.code.includes(ext) || EXTENSIONS.txt.includes(ext);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
if (newState.copyPossible) {
|
|
216
|
+
if (EXTENSIONS.txt.includes(_this2.state.ext)) {
|
|
217
|
+
newState.text = data;
|
|
218
|
+
newState.editingValue = data;
|
|
219
|
+
} else if (EXTENSIONS.code.includes(_this2.state.ext)) {
|
|
220
|
+
newState.code = data;
|
|
221
|
+
newState.editingValue = data;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
_this2.setState(newState);
|
|
226
|
+
})["catch"](function (e) {
|
|
227
|
+
return window.alert('Cannot read file: ' + e);
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}, {
|
|
232
|
+
key: "componentDidMount",
|
|
233
|
+
value: function componentDidMount() {
|
|
234
|
+
this.readFile();
|
|
235
|
+
var parts = this.props.href.split('/');
|
|
236
|
+
parts.splice(0, 2);
|
|
237
|
+
var adapter = parts[0];
|
|
238
|
+
var name = parts.splice(1).join('/');
|
|
239
|
+
this.props.supportSubscribes && this.props.socket.subscribeFiles(adapter, name, this.onFileChanged);
|
|
240
|
+
}
|
|
241
|
+
}, {
|
|
242
|
+
key: "componentWillUnmount",
|
|
243
|
+
value: function componentWillUnmount() {
|
|
244
|
+
this.timeout && clearTimeout(this.timeout);
|
|
245
|
+
var parts = this.props.href.split('/');
|
|
246
|
+
parts.splice(0, 2);
|
|
247
|
+
var adapter = parts[0];
|
|
248
|
+
var name = parts.splice(1).join('/');
|
|
249
|
+
this.props.supportSubscribes && this.props.socket.subscribeFiles(adapter, name, this.onFileChanged);
|
|
250
|
+
}
|
|
251
|
+
}, {
|
|
252
|
+
key: "getEditFile",
|
|
253
|
+
value: function getEditFile(ext) {
|
|
254
|
+
switch (ext) {
|
|
255
|
+
case 'json':
|
|
256
|
+
return 'json';
|
|
257
|
+
|
|
258
|
+
case 'js':
|
|
259
|
+
return 'javascript';
|
|
260
|
+
|
|
261
|
+
case 'html':
|
|
262
|
+
return 'html';
|
|
263
|
+
|
|
264
|
+
case 'txt':
|
|
265
|
+
return 'html';
|
|
266
|
+
|
|
267
|
+
default:
|
|
268
|
+
return 'json';
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
}, {
|
|
144
272
|
key: "getContent",
|
|
145
273
|
value: function getContent() {
|
|
146
|
-
|
|
274
|
+
var _this3 = this;
|
|
275
|
+
|
|
276
|
+
if (EXTENSIONS.images.includes(this.state.ext)) {
|
|
147
277
|
return /*#__PURE__*/_react["default"].createElement("img", {
|
|
148
278
|
onError: function onError(e) {
|
|
149
279
|
e.target.onerror = null;
|
|
150
280
|
e.target.src = _no_icon["default"];
|
|
151
281
|
},
|
|
152
|
-
className: this.props.classes.img,
|
|
153
|
-
src: this.props.href,
|
|
282
|
+
className: _Utils["default"].clsx(this.props.classes.img, this.props.getClassBackgroundImage()),
|
|
283
|
+
src: this.props.href + '?ts=' + this.state.forceUpdate,
|
|
154
284
|
alt: this.props.href
|
|
155
285
|
});
|
|
156
|
-
} else if (this.state.code !== null) {
|
|
286
|
+
} else if (this.state.code !== null || this.state.text !== null || this.state.editing) {
|
|
157
287
|
return /*#__PURE__*/_react["default"].createElement(_TextField["default"], {
|
|
158
288
|
variant: "standard",
|
|
159
289
|
className: this.props.classes.textarea,
|
|
160
290
|
multiline: true,
|
|
161
|
-
value: this.state.code,
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
variant: "standard",
|
|
169
|
-
className: this.props.classes.textarea,
|
|
170
|
-
value: this.state.code,
|
|
171
|
-
multiline: true,
|
|
291
|
+
value: this.state.editingValue || this.state.code || this.state.text,
|
|
292
|
+
onChange: function onChange(newValue) {
|
|
293
|
+
return _this3.setState({
|
|
294
|
+
editingValue: newValue,
|
|
295
|
+
changed: true
|
|
296
|
+
});
|
|
297
|
+
},
|
|
172
298
|
InputProps: {
|
|
173
|
-
readOnly:
|
|
299
|
+
readOnly: !this.state.editing
|
|
174
300
|
}
|
|
175
301
|
});
|
|
176
302
|
}
|
|
@@ -178,49 +304,67 @@ var FileViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
178
304
|
}, {
|
|
179
305
|
key: "render",
|
|
180
306
|
value: function render() {
|
|
181
|
-
var
|
|
307
|
+
var _this4 = this;
|
|
182
308
|
|
|
183
309
|
return /*#__PURE__*/_react["default"].createElement(_Dialog["default"], {
|
|
184
|
-
|
|
310
|
+
classes: {
|
|
311
|
+
scrollPaper: this.props.classes.dialog,
|
|
312
|
+
paper: this.props.classes.paper
|
|
313
|
+
},
|
|
314
|
+
scroll: "paper",
|
|
185
315
|
open: !!this.props.href,
|
|
186
316
|
onClose: function onClose() {
|
|
187
|
-
return
|
|
317
|
+
return _this4.props.onClose();
|
|
188
318
|
},
|
|
189
319
|
fullWidth: true,
|
|
190
|
-
|
|
320
|
+
maxWidth: "xl",
|
|
191
321
|
"aria-labelledby": "form-dialog-title"
|
|
322
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
323
|
+
className: this.props.classes.dialogTitle
|
|
192
324
|
}, /*#__PURE__*/_react["default"].createElement(_DialogTitle["default"], {
|
|
193
325
|
id: "form-dialog-title"
|
|
194
|
-
}, this.props.t('
|
|
326
|
+
}, this.props.t(this.state.editing ? 'Edit' : 'View') + ': ' + this.props.href), EXTENSIONS.images.includes(this.state.ext) && /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(_material.IconButton, {
|
|
327
|
+
size: "large",
|
|
328
|
+
color: 'inherit',
|
|
329
|
+
onClick: this.props.setStateBackgroundImage
|
|
330
|
+
}, /*#__PURE__*/_react["default"].createElement(_Brightness["default"], null)))), /*#__PURE__*/_react["default"].createElement(_DialogContent["default"], {
|
|
195
331
|
className: this.props.classes.content
|
|
196
332
|
}, this.getContent()), /*#__PURE__*/_react["default"].createElement(_DialogActions["default"], null, this.state.copyPossible ? /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
197
333
|
color: "grey",
|
|
198
334
|
onClick: function onClick(e) {
|
|
199
|
-
return _Utils["default"].copyToClipboard(
|
|
200
|
-
}
|
|
201
|
-
|
|
335
|
+
return _Utils["default"].copyToClipboard(_this4.state.text || _this4.state.code, e);
|
|
336
|
+
},
|
|
337
|
+
startIcon: /*#__PURE__*/_react["default"].createElement(_fa.FaCopy, null)
|
|
338
|
+
}, this.props.t('Copy content')) : null, this.state.editing ? /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
339
|
+
color: "grey",
|
|
340
|
+
disabled: this.state.editingValue === this.state.code || this.state.editingValue === this.state.text,
|
|
341
|
+
variant: "contained",
|
|
342
|
+
onClick: this.writeFile64,
|
|
343
|
+
startIcon: /*#__PURE__*/_react["default"].createElement(_Save["default"], null)
|
|
344
|
+
}, this.props.t('Save')) : null, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
345
|
+
variant: "contained",
|
|
202
346
|
onClick: function onClick() {
|
|
203
|
-
return
|
|
347
|
+
return _this4.props.onClose();
|
|
204
348
|
},
|
|
205
|
-
color: "primary"
|
|
206
|
-
|
|
349
|
+
color: "primary",
|
|
350
|
+
startIcon: /*#__PURE__*/_react["default"].createElement(_Close["default"], null)
|
|
351
|
+
}, this.props.t('Close'))));
|
|
207
352
|
}
|
|
208
|
-
}], [{
|
|
209
|
-
key: "getDerivedStateFromProps",
|
|
210
|
-
value: function getDerivedStateFromProps() {}
|
|
211
353
|
}]);
|
|
212
354
|
return FileViewer;
|
|
213
|
-
}(_react
|
|
355
|
+
}(_react.Component);
|
|
214
356
|
|
|
215
357
|
FileViewer.propTypes = {
|
|
216
358
|
t: _propTypes["default"].func,
|
|
359
|
+
lang: _propTypes["default"].string,
|
|
360
|
+
expertMode: _propTypes["default"].bool,
|
|
217
361
|
onClose: _propTypes["default"].func,
|
|
218
362
|
href: _propTypes["default"].string.isRequired,
|
|
219
|
-
|
|
363
|
+
supportSubscribes: _propTypes["default"].bool
|
|
220
364
|
};
|
|
221
365
|
/** @type {typeof FileViewer} */
|
|
222
366
|
|
|
223
|
-
var _export =
|
|
367
|
+
var _export = (0, _withWidth["default"])()((0, _styles.withStyles)(styles)(FileViewer));
|
|
224
368
|
|
|
225
369
|
var _default = _export;
|
|
226
370
|
exports["default"] = _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileViewer.js","names":["withWidth","WrappedComponent","props","styles","theme","dialog","height","maxHeight","maxWidth","content","textAlign","textarea","width","img","objectFit","EXTENSIONS","images","code","txt","FileViewer","ext","Utils","getFileExtension","href","state","text","copyPossible","includes","fetch","then","response","data","setState","e","target","onerror","src","NoImage","classes","readOnly","onClose","fullScreen","undefined","t","getContent","copyToClipboard","React","Component","propTypes","PropTypes","func","string","isRequired","bool","_export","withStyles"],"sources":["FileViewer.js"],"sourcesContent":["import React from 'react';\nimport withStyles from '@mui/styles/withStyles';\nimport PropTypes from 'prop-types';\n\nimport Button from '@mui/material/Button';\nimport Dialog from '@mui/material/Dialog';\nimport DialogActions from '@mui/material/DialogActions';\nimport DialogContent from '@mui/material/DialogContent';\nimport DialogTitle from '@mui/material/DialogTitle';\nimport TextField from '@mui/material/TextField';\n\nimport NoImage from '../assets/no_icon.svg';\nimport Utils from './Utils';\n\n// Icons\nimport {FaCopy as CopyIcon} from 'react-icons/fa';\nimport CloseIcon from '@mui/icons-material/Close';\n\n// FIXME checkout https://mui.com/components/use-media-query/#migrating-from-withwidth\nconst withWidth = () => WrappedComponent => props => <WrappedComponent {...props} width=\"xs\" />;\n\nconst styles = theme => ({\n dialog: {\n height: '100%',\n maxHeight: '100%',\n maxWidth: '100%',\n },\n content: {\n textAlign: 'center',\n },\n textarea: {\n width: '100%',\n height: '100%',\n },\n img: {\n width: 'auto',\n height: 'calc(100% - 5px)',\n objectFit: 'contain',\n }\n});\n\nexport const EXTENSIONS = {\n images: ['png', 'jpg', 'svg', 'jpeg', 'jpg'],\n code: ['js', 'json'],\n txt: ['log', 'txt', 'html', 'css', 'xml'],\n};\n\n/**\n * @typedef {object} FileViewerProps\n * @property {string} [key] The key to identify this component.\n * @property {import('../types').Translator} t Translation function\n * @property {ioBroker.Languages} [lang] The selected language.\n * @property {boolean} [expertMode] Is expert mode enabled? (default: false)\n * @property {() => void} onClose Callback when the viewer is closed.\n * @property {string} href The URL to the file to be displayed.\n *\n * @extends {React.Component<FileViewerProps>}\n */\nclass FileViewer extends React.Component {\n /**\n * @param {Readonly<FileViewerProps>} props\n */\n constructor(props) {\n super(props);\n\n this.ext = Utils.getFileExtension(this.props.href);\n\n this.state = {\n text: null,\n code: null,\n copyPossible: EXTENSIONS.code.includes(this.ext) || EXTENSIONS.txt.includes(this.ext),\n };\n\n if (this.state.copyPossible) {\n fetch(this.props.href)\n .then(response => response.text())\n .then(data => {\n if (EXTENSIONS.txt.includes(this.ext)) {\n this.setState({ text: data });\n } else if (EXTENSIONS.code.includes(this.ext)) {\n this.setState({ code: data });\n }\n });\n }\n }\n\n static getDerivedStateFromProps() {\n\n }\n\n getContent() {\n if (EXTENSIONS.images.includes(this.ext)) {\n return <img\n onError={ e => {\n e.target.onerror = null;\n e.target.src = NoImage;\n }}\n className={ this.props.classes.img }\n src={ this.props.href }\n alt={ this.props.href }\n />;\n } else if (this.state.code !== null) {\n return <TextField\n variant=\"standard\"\n className={ this.props.classes.textarea }\n multiline\n value={ this.state.code }\n InputProps={{\n readOnly: true,\n }}\n />;\n } else if (this.state.text !== null) {\n return <TextField\n variant=\"standard\"\n className={ this.props.classes.textarea }\n value={ this.state.code }\n multiline\n InputProps={{\n readOnly: true,\n }}\n />;\n }\n }\n\n render() {\n return <Dialog\n className={ this.props.classes.dialog }\n open={ !!this.props.href }\n onClose={ () => this.props.onClose() }\n fullWidth\n fullScreen={this.props.fullScreen !== undefined ? this.props.fullScreen : true}\n aria-labelledby=\"form-dialog-title\"\n >\n <DialogTitle id=\"form-dialog-title\">{ this.props.t('ra_View: %s', this.props.href) }</DialogTitle>\n <DialogContent className={ this.props.classes.content }>\n { this.getContent() }\n </DialogContent>\n <DialogActions>\n { this.state.copyPossible ? <Button color=\"grey\" onClick={e => Utils.copyToClipboard(this.state.text || this.state.code, e) } >\n <CopyIcon />\n { this.props.t('ra_Copy content') }\n </Button> : null }\n\n <Button onClick={() => this.props.onClose()} color=\"primary\">\n <CloseIcon />\n { this.props.t('ra_Close') }\n </Button>\n </DialogActions>\n </Dialog>;\n }\n}\n\nFileViewer.propTypes = {\n t: PropTypes.func,\n\n onClose: PropTypes.func,\n href: PropTypes.string.isRequired,\n fullScreen: PropTypes.bool,\n};\n\n/** @type {typeof FileViewer} */\nconst _export = withWidth()(withStyles(styles)(FileViewer));\nexport default _export;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AAGA;;AACA;;;;;;AAEA;AACA,IAAM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AE,iBAAAO,CAAC;UAAA,OAAIZ,iBAAA,CAAMwB,eAAN,CAAsB,MAAI,CAACrB,KAAL,CAAWC,IAAX,IAAmB,MAAI,CAACD,KAAL,CAAWP,IAApD,EAA0DgB,CAA1D,CAAJ;QAAA;MAA/B,gBACxB,gCAAC,UAAD,OADwB,EAEtB,KAAK/B,KAAL,CAAWyC,CAAX,CAAa,iBAAb,CAFsB,CAA1B,GAGU,IAJhB,eAMI,gCAAC,kBAAD;QAAQ,OAAO,EAAE;UAAA,OAAM,MAAI,CAACzC,KAAL,CAAWsC,OAAX,EAAN;QAAA,CAAjB;QAA6C,KAAK,EAAC;MAAnD,gBACI,gCAAC,iBAAD,OADJ,EAEM,KAAKtC,KAAL,CAAWyC,CAAX,CAAa,UAAb,CAFN,CANJ,CAZG,CAAP;IAwBH;;;WA/DD,oCAAkC,CAEjC;;;EA9BoBG,iBAAA,CAAMC,S;;AA8F/B5B,UAAU,CAAC6B,SAAX,GAAuB;EACnBL,CAAC,EAAEM,qBAAA,CAAUC,IADM;EAGnBV,OAAO,EAAES,qBAAA,CAAUC,IAHA;EAInB3B,IAAI,EAAE0B,qBAAA,CAAUE,MAAV,CAAiBC,UAJJ;EAKnBX,UAAU,EAAEQ,qBAAA,CAAUI;AALH,CAAvB;AAQA;;AACA,IAAMC,OAAO,GAAGtD,SAAS,GAAG,IAAAuD,sBAAA,EAAWpD,MAAX,EAAmBgB,UAAnB,CAAH,CAAzB;;eACemC,O"}
|
|
1
|
+
{"version":3,"file":"FileViewer.js","names":["styles","theme","dialog","height","paper","content","textAlign","textarea","width","img","objectFit","dialogTitle","justifyContent","display","EXTENSIONS","images","code","txt","bufferToBase64","buffer","binary","bytes","Uint8Array","len","byteLength","i","String","fromCharCode","window","btoa","FileViewer","props","id","fileName","size","state","changed","timeout","clearTimeout","setTimeout","alert","text","readFile","setState","forceUpdate","Date","now","parts","href","split","data","editingValue","splice","adapter","name","join","socket","writeFile64","Buffer","from","toString","then","_","onClose","e","ext","Utils","getFileExtension","editing","formatEditFile","copyPossible","includes","file","undefined","newState","type","AdminUtils","detectMimeType","supportSubscribes","subscribeFiles","onFileChanged","target","onerror","src","NoImage","clsx","classes","getClassBackgroundImage","newValue","readOnly","scrollPaper","t","setStateBackgroundImage","getContent","copyToClipboard","Component","propTypes","PropTypes","func","lang","string","expertMode","bool","isRequired","_export","withWidth","withStyles"],"sources":["FileViewer.js"],"sourcesContent":["import React, { Component } from 'react';\nimport { withStyles } from '@mui/styles';\nimport withWidth from './withWidth';\nimport PropTypes from 'prop-types';\n\nimport TextField from '@mui/material/TextField';\nimport Button from '@mui/material/Button';\nimport Dialog from '@mui/material/Dialog';\nimport DialogActions from '@mui/material/DialogActions';\nimport DialogContent from '@mui/material/DialogContent';\nimport DialogTitle from '@mui/material/DialogTitle';\nimport { IconButton } from '@mui/material';\n\nimport NoImage from '../assets/no_icon.svg';\nimport Utils from './Utils';\n\n// Icons\nimport { FaCopy as CopyIcon } from 'react-icons/fa';\nimport Brightness5Icon from '@mui/icons-material/Brightness6';\nimport CloseIcon from '@mui/icons-material/Close';\nimport SaveIcon from '@mui/icons-material/Save';\n\nconst styles = theme => ({\n dialog: {\n height: '100%',\n },\n paper: {\n height: 'calc(100% - 64px)',\n },\n content: {\n textAlign: 'center',\n },\n textarea: {\n width: '100%',\n height: '100%',\n },\n img: {\n width: 'auto',\n height: 'calc(100% - 5px)',\n objectFit: 'contain',\n },\n dialogTitle: {\n justifyContent: 'space-between',\n display: 'flex'\n }\n});\n\nexport const EXTENSIONS = {\n images: ['png', 'jpg', 'svg', 'jpeg', 'bmp'],\n code: ['js', 'json', 'md'],\n txt: ['log', 'txt', 'html', 'css', 'xml'],\n};\n\nfunction bufferToBase64(buffer) {\n let binary = '';\n let bytes = new Uint8Array(buffer);\n let len = bytes.byteLength;\n for (let i = 0; i < len && i < 50; i++) {\n binary += String.fromCharCode(bytes[i]);\n }\n return window.btoa(binary);\n}\n\n/**\n * @typedef {object} FileViewerProps\n * @property {string} [key] The key to identify this component.\n * @property {import('../types').Translator} t Translation function\n * @property {ioBroker.Languages} [lang] The selected language.\n * @property {boolean} [expertMode] Is expert mode enabled? (default: false)\n * @property {() => void} onClose Callback when the viewer is closed.\n * @property {string} href The URL to the file to be displayed.\n *\n * @extends {React.Component<FileViewerProps>}\n */\nclass FileViewer extends Component {\n /**\n * @param {Readonly<FileViewerProps>} props\n */\n constructor(props) {\n super(props);\n const ext = Utils.getFileExtension(this.props.href);\n\n this.state = {\n text: null,\n code: null,\n ext,\n editing: !!this.props.formatEditFile || false,\n editingValue: null,\n copyPossible: EXTENSIONS.code.includes(ext) || EXTENSIONS.txt.includes(ext),\n forceUpdate: Date.now(),\n changed: false,\n };\n }\n\n readFile() {\n if (this.props.href) {\n const parts = this.props.href.split('/');\n parts.splice(0, 2);\n const adapter = parts[0];\n const name = parts.splice(1).join('/');\n\n this.props.socket.readFile(adapter, name)\n .then(data => {\n if (data.file !== undefined) {\n data = data.file;\n }\n\n const newState = {copyPossible: this.state.copyPossible};\n // try to detect valid extension\n if (data.type === 'Buffer') {\n const ext = AdminUtils.detectMimeType(bufferToBase64(data.data));\n if (ext) {\n newState.ext = ext;\n newState.copyPossible = EXTENSIONS.code.includes(ext) || EXTENSIONS.txt.includes(ext);\n }\n }\n\n if (newState.copyPossible) {\n if (EXTENSIONS.txt.includes(this.state.ext)) {\n newState.text = data;\n newState.editingValue = data;\n } else if (EXTENSIONS.code.includes(this.state.ext)) {\n newState.code = data;\n newState.editingValue = data;\n }\n }\n\n this.setState(newState);\n })\n .catch(e => window.alert('Cannot read file: ' + e));\n }\n }\n\n componentDidMount() {\n this.readFile();\n\n const parts = this.props.href.split('/');\n parts.splice(0, 2);\n const adapter = parts[0];\n const name = parts.splice(1).join('/');\n\n this.props.supportSubscribes && this.props.socket.subscribeFiles(adapter, name, this.onFileChanged);\n }\n\n componentWillUnmount() {\n this.timeout && clearTimeout(this.timeout);\n const parts = this.props.href.split('/');\n parts.splice(0, 2);\n const adapter = parts[0];\n const name = parts.splice(1).join('/');\n this.props.supportSubscribes && this.props.socket.subscribeFiles(adapter, name, this.onFileChanged);\n }\n\n onFileChanged = (id, fileName, size) => {\n if (!this.state.changed) {\n this.timeout && clearTimeout(this.timeout);\n this.timeout = setTimeout(() => {\n this.timeout = null;\n if (size === null) {\n window.alert('Show file was deleted!');\n } else if (this.state.text !== null || this.state.code !== null) {\n this.readFile();\n } else {\n this.setState({ forceUpdate: Date.now() });\n }\n }, 300);\n }\n };\n\n writeFile64 = () => {\n const parts = this.props.href.split('/');\n const data = this.state.editingValue;\n parts.splice(0, 2);\n const adapter = parts[0];\n const name = parts.splice(1).join('/');\n this.props.socket.writeFile64(adapter, name, Buffer.from(data).toString('base64'))\n .then(_ => this.props.onClose())\n .catch(e => window.alert('Cannot write file: ' + e));\n }\n\n getEditFile(ext) {\n switch (ext) {\n case 'json':\n return 'json';\n case 'js':\n return 'javascript';\n case 'html':\n return 'html';\n case 'txt':\n return 'html';\n default:\n return 'json';\n }\n }\n\n getContent() {\n if (EXTENSIONS.images.includes(this.state.ext)) {\n return <img\n onError={e => {\n e.target.onerror = null;\n e.target.src = NoImage;\n }}\n className={Utils.clsx(this.props.classes.img, this.props.getClassBackgroundImage())}\n src={this.props.href + '?ts=' + this.state.forceUpdate}\n alt={this.props.href}\n />;\n } else if (this.state.code !== null || this.state.text !== null || this.state.editing) {\n return <TextField\n variant=\"standard\"\n className={ this.props.classes.textarea }\n multiline\n value={ this.state.editingValue || this.state.code || this.state.text }\n onChange={newValue => this.setState({ editingValue: newValue, changed: true })}\n InputProps={{ readOnly: !this.state.editing,}}\n />;\n }\n }\n\n render() {\n return <Dialog\n classes={{ scrollPaper: this.props.classes.dialog, paper: this.props.classes.paper }}\n scroll=\"paper\"\n open={!!this.props.href}\n onClose={() => this.props.onClose()}\n fullWidth={true}\n maxWidth=\"xl\"\n aria-labelledby=\"form-dialog-title\"\n >\n <div className={this.props.classes.dialogTitle}>\n <DialogTitle id=\"form-dialog-title\">{this.props.t(this.state.editing ? 'Edit' : 'View') + ': ' + this.props.href}</DialogTitle>\n {EXTENSIONS.images.includes(this.state.ext) && <div>\n <IconButton size=\"large\"\n color={'inherit'}\n onClick={this.props.setStateBackgroundImage}\n >\n <Brightness5Icon />\n </IconButton>\n </div>\n }\n </div>\n <DialogContent className={this.props.classes.content}>\n {this.getContent()}\n </DialogContent>\n <DialogActions>\n {this.state.copyPossible ?\n <Button\n color=\"grey\"\n onClick={e => Utils.copyToClipboard(this.state.text || this.state.code, e)}\n startIcon={<CopyIcon />}\n >\n {this.props.t('Copy content')}\n </Button> : null}\n {this.state.editing ?\n <Button\n color=\"grey\"\n disabled={this.state.editingValue === this.state.code || this.state.editingValue === this.state.text}\n variant=\"contained\"\n onClick={this.writeFile64}\n startIcon={<SaveIcon />}\n >\n {this.props.t('Save')}\n </Button> : null}\n <Button\n variant=\"contained\"\n onClick={() => this.props.onClose()}\n color=\"primary\"\n startIcon={<CloseIcon />}\n >\n {this.props.t('Close')}\n </Button>\n </DialogActions>\n </Dialog>;\n }\n}\n\nFileViewer.propTypes = {\n t: PropTypes.func,\n lang: PropTypes.string,\n expertMode: PropTypes.bool,\n onClose: PropTypes.func,\n href: PropTypes.string.isRequired,\n supportSubscribes: PropTypes.bool,\n};\n\n/** @type {typeof FileViewer} */\nconst _export = withWidth()(withStyles(styles)(FileViewer));\nexport default _export;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AAGA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,IAAMA,MAAM,GAAG,SAATA,MAAS,CAAAC,KAAK;EAAA,OAAK;IACrBC,MAAM,EAAE;MACJC,MAAM,EAAE;IADJ,CADa;IAIrBC,KAAK,EAAE;MACHD,MAAM,EAAE;IADL,CAJc;IAOrBE,OAAO,EAAE;MACLC,SAAS,EAAE;IADN,CAPY;IAUrBC,QAAQ,EAA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