react-core-image-upload
Version:
a component for image to upload and crop
2 lines • 39.5 kB
JavaScript
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("react"),require("prop-types"));else if("function"==typeof define&&define.amd)define(["react","prop-types"],t);else{var o="object"==typeof exports?t(require("react"),require("prop-types")):t(e.react,e["prop-types"]);for(var i in o)("object"==typeof exports?exports:e)[i]=o[i]}}(this,function(e,t){return function(e){function t(i){if(o[i])return o[i].exports;var r=o[i]={exports:{},id:i,loaded:!1};return e[i].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var o={};return t.m=e,t.c=o,t.p="",t(0)}([function(e,t,o){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},p=function(){function e(e,t){for(var o=0;o<t.length;o++){var i=t[o];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,o,i){return o&&e(t.prototype,o),i&&e(t,i),t}}(),l=o(1),c=i(l),u=o(2),f=i(u),d=o(3),h=i(d),g=o(4),m=i(g),A=o(6),b=i(A),v=o(12),y=i(v),x=o(13),C=i(x);o(14);var w="",I=function(e){function t(e){r(this,t);var o=n(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return o.state={formID:"g-core-upload-input-"+Math.floor(1e4*Math.random()),uploading:!1,hasImage:!1,image:{src:"http://img1.vued.vanthink.cn/vuedcb0efb21e5f2ca013ca1480198bbf4b3.png",width:0,height:0}},o.multiple?o.name=o.props.inputOfFile+"[]":o.name=o.props.inputOfFile,o.change=o.change.bind(o),o.doCrop=o.doCrop.bind(o),o.doResize=o.doResize.bind(o),o.cancel=o.cancel.bind(o),o}return a(t,e),p(t,[{key:"render",value:function(){var e=this;return c.default.createElement("div",{className:this.props.className+" g-core-image-upload-btn",id:this.state.formID},this.props.children?this.props.children:this.props.text,c.default.createElement("form",{className:"g-core-image-upload-form",method:"post",encType:"multipart/form-data",action:"",style:{display:"block",cursor:"pointer",position:"absolute",left:0,top:0,width:"100%",height:"100%",opacity:0,margin:0,padding:0,overflow:"hidden"}},c.default.createElement("input",{disabled:this.state.uploading,onChange:this.change,name:this.props.inputOfFile,type:"file",multiple:this.props.multiple,accept:this.props.inputAccept,style:{width:"100%",height:"100%"}})),c.default.createElement("div",{className:"g-core-image-corp-container",style:{display:this.state.hasImage?"block":"none"}},c.default.createElement(b.default,{ref:function(t){return e.cropbox=t},isResize:this.props.resize&&!this.props.crop,ratio:this.props.ratio}),c.default.createElement("div",{className:"info-aside"},this.props.crop?c.default.createElement("p",{className:"btn-groups"},c.default.createElement("button",{type:"button",onClick:this.doCrop,className:"btn btn-upload"},this.props.cropBtn.ok),c.default.createElement("button",{type:"button",onClick:this.cancel,className:"btn btn-cancel"},this.props.cropBtn.cancel)):null,this.props.resize?c.default.createElement("p",{className:"btn-groups"},c.default.createElement("button",{type:"button",onClick:this.doResize,className:"btn btn-upload"},this.props.resizeBtn.ok),c.default.createElement("button",{type:"button",onClick:this.cancel,className:"btn btn-cancel"},this.props.resizeBtn.cancel)):null)))}},{key:"__dispatch",value:function(e,t){this.props[e]&&"function"==typeof this.props[e]&&this.props[e].apply(this,Array.from(arguments).slice(1))}},{key:"__find",value:function(e){var t=document.getElementById(this.state.formID);return t.querySelector(e)}},{key:"change",value:function(e){var t=this,o=this.__find("input").value.replace(/C:\\fakepath\\/i,""),i=o.substring(o.lastIndexOf(".")+1),r=this.props.extensions;if(r.length>1){var n=new RegExp("^["+r.join("|")+"]+$","i");if(!n.test(i))return this.__dispatch("errorHandle".errorCode.FILE_FORMAT)}if(e.target.files[0].size>this.props.maxFileSize){var a;return a=parseInt(this.maxFileSize/1024/1024)>0?(this.maxFileSize/1024/1024).toFixed(2)+"MB":parseInt(this.maxFileSize/1024)>0?(this.maxFileSize/1024).toFixed(2)+"kB":options.maxFileSize.toFixed(2)+"Byte",void this.__dispatch("errorHandle",y.default.FILE_MAXSIZE,"FILE IS TOO LARGER THAN THE MAX VALUE "+a)}return this.files=e.target.files,this.props.crop||this.props.resize?void this.__showImage():(this.__dispatch("imageChanged",this.files.length>1?this.files:this.files[0]),void(this.props.compress&&"image/png"!==this.files[0].type&&"image/gif"!==this.files[0].type?C.default.compress(this.files[0],100-this.props.compress,function(e){t.tryAjaxUpload("",!0,e)}):this.tryAjaxUpload()))}},{key:"__showImage",value:function(){this.setState({hasImage:!0}),this.__readFiles()}},{key:"__readFiles",value:function(){var e=new FileReader,t=this;e.onload=function(e){var o=e.target.result;w=document.body.style.overflow,document.body.style.overflow="hidden",t.__initImage(o)},e.readAsDataURL(this.files[0])}},{key:"__initImage",value:function(e){var t=new Image,o=this;t.src=e;var i=this.cropbox;t.onload=function(){o.setState({image:{src:e,width:t.naturalWidth,height:t.naturalHeight}}),o.imgChangeRatio=i.setImage(e,t.naturalWidth,t.naturalHeight)}}},{key:"resizeImage",value:function(e){var t=this.$refs.cropBox;t.resizeImage(e)}},{key:"doCrop",value:function(e){this.__setData("crop");var t=this.cropbox,o=this.__setUpload(e.target);if("local"===this.props.crop){var i=t.getCropImage();return this.props.data.comprese=100-this.props.compress,C.default.crop(i,this.props.data,function(e){console.log(e),o(e)})}o()}},{key:"doResize",value:function(e){this.__setData("reszie");var t=this.cropbox,o=this.__setUpload(e.target);if("local"===this.props.resize){var i=t.getCropImage();return this.data.comprose=100-this.compress,C.default.resize(i,this.data,function(e){o(e)})}o()}},{key:"__setData",value:function(e){this.props.data.request=e;var t=this.cropbox,o=t.getCropData(),i=!0,r=!1,n=void 0;try{for(var a,s=Object.keys(o)[Symbol.iterator]();!(i=(a=s.next()).done);i=!0){var p=a.value;this.props.data[p]=o[p]}}catch(e){r=!0,n=e}finally{try{!i&&s.return&&s.return()}finally{if(r)throw n}}this.props.maxWidth&&(this.props.data.maxWidth=this.maxWidth),this.maxHeight&&(this.props.data.maxHeight=this.maxHeight),this.minWidth&&(this.props.data.minWidth=this.minWidth)}},{key:"__setUpload",value:function(e){var t=this;e.value=e.value+"...",e.disabled=!0;var o=function(o){t.tryAjaxUpload(function(){e.value=e.value.replace("...",""),e.disabled=!1},!!o,o)};return o}},{key:"cancel",value:function(){this.setState({hasImage:!1}),document.body.style.overflow=w,this.files="",this.__find("input").value=""}},{key:"tryAjaxUpload",value:function(e,t,o){var i=this;this.__dispatch("imageuploading",this.files[0]);var r=function(t){"function"==typeof e&&e(),i.uploading=!1,i.cancel(),i.__dispatch("imageUploaded",t)},n=function(e){i.__dispatch("errorHandle",y.default.SERVER_ERROR)};if(!this.props.isXhr)return this.props.crop&&this.setState(hasImage),"function"==typeof e&&e();var a=void 0;if(t)a={type:this.files[0].type,filename:this.files[0].name,filed:this.props.inputOfFile,base64Code:o},"object"===s(this.props.data)&&(a=Object.assign(this.props.data,a));else{a=new FormData;for(var p=0;p<this.files.length;p++)a.append(this.name,this.files[p]);if("object"===s(this.props.data))for(var l in this.props.data)void 0!==this.props.data[l]&&a.append(l,this.props.data[l])}(0,f.default)("POST",this.props.url,this.props.headers,a,r,n,t)}}]),t}(c.default.Component);I.propTypes=m.default,I.defaultProps=h.default,t.default=I},function(t,o){t.exports=e},function(e,t){"use strict";var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};void 0===XMLHttpRequest.prototype.sendAsBinary&&(XMLHttpRequest.prototype.sendAsBinary=function(e){var t=Array.prototype.map.call(e,function(e){return 255&e.charCodeAt(0)});this.send(new Uint8Array(t).buffer)}),e.exports=function(e,t,i,r,n,a,s,p){function l(e){for(var t={},o=/([a-z\-]+):\s?(.*);?/gi,i=void 0;i=o.exec(e);)t[i[1]]=i[2];return t}var c=new XMLHttpRequest,u=a||function(){console.error("AJAX ERROR!")},f="webcodeimageupload",d=!1;"blob"===e&&(d=e,e="GET"),e=e.toUpperCase(),c.onload=function(){var t=c.response;try{t=JSON.parse(c.responseText)}catch(e){401===c.status&&(t=u("access_denied",c.statusText))}var o=l(c.getAllResponseHeaders());o.statusCode=c.status,n(t||("GET"===e?u("empty_response","Could not get resource"):{}),o)},c.onerror=function(){var e=c.responseText;try{e=JSON.parse(c.responseText)}catch(e){console.error(e)}n(e||u("access_denied","Could not get resource"))};var h=void 0;if("GET"===e||"DELETE"===e)r=null;else if(s){var g=r,m=r.base64Code.replace("data:"+r.type+";base64,","");r=["--"+f,'Content-Disposition: form-data; name="'+r.filed+'"; filename="'+r.filename+'"',"Content-Type: "+r.type,"",window.atob(m),""].join("\r\n");var A=Object.keys(g);if(A.length>4){var b=!0,v=!1,y=void 0;try{for(var x,C=A[Symbol.iterator]();!(b=(x=C.next()).done);b=!0){var w=x.value;["filed","filename","type","base64Code"].indexOf(w)==-1&&(r+=["--"+f,'Content-Disposition: form-data; name="'+w+'";',"",""].join("\r\n"),r+=["object"===o(g[w])?JSON.stringify(g[w]):encodeURI(g[w]),""].join("\r\n"))}}catch(e){v=!0,y=e}finally{try{!b&&C.return&&C.return()}finally{if(v)throw y}}}r+="--"+f+"--"}if(c.open(e,t,!0),d&&("responseType"in c?c.responseType=d:c.overrideMimeType("text/plain; charset=x-user-defined")),i)for(h in i)c.setRequestHeader(h,i[h]);return c.withCredentials="undefined"==typeof p||p,s?(c.setRequestHeader("Content-Type","multipart/form-data; boundary="+f),c.sendAsBinary(r)):(c.send(r),c)}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={url:"",text:"upload",inputOfFile:"files",crop:!1,cropBtn:{ok:"Save",cancel:"Cancel"},extensions:["png","jpg","jpeg","gif","svg","webp"],cropRatio:"1:1",resize:!1,resizeBtn:{ok:"Save",cancel:"Cancel"},inputAccept:"image/jpg,image/jpeg,image/png",data:{},header:{},isXhr:!0,multiple:!1,compress:0,imageUploaded:function(e){},imageUploading:function(e){console.info("uploading")},imageChanged:function(){},errorHandle:function(e){console.error(e)}}},function(e,t,o){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=o(5),n=i(r);t.default={url:n.default.string,text:n.default.string,inputAccept:n.default.string,inputOfFile:n.default.string,cropBtn:n.default.object,cropRatio:n.default.string,resizeBtn:n.default.object,maxFileSize:n.default.number,maxWidth:n.default.number,maxHeight:n.default.number,minWidth:n.default.number,minHeight:n.default.number,data:n.default.object,header:n.default.object,multipleSize:n.default.number,compress:n.default.number}},function(e,o){e.exports=t},function(e,t,o){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var o=0;o<t.length;o++){var i=t[o];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,o,i){return o&&e(t.prototype,o),i&&e(t,i),t}}(),p=o(1),l=i(p),c=o(5),u=i(c),f=o(7),d=i(f),h=o(8),g=i(h),m=o(10),A=i(m),b=o(9),v=i(b),y=o(11),x=i(y),C=75,w=(g.default.isMobile,window.innerWidth-60),I=window.innerHeight-110,E=function(e){function t(e){r(this,t);var o=n(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return o.state={left:0,top:0,width:0,height:0,cropCSS:{left:0,top:0,width:0,height:0},src:x.default},o.drag=o.drag.bind(o),o.resize=o.resize.bind(o),o.resizeImage=o.resizeImage.bind(o),o}return a(t,e),s(t,[{key:"render",value:function(){return l.default.createElement("div",{className:"image-aside",ref:"container"},l.default.createElement("div",{className:"g-crop-image-box"},l.default.createElement("div",{className:"g-crop-image-principal",onTouchStart:this.drag,onMouseDown:this.drag},l.default.createElement("div",{className:"image-wrap",style:{width:this.state.width,height:this.state.height,left:this.state.left,top:this.state.top,backgroundImage:"url("+this.state.src+")",cursor:this.props.isResize?"default":"move"}},l.default.createElement("img",{ref:"crop-image",style:{width:0,height:0},src:this.state.src})),this.props.isResize?null:l.default.createElement("div",{className:"image-mask"},l.default.createElement("div",{className:"mask top",style:{top:0,height:this.state.cropCSS.top+"px",left:0,width:"100%"}}),l.default.createElement("div",{className:"mask bottom",style:{bottom:0,top:this.state.cropCSS.top+this.state.cropCSS.height+"px",left:0,width:"100%"}}),l.default.createElement("div",{className:"mask left",style:{top:this.state.cropCSS.top+"px",height:this.state.cropCSS.height+"px",left:0,width:this.state.cropCSS.left+"px"}}),l.default.createElement("div",{className:"mask right",style:{top:this.state.cropCSS.top+"px",height:this.state.cropCSS.height+"px",left:this.state.cropCSS.left+this.state.cropCSS.width+"px",right:0}})),this.props.isResize?"":l.default.createElement("div",{className:"crop-box",ref:"cropbox",style:{top:this.state.cropCSS.top+"px",left:this.state.cropCSS.left+"px",height:this.state.cropCSS.height+"px",width:this.state.cropCSS.width+"px"}},l.default.createElement("div",{className:"reference-line v"}),l.default.createElement("div",{className:"reference-line h"}),l.default.createElement("a",{className:"g-resize",onTouchStart:this.resize,onMouseDown:this.resize}))),l.default.createElement(d.default,{ref:"resizeBar",resize:this.resizeImage})))}},{key:"setImage",value:function(e,t,o){this.setState({src:e}),this.props.ratio.indexOf(":")>0?(this.ratioW=this.props.ratio.split(":")[0],this.ratioH=this.props.ratio.split(":")[1],this.ratioVal=this.ratioW/this.ratioH):(this.ratioW=1,this.ratioH=1,this.ratioVal=this.ratio),this.natrualWidth=t,this.natrualHeight=o,this.setLayout(t,o);var i=this.refs.resizeBar;return this.props.isResize?i.setProgress(100):i.setProgress(0),this.imgChangeRatio}},{key:"resizeImage",value:function(e){var t=void 0,o=void 0;this.props.isResize?(t=this.natrualWidth*this.imgChangeRatio*e,o=this.natrualHeight*this.imgChangeRatio*e):(t=this.initWidth+e*(this.natrualWidth-this.initWidth),o=this.initHeight+e*(this.natrualHeight-this.initHeight)),t<=this.props.minWidth||o<this.props.minHeight||(this.setState({left:this.state.left+(this.state.width-t)/2,top:this.state.top+(this.state.height-o)/2,width:t,height:o}),this.imgChangeRatio=this.width/this.natrualWidth)}},{key:"setLayout",value:function(e,t){var o=I,i=w,r=e,n=t,a=0,s=0,p=r/n,l=i/o;p>l?(n=o,r=o*p,a=(i-o*p)/2):(r=o*p,n=o,a=(i-o*p)/2),this._setStyle(r,n,a,s,p,!0)}},{key:"_setStyle",value:function(e,t,o,i,r,n){var a=this.__find(".g-crop-image-principal");n||(this.marginLeft=this.marginLeft+(this.width-e)/2,this.marginTop=this.marginTop+(this.height-t)/2),a.style.cssText="width:"+e+"px;height:"+t+"px;margin-left:"+o+"px;margin-top:"+i+"px";var s=this.setCropBox(e,t),p=void 0,l=void 0;if(this.props.isResize)this.setState({width:e,height:t});else{r>=1?(l=s.height,p=l*r):(p=s.width,l=p/r),this.initWidth=p,this.initHeight=l;var c=(e-p)/2,u=(t-l)/2;this.setState({width:p,height:l,left:c,top:u})}this.imgChangeRatio=p/this.natrualWidth}},{key:"setCropBox",value:function(e,t,o){if(!this.props.isResize){var i=this.refs.cropbox,r=(this.refs.container,e),n=t,a=this.ratioW,s=this.ratioH,p=r;w<e&&(p=w);var l=p/100*C,c={width:l,height:l/a*s};if(c.left=(r-l)/2,c.top=(n-c.height)/2,i.style.cssText=g.default.setCssText(c),c.height>n){var u=n/100*C;c.height=u,c.width=c.height*a/s,c.left=(r-c.width)/2,c.top=(n-c.height)/2,i.style.cssText=g.default.setCssText(c)}return this.setState({cropCSS:c}),c}}},{key:"getCropData",value:function(){return this.props.isResize?{imgChangeRatio:this.imgChangeRatio,toCropImgX:0,toCropImgY:0,toCropImgW:this.natrualWidth,toCropImgH:this.natrualHeight}:{toCropImgX:(this.state.cropCSS.left-this.state.left)/this.imgChangeRatio,toCropImgY:(this.state.cropCSS.top-this.state.top)/this.imgChangeRatio,toCropImgW:this.state.cropCSS.width/this.imgChangeRatio,toCropImgH:this.state.cropCSS.height/this.imgChangeRatio}}},{key:"getCropImage",value:function(){return this.refs["crop-image"]}},{key:"__find",value:function(e){var t=this.refs.container;return t.querySelector(e)}},{key:"resize",value:function(e){if(e.stopPropagation(),this.props.ratio.indexOf(":")){var t=e.target.parentElement,o=this.__find(".g-crop-image-principal");this._$container&&(this._$container=container);var i=this,r={x:g.default.isMobile?e.touches[0].clientX:e.clientX,y:g.default.isMobile?e.touches[0].clientY:e.clientY,w:t.offsetWidth,h:t.offsetHeight};this.el=t,this.container=o;var n=function(e){var t=(0,A.default)(e,i.el,o,r,i.ratioVal);t&&i.setState({cropCSS:{width:t.width,height:t.height}})},a=function e(t){this.el=null,g.default.isMobile&&(document.removeEventListener("touchmove",n,!1),document.removeEventListener("touchend",e,!1)),document.removeEventListener("mousemove",n,!1),document.removeEventListener("mouseup",e,!1)};g.default.isMobile&&(document.addEventListener("touchmove",n,!1),document.addEventListener("touchend",a,!1)),document.addEventListener("mousemove",n,!1),document.addEventListener("mouseup",a,!1)}}},{key:"drag",value:function(e){e.preventDefault();var t=this.__find(".image-wrap");this.el=t;var o=this.__find(".crop-box"),i=(e.currentTarget,this),r=g.default.isMobile,n={x:(r?e.touches[0].clientX:e.clientX)-t.offsetLeft,y:(r?e.touches[0].clientY:e.clientY)-t.offsetTop,maxLeft:o.offsetLeft,maxTop:o.offsetTop,minLeft:o.offsetWidth+o.offsetLeft-t.offsetWidth,minTop:o.offsetHeight+o.offsetTop-t.offsetHeight},a=function(e){var t=(0,v.default)(e,i.el,n);t&&i.setState({left:t.left,top:t.top})},s=function e(t){return i.el=null,r?(document.removeEventListener("touchmove",a,!1),void document.removeEventListener("touchend",e,!1)):(document.removeEventListener("mousemove",a,!1),void document.removeEventListener("mouseup",e,!1))};return r?(document.addEventListener("touchmove",a,!1),void document.addEventListener("touchend",s,!1)):(document.addEventListener("mousemove",a,!1),void document.addEventListener("mouseup",s,!1))}}]),t}(l.default.Component);t.default=E,E.propTypes={isResize:u.default.bool,minWidth:u.default.number,minHeight:u.default.number,ratio:u.default.string},E.defaultProps={isResize:!1,minWidth:50,minHeight:50,ratio:"1:1"}},function(e,t,o){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var o=0;o<t.length;o++){var i=t[o];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,o,i){return o&&e(t.prototype,o),i&&e(t,i),t}}(),p=o(1),l=i(p),c=o(5),u=i(c),f=o(8),d=i(f),h=o(9),g=i(h),m=function(e){function t(e){r(this,t);var o=n(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return o.state={left:0},o.drag=o.drag.bind(o),o}return a(t,e),s(t,[{key:"render",value:function(){return l.default.createElement("div",{className:"g-resize-bar",ref:"container"},l.default.createElement("div",{className:"g-resize-highlight",style:{width:this.state.left+"%"}}),l.default.createElement("button",{className:"circle-btn",onTouchStart:this.drag,onMouseDown:this.drag,style:{left:this.state.left+"%"}}))}},{key:"setProgress",value:function(e){this.setState({left:e})}},{key:"drag",value:function(e){var t=e.target;this.el=t;var o=this.refs.container.parentElement,i=this,r=d.default.isMobile,n=200,a={x:(r?e.touches[0].clientX:e.clientX)-t.offsetLeft,y:(r?e.touches[0].clientY:e.clientY)-t.offsetTop,maxLeft:n,maxTop:parseInt(o.style.height)-parseInt(t.style.height),minLeft:0,minTop:0},s=function(e){var t=(0,g.default)(e,i.el,a);if(t){if(t.left/n<i.minProgress)return;i.progress=t.left/n,i.setState({left:t.left/n*100}),i.props.resize(i.progress)}},p=function e(t){return i.el=null,r?(document.removeEventListener("touchmove",s,!1),void document.removeEventListener("touchend",e,!1)):(document.removeEventListener("mousemove",s,!1),void document.removeEventListener("mouseup",e,!1))};return r?(document.addEventListener("touchmove",s,!1),void document.addEventListener("touchend",p,!1)):(document.addEventListener("mousemove",s,!1),void document.addEventListener("mouseup",p,!1))}}]),t}(l.default.Component);t.default=m,m.PropTypes={minProgress:u.default.minProgress,resize:u.default.function},m.defaultProps={minProgress:0}},function(e,t){"use strict";e.exports={isMobile:/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),setCssText:function(e){var t=[];for(var o in e){var i=e[o];"number"==typeof i&&(i=""+i+"px"),t.push(o+": "+i+";")}return t.join("")}}},function(e,t,o){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function r(e,t,o){if(t){var i=s?e.changedTouches[0].clientX:e.clientX,r=s?e.changedTouches[0].clientY:e.clientY,n=i-o.x,a=r-o.y;return n<=o.minLeft&&(n=o.minLeft),n>=o.maxLeft&&(n=o.maxLeft),a<=o.minTop&&(a=o.minTop),a>=o.maxTop&&(a=o.maxTop),{left:n,top:a}}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r;var n=o(8),a=i(n),s=a.default.isMobile},function(e,t,o){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function r(e,t,o,i,r){if(t){var n=document.body.offsetHeight,a=1/r,l=parseInt(window.getComputedStyle(o).width),c=parseInt(window.getComputedStyle(o).height),u=document.querySelector(".info-aside"),f=(p-l)/2,d=parseInt(window.getComputedStyle(u).height),h=(n-c-d)/2,g=s?e.changedTouches[0].clientX:e.clientX,m=s?e.changedTouches[0].clientY:e.clientY,A=parseInt(t.offsetWidth),b=parseInt(t.offsetHeight),v={};return r>=1&&g<=f+l?(A>=l&&(v.width=l),v.width=i.w+g-i.x,v.height=A*a,l>c?A>c&&(v.height=c,v.width=c*r):l<c?A>l&&(v.width=l,v.height=l*a):A>=l&&(v.width=l,v.height=l*a)):r<1&&m<h+c+d?(v.height=i.h+m-i.y,v.width=parseInt(t.style.height)*r,l>c?b>c&&(v.height=c,v.width=c*r):l<c?A>l&&(v.width=l,v.height=l*a):A>l&&(v.width=l,v.height=l*a)):"auto"==r&&m<=h+c+d&&g<=h+l?(v.height=i.h+m-i.y,v.width=i.w+g-i.x):g<=f+l&&(v.width=i.w+g-i.x,v.height=t.style.width,l>c?b>c&&(v.height=c,v.width=c):l<c?A>l&&(v.width=l,v.height=l):A>l&&(v.width=t.style.height=l)),v}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r;var n=o(8),a=i(n),s=a.default.isMobile,p=document.body.offsetWidth},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o="data:image/gif;base64,R0lGODlhGAAYAPQAAP///3FxcePj4/v7++3t7dLS0vHx8b+/v+Dg4MfHx+jo6M7Oztvb2/f397Kysru7u9fX16qqqgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi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},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=2500,i=2501,r=2502;t.default={SERVER_ERROR:o,FILE_SIZE_ERROR:i,FILE_FORMAT:r}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={_getImageType:function(e){var t="image/jpeg",o=e.match(/(image\/[\w]+)\.*/)[0];return"undefined"!=typeof o&&(t=o),t},compress:function(e,t,o){var i=new FileReader,r=this;i.onload=function(i){var n=new Image;n.src=i.target.result,n.onload=function(){var i=r._getImageType(e.type),a=r._getCanvas(n.naturalWidth,n.naturalHeight),s=(a.getContext("2d").drawImage(n,0,0),a.toDataURL(i,t/100));o(s)}},i.readAsDataURL(e)},crop:function(e,t,o){var i=function(e){return"number"==typeof e};if(i(t.toCropImgX)&&i(t.toCropImgY)&&t.toCropImgW>0&&t.toCropImgH>0){var r=t.toCropImgW,n=t.toCropImgH;t.maxWidth&&t.maxWidth<r&&(r=t.maxWidth,n=t.toCropImgH*r/t.toCropImgW),t.maxHeight&&t.maxHeight<n&&(n=t.maxHeight);var a=this._getCanvas(r,n),s=(a.getContext("2d").drawImage(e,t.toCropImgX,t.toCropImgY,t.toCropImgW,t.toCropImgH,0,0,r,n),this._getImageType(e.src)),p=a.toDataURL(s,t.compress/100);o(p)}},resize:function(e,t,o){var i=function(e){return"number"==typeof e};if(i(t.toCropImgX)&&i(t.toCropImgY)&&t.toCropImgW>0&&t.toCropImgH>0){var r=t.toCropImgW*t.imgChangeRatio,n=t.toCropImgH*t.imgChangeRatio,a=this._getCanvas(r,n),s=(a.getContext("2d").drawImage(e,0,0,t.toCropImgW,t.toCropImgH,0,0,r,n),this._getImageType(e.src)),p=a.toDataURL(s,t.compress/100);o(p)}},_loadImage:function(e,t){var o=new Image;o.src=e,o.onload=function(){t(o)},o.onerror=function(){console.log("Error: image error!")}},_getCanvas:function(e,t){var o=document.createElement("canvas");return o.width=e,o.height=t,o}}},function(e,t,o){var i=o(15);"string"==typeof i&&(i=[[e.id,i,""]]);var r,n={};n.transform=r;o(17)(i,n);i.locals&&(e.exports=i.locals)},function(e,t,o){t=e.exports=o(16)(),t.push([e.id,'.g-core-image-upload-btn{position:relative;overflow:hidden;cursor:pointer}.g-core-image-upload-form{position:absolute;left:0;right:0;top:0;bottom:0;opacity:0}.g-core-image-upload-container{position:absolute;background:#111;z-index:900}.g-core-image-upload-modal{position:absolute;left:0;right:0;width:100%;height:100%;border:1px solid #ccc;z-index:899}.dropped{border:4px solid #ea6153}.g-core-image-corp-container{z-index:1900;position:fixed;left:0;right:0;top:0;bottom:0;background:rgba(0,0,0,.9);color:#f1f1f1}.g-core-image-corp-container .image-aside{overflow:hidden;position:absolute;right:30px;left:30px;top:60px;bottom:20px;text-align:center}.g-core-image-corp-container .image-aside img{max-width:100%;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.g-core-image-corp-container .info-aside{position:absolute;left:0;right:0;top:0;height:40px;padding-left:10px;padding-right:10px;background:#fefefe;color:#777}.g-core-image-corp-container .info-aside .image-corp-preview{position:relative;overflow:hidden;text-align:center;border:2px solid #ccc}.g-core-image-corp-container .info-aside .image-corp-preview.circled{border-radius:160px}.g-core-image-corp-container .info-aside .image-corp-preview img{width:100%}.g-core-image-corp-container .btn-groups{text-align:right;margin:5px 0 0}.g-core-image-corp-container .btn{display:inline-block;padding:0 15px;height:32px;margin-left:15px;background:#fff;border:1px solid #ccc;border-radius:2px;font-size:13px;color:#222;line-height:32px;transition:all .1s ease-in}.g-core-image-corp-container .btn:hover{border:1px solid #777;box-shadow:0 1px 3px rgba(0,0,0,.05)},.g-core-image-corp-container .btn:active{background:#ddd}.g-core-image-corp-container .btn:disabled{background:#eee!important;border-color:#ccc;cursor:not-allowed}.g-core-image-corp-container .btn-upload{background:#2d2d2d;border-color:#3d3d3d;color:#fff}.g-core-image-corp-container .btn-upload:hover{background:#222;border-color:#222;box-shadow:0 1px 3px rgba(0,0,0,.05)}.g-core-image-corp-container .g-crop-image-box,.g-core-image-corp-container .g-crop-image-box .g-crop-image-principal{position:relative}.g-crop-image-principal{overflow:hidden;background-color:#fff;background-image:-webkit-linear-gradient(bottom left,#efefef 25%,transparent 0,transparent 75%,#efefef 0,#efefef),-webkit-linear-gradient(bottom left,#efefef 25%,transparent 0,transparent 75%,#efefef 0,#efefef);background-image:-moz-linear-gradient(bottom left,#efefef 25%,transparent 25%,transparent 75%,#efefef 75%,#efefef),-moz-linear-gradient(bottom left,#efefef 25%,transparent 25%,transparent 75%,#efefef 75%,#efefef);background-image:-o-linear-gradient(bottom left,#efefef 25%,transparent 25%,transparent 75%,#efefef 75%,#efefef),-o-linear-gradient(bottom left,#efefef 25%,transparent 25%,transparent 75%,#efefef 75%,#efefef);background-image:linear-gradient(to top right,#efefef 25%,transparent 0,transparent 75%,#efefef 0,#efefef),linear-gradient(to top right,#efefef 25%,transparent 0,transparent 75%,#efefef 0,#efefef);background-position:0 0,10px 10px;-webkit-background-size:21px 21px;background-size:21px 21px}.image-aside{overflow:hidden;position:absolute;right:30px;left:30px;top:70px;bottom:40px;text-align:center}.image-aside .image-wrap{position:absolute;left:0;top:0;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;box-shadow:0 3px 5px -2px rgba(0,0,0,.25);background-size:cover}.image-mask{position:absolute;left:0;top:0;width:100%;height:100%}.image-mask .mask{position:absolute;background-color:hsla(0,0%,100%,.6)}.crop-box{z-index:2000;box-sizing:border-box;position:absolute;background:none;cursor:move;width:100px;height:100px;border:1px solid hsla(0,0%,100%,.95)}.crop-box:after,.crop-box:before{content:"";display:block;opacity:0;position:absolute;left:33.3333%;top:0;width:33.334%;height:100%;background-color:transparent;border:0 solid hsla(0,0%,100%,.7)}.crop-box:active:after,.crop-box:active:before{opacity:1}.crop-box:before{border-left-width:1px;border-right-width:1px}.crop-box:after{top:33.3333%;left:0;height:33.3334%;width:100%;border-top-width:1px;border-bottom-width:1px}.crop-box .g-resize{display:inline-block;z-index:1910;position:absolute;bottom:-8px;right:-8px;width:16px;height:16px;cursor:se-resize;border-radius:10px;background-color:#fff;box-shadow:0 2px 4px -2px rgba(0,0,0,.25)}.g-resize-bar{position:absolute;bottom:0;margin:17px auto;height:6px;border-radius:3px;width:200px;margin-left:-100px;left:50%;background-color:#9cd6fd;box-shadow:0 2px 3px -1px rgba(0,0,0,.3)}.g-resize-bar .g-resize-highlight{position:absolute;left:0;top:0;height:6px;background-color:#3498db;border-radius:3px}.g-resize-bar .circle-btn{display:block;position:absolute;left:0;top:-5px;width:14px;height:14px;margin-left:-7px;background-color:#fff;border-radius:7px;box-shadow:0 2px 3px -2px rgba(0,0,0,.6),0 -2px 3px -2px rgba(0,0,0,.55);border-width:0}',""]);
},function(e,t){e.exports=function(){var e=[];return e.toString=function(){for(var e=[],t=0;t<this.length;t++){var o=this[t];o[2]?e.push("@media "+o[2]+"{"+o[1]+"}"):e.push(o[1])}return e.join("")},e.i=function(t,o){"string"==typeof t&&(t=[[null,t,""]]);for(var i={},r=0;r<this.length;r++){var n=this[r][0];"number"==typeof n&&(i[n]=!0)}for(r=0;r<t.length;r++){var a=t[r];"number"==typeof a[0]&&i[a[0]]||(o&&!a[2]?a[2]=o:o&&(a[2]="("+a[2]+") and ("+o+")"),e.push(a))}},e}},function(e,t,o){function i(e,t){for(var o=0;o<e.length;o++){var i=e[o],r=h[i.id];if(r){r.refs++;for(var n=0;n<r.parts.length;n++)r.parts[n](i.parts[n]);for(;n<i.parts.length;n++)r.parts.push(c(i.parts[n],t))}else{for(var a=[],n=0;n<i.parts.length;n++)a.push(c(i.parts[n],t));h[i.id]={id:i.id,refs:1,parts:a}}}}function r(e,t){for(var o=[],i={},r=0;r<e.length;r++){var n=e[r],a=t.base?n[0]+t.base:n[0],s=n[1],p=n[2],l=n[3],c={css:s,media:p,sourceMap:l};i[a]?i[a].parts.push(c):o.push(i[a]={id:a,parts:[c]})}return o}function n(e,t){var o=A(e.insertInto);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");var i=y[y.length-1];if("top"===e.insertAt)i?i.nextSibling?o.insertBefore(t,i.nextSibling):o.appendChild(t):o.insertBefore(t,o.firstChild),y.push(t);else{if("bottom"!==e.insertAt)throw new Error("Invalid value for parameter 'insertAt'. Must be 'top' or 'bottom'.");o.appendChild(t)}}function a(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e);var t=y.indexOf(e);t>=0&&y.splice(t,1)}function s(e){var t=document.createElement("style");return e.attrs.type="text/css",l(t,e.attrs),n(e,t),t}function p(e){var t=document.createElement("link");return e.attrs.type="text/css",e.attrs.rel="stylesheet",l(t,e.attrs),n(e,t),t}function l(e,t){Object.keys(t).forEach(function(o){e.setAttribute(o,t[o])})}function c(e,t){var o,i,r,n;if(t.transform&&e.css){if(n=t.transform(e.css),!n)return function(){};e.css=n}if(t.singleton){var l=v++;o=b||(b=s(t)),i=u.bind(null,o,l,!1),r=u.bind(null,o,l,!0)}else e.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(o=p(t),i=d.bind(null,o,t),r=function(){a(o),o.href&&URL.revokeObjectURL(o.href)}):(o=s(t),i=f.bind(null,o),r=function(){a(o)});return i(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;i(e=t)}else r()}}function u(e,t,o,i){var r=o?"":i.css;if(e.styleSheet)e.styleSheet.cssText=C(t,r);else{var n=document.createTextNode(r),a=e.childNodes;a[t]&&e.removeChild(a[t]),a.length?e.insertBefore(n,a[t]):e.appendChild(n)}}function f(e,t){var o=t.css,i=t.media;if(i&&e.setAttribute("media",i),e.styleSheet)e.styleSheet.cssText=o;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(o))}}function d(e,t,o){var i=o.css,r=o.sourceMap,n=void 0===t.convertToAbsoluteUrls&&r;(t.convertToAbsoluteUrls||n)&&(i=x(i)),r&&(i+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(r))))+" */");var a=new Blob([i],{type:"text/css"}),s=e.href;e.href=URL.createObjectURL(a),s&&URL.revokeObjectURL(s)}var h={},g=function(e){var t;return function(){return"undefined"==typeof t&&(t=e.apply(this,arguments)),t}},m=g(function(){return window&&document&&document.all&&!window.atob}),A=function(e){var t={};return function(o){return"undefined"==typeof t[o]&&(t[o]=e.call(this,o)),t[o]}}(function(e){return document.querySelector(e)}),b=null,v=0,y=[],x=o(18);e.exports=function(e,t){t=t||{},t.attrs="object"==typeof t.attrs?t.attrs:{},t.singleton||(t.singleton=m()),t.insertInto||(t.insertInto="head"),t.insertAt||(t.insertAt="bottom");var o=r(e,t);return i(o,t),function(e){for(var n=[],a=0;a<o.length;a++){var s=o[a],p=h[s.id];p.refs--,n.push(p)}if(e){var l=r(e,t);i(l,t)}for(var a=0;a<n.length;a++){var p=n[a];if(0===p.refs){for(var c=0;c<p.parts.length;c++)p.parts[c]();delete h[p.id]}}}};var C=function(){var e=[];return function(t,o){return e[t]=o,e.filter(Boolean).join("\n")}}()},function(e,t){e.exports=function(e){var t="undefined"!=typeof window&&window.location;if(!t)throw new Error("fixUrls requires window.location");if(!e||"string"!=typeof e)return e;var o=t.protocol+"//"+t.host,i=o+t.pathname.replace(/\/[^\/]*$/,"/"),r=e.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,function(e,t){var r=t.trim().replace(/^"(.*)"$/,function(e,t){return t}).replace(/^'(.*)'$/,function(e,t){return t});if(/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/)/i.test(r))return e;var n;return n=0===r.indexOf("//")?r:0===r.indexOf("/")?o+r:i+r.replace(/^\.\//,""),"url("+JSON.stringify(n)+")"});return r}}])});