"use strict";var _interopRequireWildcard=require("@babel/runtime/helpers/interopRequireWildcard"),_interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=void 0;var _classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")),_createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass")),_assertThisInitialized2=_interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized")),_inherits2=_interopRequireDefault(require("@babel/runtime/helpers/inherits")),_possibleConstructorReturn2=_interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn")),_getPrototypeOf2=_interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf")),_defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty")),_react=_interopRequireWildcard(require("react")),_reactDropzone=_interopRequireDefault(require("react-dropzone")),_ErrorBoundary=_interopRequireDefault(require("../../hoc/ErrorBoundary")),_react2=require("@lingui/react");function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function(){var result,Super=(0,_getPrototypeOf2["default"])(Derived);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)}}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}var Accept=/*#__PURE__*/function(_Component){function Accept(){var _this;(0,_classCallCheck2["default"])(this,Accept);for(var _len=arguments.length,args=Array(_len),_key=0;_key<_len;_key++)args[_key]=arguments[_key];return _this=_super.call.apply(_super,[this].concat(args)),(0,_defineProperty2["default"])((0,_assertThisInitialized2["default"])(_this),"dropzoneRef",void 0),(0,_defineProperty2["default"])((0,_assertThisInitialized2["default"])(_this),"state",{accepted:[],rejected:[]}),_this}(0,_inherits2["default"])(Accept,_Component);var _super=_createSuper(Accept);return(0,_createClass2["default"])(Accept,[{key:"render",value:function render(){var _this2=this;return/*#__PURE__*/_react["default"].createElement(_ErrorBoundary["default"],null,/*#__PURE__*/_react["default"].createElement("section",null,/*#__PURE__*/_react["default"].createElement("div",{className:"dropzone"},/*#__PURE__*/_react["default"].createElement(_reactDropzone["default"],{ref:function ref(node){_this2.dropzoneRef=node},accept:"image/jpeg, image/png",onDrop:function onDrop(accepted,rejected){_this2.setState({accepted:accepted,rejected:rejected})}},/*#__PURE__*/_react["default"].createElement("p",null,/*#__PURE__*/_react["default"].createElement(_react2.Trans,{id:"Try dropping some files here, or click to select files to upload."})),/*#__PURE__*/_react["default"].createElement("p",null,/*#__PURE__*/_react["default"].createElement(_react2.Trans,{id:"Only *.jpeg and *.png images will be accepted"})))),/*#__PURE__*/_react["default"].createElement("aside",null,/*#__PURE__*/_react["default"].createElement("h2",null,/*#__PURE__*/_react["default"].createElement(_react2.Trans,{id:"Accepted files"})),/*#__PURE__*/_react["default"].createElement("ul",null,this.state.accepted.map(function(f){return/*#__PURE__*/_react["default"].createElement("li",{key:f.name},f.name," - ",f.size," bytes")})),/*#__PURE__*/_react["default"].createElement("h2",null,/*#__PURE__*/_react["default"].createElement(_react2.Trans,{id:"Rejected files"})),/*#__PURE__*/_react["default"].createElement("ul",null,this.state.rejected.map(function(f){return/*#__PURE__*/_react["default"].createElement("li",{key:f.name},f.name," - ",f.size," bytes")}))),/*#__PURE__*/_react["default"].createElement("button",{type:"button",onClick:function onClick(){_this2.dropzoneRef.open()}},/*#__PURE__*/_react["default"].createElement(_react2.Trans,{id:"Open File Dialog"}))))}}]),Accept}(_react.Component),_default=Accept;exports["default"]=_default;