text: ($WP="undefined"!=typeof $WP?$WP:[]).push({id:"@ta/input.drop-zone",d:["vendor-babel","vendor-react-libs"],e:["./packages/input/drop-zone/index.jsx"],x:{"./packages/input/drop-zone/index.jsx":["DropZone","fileExtentsion","processFile","processFilesFromDrop","maxImageUploadSizeInMB","maxImageUploadSizeInBytes","maxVideoUploadSizeInBytes"]},m:{"./packages/input/drop-zone/index.jsx":function(e,n,r){"use strict";r.r(n);var t=r("@babel/runtime/helpers/esm/extends"),i=r.n(t),o=r("@babel/runtime/helpers/esm/classCallCheck"),a=r.n(o),s=r("@babel/runtime/helpers/esm/createClass"),l=r.n(s),p=r("@babel/runtime/helpers/esm/possibleConstructorReturn"),d=r.n(p),u=r("@babel/runtime/helpers/esm/getPrototypeOf"),f=r.n(u),c=r("@babel/runtime/helpers/esm/inherits"),v=r.n(c),m=r("@babel/runtime/helpers/esm/assertThisInitialized"),g=r.n(m),h=r("@babel/runtime/helpers/esm/defineProperty"),D=r.n(h),b=r("react"),y={dropZone:"input-drop-zone-DropZone__dropZone--2XjBc",isDragOver:"input-drop-zone-DropZone__isDragOver--2tkzq"},w=function e(n){var r=n.lastIndexOf(".");if(!(r<0))return n.substring(r).toLowerCase()},O=function e(n,r,t,i,o,a){var s=function e(n,r,t){if(t&&n.size>t)return"file_too_large";if(r){var i=w(n.name);if(!i)return"wrong_file_type";if(!r.includes(i))return"wrong_file_type"}}(n,t,i);s?o&&o(n,s):r(n,a)},x=function e(n,r,t,i,o){if(n.dataTransfer.items)for(var a=0;a<n.dataTransfer.items.length;a++){var s=n.dataTransfer.items[a].getAsFile();O(s,r,t,i,o,"drag_drop")}else for(var l=0;l<n.dataTransfer.files.length;l++){var p=n.dataTransfer.files[l];O(p,r,t,i,o,"drag_drop")}},I=function(e){function n(e){var r;return a()(this,n),r=d()(this,f()(n).call(this,e)),D()(g()(g()(r)),"fileInputRef",void 0),D()(g()(g()(r)),"eventPreventDefault",function(e){e.preventDefault()}),D()(g()(g()(r)),"handleDragOver",function(e){e.preventDefault(),r.setState({isDragOver:!0})}),D()(g()(g()(r)),"handleDragLeave",function(e){e.preventDefault(),r.setState({isDragOver:!1})}),D()(g()(g()(r)),"handleDrop",function(e){e.preventDefault(),x(e,r.props.addFile,r.props.allowedFileTypes,r.props.maxSizeInBytes,r.props.fileRejected),r.setState({isDragOver:!1})}),D()(g()(g()(r)),"fileSelectionChanged",function(e){var n=e.target.files;Array.from(n).forEach(function(e){return O(e,r.props.addFile,r.props.allowedFileTypes,r.props.maxSizeInBytes,r.props.fileRejected,"file_picker")}),r.fileInputRef.value=""}),D()(g()(g()(r)),"render",function(){var e=r.props.allowMultipleSelection?{multiple:!0}:{};return b.createElement("div",{style:{width:r.props.width,height:r.props.height},className:"".concat(y.dropZone," ").concat(r.props.isDragOverOutsideComponent||r.state.isDragOver?y.isDragOver:""),onDragOver:r.handleDragOver,onDragLeave:r.handleDragLeave,onDrop:r.handleDrop,onClick:function e(){return r.fileInputRef.click()}},b.createElement("input",i()({style:{display:"none"},type:"file",name:"media",accept:r.props.allowedFileTypes.join(",")},e,{onChange:r.fileSelectionChanged,onClick:function e(n){return n.stopPropagation()},ref:function e(n){r.fileInputRef=n}})),r.props.children)}),r.state={isDragOver:!1},r}return v()(n,e),l()(n,[{key:"componentDidMount",value:function e(){this.props.disableOnDropForPage&&(window.addEventListener("dragover",this.eventPreventDefault),window.addEventListener("drop",this.eventPreventDefault))}},{key:"componentWillUnmount",value:function e(){this.props.disableOnDropForPage&&(window.removeEventListener("dragover",this.eventPreventDefault),window.removeEventListener("drop",this.eventPreventDefault))}}]),n}(b.Component);D()(I,"defaultProps",{allowedFileTypes:["*"],allowMultipleSelection:!0,disableOnDropForPage:!0,isDragOverOutsideComponent:!1,width:"100%",height:"100%"}),r.d(n,"DropZone",function(){return I}),r.d(n,"fileExtentsion",function(){return w}),r.d(n,"processFile",function(){return O}),r.d(n,"processFilesFromDrop",function(){return x}),r.d(n,"maxImageUploadSizeInMB",function(){return 15}),r.d(n,"maxImageUploadSizeInBytes",function(){return 15728640}),r.d(n,"maxVideoUploadSizeInBytes",function(){return 524288e3})}}});
  //# sourceMappingURL=input.drop-zone.504ebbe6cb.js.map