Changeset 2339847
- Timestamp:
- 07/13/2020 04:59:56 PM (6 years ago)
- Location:
- squareoffs/trunk
- Files:
-
- 5 edited
-
build/index.asset.php (modified) (1 diff)
-
build/index.js (modified) (2 diffs)
-
build/index.js.map (modified) (1 diff)
-
plugin.php (modified) (2 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
squareoffs/trunk/build/index.asset.php
r2332643 r2339847 1 <?php return array('dependencies' => array('react', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-date', 'wp-element', 'wp-polyfill', 'wp-server-side-render'), 'version' => ' f47eeec07d6f25f296868ec5dec37257');1 <?php return array('dependencies' => array('react', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-date', 'wp-element', 'wp-polyfill', 'wp-server-side-render'), 'version' => 'db248078236c802a78a898ad25ecf6a0'); -
squareoffs/trunk/build/index.js
r2332643 r2339847 1 !function(t){var e={};function i(a){if(e[a])return e[a].exports;var n=e[a]={i:a,l:!1,exports:{}};return t[a].call(n.exports,n,n.exports,i),n.l=!0,n.exports}i.m=t,i.c=e,i.d=function(t,e,a){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:a})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var a=Object.create(null);if(i.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)i.d(a,n,function(e){return t[e]}.bind(null,n));return a},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=9)}([function(t,e){!function(){t.exports=this.wp.element}()},function(t,e){!function(){t.exports=this.wp.components}()},function(t,e){!function(){t.exports=this.wp.blockEditor}()},function(t,e){!function(){t.exports=this.regeneratorRuntime}()},function(t,e,i){var a=i(10),n=i(11),o=i(12),r=i(14);t.exports=function(t,e){return a(t)||n(t,e)||o(t,e)||r()}},function(t,e){function i(t,e,i,a,n,o,r){try{var s=t[o](r),c=s.value}catch(t){return void i(t)}s.done?e(c):Promise.resolve(c).then(a,n)}t.exports=function(t){return function(){var e=this,a=arguments;return new Promise((function(n,o){var r=t.apply(e,a);function s(t){i(r,n,o,s,c,"next",t)}function c(t){i(r,n,o,s,c,"throw",t)}s(void 0)}))}}},function(t,e){!function(){t.exports=this.wp.blocks}()},function(t,e){!function(){t.exports=this.wp.serverSideRender}()},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var a=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)){var a=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(t,i):{};a.get||a.set?Object.defineProperty(e,i,a):e[i]=t[i]}return e.default=t,e}(i(17)),n=r(i(18)),o=r(i(21));function r(t){return t&&t.__esModule?t:{default:t}}function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function c(){return(c=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(t[a]=i[a])}return t}).apply(this,arguments)}function l(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function h(t,e){for(var i=0;i<e.length;i++){var a=e[i];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(t,a.key,a)}}function u(t,e){return!e||"object"!==s(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function p(t){return(p=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function d(t,e){return(d=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var m=["dragMode","aspectRatio","data","crop","viewMode","preview","responsive","restore","checkCrossOrigin","checkOrientation","modal","guides","center","highlight","background","autoCrop","autoCropArea","movable","rotatable","scalable","zoomable","zoomOnTouch","zoomOnWheel","wheelZoomRatio","cropBoxMovable","cropBoxResizable","toggleDragModeOnDblclick","minContainerWidth","minContainerHeight","minCanvasWidth","minCanvasHeight","minCropBoxWidth","minCropBoxHeight","ready","cropstart","cropmove","cropend","zoom"],f=m.slice(4),g=function(t){function e(){return l(this,e),u(this,p(e).apply(this,arguments))}var i,n,r;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&d(t,e)}(e,t),i=e,(n=[{key:"componentDidMount",value:function(){var t=this,e=Object.keys(this.props).filter((function(t){return-1!==m.indexOf(t)})).reduce((function(e,i){return c({},e,(a={},n=i,o=t.props[i],n in a?Object.defineProperty(a,n,{value:o,enumerable:!0,configurable:!0,writable:!0}):a[n]=o,a));var a,n,o}),{});this.cropper=new o.default(this.img,e)}},{key:"UNSAFE_componentWillReceiveProps",value:function(t){var e=this;t.src!==this.props.src&&this.cropper.reset().clear().replace(t.src),t.aspectRatio!==this.props.aspectRatio&&this.setAspectRatio(t.aspectRatio),t.data!==this.props.data&&this.setData(t.data),t.dragMode!==this.props.dragMode&&this.setDragMode(t.dragMode),t.cropBoxData!==this.props.cropBoxData&&this.setCropBoxData(t.cropBoxData),t.canvasData!==this.props.canvasData&&this.setCanvasData(t.canvasData),t.moveTo!==this.props.moveTo&&(t.moveTo.length>1?this.moveTo(t.moveTo[0],t.moveTo[1]):this.moveTo(t.moveTo[0])),t.zoomTo!==this.props.zoomTo&&this.zoomTo(t.zoomTo),t.rotateTo!==this.props.rotateTo&&this.rotateTo(t.rotateTo),t.scaleX!==this.props.scaleX&&this.scaleX(t.scaleX),t.scaleY!==this.props.scaleY&&this.scaleY(t.scaleY),t.enable!==this.props.enable&&(t.enable?this.enable():this.disable()),Object.keys(t).forEach((function(i){var a=t[i]!==e.props[i],n=-1!==f.indexOf(i);if("function"==typeof t[i]&&"function"==typeof e.props[i]&&(a=t[i].toString()!==e.props[i].toString()),a&&n)throw new Error("prop: ".concat(i," can't be change after componentDidMount"))}))}},{key:"componentWillUnmount",value:function(){this.img&&(this.cropper.destroy(),delete this.img,delete this.cropper)}},{key:"setDragMode",value:function(t){return this.cropper.setDragMode(t)}},{key:"setAspectRatio",value:function(t){return this.cropper.setAspectRatio(t)}},{key:"getCroppedCanvas",value:function(t){return this.cropper.getCroppedCanvas(t)}},{key:"setCropBoxData",value:function(t){return this.cropper.setCropBoxData(t)}},{key:"getCropBoxData",value:function(){return this.cropper.getCropBoxData()}},{key:"setCanvasData",value:function(t){return this.cropper.setCanvasData(t)}},{key:"getCanvasData",value:function(){return this.cropper.getCanvasData()}},{key:"getImageData",value:function(){return this.cropper.getImageData()}},{key:"getContainerData",value:function(){return this.cropper.getContainerData()}},{key:"setData",value:function(t){return this.cropper.setData(t)}},{key:"getData",value:function(t){return this.cropper.getData(t)}},{key:"crop",value:function(){return this.cropper.crop()}},{key:"move",value:function(t,e){return this.cropper.move(t,e)}},{key:"moveTo",value:function(t,e){return this.cropper.moveTo(t,e)}},{key:"zoom",value:function(t){return this.cropper.zoom(t)}},{key:"zoomTo",value:function(t){return this.cropper.zoomTo(t)}},{key:"rotate",value:function(t){return this.cropper.rotate(t)}},{key:"rotateTo",value:function(t){return this.cropper.rotateTo(t)}},{key:"enable",value:function(){return this.cropper.enable()}},{key:"disable",value:function(){return this.cropper.disable()}},{key:"reset",value:function(){return this.cropper.reset()}},{key:"clear",value:function(){return this.cropper.clear()}},{key:"replace",value:function(t,e){return this.cropper.replace(t,e)}},{key:"scale",value:function(t,e){return this.cropper.scale(t,e)}},{key:"scaleX",value:function(t){return this.cropper.scaleX(t)}},{key:"scaleY",value:function(t){return this.cropper.scaleY(t)}},{key:"render",value:function(){var t=this,e=this.props,i=e.src,n=e.alt,o=e.crossOrigin,r=e.style,s=e.className;return a.default.createElement("div",{style:r,className:s},a.default.createElement("img",{crossOrigin:o,ref:function(e){t.img=e},src:i,alt:void 0===n?"picture":n,style:{opacity:0}}))}}])&&h(i.prototype,n),r&&h(i,r),e}(a.Component);g.propTypes={style:n.default.object,className:n.default.string,crossOrigin:n.default.string,src:n.default.string,alt:n.default.string,aspectRatio:n.default.number,dragMode:n.default.oneOf(["crop","move","none"]),data:n.default.shape({x:n.default.number,y:n.default.number,width:n.default.number,height:n.default.number,rotate:n.default.number,scaleX:n.default.number,scaleY:n.default.number}),scaleX:n.default.number,scaleY:n.default.number,enable:n.default.bool,cropBoxData:n.default.shape({left:n.default.number,top:n.default.number,width:n.default.number,height:n.default.number}),canvasData:n.default.shape({left:n.default.number,top:n.default.number,width:n.default.number,height:n.default.number}),zoomTo:n.default.number,moveTo:n.default.arrayOf(n.default.number),rotateTo:n.default.number,viewMode:n.default.oneOf([0,1,2,3]),preview:n.default.string,responsive:n.default.bool,restore:n.default.bool,checkCrossOrigin:n.default.bool,checkOrientation:n.default.bool,modal:n.default.bool,guides:n.default.bool,center:n.default.bool,highlight:n.default.bool,background:n.default.bool,autoCrop:n.default.bool,autoCropArea:n.default.number,movable:n.default.bool,rotatable:n.default.bool,scalable:n.default.bool,zoomable:n.default.bool,zoomOnTouch:n.default.bool,zoomOnWheel:n.default.bool,wheelZoomRatio:n.default.number,cropBoxMovable:n.default.bool,cropBoxResizable:n.default.bool,toggleDragModeOnDblclick:n.default.bool,minContainerWidth:n.default.number,minContainerHeight:n.default.number,minCanvasWidth:n.default.number,minCanvasHeight:n.default.number,minCropBoxWidth:n.default.number,minCropBoxHeight:n.default.number,ready:n.default.func,cropstart:n.default.func,cropmove:n.default.func,cropend:n.default.func,crop:n.default.func,zoom:n.default.func},g.defaultProps={src:null,dragMode:"crop",data:null,scaleX:1,scaleY:1,enable:!0,zoomTo:1,rotateTo:0};var b=g;e.default=b},function(t,e,i){"use strict";i.r(e);var a=i(3),n=i.n(a),o=i(5),r=i.n(o),s=i(4),c=i.n(s),l=i(0),h=i(6),u=i(2),p=i(1),d=i(7),m=i.n(d),f=(i(15),i(16),i(8)),g=i.n(f),b=React.createElement,v=React.createRef(),y=(b("svg",{className:"soIcon",width:"166.000000pt",height:"155.000000pt",preserveAspectRatio:"xMidYMid meet",viewBox:"0 0 166.000000 155.000000"},b("g",{transform:"translate(0.000000,155.000000) scale(0.100000,-0.100000)",fill:"#000000",stroke:"none"},b("path",{d:"M880 774 l0 -779 98 95 c339 330 682 677 682 691 0 15 -748 759 -771 767 -5 2 -9 -301 -9 -774z"}),b("path",{d:"M0 767 c0 -13 751 -757 764 -757 3 0 6 173 6 385 l0 385 -385 0 c-315 0 -385 -2 -385 -13z"}))),function(){return Object(l.createElement)(p.Icon,{icon:Object(l.createElement)("svg",{width:"25",height:"25",xmlns:"http://www.w3.org/2000/svg"},Object(l.createElement)("g",null,Object(l.createElement)("path",{stroke:"null",id:"svg_1","fill-rule":"evenodd",fill:"#010101",d:"m14.953703,6.452965c0,0.410933 0.333676,0.744479 0.74461,0.744479c0.410868,0 0.744544,-0.333578 0.744544,-0.744479c0,-0.410966 -0.333676,-0.744544 -0.744544,-0.744544c-0.410966,0 -0.74461,0.333578 -0.74461,0.744544zm-7.44495,4.020342l0,0.818949c0,0.369339 0.300702,0.670008 0.670041,0.670008l8.264031,0l-2.847197,-2.799309c-0.238228,-0.238326 -0.619432,-0.238326 -0.857267,0l-0.601765,0.592587l-1.518916,-1.485975c-0.238195,-0.238326 -0.666894,-0.238326 -0.902139,0l-2.206788,2.203739zm-2.680195,5.062573c0,0.658142 0.533096,1.191172 1.19114,1.191172l11.912085,0c0.65811,0 1.19114,-0.53303 1.19114,-1.191172l0,-11.316449c0,-0.658142 -0.53303,-1.191205 -1.19114,-1.191205l-11.912052,0c-0.658077,0 -1.19114,0.533096 -1.19114,1.191205l0,11.316449l-0.000033,0zm2.144248,-11.018599l10.005933,0c0.363307,0 0.655225,0.291787 0.655225,0.655192l0,7.325804c0,0.363242 -0.291918,0.655127 -0.655225,0.655127l-10.005933,0c-0.363275,0 -0.655258,-0.291885 -0.655258,-0.655127l0,-7.325804c-0.000033,-0.363406 0.291983,-0.655192 0.655258,-0.655192z","clip-rule":"evenodd"})))})}),w=function(){return Object(l.createElement)(p.Icon,{icon:Object(l.createElement)("svg",{width:"25",height:"25",xmlns:"http://www.w3.org/2000/svg"},Object(l.createElement)("g",null,Object(l.createElement)("path",{stroke:"null",id:"svg_1","fill-rule":"evenodd",fill:"#010101",d:"m14.802511,7.322292c0,0.515244 0.418376,0.933455 0.93362,0.933455c0.515161,0 0.933537,-0.418253 0.933537,-0.933455c0,-0.515285 -0.418376,-0.933537 -0.933537,-0.933537c-0.515285,0 -0.93362,0.418253 -0.93362,0.933537zm-9.334758,5.040856l0,1.02683c0,0.46309 0.377032,0.840081 0.840122,0.840081l10.361752,0l-3.569923,-3.509879c-0.298699,-0.298822 -0.776667,-0.298822 -1.074873,0l-0.754515,0.743008l-1.904474,-1.863171c-0.298658,-0.298822 -0.836177,-0.298822 -1.131136,0l-2.766953,2.763131zm-3.360529,6.347644c0,0.825204 0.668415,1.493537 1.493496,1.493537l14.935818,0c0.825162,0 1.493496,-0.668333 1.493496,-1.493537l0,-14.188988c0,-0.825204 -0.668333,-1.493578 -1.493496,-1.493578l-14.935777,0c-0.825121,0 -1.493496,0.668415 -1.493496,1.493578l0,14.188988l-0.000041,0zm2.688539,-13.815532l12.545814,0c0.455528,0 0.821546,0.365853 0.821546,0.821505l0,9.185367c0,0.455446 -0.366017,0.821423 -0.821546,0.821423l-12.545814,0c-0.455487,0 -0.821587,-0.365976 -0.821587,-0.821423l0,-9.185367c-0.000041,-0.455652 0.3661,-0.821505 0.821587,-0.821505z","clip-rule":"evenodd"})))})},x=function(){return Object(l.createElement)(p.Icon,{icon:Object(l.createElement)("svg",{width:"25",height:"25",xmlns:"http://www.w3.org/2000/svg"},Object(l.createElement)("g",null,Object(l.createElement)("path",{stroke:"null",id:"svg_1","fill-rule":"evenodd",fill:"#010101",d:"m16.730116,7.974287c0,0.593476 0.481901,1.075188 1.075377,1.075188c0.593382,0 1.075282,-0.481759 1.075282,-1.075188c0,-0.593524 -0.481901,-1.075282 -1.075282,-1.075282c-0.593524,0 -1.075377,0.481759 -1.075377,1.075282zm-10.752113,5.80624l0,1.18274c0,0.533404 0.434279,0.967636 0.967683,0.967636l11.935042,0l-4.111967,-4.042806c-0.344052,-0.344194 -0.894593,-0.344194 -1.238078,0l-0.869078,0.855823l-2.193642,-2.146067c-0.344005,-0.344194 -0.963139,-0.344194 -1.302883,0l-3.187077,3.182675zm-3.87078,7.311446c0,0.950499 0.769905,1.72031 1.720262,1.72031l17.203617,0c0.950452,0 1.720262,-0.76981 1.720262,-1.72031l0,-16.343391c0,-0.950499 -0.76981,-1.720357 -1.720262,-1.720357l-17.20357,0c-0.950405,0 -1.720262,0.769905 -1.720262,1.720357l0,16.343391l-0.000047,0zm3.096756,-15.913231l14.450724,0c0.524694,0 0.946286,0.421403 0.946286,0.946239l0,10.580039c0,0.5246 -0.421592,0.946144 -0.946286,0.946144l-14.450724,0c-0.524647,0 -0.946334,-0.421545 -0.946334,-0.946144l0,-10.580039c-0.000047,-0.524836 0.421687,-0.946239 0.946334,-0.946239z","clip-rule":"evenodd"})))})};Object(h.registerBlockType)("squareoffs/blocks",{title:"SquareOffs",icon:function(){return Object(l.createElement)("svg",{version:"1.1",id:"Layer_1",x:"0px",y:"0px",width:"24px",height:"24px",viewBox:"0 0 24 24","enable-background":"new 0 0 24 24"},Object(l.createElement)("polygon",{fill:"#1F8978",points:"11.18,22.166 11.173,12 1.003,12 "}),Object(l.createElement)("polygon",{fill:"#00AE95",points:"11.166,1.834 11.173,12 1.003,12 "}),Object(l.createElement)("polygon",{fill:"#CE3D39",points:"12.822,22.166 12.829,12 22.998,12 "}),Object(l.createElement)("polygon",{fill:"#F15C52",points:"12.836,1.834 12.829,12 22.998,12 "}))},category:"embed",attributes:{soAlignment:{type:"string",default:"left"},soID:{type:"number"},soSize:{type:"string",default:"wide"},soStep:{type:"number",default:0},question:{type:"string"},side_1_title:{type:"string"},side_2_title:{type:"string"},side_1_defense:{type:"string"},side_2_defense:{type:"string"},side_1_photo:{type:"string"},side_1_photo_raw:{type:"string"},side_2_photo:{type:"string"},side_2_photo_raw:{type:"string"},end_date:{type:"string"},category_uuid:{type:"string"},tag_list:{type:"string"},cover_photo:{type:"string"},cover_photo_raw:{type:"string"},cover_photo_mime:{type:"string"},side1MediaID:{type:"string"},side2MediaID:{type:"string"},coverPhotoMediaID:{type:"string"},showRequired:{type:"number"}},edit:function(t){var e=Object(l.useState)(!1),i=c()(e,2),a=i[0],o=i[1],s=Object(l.useState)(!1),h=c()(s,2),d=h[0];h[1];Object(l.useEffect)((function(){console.log("CB: ",a),console.log("DONE: ",d)}),[a,d]);function f(e){e.preventDefault(),console.log(t.attributes.soStep," == ",4);var i=!1;console.log(t.attributes),1==t.attributes.soStep?t.attributes.question&&t.attributes.side_1_title&&t.attributes.side_2_title?i=!0:(t.setAttributes({showRequired:1}),console.log("dddd")):3==t.attributes.soStep?t.attributes.category_uuid?i=!0:t.setAttributes({showRequired:3}):0!=t.attributes.soStep&&2!=t.attributes.soStep||(i=!0),!0===i&&(parseInt(t.attributes.soStep)+1==4?t.attributes.question&&t.attributes.side_1_title&&t.attributes.side_2_title&&t.attributes.category_uuid&&(!function(){b.apply(this,arguments)}(),t.setAttributes({soStep:parseInt(t.attributes.soStep)+parseInt(1)})):t.setAttributes({soStep:parseInt(t.attributes.soStep)+parseInt(1)}))}function b(){return(b=r()(n.a.mark((function e(){var i,a;return n.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(a in i=new FormData,t.attributes)i.append(a,t.attributes[a]);return i.append("action","soCreateSquareOffs"),console.log("fetching..."),console.log(i),e.next=7,fetch(window.ajaxurl,{method:"POST",body:i}).then((function(t){return t.json()})).then((function(t){return O(t)}));case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function O(e){console.log(e),t.setAttributes({soID:e.external_id}),t.setAttributes({soStep:5}),t.setAttributes({cover_photo:""})}function C(e){e.preventDefault(),t.setAttributes({soStep:0})}function E(e){t.attributes.soID&&t.attributes.soSize&&t.attributes.soAlignment&&t.setAttributes({soStep:5})}var j=function(e){e.preventDefault(),e.key?"Enter"==e.key&&t.setAttributes({soID:parseInt(e.target.value)}):t.setAttributes({soID:parseInt(e.target.value)})};return Object(l.createElement)("div",{class:"soContainer "+t.className},5==t.attributes.soStep&&t.attributes.soID?Object(l.createElement)("div",null,Object(l.createElement)(l.Fragment,null,Object(l.createElement)(u.InspectorControls,null,Object(l.createElement)(p.PanelBody,{title:"SquareOffs Settings",initialOpen:!0},Object(l.createElement)(p.PanelRow,null,Object(l.createElement)(p.TextControl,{label:"SquareOff ID",onKeyUp:j,onBlur:j,defaultValue:t.attributes.soID}))))),Object(l.createElement)(u.BlockControls,null,Object(l.createElement)(u.BlockAlignmentToolbar,{controls:["left","center","right"],value:t.attributes.soAlignment,onChange:function(e){t.setAttributes({soAlignment:void 0===e?"none":e}),E()}}),Object(l.createElement)(p.Toolbar,null,Object(l.createElement)(p.IconButton,{icon:y,label:"Small",value:"small",onClick:function(){t.setAttributes({soSize:"small"}),E()}}),Object(l.createElement)(p.IconButton,{icon:w,label:"Medium",value:"medium",onClick:function(){t.setAttributes({soSize:"medium"}),E()}}),Object(l.createElement)(p.IconButton,{icon:x,label:"Wide",value:"wide",onClick:function(){t.setAttributes({soSize:"wide"}),E()}})))):null,5==t.attributes.soStep?Object(l.createElement)("div",null,Object(l.createElement)("div",{class:"soClickHandle"}),Object(l.createElement)(m.a,{block:"squareoffs/blocks",attributes:{soID:t.attributes.soID,soSize:t.attributes.soSize,soAlignment:t.attributes.soAlignment}})):Object(l.createElement)("div",{class:"components-placeholder soCont"+t.attributes.soStep},Object(l.createElement)("img",{class:"squareOffsLogo",src:"https://squareoffs.com/assets/Logo-343c6a748ac336ca96afdf9d72fdeb3d70f1478434f3566ae459fd1707da8d18.svg"}),0==t.attributes.soStep?Object(l.createElement)("div",{class:"soStep soStep0"},Object(l.createElement)(p.Button,{isPrimary:!0,onClick:f},"Create new SquareOff"),Object(l.createElement)(p.Button,{isSecondary:!0,onClick:function(e){e.preventDefault(),t.setAttributes({soStep:10})}},"Insert Existing SquareOff")):null,10==t.attributes.soStep?Object(l.createElement)("div",{class:"soStep soStep10"},Object(l.createElement)("h2",null,"Insert Existing SquareOff"),Object(l.createElement)("p",null,Object(l.createElement)("input",{onChange:j,type:"text",defaultValue:t.attributes.soID,placeholder:"SquareOff ID"})),Object(l.createElement)("p",null,Object(l.createElement)(p.Button,{isPrimary:!0,onClick:E},"Embed"),Object(l.createElement)(p.Button,{isSecondary:!0,onClick:C},"Cancel"))):null,1==t.attributes.soStep?Object(l.createElement)("div",{class:"soStep soStep1"},t.attributes.cover_photo_raw?null:Object(l.createElement)("p",{class:"soCoverPhoto"},Object(l.createElement)("img",{src:window.soVars.soURL+"assets/16x9.png"})),t.attributes.cover_photo_raw&&t.attributes.cover_photo_mime?Object(l.createElement)(g.a,{ref:v,src:t.attributes.cover_photo_raw,style:{height:"auto",width:"100%"},aspectRatio:16/9,guides:!0,viewMode:1,crop:function(){console.log("asdfsdf",t.attributes),t.setAttributes({cover_photo:v.current.getCroppedCanvas().toDataURL(t.attributes.cover_photo_mime)})}}):null,Object(l.createElement)(u.MediaUploadCheck,null,Object(l.createElement)(u.MediaUpload,{onSelect:function(e){t.setAttributes({cover_photo_mime:e.mime}),t.setAttributes({cover_photo_raw:e.url})},allowedTypes:"image",value:t.attributes.coverPhotoMediaID,render:function(t){var e=t.open;return Object(l.createElement)(p.Button,{isPrimary:!0,onClick:e},"Add a Cover Photo (max. 5Mb)")}})),Object(l.createElement)("p",null," "),Object(l.createElement)("label",null,"What is your question? *"),Object(l.createElement)("p",null,Object(l.createElement)("textarea",{type:"text",class:1!=t.attributes.showRequired||t.attributes.question?"":"required",value:t.attributes.question,onChange:function(e){return t.setAttributes({question:e.target.value})},maxLength:"100"})),Object(l.createElement)("label",null,"Side 1 Answer *"),Object(l.createElement)("p",null,Object(l.createElement)("textarea",{type:"text",class:1!=t.attributes.showRequired||t.attributes.side_1_title?"":"required",value:t.attributes.side_1_title,onChange:function(e){return t.setAttributes({side_1_title:e.target.value})},maxLength:"20"})),Object(l.createElement)("label",null,"Side 2 Answer *"),Object(l.createElement)("p",null,Object(l.createElement)("textarea",{type:"text",class:1!=t.attributes.showRequired||t.attributes.side_2_title?"":"required",value:t.attributes.side_2_title,onChange:function(e){return t.setAttributes({side_2_title:e.target.value})},maxLength:"20"}))):null,2==t.attributes.soStep?Object(l.createElement)("div",{class:"soStep soStep3"},Object(l.createElement)("h2",null,"Add a defense for each side (optional)"),Object(l.createElement)("label",null,"Side 1"),Object(l.createElement)("p",null,Object(l.createElement)("textarea",{type:"text",value:t.attributes.side_1_defense,onChange:function(e){t.setAttributes({side_1_defense:e.target.value})},placeholder:"Add more info, stats, or links to defend this side (optinal).",maxLength:"600"})),t.attributes.side_1_photo?Object(l.createElement)("p",{class:"soPhoto"},Object(l.createElement)("i",{class:"removePhoto",onClick:function(e){t.setAttributes({side_1_photo:null})}},"x"),Object(l.createElement)("img",{src:t.attributes.side_1_photo})):null,Object(l.createElement)(u.MediaUploadCheck,null,Object(l.createElement)(u.MediaUpload,{onSelect:function(e){return t.setAttributes({side_1_photo:e.url})},allowedTypes:"image",value:t.attributes.side1MediaID,render:function(t){var e=t.open;return Object(l.createElement)(p.Button,{isSecondary:!0,onClick:e},"Add a photo for side 1 (max. 5Mb)")}})),Object(l.createElement)("p",null,Object(l.createElement)("br",null)),Object(l.createElement)("label",null,"Side 2"),Object(l.createElement)("p",null,Object(l.createElement)("textarea",{type:"text",value:t.attributes.side_2_defense,onChange:function(e){t.setAttributes({side_2_defense:e.target.value})},placeholder:"Add more info, stats, or links to defend this side (optinal).",maxLength:"600"})),t.attributes.side_2_photo?Object(l.createElement)("p",{class:"soPhoto"},Object(l.createElement)("i",{class:"removePhoto",onClick:function(e){t.setAttributes({side_2_photo:null})}},"x"),Object(l.createElement)("img",{src:t.attributes.side_2_photo})):null,Object(l.createElement)(u.MediaUploadCheck,null,Object(l.createElement)(u.MediaUpload,{onSelect:function(e){return t.setAttributes({side_2_photo:e.url})},allowedTypes:"image",value:t.attributes.side2MediaID,render:function(t){var e=t.open;return Object(l.createElement)(p.Button,{isSecondary:!0,onClick:e},"Add a photo for side 2 (max. 5Mb)")}}))):null,3==t.attributes.soStep?Object(l.createElement)("div",{class:"soStep soStep4"},Object(l.createElement)("h2",null,"Details"),Object(l.createElement)("label",{for:"socategory"},"Category *"),Object(l.createElement)("p",null,Object(l.createElement)("select",{id:"socategory",class:3!=t.attributes.showRequired||t.attributes.category_uuid?"":"required",value:t.attributes.category_uuid,onChange:function(e){t.setAttributes({category_uuid:e.target.value})}},Object(l.createElement)("option",{value:""}),Object(l.createElement)("option",{value:"a6840d90-1f50-4e8a-98d0-c1c1c5134a78"},"News"),Object(l.createElement)("option",{value:"6c806976-e20c-4666-9d33-45896567c155"},"Sports"),Object(l.createElement)("option",{value:"e5e6883a-6e9c-4b7e-b247-43629ce4a5db"},"Life"))),Object(l.createElement)("label",{for:"soTags"},"Tags"),Object(l.createElement)("p",null,Object(l.createElement)("textarea",{type:"text",id:"soTags",value:t.attributes.tag_list,onChange:function(e){t.setAttributes({tag_list:e.target.value})},placeholder:"Comma-separated tags",maxLength:"100"})),Object(l.createElement)("label",{for:"endDate"},"End Date"),Object(l.createElement)("p",null,Object(l.createElement)("input",{type:"text",id:"endDate",value:t.attributes.end_date,onFocus:function(t){t.preventDefault(),t.stopPropagation(),o(!0)}})),1==a?Object(l.createElement)("div",{class:"DateTimePicker"},Object(l.createElement)(p.DateTimePicker,{currentDate:t.attributes.end_date,onChange:function(e){return t.setAttributes({end_date:e})},is12Hour:!0}),Object(l.createElement)(p.Button,{isPrimary:!0,onClick:function(t){t.preventDefault(),t.stopPropagation(),o(!1)}},"OK")):null,Object(l.createElement)("label",{for:"soSize"},"Size"),Object(l.createElement)("div",{class:"soRadioSizes"},Object(l.createElement)("div",null,Object(l.createElement)("i",{class:"small",onClick:function(e){t.setAttributes({soSize:"small"})}}),Object(l.createElement)("input",{type:"radio",value:"small",checked:"small"===t.attributes.soSize,onChange:function(e){t.setAttributes({soSize:e.target.value})}})),Object(l.createElement)("div",null,Object(l.createElement)("i",{class:"medium",onClick:function(e){t.setAttributes({soSize:"medium"})}}),Object(l.createElement)("input",{type:"radio",value:"medium",checked:"medium"===t.attributes.soSize,onChange:function(e){t.setAttributes({soSize:e.target.value})}})),Object(l.createElement)("div",null,Object(l.createElement)("i",{class:"wide",onClick:function(e){t.setAttributes({soSize:"wide"})}}),Object(l.createElement)("input",{type:"radio",value:"wide",checked:"wide"===t.attributes.soSize,onChange:function(e){t.setAttributes({soSize:e.target.value})}}))),Object(l.createElement)("p",null,Object(l.createElement)("i",null,"Small embed does not display the cover photo. By default, the cover photo will be displayed in all other embed sizes, Feeds, and SquareOffs.com."))):null,4==t.attributes.soStep?Object(l.createElement)("div",{class:"soStep soStep5",id:t.attributes.soStep},Object(l.createElement)("p",null,"Please wait while we're creating your SquareOff...")):null,0!==t.attributes.soStep&&4!==t.attributes.soStep&&5!==t.attributes.soStep&&10!=t.attributes.soStep?Object(l.createElement)("div",{class:"btnControls"},Object(l.createElement)(p.Button,{isPrimary:!0,onClick:f},3==t.attributes.soStep?"Submit":"Next"),t.attributes.soStep>1?Object(l.createElement)(p.Button,{isSecondary:!0,onClick:function(e){e.preventDefault(),console.log(t.attributes),t.setAttributes({soStep:parseInt(t.attributes.soStep)-parseInt(1)})}},"Back"):null,Object(l.createElement)(p.Button,{isTertiary:!0,onClick:C},"Cancel")):null))},save:function(){return null}})},function(t,e){t.exports=function(t){if(Array.isArray(t))return t}},function(t,e){t.exports=function(t,e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t)){var i=[],a=!0,n=!1,o=void 0;try{for(var r,s=t[Symbol.iterator]();!(a=(r=s.next()).done)&&(i.push(r.value),!e||i.length!==e);a=!0);}catch(t){n=!0,o=t}finally{try{a||null==s.return||s.return()}finally{if(n)throw o}}return i}}},function(t,e,i){var a=i(13);t.exports=function(t,e){if(t){if("string"==typeof t)return a(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?a(t,e):void 0}}},function(t,e){t.exports=function(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,a=new Array(e);i<e;i++)a[i]=t[i];return a}},function(t,e){t.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},function(t,e){!function(){t.exports=this.wp.date}()},function(t,e){!function(){t.exports=this.wp.compose}()},function(t,e){!function(){t.exports=this.React}()},function(t,e,i){t.exports=i(19)()},function(t,e,i){"use strict";var a=i(20);function n(){}function o(){}o.resetWarningCache=n,t.exports=function(){function t(t,e,i,n,o,r){if(r!==a){var s=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function e(){return t}t.isRequired=t;var i={array:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,elementType:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:o,resetWarningCache:n};return i.PropTypes=i,i}},function(t,e,i){"use strict";t.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(t,e,i){ 1 /******/ (function(modules) { // webpackBootstrap 2 /******/ // The module cache 3 /******/ var installedModules = {}; 4 /******/ 5 /******/ // The require function 6 /******/ function __webpack_require__(moduleId) { 7 /******/ 8 /******/ // Check if module is in cache 9 /******/ if(installedModules[moduleId]) { 10 /******/ return installedModules[moduleId].exports; 11 /******/ } 12 /******/ // Create a new module (and put it into the cache) 13 /******/ var module = installedModules[moduleId] = { 14 /******/ i: moduleId, 15 /******/ l: false, 16 /******/ exports: {} 17 /******/ }; 18 /******/ 19 /******/ // Execute the module function 20 /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 21 /******/ 22 /******/ // Flag the module as loaded 23 /******/ module.l = true; 24 /******/ 25 /******/ // Return the exports of the module 26 /******/ return module.exports; 27 /******/ } 28 /******/ 29 /******/ 30 /******/ // expose the modules object (__webpack_modules__) 31 /******/ __webpack_require__.m = modules; 32 /******/ 33 /******/ // expose the module cache 34 /******/ __webpack_require__.c = installedModules; 35 /******/ 36 /******/ // define getter function for harmony exports 37 /******/ __webpack_require__.d = function(exports, name, getter) { 38 /******/ if(!__webpack_require__.o(exports, name)) { 39 /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); 40 /******/ } 41 /******/ }; 42 /******/ 43 /******/ // define __esModule on exports 44 /******/ __webpack_require__.r = function(exports) { 45 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 46 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 47 /******/ } 48 /******/ Object.defineProperty(exports, '__esModule', { value: true }); 49 /******/ }; 50 /******/ 51 /******/ // create a fake namespace object 52 /******/ // mode & 1: value is a module id, require it 53 /******/ // mode & 2: merge all properties of value into the ns 54 /******/ // mode & 4: return value when already ns object 55 /******/ // mode & 8|1: behave like require 56 /******/ __webpack_require__.t = function(value, mode) { 57 /******/ if(mode & 1) value = __webpack_require__(value); 58 /******/ if(mode & 8) return value; 59 /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; 60 /******/ var ns = Object.create(null); 61 /******/ __webpack_require__.r(ns); 62 /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); 63 /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); 64 /******/ return ns; 65 /******/ }; 66 /******/ 67 /******/ // getDefaultExport function for compatibility with non-harmony modules 68 /******/ __webpack_require__.n = function(module) { 69 /******/ var getter = module && module.__esModule ? 70 /******/ function getDefault() { return module['default']; } : 71 /******/ function getModuleExports() { return module; }; 72 /******/ __webpack_require__.d(getter, 'a', getter); 73 /******/ return getter; 74 /******/ }; 75 /******/ 76 /******/ // Object.prototype.hasOwnProperty.call 77 /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 78 /******/ 79 /******/ // __webpack_public_path__ 80 /******/ __webpack_require__.p = ""; 81 /******/ 82 /******/ 83 /******/ // Load entry module and return exports 84 /******/ return __webpack_require__(__webpack_require__.s = "./src/index.js"); 85 /******/ }) 86 /************************************************************************/ 87 /******/ ({ 88 89 /***/ "./node_modules/@babel/runtime/helpers/arrayLikeToArray.js": 90 /*!*****************************************************************!*\ 91 !*** ./node_modules/@babel/runtime/helpers/arrayLikeToArray.js ***! 92 \*****************************************************************/ 93 /*! no static exports found */ 94 /***/ (function(module, exports) { 95 96 function _arrayLikeToArray(arr, len) { 97 if (len == null || len > arr.length) len = arr.length; 98 99 for (var i = 0, arr2 = new Array(len); i < len; i++) { 100 arr2[i] = arr[i]; 101 } 102 103 return arr2; 104 } 105 106 module.exports = _arrayLikeToArray; 107 108 /***/ }), 109 110 /***/ "./node_modules/@babel/runtime/helpers/arrayWithHoles.js": 111 /*!***************************************************************!*\ 112 !*** ./node_modules/@babel/runtime/helpers/arrayWithHoles.js ***! 113 \***************************************************************/ 114 /*! no static exports found */ 115 /***/ (function(module, exports) { 116 117 function _arrayWithHoles(arr) { 118 if (Array.isArray(arr)) return arr; 119 } 120 121 module.exports = _arrayWithHoles; 122 123 /***/ }), 124 125 /***/ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js": 126 /*!*****************************************************************!*\ 127 !*** ./node_modules/@babel/runtime/helpers/asyncToGenerator.js ***! 128 \*****************************************************************/ 129 /*! no static exports found */ 130 /***/ (function(module, exports) { 131 132 function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { 133 try { 134 var info = gen[key](arg); 135 var value = info.value; 136 } catch (error) { 137 reject(error); 138 return; 139 } 140 141 if (info.done) { 142 resolve(value); 143 } else { 144 Promise.resolve(value).then(_next, _throw); 145 } 146 } 147 148 function _asyncToGenerator(fn) { 149 return function () { 150 var self = this, 151 args = arguments; 152 return new Promise(function (resolve, reject) { 153 var gen = fn.apply(self, args); 154 155 function _next(value) { 156 asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); 157 } 158 159 function _throw(err) { 160 asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); 161 } 162 163 _next(undefined); 164 }); 165 }; 166 } 167 168 module.exports = _asyncToGenerator; 169 170 /***/ }), 171 172 /***/ "./node_modules/@babel/runtime/helpers/iterableToArrayLimit.js": 173 /*!*********************************************************************!*\ 174 !*** ./node_modules/@babel/runtime/helpers/iterableToArrayLimit.js ***! 175 \*********************************************************************/ 176 /*! no static exports found */ 177 /***/ (function(module, exports) { 178 179 function _iterableToArrayLimit(arr, i) { 180 if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; 181 var _arr = []; 182 var _n = true; 183 var _d = false; 184 var _e = undefined; 185 186 try { 187 for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { 188 _arr.push(_s.value); 189 190 if (i && _arr.length === i) break; 191 } 192 } catch (err) { 193 _d = true; 194 _e = err; 195 } finally { 196 try { 197 if (!_n && _i["return"] != null) _i["return"](); 198 } finally { 199 if (_d) throw _e; 200 } 201 } 202 203 return _arr; 204 } 205 206 module.exports = _iterableToArrayLimit; 207 208 /***/ }), 209 210 /***/ "./node_modules/@babel/runtime/helpers/nonIterableRest.js": 211 /*!****************************************************************!*\ 212 !*** ./node_modules/@babel/runtime/helpers/nonIterableRest.js ***! 213 \****************************************************************/ 214 /*! no static exports found */ 215 /***/ (function(module, exports) { 216 217 function _nonIterableRest() { 218 throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); 219 } 220 221 module.exports = _nonIterableRest; 222 223 /***/ }), 224 225 /***/ "./node_modules/@babel/runtime/helpers/slicedToArray.js": 226 /*!**************************************************************!*\ 227 !*** ./node_modules/@babel/runtime/helpers/slicedToArray.js ***! 228 \**************************************************************/ 229 /*! no static exports found */ 230 /***/ (function(module, exports, __webpack_require__) { 231 232 var arrayWithHoles = __webpack_require__(/*! ./arrayWithHoles */ "./node_modules/@babel/runtime/helpers/arrayWithHoles.js"); 233 234 var iterableToArrayLimit = __webpack_require__(/*! ./iterableToArrayLimit */ "./node_modules/@babel/runtime/helpers/iterableToArrayLimit.js"); 235 236 var unsupportedIterableToArray = __webpack_require__(/*! ./unsupportedIterableToArray */ "./node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js"); 237 238 var nonIterableRest = __webpack_require__(/*! ./nonIterableRest */ "./node_modules/@babel/runtime/helpers/nonIterableRest.js"); 239 240 function _slicedToArray(arr, i) { 241 return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest(); 242 } 243 244 module.exports = _slicedToArray; 245 246 /***/ }), 247 248 /***/ "./node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js": 249 /*!***************************************************************************!*\ 250 !*** ./node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js ***! 251 \***************************************************************************/ 252 /*! no static exports found */ 253 /***/ (function(module, exports, __webpack_require__) { 254 255 var arrayLikeToArray = __webpack_require__(/*! ./arrayLikeToArray */ "./node_modules/@babel/runtime/helpers/arrayLikeToArray.js"); 256 257 function _unsupportedIterableToArray(o, minLen) { 258 if (!o) return; 259 if (typeof o === "string") return arrayLikeToArray(o, minLen); 260 var n = Object.prototype.toString.call(o).slice(8, -1); 261 if (n === "Object" && o.constructor) n = o.constructor.name; 262 if (n === "Map" || n === "Set") return Array.from(o); 263 if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen); 264 } 265 266 module.exports = _unsupportedIterableToArray; 267 268 /***/ }), 269 270 /***/ "./node_modules/cropperjs/dist/cropper.js": 271 /*!************************************************!*\ 272 !*** ./node_modules/cropperjs/dist/cropper.js ***! 273 \************************************************/ 274 /*! no static exports found */ 275 /***/ (function(module, exports, __webpack_require__) { 276 2 277 /*! 3 278 * Cropper.js v1.5.6 … … 9 284 * Date: 2019-10-04T04:33:48.372Z 10 285 */ 11 t.exports=function(){"use strict";function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(e)}function e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var i=0;i<e.length;i++){var a=e[i];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(t,a.key,a)}}function a(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function n(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);e&&(a=a.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,a)}return i}function o(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?n(i,!0).forEach((function(e){a(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):n(i).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function r(t){return function(t){if(Array.isArray(t)){for(var e=0,i=new Array(t.length);e<t.length;e++)i[e]=t[e];return i}}(t)||function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var s="undefined"!=typeof window&&void 0!==window.document,c=s?window:{},l=!!s&&"ontouchstart"in c.document.documentElement,h=!!s&&"PointerEvent"in c,u="".concat("cropper","-crop"),p="".concat("cropper","-disabled"),d="".concat("cropper","-hidden"),m="".concat("cropper","-hide"),f="".concat("cropper","-invisible"),g="".concat("cropper","-modal"),b="".concat("cropper","-move"),v="".concat("cropper","Action"),y="".concat("cropper","Preview"),w=l?"touchstart":"mousedown",x=l?"touchmove":"mousemove",O=l?"touchend touchcancel":"mouseup",C=h?"pointerdown":w,E=h?"pointermove":x,j=h?"pointerup pointercancel":O,D=/^e|w|s|n|se|sw|ne|nw|all|crop|move|zoom$/,M=/^data:/,k=/^data:image\/jpeg;base64,/,S=/^img|canvas$/i,_={viewMode:0,dragMode:"crop",initialAspectRatio:NaN,aspectRatio:NaN,data:null,preview:"",responsive:!0,restore:!0,checkCrossOrigin:!0,checkOrientation:!0,modal:!0,guides:!0,center:!0,highlight:!0,background:!0,autoCrop:!0,autoCropArea:.8,movable:!0,rotatable:!0,scalable:!0,zoomable:!0,zoomOnTouch:!0,zoomOnWheel:!0,wheelZoomRatio:.1,cropBoxMovable:!0,cropBoxResizable:!0,toggleDragModeOnDblclick:!0,minCanvasWidth:0,minCanvasHeight:0,minCropBoxWidth:0,minCropBoxHeight:0,minContainerWidth:200,minContainerHeight:100,ready:null,cropstart:null,cropmove:null,cropend:null,crop:null,zoom:null},T=Number.isNaN||c.isNaN;function B(t){return"number"==typeof t&&!T(t)}var z=function(t){return t>0&&t<1/0};function A(t){return void 0===t}function R(e){return"object"===t(e)&&null!==e}var P=Object.prototype.hasOwnProperty;function W(t){if(!R(t))return!1;try{var e=t.constructor,i=e.prototype;return e&&i&&P.call(i,"isPrototypeOf")}catch(t){return!1}}function I(t){return"function"==typeof t}var N=Array.prototype.slice;function L(t){return Array.from?Array.from(t):N.call(t)}function H(t,e){return t&&I(e)&&(Array.isArray(t)||B(t.length)?L(t).forEach((function(i,a){e.call(t,i,a,t)})):R(t)&&Object.keys(t).forEach((function(i){e.call(t,t[i],i,t)}))),t}var Y=Object.assign||function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),a=1;a<e;a++)i[a-1]=arguments[a];return R(t)&&i.length>0&&i.forEach((function(e){R(e)&&Object.keys(e).forEach((function(i){t[i]=e[i]}))})),t},X=/\.\d*(?:0|9){12}\d*$/;function q(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e11;return X.test(t)?Math.round(t*e)/e:t}var U=/^width|height|left|top|marginLeft|marginTop$/;function F(t,e){var i=t.style;H(e,(function(t,e){U.test(e)&&B(t)&&(t="".concat(t,"px")),i[e]=t}))}function $(t,e){if(e)if(B(t.length))H(t,(function(t){$(t,e)}));else if(t.classList)t.classList.add(e);else{var i=t.className.trim();i?i.indexOf(e)<0&&(t.className="".concat(i," ").concat(e)):t.className=e}}function K(t,e){e&&(B(t.length)?H(t,(function(t){K(t,e)})):t.classList?t.classList.remove(e):t.className.indexOf(e)>=0&&(t.className=t.className.replace(e,"")))}function V(t,e,i){e&&(B(t.length)?H(t,(function(t){V(t,e,i)})):i?$(t,e):K(t,e))}var Z=/([a-z\d])([A-Z])/g;function Q(t){return t.replace(Z,"$1-$2").toLowerCase()}function G(t,e){return R(t[e])?t[e]:t.dataset?t.dataset[e]:t.getAttribute("data-".concat(Q(e)))}function J(t,e,i){R(i)?t[e]=i:t.dataset?t.dataset[e]=i:t.setAttribute("data-".concat(Q(e)),i)}var tt=/\s\s*/,et=function(){var t=!1;if(s){var e=!1,i=function(){},a=Object.defineProperty({},"once",{get:function(){return t=!0,e},set:function(t){e=t}});c.addEventListener("test",i,a),c.removeEventListener("test",i,a)}return t}();function it(t,e,i){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},n=i;e.trim().split(tt).forEach((function(e){if(!et){var o=t.listeners;o&&o[e]&&o[e][i]&&(n=o[e][i],delete o[e][i],0===Object.keys(o[e]).length&&delete o[e],0===Object.keys(o).length&&delete t.listeners)}t.removeEventListener(e,n,a)}))}function at(t,e,i){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},n=i;e.trim().split(tt).forEach((function(e){if(a.once&&!et){var o=t.listeners,r=void 0===o?{}:o;n=function(){delete r[e][i],t.removeEventListener(e,n,a);for(var o=arguments.length,s=new Array(o),c=0;c<o;c++)s[c]=arguments[c];i.apply(t,s)},r[e]||(r[e]={}),r[e][i]&&t.removeEventListener(e,r[e][i],a),r[e][i]=n,t.listeners=r}t.addEventListener(e,n,a)}))}function nt(t,e,i){var a;return I(Event)&&I(CustomEvent)?a=new CustomEvent(e,{detail:i,bubbles:!0,cancelable:!0}):(a=document.createEvent("CustomEvent")).initCustomEvent(e,!0,!0,i),t.dispatchEvent(a)}function ot(t){var e=t.getBoundingClientRect();return{left:e.left+(window.pageXOffset-document.documentElement.clientLeft),top:e.top+(window.pageYOffset-document.documentElement.clientTop)}}var rt=c.location,st=/^(\w+:)\/\/([^:/?#]*):?(\d*)/i;function ct(t){var e=t.match(st);return null!==e&&(e[1]!==rt.protocol||e[2]!==rt.hostname||e[3]!==rt.port)}function lt(t){var e="timestamp=".concat((new Date).getTime());return t+(-1===t.indexOf("?")?"?":"&")+e}function ht(t){var e=t.rotate,i=t.scaleX,a=t.scaleY,n=t.translateX,o=t.translateY,r=[];B(n)&&0!==n&&r.push("translateX(".concat(n,"px)")),B(o)&&0!==o&&r.push("translateY(".concat(o,"px)")),B(e)&&0!==e&&r.push("rotate(".concat(e,"deg)")),B(i)&&1!==i&&r.push("scaleX(".concat(i,")")),B(a)&&1!==a&&r.push("scaleY(".concat(a,")"));var s=r.length?r.join(" "):"none";return{WebkitTransform:s,msTransform:s,transform:s}}function ut(t,e){var i=t.pageX,a=t.pageY,n={endX:i,endY:a};return e?n:o({startX:i,startY:a},n)}function pt(t){var e=t.aspectRatio,i=t.height,a=t.width,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"contain",o=z(a),r=z(i);if(o&&r){var s=i*e;"contain"===n&&s>a||"cover"===n&&s<a?i=a/e:a=i*e}else o?i=a/e:r&&(a=i*e);return{width:a,height:i}}function dt(t,e,i,a){var n=e.aspectRatio,o=e.naturalWidth,s=e.naturalHeight,c=e.rotate,l=void 0===c?0:c,h=e.scaleX,u=void 0===h?1:h,p=e.scaleY,d=void 0===p?1:p,m=i.aspectRatio,f=i.naturalWidth,g=i.naturalHeight,b=a.fillColor,v=void 0===b?"transparent":b,y=a.imageSmoothingEnabled,w=void 0===y||y,x=a.imageSmoothingQuality,O=void 0===x?"low":x,C=a.maxWidth,E=void 0===C?1/0:C,j=a.maxHeight,D=void 0===j?1/0:j,M=a.minWidth,k=void 0===M?0:M,S=a.minHeight,_=void 0===S?0:S,T=document.createElement("canvas"),B=T.getContext("2d"),z=pt({aspectRatio:m,width:E,height:D}),A=pt({aspectRatio:m,width:k,height:_},"cover"),R=Math.min(z.width,Math.max(A.width,f)),P=Math.min(z.height,Math.max(A.height,g)),W=pt({aspectRatio:n,width:E,height:D}),I=pt({aspectRatio:n,width:k,height:_},"cover"),N=Math.min(W.width,Math.max(I.width,o)),L=Math.min(W.height,Math.max(I.height,s)),H=[-N/2,-L/2,N,L];return T.width=q(R),T.height=q(P),B.fillStyle=v,B.fillRect(0,0,R,P),B.save(),B.translate(R/2,P/2),B.rotate(l*Math.PI/180),B.scale(u,d),B.imageSmoothingEnabled=w,B.imageSmoothingQuality=O,B.drawImage.apply(B,[t].concat(r(H.map((function(t){return Math.floor(q(t))}))))),B.restore(),T}var mt=String.fromCharCode,ft=/^data:.*,/;function gt(t){var e,i=new DataView(t);try{var a,n,o;if(255===i.getUint8(0)&&216===i.getUint8(1))for(var r=i.byteLength,s=2;s+1<r;){if(255===i.getUint8(s)&&225===i.getUint8(s+1)){n=s;break}s+=1}if(n){var c=n+10;if("Exif"===function(t,e,i){var a="";i+=e;for(var n=e;n<i;n+=1)a+=mt(t.getUint8(n));return a}(i,n+4,4)){var l=i.getUint16(c);if(((a=18761===l)||19789===l)&&42===i.getUint16(c+2,a)){var h=i.getUint32(c+4,a);h>=8&&(o=c+h)}}}if(o){var u,p,d=i.getUint16(o,a);for(p=0;p<d;p+=1)if(u=o+12*p+2,274===i.getUint16(u,a)){u+=8,e=i.getUint16(u,a),i.setUint16(u,1,a);break}}}catch(t){e=1}return e}var bt={render:function(){this.initContainer(),this.initCanvas(),this.initCropBox(),this.renderCanvas(),this.cropped&&this.renderCropBox()},initContainer:function(){var t=this.element,e=this.options,i=this.container,a=this.cropper;$(a,d),K(t,d);var n={width:Math.max(i.offsetWidth,Number(e.minContainerWidth)||200),height:Math.max(i.offsetHeight,Number(e.minContainerHeight)||100)};this.containerData=n,F(a,{width:n.width,height:n.height}),$(t,d),K(a,d)},initCanvas:function(){var t=this.containerData,e=this.imageData,i=this.options.viewMode,a=Math.abs(e.rotate)%180==90,n=a?e.naturalHeight:e.naturalWidth,o=a?e.naturalWidth:e.naturalHeight,r=n/o,s=t.width,c=t.height;t.height*r>t.width?3===i?s=t.height*r:c=t.width/r:3===i?c=t.width/r:s=t.height*r;var l={aspectRatio:r,naturalWidth:n,naturalHeight:o,width:s,height:c};l.left=(t.width-s)/2,l.top=(t.height-c)/2,l.oldLeft=l.left,l.oldTop=l.top,this.canvasData=l,this.limited=1===i||2===i,this.limitCanvas(!0,!0),this.initialImageData=Y({},e),this.initialCanvasData=Y({},l)},limitCanvas:function(t,e){var i=this.options,a=this.containerData,n=this.canvasData,o=this.cropBoxData,r=i.viewMode,s=n.aspectRatio,c=this.cropped&&o;if(t){var l=Number(i.minCanvasWidth)||0,h=Number(i.minCanvasHeight)||0;r>1?(l=Math.max(l,a.width),h=Math.max(h,a.height),3===r&&(h*s>l?l=h*s:h=l/s)):r>0&&(l?l=Math.max(l,c?o.width:0):h?h=Math.max(h,c?o.height:0):c&&(l=o.width,(h=o.height)*s>l?l=h*s:h=l/s));var u=pt({aspectRatio:s,width:l,height:h});l=u.width,h=u.height,n.minWidth=l,n.minHeight=h,n.maxWidth=1/0,n.maxHeight=1/0}if(e)if(r>(c?0:1)){var p=a.width-n.width,d=a.height-n.height;n.minLeft=Math.min(0,p),n.minTop=Math.min(0,d),n.maxLeft=Math.max(0,p),n.maxTop=Math.max(0,d),c&&this.limited&&(n.minLeft=Math.min(o.left,o.left+(o.width-n.width)),n.minTop=Math.min(o.top,o.top+(o.height-n.height)),n.maxLeft=o.left,n.maxTop=o.top,2===r&&(n.width>=a.width&&(n.minLeft=Math.min(0,p),n.maxLeft=Math.max(0,p)),n.height>=a.height&&(n.minTop=Math.min(0,d),n.maxTop=Math.max(0,d))))}else n.minLeft=-n.width,n.minTop=-n.height,n.maxLeft=a.width,n.maxTop=a.height},renderCanvas:function(t,e){var i=this.canvasData,a=this.imageData;if(e){var n=function(t){var e=t.width,i=t.height,a=t.degree;if(90==(a=Math.abs(a)%180))return{width:i,height:e};var n=a%90*Math.PI/180,o=Math.sin(n),r=Math.cos(n),s=e*r+i*o,c=e*o+i*r;return a>90?{width:c,height:s}:{width:s,height:c}}({width:a.naturalWidth*Math.abs(a.scaleX||1),height:a.naturalHeight*Math.abs(a.scaleY||1),degree:a.rotate||0}),o=n.width,r=n.height,s=i.width*(o/i.naturalWidth),c=i.height*(r/i.naturalHeight);i.left-=(s-i.width)/2,i.top-=(c-i.height)/2,i.width=s,i.height=c,i.aspectRatio=o/r,i.naturalWidth=o,i.naturalHeight=r,this.limitCanvas(!0,!1)}(i.width>i.maxWidth||i.width<i.minWidth)&&(i.left=i.oldLeft),(i.height>i.maxHeight||i.height<i.minHeight)&&(i.top=i.oldTop),i.width=Math.min(Math.max(i.width,i.minWidth),i.maxWidth),i.height=Math.min(Math.max(i.height,i.minHeight),i.maxHeight),this.limitCanvas(!1,!0),i.left=Math.min(Math.max(i.left,i.minLeft),i.maxLeft),i.top=Math.min(Math.max(i.top,i.minTop),i.maxTop),i.oldLeft=i.left,i.oldTop=i.top,F(this.canvas,Y({width:i.width,height:i.height},ht({translateX:i.left,translateY:i.top}))),this.renderImage(t),this.cropped&&this.limited&&this.limitCropBox(!0,!0)},renderImage:function(t){var e=this.canvasData,i=this.imageData,a=i.naturalWidth*(e.width/e.naturalWidth),n=i.naturalHeight*(e.height/e.naturalHeight);Y(i,{width:a,height:n,left:(e.width-a)/2,top:(e.height-n)/2}),F(this.image,Y({width:i.width,height:i.height},ht(Y({translateX:i.left,translateY:i.top},i)))),t&&this.output()},initCropBox:function(){var t=this.options,e=this.canvasData,i=t.aspectRatio||t.initialAspectRatio,a=Number(t.autoCropArea)||.8,n={width:e.width,height:e.height};i&&(e.height*i>e.width?n.height=n.width/i:n.width=n.height*i),this.cropBoxData=n,this.limitCropBox(!0,!0),n.width=Math.min(Math.max(n.width,n.minWidth),n.maxWidth),n.height=Math.min(Math.max(n.height,n.minHeight),n.maxHeight),n.width=Math.max(n.minWidth,n.width*a),n.height=Math.max(n.minHeight,n.height*a),n.left=e.left+(e.width-n.width)/2,n.top=e.top+(e.height-n.height)/2,n.oldLeft=n.left,n.oldTop=n.top,this.initialCropBoxData=Y({},n)},limitCropBox:function(t,e){var i=this.options,a=this.containerData,n=this.canvasData,o=this.cropBoxData,r=this.limited,s=i.aspectRatio;if(t){var c=Number(i.minCropBoxWidth)||0,l=Number(i.minCropBoxHeight)||0,h=r?Math.min(a.width,n.width,n.width+n.left,a.width-n.left):a.width,u=r?Math.min(a.height,n.height,n.height+n.top,a.height-n.top):a.height;c=Math.min(c,a.width),l=Math.min(l,a.height),s&&(c&&l?l*s>c?l=c/s:c=l*s:c?l=c/s:l&&(c=l*s),u*s>h?u=h/s:h=u*s),o.minWidth=Math.min(c,h),o.minHeight=Math.min(l,u),o.maxWidth=h,o.maxHeight=u}e&&(r?(o.minLeft=Math.max(0,n.left),o.minTop=Math.max(0,n.top),o.maxLeft=Math.min(a.width,n.left+n.width)-o.width,o.maxTop=Math.min(a.height,n.top+n.height)-o.height):(o.minLeft=0,o.minTop=0,o.maxLeft=a.width-o.width,o.maxTop=a.height-o.height))},renderCropBox:function(){var t=this.options,e=this.containerData,i=this.cropBoxData;(i.width>i.maxWidth||i.width<i.minWidth)&&(i.left=i.oldLeft),(i.height>i.maxHeight||i.height<i.minHeight)&&(i.top=i.oldTop),i.width=Math.min(Math.max(i.width,i.minWidth),i.maxWidth),i.height=Math.min(Math.max(i.height,i.minHeight),i.maxHeight),this.limitCropBox(!1,!0),i.left=Math.min(Math.max(i.left,i.minLeft),i.maxLeft),i.top=Math.min(Math.max(i.top,i.minTop),i.maxTop),i.oldLeft=i.left,i.oldTop=i.top,t.movable&&t.cropBoxMovable&&J(this.face,v,i.width>=e.width&&i.height>=e.height?"move":"all"),F(this.cropBox,Y({width:i.width,height:i.height},ht({translateX:i.left,translateY:i.top}))),this.cropped&&this.limited&&this.limitCanvas(!0,!0),this.disabled||this.output()},output:function(){this.preview(),nt(this.element,"crop",this.getData())}},vt={initPreview:function(){var t=this.element,e=this.crossOrigin,i=this.options.preview,a=e?this.crossOriginUrl:this.url,n=t.alt||"The image to preview",o=document.createElement("img");if(e&&(o.crossOrigin=e),o.src=a,o.alt=n,this.viewBox.appendChild(o),this.viewBoxImage=o,i){var r=i;"string"==typeof i?r=t.ownerDocument.querySelectorAll(i):i.querySelector&&(r=[i]),this.previews=r,H(r,(function(t){var i=document.createElement("img");J(t,y,{width:t.offsetWidth,height:t.offsetHeight,html:t.innerHTML}),e&&(i.crossOrigin=e),i.src=a,i.alt=n,i.style.cssText='display:block;width:100%;height:auto;min-width:0!important;min-height:0!important;max-width:none!important;max-height:none!important;image-orientation:0deg!important;"',t.innerHTML="",t.appendChild(i)}))}},resetPreview:function(){H(this.previews,(function(t){var e=G(t,y);F(t,{width:e.width,height:e.height}),t.innerHTML=e.html,function(t,e){if(R(t[e]))try{delete t[e]}catch(i){t[e]=void 0}else if(t.dataset)try{delete t.dataset[e]}catch(i){t.dataset[e]=void 0}else t.removeAttribute("data-".concat(Q(e)))}(t,y)}))},preview:function(){var t=this.imageData,e=this.canvasData,i=this.cropBoxData,a=i.width,n=i.height,o=t.width,r=t.height,s=i.left-e.left-t.left,c=i.top-e.top-t.top;this.cropped&&!this.disabled&&(F(this.viewBoxImage,Y({width:o,height:r},ht(Y({translateX:-s,translateY:-c},t)))),H(this.previews,(function(e){var i=G(e,y),l=i.width,h=i.height,u=l,p=h,d=1;a&&(p=n*(d=l/a)),n&&p>h&&(u=a*(d=h/n),p=h),F(e,{width:u,height:p}),F(e.getElementsByTagName("img")[0],Y({width:o*d,height:r*d},ht(Y({translateX:-s*d,translateY:-c*d},t))))})))}},yt={bind:function(){var t=this.element,e=this.options,i=this.cropper;I(e.cropstart)&&at(t,"cropstart",e.cropstart),I(e.cropmove)&&at(t,"cropmove",e.cropmove),I(e.cropend)&&at(t,"cropend",e.cropend),I(e.crop)&&at(t,"crop",e.crop),I(e.zoom)&&at(t,"zoom",e.zoom),at(i,C,this.onCropStart=this.cropStart.bind(this)),e.zoomable&&e.zoomOnWheel&&at(i,"wheel",this.onWheel=this.wheel.bind(this),{passive:!1,capture:!0}),e.toggleDragModeOnDblclick&&at(i,"dblclick",this.onDblclick=this.dblclick.bind(this)),at(t.ownerDocument,E,this.onCropMove=this.cropMove.bind(this)),at(t.ownerDocument,j,this.onCropEnd=this.cropEnd.bind(this)),e.responsive&&at(window,"resize",this.onResize=this.resize.bind(this))},unbind:function(){var t=this.element,e=this.options,i=this.cropper;I(e.cropstart)&&it(t,"cropstart",e.cropstart),I(e.cropmove)&&it(t,"cropmove",e.cropmove),I(e.cropend)&&it(t,"cropend",e.cropend),I(e.crop)&&it(t,"crop",e.crop),I(e.zoom)&&it(t,"zoom",e.zoom),it(i,C,this.onCropStart),e.zoomable&&e.zoomOnWheel&&it(i,"wheel",this.onWheel,{passive:!1,capture:!0}),e.toggleDragModeOnDblclick&&it(i,"dblclick",this.onDblclick),it(t.ownerDocument,E,this.onCropMove),it(t.ownerDocument,j,this.onCropEnd),e.responsive&&it(window,"resize",this.onResize)}},wt={resize:function(){var t=this.options,e=this.container,i=this.containerData,a=Number(t.minContainerWidth)||200,n=Number(t.minContainerHeight)||100;if(!(this.disabled||i.width<=a||i.height<=n)){var o,r,s=e.offsetWidth/i.width;1===s&&e.offsetHeight===i.height||(t.restore&&(o=this.getCanvasData(),r=this.getCropBoxData()),this.render(),t.restore&&(this.setCanvasData(H(o,(function(t,e){o[e]=t*s}))),this.setCropBoxData(H(r,(function(t,e){r[e]=t*s})))))}},dblclick:function(){var t,e;this.disabled||"none"===this.options.dragMode||this.setDragMode((t=this.dragBox,e=u,(t.classList?t.classList.contains(e):t.className.indexOf(e)>-1)?"move":"crop"))},wheel:function(t){var e=this,i=Number(this.options.wheelZoomRatio)||.1,a=1;this.disabled||(t.preventDefault(),this.wheeling||(this.wheeling=!0,setTimeout((function(){e.wheeling=!1}),50),t.deltaY?a=t.deltaY>0?1:-1:t.wheelDelta?a=-t.wheelDelta/120:t.detail&&(a=t.detail>0?1:-1),this.zoom(-a*i,t)))},cropStart:function(t){var e=t.buttons,i=t.button;if(!(this.disabled||("mousedown"===t.type||"pointerdown"===t.type&&"mouse"===t.pointerType)&&(B(e)&&1!==e||B(i)&&0!==i||t.ctrlKey))){var a,n=this.options,o=this.pointers;t.changedTouches?H(t.changedTouches,(function(t){o[t.identifier]=ut(t)})):o[t.pointerId||0]=ut(t),a=Object.keys(o).length>1&&n.zoomable&&n.zoomOnTouch?"zoom":G(t.target,v),D.test(a)&&!1!==nt(this.element,"cropstart",{originalEvent:t,action:a})&&(t.preventDefault(),this.action=a,this.cropping=!1,"crop"===a&&(this.cropping=!0,$(this.dragBox,g)))}},cropMove:function(t){var e=this.action;if(!this.disabled&&e){var i=this.pointers;t.preventDefault(),!1!==nt(this.element,"cropmove",{originalEvent:t,action:e})&&(t.changedTouches?H(t.changedTouches,(function(t){Y(i[t.identifier]||{},ut(t,!0))})):Y(i[t.pointerId||0]||{},ut(t,!0)),this.change(t))}},cropEnd:function(t){if(!this.disabled){var e=this.action,i=this.pointers;t.changedTouches?H(t.changedTouches,(function(t){delete i[t.identifier]})):delete i[t.pointerId||0],e&&(t.preventDefault(),Object.keys(i).length||(this.action=""),this.cropping&&(this.cropping=!1,V(this.dragBox,g,this.cropped&&this.options.modal)),nt(this.element,"cropend",{originalEvent:t,action:e}))}}},xt={change:function(t){var e,i=this.options,a=this.canvasData,n=this.containerData,r=this.cropBoxData,s=this.pointers,c=this.action,l=i.aspectRatio,h=r.left,u=r.top,p=r.width,m=r.height,f=h+p,g=u+m,b=0,v=0,y=n.width,w=n.height,x=!0;!l&&t.shiftKey&&(l=p&&m?p/m:1),this.limited&&(b=r.minLeft,v=r.minTop,y=b+Math.min(n.width,a.width,a.left+a.width),w=v+Math.min(n.height,a.height,a.top+a.height));var O=s[Object.keys(s)[0]],C={x:O.endX-O.startX,y:O.endY-O.startY},E=function(t){switch(t){case"e":f+C.x>y&&(C.x=y-f);break;case"w":h+C.x<b&&(C.x=b-h);break;case"n":u+C.y<v&&(C.y=v-u);break;case"s":g+C.y>w&&(C.y=w-g)}};switch(c){case"all":h+=C.x,u+=C.y;break;case"e":if(C.x>=0&&(f>=y||l&&(u<=v||g>=w))){x=!1;break}E("e"),(p+=C.x)<0&&(c="w",h-=p=-p),l&&(m=p/l,u+=(r.height-m)/2);break;case"n":if(C.y<=0&&(u<=v||l&&(h<=b||f>=y))){x=!1;break}E("n"),m-=C.y,u+=C.y,m<0&&(c="s",u-=m=-m),l&&(p=m*l,h+=(r.width-p)/2);break;case"w":if(C.x<=0&&(h<=b||l&&(u<=v||g>=w))){x=!1;break}E("w"),p-=C.x,h+=C.x,p<0&&(c="e",h-=p=-p),l&&(m=p/l,u+=(r.height-m)/2);break;case"s":if(C.y>=0&&(g>=w||l&&(h<=b||f>=y))){x=!1;break}E("s"),(m+=C.y)<0&&(c="n",u-=m=-m),l&&(p=m*l,h+=(r.width-p)/2);break;case"ne":if(l){if(C.y<=0&&(u<=v||f>=y)){x=!1;break}E("n"),m-=C.y,u+=C.y,p=m*l}else E("n"),E("e"),C.x>=0?f<y?p+=C.x:C.y<=0&&u<=v&&(x=!1):p+=C.x,C.y<=0?u>v&&(m-=C.y,u+=C.y):(m-=C.y,u+=C.y);p<0&&m<0?(c="sw",u-=m=-m,h-=p=-p):p<0?(c="nw",h-=p=-p):m<0&&(c="se",u-=m=-m);break;case"nw":if(l){if(C.y<=0&&(u<=v||h<=b)){x=!1;break}E("n"),m-=C.y,u+=C.y,p=m*l,h+=r.width-p}else E("n"),E("w"),C.x<=0?h>b?(p-=C.x,h+=C.x):C.y<=0&&u<=v&&(x=!1):(p-=C.x,h+=C.x),C.y<=0?u>v&&(m-=C.y,u+=C.y):(m-=C.y,u+=C.y);p<0&&m<0?(c="se",u-=m=-m,h-=p=-p):p<0?(c="ne",h-=p=-p):m<0&&(c="sw",u-=m=-m);break;case"sw":if(l){if(C.x<=0&&(h<=b||g>=w)){x=!1;break}E("w"),p-=C.x,h+=C.x,m=p/l}else E("s"),E("w"),C.x<=0?h>b?(p-=C.x,h+=C.x):C.y>=0&&g>=w&&(x=!1):(p-=C.x,h+=C.x),C.y>=0?g<w&&(m+=C.y):m+=C.y;p<0&&m<0?(c="ne",u-=m=-m,h-=p=-p):p<0?(c="se",h-=p=-p):m<0&&(c="nw",u-=m=-m);break;case"se":if(l){if(C.x>=0&&(f>=y||g>=w)){x=!1;break}E("e"),m=(p+=C.x)/l}else E("s"),E("e"),C.x>=0?f<y?p+=C.x:C.y>=0&&g>=w&&(x=!1):p+=C.x,C.y>=0?g<w&&(m+=C.y):m+=C.y;p<0&&m<0?(c="nw",u-=m=-m,h-=p=-p):p<0?(c="sw",h-=p=-p):m<0&&(c="ne",u-=m=-m);break;case"move":this.move(C.x,C.y),x=!1;break;case"zoom":this.zoom(function(t){var e=o({},t),i=[];return H(t,(function(t,a){delete e[a],H(e,(function(e){var a=Math.abs(t.startX-e.startX),n=Math.abs(t.startY-e.startY),o=Math.abs(t.endX-e.endX),r=Math.abs(t.endY-e.endY),s=Math.sqrt(a*a+n*n),c=(Math.sqrt(o*o+r*r)-s)/s;i.push(c)}))})),i.sort((function(t,e){return Math.abs(t)<Math.abs(e)})),i[0]}(s),t),x=!1;break;case"crop":if(!C.x||!C.y){x=!1;break}e=ot(this.cropper),h=O.startX-e.left,u=O.startY-e.top,p=r.minWidth,m=r.minHeight,C.x>0?c=C.y>0?"se":"ne":C.x<0&&(h-=p,c=C.y>0?"sw":"nw"),C.y<0&&(u-=m),this.cropped||(K(this.cropBox,d),this.cropped=!0,this.limited&&this.limitCropBox(!0,!0))}x&&(r.width=p,r.height=m,r.left=h,r.top=u,this.action=c,this.renderCropBox()),H(s,(function(t){t.startX=t.endX,t.startY=t.endY}))}},Ot={crop:function(){return!this.ready||this.cropped||this.disabled||(this.cropped=!0,this.limitCropBox(!0,!0),this.options.modal&&$(this.dragBox,g),K(this.cropBox,d),this.setCropBoxData(this.initialCropBoxData)),this},reset:function(){return this.ready&&!this.disabled&&(this.imageData=Y({},this.initialImageData),this.canvasData=Y({},this.initialCanvasData),this.cropBoxData=Y({},this.initialCropBoxData),this.renderCanvas(),this.cropped&&this.renderCropBox()),this},clear:function(){return this.cropped&&!this.disabled&&(Y(this.cropBoxData,{left:0,top:0,width:0,height:0}),this.cropped=!1,this.renderCropBox(),this.limitCanvas(!0,!0),this.renderCanvas(),K(this.dragBox,g),$(this.cropBox,d)),this},replace:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return!this.disabled&&t&&(this.isImg&&(this.element.src=t),e?(this.url=t,this.image.src=t,this.ready&&(this.viewBoxImage.src=t,H(this.previews,(function(e){e.getElementsByTagName("img")[0].src=t})))):(this.isImg&&(this.replaced=!0),this.options.data=null,this.uncreate(),this.load(t))),this},enable:function(){return this.ready&&this.disabled&&(this.disabled=!1,K(this.cropper,p)),this},disable:function(){return this.ready&&!this.disabled&&(this.disabled=!0,$(this.cropper,p)),this},destroy:function(){var t=this.element;return t.cropper?(t.cropper=void 0,this.isImg&&this.replaced&&(t.src=this.originalUrl),this.uncreate(),this):this},move:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,i=this.canvasData,a=i.left,n=i.top;return this.moveTo(A(t)?t:a+Number(t),A(e)?e:n+Number(e))},moveTo:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,i=this.canvasData,a=!1;return t=Number(t),e=Number(e),this.ready&&!this.disabled&&this.options.movable&&(B(t)&&(i.left=t,a=!0),B(e)&&(i.top=e,a=!0),a&&this.renderCanvas(!0)),this},zoom:function(t,e){var i=this.canvasData;return t=(t=Number(t))<0?1/(1-t):1+t,this.zoomTo(i.width*t/i.naturalWidth,null,e)},zoomTo:function(t,e,i){var a=this.options,n=this.canvasData,o=n.width,r=n.height,s=n.naturalWidth,c=n.naturalHeight;if((t=Number(t))>=0&&this.ready&&!this.disabled&&a.zoomable){var l=s*t,h=c*t;if(!1===nt(this.element,"zoom",{ratio:t,oldRatio:o/s,originalEvent:i}))return this;if(i){var u=this.pointers,p=ot(this.cropper),d=u&&Object.keys(u).length?function(t){var e=0,i=0,a=0;return H(t,(function(t){var n=t.startX,o=t.startY;e+=n,i+=o,a+=1})),{pageX:e/=a,pageY:i/=a}}(u):{pageX:i.pageX,pageY:i.pageY};n.left-=(l-o)*((d.pageX-p.left-n.left)/o),n.top-=(h-r)*((d.pageY-p.top-n.top)/r)}else W(e)&&B(e.x)&&B(e.y)?(n.left-=(l-o)*((e.x-n.left)/o),n.top-=(h-r)*((e.y-n.top)/r)):(n.left-=(l-o)/2,n.top-=(h-r)/2);n.width=l,n.height=h,this.renderCanvas(!0)}return this},rotate:function(t){return this.rotateTo((this.imageData.rotate||0)+Number(t))},rotateTo:function(t){return B(t=Number(t))&&this.ready&&!this.disabled&&this.options.rotatable&&(this.imageData.rotate=t%360,this.renderCanvas(!0,!0)),this},scaleX:function(t){var e=this.imageData.scaleY;return this.scale(t,B(e)?e:1)},scaleY:function(t){var e=this.imageData.scaleX;return this.scale(B(e)?e:1,t)},scale:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,i=this.imageData,a=!1;return t=Number(t),e=Number(e),this.ready&&!this.disabled&&this.options.scalable&&(B(t)&&(i.scaleX=t,a=!0),B(e)&&(i.scaleY=e,a=!0),a&&this.renderCanvas(!0,!0)),this},getData:function(){var t,e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],i=this.options,a=this.imageData,n=this.canvasData,o=this.cropBoxData;if(this.ready&&this.cropped){t={x:o.left-n.left,y:o.top-n.top,width:o.width,height:o.height};var r=a.width/a.naturalWidth;if(H(t,(function(e,i){t[i]=e/r})),e){var s=Math.round(t.y+t.height),c=Math.round(t.x+t.width);t.x=Math.round(t.x),t.y=Math.round(t.y),t.width=c-t.x,t.height=s-t.y}}else t={x:0,y:0,width:0,height:0};return i.rotatable&&(t.rotate=a.rotate||0),i.scalable&&(t.scaleX=a.scaleX||1,t.scaleY=a.scaleY||1),t},setData:function(t){var e=this.options,i=this.imageData,a=this.canvasData,n={};if(this.ready&&!this.disabled&&W(t)){var o=!1;e.rotatable&&B(t.rotate)&&t.rotate!==i.rotate&&(i.rotate=t.rotate,o=!0),e.scalable&&(B(t.scaleX)&&t.scaleX!==i.scaleX&&(i.scaleX=t.scaleX,o=!0),B(t.scaleY)&&t.scaleY!==i.scaleY&&(i.scaleY=t.scaleY,o=!0)),o&&this.renderCanvas(!0,!0);var r=i.width/i.naturalWidth;B(t.x)&&(n.left=t.x*r+a.left),B(t.y)&&(n.top=t.y*r+a.top),B(t.width)&&(n.width=t.width*r),B(t.height)&&(n.height=t.height*r),this.setCropBoxData(n)}return this},getContainerData:function(){return this.ready?Y({},this.containerData):{}},getImageData:function(){return this.sized?Y({},this.imageData):{}},getCanvasData:function(){var t=this.canvasData,e={};return this.ready&&H(["left","top","width","height","naturalWidth","naturalHeight"],(function(i){e[i]=t[i]})),e},setCanvasData:function(t){var e=this.canvasData,i=e.aspectRatio;return this.ready&&!this.disabled&&W(t)&&(B(t.left)&&(e.left=t.left),B(t.top)&&(e.top=t.top),B(t.width)?(e.width=t.width,e.height=t.width/i):B(t.height)&&(e.height=t.height,e.width=t.height*i),this.renderCanvas(!0)),this},getCropBoxData:function(){var t,e=this.cropBoxData;return this.ready&&this.cropped&&(t={left:e.left,top:e.top,width:e.width,height:e.height}),t||{}},setCropBoxData:function(t){var e,i,a=this.cropBoxData,n=this.options.aspectRatio;return this.ready&&this.cropped&&!this.disabled&&W(t)&&(B(t.left)&&(a.left=t.left),B(t.top)&&(a.top=t.top),B(t.width)&&t.width!==a.width&&(e=!0,a.width=t.width),B(t.height)&&t.height!==a.height&&(i=!0,a.height=t.height),n&&(e?a.height=a.width/n:i&&(a.width=a.height*n)),this.renderCropBox()),this},getCroppedCanvas:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!this.ready||!window.HTMLCanvasElement)return null;var e=this.canvasData,i=dt(this.image,this.imageData,e,t);if(!this.cropped)return i;var a=this.getData(),n=a.x,o=a.y,s=a.width,c=a.height,l=i.width/Math.floor(e.naturalWidth);1!==l&&(n*=l,o*=l,s*=l,c*=l);var h=s/c,u=pt({aspectRatio:h,width:t.maxWidth||1/0,height:t.maxHeight||1/0}),p=pt({aspectRatio:h,width:t.minWidth||0,height:t.minHeight||0},"cover"),d=pt({aspectRatio:h,width:t.width||(1!==l?i.width:s),height:t.height||(1!==l?i.height:c)}),m=d.width,f=d.height;m=Math.min(u.width,Math.max(p.width,m)),f=Math.min(u.height,Math.max(p.height,f));var g=document.createElement("canvas"),b=g.getContext("2d");g.width=q(m),g.height=q(f),b.fillStyle=t.fillColor||"transparent",b.fillRect(0,0,m,f);var v=t.imageSmoothingEnabled,y=void 0===v||v,w=t.imageSmoothingQuality;b.imageSmoothingEnabled=y,w&&(b.imageSmoothingQuality=w);var x,O,C,E,j,D,M=i.width,k=i.height,S=n,_=o;S<=-s||S>M?(S=0,x=0,C=0,j=0):S<=0?(C=-S,S=0,j=x=Math.min(M,s+S)):S<=M&&(C=0,j=x=Math.min(s,M-S)),x<=0||_<=-c||_>k?(_=0,O=0,E=0,D=0):_<=0?(E=-_,_=0,D=O=Math.min(k,c+_)):_<=k&&(E=0,D=O=Math.min(c,k-_));var T=[S,_,x,O];if(j>0&&D>0){var B=m/s;T.push(C*B,E*B,j*B,D*B)}return b.drawImage.apply(b,[i].concat(r(T.map((function(t){return Math.floor(q(t))}))))),g},setAspectRatio:function(t){var e=this.options;return this.disabled||A(t)||(e.aspectRatio=Math.max(0,t)||NaN,this.ready&&(this.initCropBox(),this.cropped&&this.renderCropBox())),this},setDragMode:function(t){var e=this.options,i=this.dragBox,a=this.face;if(this.ready&&!this.disabled){var n="crop"===t,o=e.movable&&"move"===t;t=n||o?t:"none",e.dragMode=t,J(i,v,t),V(i,u,n),V(i,b,o),e.cropBoxMovable||(J(a,v,t),V(a,u,n),V(a,b,o))}return this}},Ct=c.Cropper,Et=function(){function t(i){var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(e(this,t),!i||!S.test(i.tagName))throw new Error("The first argument is required and must be an <img> or <canvas> element.");this.element=i,this.options=Y({},_,W(a)&&a),this.cropped=!1,this.disabled=!1,this.pointers={},this.ready=!1,this.reloading=!1,this.replaced=!1,this.sized=!1,this.sizing=!1,this.init()}var a,n,o;return a=t,o=[{key:"noConflict",value:function(){return window.Cropper=Ct,t}},{key:"setDefaults",value:function(t){Y(_,W(t)&&t)}}],(n=[{key:"init",value:function(){var t,e=this.element,i=e.tagName.toLowerCase();if(!e.cropper){if(e.cropper=this,"img"===i){if(this.isImg=!0,t=e.getAttribute("src")||"",this.originalUrl=t,!t)return;t=e.src}else"canvas"===i&&window.HTMLCanvasElement&&(t=e.toDataURL());this.load(t)}}},{key:"load",value:function(t){var e=this;if(t){this.url=t,this.imageData={};var i=this.element,a=this.options;if(a.rotatable||a.scalable||(a.checkOrientation=!1),a.checkOrientation&&window.ArrayBuffer)if(M.test(t))k.test(t)?this.read((n=t.replace(ft,""),o=atob(n),r=new ArrayBuffer(o.length),H(s=new Uint8Array(r),(function(t,e){s[e]=o.charCodeAt(e)})),r)):this.clone();else{var n,o,r,s,c=new XMLHttpRequest,l=this.clone.bind(this);this.reloading=!0,this.xhr=c,c.onabort=l,c.onerror=l,c.ontimeout=l,c.onprogress=function(){"image/jpeg"!==c.getResponseHeader("content-type")&&c.abort()},c.onload=function(){e.read(c.response)},c.onloadend=function(){e.reloading=!1,e.xhr=null},a.checkCrossOrigin&&ct(t)&&i.crossOrigin&&(t=lt(t)),c.open("GET",t),c.responseType="arraybuffer",c.withCredentials="use-credentials"===i.crossOrigin,c.send()}else this.clone()}}},{key:"read",value:function(t){var e=this.options,i=this.imageData,a=gt(t),n=0,o=1,r=1;if(a>1){this.url=function(t,e){for(var i=[],a=new Uint8Array(t);a.length>0;)i.push(mt.apply(null,L(a.subarray(0,8192)))),a=a.subarray(8192);return"data:".concat(e,";base64,").concat(btoa(i.join("")))}(t,"image/jpeg");var s=function(t){var e=0,i=1,a=1;switch(t){case 2:i=-1;break;case 3:e=-180;break;case 4:a=-1;break;case 5:e=90,a=-1;break;case 6:e=90;break;case 7:e=90,i=-1;break;case 8:e=-90}return{rotate:e,scaleX:i,scaleY:a}}(a);n=s.rotate,o=s.scaleX,r=s.scaleY}e.rotatable&&(i.rotate=n),e.scalable&&(i.scaleX=o,i.scaleY=r),this.clone()}},{key:"clone",value:function(){var t=this.element,e=this.url,i=t.crossOrigin,a=e;this.options.checkCrossOrigin&&ct(e)&&(i||(i="anonymous"),a=lt(e)),this.crossOrigin=i,this.crossOriginUrl=a;var n=document.createElement("img");i&&(n.crossOrigin=i),n.src=a||e,n.alt=t.alt||"The image to crop",this.image=n,n.onload=this.start.bind(this),n.onerror=this.stop.bind(this),$(n,m),t.parentNode.insertBefore(n,t.nextSibling)}},{key:"start",value:function(){var t=this,e=this.image;e.onload=null,e.onerror=null,this.sizing=!0;var i=c.navigator&&/(?:iPad|iPhone|iPod).*?AppleWebKit/i.test(c.navigator.userAgent),a=function(e,i){Y(t.imageData,{naturalWidth:e,naturalHeight:i,aspectRatio:e/i}),t.sizing=!1,t.sized=!0,t.build()};if(!e.naturalWidth||i){var n=document.createElement("img"),o=document.body||document.documentElement;this.sizingImage=n,n.onload=function(){a(n.width,n.height),i||o.removeChild(n)},n.src=e.src,i||(n.style.cssText="left:0;max-height:none!important;max-width:none!important;min-height:0!important;min-width:0!important;opacity:0;position:absolute;top:0;z-index:-1;",o.appendChild(n))}else a(e.naturalWidth,e.naturalHeight)}},{key:"stop",value:function(){var t=this.image;t.onload=null,t.onerror=null,t.parentNode.removeChild(t),this.image=null}},{key:"build",value:function(){if(this.sized&&!this.ready){var t=this.element,e=this.options,i=this.image,a=t.parentNode,n=document.createElement("div");n.innerHTML='<div class="cropper-container" touch-action="none"><div class="cropper-wrap-box"><div class="cropper-canvas"></div></div><div class="cropper-drag-box"></div><div class="cropper-crop-box"><span class="cropper-view-box"></span><span class="cropper-dashed dashed-h"></span><span class="cropper-dashed dashed-v"></span><span class="cropper-center"></span><span class="cropper-face"></span><span class="cropper-line line-e" data-cropper-action="e"></span><span class="cropper-line line-n" data-cropper-action="n"></span><span class="cropper-line line-w" data-cropper-action="w"></span><span class="cropper-line line-s" data-cropper-action="s"></span><span class="cropper-point point-e" data-cropper-action="e"></span><span class="cropper-point point-n" data-cropper-action="n"></span><span class="cropper-point point-w" data-cropper-action="w"></span><span class="cropper-point point-s" data-cropper-action="s"></span><span class="cropper-point point-ne" data-cropper-action="ne"></span><span class="cropper-point point-nw" data-cropper-action="nw"></span><span class="cropper-point point-sw" data-cropper-action="sw"></span><span class="cropper-point point-se" data-cropper-action="se"></span></div></div>';var o=n.querySelector(".".concat("cropper","-container")),r=o.querySelector(".".concat("cropper","-canvas")),s=o.querySelector(".".concat("cropper","-drag-box")),c=o.querySelector(".".concat("cropper","-crop-box")),l=c.querySelector(".".concat("cropper","-face"));this.container=a,this.cropper=o,this.canvas=r,this.dragBox=s,this.cropBox=c,this.viewBox=o.querySelector(".".concat("cropper","-view-box")),this.face=l,r.appendChild(i),$(t,d),a.insertBefore(o,t.nextSibling),this.isImg||K(i,m),this.initPreview(),this.bind(),e.initialAspectRatio=Math.max(0,e.initialAspectRatio)||NaN,e.aspectRatio=Math.max(0,e.aspectRatio)||NaN,e.viewMode=Math.max(0,Math.min(3,Math.round(e.viewMode)))||0,$(c,d),e.guides||$(c.getElementsByClassName("".concat("cropper","-dashed")),d),e.center||$(c.getElementsByClassName("".concat("cropper","-center")),d),e.background&&$(o,"".concat("cropper","-bg")),e.highlight||$(l,f),e.cropBoxMovable&&($(l,b),J(l,v,"all")),e.cropBoxResizable||($(c.getElementsByClassName("".concat("cropper","-line")),d),$(c.getElementsByClassName("".concat("cropper","-point")),d)),this.render(),this.ready=!0,this.setDragMode(e.dragMode),e.autoCrop&&this.crop(),this.setData(e.data),I(e.ready)&&at(t,"ready",e.ready,{once:!0}),nt(t,"ready")}}},{key:"unbuild",value:function(){this.ready&&(this.ready=!1,this.unbind(),this.resetPreview(),this.cropper.parentNode.removeChild(this.cropper),K(this.element,d))}},{key:"uncreate",value:function(){this.ready?(this.unbuild(),this.ready=!1,this.cropped=!1):this.sizing?(this.sizingImage.onload=null,this.sizing=!1,this.sized=!1):this.reloading?(this.xhr.onabort=null,this.xhr.abort()):this.image&&this.stop()}}])&&i(a.prototype,n),o&&i(a,o),t}();return Y(Et.prototype,bt,vt,yt,wt,xt,Ot),Et}()}]); 286 287 (function (global, factory) { 288 true ? module.exports = factory() : 289 undefined; 290 }(this, function () { 'use strict'; 291 292 function _typeof(obj) { 293 if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { 294 _typeof = function (obj) { 295 return typeof obj; 296 }; 297 } else { 298 _typeof = function (obj) { 299 return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; 300 }; 301 } 302 303 return _typeof(obj); 304 } 305 306 function _classCallCheck(instance, Constructor) { 307 if (!(instance instanceof Constructor)) { 308 throw new TypeError("Cannot call a class as a function"); 309 } 310 } 311 312 function _defineProperties(target, props) { 313 for (var i = 0; i < props.length; i++) { 314 var descriptor = props[i]; 315 descriptor.enumerable = descriptor.enumerable || false; 316 descriptor.configurable = true; 317 if ("value" in descriptor) descriptor.writable = true; 318 Object.defineProperty(target, descriptor.key, descriptor); 319 } 320 } 321 322 function _createClass(Constructor, protoProps, staticProps) { 323 if (protoProps) _defineProperties(Constructor.prototype, protoProps); 324 if (staticProps) _defineProperties(Constructor, staticProps); 325 return Constructor; 326 } 327 328 function _defineProperty(obj, key, value) { 329 if (key in obj) { 330 Object.defineProperty(obj, key, { 331 value: value, 332 enumerable: true, 333 configurable: true, 334 writable: true 335 }); 336 } else { 337 obj[key] = value; 338 } 339 340 return obj; 341 } 342 343 function ownKeys(object, enumerableOnly) { 344 var keys = Object.keys(object); 345 346 if (Object.getOwnPropertySymbols) { 347 var symbols = Object.getOwnPropertySymbols(object); 348 if (enumerableOnly) symbols = symbols.filter(function (sym) { 349 return Object.getOwnPropertyDescriptor(object, sym).enumerable; 350 }); 351 keys.push.apply(keys, symbols); 352 } 353 354 return keys; 355 } 356 357 function _objectSpread2(target) { 358 for (var i = 1; i < arguments.length; i++) { 359 var source = arguments[i] != null ? arguments[i] : {}; 360 361 if (i % 2) { 362 ownKeys(source, true).forEach(function (key) { 363 _defineProperty(target, key, source[key]); 364 }); 365 } else if (Object.getOwnPropertyDescriptors) { 366 Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); 367 } else { 368 ownKeys(source).forEach(function (key) { 369 Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); 370 }); 371 } 372 } 373 374 return target; 375 } 376 377 function _toConsumableArray(arr) { 378 return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); 379 } 380 381 function _arrayWithoutHoles(arr) { 382 if (Array.isArray(arr)) { 383 for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; 384 385 return arr2; 386 } 387 } 388 389 function _iterableToArray(iter) { 390 if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); 391 } 392 393 function _nonIterableSpread() { 394 throw new TypeError("Invalid attempt to spread non-iterable instance"); 395 } 396 397 var IS_BROWSER = typeof window !== 'undefined' && typeof window.document !== 'undefined'; 398 var WINDOW = IS_BROWSER ? window : {}; 399 var IS_TOUCH_DEVICE = IS_BROWSER ? 'ontouchstart' in WINDOW.document.documentElement : false; 400 var HAS_POINTER_EVENT = IS_BROWSER ? 'PointerEvent' in WINDOW : false; 401 var NAMESPACE = 'cropper'; // Actions 402 403 var ACTION_ALL = 'all'; 404 var ACTION_CROP = 'crop'; 405 var ACTION_MOVE = 'move'; 406 var ACTION_ZOOM = 'zoom'; 407 var ACTION_EAST = 'e'; 408 var ACTION_WEST = 'w'; 409 var ACTION_SOUTH = 's'; 410 var ACTION_NORTH = 'n'; 411 var ACTION_NORTH_EAST = 'ne'; 412 var ACTION_NORTH_WEST = 'nw'; 413 var ACTION_SOUTH_EAST = 'se'; 414 var ACTION_SOUTH_WEST = 'sw'; // Classes 415 416 var CLASS_CROP = "".concat(NAMESPACE, "-crop"); 417 var CLASS_DISABLED = "".concat(NAMESPACE, "-disabled"); 418 var CLASS_HIDDEN = "".concat(NAMESPACE, "-hidden"); 419 var CLASS_HIDE = "".concat(NAMESPACE, "-hide"); 420 var CLASS_INVISIBLE = "".concat(NAMESPACE, "-invisible"); 421 var CLASS_MODAL = "".concat(NAMESPACE, "-modal"); 422 var CLASS_MOVE = "".concat(NAMESPACE, "-move"); // Data keys 423 424 var DATA_ACTION = "".concat(NAMESPACE, "Action"); 425 var DATA_PREVIEW = "".concat(NAMESPACE, "Preview"); // Drag modes 426 427 var DRAG_MODE_CROP = 'crop'; 428 var DRAG_MODE_MOVE = 'move'; 429 var DRAG_MODE_NONE = 'none'; // Events 430 431 var EVENT_CROP = 'crop'; 432 var EVENT_CROP_END = 'cropend'; 433 var EVENT_CROP_MOVE = 'cropmove'; 434 var EVENT_CROP_START = 'cropstart'; 435 var EVENT_DBLCLICK = 'dblclick'; 436 var EVENT_TOUCH_START = IS_TOUCH_DEVICE ? 'touchstart' : 'mousedown'; 437 var EVENT_TOUCH_MOVE = IS_TOUCH_DEVICE ? 'touchmove' : 'mousemove'; 438 var EVENT_TOUCH_END = IS_TOUCH_DEVICE ? 'touchend touchcancel' : 'mouseup'; 439 var EVENT_POINTER_DOWN = HAS_POINTER_EVENT ? 'pointerdown' : EVENT_TOUCH_START; 440 var EVENT_POINTER_MOVE = HAS_POINTER_EVENT ? 'pointermove' : EVENT_TOUCH_MOVE; 441 var EVENT_POINTER_UP = HAS_POINTER_EVENT ? 'pointerup pointercancel' : EVENT_TOUCH_END; 442 var EVENT_READY = 'ready'; 443 var EVENT_RESIZE = 'resize'; 444 var EVENT_WHEEL = 'wheel'; 445 var EVENT_ZOOM = 'zoom'; // Mime types 446 447 var MIME_TYPE_JPEG = 'image/jpeg'; // RegExps 448 449 var REGEXP_ACTIONS = /^e|w|s|n|se|sw|ne|nw|all|crop|move|zoom$/; 450 var REGEXP_DATA_URL = /^data:/; 451 var REGEXP_DATA_URL_JPEG = /^data:image\/jpeg;base64,/; 452 var REGEXP_TAG_NAME = /^img|canvas$/i; // Misc 453 // Inspired by the default width and height of a canvas element. 454 455 var MIN_CONTAINER_WIDTH = 200; 456 var MIN_CONTAINER_HEIGHT = 100; 457 458 var DEFAULTS = { 459 // Define the view mode of the cropper 460 viewMode: 0, 461 // 0, 1, 2, 3 462 // Define the dragging mode of the cropper 463 dragMode: DRAG_MODE_CROP, 464 // 'crop', 'move' or 'none' 465 // Define the initial aspect ratio of the crop box 466 initialAspectRatio: NaN, 467 // Define the aspect ratio of the crop box 468 aspectRatio: NaN, 469 // An object with the previous cropping result data 470 data: null, 471 // A selector for adding extra containers to preview 472 preview: '', 473 // Re-render the cropper when resize the window 474 responsive: true, 475 // Restore the cropped area after resize the window 476 restore: true, 477 // Check if the current image is a cross-origin image 478 checkCrossOrigin: true, 479 // Check the current image's Exif Orientation information 480 checkOrientation: true, 481 // Show the black modal 482 modal: true, 483 // Show the dashed lines for guiding 484 guides: true, 485 // Show the center indicator for guiding 486 center: true, 487 // Show the white modal to highlight the crop box 488 highlight: true, 489 // Show the grid background 490 background: true, 491 // Enable to crop the image automatically when initialize 492 autoCrop: true, 493 // Define the percentage of automatic cropping area when initializes 494 autoCropArea: 0.8, 495 // Enable to move the image 496 movable: true, 497 // Enable to rotate the image 498 rotatable: true, 499 // Enable to scale the image 500 scalable: true, 501 // Enable to zoom the image 502 zoomable: true, 503 // Enable to zoom the image by dragging touch 504 zoomOnTouch: true, 505 // Enable to zoom the image by wheeling mouse 506 zoomOnWheel: true, 507 // Define zoom ratio when zoom the image by wheeling mouse 508 wheelZoomRatio: 0.1, 509 // Enable to move the crop box 510 cropBoxMovable: true, 511 // Enable to resize the crop box 512 cropBoxResizable: true, 513 // Toggle drag mode between "crop" and "move" when click twice on the cropper 514 toggleDragModeOnDblclick: true, 515 // Size limitation 516 minCanvasWidth: 0, 517 minCanvasHeight: 0, 518 minCropBoxWidth: 0, 519 minCropBoxHeight: 0, 520 minContainerWidth: 200, 521 minContainerHeight: 100, 522 // Shortcuts of events 523 ready: null, 524 cropstart: null, 525 cropmove: null, 526 cropend: null, 527 crop: null, 528 zoom: null 529 }; 530 531 var TEMPLATE = '<div class="cropper-container" touch-action="none">' + '<div class="cropper-wrap-box">' + '<div class="cropper-canvas"></div>' + '</div>' + '<div class="cropper-drag-box"></div>' + '<div class="cropper-crop-box">' + '<span class="cropper-view-box"></span>' + '<span class="cropper-dashed dashed-h"></span>' + '<span class="cropper-dashed dashed-v"></span>' + '<span class="cropper-center"></span>' + '<span class="cropper-face"></span>' + '<span class="cropper-line line-e" data-cropper-action="e"></span>' + '<span class="cropper-line line-n" data-cropper-action="n"></span>' + '<span class="cropper-line line-w" data-cropper-action="w"></span>' + '<span class="cropper-line line-s" data-cropper-action="s"></span>' + '<span class="cropper-point point-e" data-cropper-action="e"></span>' + '<span class="cropper-point point-n" data-cropper-action="n"></span>' + '<span class="cropper-point point-w" data-cropper-action="w"></span>' + '<span class="cropper-point point-s" data-cropper-action="s"></span>' + '<span class="cropper-point point-ne" data-cropper-action="ne"></span>' + '<span class="cropper-point point-nw" data-cropper-action="nw"></span>' + '<span class="cropper-point point-sw" data-cropper-action="sw"></span>' + '<span class="cropper-point point-se" data-cropper-action="se"></span>' + '</div>' + '</div>'; 532 533 /** 534 * Check if the given value is not a number. 535 */ 536 537 var isNaN = Number.isNaN || WINDOW.isNaN; 538 /** 539 * Check if the given value is a number. 540 * @param {*} value - The value to check. 541 * @returns {boolean} Returns `true` if the given value is a number, else `false`. 542 */ 543 544 function isNumber(value) { 545 return typeof value === 'number' && !isNaN(value); 546 } 547 /** 548 * Check if the given value is a positive number. 549 * @param {*} value - The value to check. 550 * @returns {boolean} Returns `true` if the given value is a positive number, else `false`. 551 */ 552 553 var isPositiveNumber = function isPositiveNumber(value) { 554 return value > 0 && value < Infinity; 555 }; 556 /** 557 * Check if the given value is undefined. 558 * @param {*} value - The value to check. 559 * @returns {boolean} Returns `true` if the given value is undefined, else `false`. 560 */ 561 562 function isUndefined(value) { 563 return typeof value === 'undefined'; 564 } 565 /** 566 * Check if the given value is an object. 567 * @param {*} value - The value to check. 568 * @returns {boolean} Returns `true` if the given value is an object, else `false`. 569 */ 570 571 function isObject(value) { 572 return _typeof(value) === 'object' && value !== null; 573 } 574 var hasOwnProperty = Object.prototype.hasOwnProperty; 575 /** 576 * Check if the given value is a plain object. 577 * @param {*} value - The value to check. 578 * @returns {boolean} Returns `true` if the given value is a plain object, else `false`. 579 */ 580 581 function isPlainObject(value) { 582 if (!isObject(value)) { 583 return false; 584 } 585 586 try { 587 var _constructor = value.constructor; 588 var prototype = _constructor.prototype; 589 return _constructor && prototype && hasOwnProperty.call(prototype, 'isPrototypeOf'); 590 } catch (error) { 591 return false; 592 } 593 } 594 /** 595 * Check if the given value is a function. 596 * @param {*} value - The value to check. 597 * @returns {boolean} Returns `true` if the given value is a function, else `false`. 598 */ 599 600 function isFunction(value) { 601 return typeof value === 'function'; 602 } 603 var slice = Array.prototype.slice; 604 /** 605 * Convert array-like or iterable object to an array. 606 * @param {*} value - The value to convert. 607 * @returns {Array} Returns a new array. 608 */ 609 610 function toArray(value) { 611 return Array.from ? Array.from(value) : slice.call(value); 612 } 613 /** 614 * Iterate the given data. 615 * @param {*} data - The data to iterate. 616 * @param {Function} callback - The process function for each element. 617 * @returns {*} The original data. 618 */ 619 620 function forEach(data, callback) { 621 if (data && isFunction(callback)) { 622 if (Array.isArray(data) || isNumber(data.length) 623 /* array-like */ 624 ) { 625 toArray(data).forEach(function (value, key) { 626 callback.call(data, value, key, data); 627 }); 628 } else if (isObject(data)) { 629 Object.keys(data).forEach(function (key) { 630 callback.call(data, data[key], key, data); 631 }); 632 } 633 } 634 635 return data; 636 } 637 /** 638 * Extend the given object. 639 * @param {*} target - The target object to extend. 640 * @param {*} args - The rest objects for merging to the target object. 641 * @returns {Object} The extended object. 642 */ 643 644 var assign = Object.assign || function assign(target) { 645 for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { 646 args[_key - 1] = arguments[_key]; 647 } 648 649 if (isObject(target) && args.length > 0) { 650 args.forEach(function (arg) { 651 if (isObject(arg)) { 652 Object.keys(arg).forEach(function (key) { 653 target[key] = arg[key]; 654 }); 655 } 656 }); 657 } 658 659 return target; 660 }; 661 var REGEXP_DECIMALS = /\.\d*(?:0|9){12}\d*$/; 662 /** 663 * Normalize decimal number. 664 * Check out {@link http://0.30000000000000004.com/} 665 * @param {number} value - The value to normalize. 666 * @param {number} [times=100000000000] - The times for normalizing. 667 * @returns {number} Returns the normalized number. 668 */ 669 670 function normalizeDecimalNumber(value) { 671 var times = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 100000000000; 672 return REGEXP_DECIMALS.test(value) ? Math.round(value * times) / times : value; 673 } 674 var REGEXP_SUFFIX = /^width|height|left|top|marginLeft|marginTop$/; 675 /** 676 * Apply styles to the given element. 677 * @param {Element} element - The target element. 678 * @param {Object} styles - The styles for applying. 679 */ 680 681 function setStyle(element, styles) { 682 var style = element.style; 683 forEach(styles, function (value, property) { 684 if (REGEXP_SUFFIX.test(property) && isNumber(value)) { 685 value = "".concat(value, "px"); 686 } 687 688 style[property] = value; 689 }); 690 } 691 /** 692 * Check if the given element has a special class. 693 * @param {Element} element - The element to check. 694 * @param {string} value - The class to search. 695 * @returns {boolean} Returns `true` if the special class was found. 696 */ 697 698 function hasClass(element, value) { 699 return element.classList ? element.classList.contains(value) : element.className.indexOf(value) > -1; 700 } 701 /** 702 * Add classes to the given element. 703 * @param {Element} element - The target element. 704 * @param {string} value - The classes to be added. 705 */ 706 707 function addClass(element, value) { 708 if (!value) { 709 return; 710 } 711 712 if (isNumber(element.length)) { 713 forEach(element, function (elem) { 714 addClass(elem, value); 715 }); 716 return; 717 } 718 719 if (element.classList) { 720 element.classList.add(value); 721 return; 722 } 723 724 var className = element.className.trim(); 725 726 if (!className) { 727 element.className = value; 728 } else if (className.indexOf(value) < 0) { 729 element.className = "".concat(className, " ").concat(value); 730 } 731 } 732 /** 733 * Remove classes from the given element. 734 * @param {Element} element - The target element. 735 * @param {string} value - The classes to be removed. 736 */ 737 738 function removeClass(element, value) { 739 if (!value) { 740 return; 741 } 742 743 if (isNumber(element.length)) { 744 forEach(element, function (elem) { 745 removeClass(elem, value); 746 }); 747 return; 748 } 749 750 if (element.classList) { 751 element.classList.remove(value); 752 return; 753 } 754 755 if (element.className.indexOf(value) >= 0) { 756 element.className = element.className.replace(value, ''); 757 } 758 } 759 /** 760 * Add or remove classes from the given element. 761 * @param {Element} element - The target element. 762 * @param {string} value - The classes to be toggled. 763 * @param {boolean} added - Add only. 764 */ 765 766 function toggleClass(element, value, added) { 767 if (!value) { 768 return; 769 } 770 771 if (isNumber(element.length)) { 772 forEach(element, function (elem) { 773 toggleClass(elem, value, added); 774 }); 775 return; 776 } // IE10-11 doesn't support the second parameter of `classList.toggle` 777 778 779 if (added) { 780 addClass(element, value); 781 } else { 782 removeClass(element, value); 783 } 784 } 785 var REGEXP_CAMEL_CASE = /([a-z\d])([A-Z])/g; 786 /** 787 * Transform the given string from camelCase to kebab-case 788 * @param {string} value - The value to transform. 789 * @returns {string} The transformed value. 790 */ 791 792 function toParamCase(value) { 793 return value.replace(REGEXP_CAMEL_CASE, '$1-$2').toLowerCase(); 794 } 795 /** 796 * Get data from the given element. 797 * @param {Element} element - The target element. 798 * @param {string} name - The data key to get. 799 * @returns {string} The data value. 800 */ 801 802 function getData(element, name) { 803 if (isObject(element[name])) { 804 return element[name]; 805 } 806 807 if (element.dataset) { 808 return element.dataset[name]; 809 } 810 811 return element.getAttribute("data-".concat(toParamCase(name))); 812 } 813 /** 814 * Set data to the given element. 815 * @param {Element} element - The target element. 816 * @param {string} name - The data key to set. 817 * @param {string} data - The data value. 818 */ 819 820 function setData(element, name, data) { 821 if (isObject(data)) { 822 element[name] = data; 823 } else if (element.dataset) { 824 element.dataset[name] = data; 825 } else { 826 element.setAttribute("data-".concat(toParamCase(name)), data); 827 } 828 } 829 /** 830 * Remove data from the given element. 831 * @param {Element} element - The target element. 832 * @param {string} name - The data key to remove. 833 */ 834 835 function removeData(element, name) { 836 if (isObject(element[name])) { 837 try { 838 delete element[name]; 839 } catch (error) { 840 element[name] = undefined; 841 } 842 } else if (element.dataset) { 843 // #128 Safari not allows to delete dataset property 844 try { 845 delete element.dataset[name]; 846 } catch (error) { 847 element.dataset[name] = undefined; 848 } 849 } else { 850 element.removeAttribute("data-".concat(toParamCase(name))); 851 } 852 } 853 var REGEXP_SPACES = /\s\s*/; 854 855 var onceSupported = function () { 856 var supported = false; 857 858 if (IS_BROWSER) { 859 var once = false; 860 861 var listener = function listener() {}; 862 863 var options = Object.defineProperty({}, 'once', { 864 get: function get() { 865 supported = true; 866 return once; 867 }, 868 869 /** 870 * This setter can fix a `TypeError` in strict mode 871 * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Getter_only} 872 * @param {boolean} value - The value to set 873 */ 874 set: function set(value) { 875 once = value; 876 } 877 }); 878 WINDOW.addEventListener('test', listener, options); 879 WINDOW.removeEventListener('test', listener, options); 880 } 881 882 return supported; 883 }(); 884 /** 885 * Remove event listener from the target element. 886 * @param {Element} element - The event target. 887 * @param {string} type - The event type(s). 888 * @param {Function} listener - The event listener. 889 * @param {Object} options - The event options. 890 */ 891 892 893 function removeListener(element, type, listener) { 894 var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; 895 var handler = listener; 896 type.trim().split(REGEXP_SPACES).forEach(function (event) { 897 if (!onceSupported) { 898 var listeners = element.listeners; 899 900 if (listeners && listeners[event] && listeners[event][listener]) { 901 handler = listeners[event][listener]; 902 delete listeners[event][listener]; 903 904 if (Object.keys(listeners[event]).length === 0) { 905 delete listeners[event]; 906 } 907 908 if (Object.keys(listeners).length === 0) { 909 delete element.listeners; 910 } 911 } 912 } 913 914 element.removeEventListener(event, handler, options); 915 }); 916 } 917 /** 918 * Add event listener to the target element. 919 * @param {Element} element - The event target. 920 * @param {string} type - The event type(s). 921 * @param {Function} listener - The event listener. 922 * @param {Object} options - The event options. 923 */ 924 925 function addListener(element, type, listener) { 926 var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; 927 var _handler = listener; 928 type.trim().split(REGEXP_SPACES).forEach(function (event) { 929 if (options.once && !onceSupported) { 930 var _element$listeners = element.listeners, 931 listeners = _element$listeners === void 0 ? {} : _element$listeners; 932 933 _handler = function handler() { 934 delete listeners[event][listener]; 935 element.removeEventListener(event, _handler, options); 936 937 for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { 938 args[_key2] = arguments[_key2]; 939 } 940 941 listener.apply(element, args); 942 }; 943 944 if (!listeners[event]) { 945 listeners[event] = {}; 946 } 947 948 if (listeners[event][listener]) { 949 element.removeEventListener(event, listeners[event][listener], options); 950 } 951 952 listeners[event][listener] = _handler; 953 element.listeners = listeners; 954 } 955 956 element.addEventListener(event, _handler, options); 957 }); 958 } 959 /** 960 * Dispatch event on the target element. 961 * @param {Element} element - The event target. 962 * @param {string} type - The event type(s). 963 * @param {Object} data - The additional event data. 964 * @returns {boolean} Indicate if the event is default prevented or not. 965 */ 966 967 function dispatchEvent(element, type, data) { 968 var event; // Event and CustomEvent on IE9-11 are global objects, not constructors 969 970 if (isFunction(Event) && isFunction(CustomEvent)) { 971 event = new CustomEvent(type, { 972 detail: data, 973 bubbles: true, 974 cancelable: true 975 }); 976 } else { 977 event = document.createEvent('CustomEvent'); 978 event.initCustomEvent(type, true, true, data); 979 } 980 981 return element.dispatchEvent(event); 982 } 983 /** 984 * Get the offset base on the document. 985 * @param {Element} element - The target element. 986 * @returns {Object} The offset data. 987 */ 988 989 function getOffset(element) { 990 var box = element.getBoundingClientRect(); 991 return { 992 left: box.left + (window.pageXOffset - document.documentElement.clientLeft), 993 top: box.top + (window.pageYOffset - document.documentElement.clientTop) 994 }; 995 } 996 var location = WINDOW.location; 997 var REGEXP_ORIGINS = /^(\w+:)\/\/([^:/?#]*):?(\d*)/i; 998 /** 999 * Check if the given URL is a cross origin URL. 1000 * @param {string} url - The target URL. 1001 * @returns {boolean} Returns `true` if the given URL is a cross origin URL, else `false`. 1002 */ 1003 1004 function isCrossOriginURL(url) { 1005 var parts = url.match(REGEXP_ORIGINS); 1006 return parts !== null && (parts[1] !== location.protocol || parts[2] !== location.hostname || parts[3] !== location.port); 1007 } 1008 /** 1009 * Add timestamp to the given URL. 1010 * @param {string} url - The target URL. 1011 * @returns {string} The result URL. 1012 */ 1013 1014 function addTimestamp(url) { 1015 var timestamp = "timestamp=".concat(new Date().getTime()); 1016 return url + (url.indexOf('?') === -1 ? '?' : '&') + timestamp; 1017 } 1018 /** 1019 * Get transforms base on the given object. 1020 * @param {Object} obj - The target object. 1021 * @returns {string} A string contains transform values. 1022 */ 1023 1024 function getTransforms(_ref) { 1025 var rotate = _ref.rotate, 1026 scaleX = _ref.scaleX, 1027 scaleY = _ref.scaleY, 1028 translateX = _ref.translateX, 1029 translateY = _ref.translateY; 1030 var values = []; 1031 1032 if (isNumber(translateX) && translateX !== 0) { 1033 values.push("translateX(".concat(translateX, "px)")); 1034 } 1035 1036 if (isNumber(translateY) && translateY !== 0) { 1037 values.push("translateY(".concat(translateY, "px)")); 1038 } // Rotate should come first before scale to match orientation transform 1039 1040 1041 if (isNumber(rotate) && rotate !== 0) { 1042 values.push("rotate(".concat(rotate, "deg)")); 1043 } 1044 1045 if (isNumber(scaleX) && scaleX !== 1) { 1046 values.push("scaleX(".concat(scaleX, ")")); 1047 } 1048 1049 if (isNumber(scaleY) && scaleY !== 1) { 1050 values.push("scaleY(".concat(scaleY, ")")); 1051 } 1052 1053 var transform = values.length ? values.join(' ') : 'none'; 1054 return { 1055 WebkitTransform: transform, 1056 msTransform: transform, 1057 transform: transform 1058 }; 1059 } 1060 /** 1061 * Get the max ratio of a group of pointers. 1062 * @param {string} pointers - The target pointers. 1063 * @returns {number} The result ratio. 1064 */ 1065 1066 function getMaxZoomRatio(pointers) { 1067 var pointers2 = _objectSpread2({}, pointers); 1068 1069 var ratios = []; 1070 forEach(pointers, function (pointer, pointerId) { 1071 delete pointers2[pointerId]; 1072 forEach(pointers2, function (pointer2) { 1073 var x1 = Math.abs(pointer.startX - pointer2.startX); 1074 var y1 = Math.abs(pointer.startY - pointer2.startY); 1075 var x2 = Math.abs(pointer.endX - pointer2.endX); 1076 var y2 = Math.abs(pointer.endY - pointer2.endY); 1077 var z1 = Math.sqrt(x1 * x1 + y1 * y1); 1078 var z2 = Math.sqrt(x2 * x2 + y2 * y2); 1079 var ratio = (z2 - z1) / z1; 1080 ratios.push(ratio); 1081 }); 1082 }); 1083 ratios.sort(function (a, b) { 1084 return Math.abs(a) < Math.abs(b); 1085 }); 1086 return ratios[0]; 1087 } 1088 /** 1089 * Get a pointer from an event object. 1090 * @param {Object} event - The target event object. 1091 * @param {boolean} endOnly - Indicates if only returns the end point coordinate or not. 1092 * @returns {Object} The result pointer contains start and/or end point coordinates. 1093 */ 1094 1095 function getPointer(_ref2, endOnly) { 1096 var pageX = _ref2.pageX, 1097 pageY = _ref2.pageY; 1098 var end = { 1099 endX: pageX, 1100 endY: pageY 1101 }; 1102 return endOnly ? end : _objectSpread2({ 1103 startX: pageX, 1104 startY: pageY 1105 }, end); 1106 } 1107 /** 1108 * Get the center point coordinate of a group of pointers. 1109 * @param {Object} pointers - The target pointers. 1110 * @returns {Object} The center point coordinate. 1111 */ 1112 1113 function getPointersCenter(pointers) { 1114 var pageX = 0; 1115 var pageY = 0; 1116 var count = 0; 1117 forEach(pointers, function (_ref3) { 1118 var startX = _ref3.startX, 1119 startY = _ref3.startY; 1120 pageX += startX; 1121 pageY += startY; 1122 count += 1; 1123 }); 1124 pageX /= count; 1125 pageY /= count; 1126 return { 1127 pageX: pageX, 1128 pageY: pageY 1129 }; 1130 } 1131 /** 1132 * Get the max sizes in a rectangle under the given aspect ratio. 1133 * @param {Object} data - The original sizes. 1134 * @param {string} [type='contain'] - The adjust type. 1135 * @returns {Object} The result sizes. 1136 */ 1137 1138 function getAdjustedSizes(_ref4) // or 'cover' 1139 { 1140 var aspectRatio = _ref4.aspectRatio, 1141 height = _ref4.height, 1142 width = _ref4.width; 1143 var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'contain'; 1144 var isValidWidth = isPositiveNumber(width); 1145 var isValidHeight = isPositiveNumber(height); 1146 1147 if (isValidWidth && isValidHeight) { 1148 var adjustedWidth = height * aspectRatio; 1149 1150 if (type === 'contain' && adjustedWidth > width || type === 'cover' && adjustedWidth < width) { 1151 height = width / aspectRatio; 1152 } else { 1153 width = height * aspectRatio; 1154 } 1155 } else if (isValidWidth) { 1156 height = width / aspectRatio; 1157 } else if (isValidHeight) { 1158 width = height * aspectRatio; 1159 } 1160 1161 return { 1162 width: width, 1163 height: height 1164 }; 1165 } 1166 /** 1167 * Get the new sizes of a rectangle after rotated. 1168 * @param {Object} data - The original sizes. 1169 * @returns {Object} The result sizes. 1170 */ 1171 1172 function getRotatedSizes(_ref5) { 1173 var width = _ref5.width, 1174 height = _ref5.height, 1175 degree = _ref5.degree; 1176 degree = Math.abs(degree) % 180; 1177 1178 if (degree === 90) { 1179 return { 1180 width: height, 1181 height: width 1182 }; 1183 } 1184 1185 var arc = degree % 90 * Math.PI / 180; 1186 var sinArc = Math.sin(arc); 1187 var cosArc = Math.cos(arc); 1188 var newWidth = width * cosArc + height * sinArc; 1189 var newHeight = width * sinArc + height * cosArc; 1190 return degree > 90 ? { 1191 width: newHeight, 1192 height: newWidth 1193 } : { 1194 width: newWidth, 1195 height: newHeight 1196 }; 1197 } 1198 /** 1199 * Get a canvas which drew the given image. 1200 * @param {HTMLImageElement} image - The image for drawing. 1201 * @param {Object} imageData - The image data. 1202 * @param {Object} canvasData - The canvas data. 1203 * @param {Object} options - The options. 1204 * @returns {HTMLCanvasElement} The result canvas. 1205 */ 1206 1207 function getSourceCanvas(image, _ref6, _ref7, _ref8) { 1208 var imageAspectRatio = _ref6.aspectRatio, 1209 imageNaturalWidth = _ref6.naturalWidth, 1210 imageNaturalHeight = _ref6.naturalHeight, 1211 _ref6$rotate = _ref6.rotate, 1212 rotate = _ref6$rotate === void 0 ? 0 : _ref6$rotate, 1213 _ref6$scaleX = _ref6.scaleX, 1214 scaleX = _ref6$scaleX === void 0 ? 1 : _ref6$scaleX, 1215 _ref6$scaleY = _ref6.scaleY, 1216 scaleY = _ref6$scaleY === void 0 ? 1 : _ref6$scaleY; 1217 var aspectRatio = _ref7.aspectRatio, 1218 naturalWidth = _ref7.naturalWidth, 1219 naturalHeight = _ref7.naturalHeight; 1220 var _ref8$fillColor = _ref8.fillColor, 1221 fillColor = _ref8$fillColor === void 0 ? 'transparent' : _ref8$fillColor, 1222 _ref8$imageSmoothingE = _ref8.imageSmoothingEnabled, 1223 imageSmoothingEnabled = _ref8$imageSmoothingE === void 0 ? true : _ref8$imageSmoothingE, 1224 _ref8$imageSmoothingQ = _ref8.imageSmoothingQuality, 1225 imageSmoothingQuality = _ref8$imageSmoothingQ === void 0 ? 'low' : _ref8$imageSmoothingQ, 1226 _ref8$maxWidth = _ref8.maxWidth, 1227 maxWidth = _ref8$maxWidth === void 0 ? Infinity : _ref8$maxWidth, 1228 _ref8$maxHeight = _ref8.maxHeight, 1229 maxHeight = _ref8$maxHeight === void 0 ? Infinity : _ref8$maxHeight, 1230 _ref8$minWidth = _ref8.minWidth, 1231 minWidth = _ref8$minWidth === void 0 ? 0 : _ref8$minWidth, 1232 _ref8$minHeight = _ref8.minHeight, 1233 minHeight = _ref8$minHeight === void 0 ? 0 : _ref8$minHeight; 1234 var canvas = document.createElement('canvas'); 1235 var context = canvas.getContext('2d'); 1236 var maxSizes = getAdjustedSizes({ 1237 aspectRatio: aspectRatio, 1238 width: maxWidth, 1239 height: maxHeight 1240 }); 1241 var minSizes = getAdjustedSizes({ 1242 aspectRatio: aspectRatio, 1243 width: minWidth, 1244 height: minHeight 1245 }, 'cover'); 1246 var width = Math.min(maxSizes.width, Math.max(minSizes.width, naturalWidth)); 1247 var height = Math.min(maxSizes.height, Math.max(minSizes.height, naturalHeight)); // Note: should always use image's natural sizes for drawing as 1248 // imageData.naturalWidth === canvasData.naturalHeight when rotate % 180 === 90 1249 1250 var destMaxSizes = getAdjustedSizes({ 1251 aspectRatio: imageAspectRatio, 1252 width: maxWidth, 1253 height: maxHeight 1254 }); 1255 var destMinSizes = getAdjustedSizes({ 1256 aspectRatio: imageAspectRatio, 1257 width: minWidth, 1258 height: minHeight 1259 }, 'cover'); 1260 var destWidth = Math.min(destMaxSizes.width, Math.max(destMinSizes.width, imageNaturalWidth)); 1261 var destHeight = Math.min(destMaxSizes.height, Math.max(destMinSizes.height, imageNaturalHeight)); 1262 var params = [-destWidth / 2, -destHeight / 2, destWidth, destHeight]; 1263 canvas.width = normalizeDecimalNumber(width); 1264 canvas.height = normalizeDecimalNumber(height); 1265 context.fillStyle = fillColor; 1266 context.fillRect(0, 0, width, height); 1267 context.save(); 1268 context.translate(width / 2, height / 2); 1269 context.rotate(rotate * Math.PI / 180); 1270 context.scale(scaleX, scaleY); 1271 context.imageSmoothingEnabled = imageSmoothingEnabled; 1272 context.imageSmoothingQuality = imageSmoothingQuality; 1273 context.drawImage.apply(context, [image].concat(_toConsumableArray(params.map(function (param) { 1274 return Math.floor(normalizeDecimalNumber(param)); 1275 })))); 1276 context.restore(); 1277 return canvas; 1278 } 1279 var fromCharCode = String.fromCharCode; 1280 /** 1281 * Get string from char code in data view. 1282 * @param {DataView} dataView - The data view for read. 1283 * @param {number} start - The start index. 1284 * @param {number} length - The read length. 1285 * @returns {string} The read result. 1286 */ 1287 1288 function getStringFromCharCode(dataView, start, length) { 1289 var str = ''; 1290 length += start; 1291 1292 for (var i = start; i < length; i += 1) { 1293 str += fromCharCode(dataView.getUint8(i)); 1294 } 1295 1296 return str; 1297 } 1298 var REGEXP_DATA_URL_HEAD = /^data:.*,/; 1299 /** 1300 * Transform Data URL to array buffer. 1301 * @param {string} dataURL - The Data URL to transform. 1302 * @returns {ArrayBuffer} The result array buffer. 1303 */ 1304 1305 function dataURLToArrayBuffer(dataURL) { 1306 var base64 = dataURL.replace(REGEXP_DATA_URL_HEAD, ''); 1307 var binary = atob(base64); 1308 var arrayBuffer = new ArrayBuffer(binary.length); 1309 var uint8 = new Uint8Array(arrayBuffer); 1310 forEach(uint8, function (value, i) { 1311 uint8[i] = binary.charCodeAt(i); 1312 }); 1313 return arrayBuffer; 1314 } 1315 /** 1316 * Transform array buffer to Data URL. 1317 * @param {ArrayBuffer} arrayBuffer - The array buffer to transform. 1318 * @param {string} mimeType - The mime type of the Data URL. 1319 * @returns {string} The result Data URL. 1320 */ 1321 1322 function arrayBufferToDataURL(arrayBuffer, mimeType) { 1323 var chunks = []; // Chunk Typed Array for better performance (#435) 1324 1325 var chunkSize = 8192; 1326 var uint8 = new Uint8Array(arrayBuffer); 1327 1328 while (uint8.length > 0) { 1329 // XXX: Babel's `toConsumableArray` helper will throw error in IE or Safari 9 1330 // eslint-disable-next-line prefer-spread 1331 chunks.push(fromCharCode.apply(null, toArray(uint8.subarray(0, chunkSize)))); 1332 uint8 = uint8.subarray(chunkSize); 1333 } 1334 1335 return "data:".concat(mimeType, ";base64,").concat(btoa(chunks.join(''))); 1336 } 1337 /** 1338 * Get orientation value from given array buffer. 1339 * @param {ArrayBuffer} arrayBuffer - The array buffer to read. 1340 * @returns {number} The read orientation value. 1341 */ 1342 1343 function resetAndGetOrientation(arrayBuffer) { 1344 var dataView = new DataView(arrayBuffer); 1345 var orientation; // Ignores range error when the image does not have correct Exif information 1346 1347 try { 1348 var littleEndian; 1349 var app1Start; 1350 var ifdStart; // Only handle JPEG image (start by 0xFFD8) 1351 1352 if (dataView.getUint8(0) === 0xFF && dataView.getUint8(1) === 0xD8) { 1353 var length = dataView.byteLength; 1354 var offset = 2; 1355 1356 while (offset + 1 < length) { 1357 if (dataView.getUint8(offset) === 0xFF && dataView.getUint8(offset + 1) === 0xE1) { 1358 app1Start = offset; 1359 break; 1360 } 1361 1362 offset += 1; 1363 } 1364 } 1365 1366 if (app1Start) { 1367 var exifIDCode = app1Start + 4; 1368 var tiffOffset = app1Start + 10; 1369 1370 if (getStringFromCharCode(dataView, exifIDCode, 4) === 'Exif') { 1371 var endianness = dataView.getUint16(tiffOffset); 1372 littleEndian = endianness === 0x4949; 1373 1374 if (littleEndian || endianness === 0x4D4D 1375 /* bigEndian */ 1376 ) { 1377 if (dataView.getUint16(tiffOffset + 2, littleEndian) === 0x002A) { 1378 var firstIFDOffset = dataView.getUint32(tiffOffset + 4, littleEndian); 1379 1380 if (firstIFDOffset >= 0x00000008) { 1381 ifdStart = tiffOffset + firstIFDOffset; 1382 } 1383 } 1384 } 1385 } 1386 } 1387 1388 if (ifdStart) { 1389 var _length = dataView.getUint16(ifdStart, littleEndian); 1390 1391 var _offset; 1392 1393 var i; 1394 1395 for (i = 0; i < _length; i += 1) { 1396 _offset = ifdStart + i * 12 + 2; 1397 1398 if (dataView.getUint16(_offset, littleEndian) === 0x0112 1399 /* Orientation */ 1400 ) { 1401 // 8 is the offset of the current tag's value 1402 _offset += 8; // Get the original orientation value 1403 1404 orientation = dataView.getUint16(_offset, littleEndian); // Override the orientation with its default value 1405 1406 dataView.setUint16(_offset, 1, littleEndian); 1407 break; 1408 } 1409 } 1410 } 1411 } catch (error) { 1412 orientation = 1; 1413 } 1414 1415 return orientation; 1416 } 1417 /** 1418 * Parse Exif Orientation value. 1419 * @param {number} orientation - The orientation to parse. 1420 * @returns {Object} The parsed result. 1421 */ 1422 1423 function parseOrientation(orientation) { 1424 var rotate = 0; 1425 var scaleX = 1; 1426 var scaleY = 1; 1427 1428 switch (orientation) { 1429 // Flip horizontal 1430 case 2: 1431 scaleX = -1; 1432 break; 1433 // Rotate left 180° 1434 1435 case 3: 1436 rotate = -180; 1437 break; 1438 // Flip vertical 1439 1440 case 4: 1441 scaleY = -1; 1442 break; 1443 // Flip vertical and rotate right 90° 1444 1445 case 5: 1446 rotate = 90; 1447 scaleY = -1; 1448 break; 1449 // Rotate right 90° 1450 1451 case 6: 1452 rotate = 90; 1453 break; 1454 // Flip horizontal and rotate right 90° 1455 1456 case 7: 1457 rotate = 90; 1458 scaleX = -1; 1459 break; 1460 // Rotate left 90° 1461 1462 case 8: 1463 rotate = -90; 1464 break; 1465 1466 default: 1467 } 1468 1469 return { 1470 rotate: rotate, 1471 scaleX: scaleX, 1472 scaleY: scaleY 1473 }; 1474 } 1475 1476 var render = { 1477 render: function render() { 1478 this.initContainer(); 1479 this.initCanvas(); 1480 this.initCropBox(); 1481 this.renderCanvas(); 1482 1483 if (this.cropped) { 1484 this.renderCropBox(); 1485 } 1486 }, 1487 initContainer: function initContainer() { 1488 var element = this.element, 1489 options = this.options, 1490 container = this.container, 1491 cropper = this.cropper; 1492 addClass(cropper, CLASS_HIDDEN); 1493 removeClass(element, CLASS_HIDDEN); 1494 var containerData = { 1495 width: Math.max(container.offsetWidth, Number(options.minContainerWidth) || 200), 1496 height: Math.max(container.offsetHeight, Number(options.minContainerHeight) || 100) 1497 }; 1498 this.containerData = containerData; 1499 setStyle(cropper, { 1500 width: containerData.width, 1501 height: containerData.height 1502 }); 1503 addClass(element, CLASS_HIDDEN); 1504 removeClass(cropper, CLASS_HIDDEN); 1505 }, 1506 // Canvas (image wrapper) 1507 initCanvas: function initCanvas() { 1508 var containerData = this.containerData, 1509 imageData = this.imageData; 1510 var viewMode = this.options.viewMode; 1511 var rotated = Math.abs(imageData.rotate) % 180 === 90; 1512 var naturalWidth = rotated ? imageData.naturalHeight : imageData.naturalWidth; 1513 var naturalHeight = rotated ? imageData.naturalWidth : imageData.naturalHeight; 1514 var aspectRatio = naturalWidth / naturalHeight; 1515 var canvasWidth = containerData.width; 1516 var canvasHeight = containerData.height; 1517 1518 if (containerData.height * aspectRatio > containerData.width) { 1519 if (viewMode === 3) { 1520 canvasWidth = containerData.height * aspectRatio; 1521 } else { 1522 canvasHeight = containerData.width / aspectRatio; 1523 } 1524 } else if (viewMode === 3) { 1525 canvasHeight = containerData.width / aspectRatio; 1526 } else { 1527 canvasWidth = containerData.height * aspectRatio; 1528 } 1529 1530 var canvasData = { 1531 aspectRatio: aspectRatio, 1532 naturalWidth: naturalWidth, 1533 naturalHeight: naturalHeight, 1534 width: canvasWidth, 1535 height: canvasHeight 1536 }; 1537 canvasData.left = (containerData.width - canvasWidth) / 2; 1538 canvasData.top = (containerData.height - canvasHeight) / 2; 1539 canvasData.oldLeft = canvasData.left; 1540 canvasData.oldTop = canvasData.top; 1541 this.canvasData = canvasData; 1542 this.limited = viewMode === 1 || viewMode === 2; 1543 this.limitCanvas(true, true); 1544 this.initialImageData = assign({}, imageData); 1545 this.initialCanvasData = assign({}, canvasData); 1546 }, 1547 limitCanvas: function limitCanvas(sizeLimited, positionLimited) { 1548 var options = this.options, 1549 containerData = this.containerData, 1550 canvasData = this.canvasData, 1551 cropBoxData = this.cropBoxData; 1552 var viewMode = options.viewMode; 1553 var aspectRatio = canvasData.aspectRatio; 1554 var cropped = this.cropped && cropBoxData; 1555 1556 if (sizeLimited) { 1557 var minCanvasWidth = Number(options.minCanvasWidth) || 0; 1558 var minCanvasHeight = Number(options.minCanvasHeight) || 0; 1559 1560 if (viewMode > 1) { 1561 minCanvasWidth = Math.max(minCanvasWidth, containerData.width); 1562 minCanvasHeight = Math.max(minCanvasHeight, containerData.height); 1563 1564 if (viewMode === 3) { 1565 if (minCanvasHeight * aspectRatio > minCanvasWidth) { 1566 minCanvasWidth = minCanvasHeight * aspectRatio; 1567 } else { 1568 minCanvasHeight = minCanvasWidth / aspectRatio; 1569 } 1570 } 1571 } else if (viewMode > 0) { 1572 if (minCanvasWidth) { 1573 minCanvasWidth = Math.max(minCanvasWidth, cropped ? cropBoxData.width : 0); 1574 } else if (minCanvasHeight) { 1575 minCanvasHeight = Math.max(minCanvasHeight, cropped ? cropBoxData.height : 0); 1576 } else if (cropped) { 1577 minCanvasWidth = cropBoxData.width; 1578 minCanvasHeight = cropBoxData.height; 1579 1580 if (minCanvasHeight * aspectRatio > minCanvasWidth) { 1581 minCanvasWidth = minCanvasHeight * aspectRatio; 1582 } else { 1583 minCanvasHeight = minCanvasWidth / aspectRatio; 1584 } 1585 } 1586 } 1587 1588 var _getAdjustedSizes = getAdjustedSizes({ 1589 aspectRatio: aspectRatio, 1590 width: minCanvasWidth, 1591 height: minCanvasHeight 1592 }); 1593 1594 minCanvasWidth = _getAdjustedSizes.width; 1595 minCanvasHeight = _getAdjustedSizes.height; 1596 canvasData.minWidth = minCanvasWidth; 1597 canvasData.minHeight = minCanvasHeight; 1598 canvasData.maxWidth = Infinity; 1599 canvasData.maxHeight = Infinity; 1600 } 1601 1602 if (positionLimited) { 1603 if (viewMode > (cropped ? 0 : 1)) { 1604 var newCanvasLeft = containerData.width - canvasData.width; 1605 var newCanvasTop = containerData.height - canvasData.height; 1606 canvasData.minLeft = Math.min(0, newCanvasLeft); 1607 canvasData.minTop = Math.min(0, newCanvasTop); 1608 canvasData.maxLeft = Math.max(0, newCanvasLeft); 1609 canvasData.maxTop = Math.max(0, newCanvasTop); 1610 1611 if (cropped && this.limited) { 1612 canvasData.minLeft = Math.min(cropBoxData.left, cropBoxData.left + (cropBoxData.width - canvasData.width)); 1613 canvasData.minTop = Math.min(cropBoxData.top, cropBoxData.top + (cropBoxData.height - canvasData.height)); 1614 canvasData.maxLeft = cropBoxData.left; 1615 canvasData.maxTop = cropBoxData.top; 1616 1617 if (viewMode === 2) { 1618 if (canvasData.width >= containerData.width) { 1619 canvasData.minLeft = Math.min(0, newCanvasLeft); 1620 canvasData.maxLeft = Math.max(0, newCanvasLeft); 1621 } 1622 1623 if (canvasData.height >= containerData.height) { 1624 canvasData.minTop = Math.min(0, newCanvasTop); 1625 canvasData.maxTop = Math.max(0, newCanvasTop); 1626 } 1627 } 1628 } 1629 } else { 1630 canvasData.minLeft = -canvasData.width; 1631 canvasData.minTop = -canvasData.height; 1632 canvasData.maxLeft = containerData.width; 1633 canvasData.maxTop = containerData.height; 1634 } 1635 } 1636 }, 1637 renderCanvas: function renderCanvas(changed, transformed) { 1638 var canvasData = this.canvasData, 1639 imageData = this.imageData; 1640 1641 if (transformed) { 1642 var _getRotatedSizes = getRotatedSizes({ 1643 width: imageData.naturalWidth * Math.abs(imageData.scaleX || 1), 1644 height: imageData.naturalHeight * Math.abs(imageData.scaleY || 1), 1645 degree: imageData.rotate || 0 1646 }), 1647 naturalWidth = _getRotatedSizes.width, 1648 naturalHeight = _getRotatedSizes.height; 1649 1650 var width = canvasData.width * (naturalWidth / canvasData.naturalWidth); 1651 var height = canvasData.height * (naturalHeight / canvasData.naturalHeight); 1652 canvasData.left -= (width - canvasData.width) / 2; 1653 canvasData.top -= (height - canvasData.height) / 2; 1654 canvasData.width = width; 1655 canvasData.height = height; 1656 canvasData.aspectRatio = naturalWidth / naturalHeight; 1657 canvasData.naturalWidth = naturalWidth; 1658 canvasData.naturalHeight = naturalHeight; 1659 this.limitCanvas(true, false); 1660 } 1661 1662 if (canvasData.width > canvasData.maxWidth || canvasData.width < canvasData.minWidth) { 1663 canvasData.left = canvasData.oldLeft; 1664 } 1665 1666 if (canvasData.height > canvasData.maxHeight || canvasData.height < canvasData.minHeight) { 1667 canvasData.top = canvasData.oldTop; 1668 } 1669 1670 canvasData.width = Math.min(Math.max(canvasData.width, canvasData.minWidth), canvasData.maxWidth); 1671 canvasData.height = Math.min(Math.max(canvasData.height, canvasData.minHeight), canvasData.maxHeight); 1672 this.limitCanvas(false, true); 1673 canvasData.left = Math.min(Math.max(canvasData.left, canvasData.minLeft), canvasData.maxLeft); 1674 canvasData.top = Math.min(Math.max(canvasData.top, canvasData.minTop), canvasData.maxTop); 1675 canvasData.oldLeft = canvasData.left; 1676 canvasData.oldTop = canvasData.top; 1677 setStyle(this.canvas, assign({ 1678 width: canvasData.width, 1679 height: canvasData.height 1680 }, getTransforms({ 1681 translateX: canvasData.left, 1682 translateY: canvasData.top 1683 }))); 1684 this.renderImage(changed); 1685 1686 if (this.cropped && this.limited) { 1687 this.limitCropBox(true, true); 1688 } 1689 }, 1690 renderImage: function renderImage(changed) { 1691 var canvasData = this.canvasData, 1692 imageData = this.imageData; 1693 var width = imageData.naturalWidth * (canvasData.width / canvasData.naturalWidth); 1694 var height = imageData.naturalHeight * (canvasData.height / canvasData.naturalHeight); 1695 assign(imageData, { 1696 width: width, 1697 height: height, 1698 left: (canvasData.width - width) / 2, 1699 top: (canvasData.height - height) / 2 1700 }); 1701 setStyle(this.image, assign({ 1702 width: imageData.width, 1703 height: imageData.height 1704 }, getTransforms(assign({ 1705 translateX: imageData.left, 1706 translateY: imageData.top 1707 }, imageData)))); 1708 1709 if (changed) { 1710 this.output(); 1711 } 1712 }, 1713 initCropBox: function initCropBox() { 1714 var options = this.options, 1715 canvasData = this.canvasData; 1716 var aspectRatio = options.aspectRatio || options.initialAspectRatio; 1717 var autoCropArea = Number(options.autoCropArea) || 0.8; 1718 var cropBoxData = { 1719 width: canvasData.width, 1720 height: canvasData.height 1721 }; 1722 1723 if (aspectRatio) { 1724 if (canvasData.height * aspectRatio > canvasData.width) { 1725 cropBoxData.height = cropBoxData.width / aspectRatio; 1726 } else { 1727 cropBoxData.width = cropBoxData.height * aspectRatio; 1728 } 1729 } 1730 1731 this.cropBoxData = cropBoxData; 1732 this.limitCropBox(true, true); // Initialize auto crop area 1733 1734 cropBoxData.width = Math.min(Math.max(cropBoxData.width, cropBoxData.minWidth), cropBoxData.maxWidth); 1735 cropBoxData.height = Math.min(Math.max(cropBoxData.height, cropBoxData.minHeight), cropBoxData.maxHeight); // The width/height of auto crop area must large than "minWidth/Height" 1736 1737 cropBoxData.width = Math.max(cropBoxData.minWidth, cropBoxData.width * autoCropArea); 1738 cropBoxData.height = Math.max(cropBoxData.minHeight, cropBoxData.height * autoCropArea); 1739 cropBoxData.left = canvasData.left + (canvasData.width - cropBoxData.width) / 2; 1740 cropBoxData.top = canvasData.top + (canvasData.height - cropBoxData.height) / 2; 1741 cropBoxData.oldLeft = cropBoxData.left; 1742 cropBoxData.oldTop = cropBoxData.top; 1743 this.initialCropBoxData = assign({}, cropBoxData); 1744 }, 1745 limitCropBox: function limitCropBox(sizeLimited, positionLimited) { 1746 var options = this.options, 1747 containerData = this.containerData, 1748 canvasData = this.canvasData, 1749 cropBoxData = this.cropBoxData, 1750 limited = this.limited; 1751 var aspectRatio = options.aspectRatio; 1752 1753 if (sizeLimited) { 1754 var minCropBoxWidth = Number(options.minCropBoxWidth) || 0; 1755 var minCropBoxHeight = Number(options.minCropBoxHeight) || 0; 1756 var maxCropBoxWidth = limited ? Math.min(containerData.width, canvasData.width, canvasData.width + canvasData.left, containerData.width - canvasData.left) : containerData.width; 1757 var maxCropBoxHeight = limited ? Math.min(containerData.height, canvasData.height, canvasData.height + canvasData.top, containerData.height - canvasData.top) : containerData.height; // The min/maxCropBoxWidth/Height must be less than container's width/height 1758 1759 minCropBoxWidth = Math.min(minCropBoxWidth, containerData.width); 1760 minCropBoxHeight = Math.min(minCropBoxHeight, containerData.height); 1761 1762 if (aspectRatio) { 1763 if (minCropBoxWidth && minCropBoxHeight) { 1764 if (minCropBoxHeight * aspectRatio > minCropBoxWidth) { 1765 minCropBoxHeight = minCropBoxWidth / aspectRatio; 1766 } else { 1767 minCropBoxWidth = minCropBoxHeight * aspectRatio; 1768 } 1769 } else if (minCropBoxWidth) { 1770 minCropBoxHeight = minCropBoxWidth / aspectRatio; 1771 } else if (minCropBoxHeight) { 1772 minCropBoxWidth = minCropBoxHeight * aspectRatio; 1773 } 1774 1775 if (maxCropBoxHeight * aspectRatio > maxCropBoxWidth) { 1776 maxCropBoxHeight = maxCropBoxWidth / aspectRatio; 1777 } else { 1778 maxCropBoxWidth = maxCropBoxHeight * aspectRatio; 1779 } 1780 } // The minWidth/Height must be less than maxWidth/Height 1781 1782 1783 cropBoxData.minWidth = Math.min(minCropBoxWidth, maxCropBoxWidth); 1784 cropBoxData.minHeight = Math.min(minCropBoxHeight, maxCropBoxHeight); 1785 cropBoxData.maxWidth = maxCropBoxWidth; 1786 cropBoxData.maxHeight = maxCropBoxHeight; 1787 } 1788 1789 if (positionLimited) { 1790 if (limited) { 1791 cropBoxData.minLeft = Math.max(0, canvasData.left); 1792 cropBoxData.minTop = Math.max(0, canvasData.top); 1793 cropBoxData.maxLeft = Math.min(containerData.width, canvasData.left + canvasData.width) - cropBoxData.width; 1794 cropBoxData.maxTop = Math.min(containerData.height, canvasData.top + canvasData.height) - cropBoxData.height; 1795 } else { 1796 cropBoxData.minLeft = 0; 1797 cropBoxData.minTop = 0; 1798 cropBoxData.maxLeft = containerData.width - cropBoxData.width; 1799 cropBoxData.maxTop = containerData.height - cropBoxData.height; 1800 } 1801 } 1802 }, 1803 renderCropBox: function renderCropBox() { 1804 var options = this.options, 1805 containerData = this.containerData, 1806 cropBoxData = this.cropBoxData; 1807 1808 if (cropBoxData.width > cropBoxData.maxWidth || cropBoxData.width < cropBoxData.minWidth) { 1809 cropBoxData.left = cropBoxData.oldLeft; 1810 } 1811 1812 if (cropBoxData.height > cropBoxData.maxHeight || cropBoxData.height < cropBoxData.minHeight) { 1813 cropBoxData.top = cropBoxData.oldTop; 1814 } 1815 1816 cropBoxData.width = Math.min(Math.max(cropBoxData.width, cropBoxData.minWidth), cropBoxData.maxWidth); 1817 cropBoxData.height = Math.min(Math.max(cropBoxData.height, cropBoxData.minHeight), cropBoxData.maxHeight); 1818 this.limitCropBox(false, true); 1819 cropBoxData.left = Math.min(Math.max(cropBoxData.left, cropBoxData.minLeft), cropBoxData.maxLeft); 1820 cropBoxData.top = Math.min(Math.max(cropBoxData.top, cropBoxData.minTop), cropBoxData.maxTop); 1821 cropBoxData.oldLeft = cropBoxData.left; 1822 cropBoxData.oldTop = cropBoxData.top; 1823 1824 if (options.movable && options.cropBoxMovable) { 1825 // Turn to move the canvas when the crop box is equal to the container 1826 setData(this.face, DATA_ACTION, cropBoxData.width >= containerData.width && cropBoxData.height >= containerData.height ? ACTION_MOVE : ACTION_ALL); 1827 } 1828 1829 setStyle(this.cropBox, assign({ 1830 width: cropBoxData.width, 1831 height: cropBoxData.height 1832 }, getTransforms({ 1833 translateX: cropBoxData.left, 1834 translateY: cropBoxData.top 1835 }))); 1836 1837 if (this.cropped && this.limited) { 1838 this.limitCanvas(true, true); 1839 } 1840 1841 if (!this.disabled) { 1842 this.output(); 1843 } 1844 }, 1845 output: function output() { 1846 this.preview(); 1847 dispatchEvent(this.element, EVENT_CROP, this.getData()); 1848 } 1849 }; 1850 1851 var preview = { 1852 initPreview: function initPreview() { 1853 var element = this.element, 1854 crossOrigin = this.crossOrigin; 1855 var preview = this.options.preview; 1856 var url = crossOrigin ? this.crossOriginUrl : this.url; 1857 var alt = element.alt || 'The image to preview'; 1858 var image = document.createElement('img'); 1859 1860 if (crossOrigin) { 1861 image.crossOrigin = crossOrigin; 1862 } 1863 1864 image.src = url; 1865 image.alt = alt; 1866 this.viewBox.appendChild(image); 1867 this.viewBoxImage = image; 1868 1869 if (!preview) { 1870 return; 1871 } 1872 1873 var previews = preview; 1874 1875 if (typeof preview === 'string') { 1876 previews = element.ownerDocument.querySelectorAll(preview); 1877 } else if (preview.querySelector) { 1878 previews = [preview]; 1879 } 1880 1881 this.previews = previews; 1882 forEach(previews, function (el) { 1883 var img = document.createElement('img'); // Save the original size for recover 1884 1885 setData(el, DATA_PREVIEW, { 1886 width: el.offsetWidth, 1887 height: el.offsetHeight, 1888 html: el.innerHTML 1889 }); 1890 1891 if (crossOrigin) { 1892 img.crossOrigin = crossOrigin; 1893 } 1894 1895 img.src = url; 1896 img.alt = alt; 1897 /** 1898 * Override img element styles 1899 * Add `display:block` to avoid margin top issue 1900 * Add `height:auto` to override `height` attribute on IE8 1901 * (Occur only when margin-top <= -height) 1902 */ 1903 1904 img.style.cssText = 'display:block;' + 'width:100%;' + 'height:auto;' + 'min-width:0!important;' + 'min-height:0!important;' + 'max-width:none!important;' + 'max-height:none!important;' + 'image-orientation:0deg!important;"'; 1905 el.innerHTML = ''; 1906 el.appendChild(img); 1907 }); 1908 }, 1909 resetPreview: function resetPreview() { 1910 forEach(this.previews, function (element) { 1911 var data = getData(element, DATA_PREVIEW); 1912 setStyle(element, { 1913 width: data.width, 1914 height: data.height 1915 }); 1916 element.innerHTML = data.html; 1917 removeData(element, DATA_PREVIEW); 1918 }); 1919 }, 1920 preview: function preview() { 1921 var imageData = this.imageData, 1922 canvasData = this.canvasData, 1923 cropBoxData = this.cropBoxData; 1924 var cropBoxWidth = cropBoxData.width, 1925 cropBoxHeight = cropBoxData.height; 1926 var width = imageData.width, 1927 height = imageData.height; 1928 var left = cropBoxData.left - canvasData.left - imageData.left; 1929 var top = cropBoxData.top - canvasData.top - imageData.top; 1930 1931 if (!this.cropped || this.disabled) { 1932 return; 1933 } 1934 1935 setStyle(this.viewBoxImage, assign({ 1936 width: width, 1937 height: height 1938 }, getTransforms(assign({ 1939 translateX: -left, 1940 translateY: -top 1941 }, imageData)))); 1942 forEach(this.previews, function (element) { 1943 var data = getData(element, DATA_PREVIEW); 1944 var originalWidth = data.width; 1945 var originalHeight = data.height; 1946 var newWidth = originalWidth; 1947 var newHeight = originalHeight; 1948 var ratio = 1; 1949 1950 if (cropBoxWidth) { 1951 ratio = originalWidth / cropBoxWidth; 1952 newHeight = cropBoxHeight * ratio; 1953 } 1954 1955 if (cropBoxHeight && newHeight > originalHeight) { 1956 ratio = originalHeight / cropBoxHeight; 1957 newWidth = cropBoxWidth * ratio; 1958 newHeight = originalHeight; 1959 } 1960 1961 setStyle(element, { 1962 width: newWidth, 1963 height: newHeight 1964 }); 1965 setStyle(element.getElementsByTagName('img')[0], assign({ 1966 width: width * ratio, 1967 height: height * ratio 1968 }, getTransforms(assign({ 1969 translateX: -left * ratio, 1970 translateY: -top * ratio 1971 }, imageData)))); 1972 }); 1973 } 1974 }; 1975 1976 var events = { 1977 bind: function bind() { 1978 var element = this.element, 1979 options = this.options, 1980 cropper = this.cropper; 1981 1982 if (isFunction(options.cropstart)) { 1983 addListener(element, EVENT_CROP_START, options.cropstart); 1984 } 1985 1986 if (isFunction(options.cropmove)) { 1987 addListener(element, EVENT_CROP_MOVE, options.cropmove); 1988 } 1989 1990 if (isFunction(options.cropend)) { 1991 addListener(element, EVENT_CROP_END, options.cropend); 1992 } 1993 1994 if (isFunction(options.crop)) { 1995 addListener(element, EVENT_CROP, options.crop); 1996 } 1997 1998 if (isFunction(options.zoom)) { 1999 addListener(element, EVENT_ZOOM, options.zoom); 2000 } 2001 2002 addListener(cropper, EVENT_POINTER_DOWN, this.onCropStart = this.cropStart.bind(this)); 2003 2004 if (options.zoomable && options.zoomOnWheel) { 2005 addListener(cropper, EVENT_WHEEL, this.onWheel = this.wheel.bind(this), { 2006 passive: false, 2007 capture: true 2008 }); 2009 } 2010 2011 if (options.toggleDragModeOnDblclick) { 2012 addListener(cropper, EVENT_DBLCLICK, this.onDblclick = this.dblclick.bind(this)); 2013 } 2014 2015 addListener(element.ownerDocument, EVENT_POINTER_MOVE, this.onCropMove = this.cropMove.bind(this)); 2016 addListener(element.ownerDocument, EVENT_POINTER_UP, this.onCropEnd = this.cropEnd.bind(this)); 2017 2018 if (options.responsive) { 2019 addListener(window, EVENT_RESIZE, this.onResize = this.resize.bind(this)); 2020 } 2021 }, 2022 unbind: function unbind() { 2023 var element = this.element, 2024 options = this.options, 2025 cropper = this.cropper; 2026 2027 if (isFunction(options.cropstart)) { 2028 removeListener(element, EVENT_CROP_START, options.cropstart); 2029 } 2030 2031 if (isFunction(options.cropmove)) { 2032 removeListener(element, EVENT_CROP_MOVE, options.cropmove); 2033 } 2034 2035 if (isFunction(options.cropend)) { 2036 removeListener(element, EVENT_CROP_END, options.cropend); 2037 } 2038 2039 if (isFunction(options.crop)) { 2040 removeListener(element, EVENT_CROP, options.crop); 2041 } 2042 2043 if (isFunction(options.zoom)) { 2044 removeListener(element, EVENT_ZOOM, options.zoom); 2045 } 2046 2047 removeListener(cropper, EVENT_POINTER_DOWN, this.onCropStart); 2048 2049 if (options.zoomable && options.zoomOnWheel) { 2050 removeListener(cropper, EVENT_WHEEL, this.onWheel, { 2051 passive: false, 2052 capture: true 2053 }); 2054 } 2055 2056 if (options.toggleDragModeOnDblclick) { 2057 removeListener(cropper, EVENT_DBLCLICK, this.onDblclick); 2058 } 2059 2060 removeListener(element.ownerDocument, EVENT_POINTER_MOVE, this.onCropMove); 2061 removeListener(element.ownerDocument, EVENT_POINTER_UP, this.onCropEnd); 2062 2063 if (options.responsive) { 2064 removeListener(window, EVENT_RESIZE, this.onResize); 2065 } 2066 } 2067 }; 2068 2069 var handlers = { 2070 resize: function resize() { 2071 var options = this.options, 2072 container = this.container, 2073 containerData = this.containerData; 2074 var minContainerWidth = Number(options.minContainerWidth) || MIN_CONTAINER_WIDTH; 2075 var minContainerHeight = Number(options.minContainerHeight) || MIN_CONTAINER_HEIGHT; 2076 2077 if (this.disabled || containerData.width <= minContainerWidth || containerData.height <= minContainerHeight) { 2078 return; 2079 } 2080 2081 var ratio = container.offsetWidth / containerData.width; // Resize when width changed or height changed 2082 2083 if (ratio !== 1 || container.offsetHeight !== containerData.height) { 2084 var canvasData; 2085 var cropBoxData; 2086 2087 if (options.restore) { 2088 canvasData = this.getCanvasData(); 2089 cropBoxData = this.getCropBoxData(); 2090 } 2091 2092 this.render(); 2093 2094 if (options.restore) { 2095 this.setCanvasData(forEach(canvasData, function (n, i) { 2096 canvasData[i] = n * ratio; 2097 })); 2098 this.setCropBoxData(forEach(cropBoxData, function (n, i) { 2099 cropBoxData[i] = n * ratio; 2100 })); 2101 } 2102 } 2103 }, 2104 dblclick: function dblclick() { 2105 if (this.disabled || this.options.dragMode === DRAG_MODE_NONE) { 2106 return; 2107 } 2108 2109 this.setDragMode(hasClass(this.dragBox, CLASS_CROP) ? DRAG_MODE_MOVE : DRAG_MODE_CROP); 2110 }, 2111 wheel: function wheel(event) { 2112 var _this = this; 2113 2114 var ratio = Number(this.options.wheelZoomRatio) || 0.1; 2115 var delta = 1; 2116 2117 if (this.disabled) { 2118 return; 2119 } 2120 2121 event.preventDefault(); // Limit wheel speed to prevent zoom too fast (#21) 2122 2123 if (this.wheeling) { 2124 return; 2125 } 2126 2127 this.wheeling = true; 2128 setTimeout(function () { 2129 _this.wheeling = false; 2130 }, 50); 2131 2132 if (event.deltaY) { 2133 delta = event.deltaY > 0 ? 1 : -1; 2134 } else if (event.wheelDelta) { 2135 delta = -event.wheelDelta / 120; 2136 } else if (event.detail) { 2137 delta = event.detail > 0 ? 1 : -1; 2138 } 2139 2140 this.zoom(-delta * ratio, event); 2141 }, 2142 cropStart: function cropStart(event) { 2143 var buttons = event.buttons, 2144 button = event.button; 2145 2146 if (this.disabled // Handle mouse event and pointer event and ignore touch event 2147 || (event.type === 'mousedown' || event.type === 'pointerdown' && event.pointerType === 'mouse') && ( // No primary button (Usually the left button) 2148 isNumber(buttons) && buttons !== 1 || isNumber(button) && button !== 0 // Open context menu 2149 || event.ctrlKey)) { 2150 return; 2151 } 2152 2153 var options = this.options, 2154 pointers = this.pointers; 2155 var action; 2156 2157 if (event.changedTouches) { 2158 // Handle touch event 2159 forEach(event.changedTouches, function (touch) { 2160 pointers[touch.identifier] = getPointer(touch); 2161 }); 2162 } else { 2163 // Handle mouse event and pointer event 2164 pointers[event.pointerId || 0] = getPointer(event); 2165 } 2166 2167 if (Object.keys(pointers).length > 1 && options.zoomable && options.zoomOnTouch) { 2168 action = ACTION_ZOOM; 2169 } else { 2170 action = getData(event.target, DATA_ACTION); 2171 } 2172 2173 if (!REGEXP_ACTIONS.test(action)) { 2174 return; 2175 } 2176 2177 if (dispatchEvent(this.element, EVENT_CROP_START, { 2178 originalEvent: event, 2179 action: action 2180 }) === false) { 2181 return; 2182 } // This line is required for preventing page zooming in iOS browsers 2183 2184 2185 event.preventDefault(); 2186 this.action = action; 2187 this.cropping = false; 2188 2189 if (action === ACTION_CROP) { 2190 this.cropping = true; 2191 addClass(this.dragBox, CLASS_MODAL); 2192 } 2193 }, 2194 cropMove: function cropMove(event) { 2195 var action = this.action; 2196 2197 if (this.disabled || !action) { 2198 return; 2199 } 2200 2201 var pointers = this.pointers; 2202 event.preventDefault(); 2203 2204 if (dispatchEvent(this.element, EVENT_CROP_MOVE, { 2205 originalEvent: event, 2206 action: action 2207 }) === false) { 2208 return; 2209 } 2210 2211 if (event.changedTouches) { 2212 forEach(event.changedTouches, function (touch) { 2213 // The first parameter should not be undefined (#432) 2214 assign(pointers[touch.identifier] || {}, getPointer(touch, true)); 2215 }); 2216 } else { 2217 assign(pointers[event.pointerId || 0] || {}, getPointer(event, true)); 2218 } 2219 2220 this.change(event); 2221 }, 2222 cropEnd: function cropEnd(event) { 2223 if (this.disabled) { 2224 return; 2225 } 2226 2227 var action = this.action, 2228 pointers = this.pointers; 2229 2230 if (event.changedTouches) { 2231 forEach(event.changedTouches, function (touch) { 2232 delete pointers[touch.identifier]; 2233 }); 2234 } else { 2235 delete pointers[event.pointerId || 0]; 2236 } 2237 2238 if (!action) { 2239 return; 2240 } 2241 2242 event.preventDefault(); 2243 2244 if (!Object.keys(pointers).length) { 2245 this.action = ''; 2246 } 2247 2248 if (this.cropping) { 2249 this.cropping = false; 2250 toggleClass(this.dragBox, CLASS_MODAL, this.cropped && this.options.modal); 2251 } 2252 2253 dispatchEvent(this.element, EVENT_CROP_END, { 2254 originalEvent: event, 2255 action: action 2256 }); 2257 } 2258 }; 2259 2260 var change = { 2261 change: function change(event) { 2262 var options = this.options, 2263 canvasData = this.canvasData, 2264 containerData = this.containerData, 2265 cropBoxData = this.cropBoxData, 2266 pointers = this.pointers; 2267 var action = this.action; 2268 var aspectRatio = options.aspectRatio; 2269 var left = cropBoxData.left, 2270 top = cropBoxData.top, 2271 width = cropBoxData.width, 2272 height = cropBoxData.height; 2273 var right = left + width; 2274 var bottom = top + height; 2275 var minLeft = 0; 2276 var minTop = 0; 2277 var maxWidth = containerData.width; 2278 var maxHeight = containerData.height; 2279 var renderable = true; 2280 var offset; // Locking aspect ratio in "free mode" by holding shift key 2281 2282 if (!aspectRatio && event.shiftKey) { 2283 aspectRatio = width && height ? width / height : 1; 2284 } 2285 2286 if (this.limited) { 2287 minLeft = cropBoxData.minLeft; 2288 minTop = cropBoxData.minTop; 2289 maxWidth = minLeft + Math.min(containerData.width, canvasData.width, canvasData.left + canvasData.width); 2290 maxHeight = minTop + Math.min(containerData.height, canvasData.height, canvasData.top + canvasData.height); 2291 } 2292 2293 var pointer = pointers[Object.keys(pointers)[0]]; 2294 var range = { 2295 x: pointer.endX - pointer.startX, 2296 y: pointer.endY - pointer.startY 2297 }; 2298 2299 var check = function check(side) { 2300 switch (side) { 2301 case ACTION_EAST: 2302 if (right + range.x > maxWidth) { 2303 range.x = maxWidth - right; 2304 } 2305 2306 break; 2307 2308 case ACTION_WEST: 2309 if (left + range.x < minLeft) { 2310 range.x = minLeft - left; 2311 } 2312 2313 break; 2314 2315 case ACTION_NORTH: 2316 if (top + range.y < minTop) { 2317 range.y = minTop - top; 2318 } 2319 2320 break; 2321 2322 case ACTION_SOUTH: 2323 if (bottom + range.y > maxHeight) { 2324 range.y = maxHeight - bottom; 2325 } 2326 2327 break; 2328 2329 default: 2330 } 2331 }; 2332 2333 switch (action) { 2334 // Move crop box 2335 case ACTION_ALL: 2336 left += range.x; 2337 top += range.y; 2338 break; 2339 // Resize crop box 2340 2341 case ACTION_EAST: 2342 if (range.x >= 0 && (right >= maxWidth || aspectRatio && (top <= minTop || bottom >= maxHeight))) { 2343 renderable = false; 2344 break; 2345 } 2346 2347 check(ACTION_EAST); 2348 width += range.x; 2349 2350 if (width < 0) { 2351 action = ACTION_WEST; 2352 width = -width; 2353 left -= width; 2354 } 2355 2356 if (aspectRatio) { 2357 height = width / aspectRatio; 2358 top += (cropBoxData.height - height) / 2; 2359 } 2360 2361 break; 2362 2363 case ACTION_NORTH: 2364 if (range.y <= 0 && (top <= minTop || aspectRatio && (left <= minLeft || right >= maxWidth))) { 2365 renderable = false; 2366 break; 2367 } 2368 2369 check(ACTION_NORTH); 2370 height -= range.y; 2371 top += range.y; 2372 2373 if (height < 0) { 2374 action = ACTION_SOUTH; 2375 height = -height; 2376 top -= height; 2377 } 2378 2379 if (aspectRatio) { 2380 width = height * aspectRatio; 2381 left += (cropBoxData.width - width) / 2; 2382 } 2383 2384 break; 2385 2386 case ACTION_WEST: 2387 if (range.x <= 0 && (left <= minLeft || aspectRatio && (top <= minTop || bottom >= maxHeight))) { 2388 renderable = false; 2389 break; 2390 } 2391 2392 check(ACTION_WEST); 2393 width -= range.x; 2394 left += range.x; 2395 2396 if (width < 0) { 2397 action = ACTION_EAST; 2398 width = -width; 2399 left -= width; 2400 } 2401 2402 if (aspectRatio) { 2403 height = width / aspectRatio; 2404 top += (cropBoxData.height - height) / 2; 2405 } 2406 2407 break; 2408 2409 case ACTION_SOUTH: 2410 if (range.y >= 0 && (bottom >= maxHeight || aspectRatio && (left <= minLeft || right >= maxWidth))) { 2411 renderable = false; 2412 break; 2413 } 2414 2415 check(ACTION_SOUTH); 2416 height += range.y; 2417 2418 if (height < 0) { 2419 action = ACTION_NORTH; 2420 height = -height; 2421 top -= height; 2422 } 2423 2424 if (aspectRatio) { 2425 width = height * aspectRatio; 2426 left += (cropBoxData.width - width) / 2; 2427 } 2428 2429 break; 2430 2431 case ACTION_NORTH_EAST: 2432 if (aspectRatio) { 2433 if (range.y <= 0 && (top <= minTop || right >= maxWidth)) { 2434 renderable = false; 2435 break; 2436 } 2437 2438 check(ACTION_NORTH); 2439 height -= range.y; 2440 top += range.y; 2441 width = height * aspectRatio; 2442 } else { 2443 check(ACTION_NORTH); 2444 check(ACTION_EAST); 2445 2446 if (range.x >= 0) { 2447 if (right < maxWidth) { 2448 width += range.x; 2449 } else if (range.y <= 0 && top <= minTop) { 2450 renderable = false; 2451 } 2452 } else { 2453 width += range.x; 2454 } 2455 2456 if (range.y <= 0) { 2457 if (top > minTop) { 2458 height -= range.y; 2459 top += range.y; 2460 } 2461 } else { 2462 height -= range.y; 2463 top += range.y; 2464 } 2465 } 2466 2467 if (width < 0 && height < 0) { 2468 action = ACTION_SOUTH_WEST; 2469 height = -height; 2470 width = -width; 2471 top -= height; 2472 left -= width; 2473 } else if (width < 0) { 2474 action = ACTION_NORTH_WEST; 2475 width = -width; 2476 left -= width; 2477 } else if (height < 0) { 2478 action = ACTION_SOUTH_EAST; 2479 height = -height; 2480 top -= height; 2481 } 2482 2483 break; 2484 2485 case ACTION_NORTH_WEST: 2486 if (aspectRatio) { 2487 if (range.y <= 0 && (top <= minTop || left <= minLeft)) { 2488 renderable = false; 2489 break; 2490 } 2491 2492 check(ACTION_NORTH); 2493 height -= range.y; 2494 top += range.y; 2495 width = height * aspectRatio; 2496 left += cropBoxData.width - width; 2497 } else { 2498 check(ACTION_NORTH); 2499 check(ACTION_WEST); 2500 2501 if (range.x <= 0) { 2502 if (left > minLeft) { 2503 width -= range.x; 2504 left += range.x; 2505 } else if (range.y <= 0 && top <= minTop) { 2506 renderable = false; 2507 } 2508 } else { 2509 width -= range.x; 2510 left += range.x; 2511 } 2512 2513 if (range.y <= 0) { 2514 if (top > minTop) { 2515 height -= range.y; 2516 top += range.y; 2517 } 2518 } else { 2519 height -= range.y; 2520 top += range.y; 2521 } 2522 } 2523 2524 if (width < 0 && height < 0) { 2525 action = ACTION_SOUTH_EAST; 2526 height = -height; 2527 width = -width; 2528 top -= height; 2529 left -= width; 2530 } else if (width < 0) { 2531 action = ACTION_NORTH_EAST; 2532 width = -width; 2533 left -= width; 2534 } else if (height < 0) { 2535 action = ACTION_SOUTH_WEST; 2536 height = -height; 2537 top -= height; 2538 } 2539 2540 break; 2541 2542 case ACTION_SOUTH_WEST: 2543 if (aspectRatio) { 2544 if (range.x <= 0 && (left <= minLeft || bottom >= maxHeight)) { 2545 renderable = false; 2546 break; 2547 } 2548 2549 check(ACTION_WEST); 2550 width -= range.x; 2551 left += range.x; 2552 height = width / aspectRatio; 2553 } else { 2554 check(ACTION_SOUTH); 2555 check(ACTION_WEST); 2556 2557 if (range.x <= 0) { 2558 if (left > minLeft) { 2559 width -= range.x; 2560 left += range.x; 2561 } else if (range.y >= 0 && bottom >= maxHeight) { 2562 renderable = false; 2563 } 2564 } else { 2565 width -= range.x; 2566 left += range.x; 2567 } 2568 2569 if (range.y >= 0) { 2570 if (bottom < maxHeight) { 2571 height += range.y; 2572 } 2573 } else { 2574 height += range.y; 2575 } 2576 } 2577 2578 if (width < 0 && height < 0) { 2579 action = ACTION_NORTH_EAST; 2580 height = -height; 2581 width = -width; 2582 top -= height; 2583 left -= width; 2584 } else if (width < 0) { 2585 action = ACTION_SOUTH_EAST; 2586 width = -width; 2587 left -= width; 2588 } else if (height < 0) { 2589 action = ACTION_NORTH_WEST; 2590 height = -height; 2591 top -= height; 2592 } 2593 2594 break; 2595 2596 case ACTION_SOUTH_EAST: 2597 if (aspectRatio) { 2598 if (range.x >= 0 && (right >= maxWidth || bottom >= maxHeight)) { 2599 renderable = false; 2600 break; 2601 } 2602 2603 check(ACTION_EAST); 2604 width += range.x; 2605 height = width / aspectRatio; 2606 } else { 2607 check(ACTION_SOUTH); 2608 check(ACTION_EAST); 2609 2610 if (range.x >= 0) { 2611 if (right < maxWidth) { 2612 width += range.x; 2613 } else if (range.y >= 0 && bottom >= maxHeight) { 2614 renderable = false; 2615 } 2616 } else { 2617 width += range.x; 2618 } 2619 2620 if (range.y >= 0) { 2621 if (bottom < maxHeight) { 2622 height += range.y; 2623 } 2624 } else { 2625 height += range.y; 2626 } 2627 } 2628 2629 if (width < 0 && height < 0) { 2630 action = ACTION_NORTH_WEST; 2631 height = -height; 2632 width = -width; 2633 top -= height; 2634 left -= width; 2635 } else if (width < 0) { 2636 action = ACTION_SOUTH_WEST; 2637 width = -width; 2638 left -= width; 2639 } else if (height < 0) { 2640 action = ACTION_NORTH_EAST; 2641 height = -height; 2642 top -= height; 2643 } 2644 2645 break; 2646 // Move canvas 2647 2648 case ACTION_MOVE: 2649 this.move(range.x, range.y); 2650 renderable = false; 2651 break; 2652 // Zoom canvas 2653 2654 case ACTION_ZOOM: 2655 this.zoom(getMaxZoomRatio(pointers), event); 2656 renderable = false; 2657 break; 2658 // Create crop box 2659 2660 case ACTION_CROP: 2661 if (!range.x || !range.y) { 2662 renderable = false; 2663 break; 2664 } 2665 2666 offset = getOffset(this.cropper); 2667 left = pointer.startX - offset.left; 2668 top = pointer.startY - offset.top; 2669 width = cropBoxData.minWidth; 2670 height = cropBoxData.minHeight; 2671 2672 if (range.x > 0) { 2673 action = range.y > 0 ? ACTION_SOUTH_EAST : ACTION_NORTH_EAST; 2674 } else if (range.x < 0) { 2675 left -= width; 2676 action = range.y > 0 ? ACTION_SOUTH_WEST : ACTION_NORTH_WEST; 2677 } 2678 2679 if (range.y < 0) { 2680 top -= height; 2681 } // Show the crop box if is hidden 2682 2683 2684 if (!this.cropped) { 2685 removeClass(this.cropBox, CLASS_HIDDEN); 2686 this.cropped = true; 2687 2688 if (this.limited) { 2689 this.limitCropBox(true, true); 2690 } 2691 } 2692 2693 break; 2694 2695 default: 2696 } 2697 2698 if (renderable) { 2699 cropBoxData.width = width; 2700 cropBoxData.height = height; 2701 cropBoxData.left = left; 2702 cropBoxData.top = top; 2703 this.action = action; 2704 this.renderCropBox(); 2705 } // Override 2706 2707 2708 forEach(pointers, function (p) { 2709 p.startX = p.endX; 2710 p.startY = p.endY; 2711 }); 2712 } 2713 }; 2714 2715 var methods = { 2716 // Show the crop box manually 2717 crop: function crop() { 2718 if (this.ready && !this.cropped && !this.disabled) { 2719 this.cropped = true; 2720 this.limitCropBox(true, true); 2721 2722 if (this.options.modal) { 2723 addClass(this.dragBox, CLASS_MODAL); 2724 } 2725 2726 removeClass(this.cropBox, CLASS_HIDDEN); 2727 this.setCropBoxData(this.initialCropBoxData); 2728 } 2729 2730 return this; 2731 }, 2732 // Reset the image and crop box to their initial states 2733 reset: function reset() { 2734 if (this.ready && !this.disabled) { 2735 this.imageData = assign({}, this.initialImageData); 2736 this.canvasData = assign({}, this.initialCanvasData); 2737 this.cropBoxData = assign({}, this.initialCropBoxData); 2738 this.renderCanvas(); 2739 2740 if (this.cropped) { 2741 this.renderCropBox(); 2742 } 2743 } 2744 2745 return this; 2746 }, 2747 // Clear the crop box 2748 clear: function clear() { 2749 if (this.cropped && !this.disabled) { 2750 assign(this.cropBoxData, { 2751 left: 0, 2752 top: 0, 2753 width: 0, 2754 height: 0 2755 }); 2756 this.cropped = false; 2757 this.renderCropBox(); 2758 this.limitCanvas(true, true); // Render canvas after crop box rendered 2759 2760 this.renderCanvas(); 2761 removeClass(this.dragBox, CLASS_MODAL); 2762 addClass(this.cropBox, CLASS_HIDDEN); 2763 } 2764 2765 return this; 2766 }, 2767 2768 /** 2769 * Replace the image's src and rebuild the cropper 2770 * @param {string} url - The new URL. 2771 * @param {boolean} [hasSameSize] - Indicate if the new image has the same size as the old one. 2772 * @returns {Cropper} this 2773 */ 2774 replace: function replace(url) { 2775 var hasSameSize = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; 2776 2777 if (!this.disabled && url) { 2778 if (this.isImg) { 2779 this.element.src = url; 2780 } 2781 2782 if (hasSameSize) { 2783 this.url = url; 2784 this.image.src = url; 2785 2786 if (this.ready) { 2787 this.viewBoxImage.src = url; 2788 forEach(this.previews, function (element) { 2789 element.getElementsByTagName('img')[0].src = url; 2790 }); 2791 } 2792 } else { 2793 if (this.isImg) { 2794 this.replaced = true; 2795 } 2796 2797 this.options.data = null; 2798 this.uncreate(); 2799 this.load(url); 2800 } 2801 } 2802 2803 return this; 2804 }, 2805 // Enable (unfreeze) the cropper 2806 enable: function enable() { 2807 if (this.ready && this.disabled) { 2808 this.disabled = false; 2809 removeClass(this.cropper, CLASS_DISABLED); 2810 } 2811 2812 return this; 2813 }, 2814 // Disable (freeze) the cropper 2815 disable: function disable() { 2816 if (this.ready && !this.disabled) { 2817 this.disabled = true; 2818 addClass(this.cropper, CLASS_DISABLED); 2819 } 2820 2821 return this; 2822 }, 2823 2824 /** 2825 * Destroy the cropper and remove the instance from the image 2826 * @returns {Cropper} this 2827 */ 2828 destroy: function destroy() { 2829 var element = this.element; 2830 2831 if (!element[NAMESPACE]) { 2832 return this; 2833 } 2834 2835 element[NAMESPACE] = undefined; 2836 2837 if (this.isImg && this.replaced) { 2838 element.src = this.originalUrl; 2839 } 2840 2841 this.uncreate(); 2842 return this; 2843 }, 2844 2845 /** 2846 * Move the canvas with relative offsets 2847 * @param {number} offsetX - The relative offset distance on the x-axis. 2848 * @param {number} [offsetY=offsetX] - The relative offset distance on the y-axis. 2849 * @returns {Cropper} this 2850 */ 2851 move: function move(offsetX) { 2852 var offsetY = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : offsetX; 2853 var _this$canvasData = this.canvasData, 2854 left = _this$canvasData.left, 2855 top = _this$canvasData.top; 2856 return this.moveTo(isUndefined(offsetX) ? offsetX : left + Number(offsetX), isUndefined(offsetY) ? offsetY : top + Number(offsetY)); 2857 }, 2858 2859 /** 2860 * Move the canvas to an absolute point 2861 * @param {number} x - The x-axis coordinate. 2862 * @param {number} [y=x] - The y-axis coordinate. 2863 * @returns {Cropper} this 2864 */ 2865 moveTo: function moveTo(x) { 2866 var y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : x; 2867 var canvasData = this.canvasData; 2868 var changed = false; 2869 x = Number(x); 2870 y = Number(y); 2871 2872 if (this.ready && !this.disabled && this.options.movable) { 2873 if (isNumber(x)) { 2874 canvasData.left = x; 2875 changed = true; 2876 } 2877 2878 if (isNumber(y)) { 2879 canvasData.top = y; 2880 changed = true; 2881 } 2882 2883 if (changed) { 2884 this.renderCanvas(true); 2885 } 2886 } 2887 2888 return this; 2889 }, 2890 2891 /** 2892 * Zoom the canvas with a relative ratio 2893 * @param {number} ratio - The target ratio. 2894 * @param {Event} _originalEvent - The original event if any. 2895 * @returns {Cropper} this 2896 */ 2897 zoom: function zoom(ratio, _originalEvent) { 2898 var canvasData = this.canvasData; 2899 ratio = Number(ratio); 2900 2901 if (ratio < 0) { 2902 ratio = 1 / (1 - ratio); 2903 } else { 2904 ratio = 1 + ratio; 2905 } 2906 2907 return this.zoomTo(canvasData.width * ratio / canvasData.naturalWidth, null, _originalEvent); 2908 }, 2909 2910 /** 2911 * Zoom the canvas to an absolute ratio 2912 * @param {number} ratio - The target ratio. 2913 * @param {Object} pivot - The zoom pivot point coordinate. 2914 * @param {Event} _originalEvent - The original event if any. 2915 * @returns {Cropper} this 2916 */ 2917 zoomTo: function zoomTo(ratio, pivot, _originalEvent) { 2918 var options = this.options, 2919 canvasData = this.canvasData; 2920 var width = canvasData.width, 2921 height = canvasData.height, 2922 naturalWidth = canvasData.naturalWidth, 2923 naturalHeight = canvasData.naturalHeight; 2924 ratio = Number(ratio); 2925 2926 if (ratio >= 0 && this.ready && !this.disabled && options.zoomable) { 2927 var newWidth = naturalWidth * ratio; 2928 var newHeight = naturalHeight * ratio; 2929 2930 if (dispatchEvent(this.element, EVENT_ZOOM, { 2931 ratio: ratio, 2932 oldRatio: width / naturalWidth, 2933 originalEvent: _originalEvent 2934 }) === false) { 2935 return this; 2936 } 2937 2938 if (_originalEvent) { 2939 var pointers = this.pointers; 2940 var offset = getOffset(this.cropper); 2941 var center = pointers && Object.keys(pointers).length ? getPointersCenter(pointers) : { 2942 pageX: _originalEvent.pageX, 2943 pageY: _originalEvent.pageY 2944 }; // Zoom from the triggering point of the event 2945 2946 canvasData.left -= (newWidth - width) * ((center.pageX - offset.left - canvasData.left) / width); 2947 canvasData.top -= (newHeight - height) * ((center.pageY - offset.top - canvasData.top) / height); 2948 } else if (isPlainObject(pivot) && isNumber(pivot.x) && isNumber(pivot.y)) { 2949 canvasData.left -= (newWidth - width) * ((pivot.x - canvasData.left) / width); 2950 canvasData.top -= (newHeight - height) * ((pivot.y - canvasData.top) / height); 2951 } else { 2952 // Zoom from the center of the canvas 2953 canvasData.left -= (newWidth - width) / 2; 2954 canvasData.top -= (newHeight - height) / 2; 2955 } 2956 2957 canvasData.width = newWidth; 2958 canvasData.height = newHeight; 2959 this.renderCanvas(true); 2960 } 2961 2962 return this; 2963 }, 2964 2965 /** 2966 * Rotate the canvas with a relative degree 2967 * @param {number} degree - The rotate degree. 2968 * @returns {Cropper} this 2969 */ 2970 rotate: function rotate(degree) { 2971 return this.rotateTo((this.imageData.rotate || 0) + Number(degree)); 2972 }, 2973 2974 /** 2975 * Rotate the canvas to an absolute degree 2976 * @param {number} degree - The rotate degree. 2977 * @returns {Cropper} this 2978 */ 2979 rotateTo: function rotateTo(degree) { 2980 degree = Number(degree); 2981 2982 if (isNumber(degree) && this.ready && !this.disabled && this.options.rotatable) { 2983 this.imageData.rotate = degree % 360; 2984 this.renderCanvas(true, true); 2985 } 2986 2987 return this; 2988 }, 2989 2990 /** 2991 * Scale the image on the x-axis. 2992 * @param {number} scaleX - The scale ratio on the x-axis. 2993 * @returns {Cropper} this 2994 */ 2995 scaleX: function scaleX(_scaleX) { 2996 var scaleY = this.imageData.scaleY; 2997 return this.scale(_scaleX, isNumber(scaleY) ? scaleY : 1); 2998 }, 2999 3000 /** 3001 * Scale the image on the y-axis. 3002 * @param {number} scaleY - The scale ratio on the y-axis. 3003 * @returns {Cropper} this 3004 */ 3005 scaleY: function scaleY(_scaleY) { 3006 var scaleX = this.imageData.scaleX; 3007 return this.scale(isNumber(scaleX) ? scaleX : 1, _scaleY); 3008 }, 3009 3010 /** 3011 * Scale the image 3012 * @param {number} scaleX - The scale ratio on the x-axis. 3013 * @param {number} [scaleY=scaleX] - The scale ratio on the y-axis. 3014 * @returns {Cropper} this 3015 */ 3016 scale: function scale(scaleX) { 3017 var scaleY = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : scaleX; 3018 var imageData = this.imageData; 3019 var transformed = false; 3020 scaleX = Number(scaleX); 3021 scaleY = Number(scaleY); 3022 3023 if (this.ready && !this.disabled && this.options.scalable) { 3024 if (isNumber(scaleX)) { 3025 imageData.scaleX = scaleX; 3026 transformed = true; 3027 } 3028 3029 if (isNumber(scaleY)) { 3030 imageData.scaleY = scaleY; 3031 transformed = true; 3032 } 3033 3034 if (transformed) { 3035 this.renderCanvas(true, true); 3036 } 3037 } 3038 3039 return this; 3040 }, 3041 3042 /** 3043 * Get the cropped area position and size data (base on the original image) 3044 * @param {boolean} [rounded=false] - Indicate if round the data values or not. 3045 * @returns {Object} The result cropped data. 3046 */ 3047 getData: function getData() { 3048 var rounded = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; 3049 var options = this.options, 3050 imageData = this.imageData, 3051 canvasData = this.canvasData, 3052 cropBoxData = this.cropBoxData; 3053 var data; 3054 3055 if (this.ready && this.cropped) { 3056 data = { 3057 x: cropBoxData.left - canvasData.left, 3058 y: cropBoxData.top - canvasData.top, 3059 width: cropBoxData.width, 3060 height: cropBoxData.height 3061 }; 3062 var ratio = imageData.width / imageData.naturalWidth; 3063 forEach(data, function (n, i) { 3064 data[i] = n / ratio; 3065 }); 3066 3067 if (rounded) { 3068 // In case rounding off leads to extra 1px in right or bottom border 3069 // we should round the top-left corner and the dimension (#343). 3070 var bottom = Math.round(data.y + data.height); 3071 var right = Math.round(data.x + data.width); 3072 data.x = Math.round(data.x); 3073 data.y = Math.round(data.y); 3074 data.width = right - data.x; 3075 data.height = bottom - data.y; 3076 } 3077 } else { 3078 data = { 3079 x: 0, 3080 y: 0, 3081 width: 0, 3082 height: 0 3083 }; 3084 } 3085 3086 if (options.rotatable) { 3087 data.rotate = imageData.rotate || 0; 3088 } 3089 3090 if (options.scalable) { 3091 data.scaleX = imageData.scaleX || 1; 3092 data.scaleY = imageData.scaleY || 1; 3093 } 3094 3095 return data; 3096 }, 3097 3098 /** 3099 * Set the cropped area position and size with new data 3100 * @param {Object} data - The new data. 3101 * @returns {Cropper} this 3102 */ 3103 setData: function setData(data) { 3104 var options = this.options, 3105 imageData = this.imageData, 3106 canvasData = this.canvasData; 3107 var cropBoxData = {}; 3108 3109 if (this.ready && !this.disabled && isPlainObject(data)) { 3110 var transformed = false; 3111 3112 if (options.rotatable) { 3113 if (isNumber(data.rotate) && data.rotate !== imageData.rotate) { 3114 imageData.rotate = data.rotate; 3115 transformed = true; 3116 } 3117 } 3118 3119 if (options.scalable) { 3120 if (isNumber(data.scaleX) && data.scaleX !== imageData.scaleX) { 3121 imageData.scaleX = data.scaleX; 3122 transformed = true; 3123 } 3124 3125 if (isNumber(data.scaleY) && data.scaleY !== imageData.scaleY) { 3126 imageData.scaleY = data.scaleY; 3127 transformed = true; 3128 } 3129 } 3130 3131 if (transformed) { 3132 this.renderCanvas(true, true); 3133 } 3134 3135 var ratio = imageData.width / imageData.naturalWidth; 3136 3137 if (isNumber(data.x)) { 3138 cropBoxData.left = data.x * ratio + canvasData.left; 3139 } 3140 3141 if (isNumber(data.y)) { 3142 cropBoxData.top = data.y * ratio + canvasData.top; 3143 } 3144 3145 if (isNumber(data.width)) { 3146 cropBoxData.width = data.width * ratio; 3147 } 3148 3149 if (isNumber(data.height)) { 3150 cropBoxData.height = data.height * ratio; 3151 } 3152 3153 this.setCropBoxData(cropBoxData); 3154 } 3155 3156 return this; 3157 }, 3158 3159 /** 3160 * Get the container size data. 3161 * @returns {Object} The result container data. 3162 */ 3163 getContainerData: function getContainerData() { 3164 return this.ready ? assign({}, this.containerData) : {}; 3165 }, 3166 3167 /** 3168 * Get the image position and size data. 3169 * @returns {Object} The result image data. 3170 */ 3171 getImageData: function getImageData() { 3172 return this.sized ? assign({}, this.imageData) : {}; 3173 }, 3174 3175 /** 3176 * Get the canvas position and size data. 3177 * @returns {Object} The result canvas data. 3178 */ 3179 getCanvasData: function getCanvasData() { 3180 var canvasData = this.canvasData; 3181 var data = {}; 3182 3183 if (this.ready) { 3184 forEach(['left', 'top', 'width', 'height', 'naturalWidth', 'naturalHeight'], function (n) { 3185 data[n] = canvasData[n]; 3186 }); 3187 } 3188 3189 return data; 3190 }, 3191 3192 /** 3193 * Set the canvas position and size with new data. 3194 * @param {Object} data - The new canvas data. 3195 * @returns {Cropper} this 3196 */ 3197 setCanvasData: function setCanvasData(data) { 3198 var canvasData = this.canvasData; 3199 var aspectRatio = canvasData.aspectRatio; 3200 3201 if (this.ready && !this.disabled && isPlainObject(data)) { 3202 if (isNumber(data.left)) { 3203 canvasData.left = data.left; 3204 } 3205 3206 if (isNumber(data.top)) { 3207 canvasData.top = data.top; 3208 } 3209 3210 if (isNumber(data.width)) { 3211 canvasData.width = data.width; 3212 canvasData.height = data.width / aspectRatio; 3213 } else if (isNumber(data.height)) { 3214 canvasData.height = data.height; 3215 canvasData.width = data.height * aspectRatio; 3216 } 3217 3218 this.renderCanvas(true); 3219 } 3220 3221 return this; 3222 }, 3223 3224 /** 3225 * Get the crop box position and size data. 3226 * @returns {Object} The result crop box data. 3227 */ 3228 getCropBoxData: function getCropBoxData() { 3229 var cropBoxData = this.cropBoxData; 3230 var data; 3231 3232 if (this.ready && this.cropped) { 3233 data = { 3234 left: cropBoxData.left, 3235 top: cropBoxData.top, 3236 width: cropBoxData.width, 3237 height: cropBoxData.height 3238 }; 3239 } 3240 3241 return data || {}; 3242 }, 3243 3244 /** 3245 * Set the crop box position and size with new data. 3246 * @param {Object} data - The new crop box data. 3247 * @returns {Cropper} this 3248 */ 3249 setCropBoxData: function setCropBoxData(data) { 3250 var cropBoxData = this.cropBoxData; 3251 var aspectRatio = this.options.aspectRatio; 3252 var widthChanged; 3253 var heightChanged; 3254 3255 if (this.ready && this.cropped && !this.disabled && isPlainObject(data)) { 3256 if (isNumber(data.left)) { 3257 cropBoxData.left = data.left; 3258 } 3259 3260 if (isNumber(data.top)) { 3261 cropBoxData.top = data.top; 3262 } 3263 3264 if (isNumber(data.width) && data.width !== cropBoxData.width) { 3265 widthChanged = true; 3266 cropBoxData.width = data.width; 3267 } 3268 3269 if (isNumber(data.height) && data.height !== cropBoxData.height) { 3270 heightChanged = true; 3271 cropBoxData.height = data.height; 3272 } 3273 3274 if (aspectRatio) { 3275 if (widthChanged) { 3276 cropBoxData.height = cropBoxData.width / aspectRatio; 3277 } else if (heightChanged) { 3278 cropBoxData.width = cropBoxData.height * aspectRatio; 3279 } 3280 } 3281 3282 this.renderCropBox(); 3283 } 3284 3285 return this; 3286 }, 3287 3288 /** 3289 * Get a canvas drawn the cropped image. 3290 * @param {Object} [options={}] - The config options. 3291 * @returns {HTMLCanvasElement} - The result canvas. 3292 */ 3293 getCroppedCanvas: function getCroppedCanvas() { 3294 var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; 3295 3296 if (!this.ready || !window.HTMLCanvasElement) { 3297 return null; 3298 } 3299 3300 var canvasData = this.canvasData; 3301 var source = getSourceCanvas(this.image, this.imageData, canvasData, options); // Returns the source canvas if it is not cropped. 3302 3303 if (!this.cropped) { 3304 return source; 3305 } 3306 3307 var _this$getData = this.getData(), 3308 initialX = _this$getData.x, 3309 initialY = _this$getData.y, 3310 initialWidth = _this$getData.width, 3311 initialHeight = _this$getData.height; 3312 3313 var ratio = source.width / Math.floor(canvasData.naturalWidth); 3314 3315 if (ratio !== 1) { 3316 initialX *= ratio; 3317 initialY *= ratio; 3318 initialWidth *= ratio; 3319 initialHeight *= ratio; 3320 } 3321 3322 var aspectRatio = initialWidth / initialHeight; 3323 var maxSizes = getAdjustedSizes({ 3324 aspectRatio: aspectRatio, 3325 width: options.maxWidth || Infinity, 3326 height: options.maxHeight || Infinity 3327 }); 3328 var minSizes = getAdjustedSizes({ 3329 aspectRatio: aspectRatio, 3330 width: options.minWidth || 0, 3331 height: options.minHeight || 0 3332 }, 'cover'); 3333 3334 var _getAdjustedSizes = getAdjustedSizes({ 3335 aspectRatio: aspectRatio, 3336 width: options.width || (ratio !== 1 ? source.width : initialWidth), 3337 height: options.height || (ratio !== 1 ? source.height : initialHeight) 3338 }), 3339 width = _getAdjustedSizes.width, 3340 height = _getAdjustedSizes.height; 3341 3342 width = Math.min(maxSizes.width, Math.max(minSizes.width, width)); 3343 height = Math.min(maxSizes.height, Math.max(minSizes.height, height)); 3344 var canvas = document.createElement('canvas'); 3345 var context = canvas.getContext('2d'); 3346 canvas.width = normalizeDecimalNumber(width); 3347 canvas.height = normalizeDecimalNumber(height); 3348 context.fillStyle = options.fillColor || 'transparent'; 3349 context.fillRect(0, 0, width, height); 3350 var _options$imageSmoothi = options.imageSmoothingEnabled, 3351 imageSmoothingEnabled = _options$imageSmoothi === void 0 ? true : _options$imageSmoothi, 3352 imageSmoothingQuality = options.imageSmoothingQuality; 3353 context.imageSmoothingEnabled = imageSmoothingEnabled; 3354 3355 if (imageSmoothingQuality) { 3356 context.imageSmoothingQuality = imageSmoothingQuality; 3357 } // https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D.drawImage 3358 3359 3360 var sourceWidth = source.width; 3361 var sourceHeight = source.height; // Source canvas parameters 3362 3363 var srcX = initialX; 3364 var srcY = initialY; 3365 var srcWidth; 3366 var srcHeight; // Destination canvas parameters 3367 3368 var dstX; 3369 var dstY; 3370 var dstWidth; 3371 var dstHeight; 3372 3373 if (srcX <= -initialWidth || srcX > sourceWidth) { 3374 srcX = 0; 3375 srcWidth = 0; 3376 dstX = 0; 3377 dstWidth = 0; 3378 } else if (srcX <= 0) { 3379 dstX = -srcX; 3380 srcX = 0; 3381 srcWidth = Math.min(sourceWidth, initialWidth + srcX); 3382 dstWidth = srcWidth; 3383 } else if (srcX <= sourceWidth) { 3384 dstX = 0; 3385 srcWidth = Math.min(initialWidth, sourceWidth - srcX); 3386 dstWidth = srcWidth; 3387 } 3388 3389 if (srcWidth <= 0 || srcY <= -initialHeight || srcY > sourceHeight) { 3390 srcY = 0; 3391 srcHeight = 0; 3392 dstY = 0; 3393 dstHeight = 0; 3394 } else if (srcY <= 0) { 3395 dstY = -srcY; 3396 srcY = 0; 3397 srcHeight = Math.min(sourceHeight, initialHeight + srcY); 3398 dstHeight = srcHeight; 3399 } else if (srcY <= sourceHeight) { 3400 dstY = 0; 3401 srcHeight = Math.min(initialHeight, sourceHeight - srcY); 3402 dstHeight = srcHeight; 3403 } 3404 3405 var params = [srcX, srcY, srcWidth, srcHeight]; // Avoid "IndexSizeError" 3406 3407 if (dstWidth > 0 && dstHeight > 0) { 3408 var scale = width / initialWidth; 3409 params.push(dstX * scale, dstY * scale, dstWidth * scale, dstHeight * scale); 3410 } // All the numerical parameters should be integer for `drawImage` 3411 // https://github.com/fengyuanchen/cropper/issues/476 3412 3413 3414 context.drawImage.apply(context, [source].concat(_toConsumableArray(params.map(function (param) { 3415 return Math.floor(normalizeDecimalNumber(param)); 3416 })))); 3417 return canvas; 3418 }, 3419 3420 /** 3421 * Change the aspect ratio of the crop box. 3422 * @param {number} aspectRatio - The new aspect ratio. 3423 * @returns {Cropper} this 3424 */ 3425 setAspectRatio: function setAspectRatio(aspectRatio) { 3426 var options = this.options; 3427 3428 if (!this.disabled && !isUndefined(aspectRatio)) { 3429 // 0 -> NaN 3430 options.aspectRatio = Math.max(0, aspectRatio) || NaN; 3431 3432 if (this.ready) { 3433 this.initCropBox(); 3434 3435 if (this.cropped) { 3436 this.renderCropBox(); 3437 } 3438 } 3439 } 3440 3441 return this; 3442 }, 3443 3444 /** 3445 * Change the drag mode. 3446 * @param {string} mode - The new drag mode. 3447 * @returns {Cropper} this 3448 */ 3449 setDragMode: function setDragMode(mode) { 3450 var options = this.options, 3451 dragBox = this.dragBox, 3452 face = this.face; 3453 3454 if (this.ready && !this.disabled) { 3455 var croppable = mode === DRAG_MODE_CROP; 3456 var movable = options.movable && mode === DRAG_MODE_MOVE; 3457 mode = croppable || movable ? mode : DRAG_MODE_NONE; 3458 options.dragMode = mode; 3459 setData(dragBox, DATA_ACTION, mode); 3460 toggleClass(dragBox, CLASS_CROP, croppable); 3461 toggleClass(dragBox, CLASS_MOVE, movable); 3462 3463 if (!options.cropBoxMovable) { 3464 // Sync drag mode to crop box when it is not movable 3465 setData(face, DATA_ACTION, mode); 3466 toggleClass(face, CLASS_CROP, croppable); 3467 toggleClass(face, CLASS_MOVE, movable); 3468 } 3469 } 3470 3471 return this; 3472 } 3473 }; 3474 3475 var AnotherCropper = WINDOW.Cropper; 3476 3477 var Cropper = 3478 /*#__PURE__*/ 3479 function () { 3480 /** 3481 * Create a new Cropper. 3482 * @param {Element} element - The target element for cropping. 3483 * @param {Object} [options={}] - The configuration options. 3484 */ 3485 function Cropper(element) { 3486 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; 3487 3488 _classCallCheck(this, Cropper); 3489 3490 if (!element || !REGEXP_TAG_NAME.test(element.tagName)) { 3491 throw new Error('The first argument is required and must be an <img> or <canvas> element.'); 3492 } 3493 3494 this.element = element; 3495 this.options = assign({}, DEFAULTS, isPlainObject(options) && options); 3496 this.cropped = false; 3497 this.disabled = false; 3498 this.pointers = {}; 3499 this.ready = false; 3500 this.reloading = false; 3501 this.replaced = false; 3502 this.sized = false; 3503 this.sizing = false; 3504 this.init(); 3505 } 3506 3507 _createClass(Cropper, [{ 3508 key: "init", 3509 value: function init() { 3510 var element = this.element; 3511 var tagName = element.tagName.toLowerCase(); 3512 var url; 3513 3514 if (element[NAMESPACE]) { 3515 return; 3516 } 3517 3518 element[NAMESPACE] = this; 3519 3520 if (tagName === 'img') { 3521 this.isImg = true; // e.g.: "img/picture.jpg" 3522 3523 url = element.getAttribute('src') || ''; 3524 this.originalUrl = url; // Stop when it's a blank image 3525 3526 if (!url) { 3527 return; 3528 } // e.g.: "http://example.com/img/picture.jpg" 3529 3530 3531 url = element.src; 3532 } else if (tagName === 'canvas' && window.HTMLCanvasElement) { 3533 url = element.toDataURL(); 3534 } 3535 3536 this.load(url); 3537 } 3538 }, { 3539 key: "load", 3540 value: function load(url) { 3541 var _this = this; 3542 3543 if (!url) { 3544 return; 3545 } 3546 3547 this.url = url; 3548 this.imageData = {}; 3549 var element = this.element, 3550 options = this.options; 3551 3552 if (!options.rotatable && !options.scalable) { 3553 options.checkOrientation = false; 3554 } // Only IE10+ supports Typed Arrays 3555 3556 3557 if (!options.checkOrientation || !window.ArrayBuffer) { 3558 this.clone(); 3559 return; 3560 } // Detect the mime type of the image directly if it is a Data URL 3561 3562 3563 if (REGEXP_DATA_URL.test(url)) { 3564 // Read ArrayBuffer from Data URL of JPEG images directly for better performance 3565 if (REGEXP_DATA_URL_JPEG.test(url)) { 3566 this.read(dataURLToArrayBuffer(url)); 3567 } else { 3568 // Only a JPEG image may contains Exif Orientation information, 3569 // the rest types of Data URLs are not necessary to check orientation at all. 3570 this.clone(); 3571 } 3572 3573 return; 3574 } // 1. Detect the mime type of the image by a XMLHttpRequest. 3575 // 2. Load the image as ArrayBuffer for reading orientation if its a JPEG image. 3576 3577 3578 var xhr = new XMLHttpRequest(); 3579 var clone = this.clone.bind(this); 3580 this.reloading = true; 3581 this.xhr = xhr; // 1. Cross origin requests are only supported for protocol schemes: 3582 // http, https, data, chrome, chrome-extension. 3583 // 2. Access to XMLHttpRequest from a Data URL will be blocked by CORS policy 3584 // in some browsers as IE11 and Safari. 3585 3586 xhr.onabort = clone; 3587 xhr.onerror = clone; 3588 xhr.ontimeout = clone; 3589 3590 xhr.onprogress = function () { 3591 // Abort the request directly if it not a JPEG image for better performance 3592 if (xhr.getResponseHeader('content-type') !== MIME_TYPE_JPEG) { 3593 xhr.abort(); 3594 } 3595 }; 3596 3597 xhr.onload = function () { 3598 _this.read(xhr.response); 3599 }; 3600 3601 xhr.onloadend = function () { 3602 _this.reloading = false; 3603 _this.xhr = null; 3604 }; // Bust cache when there is a "crossOrigin" property to avoid browser cache error 3605 3606 3607 if (options.checkCrossOrigin && isCrossOriginURL(url) && element.crossOrigin) { 3608 url = addTimestamp(url); 3609 } 3610 3611 xhr.open('GET', url); 3612 xhr.responseType = 'arraybuffer'; 3613 xhr.withCredentials = element.crossOrigin === 'use-credentials'; 3614 xhr.send(); 3615 } 3616 }, { 3617 key: "read", 3618 value: function read(arrayBuffer) { 3619 var options = this.options, 3620 imageData = this.imageData; // Reset the orientation value to its default value 1 3621 // as some iOS browsers will render image with its orientation 3622 3623 var orientation = resetAndGetOrientation(arrayBuffer); 3624 var rotate = 0; 3625 var scaleX = 1; 3626 var scaleY = 1; 3627 3628 if (orientation > 1) { 3629 // Generate a new URL which has the default orientation value 3630 this.url = arrayBufferToDataURL(arrayBuffer, MIME_TYPE_JPEG); 3631 3632 var _parseOrientation = parseOrientation(orientation); 3633 3634 rotate = _parseOrientation.rotate; 3635 scaleX = _parseOrientation.scaleX; 3636 scaleY = _parseOrientation.scaleY; 3637 } 3638 3639 if (options.rotatable) { 3640 imageData.rotate = rotate; 3641 } 3642 3643 if (options.scalable) { 3644 imageData.scaleX = scaleX; 3645 imageData.scaleY = scaleY; 3646 } 3647 3648 this.clone(); 3649 } 3650 }, { 3651 key: "clone", 3652 value: function clone() { 3653 var element = this.element, 3654 url = this.url; 3655 var crossOrigin = element.crossOrigin; 3656 var crossOriginUrl = url; 3657 3658 if (this.options.checkCrossOrigin && isCrossOriginURL(url)) { 3659 if (!crossOrigin) { 3660 crossOrigin = 'anonymous'; 3661 } // Bust cache when there is not a "crossOrigin" property (#519) 3662 3663 3664 crossOriginUrl = addTimestamp(url); 3665 } 3666 3667 this.crossOrigin = crossOrigin; 3668 this.crossOriginUrl = crossOriginUrl; 3669 var image = document.createElement('img'); 3670 3671 if (crossOrigin) { 3672 image.crossOrigin = crossOrigin; 3673 } 3674 3675 image.src = crossOriginUrl || url; 3676 image.alt = element.alt || 'The image to crop'; 3677 this.image = image; 3678 image.onload = this.start.bind(this); 3679 image.onerror = this.stop.bind(this); 3680 addClass(image, CLASS_HIDE); 3681 element.parentNode.insertBefore(image, element.nextSibling); 3682 } 3683 }, { 3684 key: "start", 3685 value: function start() { 3686 var _this2 = this; 3687 3688 var image = this.image; 3689 image.onload = null; 3690 image.onerror = null; 3691 this.sizing = true; // Match all browsers that use WebKit as the layout engine in iOS devices, 3692 // such as Safari for iOS, Chrome for iOS, and in-app browsers. 3693 3694 var isIOSWebKit = WINDOW.navigator && /(?:iPad|iPhone|iPod).*?AppleWebKit/i.test(WINDOW.navigator.userAgent); 3695 3696 var done = function done(naturalWidth, naturalHeight) { 3697 assign(_this2.imageData, { 3698 naturalWidth: naturalWidth, 3699 naturalHeight: naturalHeight, 3700 aspectRatio: naturalWidth / naturalHeight 3701 }); 3702 _this2.sizing = false; 3703 _this2.sized = true; 3704 3705 _this2.build(); 3706 }; // Most modern browsers (excepts iOS WebKit) 3707 3708 3709 if (image.naturalWidth && !isIOSWebKit) { 3710 done(image.naturalWidth, image.naturalHeight); 3711 return; 3712 } 3713 3714 var sizingImage = document.createElement('img'); 3715 var body = document.body || document.documentElement; 3716 this.sizingImage = sizingImage; 3717 3718 sizingImage.onload = function () { 3719 done(sizingImage.width, sizingImage.height); 3720 3721 if (!isIOSWebKit) { 3722 body.removeChild(sizingImage); 3723 } 3724 }; 3725 3726 sizingImage.src = image.src; // iOS WebKit will convert the image automatically 3727 // with its orientation once append it into DOM (#279) 3728 3729 if (!isIOSWebKit) { 3730 sizingImage.style.cssText = 'left:0;' + 'max-height:none!important;' + 'max-width:none!important;' + 'min-height:0!important;' + 'min-width:0!important;' + 'opacity:0;' + 'position:absolute;' + 'top:0;' + 'z-index:-1;'; 3731 body.appendChild(sizingImage); 3732 } 3733 } 3734 }, { 3735 key: "stop", 3736 value: function stop() { 3737 var image = this.image; 3738 image.onload = null; 3739 image.onerror = null; 3740 image.parentNode.removeChild(image); 3741 this.image = null; 3742 } 3743 }, { 3744 key: "build", 3745 value: function build() { 3746 if (!this.sized || this.ready) { 3747 return; 3748 } 3749 3750 var element = this.element, 3751 options = this.options, 3752 image = this.image; // Create cropper elements 3753 3754 var container = element.parentNode; 3755 var template = document.createElement('div'); 3756 template.innerHTML = TEMPLATE; 3757 var cropper = template.querySelector(".".concat(NAMESPACE, "-container")); 3758 var canvas = cropper.querySelector(".".concat(NAMESPACE, "-canvas")); 3759 var dragBox = cropper.querySelector(".".concat(NAMESPACE, "-drag-box")); 3760 var cropBox = cropper.querySelector(".".concat(NAMESPACE, "-crop-box")); 3761 var face = cropBox.querySelector(".".concat(NAMESPACE, "-face")); 3762 this.container = container; 3763 this.cropper = cropper; 3764 this.canvas = canvas; 3765 this.dragBox = dragBox; 3766 this.cropBox = cropBox; 3767 this.viewBox = cropper.querySelector(".".concat(NAMESPACE, "-view-box")); 3768 this.face = face; 3769 canvas.appendChild(image); // Hide the original image 3770 3771 addClass(element, CLASS_HIDDEN); // Inserts the cropper after to the current image 3772 3773 container.insertBefore(cropper, element.nextSibling); // Show the image if is hidden 3774 3775 if (!this.isImg) { 3776 removeClass(image, CLASS_HIDE); 3777 } 3778 3779 this.initPreview(); 3780 this.bind(); 3781 options.initialAspectRatio = Math.max(0, options.initialAspectRatio) || NaN; 3782 options.aspectRatio = Math.max(0, options.aspectRatio) || NaN; 3783 options.viewMode = Math.max(0, Math.min(3, Math.round(options.viewMode))) || 0; 3784 addClass(cropBox, CLASS_HIDDEN); 3785 3786 if (!options.guides) { 3787 addClass(cropBox.getElementsByClassName("".concat(NAMESPACE, "-dashed")), CLASS_HIDDEN); 3788 } 3789 3790 if (!options.center) { 3791 addClass(cropBox.getElementsByClassName("".concat(NAMESPACE, "-center")), CLASS_HIDDEN); 3792 } 3793 3794 if (options.background) { 3795 addClass(cropper, "".concat(NAMESPACE, "-bg")); 3796 } 3797 3798 if (!options.highlight) { 3799 addClass(face, CLASS_INVISIBLE); 3800 } 3801 3802 if (options.cropBoxMovable) { 3803 addClass(face, CLASS_MOVE); 3804 setData(face, DATA_ACTION, ACTION_ALL); 3805 } 3806 3807 if (!options.cropBoxResizable) { 3808 addClass(cropBox.getElementsByClassName("".concat(NAMESPACE, "-line")), CLASS_HIDDEN); 3809 addClass(cropBox.getElementsByClassName("".concat(NAMESPACE, "-point")), CLASS_HIDDEN); 3810 } 3811 3812 this.render(); 3813 this.ready = true; 3814 this.setDragMode(options.dragMode); 3815 3816 if (options.autoCrop) { 3817 this.crop(); 3818 } 3819 3820 this.setData(options.data); 3821 3822 if (isFunction(options.ready)) { 3823 addListener(element, EVENT_READY, options.ready, { 3824 once: true 3825 }); 3826 } 3827 3828 dispatchEvent(element, EVENT_READY); 3829 } 3830 }, { 3831 key: "unbuild", 3832 value: function unbuild() { 3833 if (!this.ready) { 3834 return; 3835 } 3836 3837 this.ready = false; 3838 this.unbind(); 3839 this.resetPreview(); 3840 this.cropper.parentNode.removeChild(this.cropper); 3841 removeClass(this.element, CLASS_HIDDEN); 3842 } 3843 }, { 3844 key: "uncreate", 3845 value: function uncreate() { 3846 if (this.ready) { 3847 this.unbuild(); 3848 this.ready = false; 3849 this.cropped = false; 3850 } else if (this.sizing) { 3851 this.sizingImage.onload = null; 3852 this.sizing = false; 3853 this.sized = false; 3854 } else if (this.reloading) { 3855 this.xhr.onabort = null; 3856 this.xhr.abort(); 3857 } else if (this.image) { 3858 this.stop(); 3859 } 3860 } 3861 /** 3862 * Get the no conflict cropper class. 3863 * @returns {Cropper} The cropper class. 3864 */ 3865 3866 }], [{ 3867 key: "noConflict", 3868 value: function noConflict() { 3869 window.Cropper = AnotherCropper; 3870 return Cropper; 3871 } 3872 /** 3873 * Change the default options. 3874 * @param {Object} options - The new default options. 3875 */ 3876 3877 }, { 3878 key: "setDefaults", 3879 value: function setDefaults(options) { 3880 assign(DEFAULTS, isPlainObject(options) && options); 3881 } 3882 }]); 3883 3884 return Cropper; 3885 }(); 3886 3887 assign(Cropper.prototype, render, preview, events, handlers, change, methods); 3888 3889 return Cropper; 3890 3891 })); 3892 3893 3894 /***/ }), 3895 3896 /***/ "./node_modules/prop-types/checkPropTypes.js": 3897 /*!***************************************************!*\ 3898 !*** ./node_modules/prop-types/checkPropTypes.js ***! 3899 \***************************************************/ 3900 /*! no static exports found */ 3901 /***/ (function(module, exports, __webpack_require__) { 3902 3903 "use strict"; 3904 /** 3905 * Copyright (c) 2013-present, Facebook, Inc. 3906 * 3907 * This source code is licensed under the MIT license found in the 3908 * LICENSE file in the root directory of this source tree. 3909 */ 3910 3911 3912 3913 var printWarning = function() {}; 3914 3915 if (true) { 3916 var ReactPropTypesSecret = __webpack_require__(/*! ./lib/ReactPropTypesSecret */ "./node_modules/prop-types/lib/ReactPropTypesSecret.js"); 3917 var loggedTypeFailures = {}; 3918 var has = Function.call.bind(Object.prototype.hasOwnProperty); 3919 3920 printWarning = function(text) { 3921 var message = 'Warning: ' + text; 3922 if (typeof console !== 'undefined') { 3923 console.error(message); 3924 } 3925 try { 3926 // --- Welcome to debugging React --- 3927 // This error was thrown as a convenience so that you can use this stack 3928 // to find the callsite that caused this warning to fire. 3929 throw new Error(message); 3930 } catch (x) {} 3931 }; 3932 } 3933 3934 /** 3935 * Assert that the values match with the type specs. 3936 * Error messages are memorized and will only be shown once. 3937 * 3938 * @param {object} typeSpecs Map of name to a ReactPropType 3939 * @param {object} values Runtime values that need to be type-checked 3940 * @param {string} location e.g. "prop", "context", "child context" 3941 * @param {string} componentName Name of the component for error messages. 3942 * @param {?Function} getStack Returns the component stack. 3943 * @private 3944 */ 3945 function checkPropTypes(typeSpecs, values, location, componentName, getStack) { 3946 if (true) { 3947 for (var typeSpecName in typeSpecs) { 3948 if (has(typeSpecs, typeSpecName)) { 3949 var error; 3950 // Prop type validation may throw. In case they do, we don't want to 3951 // fail the render phase where it didn't fail before. So we log it. 3952 // After these have been cleaned up, we'll let them throw. 3953 try { 3954 // This is intentionally an invariant that gets caught. It's the same 3955 // behavior as without this statement except with a better message. 3956 if (typeof typeSpecs[typeSpecName] !== 'function') { 3957 var err = Error( 3958 (componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 3959 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' 3960 ); 3961 err.name = 'Invariant Violation'; 3962 throw err; 3963 } 3964 error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret); 3965 } catch (ex) { 3966 error = ex; 3967 } 3968 if (error && !(error instanceof Error)) { 3969 printWarning( 3970 (componentName || 'React class') + ': type specification of ' + 3971 location + ' `' + typeSpecName + '` is invalid; the type checker ' + 3972 'function must return `null` or an `Error` but returned a ' + typeof error + '. ' + 3973 'You may have forgotten to pass an argument to the type checker ' + 3974 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 3975 'shape all require an argument).' 3976 ); 3977 } 3978 if (error instanceof Error && !(error.message in loggedTypeFailures)) { 3979 // Only monitor this failure once because there tends to be a lot of the 3980 // same error. 3981 loggedTypeFailures[error.message] = true; 3982 3983 var stack = getStack ? getStack() : ''; 3984 3985 printWarning( 3986 'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '') 3987 ); 3988 } 3989 } 3990 } 3991 } 3992 } 3993 3994 /** 3995 * Resets warning cache when testing. 3996 * 3997 * @private 3998 */ 3999 checkPropTypes.resetWarningCache = function() { 4000 if (true) { 4001 loggedTypeFailures = {}; 4002 } 4003 } 4004 4005 module.exports = checkPropTypes; 4006 4007 4008 /***/ }), 4009 4010 /***/ "./node_modules/prop-types/factoryWithTypeCheckers.js": 4011 /*!************************************************************!*\ 4012 !*** ./node_modules/prop-types/factoryWithTypeCheckers.js ***! 4013 \************************************************************/ 4014 /*! no static exports found */ 4015 /***/ (function(module, exports, __webpack_require__) { 4016 4017 "use strict"; 4018 /** 4019 * Copyright (c) 2013-present, Facebook, Inc. 4020 * 4021 * This source code is licensed under the MIT license found in the 4022 * LICENSE file in the root directory of this source tree. 4023 */ 4024 4025 4026 4027 var ReactIs = __webpack_require__(/*! react-is */ "./node_modules/react-is/index.js"); 4028 var assign = __webpack_require__(/*! object-assign */ "./node_modules/prop-types/node_modules/object-assign/index.js"); 4029 4030 var ReactPropTypesSecret = __webpack_require__(/*! ./lib/ReactPropTypesSecret */ "./node_modules/prop-types/lib/ReactPropTypesSecret.js"); 4031 var checkPropTypes = __webpack_require__(/*! ./checkPropTypes */ "./node_modules/prop-types/checkPropTypes.js"); 4032 4033 var has = Function.call.bind(Object.prototype.hasOwnProperty); 4034 var printWarning = function() {}; 4035 4036 if (true) { 4037 printWarning = function(text) { 4038 var message = 'Warning: ' + text; 4039 if (typeof console !== 'undefined') { 4040 console.error(message); 4041 } 4042 try { 4043 // --- Welcome to debugging React --- 4044 // This error was thrown as a convenience so that you can use this stack 4045 // to find the callsite that caused this warning to fire. 4046 throw new Error(message); 4047 } catch (x) {} 4048 }; 4049 } 4050 4051 function emptyFunctionThatReturnsNull() { 4052 return null; 4053 } 4054 4055 module.exports = function(isValidElement, throwOnDirectAccess) { 4056 /* global Symbol */ 4057 var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator; 4058 var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec. 4059 4060 /** 4061 * Returns the iterator method function contained on the iterable object. 4062 * 4063 * Be sure to invoke the function with the iterable as context: 4064 * 4065 * var iteratorFn = getIteratorFn(myIterable); 4066 * if (iteratorFn) { 4067 * var iterator = iteratorFn.call(myIterable); 4068 * ... 4069 * } 4070 * 4071 * @param {?object} maybeIterable 4072 * @return {?function} 4073 */ 4074 function getIteratorFn(maybeIterable) { 4075 var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]); 4076 if (typeof iteratorFn === 'function') { 4077 return iteratorFn; 4078 } 4079 } 4080 4081 /** 4082 * Collection of methods that allow declaration and validation of props that are 4083 * supplied to React components. Example usage: 4084 * 4085 * var Props = require('ReactPropTypes'); 4086 * var MyArticle = React.createClass({ 4087 * propTypes: { 4088 * // An optional string prop named "description". 4089 * description: Props.string, 4090 * 4091 * // A required enum prop named "category". 4092 * category: Props.oneOf(['News','Photos']).isRequired, 4093 * 4094 * // A prop named "dialog" that requires an instance of Dialog. 4095 * dialog: Props.instanceOf(Dialog).isRequired 4096 * }, 4097 * render: function() { ... } 4098 * }); 4099 * 4100 * A more formal specification of how these methods are used: 4101 * 4102 * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...) 4103 * decl := ReactPropTypes.{type}(.isRequired)? 4104 * 4105 * Each and every declaration produces a function with the same signature. This 4106 * allows the creation of custom validation functions. For example: 4107 * 4108 * var MyLink = React.createClass({ 4109 * propTypes: { 4110 * // An optional string or URI prop named "href". 4111 * href: function(props, propName, componentName) { 4112 * var propValue = props[propName]; 4113 * if (propValue != null && typeof propValue !== 'string' && 4114 * !(propValue instanceof URI)) { 4115 * return new Error( 4116 * 'Expected a string or an URI for ' + propName + ' in ' + 4117 * componentName 4118 * ); 4119 * } 4120 * } 4121 * }, 4122 * render: function() {...} 4123 * }); 4124 * 4125 * @internal 4126 */ 4127 4128 var ANONYMOUS = '<<anonymous>>'; 4129 4130 // Important! 4131 // Keep this list in sync with production version in `./factoryWithThrowingShims.js`. 4132 var ReactPropTypes = { 4133 array: createPrimitiveTypeChecker('array'), 4134 bool: createPrimitiveTypeChecker('boolean'), 4135 func: createPrimitiveTypeChecker('function'), 4136 number: createPrimitiveTypeChecker('number'), 4137 object: createPrimitiveTypeChecker('object'), 4138 string: createPrimitiveTypeChecker('string'), 4139 symbol: createPrimitiveTypeChecker('symbol'), 4140 4141 any: createAnyTypeChecker(), 4142 arrayOf: createArrayOfTypeChecker, 4143 element: createElementTypeChecker(), 4144 elementType: createElementTypeTypeChecker(), 4145 instanceOf: createInstanceTypeChecker, 4146 node: createNodeChecker(), 4147 objectOf: createObjectOfTypeChecker, 4148 oneOf: createEnumTypeChecker, 4149 oneOfType: createUnionTypeChecker, 4150 shape: createShapeTypeChecker, 4151 exact: createStrictShapeTypeChecker, 4152 }; 4153 4154 /** 4155 * inlined Object.is polyfill to avoid requiring consumers ship their own 4156 * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is 4157 */ 4158 /*eslint-disable no-self-compare*/ 4159 function is(x, y) { 4160 // SameValue algorithm 4161 if (x === y) { 4162 // Steps 1-5, 7-10 4163 // Steps 6.b-6.e: +0 != -0 4164 return x !== 0 || 1 / x === 1 / y; 4165 } else { 4166 // Step 6.a: NaN == NaN 4167 return x !== x && y !== y; 4168 } 4169 } 4170 /*eslint-enable no-self-compare*/ 4171 4172 /** 4173 * We use an Error-like object for backward compatibility as people may call 4174 * PropTypes directly and inspect their output. However, we don't use real 4175 * Errors anymore. We don't inspect their stack anyway, and creating them 4176 * is prohibitively expensive if they are created too often, such as what 4177 * happens in oneOfType() for any type before the one that matched. 4178 */ 4179 function PropTypeError(message) { 4180 this.message = message; 4181 this.stack = ''; 4182 } 4183 // Make `instanceof Error` still work for returned errors. 4184 PropTypeError.prototype = Error.prototype; 4185 4186 function createChainableTypeChecker(validate) { 4187 if (true) { 4188 var manualPropTypeCallCache = {}; 4189 var manualPropTypeWarningCount = 0; 4190 } 4191 function checkType(isRequired, props, propName, componentName, location, propFullName, secret) { 4192 componentName = componentName || ANONYMOUS; 4193 propFullName = propFullName || propName; 4194 4195 if (secret !== ReactPropTypesSecret) { 4196 if (throwOnDirectAccess) { 4197 // New behavior only for users of `prop-types` package 4198 var err = new Error( 4199 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + 4200 'Use `PropTypes.checkPropTypes()` to call them. ' + 4201 'Read more at http://fb.me/use-check-prop-types' 4202 ); 4203 err.name = 'Invariant Violation'; 4204 throw err; 4205 } else if ( true && typeof console !== 'undefined') { 4206 // Old behavior for people using React.PropTypes 4207 var cacheKey = componentName + ':' + propName; 4208 if ( 4209 !manualPropTypeCallCache[cacheKey] && 4210 // Avoid spamming the console because they are often not actionable except for lib authors 4211 manualPropTypeWarningCount < 3 4212 ) { 4213 printWarning( 4214 'You are manually calling a React.PropTypes validation ' + 4215 'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' + 4216 'and will throw in the standalone `prop-types` package. ' + 4217 'You may be seeing this warning due to a third-party PropTypes ' + 4218 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.' 4219 ); 4220 manualPropTypeCallCache[cacheKey] = true; 4221 manualPropTypeWarningCount++; 4222 } 4223 } 4224 } 4225 if (props[propName] == null) { 4226 if (isRequired) { 4227 if (props[propName] === null) { 4228 return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.')); 4229 } 4230 return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.')); 4231 } 4232 return null; 4233 } else { 4234 return validate(props, propName, componentName, location, propFullName); 4235 } 4236 } 4237 4238 var chainedCheckType = checkType.bind(null, false); 4239 chainedCheckType.isRequired = checkType.bind(null, true); 4240 4241 return chainedCheckType; 4242 } 4243 4244 function createPrimitiveTypeChecker(expectedType) { 4245 function validate(props, propName, componentName, location, propFullName, secret) { 4246 var propValue = props[propName]; 4247 var propType = getPropType(propValue); 4248 if (propType !== expectedType) { 4249 // `propValue` being instance of, say, date/regexp, pass the 'object' 4250 // check, but we can offer a more precise error message here rather than 4251 // 'of type `object`'. 4252 var preciseType = getPreciseType(propValue); 4253 4254 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.')); 4255 } 4256 return null; 4257 } 4258 return createChainableTypeChecker(validate); 4259 } 4260 4261 function createAnyTypeChecker() { 4262 return createChainableTypeChecker(emptyFunctionThatReturnsNull); 4263 } 4264 4265 function createArrayOfTypeChecker(typeChecker) { 4266 function validate(props, propName, componentName, location, propFullName) { 4267 if (typeof typeChecker !== 'function') { 4268 return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.'); 4269 } 4270 var propValue = props[propName]; 4271 if (!Array.isArray(propValue)) { 4272 var propType = getPropType(propValue); 4273 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.')); 4274 } 4275 for (var i = 0; i < propValue.length; i++) { 4276 var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret); 4277 if (error instanceof Error) { 4278 return error; 4279 } 4280 } 4281 return null; 4282 } 4283 return createChainableTypeChecker(validate); 4284 } 4285 4286 function createElementTypeChecker() { 4287 function validate(props, propName, componentName, location, propFullName) { 4288 var propValue = props[propName]; 4289 if (!isValidElement(propValue)) { 4290 var propType = getPropType(propValue); 4291 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.')); 4292 } 4293 return null; 4294 } 4295 return createChainableTypeChecker(validate); 4296 } 4297 4298 function createElementTypeTypeChecker() { 4299 function validate(props, propName, componentName, location, propFullName) { 4300 var propValue = props[propName]; 4301 if (!ReactIs.isValidElementType(propValue)) { 4302 var propType = getPropType(propValue); 4303 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement type.')); 4304 } 4305 return null; 4306 } 4307 return createChainableTypeChecker(validate); 4308 } 4309 4310 function createInstanceTypeChecker(expectedClass) { 4311 function validate(props, propName, componentName, location, propFullName) { 4312 if (!(props[propName] instanceof expectedClass)) { 4313 var expectedClassName = expectedClass.name || ANONYMOUS; 4314 var actualClassName = getClassName(props[propName]); 4315 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.')); 4316 } 4317 return null; 4318 } 4319 return createChainableTypeChecker(validate); 4320 } 4321 4322 function createEnumTypeChecker(expectedValues) { 4323 if (!Array.isArray(expectedValues)) { 4324 if (true) { 4325 if (arguments.length > 1) { 4326 printWarning( 4327 'Invalid arguments supplied to oneOf, expected an array, got ' + arguments.length + ' arguments. ' + 4328 'A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).' 4329 ); 4330 } else { 4331 printWarning('Invalid argument supplied to oneOf, expected an array.'); 4332 } 4333 } 4334 return emptyFunctionThatReturnsNull; 4335 } 4336 4337 function validate(props, propName, componentName, location, propFullName) { 4338 var propValue = props[propName]; 4339 for (var i = 0; i < expectedValues.length; i++) { 4340 if (is(propValue, expectedValues[i])) { 4341 return null; 4342 } 4343 } 4344 4345 var valuesString = JSON.stringify(expectedValues, function replacer(key, value) { 4346 var type = getPreciseType(value); 4347 if (type === 'symbol') { 4348 return String(value); 4349 } 4350 return value; 4351 }); 4352 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + String(propValue) + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.')); 4353 } 4354 return createChainableTypeChecker(validate); 4355 } 4356 4357 function createObjectOfTypeChecker(typeChecker) { 4358 function validate(props, propName, componentName, location, propFullName) { 4359 if (typeof typeChecker !== 'function') { 4360 return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.'); 4361 } 4362 var propValue = props[propName]; 4363 var propType = getPropType(propValue); 4364 if (propType !== 'object') { 4365 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.')); 4366 } 4367 for (var key in propValue) { 4368 if (has(propValue, key)) { 4369 var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); 4370 if (error instanceof Error) { 4371 return error; 4372 } 4373 } 4374 } 4375 return null; 4376 } 4377 return createChainableTypeChecker(validate); 4378 } 4379 4380 function createUnionTypeChecker(arrayOfTypeCheckers) { 4381 if (!Array.isArray(arrayOfTypeCheckers)) { 4382 true ? printWarning('Invalid argument supplied to oneOfType, expected an instance of array.') : undefined; 4383 return emptyFunctionThatReturnsNull; 4384 } 4385 4386 for (var i = 0; i < arrayOfTypeCheckers.length; i++) { 4387 var checker = arrayOfTypeCheckers[i]; 4388 if (typeof checker !== 'function') { 4389 printWarning( 4390 'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' + 4391 'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.' 4392 ); 4393 return emptyFunctionThatReturnsNull; 4394 } 4395 } 4396 4397 function validate(props, propName, componentName, location, propFullName) { 4398 for (var i = 0; i < arrayOfTypeCheckers.length; i++) { 4399 var checker = arrayOfTypeCheckers[i]; 4400 if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret) == null) { 4401 return null; 4402 } 4403 } 4404 4405 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.')); 4406 } 4407 return createChainableTypeChecker(validate); 4408 } 4409 4410 function createNodeChecker() { 4411 function validate(props, propName, componentName, location, propFullName) { 4412 if (!isNode(props[propName])) { 4413 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.')); 4414 } 4415 return null; 4416 } 4417 return createChainableTypeChecker(validate); 4418 } 4419 4420 function createShapeTypeChecker(shapeTypes) { 4421 function validate(props, propName, componentName, location, propFullName) { 4422 var propValue = props[propName]; 4423 var propType = getPropType(propValue); 4424 if (propType !== 'object') { 4425 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.')); 4426 } 4427 for (var key in shapeTypes) { 4428 var checker = shapeTypes[key]; 4429 if (!checker) { 4430 continue; 4431 } 4432 var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); 4433 if (error) { 4434 return error; 4435 } 4436 } 4437 return null; 4438 } 4439 return createChainableTypeChecker(validate); 4440 } 4441 4442 function createStrictShapeTypeChecker(shapeTypes) { 4443 function validate(props, propName, componentName, location, propFullName) { 4444 var propValue = props[propName]; 4445 var propType = getPropType(propValue); 4446 if (propType !== 'object') { 4447 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.')); 4448 } 4449 // We need to check all keys in case some are required but missing from 4450 // props. 4451 var allKeys = assign({}, props[propName], shapeTypes); 4452 for (var key in allKeys) { 4453 var checker = shapeTypes[key]; 4454 if (!checker) { 4455 return new PropTypeError( 4456 'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' + 4457 '\nBad object: ' + JSON.stringify(props[propName], null, ' ') + 4458 '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ') 4459 ); 4460 } 4461 var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); 4462 if (error) { 4463 return error; 4464 } 4465 } 4466 return null; 4467 } 4468 4469 return createChainableTypeChecker(validate); 4470 } 4471 4472 function isNode(propValue) { 4473 switch (typeof propValue) { 4474 case 'number': 4475 case 'string': 4476 case 'undefined': 4477 return true; 4478 case 'boolean': 4479 return !propValue; 4480 case 'object': 4481 if (Array.isArray(propValue)) { 4482 return propValue.every(isNode); 4483 } 4484 if (propValue === null || isValidElement(propValue)) { 4485 return true; 4486 } 4487 4488 var iteratorFn = getIteratorFn(propValue); 4489 if (iteratorFn) { 4490 var iterator = iteratorFn.call(propValue); 4491 var step; 4492 if (iteratorFn !== propValue.entries) { 4493 while (!(step = iterator.next()).done) { 4494 if (!isNode(step.value)) { 4495 return false; 4496 } 4497 } 4498 } else { 4499 // Iterator will provide entry [k,v] tuples rather than values. 4500 while (!(step = iterator.next()).done) { 4501 var entry = step.value; 4502 if (entry) { 4503 if (!isNode(entry[1])) { 4504 return false; 4505 } 4506 } 4507 } 4508 } 4509 } else { 4510 return false; 4511 } 4512 4513 return true; 4514 default: 4515 return false; 4516 } 4517 } 4518 4519 function isSymbol(propType, propValue) { 4520 // Native Symbol. 4521 if (propType === 'symbol') { 4522 return true; 4523 } 4524 4525 // falsy value can't be a Symbol 4526 if (!propValue) { 4527 return false; 4528 } 4529 4530 // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol' 4531 if (propValue['@@toStringTag'] === 'Symbol') { 4532 return true; 4533 } 4534 4535 // Fallback for non-spec compliant Symbols which are polyfilled. 4536 if (typeof Symbol === 'function' && propValue instanceof Symbol) { 4537 return true; 4538 } 4539 4540 return false; 4541 } 4542 4543 // Equivalent of `typeof` but with special handling for array and regexp. 4544 function getPropType(propValue) { 4545 var propType = typeof propValue; 4546 if (Array.isArray(propValue)) { 4547 return 'array'; 4548 } 4549 if (propValue instanceof RegExp) { 4550 // Old webkits (at least until Android 4.0) return 'function' rather than 4551 // 'object' for typeof a RegExp. We'll normalize this here so that /bla/ 4552 // passes PropTypes.object. 4553 return 'object'; 4554 } 4555 if (isSymbol(propType, propValue)) { 4556 return 'symbol'; 4557 } 4558 return propType; 4559 } 4560 4561 // This handles more types than `getPropType`. Only used for error messages. 4562 // See `createPrimitiveTypeChecker`. 4563 function getPreciseType(propValue) { 4564 if (typeof propValue === 'undefined' || propValue === null) { 4565 return '' + propValue; 4566 } 4567 var propType = getPropType(propValue); 4568 if (propType === 'object') { 4569 if (propValue instanceof Date) { 4570 return 'date'; 4571 } else if (propValue instanceof RegExp) { 4572 return 'regexp'; 4573 } 4574 } 4575 return propType; 4576 } 4577 4578 // Returns a string that is postfixed to a warning about an invalid type. 4579 // For example, "undefined" or "of type array" 4580 function getPostfixForTypeWarning(value) { 4581 var type = getPreciseType(value); 4582 switch (type) { 4583 case 'array': 4584 case 'object': 4585 return 'an ' + type; 4586 case 'boolean': 4587 case 'date': 4588 case 'regexp': 4589 return 'a ' + type; 4590 default: 4591 return type; 4592 } 4593 } 4594 4595 // Returns class name of the object, if any. 4596 function getClassName(propValue) { 4597 if (!propValue.constructor || !propValue.constructor.name) { 4598 return ANONYMOUS; 4599 } 4600 return propValue.constructor.name; 4601 } 4602 4603 ReactPropTypes.checkPropTypes = checkPropTypes; 4604 ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache; 4605 ReactPropTypes.PropTypes = ReactPropTypes; 4606 4607 return ReactPropTypes; 4608 }; 4609 4610 4611 /***/ }), 4612 4613 /***/ "./node_modules/prop-types/index.js": 4614 /*!******************************************!*\ 4615 !*** ./node_modules/prop-types/index.js ***! 4616 \******************************************/ 4617 /*! no static exports found */ 4618 /***/ (function(module, exports, __webpack_require__) { 4619 4620 /** 4621 * Copyright (c) 2013-present, Facebook, Inc. 4622 * 4623 * This source code is licensed under the MIT license found in the 4624 * LICENSE file in the root directory of this source tree. 4625 */ 4626 4627 if (true) { 4628 var ReactIs = __webpack_require__(/*! react-is */ "./node_modules/react-is/index.js"); 4629 4630 // By explicitly using `prop-types` you are opting into new development behavior. 4631 // http://fb.me/prop-types-in-prod 4632 var throwOnDirectAccess = true; 4633 module.exports = __webpack_require__(/*! ./factoryWithTypeCheckers */ "./node_modules/prop-types/factoryWithTypeCheckers.js")(ReactIs.isElement, throwOnDirectAccess); 4634 } else {} 4635 4636 4637 /***/ }), 4638 4639 /***/ "./node_modules/prop-types/lib/ReactPropTypesSecret.js": 4640 /*!*************************************************************!*\ 4641 !*** ./node_modules/prop-types/lib/ReactPropTypesSecret.js ***! 4642 \*************************************************************/ 4643 /*! no static exports found */ 4644 /***/ (function(module, exports, __webpack_require__) { 4645 4646 "use strict"; 4647 /** 4648 * Copyright (c) 2013-present, Facebook, Inc. 4649 * 4650 * This source code is licensed under the MIT license found in the 4651 * LICENSE file in the root directory of this source tree. 4652 */ 4653 4654 4655 4656 var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; 4657 4658 module.exports = ReactPropTypesSecret; 4659 4660 4661 /***/ }), 4662 4663 /***/ "./node_modules/prop-types/node_modules/object-assign/index.js": 4664 /*!*********************************************************************!*\ 4665 !*** ./node_modules/prop-types/node_modules/object-assign/index.js ***! 4666 \*********************************************************************/ 4667 /*! no static exports found */ 4668 /***/ (function(module, exports, __webpack_require__) { 4669 4670 "use strict"; 4671 /* 4672 object-assign 4673 (c) Sindre Sorhus 4674 @license MIT 4675 */ 4676 4677 4678 /* eslint-disable no-unused-vars */ 4679 var getOwnPropertySymbols = Object.getOwnPropertySymbols; 4680 var hasOwnProperty = Object.prototype.hasOwnProperty; 4681 var propIsEnumerable = Object.prototype.propertyIsEnumerable; 4682 4683 function toObject(val) { 4684 if (val === null || val === undefined) { 4685 throw new TypeError('Object.assign cannot be called with null or undefined'); 4686 } 4687 4688 return Object(val); 4689 } 4690 4691 function shouldUseNative() { 4692 try { 4693 if (!Object.assign) { 4694 return false; 4695 } 4696 4697 // Detect buggy property enumeration order in older V8 versions. 4698 4699 // https://bugs.chromium.org/p/v8/issues/detail?id=4118 4700 var test1 = new String('abc'); // eslint-disable-line no-new-wrappers 4701 test1[5] = 'de'; 4702 if (Object.getOwnPropertyNames(test1)[0] === '5') { 4703 return false; 4704 } 4705 4706 // https://bugs.chromium.org/p/v8/issues/detail?id=3056 4707 var test2 = {}; 4708 for (var i = 0; i < 10; i++) { 4709 test2['_' + String.fromCharCode(i)] = i; 4710 } 4711 var order2 = Object.getOwnPropertyNames(test2).map(function (n) { 4712 return test2[n]; 4713 }); 4714 if (order2.join('') !== '0123456789') { 4715 return false; 4716 } 4717 4718 // https://bugs.chromium.org/p/v8/issues/detail?id=3056 4719 var test3 = {}; 4720 'abcdefghijklmnopqrst'.split('').forEach(function (letter) { 4721 test3[letter] = letter; 4722 }); 4723 if (Object.keys(Object.assign({}, test3)).join('') !== 4724 'abcdefghijklmnopqrst') { 4725 return false; 4726 } 4727 4728 return true; 4729 } catch (err) { 4730 // We don't expect any of the above to throw, but better to be safe. 4731 return false; 4732 } 4733 } 4734 4735 module.exports = shouldUseNative() ? Object.assign : function (target, source) { 4736 var from; 4737 var to = toObject(target); 4738 var symbols; 4739 4740 for (var s = 1; s < arguments.length; s++) { 4741 from = Object(arguments[s]); 4742 4743 for (var key in from) { 4744 if (hasOwnProperty.call(from, key)) { 4745 to[key] = from[key]; 4746 } 4747 } 4748 4749 if (getOwnPropertySymbols) { 4750 symbols = getOwnPropertySymbols(from); 4751 for (var i = 0; i < symbols.length; i++) { 4752 if (propIsEnumerable.call(from, symbols[i])) { 4753 to[symbols[i]] = from[symbols[i]]; 4754 } 4755 } 4756 } 4757 } 4758 4759 return to; 4760 }; 4761 4762 4763 /***/ }), 4764 4765 /***/ "./node_modules/react-cropper/dist/react-cropper.js": 4766 /*!**********************************************************!*\ 4767 !*** ./node_modules/react-cropper/dist/react-cropper.js ***! 4768 \**********************************************************/ 4769 /*! no static exports found */ 4770 /***/ (function(module, exports, __webpack_require__) { 4771 4772 "use strict"; 4773 4774 4775 Object.defineProperty(exports, "__esModule", { 4776 value: true 4777 }); 4778 exports.default = void 0; 4779 4780 var _react = _interopRequireWildcard(__webpack_require__(/*! react */ "react")); 4781 4782 var _propTypes = _interopRequireDefault(__webpack_require__(/*! prop-types */ "./node_modules/prop-types/index.js")); 4783 4784 var _cropperjs = _interopRequireDefault(__webpack_require__(/*! cropperjs */ "./node_modules/cropperjs/dist/cropper.js")); 4785 4786 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 4787 4788 function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } } 4789 4790 function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } 4791 4792 function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } 4793 4794 function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } 4795 4796 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 4797 4798 function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } 4799 4800 function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } 4801 4802 function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } 4803 4804 function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } 4805 4806 function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } 4807 4808 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } 4809 4810 function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } 4811 4812 var optionProps = ['dragMode', 'aspectRatio', 'data', 'crop', // unchangeable props start from here 4813 'viewMode', 'preview', 'responsive', 'restore', 'checkCrossOrigin', 'checkOrientation', 'modal', 'guides', 'center', 'highlight', 'background', 'autoCrop', 'autoCropArea', 'movable', 'rotatable', 'scalable', 'zoomable', 'zoomOnTouch', 'zoomOnWheel', 'wheelZoomRatio', 'cropBoxMovable', 'cropBoxResizable', 'toggleDragModeOnDblclick', 'minContainerWidth', 'minContainerHeight', 'minCanvasWidth', 'minCanvasHeight', 'minCropBoxWidth', 'minCropBoxHeight', 'ready', 'cropstart', 'cropmove', 'cropend', 'zoom']; 4814 var unchangeableProps = optionProps.slice(4); 4815 4816 var ReactCropper = 4817 /*#__PURE__*/ 4818 function (_Component) { 4819 _inherits(ReactCropper, _Component); 4820 4821 function ReactCropper() { 4822 _classCallCheck(this, ReactCropper); 4823 4824 return _possibleConstructorReturn(this, _getPrototypeOf(ReactCropper).apply(this, arguments)); 4825 } 4826 4827 _createClass(ReactCropper, [{ 4828 key: "componentDidMount", 4829 value: function componentDidMount() { 4830 var _this = this; 4831 4832 var options = Object.keys(this.props).filter(function (propKey) { 4833 return optionProps.indexOf(propKey) !== -1; 4834 }).reduce(function (prevOptions, propKey) { 4835 return _extends({}, prevOptions, _defineProperty({}, propKey, _this.props[propKey])); 4836 }, {}); 4837 this.cropper = new _cropperjs.default(this.img, options); 4838 } 4839 }, { 4840 key: "UNSAFE_componentWillReceiveProps", 4841 value: function UNSAFE_componentWillReceiveProps(nextProps) { 4842 var _this2 = this; 4843 4844 if (nextProps.src !== this.props.src) { 4845 this.cropper.reset().clear().replace(nextProps.src); 4846 } 4847 4848 if (nextProps.aspectRatio !== this.props.aspectRatio) { 4849 this.setAspectRatio(nextProps.aspectRatio); 4850 } 4851 4852 if (nextProps.data !== this.props.data) { 4853 this.setData(nextProps.data); 4854 } 4855 4856 if (nextProps.dragMode !== this.props.dragMode) { 4857 this.setDragMode(nextProps.dragMode); 4858 } 4859 4860 if (nextProps.cropBoxData !== this.props.cropBoxData) { 4861 this.setCropBoxData(nextProps.cropBoxData); 4862 } 4863 4864 if (nextProps.canvasData !== this.props.canvasData) { 4865 this.setCanvasData(nextProps.canvasData); 4866 } 4867 4868 if (nextProps.moveTo !== this.props.moveTo) { 4869 if (nextProps.moveTo.length > 1) { 4870 this.moveTo(nextProps.moveTo[0], nextProps.moveTo[1]); 4871 } else { 4872 this.moveTo(nextProps.moveTo[0]); 4873 } 4874 } 4875 4876 if (nextProps.zoomTo !== this.props.zoomTo) { 4877 this.zoomTo(nextProps.zoomTo); 4878 } 4879 4880 if (nextProps.rotateTo !== this.props.rotateTo) { 4881 this.rotateTo(nextProps.rotateTo); 4882 } 4883 4884 if (nextProps.scaleX !== this.props.scaleX) { 4885 this.scaleX(nextProps.scaleX); 4886 } 4887 4888 if (nextProps.scaleY !== this.props.scaleY) { 4889 this.scaleY(nextProps.scaleY); 4890 } 4891 4892 if (nextProps.enable !== this.props.enable) { 4893 if (nextProps.enable) { 4894 this.enable(); 4895 } else { 4896 this.disable(); 4897 } 4898 } 4899 4900 Object.keys(nextProps).forEach(function (propKey) { 4901 var isDifferentVal = nextProps[propKey] !== _this2.props[propKey]; 4902 var isUnchangeableProps = unchangeableProps.indexOf(propKey) !== -1; 4903 4904 if (typeof nextProps[propKey] === 'function' && typeof _this2.props[propKey] === 'function') { 4905 isDifferentVal = nextProps[propKey].toString() !== _this2.props[propKey].toString(); 4906 } 4907 4908 if (isDifferentVal && isUnchangeableProps) { 4909 throw new Error("prop: ".concat(propKey, " can't be change after componentDidMount")); 4910 } 4911 }); 4912 } 4913 }, { 4914 key: "componentWillUnmount", 4915 value: function componentWillUnmount() { 4916 if (this.img) { 4917 // Destroy the cropper, this makes sure events such as resize are cleaned up and do not leak 4918 this.cropper.destroy(); 4919 delete this.img; 4920 delete this.cropper; 4921 } 4922 } 4923 }, { 4924 key: "setDragMode", 4925 value: function setDragMode(mode) { 4926 return this.cropper.setDragMode(mode); 4927 } 4928 }, { 4929 key: "setAspectRatio", 4930 value: function setAspectRatio(aspectRatio) { 4931 return this.cropper.setAspectRatio(aspectRatio); 4932 } 4933 }, { 4934 key: "getCroppedCanvas", 4935 value: function getCroppedCanvas(options) { 4936 return this.cropper.getCroppedCanvas(options); 4937 } 4938 }, { 4939 key: "setCropBoxData", 4940 value: function setCropBoxData(data) { 4941 return this.cropper.setCropBoxData(data); 4942 } 4943 }, { 4944 key: "getCropBoxData", 4945 value: function getCropBoxData() { 4946 return this.cropper.getCropBoxData(); 4947 } 4948 }, { 4949 key: "setCanvasData", 4950 value: function setCanvasData(data) { 4951 return this.cropper.setCanvasData(data); 4952 } 4953 }, { 4954 key: "getCanvasData", 4955 value: function getCanvasData() { 4956 return this.cropper.getCanvasData(); 4957 } 4958 }, { 4959 key: "getImageData", 4960 value: function getImageData() { 4961 return this.cropper.getImageData(); 4962 } 4963 }, { 4964 key: "getContainerData", 4965 value: function getContainerData() { 4966 return this.cropper.getContainerData(); 4967 } 4968 }, { 4969 key: "setData", 4970 value: function setData(data) { 4971 return this.cropper.setData(data); 4972 } 4973 }, { 4974 key: "getData", 4975 value: function getData(rounded) { 4976 return this.cropper.getData(rounded); 4977 } 4978 }, { 4979 key: "crop", 4980 value: function crop() { 4981 return this.cropper.crop(); 4982 } 4983 }, { 4984 key: "move", 4985 value: function move(offsetX, offsetY) { 4986 return this.cropper.move(offsetX, offsetY); 4987 } 4988 }, { 4989 key: "moveTo", 4990 value: function moveTo(x, y) { 4991 return this.cropper.moveTo(x, y); 4992 } 4993 }, { 4994 key: "zoom", 4995 value: function zoom(ratio) { 4996 return this.cropper.zoom(ratio); 4997 } 4998 }, { 4999 key: "zoomTo", 5000 value: function zoomTo(ratio) { 5001 return this.cropper.zoomTo(ratio); 5002 } 5003 }, { 5004 key: "rotate", 5005 value: function rotate(degree) { 5006 return this.cropper.rotate(degree); 5007 } 5008 }, { 5009 key: "rotateTo", 5010 value: function rotateTo(degree) { 5011 return this.cropper.rotateTo(degree); 5012 } 5013 }, { 5014 key: "enable", 5015 value: function enable() { 5016 return this.cropper.enable(); 5017 } 5018 }, { 5019 key: "disable", 5020 value: function disable() { 5021 return this.cropper.disable(); 5022 } 5023 }, { 5024 key: "reset", 5025 value: function reset() { 5026 return this.cropper.reset(); 5027 } 5028 }, { 5029 key: "clear", 5030 value: function clear() { 5031 return this.cropper.clear(); 5032 } 5033 }, { 5034 key: "replace", 5035 value: function replace(url, onlyColorChanged) { 5036 return this.cropper.replace(url, onlyColorChanged); 5037 } 5038 }, { 5039 key: "scale", 5040 value: function scale(scaleX, scaleY) { 5041 return this.cropper.scale(scaleX, scaleY); 5042 } 5043 }, { 5044 key: "scaleX", 5045 value: function scaleX(_scaleX) { 5046 return this.cropper.scaleX(_scaleX); 5047 } 5048 }, { 5049 key: "scaleY", 5050 value: function scaleY(_scaleY) { 5051 return this.cropper.scaleY(_scaleY); 5052 } 5053 }, { 5054 key: "render", 5055 value: function render() { 5056 var _this3 = this; 5057 5058 var _this$props = this.props, 5059 src = _this$props.src, 5060 alt = _this$props.alt, 5061 crossOrigin = _this$props.crossOrigin, 5062 style = _this$props.style, 5063 className = _this$props.className; 5064 return _react.default.createElement("div", { 5065 style: style, 5066 className: className 5067 }, _react.default.createElement("img", { 5068 crossOrigin: crossOrigin, 5069 ref: function ref(img) { 5070 _this3.img = img; 5071 }, 5072 src: src, 5073 alt: alt === undefined ? 'picture' : alt, 5074 style: { 5075 opacity: 0 5076 } 5077 })); 5078 } 5079 }]); 5080 5081 return ReactCropper; 5082 }(_react.Component); 5083 5084 ReactCropper.propTypes = { 5085 style: _propTypes.default.object, 5086 // eslint-disable-line react/forbid-prop-types 5087 className: _propTypes.default.string, 5088 // react cropper options 5089 crossOrigin: _propTypes.default.string, 5090 src: _propTypes.default.string, 5091 alt: _propTypes.default.string, 5092 // props of option can be changed after componentDidmount 5093 aspectRatio: _propTypes.default.number, 5094 dragMode: _propTypes.default.oneOf(['crop', 'move', 'none']), 5095 data: _propTypes.default.shape({ 5096 x: _propTypes.default.number, 5097 y: _propTypes.default.number, 5098 width: _propTypes.default.number, 5099 height: _propTypes.default.number, 5100 rotate: _propTypes.default.number, 5101 scaleX: _propTypes.default.number, 5102 scaleY: _propTypes.default.number 5103 }), 5104 scaleX: _propTypes.default.number, 5105 scaleY: _propTypes.default.number, 5106 enable: _propTypes.default.bool, 5107 cropBoxData: _propTypes.default.shape({ 5108 left: _propTypes.default.number, 5109 top: _propTypes.default.number, 5110 width: _propTypes.default.number, 5111 height: _propTypes.default.number 5112 }), 5113 canvasData: _propTypes.default.shape({ 5114 left: _propTypes.default.number, 5115 top: _propTypes.default.number, 5116 width: _propTypes.default.number, 5117 height: _propTypes.default.number 5118 }), 5119 zoomTo: _propTypes.default.number, 5120 moveTo: _propTypes.default.arrayOf(_propTypes.default.number), 5121 rotateTo: _propTypes.default.number, 5122 // cropperjs options 5123 // https://github.com/fengyuanchen/cropperjs#options 5124 // aspectRatio, dragMode, data 5125 viewMode: _propTypes.default.oneOf([0, 1, 2, 3]), 5126 preview: _propTypes.default.string, 5127 responsive: _propTypes.default.bool, 5128 restore: _propTypes.default.bool, 5129 checkCrossOrigin: _propTypes.default.bool, 5130 checkOrientation: _propTypes.default.bool, 5131 modal: _propTypes.default.bool, 5132 guides: _propTypes.default.bool, 5133 center: _propTypes.default.bool, 5134 highlight: _propTypes.default.bool, 5135 background: _propTypes.default.bool, 5136 autoCrop: _propTypes.default.bool, 5137 autoCropArea: _propTypes.default.number, 5138 movable: _propTypes.default.bool, 5139 rotatable: _propTypes.default.bool, 5140 scalable: _propTypes.default.bool, 5141 zoomable: _propTypes.default.bool, 5142 zoomOnTouch: _propTypes.default.bool, 5143 zoomOnWheel: _propTypes.default.bool, 5144 wheelZoomRatio: _propTypes.default.number, 5145 cropBoxMovable: _propTypes.default.bool, 5146 cropBoxResizable: _propTypes.default.bool, 5147 toggleDragModeOnDblclick: _propTypes.default.bool, 5148 minContainerWidth: _propTypes.default.number, 5149 minContainerHeight: _propTypes.default.number, 5150 minCanvasWidth: _propTypes.default.number, 5151 minCanvasHeight: _propTypes.default.number, 5152 minCropBoxWidth: _propTypes.default.number, 5153 minCropBoxHeight: _propTypes.default.number, 5154 ready: _propTypes.default.func, 5155 cropstart: _propTypes.default.func, 5156 cropmove: _propTypes.default.func, 5157 cropend: _propTypes.default.func, 5158 crop: _propTypes.default.func, 5159 zoom: _propTypes.default.func 5160 }; 5161 ReactCropper.defaultProps = { 5162 src: null, 5163 dragMode: 'crop', 5164 data: null, 5165 scaleX: 1, 5166 scaleY: 1, 5167 enable: true, 5168 zoomTo: 1, 5169 rotateTo: 0 5170 }; 5171 var _default = ReactCropper; 5172 exports.default = _default; 5173 5174 5175 /***/ }), 5176 5177 /***/ "./node_modules/react-is/cjs/react-is.development.js": 5178 /*!***********************************************************!*\ 5179 !*** ./node_modules/react-is/cjs/react-is.development.js ***! 5180 \***********************************************************/ 5181 /*! no static exports found */ 5182 /***/ (function(module, exports, __webpack_require__) { 5183 5184 "use strict"; 5185 /** @license React v16.13.1 5186 * react-is.development.js 5187 * 5188 * Copyright (c) Facebook, Inc. and its affiliates. 5189 * 5190 * This source code is licensed under the MIT license found in the 5191 * LICENSE file in the root directory of this source tree. 5192 */ 5193 5194 5195 5196 5197 5198 if (true) { 5199 (function() { 5200 'use strict'; 5201 5202 // The Symbol used to tag the ReactElement-like types. If there is no native Symbol 5203 // nor polyfill, then a plain number is used for performance. 5204 var hasSymbol = typeof Symbol === 'function' && Symbol.for; 5205 var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7; 5206 var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca; 5207 var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb; 5208 var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc; 5209 var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2; 5210 var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd; 5211 var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary 5212 // (unstable) APIs that have been removed. Can we remove the symbols? 5213 5214 var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf; 5215 var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf; 5216 var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0; 5217 var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1; 5218 var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8; 5219 var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3; 5220 var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4; 5221 var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9; 5222 var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5; 5223 var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6; 5224 var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7; 5225 5226 function isValidElementType(type) { 5227 return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill. 5228 type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE); 5229 } 5230 5231 function typeOf(object) { 5232 if (typeof object === 'object' && object !== null) { 5233 var $$typeof = object.$$typeof; 5234 5235 switch ($$typeof) { 5236 case REACT_ELEMENT_TYPE: 5237 var type = object.type; 5238 5239 switch (type) { 5240 case REACT_ASYNC_MODE_TYPE: 5241 case REACT_CONCURRENT_MODE_TYPE: 5242 case REACT_FRAGMENT_TYPE: 5243 case REACT_PROFILER_TYPE: 5244 case REACT_STRICT_MODE_TYPE: 5245 case REACT_SUSPENSE_TYPE: 5246 return type; 5247 5248 default: 5249 var $$typeofType = type && type.$$typeof; 5250 5251 switch ($$typeofType) { 5252 case REACT_CONTEXT_TYPE: 5253 case REACT_FORWARD_REF_TYPE: 5254 case REACT_LAZY_TYPE: 5255 case REACT_MEMO_TYPE: 5256 case REACT_PROVIDER_TYPE: 5257 return $$typeofType; 5258 5259 default: 5260 return $$typeof; 5261 } 5262 5263 } 5264 5265 case REACT_PORTAL_TYPE: 5266 return $$typeof; 5267 } 5268 } 5269 5270 return undefined; 5271 } // AsyncMode is deprecated along with isAsyncMode 5272 5273 var AsyncMode = REACT_ASYNC_MODE_TYPE; 5274 var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE; 5275 var ContextConsumer = REACT_CONTEXT_TYPE; 5276 var ContextProvider = REACT_PROVIDER_TYPE; 5277 var Element = REACT_ELEMENT_TYPE; 5278 var ForwardRef = REACT_FORWARD_REF_TYPE; 5279 var Fragment = REACT_FRAGMENT_TYPE; 5280 var Lazy = REACT_LAZY_TYPE; 5281 var Memo = REACT_MEMO_TYPE; 5282 var Portal = REACT_PORTAL_TYPE; 5283 var Profiler = REACT_PROFILER_TYPE; 5284 var StrictMode = REACT_STRICT_MODE_TYPE; 5285 var Suspense = REACT_SUSPENSE_TYPE; 5286 var hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated 5287 5288 function isAsyncMode(object) { 5289 { 5290 if (!hasWarnedAboutDeprecatedIsAsyncMode) { 5291 hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint 5292 5293 console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.'); 5294 } 5295 } 5296 5297 return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE; 5298 } 5299 function isConcurrentMode(object) { 5300 return typeOf(object) === REACT_CONCURRENT_MODE_TYPE; 5301 } 5302 function isContextConsumer(object) { 5303 return typeOf(object) === REACT_CONTEXT_TYPE; 5304 } 5305 function isContextProvider(object) { 5306 return typeOf(object) === REACT_PROVIDER_TYPE; 5307 } 5308 function isElement(object) { 5309 return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE; 5310 } 5311 function isForwardRef(object) { 5312 return typeOf(object) === REACT_FORWARD_REF_TYPE; 5313 } 5314 function isFragment(object) { 5315 return typeOf(object) === REACT_FRAGMENT_TYPE; 5316 } 5317 function isLazy(object) { 5318 return typeOf(object) === REACT_LAZY_TYPE; 5319 } 5320 function isMemo(object) { 5321 return typeOf(object) === REACT_MEMO_TYPE; 5322 } 5323 function isPortal(object) { 5324 return typeOf(object) === REACT_PORTAL_TYPE; 5325 } 5326 function isProfiler(object) { 5327 return typeOf(object) === REACT_PROFILER_TYPE; 5328 } 5329 function isStrictMode(object) { 5330 return typeOf(object) === REACT_STRICT_MODE_TYPE; 5331 } 5332 function isSuspense(object) { 5333 return typeOf(object) === REACT_SUSPENSE_TYPE; 5334 } 5335 5336 exports.AsyncMode = AsyncMode; 5337 exports.ConcurrentMode = ConcurrentMode; 5338 exports.ContextConsumer = ContextConsumer; 5339 exports.ContextProvider = ContextProvider; 5340 exports.Element = Element; 5341 exports.ForwardRef = ForwardRef; 5342 exports.Fragment = Fragment; 5343 exports.Lazy = Lazy; 5344 exports.Memo = Memo; 5345 exports.Portal = Portal; 5346 exports.Profiler = Profiler; 5347 exports.StrictMode = StrictMode; 5348 exports.Suspense = Suspense; 5349 exports.isAsyncMode = isAsyncMode; 5350 exports.isConcurrentMode = isConcurrentMode; 5351 exports.isContextConsumer = isContextConsumer; 5352 exports.isContextProvider = isContextProvider; 5353 exports.isElement = isElement; 5354 exports.isForwardRef = isForwardRef; 5355 exports.isFragment = isFragment; 5356 exports.isLazy = isLazy; 5357 exports.isMemo = isMemo; 5358 exports.isPortal = isPortal; 5359 exports.isProfiler = isProfiler; 5360 exports.isStrictMode = isStrictMode; 5361 exports.isSuspense = isSuspense; 5362 exports.isValidElementType = isValidElementType; 5363 exports.typeOf = typeOf; 5364 })(); 5365 } 5366 5367 5368 /***/ }), 5369 5370 /***/ "./node_modules/react-is/index.js": 5371 /*!****************************************!*\ 5372 !*** ./node_modules/react-is/index.js ***! 5373 \****************************************/ 5374 /*! no static exports found */ 5375 /***/ (function(module, exports, __webpack_require__) { 5376 5377 "use strict"; 5378 5379 5380 if (false) {} else { 5381 module.exports = __webpack_require__(/*! ./cjs/react-is.development.js */ "./node_modules/react-is/cjs/react-is.development.js"); 5382 } 5383 5384 5385 /***/ }), 5386 5387 /***/ "./src/index.js": 5388 /*!**********************!*\ 5389 !*** ./src/index.js ***! 5390 \**********************/ 5391 /*! no exports provided */ 5392 /***/ (function(module, __webpack_exports__, __webpack_require__) { 5393 5394 "use strict"; 5395 __webpack_require__.r(__webpack_exports__); 5396 /* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/regenerator */ "@babel/runtime/regenerator"); 5397 /* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__); 5398 /* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js"); 5399 /* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__); 5400 /* harmony import */ var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ "./node_modules/@babel/runtime/helpers/slicedToArray.js"); 5401 /* harmony import */ var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_2__); 5402 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); 5403 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__); 5404 /* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/blocks */ "@wordpress/blocks"); 5405 /* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_4__); 5406 /* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor"); 5407 /* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_5__); 5408 /* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); 5409 /* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_6__); 5410 /* harmony import */ var _wordpress_server_side_render__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @wordpress/server-side-render */ "@wordpress/server-side-render"); 5411 /* harmony import */ var _wordpress_server_side_render__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_wordpress_server_side_render__WEBPACK_IMPORTED_MODULE_7__); 5412 /* harmony import */ var _wordpress_date__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @wordpress/date */ "@wordpress/date"); 5413 /* harmony import */ var _wordpress_date__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_wordpress_date__WEBPACK_IMPORTED_MODULE_8__); 5414 /* harmony import */ var _wordpress_compose__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @wordpress/compose */ "@wordpress/compose"); 5415 /* harmony import */ var _wordpress_compose__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(_wordpress_compose__WEBPACK_IMPORTED_MODULE_9__); 5416 /* harmony import */ var react_cropper__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! react-cropper */ "./node_modules/react-cropper/dist/react-cropper.js"); 5417 /* harmony import */ var react_cropper__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(react_cropper__WEBPACK_IMPORTED_MODULE_10__); 5418 5419 5420 5421 5422 5423 5424 5425 5426 5427 5428 5429 5430 var el = React.createElement; 5431 var cropperRef = React.createRef(); 5432 var soIconx = el('svg', { 5433 className: 'soIcon', 5434 width: '166.000000pt', 5435 height: '155.000000pt', 5436 preserveAspectRatio: "xMidYMid meet", 5437 viewBox: "0 0 166.000000 155.000000" 5438 }, el('g', { 5439 transform: "translate(0.000000,155.000000) scale(0.100000,-0.100000)", 5440 fill: "#000000", 5441 stroke: "none" 5442 }, el('path', { 5443 d: "M880 774 l0 -779 98 95 c339 330 682 677 682 691 0 15 -748 759 -771 767 -5 2 -9 -301 -9 -774z" 5444 }), el('path', { 5445 d: "M0 767 c0 -13 751 -757 764 -757 3 0 6 173 6 385 l0 385 -385 0 c-315 0 -385 -2 -385 -13z" 5446 }))); 5447 5448 var soIcon = function soIcon() { 5449 return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("svg", { 5450 version: "1.1", 5451 id: "Layer_1", 5452 x: "0px", 5453 y: "0px", 5454 width: "24px", 5455 height: "24px", 5456 viewBox: "0 0 24 24", 5457 "enable-background": "new 0 0 24 24" 5458 }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("polygon", { 5459 fill: "#1F8978", 5460 points: "11.18,22.166 11.173,12 1.003,12 " 5461 }), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("polygon", { 5462 fill: "#00AE95", 5463 points: "11.166,1.834 11.173,12 1.003,12 " 5464 }), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("polygon", { 5465 fill: "#CE3D39", 5466 points: "12.822,22.166 12.829,12 22.998,12 " 5467 }), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("polygon", { 5468 fill: "#F15C52", 5469 points: "12.836,1.834 12.829,12 22.998,12 " 5470 })); 5471 }; 5472 5473 var sSmallIcon = function sSmallIcon() { 5474 return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_6__["Icon"], { 5475 icon: Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("svg", { 5476 width: "25", 5477 height: "25", 5478 xmlns: "http://www.w3.org/2000/svg" 5479 }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("g", null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("path", { 5480 stroke: "null", 5481 id: "svg_1", 5482 "fill-rule": "evenodd", 5483 fill: "#010101", 5484 d: "m14.953703,6.452965c0,0.410933 0.333676,0.744479 0.74461,0.744479c0.410868,0 0.744544,-0.333578 0.744544,-0.744479c0,-0.410966 -0.333676,-0.744544 -0.744544,-0.744544c-0.410966,0 -0.74461,0.333578 -0.74461,0.744544zm-7.44495,4.020342l0,0.818949c0,0.369339 0.300702,0.670008 0.670041,0.670008l8.264031,0l-2.847197,-2.799309c-0.238228,-0.238326 -0.619432,-0.238326 -0.857267,0l-0.601765,0.592587l-1.518916,-1.485975c-0.238195,-0.238326 -0.666894,-0.238326 -0.902139,0l-2.206788,2.203739zm-2.680195,5.062573c0,0.658142 0.533096,1.191172 1.19114,1.191172l11.912085,0c0.65811,0 1.19114,-0.53303 1.19114,-1.191172l0,-11.316449c0,-0.658142 -0.53303,-1.191205 -1.19114,-1.191205l-11.912052,0c-0.658077,0 -1.19114,0.533096 -1.19114,1.191205l0,11.316449l-0.000033,0zm2.144248,-11.018599l10.005933,0c0.363307,0 0.655225,0.291787 0.655225,0.655192l0,7.325804c0,0.363242 -0.291918,0.655127 -0.655225,0.655127l-10.005933,0c-0.363275,0 -0.655258,-0.291885 -0.655258,-0.655127l0,-7.325804c-0.000033,-0.363406 0.291983,-0.655192 0.655258,-0.655192z", 5485 "clip-rule": "evenodd" 5486 }))) 5487 }); 5488 }; 5489 5490 var sMediumIcon = function sMediumIcon() { 5491 return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_6__["Icon"], { 5492 icon: Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("svg", { 5493 width: "25", 5494 height: "25", 5495 xmlns: "http://www.w3.org/2000/svg" 5496 }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("g", null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("path", { 5497 stroke: "null", 5498 id: "svg_1", 5499 "fill-rule": "evenodd", 5500 fill: "#010101", 5501 d: "m14.802511,7.322292c0,0.515244 0.418376,0.933455 0.93362,0.933455c0.515161,0 0.933537,-0.418253 0.933537,-0.933455c0,-0.515285 -0.418376,-0.933537 -0.933537,-0.933537c-0.515285,0 -0.93362,0.418253 -0.93362,0.933537zm-9.334758,5.040856l0,1.02683c0,0.46309 0.377032,0.840081 0.840122,0.840081l10.361752,0l-3.569923,-3.509879c-0.298699,-0.298822 -0.776667,-0.298822 -1.074873,0l-0.754515,0.743008l-1.904474,-1.863171c-0.298658,-0.298822 -0.836177,-0.298822 -1.131136,0l-2.766953,2.763131zm-3.360529,6.347644c0,0.825204 0.668415,1.493537 1.493496,1.493537l14.935818,0c0.825162,0 1.493496,-0.668333 1.493496,-1.493537l0,-14.188988c0,-0.825204 -0.668333,-1.493578 -1.493496,-1.493578l-14.935777,0c-0.825121,0 -1.493496,0.668415 -1.493496,1.493578l0,14.188988l-0.000041,0zm2.688539,-13.815532l12.545814,0c0.455528,0 0.821546,0.365853 0.821546,0.821505l0,9.185367c0,0.455446 -0.366017,0.821423 -0.821546,0.821423l-12.545814,0c-0.455487,0 -0.821587,-0.365976 -0.821587,-0.821423l0,-9.185367c-0.000041,-0.455652 0.3661,-0.821505 0.821587,-0.821505z", 5502 "clip-rule": "evenodd" 5503 }))) 5504 }); 5505 }; 5506 5507 var sWideIcon = function sWideIcon() { 5508 return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_6__["Icon"], { 5509 icon: Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("svg", { 5510 width: "25", 5511 height: "25", 5512 xmlns: "http://www.w3.org/2000/svg" 5513 }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("g", null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("path", { 5514 stroke: "null", 5515 id: "svg_1", 5516 "fill-rule": "evenodd", 5517 fill: "#010101", 5518 d: "m16.730116,7.974287c0,0.593476 0.481901,1.075188 1.075377,1.075188c0.593382,0 1.075282,-0.481759 1.075282,-1.075188c0,-0.593524 -0.481901,-1.075282 -1.075282,-1.075282c-0.593524,0 -1.075377,0.481759 -1.075377,1.075282zm-10.752113,5.80624l0,1.18274c0,0.533404 0.434279,0.967636 0.967683,0.967636l11.935042,0l-4.111967,-4.042806c-0.344052,-0.344194 -0.894593,-0.344194 -1.238078,0l-0.869078,0.855823l-2.193642,-2.146067c-0.344005,-0.344194 -0.963139,-0.344194 -1.302883,0l-3.187077,3.182675zm-3.87078,7.311446c0,0.950499 0.769905,1.72031 1.720262,1.72031l17.203617,0c0.950452,0 1.720262,-0.76981 1.720262,-1.72031l0,-16.343391c0,-0.950499 -0.76981,-1.720357 -1.720262,-1.720357l-17.20357,0c-0.950405,0 -1.720262,0.769905 -1.720262,1.720357l0,16.343391l-0.000047,0zm3.096756,-15.913231l14.450724,0c0.524694,0 0.946286,0.421403 0.946286,0.946239l0,10.580039c0,0.5246 -0.421592,0.946144 -0.946286,0.946144l-14.450724,0c-0.524647,0 -0.946334,-0.421545 -0.946334,-0.946144l0,-10.580039c-0.000047,-0.524836 0.421687,-0.946239 0.946334,-0.946239z", 5519 "clip-rule": "evenodd" 5520 }))) 5521 }); 5522 }; 5523 5524 Object(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_4__["registerBlockType"])('squareoffs/blocks', { 5525 title: 'SquareOffs', 5526 icon: soIcon, 5527 category: 'embed', 5528 attributes: { 5529 soAlignment: { 5530 type: 'string', 5531 default: 'left' 5532 }, 5533 soID: { 5534 type: 'number' 5535 }, 5536 soSize: { 5537 type: 'string', 5538 default: 'wide' 5539 }, 5540 soStep: { 5541 type: 'number', 5542 default: 0 5543 }, 5544 question: { 5545 type: 'string' 5546 }, 5547 side_1_title: { 5548 type: 'string' 5549 }, 5550 side_2_title: { 5551 type: 'string' 5552 }, 5553 side_1_defense: { 5554 type: 'string' 5555 }, 5556 side_2_defense: { 5557 type: 'string' 5558 }, 5559 side_1_photo: { 5560 type: 'string' 5561 }, 5562 side_1_photo_raw: { 5563 type: 'string' 5564 }, 5565 side_2_photo: { 5566 type: 'string' 5567 }, 5568 side_2_photo_raw: { 5569 type: 'string' 5570 }, 5571 end_date: { 5572 type: 'string' 5573 }, 5574 category_uuid: { 5575 type: 'string' 5576 }, 5577 tag_list: { 5578 type: 'string' 5579 }, 5580 cover_photo: { 5581 type: 'string' 5582 }, 5583 cover_photo_raw: { 5584 type: 'string' 5585 }, 5586 cover_photo_mime: { 5587 type: 'string' 5588 }, 5589 side1MediaID: { 5590 type: 'string' 5591 }, 5592 side2MediaID: { 5593 type: 'string' 5594 }, 5595 coverPhotoMediaID: { 5596 type: 'string' 5597 }, 5598 showRequired: { 5599 type: 'number' 5600 } 5601 }, 5602 edit: function edit(props) { 5603 var _useState = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["useState"])(false), 5604 _useState2 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_2___default()(_useState, 2), 5605 dateTimePickerFocus = _useState2[0], 5606 setDateTimePickerFocus = _useState2[1]; 5607 5608 var _useState3 = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["useState"])(false), 5609 _useState4 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_2___default()(_useState3, 2), 5610 createSoStateDone = _useState4[0], 5611 setCreateSoStateDone = _useState4[1]; 5612 5613 Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["useEffect"])(function () { 5614 console.log("CB: ", dateTimePickerFocus); 5615 console.log("DONE: ", createSoStateDone); 5616 }, [dateTimePickerFocus, createSoStateDone]); 5617 var fetchStep = 4; 5618 var finalStep = 5; 5619 5620 var handleEndDateFocus = function handleEndDateFocus(event) { 5621 event.preventDefault(); 5622 event.stopPropagation(); 5623 setDateTimePickerFocus(true); 5624 }; 5625 5626 var closeDatePicker = function closeDatePicker(event) { 5627 event.preventDefault(); 5628 event.stopPropagation(); 5629 setDateTimePickerFocus(false); 5630 }; 5631 5632 function updateSOStep(event) { 5633 event.preventDefault(); 5634 console.log(props.attributes.soStep, " == ", fetchStep); 5635 var proceed = false; 5636 console.log(props.attributes); 5637 5638 if (props.attributes.soStep == 1) { 5639 if (props.attributes.question && props.attributes.side_1_title && props.attributes.side_2_title) { 5640 proceed = true; 5641 } else { 5642 props.setAttributes({ 5643 showRequired: 1 5644 }); 5645 console.log("dddd"); 5646 } 5647 } else if (props.attributes.soStep == 3) { 5648 if (props.attributes.category_uuid) { 5649 proceed = true; 5650 } else { 5651 props.setAttributes({ 5652 showRequired: 3 5653 }); 5654 } 5655 } else if (props.attributes.soStep == 0 || props.attributes.soStep == 2) proceed = true; 5656 5657 if (proceed === true) { 5658 if (parseInt(props.attributes.soStep) + 1 == fetchStep) { 5659 if (props.attributes.question && props.attributes.side_1_title && props.attributes.side_2_title && props.attributes.category_uuid) { 5660 createSquareOffs(); 5661 props.setAttributes({ 5662 soStep: parseInt(props.attributes.soStep) + parseInt(1) 5663 }); 5664 } 5665 } else { 5666 props.setAttributes({ 5667 soStep: parseInt(props.attributes.soStep) + parseInt(1) 5668 }); 5669 } 5670 } 5671 } 5672 5673 function createSquareOffs() { 5674 return _createSquareOffs.apply(this, arguments); 5675 } 5676 5677 function _createSquareOffs() { 5678 _createSquareOffs = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee() { 5679 var form_data, key; 5680 return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee$(_context) { 5681 while (1) { 5682 switch (_context.prev = _context.next) { 5683 case 0: 5684 form_data = new FormData(); 5685 5686 for (key in props.attributes) { 5687 form_data.append(key, props.attributes[key]); 5688 } 5689 5690 form_data.append('action', 'soCreateSquareOffs'); 5691 console.log("fetching..."); 5692 console.log(form_data); 5693 _context.next = 7; 5694 return fetch(window.ajaxurl, { 5695 method: 'POST', 5696 body: form_data 5697 }).then(function (response) { 5698 return response.json(); 5699 }).then(function (data) { 5700 return doneCreatingSquareOffs(data); 5701 }); 5702 5703 case 7: 5704 case "end": 5705 return _context.stop(); 5706 } 5707 } 5708 }, _callee); 5709 })); 5710 return _createSquareOffs.apply(this, arguments); 5711 } 5712 5713 function doneCreatingSquareOffs(data) { 5714 console.log(data); 5715 props.setAttributes({ 5716 soID: data.external_id 5717 }); 5718 props.setAttributes({ 5719 soStep: finalStep 5720 }); 5721 props.setAttributes({ 5722 cover_photo: '' 5723 }); 5724 } 5725 5726 function backSOStep(event) { 5727 event.preventDefault(); 5728 console.log(props.attributes); 5729 props.setAttributes({ 5730 soStep: parseInt(props.attributes.soStep) - parseInt(1) 5731 }); 5732 } 5733 5734 function sOStepExisting(event) { 5735 event.preventDefault(); 5736 props.setAttributes({ 5737 soStep: 10 5738 }); 5739 } 5740 5741 function sOStepCancel(event) { 5742 event.preventDefault(); 5743 props.setAttributes({ 5744 soStep: 0 5745 }); 5746 } 5747 5748 function injectSOShortcode(event) { 5749 if (props.attributes.soID && props.attributes.soSize && props.attributes.soAlignment) props.setAttributes({ 5750 soStep: finalStep 5751 }); 5752 } 5753 5754 var soUpdateSOID = function soUpdateSOID(event) { 5755 event.preventDefault(); 5756 5757 if (event.key) { 5758 if ("Enter" == event.key) props.setAttributes({ 5759 soID: parseInt(event.target.value) 5760 }); 5761 } else props.setAttributes({ 5762 soID: parseInt(event.target.value) 5763 }); 5764 }; 5765 5766 var onChangeAlignment = function onChangeAlignment(newAlignment) { 5767 props.setAttributes({ 5768 soAlignment: newAlignment === undefined ? 'none' : newAlignment 5769 }); 5770 injectSOShortcode(); 5771 }; 5772 5773 var changeToSmall = function changeToSmall() { 5774 props.setAttributes({ 5775 soSize: 'small' 5776 }); 5777 injectSOShortcode(); 5778 }; 5779 5780 var changeToMedium = function changeToMedium() { 5781 props.setAttributes({ 5782 soSize: 'medium' 5783 }); 5784 injectSOShortcode(); 5785 }; 5786 5787 var changeToWide = function changeToWide() { 5788 props.setAttributes({ 5789 soSize: 'wide' 5790 }); 5791 injectSOShortcode(); 5792 }; 5793 5794 function _crop() { 5795 // image in dataUrl 5796 console.log("asdfsdf", props.attributes); 5797 { 5798 props.setAttributes({ 5799 cover_photo: cropperRef.current.getCroppedCanvas().toDataURL(props.attributes.cover_photo_mime) 5800 }); 5801 } 5802 } 5803 5804 return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("div", { 5805 class: 'soContainer ' + props.className 5806 }, props.attributes.soStep == finalStep && props.attributes.soID ? Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("div", null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["Fragment"], null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_5__["InspectorControls"], null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_6__["PanelBody"], { 5807 title: "SquareOffs Settings", 5808 initialOpen: true 5809 }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_6__["PanelRow"], null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_6__["TextControl"], { 5810 label: "SquareOff ID", 5811 onKeyUp: soUpdateSOID, 5812 onBlur: soUpdateSOID, 5813 defaultValue: props.attributes.soID 5814 }))))), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_5__["BlockControls"], null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_5__["BlockAlignmentToolbar"], { 5815 controls: ['left', 'center', 'right'], 5816 value: props.attributes.soAlignment, 5817 onChange: onChangeAlignment 5818 }), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_6__["Toolbar"], null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_6__["IconButton"], { 5819 icon: sSmallIcon, 5820 label: "Small", 5821 value: "small", 5822 onClick: changeToSmall 5823 }), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_6__["IconButton"], { 5824 icon: sMediumIcon, 5825 label: "Medium", 5826 value: "medium", 5827 onClick: changeToMedium 5828 }), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_6__["IconButton"], { 5829 icon: sWideIcon, 5830 label: "Wide", 5831 value: "wide", 5832 onClick: changeToWide 5833 })))) : null, props.attributes.soStep == finalStep ? Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("div", null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("div", { 5834 class: "soClickHandle" 5835 }), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])(_wordpress_server_side_render__WEBPACK_IMPORTED_MODULE_7___default.a, { 5836 block: "squareoffs/blocks", 5837 attributes: { 5838 soID: props.attributes.soID, 5839 soSize: props.attributes.soSize, 5840 soAlignment: props.attributes.soAlignment 5841 } 5842 })) : Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("div", { 5843 class: 'components-placeholder soCont' + props.attributes.soStep 5844 }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("img", { 5845 class: "squareOffsLogo", 5846 src: "https://squareoffs.com/assets/Logo-343c6a748ac336ca96afdf9d72fdeb3d70f1478434f3566ae459fd1707da8d18.svg" 5847 }), props.attributes.soStep == 0 ? Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("div", { 5848 class: "soStep soStep0" 5849 }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_6__["Button"], { 5850 isPrimary: true, 5851 onClick: updateSOStep 5852 }, "Create new SquareOff"), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_6__["Button"], { 5853 isSecondary: true, 5854 onClick: sOStepExisting 5855 }, "Insert Existing SquareOff")) : null, props.attributes.soStep == 10 ? Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("div", { 5856 class: "soStep soStep10" 5857 }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("h2", null, "Insert Existing SquareOff"), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("p", null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("input", { 5858 onChange: soUpdateSOID, 5859 type: "text", 5860 defaultValue: props.attributes.soID, 5861 placeholder: "SquareOff ID" 5862 })), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("p", null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_6__["Button"], { 5863 isPrimary: true, 5864 onClick: injectSOShortcode 5865 }, "Embed"), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_6__["Button"], { 5866 isSecondary: true, 5867 onClick: sOStepCancel 5868 }, "Cancel"))) : null, props.attributes.soStep == 1 ? Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("div", { 5869 class: "soStep soStep1" 5870 }, !props.attributes.cover_photo_raw ? Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("p", { 5871 class: "soCoverPhoto" 5872 }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("img", { 5873 src: window.soVars.soURL + 'assets/16x9.png' 5874 })) : null, props.attributes.cover_photo_raw && props.attributes.cover_photo_mime ? Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])(react_cropper__WEBPACK_IMPORTED_MODULE_10___default.a, { 5875 ref: cropperRef, 5876 src: props.attributes.cover_photo_raw, 5877 style: { 5878 height: 'auto', 5879 width: '100%' 5880 } // Cropper.js options 5881 , 5882 aspectRatio: 16 / 9, 5883 guides: true, 5884 viewMode: 1, 5885 crop: _crop 5886 }) : null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_5__["MediaUploadCheck"], null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_5__["MediaUpload"], { 5887 onSelect: function onSelect(media) { 5888 props.setAttributes({ 5889 cover_photo_mime: media.mime 5890 }); 5891 props.setAttributes({ 5892 cover_photo_raw: media.url 5893 }); 5894 }, 5895 allowedTypes: "image", 5896 value: props.attributes.coverPhotoMediaID, 5897 render: function render(_ref) { 5898 var open = _ref.open; 5899 return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_6__["Button"], { 5900 isPrimary: true, 5901 onClick: open 5902 }, "Add a Cover Photo (max. 5Mb)"); 5903 } 5904 })), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("p", null, "\xA0"), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("label", null, "What is your question? *"), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("p", null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("textarea", { 5905 type: "text", 5906 class: props.attributes.showRequired == 1 && !props.attributes.question ? 'required' : '', 5907 value: props.attributes.question, 5908 onChange: function onChange(event) { 5909 return props.setAttributes({ 5910 question: event.target.value 5911 }); 5912 }, 5913 maxLength: "100" 5914 })), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("label", null, "Side 1 Answer *"), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("p", null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("textarea", { 5915 type: "text", 5916 class: props.attributes.showRequired == 1 && !props.attributes.side_1_title ? 'required' : '', 5917 value: props.attributes.side_1_title, 5918 onChange: function onChange(event) { 5919 return props.setAttributes({ 5920 side_1_title: event.target.value 5921 }); 5922 }, 5923 maxLength: "20" 5924 })), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("label", null, "Side 2 Answer *"), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("p", null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("textarea", { 5925 type: "text", 5926 class: props.attributes.showRequired == 1 && !props.attributes.side_2_title ? 'required' : '', 5927 value: props.attributes.side_2_title, 5928 onChange: function onChange(event) { 5929 return props.setAttributes({ 5930 side_2_title: event.target.value 5931 }); 5932 }, 5933 maxLength: "20" 5934 }))) : null, props.attributes.soStep == 2 ? Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("div", { 5935 class: "soStep soStep3" 5936 }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("h2", null, "Add a defense for each side (optional)"), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("label", null, "Side 1"), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("p", null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("textarea", { 5937 type: "text", 5938 value: props.attributes.side_1_defense, 5939 onChange: function onChange(event) { 5940 props.setAttributes({ 5941 side_1_defense: event.target.value 5942 }); 5943 }, 5944 placeholder: "Add more info, stats, or links to defend this side (optinal).", 5945 maxLength: "600" 5946 })), props.attributes.side_1_photo ? Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("p", { 5947 class: "soPhoto" 5948 }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("i", { 5949 class: "removePhoto", 5950 onClick: function onClick(event) { 5951 props.setAttributes({ 5952 side_1_photo: null 5953 }); 5954 } 5955 }, "x"), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("img", { 5956 src: props.attributes.side_1_photo 5957 })) : null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_5__["MediaUploadCheck"], null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_5__["MediaUpload"], { 5958 onSelect: function onSelect(media) { 5959 return props.setAttributes({ 5960 side_1_photo: media.url 5961 }); 5962 }, 5963 allowedTypes: "image", 5964 value: props.attributes.side1MediaID, 5965 render: function render(_ref2) { 5966 var open = _ref2.open; 5967 return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_6__["Button"], { 5968 isSecondary: true, 5969 onClick: open 5970 }, "Add a photo for side 1 (max. 5Mb)"); 5971 } 5972 })), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("p", null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("br", null)), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("label", null, "Side 2"), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("p", null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("textarea", { 5973 type: "text", 5974 value: props.attributes.side_2_defense, 5975 onChange: function onChange(event) { 5976 props.setAttributes({ 5977 side_2_defense: event.target.value 5978 }); 5979 }, 5980 placeholder: "Add more info, stats, or links to defend this side (optinal).", 5981 maxLength: "600" 5982 })), props.attributes.side_2_photo ? Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("p", { 5983 class: "soPhoto" 5984 }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("i", { 5985 class: "removePhoto", 5986 onClick: function onClick(event) { 5987 props.setAttributes({ 5988 side_2_photo: null 5989 }); 5990 } 5991 }, "x"), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("img", { 5992 src: props.attributes.side_2_photo 5993 })) : null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_5__["MediaUploadCheck"], null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_5__["MediaUpload"], { 5994 onSelect: function onSelect(media) { 5995 return props.setAttributes({ 5996 side_2_photo: media.url 5997 }); 5998 }, 5999 allowedTypes: "image", 6000 value: props.attributes.side2MediaID, 6001 render: function render(_ref3) { 6002 var open = _ref3.open; 6003 return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_6__["Button"], { 6004 isSecondary: true, 6005 onClick: open 6006 }, "Add a photo for side 2 (max. 5Mb)"); 6007 } 6008 }))) : null, props.attributes.soStep == 3 ? Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("div", { 6009 class: "soStep soStep4" 6010 }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("h2", null, "Details"), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("label", { 6011 for: "socategory" 6012 }, "Category *"), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("p", null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("select", { 6013 id: "socategory", 6014 class: props.attributes.showRequired == 3 && !props.attributes.category_uuid ? 'required' : '', 6015 value: props.attributes.category_uuid, 6016 onChange: function onChange(event) { 6017 props.setAttributes({ 6018 category_uuid: event.target.value 6019 }); 6020 } 6021 }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("option", { 6022 value: "" 6023 }), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("option", { 6024 value: "a6840d90-1f50-4e8a-98d0-c1c1c5134a78" 6025 }, "News"), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("option", { 6026 value: "6c806976-e20c-4666-9d33-45896567c155" 6027 }, "Sports"), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("option", { 6028 value: "e5e6883a-6e9c-4b7e-b247-43629ce4a5db" 6029 }, "Life"))), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("label", { 6030 for: "soTags" 6031 }, "Tags"), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("p", null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("textarea", { 6032 type: "text", 6033 id: "soTags", 6034 value: props.attributes.tag_list, 6035 onChange: function onChange(event) { 6036 props.setAttributes({ 6037 tag_list: event.target.value 6038 }); 6039 }, 6040 placeholder: "Comma-separated tags", 6041 maxLength: "100" 6042 })), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("label", { 6043 for: "endDate" 6044 }, "End Date"), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("p", null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("input", { 6045 type: "text", 6046 id: "endDate", 6047 value: props.attributes.end_date, 6048 onFocus: handleEndDateFocus 6049 })), dateTimePickerFocus == true ? Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("div", { 6050 class: "DateTimePicker" 6051 }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_6__["DateTimePicker"], { 6052 currentDate: props.attributes.end_date, 6053 onChange: function onChange(date) { 6054 return props.setAttributes({ 6055 end_date: date 6056 }); 6057 }, 6058 is12Hour: true 6059 }), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_6__["Button"], { 6060 isPrimary: true, 6061 onClick: closeDatePicker 6062 }, "OK")) : null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("label", { 6063 for: "soSize" 6064 }, "Size"), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("div", { 6065 class: "soRadioSizes" 6066 }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("div", null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("i", { 6067 class: "small", 6068 onClick: function onClick(event) { 6069 props.setAttributes({ 6070 soSize: 'small' 6071 }); 6072 } 6073 }), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("input", { 6074 type: "radio", 6075 value: "small", 6076 checked: props.attributes.soSize === 'small', 6077 onChange: function onChange(event) { 6078 props.setAttributes({ 6079 soSize: event.target.value 6080 }); 6081 } 6082 })), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("div", null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("i", { 6083 class: "medium", 6084 onClick: function onClick(event) { 6085 props.setAttributes({ 6086 soSize: 'medium' 6087 }); 6088 } 6089 }), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("input", { 6090 type: "radio", 6091 value: "medium", 6092 checked: props.attributes.soSize === 'medium', 6093 onChange: function onChange(event) { 6094 props.setAttributes({ 6095 soSize: event.target.value 6096 }); 6097 } 6098 })), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("div", null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("i", { 6099 class: "wide", 6100 onClick: function onClick(event) { 6101 props.setAttributes({ 6102 soSize: 'wide' 6103 }); 6104 } 6105 }), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("input", { 6106 type: "radio", 6107 value: "wide", 6108 checked: props.attributes.soSize === 'wide', 6109 onChange: function onChange(event) { 6110 props.setAttributes({ 6111 soSize: event.target.value 6112 }); 6113 } 6114 }))), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("p", null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("i", null, "Small embed does not display the cover photo. By default, the cover photo will be displayed in all other embed sizes, Feeds, and SquareOffs.com."))) : null, props.attributes.soStep == fetchStep ? Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("div", { 6115 class: "soStep soStep5", 6116 id: props.attributes.soStep 6117 }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("p", null, "Please wait while we're creating your SquareOff...")) : null, props.attributes.soStep !== 0 && props.attributes.soStep !== fetchStep && props.attributes.soStep !== finalStep && props.attributes.soStep != 10 ? Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("div", { 6118 class: "btnControls" 6119 }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_6__["Button"], { 6120 isPrimary: true, 6121 onClick: updateSOStep 6122 }, props.attributes.soStep == fetchStep - 1 ? 'Submit' : 'Next'), props.attributes.soStep > 1 ? Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_6__["Button"], { 6123 isSecondary: true, 6124 onClick: backSOStep 6125 }, "Back") : null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_6__["Button"], { 6126 isTertiary: true, 6127 onClick: sOStepCancel 6128 }, "Cancel")) : null)); 6129 } 6130 }); // export default Cropper; 6131 6132 /***/ }), 6133 6134 /***/ "@babel/runtime/regenerator": 6135 /*!**********************************************!*\ 6136 !*** external {"this":"regeneratorRuntime"} ***! 6137 \**********************************************/ 6138 /*! no static exports found */ 6139 /***/ (function(module, exports) { 6140 6141 (function() { module.exports = this["regeneratorRuntime"]; }()); 6142 6143 /***/ }), 6144 6145 /***/ "@wordpress/block-editor": 6146 /*!**********************************************!*\ 6147 !*** external {"this":["wp","blockEditor"]} ***! 6148 \**********************************************/ 6149 /*! no static exports found */ 6150 /***/ (function(module, exports) { 6151 6152 (function() { module.exports = this["wp"]["blockEditor"]; }()); 6153 6154 /***/ }), 6155 6156 /***/ "@wordpress/blocks": 6157 /*!*****************************************!*\ 6158 !*** external {"this":["wp","blocks"]} ***! 6159 \*****************************************/ 6160 /*! no static exports found */ 6161 /***/ (function(module, exports) { 6162 6163 (function() { module.exports = this["wp"]["blocks"]; }()); 6164 6165 /***/ }), 6166 6167 /***/ "@wordpress/components": 6168 /*!*********************************************!*\ 6169 !*** external {"this":["wp","components"]} ***! 6170 \*********************************************/ 6171 /*! no static exports found */ 6172 /***/ (function(module, exports) { 6173 6174 (function() { module.exports = this["wp"]["components"]; }()); 6175 6176 /***/ }), 6177 6178 /***/ "@wordpress/compose": 6179 /*!******************************************!*\ 6180 !*** external {"this":["wp","compose"]} ***! 6181 \******************************************/ 6182 /*! no static exports found */ 6183 /***/ (function(module, exports) { 6184 6185 (function() { module.exports = this["wp"]["compose"]; }()); 6186 6187 /***/ }), 6188 6189 /***/ "@wordpress/date": 6190 /*!***************************************!*\ 6191 !*** external {"this":["wp","date"]} ***! 6192 \***************************************/ 6193 /*! no static exports found */ 6194 /***/ (function(module, exports) { 6195 6196 (function() { module.exports = this["wp"]["date"]; }()); 6197 6198 /***/ }), 6199 6200 /***/ "@wordpress/element": 6201 /*!******************************************!*\ 6202 !*** external {"this":["wp","element"]} ***! 6203 \******************************************/ 6204 /*! no static exports found */ 6205 /***/ (function(module, exports) { 6206 6207 (function() { module.exports = this["wp"]["element"]; }()); 6208 6209 /***/ }), 6210 6211 /***/ "@wordpress/server-side-render": 6212 /*!***************************************************!*\ 6213 !*** external {"this":["wp","serverSideRender"]} ***! 6214 \***************************************************/ 6215 /*! no static exports found */ 6216 /***/ (function(module, exports) { 6217 6218 (function() { module.exports = this["wp"]["serverSideRender"]; }()); 6219 6220 /***/ }), 6221 6222 /***/ "react": 6223 /*!*********************************!*\ 6224 !*** external {"this":"React"} ***! 6225 \*********************************/ 6226 /*! no static exports found */ 6227 /***/ (function(module, exports) { 6228 6229 (function() { module.exports = this["React"]; }()); 6230 6231 /***/ }) 6232 6233 /******/ }); 6234 //# sourceMappingURL=index.js.map -
squareoffs/trunk/build/index.js.map
r2332643 r2339847 1 {"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./node_modules/@babel/runtime/helpers/arrayLikeToArray.js","webpack:///./node_modules/@babel/runtime/helpers/arrayWithHoles.js","webpack:///./node_modules/@babel/runtime/helpers/asyncToGenerator.js","webpack:///./node_modules/@babel/runtime/helpers/iterableToArrayLimit.js","webpack:///./node_modules/@babel/runtime/helpers/nonIterableRest.js","webpack:///./node_modules/@babel/runtime/helpers/slicedToArray.js","webpack:///./node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js","webpack:///./node_modules/cropperjs/dist/cropper.js","webpack:///./node_modules/prop-types/checkPropTypes.js","webpack:///./node_modules/prop-types/factoryWithTypeCheckers.js","webpack:///./node_modules/prop-types/index.js","webpack:///./node_modules/prop-types/lib/ReactPropTypesSecret.js","webpack:///./node_modules/prop-types/node_modules/object-assign/index.js","webpack:///./node_modules/react-cropper/dist/react-cropper.js","webpack:///./node_modules/react-is/cjs/react-is.development.js","webpack:///./node_modules/react-is/index.js","webpack:///./src/index.js","webpack:///external {\"this\":\"regeneratorRuntime\"}","webpack:///external {\"this\":[\"wp\",\"blockEditor\"]}","webpack:///external {\"this\":[\"wp\",\"blocks\"]}","webpack:///external {\"this\":[\"wp\",\"components\"]}","webpack:///external {\"this\":[\"wp\",\"compose\"]}","webpack:///external {\"this\":[\"wp\",\"date\"]}","webpack:///external {\"this\":[\"wp\",\"element\"]}","webpack:///external {\"this\":[\"wp\",\"serverSideRender\"]}","webpack:///external {\"this\":\"React\"}"],"names":["el","React","createElement","cropperRef","createRef","soIcon ","className","width","height","preserveAspectRatio","viewBox","transform","fill","stroke","d","sSmallIcon","sMediumIcon","sWideIcon","registerBlockType","title","icon","category","attributes","soAlignment","type","default","soID","soSize","soStep","question","side_1_title","side_2_title","side_1_defense","side_2_defense","side_1_photo","side_1_photo_raw","side_2_photo","side_2_photo_raw","end_date","category_uuid","tag_list","cover_photo","cover_photo_raw","cover_photo_mime","side1MediaID","side2MediaID","coverPhotoMediaID","showRequired","edit","props","useState","dateTimePickerFocus","setDateTimePickerFocus","createSoStateDone","setCreateSoStateDone","useEffect","console","log","fetchStep","finalStep","handleEndDateFocus","event","preventDefault","stopPropagation","closeDatePicker","updateSOStep","proceed","setAttributes","parseInt","createSquareOffs","form_data","FormData","key","append","fetch","window","ajaxurl","method","body","then","response","json","data","doneCreatingSquareOffs","external_id","backSOStep","sOStepExisting","sOStepCancel","injectSOShortcode","soUpdateSOID","target","value","onChangeAlignment","newAlignment","undefined","changeToSmall","changeToMedium","changeToWide","_crop","current","getCroppedCanvas","toDataURL","soVars","soURL","media","mime","url","open","date","save"],"mappings":";QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;;;;;AClFA;AACA;;AAEA,wCAAwC,SAAS;AACjD;AACA;;AAEA;AACA;;AAEA,mC;;;;;;;;;;;ACVA;AACA;AACA;;AAEA,iC;;;;;;;;;;;ACJA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,KAAK;AACL;AACA;;AAEA,mC;;;;;;;;;;;ACpCA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,6CAA6C,+BAA+B;AAC5E;;AAEA;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;;AAEA,uC;;;;;;;;;;;AC3BA;AACA;AACA;;AAEA,kC;;;;;;;;;;;ACJA,qBAAqB,mBAAO,CAAC,iFAAkB;;AAE/C,2BAA2B,mBAAO,CAAC,6FAAwB;;AAE3D,iCAAiC,mBAAO,CAAC,yGAA8B;;AAEvE,sBAAsB,mBAAO,CAAC,mFAAmB;;AAEjD;AACA;AACA;;AAEA,gC;;;;;;;;;;;ACZA,uBAAuB,mBAAO,CAAC,qFAAoB;;AAEnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,6C;;;;;;;;;;;ACXA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,EAAE,KAA4D;AAC9D,EAAE,SACqD;AACvD,CAAC,oBAAoB;;AAErB;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,mBAAmB,kBAAkB;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA;;AAEA;AACA,mBAAmB,sBAAsB;AACzC;;AAEA;AACA;AACA;AACA,SAAS;AACT,OAAO;AACP;AACA,OAAO;AACP;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,mDAAmD,gBAAgB;;AAEnE;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,4BAA4B;;AAE5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B;;AAE/B;AACA;AACA;AACA;AACA;AACA;AACA,iDAAiD;;AAEjD;AACA,qDAAqD;;AAErD;AACA;AACA,8BAA8B;;AAE9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B;;AAE1B,oCAAoC;;AAEpC;AACA;AACA,gDAAgD;AAChD,wCAAwC;AACxC;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa,EAAE;AACf,eAAe,QAAQ;AACvB;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa,EAAE;AACf,eAAe,QAAQ;AACvB;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa,EAAE;AACf,eAAe,QAAQ;AACvB;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa,EAAE;AACf,eAAe,QAAQ;AACvB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,EAAE;AACf,eAAe,QAAQ;AACvB;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,aAAa,EAAE;AACf,eAAe,QAAQ;AACvB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,EAAE;AACf,eAAe,MAAM;AACrB;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa,EAAE;AACf,aAAa,SAAS;AACtB,eAAe,EAAE;AACjB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa,EAAE;AACf,aAAa,EAAE;AACf,eAAe,OAAO;AACtB;;AAEA;AACA,0FAA0F,aAAa;AACvG;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA,OAAO;AACP;;AAEA;AACA;AACA,sCAAsC,GAAG;AACzC;AACA;AACA,gBAAgB;AAChB,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB,eAAe,OAAO;AACtB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,QAAQ;AACrB,aAAa,OAAO;AACpB;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;AACL;AACA;AACA;AACA,aAAa,QAAQ;AACrB,aAAa,OAAO;AACpB,eAAe,QAAQ;AACvB;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa,QAAQ;AACrB,aAAa,OAAO;AACpB;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,aAAa,QAAQ;AACrB,aAAa,OAAO;AACpB;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,QAAQ;AACrB,aAAa,OAAO;AACpB,aAAa,QAAQ;AACrB;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,OAAO;AACP;AACA,KAAK;;;AAGL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,OAAO;AACpB,eAAe,OAAO;AACtB;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa,QAAQ;AACrB,aAAa,OAAO;AACpB,eAAe,OAAO;AACtB;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa,QAAQ;AACrB,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,aAAa,QAAQ;AACrB,aAAa,OAAO;AACpB;;AAEA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA,4CAA4C;AAC5C;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA,YAAY;AACZ,mBAAmB,QAAQ;AAC3B;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;;AAEA;AACA,GAAG;AACH;AACA;AACA,aAAa,QAAQ;AACrB,aAAa,OAAO;AACpB,aAAa,SAAS;AACtB,aAAa,OAAO;AACpB;;;AAGA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;AACL;AACA;AACA;AACA,aAAa,QAAQ;AACrB,aAAa,OAAO;AACpB,aAAa,SAAS;AACtB,aAAa,OAAO;AACpB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,0DAA0D;;AAE1D;AACA;AACA;;AAEA,gFAAgF,eAAe;AAC/F;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,KAAK;AACL;AACA;AACA;AACA,aAAa,QAAQ;AACrB,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB,eAAe,QAAQ;AACvB;;AAEA;AACA,cAAc;;AAEd;AACA;AACA;AACA;AACA;AACA,OAAO;AACP,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa,QAAQ;AACrB,eAAe,OAAO;AACtB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,OAAO;AACpB,eAAe,QAAQ;AACvB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,OAAO;AACpB,eAAe,OAAO;AACtB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,OAAO;AACpB,eAAe,OAAO;AACtB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,KAAK;;;AAGL;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,OAAO;AACpB,eAAe,OAAO;AACtB;;AAEA;AACA,qCAAqC;;AAErC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,aAAa,OAAO;AACpB,aAAa,QAAQ;AACrB,eAAe,OAAO;AACtB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,aAAa,OAAO;AACpB,eAAe,OAAO;AACtB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB,eAAe,OAAO;AACtB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,OAAO;AACP;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,OAAO;AACpB,eAAe,OAAO;AACtB;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,iBAAiB;AAC9B,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB,eAAe,kBAAkB;AACjC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,qFAAqF;AACrF;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,SAAS;AACtB,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB,eAAe,OAAO;AACtB;;AAEA;AACA;AACA;;AAEA,uBAAuB,YAAY;AACnC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa,OAAO;AACpB,eAAe,YAAY;AAC3B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,aAAa,YAAY;AACzB,aAAa,OAAO;AACpB,eAAe,OAAO;AACtB;;AAEA;AACA,oBAAoB;;AAEpB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,sCAAsC;AACtC;AACA;AACA;AACA,aAAa,YAAY;AACzB,eAAe,OAAO;AACtB;;AAEA;AACA;AACA,oBAAoB;;AAEpB;AACA;AACA;AACA,mBAAmB;;AAEnB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA,mBAAmB,aAAa;AAChC;;AAEA;AACA;AACA;AACA;AACA,2BAA2B;;AAE3B,sEAAsE;;AAEtE;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa,OAAO;AACpB,eAAe,OAAO;AACtB;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,OAAO;AACP;AACA,OAAO;AACP;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC;AACvC,wCAAwC;AACxC,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,WAAW;AACX;AACA,WAAW;AACX;AACA;;AAEA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;;AAEP;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA,oCAAoC;;AAEpC;AACA,gHAAgH;;AAEhH;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC;AACzC,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,6LAA6L;;AAE7L;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,WAAW;AACX;AACA,WAAW;AACX;AACA;;AAEA;AACA;AACA,WAAW;AACX;AACA;AACA,SAAS;;;AAGT;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;;AAEP;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA;AACA,gDAAgD;;AAEhD;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,2CAA2C,gBAAgB,iBAAiB,2BAA2B,4BAA4B,8BAA8B,+BAA+B,sCAAsC;AACtO;AACA;AACA,OAAO;AACP,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,OAAO;AACP,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT,OAAO;AACP;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,8DAA8D;;AAE9D;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA,WAAW;AACX;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA,6BAA6B;;AAE7B;AACA;AACA;;AAEA;AACA;AACA;AACA,OAAO;;AAEP;AACA;AACA,OAAO;AACP;AACA,OAAO;AACP;AACA;;AAEA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT,OAAO;AACP;AACA;AACA;;AAEA;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,OAAO;AACP;AACA,OAAO;;;AAGP;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA;AACA;AACA,iDAAiD;AACjD,SAAS;AACT,OAAO;AACP,mDAAmD;AACnD;;AAEA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT,OAAO;AACP;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;;AAEjB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;;AAEA;AACA;AACA;AACA,eAAe;AACf;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe;AACf;AACA;AACA,aAAa;AACb;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe;AACf;AACA;AACA,aAAa;AACb;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW;AACX;AACA;;AAEA;AACA;AACA;AACA,eAAe;AACf;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW;AACX;AACA;AACA;;AAEA;AACA;AACA,WAAW;;;AAGX;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;;;AAGP;AACA;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,KAAK;AACL;AACA;AACA;AACA,kCAAkC;AAClC,mCAAmC;AACnC,oCAAoC;AACpC;;AAEA;AACA;AACA;AACA;;AAEA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,qCAAqC;;AAErC;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB,eAAe,QAAQ;AACvB,iBAAiB,QAAQ;AACzB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,iBAAiB,QAAQ;AACzB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB,eAAe,MAAM;AACrB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;;AAEA;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,MAAM;AACrB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;;AAEZ;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB,iBAAiB,QAAQ;AACzB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,QAAQ;AACvB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,iBAAiB,OAAO;AACxB;AACA;AACA,mCAAmC;AACnC,KAAK;;AAEL;AACA;AACA,iBAAiB,OAAO;AACxB;AACA;AACA,mCAAmC;AACnC,KAAK;;AAEL;AACA;AACA,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;;AAEA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO,YAAY;AAClC,iBAAiB,kBAAkB;AACnC;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,oFAAoF;;AAEpF;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,OAAO;;AAEP;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,OAAO;;;AAGP;AACA,uCAAuC;;AAEvC;AACA;AACA;AACA,oBAAoB;;AAEpB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;;AAEA,qDAAqD;;AAErD;AACA;AACA;AACA,OAAO;AACP;;;AAGA;AACA;AACA,OAAO;AACP;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB,iBAAiB,QAAQ;AACzB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,OAAO,YAAY;AAClC;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA,8BAA8B;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA,4BAA4B;;AAE5B;AACA,iCAAiC;;AAEjC;AACA;AACA,WAAW;;;AAGX;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,SAAS;;;AAGT;AACA;AACA;AACA,SAAS;;;AAGT;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;;AAEA;AACA,SAAS;AACT;;;AAGA;AACA;AACA;AACA,uBAAuB;AACvB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,UAAU;;;AAGV;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,uCAAuC;AACvC;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW;;;AAGX;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA,2BAA2B;AAC3B;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;;AAEA;AACA,UAAU;;;AAGV;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,oCAAoC;AACpC;;AAEA;AACA,8CAA8C,+BAA+B,8BAA8B,4BAA4B,2BAA2B,eAAe,uBAAuB,WAAW,gBAAgB;AACnO;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,+BAA+B;;AAE/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC;;AAElC,wCAAwC;;AAExC,6DAA6D;;AAE7D;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,WAAW;AACX;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,mBAAmB,QAAQ;AAC3B;;AAEA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,OAAO;AACxB;;AAEA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA,GAAG;;AAEH;;AAEA;;AAEA,CAAC;;;;;;;;;;;;;AC/hHD;AACA;AACA;AACA;AACA;AACA;;AAEa;;AAEb;;AAEA,IAAI,IAAqC;AACzC,6BAA6B,mBAAO,CAAC,yFAA4B;AACjE;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,UAAU;AACrB;AACA;AACA;AACA,MAAM,IAAqC;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4GAA4G;AAC5G;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,2DAA2D;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,IAAqC;AAC3C;AACA;AACA;;AAEA;;;;;;;;;;;;;ACrGA;AACA;AACA;AACA;AACA;AACA;;AAEa;;AAEb,cAAc,mBAAO,CAAC,kDAAU;AAChC,aAAa,mBAAO,CAAC,oFAAe;;AAEpC,2BAA2B,mBAAO,CAAC,yFAA4B;AAC/D,qBAAqB,mBAAO,CAAC,qEAAkB;;AAE/C;AACA;;AAEA,IAAI,IAAqC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,0CAA0C;;AAE1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,QAAQ;AACrB,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV,6BAA6B;AAC7B,QAAQ;AACR;AACA;AACA;AACA;AACA,+BAA+B,KAAK;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,4BAA4B;AAC5B,OAAO;AACP;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,QAAQ,IAAqC;AAC7C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,UAAU,KAAqC;AACxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB,sBAAsB;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,UAAU,IAAqC;AAC/C;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,qBAAqB,2BAA2B;AAChD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,MAAM,KAAqC,4FAA4F,SAAM;AAC7I;AACA;;AAEA,mBAAmB,gCAAgC;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,qBAAqB,gCAAgC;AACrD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;;;;;;;;;;;AC9kBA;AACA;AACA;AACA;AACA;AACA;;AAEA,IAAI,IAAqC;AACzC,gBAAgB,mBAAO,CAAC,kDAAU;;AAElC;AACA;AACA;AACA,mBAAmB,mBAAO,CAAC,uFAA2B;AACtD,CAAC,MAAM,EAIN;;;;;;;;;;;;;AClBD;AACA;AACA;AACA;AACA;AACA;;AAEa;;AAEb;;AAEA;;;;;;;;;;;;;ACXA;AACA;AACA;AACA;AACA;;AAEa;AACb;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,gCAAgC;AAChC;AACA;AACA;AACA;;AAEA;AACA;AACA,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH,kCAAkC;AAClC;AACA;AACA;;AAEA;AACA,EAAE;AACF;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,gBAAgB,sBAAsB;AACtC;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,kBAAkB,oBAAoB;AACtC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;;;;;;;;;;;ACzFa;;AAEb;AACA;AACA,CAAC;AACD;;AAEA,qCAAqC,mBAAO,CAAC,oBAAO;;AAEpD,wCAAwC,mBAAO,CAAC,sDAAY;;AAE5D,wCAAwC,mBAAO,CAAC,2DAAW;;AAE3D,sCAAsC,uCAAuC,gBAAgB;;AAE7F,uCAAuC,6BAA6B,YAAY,EAAE,OAAO,iBAAiB,mBAAmB,uBAAuB,sDAAsD,sHAAsH,4BAA4B,0CAA0C,EAAE,OAAO,wBAAwB,EAAE,EAAE,EAAE,EAAE,sBAAsB,eAAe,EAAE;;AAEtd,uBAAuB,2EAA2E,kCAAkC,mBAAmB,GAAG,EAAE,OAAO,kCAAkC,8HAA8H,GAAG,EAAE,qBAAqB;;AAE7V,2CAA2C,kBAAkB,kCAAkC,qEAAqE,EAAE,EAAE,OAAO,kBAAkB,EAAE,YAAY;;AAE/M,qBAAqB,gDAAgD,gBAAgB,sBAAsB,OAAO,2BAA2B,0BAA0B,yDAAyD,2BAA2B,EAAE,EAAE,EAAE,eAAe,GAAG,wCAAwC;;AAE3T,iDAAiD,0CAA0C,0DAA0D,EAAE;;AAEvJ,2CAA2C,gBAAgB,kBAAkB,OAAO,2BAA2B,wDAAwD,gCAAgC,uDAAuD,2DAA2D,EAAE;;AAE3T,6DAA6D,sEAAsE,8DAA8D,oBAAoB;;AAErN,iDAAiD,0EAA0E,aAAa,EAAE,qCAAqC;;AAE/K,uCAAuC,uBAAuB,uFAAuF,EAAE,aAAa;;AAEpK,6BAA6B,gGAAgG,gDAAgD,GAAG,2BAA2B;;AAE3M,0CAA0C,+DAA+D,2EAA2E,EAAE,yEAAyE,eAAe,sDAAsD,EAAE,EAAE,uDAAuD;;AAE/X,gCAAgC,4EAA4E,iBAAiB,UAAU,GAAG,8BAA8B;;AAExK;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,OAAO;AACP,0BAA0B,iCAAiC;AAC3D,OAAO,IAAI;AACX;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,OAAO;AACP;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA,GAAG;;AAEH;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;AC/YA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEa;;;;AAIb,IAAI,IAAqC;AACzC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0EAA0E;AAC1E;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gDAAgD;;AAEhD;AACA;AACA;AACA,iDAAiD;;AAEjD;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAC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","file":"index.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"./src/index.js\");\n","function _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n\n for (var i = 0, arr2 = new Array(len); i < len; i++) {\n arr2[i] = arr[i];\n }\n\n return arr2;\n}\n\nmodule.exports = _arrayLikeToArray;","function _arrayWithHoles(arr) {\n if (Array.isArray(arr)) return arr;\n}\n\nmodule.exports = _arrayWithHoles;","function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {\n try {\n var info = gen[key](arg);\n var value = info.value;\n } catch (error) {\n reject(error);\n return;\n }\n\n if (info.done) {\n resolve(value);\n } else {\n Promise.resolve(value).then(_next, _throw);\n }\n}\n\nfunction _asyncToGenerator(fn) {\n return function () {\n var self = this,\n args = arguments;\n return new Promise(function (resolve, reject) {\n var gen = fn.apply(self, args);\n\n function _next(value) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value);\n }\n\n function _throw(err) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err);\n }\n\n _next(undefined);\n });\n };\n}\n\nmodule.exports = _asyncToGenerator;","function _iterableToArrayLimit(arr, i) {\n if (typeof Symbol === \"undefined\" || !(Symbol.iterator in Object(arr))) return;\n var _arr = [];\n var _n = true;\n var _d = false;\n var _e = undefined;\n\n try {\n for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {\n _arr.push(_s.value);\n\n if (i && _arr.length === i) break;\n }\n } catch (err) {\n _d = true;\n _e = err;\n } finally {\n try {\n if (!_n && _i[\"return\"] != null) _i[\"return\"]();\n } finally {\n if (_d) throw _e;\n }\n }\n\n return _arr;\n}\n\nmodule.exports = _iterableToArrayLimit;","function _nonIterableRest() {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\n\nmodule.exports = _nonIterableRest;","var arrayWithHoles = require(\"./arrayWithHoles\");\n\nvar iterableToArrayLimit = require(\"./iterableToArrayLimit\");\n\nvar unsupportedIterableToArray = require(\"./unsupportedIterableToArray\");\n\nvar nonIterableRest = require(\"./nonIterableRest\");\n\nfunction _slicedToArray(arr, i) {\n return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest();\n}\n\nmodule.exports = _slicedToArray;","var arrayLikeToArray = require(\"./arrayLikeToArray\");\n\nfunction _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(o);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);\n}\n\nmodule.exports = _unsupportedIterableToArray;","/*!\n * Cropper.js v1.5.6\n * https://fengyuanchen.github.io/cropperjs\n *\n * Copyright 2015-present Chen Fengyuan\n * Released under the MIT license\n *\n * Date: 2019-10-04T04:33:48.372Z\n */\n\n(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n typeof define === 'function' && define.amd ? define(factory) :\n (global = global || self, global.Cropper = factory());\n}(this, function () { 'use strict';\n\n function _typeof(obj) {\n if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n _typeof = function (obj) {\n return typeof obj;\n };\n } else {\n _typeof = function (obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n }\n\n return _typeof(obj);\n }\n\n function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n }\n\n function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n }\n\n function _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n }\n\n function _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n }\n\n function ownKeys(object, enumerableOnly) {\n var keys = Object.keys(object);\n\n if (Object.getOwnPropertySymbols) {\n var symbols = Object.getOwnPropertySymbols(object);\n if (enumerableOnly) symbols = symbols.filter(function (sym) {\n return Object.getOwnPropertyDescriptor(object, sym).enumerable;\n });\n keys.push.apply(keys, symbols);\n }\n\n return keys;\n }\n\n function _objectSpread2(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i] != null ? arguments[i] : {};\n\n if (i % 2) {\n ownKeys(source, true).forEach(function (key) {\n _defineProperty(target, key, source[key]);\n });\n } else if (Object.getOwnPropertyDescriptors) {\n Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));\n } else {\n ownKeys(source).forEach(function (key) {\n Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));\n });\n }\n }\n\n return target;\n }\n\n function _toConsumableArray(arr) {\n return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();\n }\n\n function _arrayWithoutHoles(arr) {\n if (Array.isArray(arr)) {\n for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];\n\n return arr2;\n }\n }\n\n function _iterableToArray(iter) {\n if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === \"[object Arguments]\") return Array.from(iter);\n }\n\n function _nonIterableSpread() {\n throw new TypeError(\"Invalid attempt to spread non-iterable instance\");\n }\n\n var IS_BROWSER = typeof window !== 'undefined' && typeof window.document !== 'undefined';\n var WINDOW = IS_BROWSER ? window : {};\n var IS_TOUCH_DEVICE = IS_BROWSER ? 'ontouchstart' in WINDOW.document.documentElement : false;\n var HAS_POINTER_EVENT = IS_BROWSER ? 'PointerEvent' in WINDOW : false;\n var NAMESPACE = 'cropper'; // Actions\n\n var ACTION_ALL = 'all';\n var ACTION_CROP = 'crop';\n var ACTION_MOVE = 'move';\n var ACTION_ZOOM = 'zoom';\n var ACTION_EAST = 'e';\n var ACTION_WEST = 'w';\n var ACTION_SOUTH = 's';\n var ACTION_NORTH = 'n';\n var ACTION_NORTH_EAST = 'ne';\n var ACTION_NORTH_WEST = 'nw';\n var ACTION_SOUTH_EAST = 'se';\n var ACTION_SOUTH_WEST = 'sw'; // Classes\n\n var CLASS_CROP = \"\".concat(NAMESPACE, \"-crop\");\n var CLASS_DISABLED = \"\".concat(NAMESPACE, \"-disabled\");\n var CLASS_HIDDEN = \"\".concat(NAMESPACE, \"-hidden\");\n var CLASS_HIDE = \"\".concat(NAMESPACE, \"-hide\");\n var CLASS_INVISIBLE = \"\".concat(NAMESPACE, \"-invisible\");\n var CLASS_MODAL = \"\".concat(NAMESPACE, \"-modal\");\n var CLASS_MOVE = \"\".concat(NAMESPACE, \"-move\"); // Data keys\n\n var DATA_ACTION = \"\".concat(NAMESPACE, \"Action\");\n var DATA_PREVIEW = \"\".concat(NAMESPACE, \"Preview\"); // Drag modes\n\n var DRAG_MODE_CROP = 'crop';\n var DRAG_MODE_MOVE = 'move';\n var DRAG_MODE_NONE = 'none'; // Events\n\n var EVENT_CROP = 'crop';\n var EVENT_CROP_END = 'cropend';\n var EVENT_CROP_MOVE = 'cropmove';\n var EVENT_CROP_START = 'cropstart';\n var EVENT_DBLCLICK = 'dblclick';\n var EVENT_TOUCH_START = IS_TOUCH_DEVICE ? 'touchstart' : 'mousedown';\n var EVENT_TOUCH_MOVE = IS_TOUCH_DEVICE ? 'touchmove' : 'mousemove';\n var EVENT_TOUCH_END = IS_TOUCH_DEVICE ? 'touchend touchcancel' : 'mouseup';\n var EVENT_POINTER_DOWN = HAS_POINTER_EVENT ? 'pointerdown' : EVENT_TOUCH_START;\n var EVENT_POINTER_MOVE = HAS_POINTER_EVENT ? 'pointermove' : EVENT_TOUCH_MOVE;\n var EVENT_POINTER_UP = HAS_POINTER_EVENT ? 'pointerup pointercancel' : EVENT_TOUCH_END;\n var EVENT_READY = 'ready';\n var EVENT_RESIZE = 'resize';\n var EVENT_WHEEL = 'wheel';\n var EVENT_ZOOM = 'zoom'; // Mime types\n\n var MIME_TYPE_JPEG = 'image/jpeg'; // RegExps\n\n var REGEXP_ACTIONS = /^e|w|s|n|se|sw|ne|nw|all|crop|move|zoom$/;\n var REGEXP_DATA_URL = /^data:/;\n var REGEXP_DATA_URL_JPEG = /^data:image\\/jpeg;base64,/;\n var REGEXP_TAG_NAME = /^img|canvas$/i; // Misc\n // Inspired by the default width and height of a canvas element.\n\n var MIN_CONTAINER_WIDTH = 200;\n var MIN_CONTAINER_HEIGHT = 100;\n\n var DEFAULTS = {\n // Define the view mode of the cropper\n viewMode: 0,\n // 0, 1, 2, 3\n // Define the dragging mode of the cropper\n dragMode: DRAG_MODE_CROP,\n // 'crop', 'move' or 'none'\n // Define the initial aspect ratio of the crop box\n initialAspectRatio: NaN,\n // Define the aspect ratio of the crop box\n aspectRatio: NaN,\n // An object with the previous cropping result data\n data: null,\n // A selector for adding extra containers to preview\n preview: '',\n // Re-render the cropper when resize the window\n responsive: true,\n // Restore the cropped area after resize the window\n restore: true,\n // Check if the current image is a cross-origin image\n checkCrossOrigin: true,\n // Check the current image's Exif Orientation information\n checkOrientation: true,\n // Show the black modal\n modal: true,\n // Show the dashed lines for guiding\n guides: true,\n // Show the center indicator for guiding\n center: true,\n // Show the white modal to highlight the crop box\n highlight: true,\n // Show the grid background\n background: true,\n // Enable to crop the image automatically when initialize\n autoCrop: true,\n // Define the percentage of automatic cropping area when initializes\n autoCropArea: 0.8,\n // Enable to move the image\n movable: true,\n // Enable to rotate the image\n rotatable: true,\n // Enable to scale the image\n scalable: true,\n // Enable to zoom the image\n zoomable: true,\n // Enable to zoom the image by dragging touch\n zoomOnTouch: true,\n // Enable to zoom the image by wheeling mouse\n zoomOnWheel: true,\n // Define zoom ratio when zoom the image by wheeling mouse\n wheelZoomRatio: 0.1,\n // Enable to move the crop box\n cropBoxMovable: true,\n // Enable to resize the crop box\n cropBoxResizable: true,\n // Toggle drag mode between \"crop\" and \"move\" when click twice on the cropper\n toggleDragModeOnDblclick: true,\n // Size limitation\n minCanvasWidth: 0,\n minCanvasHeight: 0,\n minCropBoxWidth: 0,\n minCropBoxHeight: 0,\n minContainerWidth: 200,\n minContainerHeight: 100,\n // Shortcuts of events\n ready: null,\n cropstart: null,\n cropmove: null,\n cropend: null,\n crop: null,\n zoom: null\n };\n\n var TEMPLATE = '<div class=\"cropper-container\" touch-action=\"none\">' + '<div class=\"cropper-wrap-box\">' + '<div class=\"cropper-canvas\"></div>' + '</div>' + '<div class=\"cropper-drag-box\"></div>' + '<div class=\"cropper-crop-box\">' + '<span class=\"cropper-view-box\"></span>' + '<span class=\"cropper-dashed dashed-h\"></span>' + '<span class=\"cropper-dashed dashed-v\"></span>' + '<span class=\"cropper-center\"></span>' + '<span class=\"cropper-face\"></span>' + '<span class=\"cropper-line line-e\" data-cropper-action=\"e\"></span>' + '<span class=\"cropper-line line-n\" data-cropper-action=\"n\"></span>' + '<span class=\"cropper-line line-w\" data-cropper-action=\"w\"></span>' + '<span class=\"cropper-line line-s\" data-cropper-action=\"s\"></span>' + '<span class=\"cropper-point point-e\" data-cropper-action=\"e\"></span>' + '<span class=\"cropper-point point-n\" data-cropper-action=\"n\"></span>' + '<span class=\"cropper-point point-w\" data-cropper-action=\"w\"></span>' + '<span class=\"cropper-point point-s\" data-cropper-action=\"s\"></span>' + '<span class=\"cropper-point point-ne\" data-cropper-action=\"ne\"></span>' + '<span class=\"cropper-point point-nw\" data-cropper-action=\"nw\"></span>' + '<span class=\"cropper-point point-sw\" data-cropper-action=\"sw\"></span>' + '<span class=\"cropper-point point-se\" data-cropper-action=\"se\"></span>' + '</div>' + '</div>';\n\n /**\n * Check if the given value is not a number.\n */\n\n var isNaN = Number.isNaN || WINDOW.isNaN;\n /**\n * Check if the given value is a number.\n * @param {*} value - The value to check.\n * @returns {boolean} Returns `true` if the given value is a number, else `false`.\n */\n\n function isNumber(value) {\n return typeof value === 'number' && !isNaN(value);\n }\n /**\n * Check if the given value is a positive number.\n * @param {*} value - The value to check.\n * @returns {boolean} Returns `true` if the given value is a positive number, else `false`.\n */\n\n var isPositiveNumber = function isPositiveNumber(value) {\n return value > 0 && value < Infinity;\n };\n /**\n * Check if the given value is undefined.\n * @param {*} value - The value to check.\n * @returns {boolean} Returns `true` if the given value is undefined, else `false`.\n */\n\n function isUndefined(value) {\n return typeof value === 'undefined';\n }\n /**\n * Check if the given value is an object.\n * @param {*} value - The value to check.\n * @returns {boolean} Returns `true` if the given value is an object, else `false`.\n */\n\n function isObject(value) {\n return _typeof(value) === 'object' && value !== null;\n }\n var hasOwnProperty = Object.prototype.hasOwnProperty;\n /**\n * Check if the given value is a plain object.\n * @param {*} value - The value to check.\n * @returns {boolean} Returns `true` if the given value is a plain object, else `false`.\n */\n\n function isPlainObject(value) {\n if (!isObject(value)) {\n return false;\n }\n\n try {\n var _constructor = value.constructor;\n var prototype = _constructor.prototype;\n return _constructor && prototype && hasOwnProperty.call(prototype, 'isPrototypeOf');\n } catch (error) {\n return false;\n }\n }\n /**\n * Check if the given value is a function.\n * @param {*} value - The value to check.\n * @returns {boolean} Returns `true` if the given value is a function, else `false`.\n */\n\n function isFunction(value) {\n return typeof value === 'function';\n }\n var slice = Array.prototype.slice;\n /**\n * Convert array-like or iterable object to an array.\n * @param {*} value - The value to convert.\n * @returns {Array} Returns a new array.\n */\n\n function toArray(value) {\n return Array.from ? Array.from(value) : slice.call(value);\n }\n /**\n * Iterate the given data.\n * @param {*} data - The data to iterate.\n * @param {Function} callback - The process function for each element.\n * @returns {*} The original data.\n */\n\n function forEach(data, callback) {\n if (data && isFunction(callback)) {\n if (Array.isArray(data) || isNumber(data.length)\n /* array-like */\n ) {\n toArray(data).forEach(function (value, key) {\n callback.call(data, value, key, data);\n });\n } else if (isObject(data)) {\n Object.keys(data).forEach(function (key) {\n callback.call(data, data[key], key, data);\n });\n }\n }\n\n return data;\n }\n /**\n * Extend the given object.\n * @param {*} target - The target object to extend.\n * @param {*} args - The rest objects for merging to the target object.\n * @returns {Object} The extended object.\n */\n\n var assign = Object.assign || function assign(target) {\n for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n\n if (isObject(target) && args.length > 0) {\n args.forEach(function (arg) {\n if (isObject(arg)) {\n Object.keys(arg).forEach(function (key) {\n target[key] = arg[key];\n });\n }\n });\n }\n\n return target;\n };\n var REGEXP_DECIMALS = /\\.\\d*(?:0|9){12}\\d*$/;\n /**\n * Normalize decimal number.\n * Check out {@link http://0.30000000000000004.com/}\n * @param {number} value - The value to normalize.\n * @param {number} [times=100000000000] - The times for normalizing.\n * @returns {number} Returns the normalized number.\n */\n\n function normalizeDecimalNumber(value) {\n var times = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 100000000000;\n return REGEXP_DECIMALS.test(value) ? Math.round(value * times) / times : value;\n }\n var REGEXP_SUFFIX = /^width|height|left|top|marginLeft|marginTop$/;\n /**\n * Apply styles to the given element.\n * @param {Element} element - The target element.\n * @param {Object} styles - The styles for applying.\n */\n\n function setStyle(element, styles) {\n var style = element.style;\n forEach(styles, function (value, property) {\n if (REGEXP_SUFFIX.test(property) && isNumber(value)) {\n value = \"\".concat(value, \"px\");\n }\n\n style[property] = value;\n });\n }\n /**\n * Check if the given element has a special class.\n * @param {Element} element - The element to check.\n * @param {string} value - The class to search.\n * @returns {boolean} Returns `true` if the special class was found.\n */\n\n function hasClass(element, value) {\n return element.classList ? element.classList.contains(value) : element.className.indexOf(value) > -1;\n }\n /**\n * Add classes to the given element.\n * @param {Element} element - The target element.\n * @param {string} value - The classes to be added.\n */\n\n function addClass(element, value) {\n if (!value) {\n return;\n }\n\n if (isNumber(element.length)) {\n forEach(element, function (elem) {\n addClass(elem, value);\n });\n return;\n }\n\n if (element.classList) {\n element.classList.add(value);\n return;\n }\n\n var className = element.className.trim();\n\n if (!className) {\n element.className = value;\n } else if (className.indexOf(value) < 0) {\n element.className = \"\".concat(className, \" \").concat(value);\n }\n }\n /**\n * Remove classes from the given element.\n * @param {Element} element - The target element.\n * @param {string} value - The classes to be removed.\n */\n\n function removeClass(element, value) {\n if (!value) {\n return;\n }\n\n if (isNumber(element.length)) {\n forEach(element, function (elem) {\n removeClass(elem, value);\n });\n return;\n }\n\n if (element.classList) {\n element.classList.remove(value);\n return;\n }\n\n if (element.className.indexOf(value) >= 0) {\n element.className = element.className.replace(value, '');\n }\n }\n /**\n * Add or remove classes from the given element.\n * @param {Element} element - The target element.\n * @param {string} value - The classes to be toggled.\n * @param {boolean} added - Add only.\n */\n\n function toggleClass(element, value, added) {\n if (!value) {\n return;\n }\n\n if (isNumber(element.length)) {\n forEach(element, function (elem) {\n toggleClass(elem, value, added);\n });\n return;\n } // IE10-11 doesn't support the second parameter of `classList.toggle`\n\n\n if (added) {\n addClass(element, value);\n } else {\n removeClass(element, value);\n }\n }\n var REGEXP_CAMEL_CASE = /([a-z\\d])([A-Z])/g;\n /**\n * Transform the given string from camelCase to kebab-case\n * @param {string} value - The value to transform.\n * @returns {string} The transformed value.\n */\n\n function toParamCase(value) {\n return value.replace(REGEXP_CAMEL_CASE, '$1-$2').toLowerCase();\n }\n /**\n * Get data from the given element.\n * @param {Element} element - The target element.\n * @param {string} name - The data key to get.\n * @returns {string} The data value.\n */\n\n function getData(element, name) {\n if (isObject(element[name])) {\n return element[name];\n }\n\n if (element.dataset) {\n return element.dataset[name];\n }\n\n return element.getAttribute(\"data-\".concat(toParamCase(name)));\n }\n /**\n * Set data to the given element.\n * @param {Element} element - The target element.\n * @param {string} name - The data key to set.\n * @param {string} data - The data value.\n */\n\n function setData(element, name, data) {\n if (isObject(data)) {\n element[name] = data;\n } else if (element.dataset) {\n element.dataset[name] = data;\n } else {\n element.setAttribute(\"data-\".concat(toParamCase(name)), data);\n }\n }\n /**\n * Remove data from the given element.\n * @param {Element} element - The target element.\n * @param {string} name - The data key to remove.\n */\n\n function removeData(element, name) {\n if (isObject(element[name])) {\n try {\n delete element[name];\n } catch (error) {\n element[name] = undefined;\n }\n } else if (element.dataset) {\n // #128 Safari not allows to delete dataset property\n try {\n delete element.dataset[name];\n } catch (error) {\n element.dataset[name] = undefined;\n }\n } else {\n element.removeAttribute(\"data-\".concat(toParamCase(name)));\n }\n }\n var REGEXP_SPACES = /\\s\\s*/;\n\n var onceSupported = function () {\n var supported = false;\n\n if (IS_BROWSER) {\n var once = false;\n\n var listener = function listener() {};\n\n var options = Object.defineProperty({}, 'once', {\n get: function get() {\n supported = true;\n return once;\n },\n\n /**\n * This setter can fix a `TypeError` in strict mode\n * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Getter_only}\n * @param {boolean} value - The value to set\n */\n set: function set(value) {\n once = value;\n }\n });\n WINDOW.addEventListener('test', listener, options);\n WINDOW.removeEventListener('test', listener, options);\n }\n\n return supported;\n }();\n /**\n * Remove event listener from the target element.\n * @param {Element} element - The event target.\n * @param {string} type - The event type(s).\n * @param {Function} listener - The event listener.\n * @param {Object} options - The event options.\n */\n\n\n function removeListener(element, type, listener) {\n var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};\n var handler = listener;\n type.trim().split(REGEXP_SPACES).forEach(function (event) {\n if (!onceSupported) {\n var listeners = element.listeners;\n\n if (listeners && listeners[event] && listeners[event][listener]) {\n handler = listeners[event][listener];\n delete listeners[event][listener];\n\n if (Object.keys(listeners[event]).length === 0) {\n delete listeners[event];\n }\n\n if (Object.keys(listeners).length === 0) {\n delete element.listeners;\n }\n }\n }\n\n element.removeEventListener(event, handler, options);\n });\n }\n /**\n * Add event listener to the target element.\n * @param {Element} element - The event target.\n * @param {string} type - The event type(s).\n * @param {Function} listener - The event listener.\n * @param {Object} options - The event options.\n */\n\n function addListener(element, type, listener) {\n var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};\n var _handler = listener;\n type.trim().split(REGEXP_SPACES).forEach(function (event) {\n if (options.once && !onceSupported) {\n var _element$listeners = element.listeners,\n listeners = _element$listeners === void 0 ? {} : _element$listeners;\n\n _handler = function handler() {\n delete listeners[event][listener];\n element.removeEventListener(event, _handler, options);\n\n for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n\n listener.apply(element, args);\n };\n\n if (!listeners[event]) {\n listeners[event] = {};\n }\n\n if (listeners[event][listener]) {\n element.removeEventListener(event, listeners[event][listener], options);\n }\n\n listeners[event][listener] = _handler;\n element.listeners = listeners;\n }\n\n element.addEventListener(event, _handler, options);\n });\n }\n /**\n * Dispatch event on the target element.\n * @param {Element} element - The event target.\n * @param {string} type - The event type(s).\n * @param {Object} data - The additional event data.\n * @returns {boolean} Indicate if the event is default prevented or not.\n */\n\n function dispatchEvent(element, type, data) {\n var event; // Event and CustomEvent on IE9-11 are global objects, not constructors\n\n if (isFunction(Event) && isFunction(CustomEvent)) {\n event = new CustomEvent(type, {\n detail: data,\n bubbles: true,\n cancelable: true\n });\n } else {\n event = document.createEvent('CustomEvent');\n event.initCustomEvent(type, true, true, data);\n }\n\n return element.dispatchEvent(event);\n }\n /**\n * Get the offset base on the document.\n * @param {Element} element - The target element.\n * @returns {Object} The offset data.\n */\n\n function getOffset(element) {\n var box = element.getBoundingClientRect();\n return {\n left: box.left + (window.pageXOffset - document.documentElement.clientLeft),\n top: box.top + (window.pageYOffset - document.documentElement.clientTop)\n };\n }\n var location = WINDOW.location;\n var REGEXP_ORIGINS = /^(\\w+:)\\/\\/([^:/?#]*):?(\\d*)/i;\n /**\n * Check if the given URL is a cross origin URL.\n * @param {string} url - The target URL.\n * @returns {boolean} Returns `true` if the given URL is a cross origin URL, else `false`.\n */\n\n function isCrossOriginURL(url) {\n var parts = url.match(REGEXP_ORIGINS);\n return parts !== null && (parts[1] !== location.protocol || parts[2] !== location.hostname || parts[3] !== location.port);\n }\n /**\n * Add timestamp to the given URL.\n * @param {string} url - The target URL.\n * @returns {string} The result URL.\n */\n\n function addTimestamp(url) {\n var timestamp = \"timestamp=\".concat(new Date().getTime());\n return url + (url.indexOf('?') === -1 ? '?' : '&') + timestamp;\n }\n /**\n * Get transforms base on the given object.\n * @param {Object} obj - The target object.\n * @returns {string} A string contains transform values.\n */\n\n function getTransforms(_ref) {\n var rotate = _ref.rotate,\n scaleX = _ref.scaleX,\n scaleY = _ref.scaleY,\n translateX = _ref.translateX,\n translateY = _ref.translateY;\n var values = [];\n\n if (isNumber(translateX) && translateX !== 0) {\n values.push(\"translateX(\".concat(translateX, \"px)\"));\n }\n\n if (isNumber(translateY) && translateY !== 0) {\n values.push(\"translateY(\".concat(translateY, \"px)\"));\n } // Rotate should come first before scale to match orientation transform\n\n\n if (isNumber(rotate) && rotate !== 0) {\n values.push(\"rotate(\".concat(rotate, \"deg)\"));\n }\n\n if (isNumber(scaleX) && scaleX !== 1) {\n values.push(\"scaleX(\".concat(scaleX, \")\"));\n }\n\n if (isNumber(scaleY) && scaleY !== 1) {\n values.push(\"scaleY(\".concat(scaleY, \")\"));\n }\n\n var transform = values.length ? values.join(' ') : 'none';\n return {\n WebkitTransform: transform,\n msTransform: transform,\n transform: transform\n };\n }\n /**\n * Get the max ratio of a group of pointers.\n * @param {string} pointers - The target pointers.\n * @returns {number} The result ratio.\n */\n\n function getMaxZoomRatio(pointers) {\n var pointers2 = _objectSpread2({}, pointers);\n\n var ratios = [];\n forEach(pointers, function (pointer, pointerId) {\n delete pointers2[pointerId];\n forEach(pointers2, function (pointer2) {\n var x1 = Math.abs(pointer.startX - pointer2.startX);\n var y1 = Math.abs(pointer.startY - pointer2.startY);\n var x2 = Math.abs(pointer.endX - pointer2.endX);\n var y2 = Math.abs(pointer.endY - pointer2.endY);\n var z1 = Math.sqrt(x1 * x1 + y1 * y1);\n var z2 = Math.sqrt(x2 * x2 + y2 * y2);\n var ratio = (z2 - z1) / z1;\n ratios.push(ratio);\n });\n });\n ratios.sort(function (a, b) {\n return Math.abs(a) < Math.abs(b);\n });\n return ratios[0];\n }\n /**\n * Get a pointer from an event object.\n * @param {Object} event - The target event object.\n * @param {boolean} endOnly - Indicates if only returns the end point coordinate or not.\n * @returns {Object} The result pointer contains start and/or end point coordinates.\n */\n\n function getPointer(_ref2, endOnly) {\n var pageX = _ref2.pageX,\n pageY = _ref2.pageY;\n var end = {\n endX: pageX,\n endY: pageY\n };\n return endOnly ? end : _objectSpread2({\n startX: pageX,\n startY: pageY\n }, end);\n }\n /**\n * Get the center point coordinate of a group of pointers.\n * @param {Object} pointers - The target pointers.\n * @returns {Object} The center point coordinate.\n */\n\n function getPointersCenter(pointers) {\n var pageX = 0;\n var pageY = 0;\n var count = 0;\n forEach(pointers, function (_ref3) {\n var startX = _ref3.startX,\n startY = _ref3.startY;\n pageX += startX;\n pageY += startY;\n count += 1;\n });\n pageX /= count;\n pageY /= count;\n return {\n pageX: pageX,\n pageY: pageY\n };\n }\n /**\n * Get the max sizes in a rectangle under the given aspect ratio.\n * @param {Object} data - The original sizes.\n * @param {string} [type='contain'] - The adjust type.\n * @returns {Object} The result sizes.\n */\n\n function getAdjustedSizes(_ref4) // or 'cover'\n {\n var aspectRatio = _ref4.aspectRatio,\n height = _ref4.height,\n width = _ref4.width;\n var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'contain';\n var isValidWidth = isPositiveNumber(width);\n var isValidHeight = isPositiveNumber(height);\n\n if (isValidWidth && isValidHeight) {\n var adjustedWidth = height * aspectRatio;\n\n if (type === 'contain' && adjustedWidth > width || type === 'cover' && adjustedWidth < width) {\n height = width / aspectRatio;\n } else {\n width = height * aspectRatio;\n }\n } else if (isValidWidth) {\n height = width / aspectRatio;\n } else if (isValidHeight) {\n width = height * aspectRatio;\n }\n\n return {\n width: width,\n height: height\n };\n }\n /**\n * Get the new sizes of a rectangle after rotated.\n * @param {Object} data - The original sizes.\n * @returns {Object} The result sizes.\n */\n\n function getRotatedSizes(_ref5) {\n var width = _ref5.width,\n height = _ref5.height,\n degree = _ref5.degree;\n degree = Math.abs(degree) % 180;\n\n if (degree === 90) {\n return {\n width: height,\n height: width\n };\n }\n\n var arc = degree % 90 * Math.PI / 180;\n var sinArc = Math.sin(arc);\n var cosArc = Math.cos(arc);\n var newWidth = width * cosArc + height * sinArc;\n var newHeight = width * sinArc + height * cosArc;\n return degree > 90 ? {\n width: newHeight,\n height: newWidth\n } : {\n width: newWidth,\n height: newHeight\n };\n }\n /**\n * Get a canvas which drew the given image.\n * @param {HTMLImageElement} image - The image for drawing.\n * @param {Object} imageData - The image data.\n * @param {Object} canvasData - The canvas data.\n * @param {Object} options - The options.\n * @returns {HTMLCanvasElement} The result canvas.\n */\n\n function getSourceCanvas(image, _ref6, _ref7, _ref8) {\n var imageAspectRatio = _ref6.aspectRatio,\n imageNaturalWidth = _ref6.naturalWidth,\n imageNaturalHeight = _ref6.naturalHeight,\n _ref6$rotate = _ref6.rotate,\n rotate = _ref6$rotate === void 0 ? 0 : _ref6$rotate,\n _ref6$scaleX = _ref6.scaleX,\n scaleX = _ref6$scaleX === void 0 ? 1 : _ref6$scaleX,\n _ref6$scaleY = _ref6.scaleY,\n scaleY = _ref6$scaleY === void 0 ? 1 : _ref6$scaleY;\n var aspectRatio = _ref7.aspectRatio,\n naturalWidth = _ref7.naturalWidth,\n naturalHeight = _ref7.naturalHeight;\n var _ref8$fillColor = _ref8.fillColor,\n fillColor = _ref8$fillColor === void 0 ? 'transparent' : _ref8$fillColor,\n _ref8$imageSmoothingE = _ref8.imageSmoothingEnabled,\n imageSmoothingEnabled = _ref8$imageSmoothingE === void 0 ? true : _ref8$imageSmoothingE,\n _ref8$imageSmoothingQ = _ref8.imageSmoothingQuality,\n imageSmoothingQuality = _ref8$imageSmoothingQ === void 0 ? 'low' : _ref8$imageSmoothingQ,\n _ref8$maxWidth = _ref8.maxWidth,\n maxWidth = _ref8$maxWidth === void 0 ? Infinity : _ref8$maxWidth,\n _ref8$maxHeight = _ref8.maxHeight,\n maxHeight = _ref8$maxHeight === void 0 ? Infinity : _ref8$maxHeight,\n _ref8$minWidth = _ref8.minWidth,\n minWidth = _ref8$minWidth === void 0 ? 0 : _ref8$minWidth,\n _ref8$minHeight = _ref8.minHeight,\n minHeight = _ref8$minHeight === void 0 ? 0 : _ref8$minHeight;\n var canvas = document.createElement('canvas');\n var context = canvas.getContext('2d');\n var maxSizes = getAdjustedSizes({\n aspectRatio: aspectRatio,\n width: maxWidth,\n height: maxHeight\n });\n var minSizes = getAdjustedSizes({\n aspectRatio: aspectRatio,\n width: minWidth,\n height: minHeight\n }, 'cover');\n var width = Math.min(maxSizes.width, Math.max(minSizes.width, naturalWidth));\n var height = Math.min(maxSizes.height, Math.max(minSizes.height, naturalHeight)); // Note: should always use image's natural sizes for drawing as\n // imageData.naturalWidth === canvasData.naturalHeight when rotate % 180 === 90\n\n var destMaxSizes = getAdjustedSizes({\n aspectRatio: imageAspectRatio,\n width: maxWidth,\n height: maxHeight\n });\n var destMinSizes = getAdjustedSizes({\n aspectRatio: imageAspectRatio,\n width: minWidth,\n height: minHeight\n }, 'cover');\n var destWidth = Math.min(destMaxSizes.width, Math.max(destMinSizes.width, imageNaturalWidth));\n var destHeight = Math.min(destMaxSizes.height, Math.max(destMinSizes.height, imageNaturalHeight));\n var params = [-destWidth / 2, -destHeight / 2, destWidth, destHeight];\n canvas.width = normalizeDecimalNumber(width);\n canvas.height = normalizeDecimalNumber(height);\n context.fillStyle = fillColor;\n context.fillRect(0, 0, width, height);\n context.save();\n context.translate(width / 2, height / 2);\n context.rotate(rotate * Math.PI / 180);\n context.scale(scaleX, scaleY);\n context.imageSmoothingEnabled = imageSmoothingEnabled;\n context.imageSmoothingQuality = imageSmoothingQuality;\n context.drawImage.apply(context, [image].concat(_toConsumableArray(params.map(function (param) {\n return Math.floor(normalizeDecimalNumber(param));\n }))));\n context.restore();\n return canvas;\n }\n var fromCharCode = String.fromCharCode;\n /**\n * Get string from char code in data view.\n * @param {DataView} dataView - The data view for read.\n * @param {number} start - The start index.\n * @param {number} length - The read length.\n * @returns {string} The read result.\n */\n\n function getStringFromCharCode(dataView, start, length) {\n var str = '';\n length += start;\n\n for (var i = start; i < length; i += 1) {\n str += fromCharCode(dataView.getUint8(i));\n }\n\n return str;\n }\n var REGEXP_DATA_URL_HEAD = /^data:.*,/;\n /**\n * Transform Data URL to array buffer.\n * @param {string} dataURL - The Data URL to transform.\n * @returns {ArrayBuffer} The result array buffer.\n */\n\n function dataURLToArrayBuffer(dataURL) {\n var base64 = dataURL.replace(REGEXP_DATA_URL_HEAD, '');\n var binary = atob(base64);\n var arrayBuffer = new ArrayBuffer(binary.length);\n var uint8 = new Uint8Array(arrayBuffer);\n forEach(uint8, function (value, i) {\n uint8[i] = binary.charCodeAt(i);\n });\n return arrayBuffer;\n }\n /**\n * Transform array buffer to Data URL.\n * @param {ArrayBuffer} arrayBuffer - The array buffer to transform.\n * @param {string} mimeType - The mime type of the Data URL.\n * @returns {string} The result Data URL.\n */\n\n function arrayBufferToDataURL(arrayBuffer, mimeType) {\n var chunks = []; // Chunk Typed Array for better performance (#435)\n\n var chunkSize = 8192;\n var uint8 = new Uint8Array(arrayBuffer);\n\n while (uint8.length > 0) {\n // XXX: Babel's `toConsumableArray` helper will throw error in IE or Safari 9\n // eslint-disable-next-line prefer-spread\n chunks.push(fromCharCode.apply(null, toArray(uint8.subarray(0, chunkSize))));\n uint8 = uint8.subarray(chunkSize);\n }\n\n return \"data:\".concat(mimeType, \";base64,\").concat(btoa(chunks.join('')));\n }\n /**\n * Get orientation value from given array buffer.\n * @param {ArrayBuffer} arrayBuffer - The array buffer to read.\n * @returns {number} The read orientation value.\n */\n\n function resetAndGetOrientation(arrayBuffer) {\n var dataView = new DataView(arrayBuffer);\n var orientation; // Ignores range error when the image does not have correct Exif information\n\n try {\n var littleEndian;\n var app1Start;\n var ifdStart; // Only handle JPEG image (start by 0xFFD8)\n\n if (dataView.getUint8(0) === 0xFF && dataView.getUint8(1) === 0xD8) {\n var length = dataView.byteLength;\n var offset = 2;\n\n while (offset + 1 < length) {\n if (dataView.getUint8(offset) === 0xFF && dataView.getUint8(offset + 1) === 0xE1) {\n app1Start = offset;\n break;\n }\n\n offset += 1;\n }\n }\n\n if (app1Start) {\n var exifIDCode = app1Start + 4;\n var tiffOffset = app1Start + 10;\n\n if (getStringFromCharCode(dataView, exifIDCode, 4) === 'Exif') {\n var endianness = dataView.getUint16(tiffOffset);\n littleEndian = endianness === 0x4949;\n\n if (littleEndian || endianness === 0x4D4D\n /* bigEndian */\n ) {\n if (dataView.getUint16(tiffOffset + 2, littleEndian) === 0x002A) {\n var firstIFDOffset = dataView.getUint32(tiffOffset + 4, littleEndian);\n\n if (firstIFDOffset >= 0x00000008) {\n ifdStart = tiffOffset + firstIFDOffset;\n }\n }\n }\n }\n }\n\n if (ifdStart) {\n var _length = dataView.getUint16(ifdStart, littleEndian);\n\n var _offset;\n\n var i;\n\n for (i = 0; i < _length; i += 1) {\n _offset = ifdStart + i * 12 + 2;\n\n if (dataView.getUint16(_offset, littleEndian) === 0x0112\n /* Orientation */\n ) {\n // 8 is the offset of the current tag's value\n _offset += 8; // Get the original orientation value\n\n orientation = dataView.getUint16(_offset, littleEndian); // Override the orientation with its default value\n\n dataView.setUint16(_offset, 1, littleEndian);\n break;\n }\n }\n }\n } catch (error) {\n orientation = 1;\n }\n\n return orientation;\n }\n /**\n * Parse Exif Orientation value.\n * @param {number} orientation - The orientation to parse.\n * @returns {Object} The parsed result.\n */\n\n function parseOrientation(orientation) {\n var rotate = 0;\n var scaleX = 1;\n var scaleY = 1;\n\n switch (orientation) {\n // Flip horizontal\n case 2:\n scaleX = -1;\n break;\n // Rotate left 180°\n\n case 3:\n rotate = -180;\n break;\n // Flip vertical\n\n case 4:\n scaleY = -1;\n break;\n // Flip vertical and rotate right 90°\n\n case 5:\n rotate = 90;\n scaleY = -1;\n break;\n // Rotate right 90°\n\n case 6:\n rotate = 90;\n break;\n // Flip horizontal and rotate right 90°\n\n case 7:\n rotate = 90;\n scaleX = -1;\n break;\n // Rotate left 90°\n\n case 8:\n rotate = -90;\n break;\n\n default:\n }\n\n return {\n rotate: rotate,\n scaleX: scaleX,\n scaleY: scaleY\n };\n }\n\n var render = {\n render: function render() {\n this.initContainer();\n this.initCanvas();\n this.initCropBox();\n this.renderCanvas();\n\n if (this.cropped) {\n this.renderCropBox();\n }\n },\n initContainer: function initContainer() {\n var element = this.element,\n options = this.options,\n container = this.container,\n cropper = this.cropper;\n addClass(cropper, CLASS_HIDDEN);\n removeClass(element, CLASS_HIDDEN);\n var containerData = {\n width: Math.max(container.offsetWidth, Number(options.minContainerWidth) || 200),\n height: Math.max(container.offsetHeight, Number(options.minContainerHeight) || 100)\n };\n this.containerData = containerData;\n setStyle(cropper, {\n width: containerData.width,\n height: containerData.height\n });\n addClass(element, CLASS_HIDDEN);\n removeClass(cropper, CLASS_HIDDEN);\n },\n // Canvas (image wrapper)\n initCanvas: function initCanvas() {\n var containerData = this.containerData,\n imageData = this.imageData;\n var viewMode = this.options.viewMode;\n var rotated = Math.abs(imageData.rotate) % 180 === 90;\n var naturalWidth = rotated ? imageData.naturalHeight : imageData.naturalWidth;\n var naturalHeight = rotated ? imageData.naturalWidth : imageData.naturalHeight;\n var aspectRatio = naturalWidth / naturalHeight;\n var canvasWidth = containerData.width;\n var canvasHeight = containerData.height;\n\n if (containerData.height * aspectRatio > containerData.width) {\n if (viewMode === 3) {\n canvasWidth = containerData.height * aspectRatio;\n } else {\n canvasHeight = containerData.width / aspectRatio;\n }\n } else if (viewMode === 3) {\n canvasHeight = containerData.width / aspectRatio;\n } else {\n canvasWidth = containerData.height * aspectRatio;\n }\n\n var canvasData = {\n aspectRatio: aspectRatio,\n naturalWidth: naturalWidth,\n naturalHeight: naturalHeight,\n width: canvasWidth,\n height: canvasHeight\n };\n canvasData.left = (containerData.width - canvasWidth) / 2;\n canvasData.top = (containerData.height - canvasHeight) / 2;\n canvasData.oldLeft = canvasData.left;\n canvasData.oldTop = canvasData.top;\n this.canvasData = canvasData;\n this.limited = viewMode === 1 || viewMode === 2;\n this.limitCanvas(true, true);\n this.initialImageData = assign({}, imageData);\n this.initialCanvasData = assign({}, canvasData);\n },\n limitCanvas: function limitCanvas(sizeLimited, positionLimited) {\n var options = this.options,\n containerData = this.containerData,\n canvasData = this.canvasData,\n cropBoxData = this.cropBoxData;\n var viewMode = options.viewMode;\n var aspectRatio = canvasData.aspectRatio;\n var cropped = this.cropped && cropBoxData;\n\n if (sizeLimited) {\n var minCanvasWidth = Number(options.minCanvasWidth) || 0;\n var minCanvasHeight = Number(options.minCanvasHeight) || 0;\n\n if (viewMode > 1) {\n minCanvasWidth = Math.max(minCanvasWidth, containerData.width);\n minCanvasHeight = Math.max(minCanvasHeight, containerData.height);\n\n if (viewMode === 3) {\n if (minCanvasHeight * aspectRatio > minCanvasWidth) {\n minCanvasWidth = minCanvasHeight * aspectRatio;\n } else {\n minCanvasHeight = minCanvasWidth / aspectRatio;\n }\n }\n } else if (viewMode > 0) {\n if (minCanvasWidth) {\n minCanvasWidth = Math.max(minCanvasWidth, cropped ? cropBoxData.width : 0);\n } else if (minCanvasHeight) {\n minCanvasHeight = Math.max(minCanvasHeight, cropped ? cropBoxData.height : 0);\n } else if (cropped) {\n minCanvasWidth = cropBoxData.width;\n minCanvasHeight = cropBoxData.height;\n\n if (minCanvasHeight * aspectRatio > minCanvasWidth) {\n minCanvasWidth = minCanvasHeight * aspectRatio;\n } else {\n minCanvasHeight = minCanvasWidth / aspectRatio;\n }\n }\n }\n\n var _getAdjustedSizes = getAdjustedSizes({\n aspectRatio: aspectRatio,\n width: minCanvasWidth,\n height: minCanvasHeight\n });\n\n minCanvasWidth = _getAdjustedSizes.width;\n minCanvasHeight = _getAdjustedSizes.height;\n canvasData.minWidth = minCanvasWidth;\n canvasData.minHeight = minCanvasHeight;\n canvasData.maxWidth = Infinity;\n canvasData.maxHeight = Infinity;\n }\n\n if (positionLimited) {\n if (viewMode > (cropped ? 0 : 1)) {\n var newCanvasLeft = containerData.width - canvasData.width;\n var newCanvasTop = containerData.height - canvasData.height;\n canvasData.minLeft = Math.min(0, newCanvasLeft);\n canvasData.minTop = Math.min(0, newCanvasTop);\n canvasData.maxLeft = Math.max(0, newCanvasLeft);\n canvasData.maxTop = Math.max(0, newCanvasTop);\n\n if (cropped && this.limited) {\n canvasData.minLeft = Math.min(cropBoxData.left, cropBoxData.left + (cropBoxData.width - canvasData.width));\n canvasData.minTop = Math.min(cropBoxData.top, cropBoxData.top + (cropBoxData.height - canvasData.height));\n canvasData.maxLeft = cropBoxData.left;\n canvasData.maxTop = cropBoxData.top;\n\n if (viewMode === 2) {\n if (canvasData.width >= containerData.width) {\n canvasData.minLeft = Math.min(0, newCanvasLeft);\n canvasData.maxLeft = Math.max(0, newCanvasLeft);\n }\n\n if (canvasData.height >= containerData.height) {\n canvasData.minTop = Math.min(0, newCanvasTop);\n canvasData.maxTop = Math.max(0, newCanvasTop);\n }\n }\n }\n } else {\n canvasData.minLeft = -canvasData.width;\n canvasData.minTop = -canvasData.height;\n canvasData.maxLeft = containerData.width;\n canvasData.maxTop = containerData.height;\n }\n }\n },\n renderCanvas: function renderCanvas(changed, transformed) {\n var canvasData = this.canvasData,\n imageData = this.imageData;\n\n if (transformed) {\n var _getRotatedSizes = getRotatedSizes({\n width: imageData.naturalWidth * Math.abs(imageData.scaleX || 1),\n height: imageData.naturalHeight * Math.abs(imageData.scaleY || 1),\n degree: imageData.rotate || 0\n }),\n naturalWidth = _getRotatedSizes.width,\n naturalHeight = _getRotatedSizes.height;\n\n var width = canvasData.width * (naturalWidth / canvasData.naturalWidth);\n var height = canvasData.height * (naturalHeight / canvasData.naturalHeight);\n canvasData.left -= (width - canvasData.width) / 2;\n canvasData.top -= (height - canvasData.height) / 2;\n canvasData.width = width;\n canvasData.height = height;\n canvasData.aspectRatio = naturalWidth / naturalHeight;\n canvasData.naturalWidth = naturalWidth;\n canvasData.naturalHeight = naturalHeight;\n this.limitCanvas(true, false);\n }\n\n if (canvasData.width > canvasData.maxWidth || canvasData.width < canvasData.minWidth) {\n canvasData.left = canvasData.oldLeft;\n }\n\n if (canvasData.height > canvasData.maxHeight || canvasData.height < canvasData.minHeight) {\n canvasData.top = canvasData.oldTop;\n }\n\n canvasData.width = Math.min(Math.max(canvasData.width, canvasData.minWidth), canvasData.maxWidth);\n canvasData.height = Math.min(Math.max(canvasData.height, canvasData.minHeight), canvasData.maxHeight);\n this.limitCanvas(false, true);\n canvasData.left = Math.min(Math.max(canvasData.left, canvasData.minLeft), canvasData.maxLeft);\n canvasData.top = Math.min(Math.max(canvasData.top, canvasData.minTop), canvasData.maxTop);\n canvasData.oldLeft = canvasData.left;\n canvasData.oldTop = canvasData.top;\n setStyle(this.canvas, assign({\n width: canvasData.width,\n height: canvasData.height\n }, getTransforms({\n translateX: canvasData.left,\n translateY: canvasData.top\n })));\n this.renderImage(changed);\n\n if (this.cropped && this.limited) {\n this.limitCropBox(true, true);\n }\n },\n renderImage: function renderImage(changed) {\n var canvasData = this.canvasData,\n imageData = this.imageData;\n var width = imageData.naturalWidth * (canvasData.width / canvasData.naturalWidth);\n var height = imageData.naturalHeight * (canvasData.height / canvasData.naturalHeight);\n assign(imageData, {\n width: width,\n height: height,\n left: (canvasData.width - width) / 2,\n top: (canvasData.height - height) / 2\n });\n setStyle(this.image, assign({\n width: imageData.width,\n height: imageData.height\n }, getTransforms(assign({\n translateX: imageData.left,\n translateY: imageData.top\n }, imageData))));\n\n if (changed) {\n this.output();\n }\n },\n initCropBox: function initCropBox() {\n var options = this.options,\n canvasData = this.canvasData;\n var aspectRatio = options.aspectRatio || options.initialAspectRatio;\n var autoCropArea = Number(options.autoCropArea) || 0.8;\n var cropBoxData = {\n width: canvasData.width,\n height: canvasData.height\n };\n\n if (aspectRatio) {\n if (canvasData.height * aspectRatio > canvasData.width) {\n cropBoxData.height = cropBoxData.width / aspectRatio;\n } else {\n cropBoxData.width = cropBoxData.height * aspectRatio;\n }\n }\n\n this.cropBoxData = cropBoxData;\n this.limitCropBox(true, true); // Initialize auto crop area\n\n cropBoxData.width = Math.min(Math.max(cropBoxData.width, cropBoxData.minWidth), cropBoxData.maxWidth);\n cropBoxData.height = Math.min(Math.max(cropBoxData.height, cropBoxData.minHeight), cropBoxData.maxHeight); // The width/height of auto crop area must large than \"minWidth/Height\"\n\n cropBoxData.width = Math.max(cropBoxData.minWidth, cropBoxData.width * autoCropArea);\n cropBoxData.height = Math.max(cropBoxData.minHeight, cropBoxData.height * autoCropArea);\n cropBoxData.left = canvasData.left + (canvasData.width - cropBoxData.width) / 2;\n cropBoxData.top = canvasData.top + (canvasData.height - cropBoxData.height) / 2;\n cropBoxData.oldLeft = cropBoxData.left;\n cropBoxData.oldTop = cropBoxData.top;\n this.initialCropBoxData = assign({}, cropBoxData);\n },\n limitCropBox: function limitCropBox(sizeLimited, positionLimited) {\n var options = this.options,\n containerData = this.containerData,\n canvasData = this.canvasData,\n cropBoxData = this.cropBoxData,\n limited = this.limited;\n var aspectRatio = options.aspectRatio;\n\n if (sizeLimited) {\n var minCropBoxWidth = Number(options.minCropBoxWidth) || 0;\n var minCropBoxHeight = Number(options.minCropBoxHeight) || 0;\n var maxCropBoxWidth = limited ? Math.min(containerData.width, canvasData.width, canvasData.width + canvasData.left, containerData.width - canvasData.left) : containerData.width;\n var maxCropBoxHeight = limited ? Math.min(containerData.height, canvasData.height, canvasData.height + canvasData.top, containerData.height - canvasData.top) : containerData.height; // The min/maxCropBoxWidth/Height must be less than container's width/height\n\n minCropBoxWidth = Math.min(minCropBoxWidth, containerData.width);\n minCropBoxHeight = Math.min(minCropBoxHeight, containerData.height);\n\n if (aspectRatio) {\n if (minCropBoxWidth && minCropBoxHeight) {\n if (minCropBoxHeight * aspectRatio > minCropBoxWidth) {\n minCropBoxHeight = minCropBoxWidth / aspectRatio;\n } else {\n minCropBoxWidth = minCropBoxHeight * aspectRatio;\n }\n } else if (minCropBoxWidth) {\n minCropBoxHeight = minCropBoxWidth / aspectRatio;\n } else if (minCropBoxHeight) {\n minCropBoxWidth = minCropBoxHeight * aspectRatio;\n }\n\n if (maxCropBoxHeight * aspectRatio > maxCropBoxWidth) {\n maxCropBoxHeight = maxCropBoxWidth / aspectRatio;\n } else {\n maxCropBoxWidth = maxCropBoxHeight * aspectRatio;\n }\n } // The minWidth/Height must be less than maxWidth/Height\n\n\n cropBoxData.minWidth = Math.min(minCropBoxWidth, maxCropBoxWidth);\n cropBoxData.minHeight = Math.min(minCropBoxHeight, maxCropBoxHeight);\n cropBoxData.maxWidth = maxCropBoxWidth;\n cropBoxData.maxHeight = maxCropBoxHeight;\n }\n\n if (positionLimited) {\n if (limited) {\n cropBoxData.minLeft = Math.max(0, canvasData.left);\n cropBoxData.minTop = Math.max(0, canvasData.top);\n cropBoxData.maxLeft = Math.min(containerData.width, canvasData.left + canvasData.width) - cropBoxData.width;\n cropBoxData.maxTop = Math.min(containerData.height, canvasData.top + canvasData.height) - cropBoxData.height;\n } else {\n cropBoxData.minLeft = 0;\n cropBoxData.minTop = 0;\n cropBoxData.maxLeft = containerData.width - cropBoxData.width;\n cropBoxData.maxTop = containerData.height - cropBoxData.height;\n }\n }\n },\n renderCropBox: function renderCropBox() {\n var options = this.options,\n containerData = this.containerData,\n cropBoxData = this.cropBoxData;\n\n if (cropBoxData.width > cropBoxData.maxWidth || cropBoxData.width < cropBoxData.minWidth) {\n cropBoxData.left = cropBoxData.oldLeft;\n }\n\n if (cropBoxData.height > cropBoxData.maxHeight || cropBoxData.height < cropBoxData.minHeight) {\n cropBoxData.top = cropBoxData.oldTop;\n }\n\n cropBoxData.width = Math.min(Math.max(cropBoxData.width, cropBoxData.minWidth), cropBoxData.maxWidth);\n cropBoxData.height = Math.min(Math.max(cropBoxData.height, cropBoxData.minHeight), cropBoxData.maxHeight);\n this.limitCropBox(false, true);\n cropBoxData.left = Math.min(Math.max(cropBoxData.left, cropBoxData.minLeft), cropBoxData.maxLeft);\n cropBoxData.top = Math.min(Math.max(cropBoxData.top, cropBoxData.minTop), cropBoxData.maxTop);\n cropBoxData.oldLeft = cropBoxData.left;\n cropBoxData.oldTop = cropBoxData.top;\n\n if (options.movable && options.cropBoxMovable) {\n // Turn to move the canvas when the crop box is equal to the container\n setData(this.face, DATA_ACTION, cropBoxData.width >= containerData.width && cropBoxData.height >= containerData.height ? ACTION_MOVE : ACTION_ALL);\n }\n\n setStyle(this.cropBox, assign({\n width: cropBoxData.width,\n height: cropBoxData.height\n }, getTransforms({\n translateX: cropBoxData.left,\n translateY: cropBoxData.top\n })));\n\n if (this.cropped && this.limited) {\n this.limitCanvas(true, true);\n }\n\n if (!this.disabled) {\n this.output();\n }\n },\n output: function output() {\n this.preview();\n dispatchEvent(this.element, EVENT_CROP, this.getData());\n }\n };\n\n var preview = {\n initPreview: function initPreview() {\n var element = this.element,\n crossOrigin = this.crossOrigin;\n var preview = this.options.preview;\n var url = crossOrigin ? this.crossOriginUrl : this.url;\n var alt = element.alt || 'The image to preview';\n var image = document.createElement('img');\n\n if (crossOrigin) {\n image.crossOrigin = crossOrigin;\n }\n\n image.src = url;\n image.alt = alt;\n this.viewBox.appendChild(image);\n this.viewBoxImage = image;\n\n if (!preview) {\n return;\n }\n\n var previews = preview;\n\n if (typeof preview === 'string') {\n previews = element.ownerDocument.querySelectorAll(preview);\n } else if (preview.querySelector) {\n previews = [preview];\n }\n\n this.previews = previews;\n forEach(previews, function (el) {\n var img = document.createElement('img'); // Save the original size for recover\n\n setData(el, DATA_PREVIEW, {\n width: el.offsetWidth,\n height: el.offsetHeight,\n html: el.innerHTML\n });\n\n if (crossOrigin) {\n img.crossOrigin = crossOrigin;\n }\n\n img.src = url;\n img.alt = alt;\n /**\n * Override img element styles\n * Add `display:block` to avoid margin top issue\n * Add `height:auto` to override `height` attribute on IE8\n * (Occur only when margin-top <= -height)\n */\n\n img.style.cssText = 'display:block;' + 'width:100%;' + 'height:auto;' + 'min-width:0!important;' + 'min-height:0!important;' + 'max-width:none!important;' + 'max-height:none!important;' + 'image-orientation:0deg!important;\"';\n el.innerHTML = '';\n el.appendChild(img);\n });\n },\n resetPreview: function resetPreview() {\n forEach(this.previews, function (element) {\n var data = getData(element, DATA_PREVIEW);\n setStyle(element, {\n width: data.width,\n height: data.height\n });\n element.innerHTML = data.html;\n removeData(element, DATA_PREVIEW);\n });\n },\n preview: function preview() {\n var imageData = this.imageData,\n canvasData = this.canvasData,\n cropBoxData = this.cropBoxData;\n var cropBoxWidth = cropBoxData.width,\n cropBoxHeight = cropBoxData.height;\n var width = imageData.width,\n height = imageData.height;\n var left = cropBoxData.left - canvasData.left - imageData.left;\n var top = cropBoxData.top - canvasData.top - imageData.top;\n\n if (!this.cropped || this.disabled) {\n return;\n }\n\n setStyle(this.viewBoxImage, assign({\n width: width,\n height: height\n }, getTransforms(assign({\n translateX: -left,\n translateY: -top\n }, imageData))));\n forEach(this.previews, function (element) {\n var data = getData(element, DATA_PREVIEW);\n var originalWidth = data.width;\n var originalHeight = data.height;\n var newWidth = originalWidth;\n var newHeight = originalHeight;\n var ratio = 1;\n\n if (cropBoxWidth) {\n ratio = originalWidth / cropBoxWidth;\n newHeight = cropBoxHeight * ratio;\n }\n\n if (cropBoxHeight && newHeight > originalHeight) {\n ratio = originalHeight / cropBoxHeight;\n newWidth = cropBoxWidth * ratio;\n newHeight = originalHeight;\n }\n\n setStyle(element, {\n width: newWidth,\n height: newHeight\n });\n setStyle(element.getElementsByTagName('img')[0], assign({\n width: width * ratio,\n height: height * ratio\n }, getTransforms(assign({\n translateX: -left * ratio,\n translateY: -top * ratio\n }, imageData))));\n });\n }\n };\n\n var events = {\n bind: function bind() {\n var element = this.element,\n options = this.options,\n cropper = this.cropper;\n\n if (isFunction(options.cropstart)) {\n addListener(element, EVENT_CROP_START, options.cropstart);\n }\n\n if (isFunction(options.cropmove)) {\n addListener(element, EVENT_CROP_MOVE, options.cropmove);\n }\n\n if (isFunction(options.cropend)) {\n addListener(element, EVENT_CROP_END, options.cropend);\n }\n\n if (isFunction(options.crop)) {\n addListener(element, EVENT_CROP, options.crop);\n }\n\n if (isFunction(options.zoom)) {\n addListener(element, EVENT_ZOOM, options.zoom);\n }\n\n addListener(cropper, EVENT_POINTER_DOWN, this.onCropStart = this.cropStart.bind(this));\n\n if (options.zoomable && options.zoomOnWheel) {\n addListener(cropper, EVENT_WHEEL, this.onWheel = this.wheel.bind(this), {\n passive: false,\n capture: true\n });\n }\n\n if (options.toggleDragModeOnDblclick) {\n addListener(cropper, EVENT_DBLCLICK, this.onDblclick = this.dblclick.bind(this));\n }\n\n addListener(element.ownerDocument, EVENT_POINTER_MOVE, this.onCropMove = this.cropMove.bind(this));\n addListener(element.ownerDocument, EVENT_POINTER_UP, this.onCropEnd = this.cropEnd.bind(this));\n\n if (options.responsive) {\n addListener(window, EVENT_RESIZE, this.onResize = this.resize.bind(this));\n }\n },\n unbind: function unbind() {\n var element = this.element,\n options = this.options,\n cropper = this.cropper;\n\n if (isFunction(options.cropstart)) {\n removeListener(element, EVENT_CROP_START, options.cropstart);\n }\n\n if (isFunction(options.cropmove)) {\n removeListener(element, EVENT_CROP_MOVE, options.cropmove);\n }\n\n if (isFunction(options.cropend)) {\n removeListener(element, EVENT_CROP_END, options.cropend);\n }\n\n if (isFunction(options.crop)) {\n removeListener(element, EVENT_CROP, options.crop);\n }\n\n if (isFunction(options.zoom)) {\n removeListener(element, EVENT_ZOOM, options.zoom);\n }\n\n removeListener(cropper, EVENT_POINTER_DOWN, this.onCropStart);\n\n if (options.zoomable && options.zoomOnWheel) {\n removeListener(cropper, EVENT_WHEEL, this.onWheel, {\n passive: false,\n capture: true\n });\n }\n\n if (options.toggleDragModeOnDblclick) {\n removeListener(cropper, EVENT_DBLCLICK, this.onDblclick);\n }\n\n removeListener(element.ownerDocument, EVENT_POINTER_MOVE, this.onCropMove);\n removeListener(element.ownerDocument, EVENT_POINTER_UP, this.onCropEnd);\n\n if (options.responsive) {\n removeListener(window, EVENT_RESIZE, this.onResize);\n }\n }\n };\n\n var handlers = {\n resize: function resize() {\n var options = this.options,\n container = this.container,\n containerData = this.containerData;\n var minContainerWidth = Number(options.minContainerWidth) || MIN_CONTAINER_WIDTH;\n var minContainerHeight = Number(options.minContainerHeight) || MIN_CONTAINER_HEIGHT;\n\n if (this.disabled || containerData.width <= minContainerWidth || containerData.height <= minContainerHeight) {\n return;\n }\n\n var ratio = container.offsetWidth / containerData.width; // Resize when width changed or height changed\n\n if (ratio !== 1 || container.offsetHeight !== containerData.height) {\n var canvasData;\n var cropBoxData;\n\n if (options.restore) {\n canvasData = this.getCanvasData();\n cropBoxData = this.getCropBoxData();\n }\n\n this.render();\n\n if (options.restore) {\n this.setCanvasData(forEach(canvasData, function (n, i) {\n canvasData[i] = n * ratio;\n }));\n this.setCropBoxData(forEach(cropBoxData, function (n, i) {\n cropBoxData[i] = n * ratio;\n }));\n }\n }\n },\n dblclick: function dblclick() {\n if (this.disabled || this.options.dragMode === DRAG_MODE_NONE) {\n return;\n }\n\n this.setDragMode(hasClass(this.dragBox, CLASS_CROP) ? DRAG_MODE_MOVE : DRAG_MODE_CROP);\n },\n wheel: function wheel(event) {\n var _this = this;\n\n var ratio = Number(this.options.wheelZoomRatio) || 0.1;\n var delta = 1;\n\n if (this.disabled) {\n return;\n }\n\n event.preventDefault(); // Limit wheel speed to prevent zoom too fast (#21)\n\n if (this.wheeling) {\n return;\n }\n\n this.wheeling = true;\n setTimeout(function () {\n _this.wheeling = false;\n }, 50);\n\n if (event.deltaY) {\n delta = event.deltaY > 0 ? 1 : -1;\n } else if (event.wheelDelta) {\n delta = -event.wheelDelta / 120;\n } else if (event.detail) {\n delta = event.detail > 0 ? 1 : -1;\n }\n\n this.zoom(-delta * ratio, event);\n },\n cropStart: function cropStart(event) {\n var buttons = event.buttons,\n button = event.button;\n\n if (this.disabled // Handle mouse event and pointer event and ignore touch event\n || (event.type === 'mousedown' || event.type === 'pointerdown' && event.pointerType === 'mouse') && ( // No primary button (Usually the left button)\n isNumber(buttons) && buttons !== 1 || isNumber(button) && button !== 0 // Open context menu\n || event.ctrlKey)) {\n return;\n }\n\n var options = this.options,\n pointers = this.pointers;\n var action;\n\n if (event.changedTouches) {\n // Handle touch event\n forEach(event.changedTouches, function (touch) {\n pointers[touch.identifier] = getPointer(touch);\n });\n } else {\n // Handle mouse event and pointer event\n pointers[event.pointerId || 0] = getPointer(event);\n }\n\n if (Object.keys(pointers).length > 1 && options.zoomable && options.zoomOnTouch) {\n action = ACTION_ZOOM;\n } else {\n action = getData(event.target, DATA_ACTION);\n }\n\n if (!REGEXP_ACTIONS.test(action)) {\n return;\n }\n\n if (dispatchEvent(this.element, EVENT_CROP_START, {\n originalEvent: event,\n action: action\n }) === false) {\n return;\n } // This line is required for preventing page zooming in iOS browsers\n\n\n event.preventDefault();\n this.action = action;\n this.cropping = false;\n\n if (action === ACTION_CROP) {\n this.cropping = true;\n addClass(this.dragBox, CLASS_MODAL);\n }\n },\n cropMove: function cropMove(event) {\n var action = this.action;\n\n if (this.disabled || !action) {\n return;\n }\n\n var pointers = this.pointers;\n event.preventDefault();\n\n if (dispatchEvent(this.element, EVENT_CROP_MOVE, {\n originalEvent: event,\n action: action\n }) === false) {\n return;\n }\n\n if (event.changedTouches) {\n forEach(event.changedTouches, function (touch) {\n // The first parameter should not be undefined (#432)\n assign(pointers[touch.identifier] || {}, getPointer(touch, true));\n });\n } else {\n assign(pointers[event.pointerId || 0] || {}, getPointer(event, true));\n }\n\n this.change(event);\n },\n cropEnd: function cropEnd(event) {\n if (this.disabled) {\n return;\n }\n\n var action = this.action,\n pointers = this.pointers;\n\n if (event.changedTouches) {\n forEach(event.changedTouches, function (touch) {\n delete pointers[touch.identifier];\n });\n } else {\n delete pointers[event.pointerId || 0];\n }\n\n if (!action) {\n return;\n }\n\n event.preventDefault();\n\n if (!Object.keys(pointers).length) {\n this.action = '';\n }\n\n if (this.cropping) {\n this.cropping = false;\n toggleClass(this.dragBox, CLASS_MODAL, this.cropped && this.options.modal);\n }\n\n dispatchEvent(this.element, EVENT_CROP_END, {\n originalEvent: event,\n action: action\n });\n }\n };\n\n var change = {\n change: function change(event) {\n var options = this.options,\n canvasData = this.canvasData,\n containerData = this.containerData,\n cropBoxData = this.cropBoxData,\n pointers = this.pointers;\n var action = this.action;\n var aspectRatio = options.aspectRatio;\n var left = cropBoxData.left,\n top = cropBoxData.top,\n width = cropBoxData.width,\n height = cropBoxData.height;\n var right = left + width;\n var bottom = top + height;\n var minLeft = 0;\n var minTop = 0;\n var maxWidth = containerData.width;\n var maxHeight = containerData.height;\n var renderable = true;\n var offset; // Locking aspect ratio in \"free mode\" by holding shift key\n\n if (!aspectRatio && event.shiftKey) {\n aspectRatio = width && height ? width / height : 1;\n }\n\n if (this.limited) {\n minLeft = cropBoxData.minLeft;\n minTop = cropBoxData.minTop;\n maxWidth = minLeft + Math.min(containerData.width, canvasData.width, canvasData.left + canvasData.width);\n maxHeight = minTop + Math.min(containerData.height, canvasData.height, canvasData.top + canvasData.height);\n }\n\n var pointer = pointers[Object.keys(pointers)[0]];\n var range = {\n x: pointer.endX - pointer.startX,\n y: pointer.endY - pointer.startY\n };\n\n var check = function check(side) {\n switch (side) {\n case ACTION_EAST:\n if (right + range.x > maxWidth) {\n range.x = maxWidth - right;\n }\n\n break;\n\n case ACTION_WEST:\n if (left + range.x < minLeft) {\n range.x = minLeft - left;\n }\n\n break;\n\n case ACTION_NORTH:\n if (top + range.y < minTop) {\n range.y = minTop - top;\n }\n\n break;\n\n case ACTION_SOUTH:\n if (bottom + range.y > maxHeight) {\n range.y = maxHeight - bottom;\n }\n\n break;\n\n default:\n }\n };\n\n switch (action) {\n // Move crop box\n case ACTION_ALL:\n left += range.x;\n top += range.y;\n break;\n // Resize crop box\n\n case ACTION_EAST:\n if (range.x >= 0 && (right >= maxWidth || aspectRatio && (top <= minTop || bottom >= maxHeight))) {\n renderable = false;\n break;\n }\n\n check(ACTION_EAST);\n width += range.x;\n\n if (width < 0) {\n action = ACTION_WEST;\n width = -width;\n left -= width;\n }\n\n if (aspectRatio) {\n height = width / aspectRatio;\n top += (cropBoxData.height - height) / 2;\n }\n\n break;\n\n case ACTION_NORTH:\n if (range.y <= 0 && (top <= minTop || aspectRatio && (left <= minLeft || right >= maxWidth))) {\n renderable = false;\n break;\n }\n\n check(ACTION_NORTH);\n height -= range.y;\n top += range.y;\n\n if (height < 0) {\n action = ACTION_SOUTH;\n height = -height;\n top -= height;\n }\n\n if (aspectRatio) {\n width = height * aspectRatio;\n left += (cropBoxData.width - width) / 2;\n }\n\n break;\n\n case ACTION_WEST:\n if (range.x <= 0 && (left <= minLeft || aspectRatio && (top <= minTop || bottom >= maxHeight))) {\n renderable = false;\n break;\n }\n\n check(ACTION_WEST);\n width -= range.x;\n left += range.x;\n\n if (width < 0) {\n action = ACTION_EAST;\n width = -width;\n left -= width;\n }\n\n if (aspectRatio) {\n height = width / aspectRatio;\n top += (cropBoxData.height - height) / 2;\n }\n\n break;\n\n case ACTION_SOUTH:\n if (range.y >= 0 && (bottom >= maxHeight || aspectRatio && (left <= minLeft || right >= maxWidth))) {\n renderable = false;\n break;\n }\n\n check(ACTION_SOUTH);\n height += range.y;\n\n if (height < 0) {\n action = ACTION_NORTH;\n height = -height;\n top -= height;\n }\n\n if (aspectRatio) {\n width = height * aspectRatio;\n left += (cropBoxData.width - width) / 2;\n }\n\n break;\n\n case ACTION_NORTH_EAST:\n if (aspectRatio) {\n if (range.y <= 0 && (top <= minTop || right >= maxWidth)) {\n renderable = false;\n break;\n }\n\n check(ACTION_NORTH);\n height -= range.y;\n top += range.y;\n width = height * aspectRatio;\n } else {\n check(ACTION_NORTH);\n check(ACTION_EAST);\n\n if (range.x >= 0) {\n if (right < maxWidth) {\n width += range.x;\n } else if (range.y <= 0 && top <= minTop) {\n renderable = false;\n }\n } else {\n width += range.x;\n }\n\n if (range.y <= 0) {\n if (top > minTop) {\n height -= range.y;\n top += range.y;\n }\n } else {\n height -= range.y;\n top += range.y;\n }\n }\n\n if (width < 0 && height < 0) {\n action = ACTION_SOUTH_WEST;\n height = -height;\n width = -width;\n top -= height;\n left -= width;\n } else if (width < 0) {\n action = ACTION_NORTH_WEST;\n width = -width;\n left -= width;\n } else if (height < 0) {\n action = ACTION_SOUTH_EAST;\n height = -height;\n top -= height;\n }\n\n break;\n\n case ACTION_NORTH_WEST:\n if (aspectRatio) {\n if (range.y <= 0 && (top <= minTop || left <= minLeft)) {\n renderable = false;\n break;\n }\n\n check(ACTION_NORTH);\n height -= range.y;\n top += range.y;\n width = height * aspectRatio;\n left += cropBoxData.width - width;\n } else {\n check(ACTION_NORTH);\n check(ACTION_WEST);\n\n if (range.x <= 0) {\n if (left > minLeft) {\n width -= range.x;\n left += range.x;\n } else if (range.y <= 0 && top <= minTop) {\n renderable = false;\n }\n } else {\n width -= range.x;\n left += range.x;\n }\n\n if (range.y <= 0) {\n if (top > minTop) {\n height -= range.y;\n top += range.y;\n }\n } else {\n height -= range.y;\n top += range.y;\n }\n }\n\n if (width < 0 && height < 0) {\n action = ACTION_SOUTH_EAST;\n height = -height;\n width = -width;\n top -= height;\n left -= width;\n } else if (width < 0) {\n action = ACTION_NORTH_EAST;\n width = -width;\n left -= width;\n } else if (height < 0) {\n action = ACTION_SOUTH_WEST;\n height = -height;\n top -= height;\n }\n\n break;\n\n case ACTION_SOUTH_WEST:\n if (aspectRatio) {\n if (range.x <= 0 && (left <= minLeft || bottom >= maxHeight)) {\n renderable = false;\n break;\n }\n\n check(ACTION_WEST);\n width -= range.x;\n left += range.x;\n height = width / aspectRatio;\n } else {\n check(ACTION_SOUTH);\n check(ACTION_WEST);\n\n if (range.x <= 0) {\n if (left > minLeft) {\n width -= range.x;\n left += range.x;\n } else if (range.y >= 0 && bottom >= maxHeight) {\n renderable = false;\n }\n } else {\n width -= range.x;\n left += range.x;\n }\n\n if (range.y >= 0) {\n if (bottom < maxHeight) {\n height += range.y;\n }\n } else {\n height += range.y;\n }\n }\n\n if (width < 0 && height < 0) {\n action = ACTION_NORTH_EAST;\n height = -height;\n width = -width;\n top -= height;\n left -= width;\n } else if (width < 0) {\n action = ACTION_SOUTH_EAST;\n width = -width;\n left -= width;\n } else if (height < 0) {\n action = ACTION_NORTH_WEST;\n height = -height;\n top -= height;\n }\n\n break;\n\n case ACTION_SOUTH_EAST:\n if (aspectRatio) {\n if (range.x >= 0 && (right >= maxWidth || bottom >= maxHeight)) {\n renderable = false;\n break;\n }\n\n check(ACTION_EAST);\n width += range.x;\n height = width / aspectRatio;\n } else {\n check(ACTION_SOUTH);\n check(ACTION_EAST);\n\n if (range.x >= 0) {\n if (right < maxWidth) {\n width += range.x;\n } else if (range.y >= 0 && bottom >= maxHeight) {\n renderable = false;\n }\n } else {\n width += range.x;\n }\n\n if (range.y >= 0) {\n if (bottom < maxHeight) {\n height += range.y;\n }\n } else {\n height += range.y;\n }\n }\n\n if (width < 0 && height < 0) {\n action = ACTION_NORTH_WEST;\n height = -height;\n width = -width;\n top -= height;\n left -= width;\n } else if (width < 0) {\n action = ACTION_SOUTH_WEST;\n width = -width;\n left -= width;\n } else if (height < 0) {\n action = ACTION_NORTH_EAST;\n height = -height;\n top -= height;\n }\n\n break;\n // Move canvas\n\n case ACTION_MOVE:\n this.move(range.x, range.y);\n renderable = false;\n break;\n // Zoom canvas\n\n case ACTION_ZOOM:\n this.zoom(getMaxZoomRatio(pointers), event);\n renderable = false;\n break;\n // Create crop box\n\n case ACTION_CROP:\n if (!range.x || !range.y) {\n renderable = false;\n break;\n }\n\n offset = getOffset(this.cropper);\n left = pointer.startX - offset.left;\n top = pointer.startY - offset.top;\n width = cropBoxData.minWidth;\n height = cropBoxData.minHeight;\n\n if (range.x > 0) {\n action = range.y > 0 ? ACTION_SOUTH_EAST : ACTION_NORTH_EAST;\n } else if (range.x < 0) {\n left -= width;\n action = range.y > 0 ? ACTION_SOUTH_WEST : ACTION_NORTH_WEST;\n }\n\n if (range.y < 0) {\n top -= height;\n } // Show the crop box if is hidden\n\n\n if (!this.cropped) {\n removeClass(this.cropBox, CLASS_HIDDEN);\n this.cropped = true;\n\n if (this.limited) {\n this.limitCropBox(true, true);\n }\n }\n\n break;\n\n default:\n }\n\n if (renderable) {\n cropBoxData.width = width;\n cropBoxData.height = height;\n cropBoxData.left = left;\n cropBoxData.top = top;\n this.action = action;\n this.renderCropBox();\n } // Override\n\n\n forEach(pointers, function (p) {\n p.startX = p.endX;\n p.startY = p.endY;\n });\n }\n };\n\n var methods = {\n // Show the crop box manually\n crop: function crop() {\n if (this.ready && !this.cropped && !this.disabled) {\n this.cropped = true;\n this.limitCropBox(true, true);\n\n if (this.options.modal) {\n addClass(this.dragBox, CLASS_MODAL);\n }\n\n removeClass(this.cropBox, CLASS_HIDDEN);\n this.setCropBoxData(this.initialCropBoxData);\n }\n\n return this;\n },\n // Reset the image and crop box to their initial states\n reset: function reset() {\n if (this.ready && !this.disabled) {\n this.imageData = assign({}, this.initialImageData);\n this.canvasData = assign({}, this.initialCanvasData);\n this.cropBoxData = assign({}, this.initialCropBoxData);\n this.renderCanvas();\n\n if (this.cropped) {\n this.renderCropBox();\n }\n }\n\n return this;\n },\n // Clear the crop box\n clear: function clear() {\n if (this.cropped && !this.disabled) {\n assign(this.cropBoxData, {\n left: 0,\n top: 0,\n width: 0,\n height: 0\n });\n this.cropped = false;\n this.renderCropBox();\n this.limitCanvas(true, true); // Render canvas after crop box rendered\n\n this.renderCanvas();\n removeClass(this.dragBox, CLASS_MODAL);\n addClass(this.cropBox, CLASS_HIDDEN);\n }\n\n return this;\n },\n\n /**\n * Replace the image's src and rebuild the cropper\n * @param {string} url - The new URL.\n * @param {boolean} [hasSameSize] - Indicate if the new image has the same size as the old one.\n * @returns {Cropper} this\n */\n replace: function replace(url) {\n var hasSameSize = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n\n if (!this.disabled && url) {\n if (this.isImg) {\n this.element.src = url;\n }\n\n if (hasSameSize) {\n this.url = url;\n this.image.src = url;\n\n if (this.ready) {\n this.viewBoxImage.src = url;\n forEach(this.previews, function (element) {\n element.getElementsByTagName('img')[0].src = url;\n });\n }\n } else {\n if (this.isImg) {\n this.replaced = true;\n }\n\n this.options.data = null;\n this.uncreate();\n this.load(url);\n }\n }\n\n return this;\n },\n // Enable (unfreeze) the cropper\n enable: function enable() {\n if (this.ready && this.disabled) {\n this.disabled = false;\n removeClass(this.cropper, CLASS_DISABLED);\n }\n\n return this;\n },\n // Disable (freeze) the cropper\n disable: function disable() {\n if (this.ready && !this.disabled) {\n this.disabled = true;\n addClass(this.cropper, CLASS_DISABLED);\n }\n\n return this;\n },\n\n /**\n * Destroy the cropper and remove the instance from the image\n * @returns {Cropper} this\n */\n destroy: function destroy() {\n var element = this.element;\n\n if (!element[NAMESPACE]) {\n return this;\n }\n\n element[NAMESPACE] = undefined;\n\n if (this.isImg && this.replaced) {\n element.src = this.originalUrl;\n }\n\n this.uncreate();\n return this;\n },\n\n /**\n * Move the canvas with relative offsets\n * @param {number} offsetX - The relative offset distance on the x-axis.\n * @param {number} [offsetY=offsetX] - The relative offset distance on the y-axis.\n * @returns {Cropper} this\n */\n move: function move(offsetX) {\n var offsetY = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : offsetX;\n var _this$canvasData = this.canvasData,\n left = _this$canvasData.left,\n top = _this$canvasData.top;\n return this.moveTo(isUndefined(offsetX) ? offsetX : left + Number(offsetX), isUndefined(offsetY) ? offsetY : top + Number(offsetY));\n },\n\n /**\n * Move the canvas to an absolute point\n * @param {number} x - The x-axis coordinate.\n * @param {number} [y=x] - The y-axis coordinate.\n * @returns {Cropper} this\n */\n moveTo: function moveTo(x) {\n var y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : x;\n var canvasData = this.canvasData;\n var changed = false;\n x = Number(x);\n y = Number(y);\n\n if (this.ready && !this.disabled && this.options.movable) {\n if (isNumber(x)) {\n canvasData.left = x;\n changed = true;\n }\n\n if (isNumber(y)) {\n canvasData.top = y;\n changed = true;\n }\n\n if (changed) {\n this.renderCanvas(true);\n }\n }\n\n return this;\n },\n\n /**\n * Zoom the canvas with a relative ratio\n * @param {number} ratio - The target ratio.\n * @param {Event} _originalEvent - The original event if any.\n * @returns {Cropper} this\n */\n zoom: function zoom(ratio, _originalEvent) {\n var canvasData = this.canvasData;\n ratio = Number(ratio);\n\n if (ratio < 0) {\n ratio = 1 / (1 - ratio);\n } else {\n ratio = 1 + ratio;\n }\n\n return this.zoomTo(canvasData.width * ratio / canvasData.naturalWidth, null, _originalEvent);\n },\n\n /**\n * Zoom the canvas to an absolute ratio\n * @param {number} ratio - The target ratio.\n * @param {Object} pivot - The zoom pivot point coordinate.\n * @param {Event} _originalEvent - The original event if any.\n * @returns {Cropper} this\n */\n zoomTo: function zoomTo(ratio, pivot, _originalEvent) {\n var options = this.options,\n canvasData = this.canvasData;\n var width = canvasData.width,\n height = canvasData.height,\n naturalWidth = canvasData.naturalWidth,\n naturalHeight = canvasData.naturalHeight;\n ratio = Number(ratio);\n\n if (ratio >= 0 && this.ready && !this.disabled && options.zoomable) {\n var newWidth = naturalWidth * ratio;\n var newHeight = naturalHeight * ratio;\n\n if (dispatchEvent(this.element, EVENT_ZOOM, {\n ratio: ratio,\n oldRatio: width / naturalWidth,\n originalEvent: _originalEvent\n }) === false) {\n return this;\n }\n\n if (_originalEvent) {\n var pointers = this.pointers;\n var offset = getOffset(this.cropper);\n var center = pointers && Object.keys(pointers).length ? getPointersCenter(pointers) : {\n pageX: _originalEvent.pageX,\n pageY: _originalEvent.pageY\n }; // Zoom from the triggering point of the event\n\n canvasData.left -= (newWidth - width) * ((center.pageX - offset.left - canvasData.left) / width);\n canvasData.top -= (newHeight - height) * ((center.pageY - offset.top - canvasData.top) / height);\n } else if (isPlainObject(pivot) && isNumber(pivot.x) && isNumber(pivot.y)) {\n canvasData.left -= (newWidth - width) * ((pivot.x - canvasData.left) / width);\n canvasData.top -= (newHeight - height) * ((pivot.y - canvasData.top) / height);\n } else {\n // Zoom from the center of the canvas\n canvasData.left -= (newWidth - width) / 2;\n canvasData.top -= (newHeight - height) / 2;\n }\n\n canvasData.width = newWidth;\n canvasData.height = newHeight;\n this.renderCanvas(true);\n }\n\n return this;\n },\n\n /**\n * Rotate the canvas with a relative degree\n * @param {number} degree - The rotate degree.\n * @returns {Cropper} this\n */\n rotate: function rotate(degree) {\n return this.rotateTo((this.imageData.rotate || 0) + Number(degree));\n },\n\n /**\n * Rotate the canvas to an absolute degree\n * @param {number} degree - The rotate degree.\n * @returns {Cropper} this\n */\n rotateTo: function rotateTo(degree) {\n degree = Number(degree);\n\n if (isNumber(degree) && this.ready && !this.disabled && this.options.rotatable) {\n this.imageData.rotate = degree % 360;\n this.renderCanvas(true, true);\n }\n\n return this;\n },\n\n /**\n * Scale the image on the x-axis.\n * @param {number} scaleX - The scale ratio on the x-axis.\n * @returns {Cropper} this\n */\n scaleX: function scaleX(_scaleX) {\n var scaleY = this.imageData.scaleY;\n return this.scale(_scaleX, isNumber(scaleY) ? scaleY : 1);\n },\n\n /**\n * Scale the image on the y-axis.\n * @param {number} scaleY - The scale ratio on the y-axis.\n * @returns {Cropper} this\n */\n scaleY: function scaleY(_scaleY) {\n var scaleX = this.imageData.scaleX;\n return this.scale(isNumber(scaleX) ? scaleX : 1, _scaleY);\n },\n\n /**\n * Scale the image\n * @param {number} scaleX - The scale ratio on the x-axis.\n * @param {number} [scaleY=scaleX] - The scale ratio on the y-axis.\n * @returns {Cropper} this\n */\n scale: function scale(scaleX) {\n var scaleY = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : scaleX;\n var imageData = this.imageData;\n var transformed = false;\n scaleX = Number(scaleX);\n scaleY = Number(scaleY);\n\n if (this.ready && !this.disabled && this.options.scalable) {\n if (isNumber(scaleX)) {\n imageData.scaleX = scaleX;\n transformed = true;\n }\n\n if (isNumber(scaleY)) {\n imageData.scaleY = scaleY;\n transformed = true;\n }\n\n if (transformed) {\n this.renderCanvas(true, true);\n }\n }\n\n return this;\n },\n\n /**\n * Get the cropped area position and size data (base on the original image)\n * @param {boolean} [rounded=false] - Indicate if round the data values or not.\n * @returns {Object} The result cropped data.\n */\n getData: function getData() {\n var rounded = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n var options = this.options,\n imageData = this.imageData,\n canvasData = this.canvasData,\n cropBoxData = this.cropBoxData;\n var data;\n\n if (this.ready && this.cropped) {\n data = {\n x: cropBoxData.left - canvasData.left,\n y: cropBoxData.top - canvasData.top,\n width: cropBoxData.width,\n height: cropBoxData.height\n };\n var ratio = imageData.width / imageData.naturalWidth;\n forEach(data, function (n, i) {\n data[i] = n / ratio;\n });\n\n if (rounded) {\n // In case rounding off leads to extra 1px in right or bottom border\n // we should round the top-left corner and the dimension (#343).\n var bottom = Math.round(data.y + data.height);\n var right = Math.round(data.x + data.width);\n data.x = Math.round(data.x);\n data.y = Math.round(data.y);\n data.width = right - data.x;\n data.height = bottom - data.y;\n }\n } else {\n data = {\n x: 0,\n y: 0,\n width: 0,\n height: 0\n };\n }\n\n if (options.rotatable) {\n data.rotate = imageData.rotate || 0;\n }\n\n if (options.scalable) {\n data.scaleX = imageData.scaleX || 1;\n data.scaleY = imageData.scaleY || 1;\n }\n\n return data;\n },\n\n /**\n * Set the cropped area position and size with new data\n * @param {Object} data - The new data.\n * @returns {Cropper} this\n */\n setData: function setData(data) {\n var options = this.options,\n imageData = this.imageData,\n canvasData = this.canvasData;\n var cropBoxData = {};\n\n if (this.ready && !this.disabled && isPlainObject(data)) {\n var transformed = false;\n\n if (options.rotatable) {\n if (isNumber(data.rotate) && data.rotate !== imageData.rotate) {\n imageData.rotate = data.rotate;\n transformed = true;\n }\n }\n\n if (options.scalable) {\n if (isNumber(data.scaleX) && data.scaleX !== imageData.scaleX) {\n imageData.scaleX = data.scaleX;\n transformed = true;\n }\n\n if (isNumber(data.scaleY) && data.scaleY !== imageData.scaleY) {\n imageData.scaleY = data.scaleY;\n transformed = true;\n }\n }\n\n if (transformed) {\n this.renderCanvas(true, true);\n }\n\n var ratio = imageData.width / imageData.naturalWidth;\n\n if (isNumber(data.x)) {\n cropBoxData.left = data.x * ratio + canvasData.left;\n }\n\n if (isNumber(data.y)) {\n cropBoxData.top = data.y * ratio + canvasData.top;\n }\n\n if (isNumber(data.width)) {\n cropBoxData.width = data.width * ratio;\n }\n\n if (isNumber(data.height)) {\n cropBoxData.height = data.height * ratio;\n }\n\n this.setCropBoxData(cropBoxData);\n }\n\n return this;\n },\n\n /**\n * Get the container size data.\n * @returns {Object} The result container data.\n */\n getContainerData: function getContainerData() {\n return this.ready ? assign({}, this.containerData) : {};\n },\n\n /**\n * Get the image position and size data.\n * @returns {Object} The result image data.\n */\n getImageData: function getImageData() {\n return this.sized ? assign({}, this.imageData) : {};\n },\n\n /**\n * Get the canvas position and size data.\n * @returns {Object} The result canvas data.\n */\n getCanvasData: function getCanvasData() {\n var canvasData = this.canvasData;\n var data = {};\n\n if (this.ready) {\n forEach(['left', 'top', 'width', 'height', 'naturalWidth', 'naturalHeight'], function (n) {\n data[n] = canvasData[n];\n });\n }\n\n return data;\n },\n\n /**\n * Set the canvas position and size with new data.\n * @param {Object} data - The new canvas data.\n * @returns {Cropper} this\n */\n setCanvasData: function setCanvasData(data) {\n var canvasData = this.canvasData;\n var aspectRatio = canvasData.aspectRatio;\n\n if (this.ready && !this.disabled && isPlainObject(data)) {\n if (isNumber(data.left)) {\n canvasData.left = data.left;\n }\n\n if (isNumber(data.top)) {\n canvasData.top = data.top;\n }\n\n if (isNumber(data.width)) {\n canvasData.width = data.width;\n canvasData.height = data.width / aspectRatio;\n } else if (isNumber(data.height)) {\n canvasData.height = data.height;\n canvasData.width = data.height * aspectRatio;\n }\n\n this.renderCanvas(true);\n }\n\n return this;\n },\n\n /**\n * Get the crop box position and size data.\n * @returns {Object} The result crop box data.\n */\n getCropBoxData: function getCropBoxData() {\n var cropBoxData = this.cropBoxData;\n var data;\n\n if (this.ready && this.cropped) {\n data = {\n left: cropBoxData.left,\n top: cropBoxData.top,\n width: cropBoxData.width,\n height: cropBoxData.height\n };\n }\n\n return data || {};\n },\n\n /**\n * Set the crop box position and size with new data.\n * @param {Object} data - The new crop box data.\n * @returns {Cropper} this\n */\n setCropBoxData: function setCropBoxData(data) {\n var cropBoxData = this.cropBoxData;\n var aspectRatio = this.options.aspectRatio;\n var widthChanged;\n var heightChanged;\n\n if (this.ready && this.cropped && !this.disabled && isPlainObject(data)) {\n if (isNumber(data.left)) {\n cropBoxData.left = data.left;\n }\n\n if (isNumber(data.top)) {\n cropBoxData.top = data.top;\n }\n\n if (isNumber(data.width) && data.width !== cropBoxData.width) {\n widthChanged = true;\n cropBoxData.width = data.width;\n }\n\n if (isNumber(data.height) && data.height !== cropBoxData.height) {\n heightChanged = true;\n cropBoxData.height = data.height;\n }\n\n if (aspectRatio) {\n if (widthChanged) {\n cropBoxData.height = cropBoxData.width / aspectRatio;\n } else if (heightChanged) {\n cropBoxData.width = cropBoxData.height * aspectRatio;\n }\n }\n\n this.renderCropBox();\n }\n\n return this;\n },\n\n /**\n * Get a canvas drawn the cropped image.\n * @param {Object} [options={}] - The config options.\n * @returns {HTMLCanvasElement} - The result canvas.\n */\n getCroppedCanvas: function getCroppedCanvas() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n if (!this.ready || !window.HTMLCanvasElement) {\n return null;\n }\n\n var canvasData = this.canvasData;\n var source = getSourceCanvas(this.image, this.imageData, canvasData, options); // Returns the source canvas if it is not cropped.\n\n if (!this.cropped) {\n return source;\n }\n\n var _this$getData = this.getData(),\n initialX = _this$getData.x,\n initialY = _this$getData.y,\n initialWidth = _this$getData.width,\n initialHeight = _this$getData.height;\n\n var ratio = source.width / Math.floor(canvasData.naturalWidth);\n\n if (ratio !== 1) {\n initialX *= ratio;\n initialY *= ratio;\n initialWidth *= ratio;\n initialHeight *= ratio;\n }\n\n var aspectRatio = initialWidth / initialHeight;\n var maxSizes = getAdjustedSizes({\n aspectRatio: aspectRatio,\n width: options.maxWidth || Infinity,\n height: options.maxHeight || Infinity\n });\n var minSizes = getAdjustedSizes({\n aspectRatio: aspectRatio,\n width: options.minWidth || 0,\n height: options.minHeight || 0\n }, 'cover');\n\n var _getAdjustedSizes = getAdjustedSizes({\n aspectRatio: aspectRatio,\n width: options.width || (ratio !== 1 ? source.width : initialWidth),\n height: options.height || (ratio !== 1 ? source.height : initialHeight)\n }),\n width = _getAdjustedSizes.width,\n height = _getAdjustedSizes.height;\n\n width = Math.min(maxSizes.width, Math.max(minSizes.width, width));\n height = Math.min(maxSizes.height, Math.max(minSizes.height, height));\n var canvas = document.createElement('canvas');\n var context = canvas.getContext('2d');\n canvas.width = normalizeDecimalNumber(width);\n canvas.height = normalizeDecimalNumber(height);\n context.fillStyle = options.fillColor || 'transparent';\n context.fillRect(0, 0, width, height);\n var _options$imageSmoothi = options.imageSmoothingEnabled,\n imageSmoothingEnabled = _options$imageSmoothi === void 0 ? true : _options$imageSmoothi,\n imageSmoothingQuality = options.imageSmoothingQuality;\n context.imageSmoothingEnabled = imageSmoothingEnabled;\n\n if (imageSmoothingQuality) {\n context.imageSmoothingQuality = imageSmoothingQuality;\n } // https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D.drawImage\n\n\n var sourceWidth = source.width;\n var sourceHeight = source.height; // Source canvas parameters\n\n var srcX = initialX;\n var srcY = initialY;\n var srcWidth;\n var srcHeight; // Destination canvas parameters\n\n var dstX;\n var dstY;\n var dstWidth;\n var dstHeight;\n\n if (srcX <= -initialWidth || srcX > sourceWidth) {\n srcX = 0;\n srcWidth = 0;\n dstX = 0;\n dstWidth = 0;\n } else if (srcX <= 0) {\n dstX = -srcX;\n srcX = 0;\n srcWidth = Math.min(sourceWidth, initialWidth + srcX);\n dstWidth = srcWidth;\n } else if (srcX <= sourceWidth) {\n dstX = 0;\n srcWidth = Math.min(initialWidth, sourceWidth - srcX);\n dstWidth = srcWidth;\n }\n\n if (srcWidth <= 0 || srcY <= -initialHeight || srcY > sourceHeight) {\n srcY = 0;\n srcHeight = 0;\n dstY = 0;\n dstHeight = 0;\n } else if (srcY <= 0) {\n dstY = -srcY;\n srcY = 0;\n srcHeight = Math.min(sourceHeight, initialHeight + srcY);\n dstHeight = srcHeight;\n } else if (srcY <= sourceHeight) {\n dstY = 0;\n srcHeight = Math.min(initialHeight, sourceHeight - srcY);\n dstHeight = srcHeight;\n }\n\n var params = [srcX, srcY, srcWidth, srcHeight]; // Avoid \"IndexSizeError\"\n\n if (dstWidth > 0 && dstHeight > 0) {\n var scale = width / initialWidth;\n params.push(dstX * scale, dstY * scale, dstWidth * scale, dstHeight * scale);\n } // All the numerical parameters should be integer for `drawImage`\n // https://github.com/fengyuanchen/cropper/issues/476\n\n\n context.drawImage.apply(context, [source].concat(_toConsumableArray(params.map(function (param) {\n return Math.floor(normalizeDecimalNumber(param));\n }))));\n return canvas;\n },\n\n /**\n * Change the aspect ratio of the crop box.\n * @param {number} aspectRatio - The new aspect ratio.\n * @returns {Cropper} this\n */\n setAspectRatio: function setAspectRatio(aspectRatio) {\n var options = this.options;\n\n if (!this.disabled && !isUndefined(aspectRatio)) {\n // 0 -> NaN\n options.aspectRatio = Math.max(0, aspectRatio) || NaN;\n\n if (this.ready) {\n this.initCropBox();\n\n if (this.cropped) {\n this.renderCropBox();\n }\n }\n }\n\n return this;\n },\n\n /**\n * Change the drag mode.\n * @param {string} mode - The new drag mode.\n * @returns {Cropper} this\n */\n setDragMode: function setDragMode(mode) {\n var options = this.options,\n dragBox = this.dragBox,\n face = this.face;\n\n if (this.ready && !this.disabled) {\n var croppable = mode === DRAG_MODE_CROP;\n var movable = options.movable && mode === DRAG_MODE_MOVE;\n mode = croppable || movable ? mode : DRAG_MODE_NONE;\n options.dragMode = mode;\n setData(dragBox, DATA_ACTION, mode);\n toggleClass(dragBox, CLASS_CROP, croppable);\n toggleClass(dragBox, CLASS_MOVE, movable);\n\n if (!options.cropBoxMovable) {\n // Sync drag mode to crop box when it is not movable\n setData(face, DATA_ACTION, mode);\n toggleClass(face, CLASS_CROP, croppable);\n toggleClass(face, CLASS_MOVE, movable);\n }\n }\n\n return this;\n }\n };\n\n var AnotherCropper = WINDOW.Cropper;\n\n var Cropper =\n /*#__PURE__*/\n function () {\n /**\n * Create a new Cropper.\n * @param {Element} element - The target element for cropping.\n * @param {Object} [options={}] - The configuration options.\n */\n function Cropper(element) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n _classCallCheck(this, Cropper);\n\n if (!element || !REGEXP_TAG_NAME.test(element.tagName)) {\n throw new Error('The first argument is required and must be an <img> or <canvas> element.');\n }\n\n this.element = element;\n this.options = assign({}, DEFAULTS, isPlainObject(options) && options);\n this.cropped = false;\n this.disabled = false;\n this.pointers = {};\n this.ready = false;\n this.reloading = false;\n this.replaced = false;\n this.sized = false;\n this.sizing = false;\n this.init();\n }\n\n _createClass(Cropper, [{\n key: \"init\",\n value: function init() {\n var element = this.element;\n var tagName = element.tagName.toLowerCase();\n var url;\n\n if (element[NAMESPACE]) {\n return;\n }\n\n element[NAMESPACE] = this;\n\n if (tagName === 'img') {\n this.isImg = true; // e.g.: \"img/picture.jpg\"\n\n url = element.getAttribute('src') || '';\n this.originalUrl = url; // Stop when it's a blank image\n\n if (!url) {\n return;\n } // e.g.: \"http://example.com/img/picture.jpg\"\n\n\n url = element.src;\n } else if (tagName === 'canvas' && window.HTMLCanvasElement) {\n url = element.toDataURL();\n }\n\n this.load(url);\n }\n }, {\n key: \"load\",\n value: function load(url) {\n var _this = this;\n\n if (!url) {\n return;\n }\n\n this.url = url;\n this.imageData = {};\n var element = this.element,\n options = this.options;\n\n if (!options.rotatable && !options.scalable) {\n options.checkOrientation = false;\n } // Only IE10+ supports Typed Arrays\n\n\n if (!options.checkOrientation || !window.ArrayBuffer) {\n this.clone();\n return;\n } // Detect the mime type of the image directly if it is a Data URL\n\n\n if (REGEXP_DATA_URL.test(url)) {\n // Read ArrayBuffer from Data URL of JPEG images directly for better performance\n if (REGEXP_DATA_URL_JPEG.test(url)) {\n this.read(dataURLToArrayBuffer(url));\n } else {\n // Only a JPEG image may contains Exif Orientation information,\n // the rest types of Data URLs are not necessary to check orientation at all.\n this.clone();\n }\n\n return;\n } // 1. Detect the mime type of the image by a XMLHttpRequest.\n // 2. Load the image as ArrayBuffer for reading orientation if its a JPEG image.\n\n\n var xhr = new XMLHttpRequest();\n var clone = this.clone.bind(this);\n this.reloading = true;\n this.xhr = xhr; // 1. Cross origin requests are only supported for protocol schemes:\n // http, https, data, chrome, chrome-extension.\n // 2. Access to XMLHttpRequest from a Data URL will be blocked by CORS policy\n // in some browsers as IE11 and Safari.\n\n xhr.onabort = clone;\n xhr.onerror = clone;\n xhr.ontimeout = clone;\n\n xhr.onprogress = function () {\n // Abort the request directly if it not a JPEG image for better performance\n if (xhr.getResponseHeader('content-type') !== MIME_TYPE_JPEG) {\n xhr.abort();\n }\n };\n\n xhr.onload = function () {\n _this.read(xhr.response);\n };\n\n xhr.onloadend = function () {\n _this.reloading = false;\n _this.xhr = null;\n }; // Bust cache when there is a \"crossOrigin\" property to avoid browser cache error\n\n\n if (options.checkCrossOrigin && isCrossOriginURL(url) && element.crossOrigin) {\n url = addTimestamp(url);\n }\n\n xhr.open('GET', url);\n xhr.responseType = 'arraybuffer';\n xhr.withCredentials = element.crossOrigin === 'use-credentials';\n xhr.send();\n }\n }, {\n key: \"read\",\n value: function read(arrayBuffer) {\n var options = this.options,\n imageData = this.imageData; // Reset the orientation value to its default value 1\n // as some iOS browsers will render image with its orientation\n\n var orientation = resetAndGetOrientation(arrayBuffer);\n var rotate = 0;\n var scaleX = 1;\n var scaleY = 1;\n\n if (orientation > 1) {\n // Generate a new URL which has the default orientation value\n this.url = arrayBufferToDataURL(arrayBuffer, MIME_TYPE_JPEG);\n\n var _parseOrientation = parseOrientation(orientation);\n\n rotate = _parseOrientation.rotate;\n scaleX = _parseOrientation.scaleX;\n scaleY = _parseOrientation.scaleY;\n }\n\n if (options.rotatable) {\n imageData.rotate = rotate;\n }\n\n if (options.scalable) {\n imageData.scaleX = scaleX;\n imageData.scaleY = scaleY;\n }\n\n this.clone();\n }\n }, {\n key: \"clone\",\n value: function clone() {\n var element = this.element,\n url = this.url;\n var crossOrigin = element.crossOrigin;\n var crossOriginUrl = url;\n\n if (this.options.checkCrossOrigin && isCrossOriginURL(url)) {\n if (!crossOrigin) {\n crossOrigin = 'anonymous';\n } // Bust cache when there is not a \"crossOrigin\" property (#519)\n\n\n crossOriginUrl = addTimestamp(url);\n }\n\n this.crossOrigin = crossOrigin;\n this.crossOriginUrl = crossOriginUrl;\n var image = document.createElement('img');\n\n if (crossOrigin) {\n image.crossOrigin = crossOrigin;\n }\n\n image.src = crossOriginUrl || url;\n image.alt = element.alt || 'The image to crop';\n this.image = image;\n image.onload = this.start.bind(this);\n image.onerror = this.stop.bind(this);\n addClass(image, CLASS_HIDE);\n element.parentNode.insertBefore(image, element.nextSibling);\n }\n }, {\n key: \"start\",\n value: function start() {\n var _this2 = this;\n\n var image = this.image;\n image.onload = null;\n image.onerror = null;\n this.sizing = true; // Match all browsers that use WebKit as the layout engine in iOS devices,\n // such as Safari for iOS, Chrome for iOS, and in-app browsers.\n\n var isIOSWebKit = WINDOW.navigator && /(?:iPad|iPhone|iPod).*?AppleWebKit/i.test(WINDOW.navigator.userAgent);\n\n var done = function done(naturalWidth, naturalHeight) {\n assign(_this2.imageData, {\n naturalWidth: naturalWidth,\n naturalHeight: naturalHeight,\n aspectRatio: naturalWidth / naturalHeight\n });\n _this2.sizing = false;\n _this2.sized = true;\n\n _this2.build();\n }; // Most modern browsers (excepts iOS WebKit)\n\n\n if (image.naturalWidth && !isIOSWebKit) {\n done(image.naturalWidth, image.naturalHeight);\n return;\n }\n\n var sizingImage = document.createElement('img');\n var body = document.body || document.documentElement;\n this.sizingImage = sizingImage;\n\n sizingImage.onload = function () {\n done(sizingImage.width, sizingImage.height);\n\n if (!isIOSWebKit) {\n body.removeChild(sizingImage);\n }\n };\n\n sizingImage.src = image.src; // iOS WebKit will convert the image automatically\n // with its orientation once append it into DOM (#279)\n\n if (!isIOSWebKit) {\n sizingImage.style.cssText = 'left:0;' + 'max-height:none!important;' + 'max-width:none!important;' + 'min-height:0!important;' + 'min-width:0!important;' + 'opacity:0;' + 'position:absolute;' + 'top:0;' + 'z-index:-1;';\n body.appendChild(sizingImage);\n }\n }\n }, {\n key: \"stop\",\n value: function stop() {\n var image = this.image;\n image.onload = null;\n image.onerror = null;\n image.parentNode.removeChild(image);\n this.image = null;\n }\n }, {\n key: \"build\",\n value: function build() {\n if (!this.sized || this.ready) {\n return;\n }\n\n var element = this.element,\n options = this.options,\n image = this.image; // Create cropper elements\n\n var container = element.parentNode;\n var template = document.createElement('div');\n template.innerHTML = TEMPLATE;\n var cropper = template.querySelector(\".\".concat(NAMESPACE, \"-container\"));\n var canvas = cropper.querySelector(\".\".concat(NAMESPACE, \"-canvas\"));\n var dragBox = cropper.querySelector(\".\".concat(NAMESPACE, \"-drag-box\"));\n var cropBox = cropper.querySelector(\".\".concat(NAMESPACE, \"-crop-box\"));\n var face = cropBox.querySelector(\".\".concat(NAMESPACE, \"-face\"));\n this.container = container;\n this.cropper = cropper;\n this.canvas = canvas;\n this.dragBox = dragBox;\n this.cropBox = cropBox;\n this.viewBox = cropper.querySelector(\".\".concat(NAMESPACE, \"-view-box\"));\n this.face = face;\n canvas.appendChild(image); // Hide the original image\n\n addClass(element, CLASS_HIDDEN); // Inserts the cropper after to the current image\n\n container.insertBefore(cropper, element.nextSibling); // Show the image if is hidden\n\n if (!this.isImg) {\n removeClass(image, CLASS_HIDE);\n }\n\n this.initPreview();\n this.bind();\n options.initialAspectRatio = Math.max(0, options.initialAspectRatio) || NaN;\n options.aspectRatio = Math.max(0, options.aspectRatio) || NaN;\n options.viewMode = Math.max(0, Math.min(3, Math.round(options.viewMode))) || 0;\n addClass(cropBox, CLASS_HIDDEN);\n\n if (!options.guides) {\n addClass(cropBox.getElementsByClassName(\"\".concat(NAMESPACE, \"-dashed\")), CLASS_HIDDEN);\n }\n\n if (!options.center) {\n addClass(cropBox.getElementsByClassName(\"\".concat(NAMESPACE, \"-center\")), CLASS_HIDDEN);\n }\n\n if (options.background) {\n addClass(cropper, \"\".concat(NAMESPACE, \"-bg\"));\n }\n\n if (!options.highlight) {\n addClass(face, CLASS_INVISIBLE);\n }\n\n if (options.cropBoxMovable) {\n addClass(face, CLASS_MOVE);\n setData(face, DATA_ACTION, ACTION_ALL);\n }\n\n if (!options.cropBoxResizable) {\n addClass(cropBox.getElementsByClassName(\"\".concat(NAMESPACE, \"-line\")), CLASS_HIDDEN);\n addClass(cropBox.getElementsByClassName(\"\".concat(NAMESPACE, \"-point\")), CLASS_HIDDEN);\n }\n\n this.render();\n this.ready = true;\n this.setDragMode(options.dragMode);\n\n if (options.autoCrop) {\n this.crop();\n }\n\n this.setData(options.data);\n\n if (isFunction(options.ready)) {\n addListener(element, EVENT_READY, options.ready, {\n once: true\n });\n }\n\n dispatchEvent(element, EVENT_READY);\n }\n }, {\n key: \"unbuild\",\n value: function unbuild() {\n if (!this.ready) {\n return;\n }\n\n this.ready = false;\n this.unbind();\n this.resetPreview();\n this.cropper.parentNode.removeChild(this.cropper);\n removeClass(this.element, CLASS_HIDDEN);\n }\n }, {\n key: \"uncreate\",\n value: function uncreate() {\n if (this.ready) {\n this.unbuild();\n this.ready = false;\n this.cropped = false;\n } else if (this.sizing) {\n this.sizingImage.onload = null;\n this.sizing = false;\n this.sized = false;\n } else if (this.reloading) {\n this.xhr.onabort = null;\n this.xhr.abort();\n } else if (this.image) {\n this.stop();\n }\n }\n /**\n * Get the no conflict cropper class.\n * @returns {Cropper} The cropper class.\n */\n\n }], [{\n key: \"noConflict\",\n value: function noConflict() {\n window.Cropper = AnotherCropper;\n return Cropper;\n }\n /**\n * Change the default options.\n * @param {Object} options - The new default options.\n */\n\n }, {\n key: \"setDefaults\",\n value: function setDefaults(options) {\n assign(DEFAULTS, isPlainObject(options) && options);\n }\n }]);\n\n return Cropper;\n }();\n\n assign(Cropper.prototype, render, preview, events, handlers, change, methods);\n\n return Cropper;\n\n}));\n","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nvar printWarning = function() {};\n\nif (process.env.NODE_ENV !== 'production') {\n var ReactPropTypesSecret = require('./lib/ReactPropTypesSecret');\n var loggedTypeFailures = {};\n var has = Function.call.bind(Object.prototype.hasOwnProperty);\n\n printWarning = function(text) {\n var message = 'Warning: ' + text;\n if (typeof console !== 'undefined') {\n console.error(message);\n }\n try {\n // --- Welcome to debugging React ---\n // This error was thrown as a convenience so that you can use this stack\n // to find the callsite that caused this warning to fire.\n throw new Error(message);\n } catch (x) {}\n };\n}\n\n/**\n * Assert that the values match with the type specs.\n * Error messages are memorized and will only be shown once.\n *\n * @param {object} typeSpecs Map of name to a ReactPropType\n * @param {object} values Runtime values that need to be type-checked\n * @param {string} location e.g. \"prop\", \"context\", \"child context\"\n * @param {string} componentName Name of the component for error messages.\n * @param {?Function} getStack Returns the component stack.\n * @private\n */\nfunction checkPropTypes(typeSpecs, values, location, componentName, getStack) {\n if (process.env.NODE_ENV !== 'production') {\n for (var typeSpecName in typeSpecs) {\n if (has(typeSpecs, typeSpecName)) {\n var error;\n // Prop type validation may throw. In case they do, we don't want to\n // fail the render phase where it didn't fail before. So we log it.\n // After these have been cleaned up, we'll let them throw.\n try {\n // This is intentionally an invariant that gets caught. It's the same\n // behavior as without this statement except with a better message.\n if (typeof typeSpecs[typeSpecName] !== 'function') {\n var err = Error(\n (componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +\n 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.'\n );\n err.name = 'Invariant Violation';\n throw err;\n }\n error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);\n } catch (ex) {\n error = ex;\n }\n if (error && !(error instanceof Error)) {\n printWarning(\n (componentName || 'React class') + ': type specification of ' +\n location + ' `' + typeSpecName + '` is invalid; the type checker ' +\n 'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +\n 'You may have forgotten to pass an argument to the type checker ' +\n 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +\n 'shape all require an argument).'\n );\n }\n if (error instanceof Error && !(error.message in loggedTypeFailures)) {\n // Only monitor this failure once because there tends to be a lot of the\n // same error.\n loggedTypeFailures[error.message] = true;\n\n var stack = getStack ? getStack() : '';\n\n printWarning(\n 'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')\n );\n }\n }\n }\n }\n}\n\n/**\n * Resets warning cache when testing.\n *\n * @private\n */\ncheckPropTypes.resetWarningCache = function() {\n if (process.env.NODE_ENV !== 'production') {\n loggedTypeFailures = {};\n }\n}\n\nmodule.exports = checkPropTypes;\n","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nvar ReactIs = require('react-is');\nvar assign = require('object-assign');\n\nvar ReactPropTypesSecret = require('./lib/ReactPropTypesSecret');\nvar checkPropTypes = require('./checkPropTypes');\n\nvar has = Function.call.bind(Object.prototype.hasOwnProperty);\nvar printWarning = function() {};\n\nif (process.env.NODE_ENV !== 'production') {\n printWarning = function(text) {\n var message = 'Warning: ' + text;\n if (typeof console !== 'undefined') {\n console.error(message);\n }\n try {\n // --- Welcome to debugging React ---\n // This error was thrown as a convenience so that you can use this stack\n // to find the callsite that caused this warning to fire.\n throw new Error(message);\n } catch (x) {}\n };\n}\n\nfunction emptyFunctionThatReturnsNull() {\n return null;\n}\n\nmodule.exports = function(isValidElement, throwOnDirectAccess) {\n /* global Symbol */\n var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;\n var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.\n\n /**\n * Returns the iterator method function contained on the iterable object.\n *\n * Be sure to invoke the function with the iterable as context:\n *\n * var iteratorFn = getIteratorFn(myIterable);\n * if (iteratorFn) {\n * var iterator = iteratorFn.call(myIterable);\n * ...\n * }\n *\n * @param {?object} maybeIterable\n * @return {?function}\n */\n function getIteratorFn(maybeIterable) {\n var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);\n if (typeof iteratorFn === 'function') {\n return iteratorFn;\n }\n }\n\n /**\n * Collection of methods that allow declaration and validation of props that are\n * supplied to React components. Example usage:\n *\n * var Props = require('ReactPropTypes');\n * var MyArticle = React.createClass({\n * propTypes: {\n * // An optional string prop named \"description\".\n * description: Props.string,\n *\n * // A required enum prop named \"category\".\n * category: Props.oneOf(['News','Photos']).isRequired,\n *\n * // A prop named \"dialog\" that requires an instance of Dialog.\n * dialog: Props.instanceOf(Dialog).isRequired\n * },\n * render: function() { ... }\n * });\n *\n * A more formal specification of how these methods are used:\n *\n * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)\n * decl := ReactPropTypes.{type}(.isRequired)?\n *\n * Each and every declaration produces a function with the same signature. This\n * allows the creation of custom validation functions. For example:\n *\n * var MyLink = React.createClass({\n * propTypes: {\n * // An optional string or URI prop named \"href\".\n * href: function(props, propName, componentName) {\n * var propValue = props[propName];\n * if (propValue != null && typeof propValue !== 'string' &&\n * !(propValue instanceof URI)) {\n * return new Error(\n * 'Expected a string or an URI for ' + propName + ' in ' +\n * componentName\n * );\n * }\n * }\n * },\n * render: function() {...}\n * });\n *\n * @internal\n */\n\n var ANONYMOUS = '<<anonymous>>';\n\n // Important!\n // Keep this list in sync with production version in `./factoryWithThrowingShims.js`.\n var ReactPropTypes = {\n array: createPrimitiveTypeChecker('array'),\n bool: createPrimitiveTypeChecker('boolean'),\n func: createPrimitiveTypeChecker('function'),\n number: createPrimitiveTypeChecker('number'),\n object: createPrimitiveTypeChecker('object'),\n string: createPrimitiveTypeChecker('string'),\n symbol: createPrimitiveTypeChecker('symbol'),\n\n any: createAnyTypeChecker(),\n arrayOf: createArrayOfTypeChecker,\n element: createElementTypeChecker(),\n elementType: createElementTypeTypeChecker(),\n instanceOf: createInstanceTypeChecker,\n node: createNodeChecker(),\n objectOf: createObjectOfTypeChecker,\n oneOf: createEnumTypeChecker,\n oneOfType: createUnionTypeChecker,\n shape: createShapeTypeChecker,\n exact: createStrictShapeTypeChecker,\n };\n\n /**\n * inlined Object.is polyfill to avoid requiring consumers ship their own\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is\n */\n /*eslint-disable no-self-compare*/\n function is(x, y) {\n // SameValue algorithm\n if (x === y) {\n // Steps 1-5, 7-10\n // Steps 6.b-6.e: +0 != -0\n return x !== 0 || 1 / x === 1 / y;\n } else {\n // Step 6.a: NaN == NaN\n return x !== x && y !== y;\n }\n }\n /*eslint-enable no-self-compare*/\n\n /**\n * We use an Error-like object for backward compatibility as people may call\n * PropTypes directly and inspect their output. However, we don't use real\n * Errors anymore. We don't inspect their stack anyway, and creating them\n * is prohibitively expensive if they are created too often, such as what\n * happens in oneOfType() for any type before the one that matched.\n */\n function PropTypeError(message) {\n this.message = message;\n this.stack = '';\n }\n // Make `instanceof Error` still work for returned errors.\n PropTypeError.prototype = Error.prototype;\n\n function createChainableTypeChecker(validate) {\n if (process.env.NODE_ENV !== 'production') {\n var manualPropTypeCallCache = {};\n var manualPropTypeWarningCount = 0;\n }\n function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {\n componentName = componentName || ANONYMOUS;\n propFullName = propFullName || propName;\n\n if (secret !== ReactPropTypesSecret) {\n if (throwOnDirectAccess) {\n // New behavior only for users of `prop-types` package\n var err = new Error(\n 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +\n 'Use `PropTypes.checkPropTypes()` to call them. ' +\n 'Read more at http://fb.me/use-check-prop-types'\n );\n err.name = 'Invariant Violation';\n throw err;\n } else if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') {\n // Old behavior for people using React.PropTypes\n var cacheKey = componentName + ':' + propName;\n if (\n !manualPropTypeCallCache[cacheKey] &&\n // Avoid spamming the console because they are often not actionable except for lib authors\n manualPropTypeWarningCount < 3\n ) {\n printWarning(\n 'You are manually calling a React.PropTypes validation ' +\n 'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' +\n 'and will throw in the standalone `prop-types` package. ' +\n 'You may be seeing this warning due to a third-party PropTypes ' +\n 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.'\n );\n manualPropTypeCallCache[cacheKey] = true;\n manualPropTypeWarningCount++;\n }\n }\n }\n if (props[propName] == null) {\n if (isRequired) {\n if (props[propName] === null) {\n return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));\n }\n return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));\n }\n return null;\n } else {\n return validate(props, propName, componentName, location, propFullName);\n }\n }\n\n var chainedCheckType = checkType.bind(null, false);\n chainedCheckType.isRequired = checkType.bind(null, true);\n\n return chainedCheckType;\n }\n\n function createPrimitiveTypeChecker(expectedType) {\n function validate(props, propName, componentName, location, propFullName, secret) {\n var propValue = props[propName];\n var propType = getPropType(propValue);\n if (propType !== expectedType) {\n // `propValue` being instance of, say, date/regexp, pass the 'object'\n // check, but we can offer a more precise error message here rather than\n // 'of type `object`'.\n var preciseType = getPreciseType(propValue);\n\n return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));\n }\n return null;\n }\n return createChainableTypeChecker(validate);\n }\n\n function createAnyTypeChecker() {\n return createChainableTypeChecker(emptyFunctionThatReturnsNull);\n }\n\n function createArrayOfTypeChecker(typeChecker) {\n function validate(props, propName, componentName, location, propFullName) {\n if (typeof typeChecker !== 'function') {\n return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');\n }\n var propValue = props[propName];\n if (!Array.isArray(propValue)) {\n var propType = getPropType(propValue);\n return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));\n }\n for (var i = 0; i < propValue.length; i++) {\n var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret);\n if (error instanceof Error) {\n return error;\n }\n }\n return null;\n }\n return createChainableTypeChecker(validate);\n }\n\n function createElementTypeChecker() {\n function validate(props, propName, componentName, location, propFullName) {\n var propValue = props[propName];\n if (!isValidElement(propValue)) {\n var propType = getPropType(propValue);\n return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));\n }\n return null;\n }\n return createChainableTypeChecker(validate);\n }\n\n function createElementTypeTypeChecker() {\n function validate(props, propName, componentName, location, propFullName) {\n var propValue = props[propName];\n if (!ReactIs.isValidElementType(propValue)) {\n var propType = getPropType(propValue);\n return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement type.'));\n }\n return null;\n }\n return createChainableTypeChecker(validate);\n }\n\n function createInstanceTypeChecker(expectedClass) {\n function validate(props, propName, componentName, location, propFullName) {\n if (!(props[propName] instanceof expectedClass)) {\n var expectedClassName = expectedClass.name || ANONYMOUS;\n var actualClassName = getClassName(props[propName]);\n return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));\n }\n return null;\n }\n return createChainableTypeChecker(validate);\n }\n\n function createEnumTypeChecker(expectedValues) {\n if (!Array.isArray(expectedValues)) {\n if (process.env.NODE_ENV !== 'production') {\n if (arguments.length > 1) {\n printWarning(\n 'Invalid arguments supplied to oneOf, expected an array, got ' + arguments.length + ' arguments. ' +\n 'A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).'\n );\n } else {\n printWarning('Invalid argument supplied to oneOf, expected an array.');\n }\n }\n return emptyFunctionThatReturnsNull;\n }\n\n function validate(props, propName, componentName, location, propFullName) {\n var propValue = props[propName];\n for (var i = 0; i < expectedValues.length; i++) {\n if (is(propValue, expectedValues[i])) {\n return null;\n }\n }\n\n var valuesString = JSON.stringify(expectedValues, function replacer(key, value) {\n var type = getPreciseType(value);\n if (type === 'symbol') {\n return String(value);\n }\n return value;\n });\n return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + String(propValue) + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));\n }\n return createChainableTypeChecker(validate);\n }\n\n function createObjectOfTypeChecker(typeChecker) {\n function validate(props, propName, componentName, location, propFullName) {\n if (typeof typeChecker !== 'function') {\n return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');\n }\n var propValue = props[propName];\n var propType = getPropType(propValue);\n if (propType !== 'object') {\n return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));\n }\n for (var key in propValue) {\n if (has(propValue, key)) {\n var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);\n if (error instanceof Error) {\n return error;\n }\n }\n }\n return null;\n }\n return createChainableTypeChecker(validate);\n }\n\n function createUnionTypeChecker(arrayOfTypeCheckers) {\n if (!Array.isArray(arrayOfTypeCheckers)) {\n process.env.NODE_ENV !== 'production' ? printWarning('Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;\n return emptyFunctionThatReturnsNull;\n }\n\n for (var i = 0; i < arrayOfTypeCheckers.length; i++) {\n var checker = arrayOfTypeCheckers[i];\n if (typeof checker !== 'function') {\n printWarning(\n 'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' +\n 'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.'\n );\n return emptyFunctionThatReturnsNull;\n }\n }\n\n function validate(props, propName, componentName, location, propFullName) {\n for (var i = 0; i < arrayOfTypeCheckers.length; i++) {\n var checker = arrayOfTypeCheckers[i];\n if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret) == null) {\n return null;\n }\n }\n\n return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));\n }\n return createChainableTypeChecker(validate);\n }\n\n function createNodeChecker() {\n function validate(props, propName, componentName, location, propFullName) {\n if (!isNode(props[propName])) {\n return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));\n }\n return null;\n }\n return createChainableTypeChecker(validate);\n }\n\n function createShapeTypeChecker(shapeTypes) {\n function validate(props, propName, componentName, location, propFullName) {\n var propValue = props[propName];\n var propType = getPropType(propValue);\n if (propType !== 'object') {\n return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));\n }\n for (var key in shapeTypes) {\n var checker = shapeTypes[key];\n if (!checker) {\n continue;\n }\n var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);\n if (error) {\n return error;\n }\n }\n return null;\n }\n return createChainableTypeChecker(validate);\n }\n\n function createStrictShapeTypeChecker(shapeTypes) {\n function validate(props, propName, componentName, location, propFullName) {\n var propValue = props[propName];\n var propType = getPropType(propValue);\n if (propType !== 'object') {\n return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));\n }\n // We need to check all keys in case some are required but missing from\n // props.\n var allKeys = assign({}, props[propName], shapeTypes);\n for (var key in allKeys) {\n var checker = shapeTypes[key];\n if (!checker) {\n return new PropTypeError(\n 'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +\n '\\nBad object: ' + JSON.stringify(props[propName], null, ' ') +\n '\\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')\n );\n }\n var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);\n if (error) {\n return error;\n }\n }\n return null;\n }\n\n return createChainableTypeChecker(validate);\n }\n\n function isNode(propValue) {\n switch (typeof propValue) {\n case 'number':\n case 'string':\n case 'undefined':\n return true;\n case 'boolean':\n return !propValue;\n case 'object':\n if (Array.isArray(propValue)) {\n return propValue.every(isNode);\n }\n if (propValue === null || isValidElement(propValue)) {\n return true;\n }\n\n var iteratorFn = getIteratorFn(propValue);\n if (iteratorFn) {\n var iterator = iteratorFn.call(propValue);\n var step;\n if (iteratorFn !== propValue.entries) {\n while (!(step = iterator.next()).done) {\n if (!isNode(step.value)) {\n return false;\n }\n }\n } else {\n // Iterator will provide entry [k,v] tuples rather than values.\n while (!(step = iterator.next()).done) {\n var entry = step.value;\n if (entry) {\n if (!isNode(entry[1])) {\n return false;\n }\n }\n }\n }\n } else {\n return false;\n }\n\n return true;\n default:\n return false;\n }\n }\n\n function isSymbol(propType, propValue) {\n // Native Symbol.\n if (propType === 'symbol') {\n return true;\n }\n\n // falsy value can't be a Symbol\n if (!propValue) {\n return false;\n }\n\n // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'\n if (propValue['@@toStringTag'] === 'Symbol') {\n return true;\n }\n\n // Fallback for non-spec compliant Symbols which are polyfilled.\n if (typeof Symbol === 'function' && propValue instanceof Symbol) {\n return true;\n }\n\n return false;\n }\n\n // Equivalent of `typeof` but with special handling for array and regexp.\n function getPropType(propValue) {\n var propType = typeof propValue;\n if (Array.isArray(propValue)) {\n return 'array';\n }\n if (propValue instanceof RegExp) {\n // Old webkits (at least until Android 4.0) return 'function' rather than\n // 'object' for typeof a RegExp. We'll normalize this here so that /bla/\n // passes PropTypes.object.\n return 'object';\n }\n if (isSymbol(propType, propValue)) {\n return 'symbol';\n }\n return propType;\n }\n\n // This handles more types than `getPropType`. Only used for error messages.\n // See `createPrimitiveTypeChecker`.\n function getPreciseType(propValue) {\n if (typeof propValue === 'undefined' || propValue === null) {\n return '' + propValue;\n }\n var propType = getPropType(propValue);\n if (propType === 'object') {\n if (propValue instanceof Date) {\n return 'date';\n } else if (propValue instanceof RegExp) {\n return 'regexp';\n }\n }\n return propType;\n }\n\n // Returns a string that is postfixed to a warning about an invalid type.\n // For example, \"undefined\" or \"of type array\"\n function getPostfixForTypeWarning(value) {\n var type = getPreciseType(value);\n switch (type) {\n case 'array':\n case 'object':\n return 'an ' + type;\n case 'boolean':\n case 'date':\n case 'regexp':\n return 'a ' + type;\n default:\n return type;\n }\n }\n\n // Returns class name of the object, if any.\n function getClassName(propValue) {\n if (!propValue.constructor || !propValue.constructor.name) {\n return ANONYMOUS;\n }\n return propValue.constructor.name;\n }\n\n ReactPropTypes.checkPropTypes = checkPropTypes;\n ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache;\n ReactPropTypes.PropTypes = ReactPropTypes;\n\n return ReactPropTypes;\n};\n","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nif (process.env.NODE_ENV !== 'production') {\n var ReactIs = require('react-is');\n\n // By explicitly using `prop-types` you are opting into new development behavior.\n // http://fb.me/prop-types-in-prod\n var throwOnDirectAccess = true;\n module.exports = require('./factoryWithTypeCheckers')(ReactIs.isElement, throwOnDirectAccess);\n} else {\n // By explicitly using `prop-types` you are opting into new production behavior.\n // http://fb.me/prop-types-in-prod\n module.exports = require('./factoryWithThrowingShims')();\n}\n","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nvar ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';\n\nmodule.exports = ReactPropTypesSecret;\n","/*\nobject-assign\n(c) Sindre Sorhus\n@license MIT\n*/\n\n'use strict';\n/* eslint-disable no-unused-vars */\nvar getOwnPropertySymbols = Object.getOwnPropertySymbols;\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\nvar propIsEnumerable = Object.prototype.propertyIsEnumerable;\n\nfunction toObject(val) {\n\tif (val === null || val === undefined) {\n\t\tthrow new TypeError('Object.assign cannot be called with null or undefined');\n\t}\n\n\treturn Object(val);\n}\n\nfunction shouldUseNative() {\n\ttry {\n\t\tif (!Object.assign) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Detect buggy property enumeration order in older V8 versions.\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=4118\n\t\tvar test1 = new String('abc'); // eslint-disable-line no-new-wrappers\n\t\ttest1[5] = 'de';\n\t\tif (Object.getOwnPropertyNames(test1)[0] === '5') {\n\t\t\treturn false;\n\t\t}\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=3056\n\t\tvar test2 = {};\n\t\tfor (var i = 0; i < 10; i++) {\n\t\t\ttest2['_' + String.fromCharCode(i)] = i;\n\t\t}\n\t\tvar order2 = Object.getOwnPropertyNames(test2).map(function (n) {\n\t\t\treturn test2[n];\n\t\t});\n\t\tif (order2.join('') !== '0123456789') {\n\t\t\treturn false;\n\t\t}\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=3056\n\t\tvar test3 = {};\n\t\t'abcdefghijklmnopqrst'.split('').forEach(function (letter) {\n\t\t\ttest3[letter] = letter;\n\t\t});\n\t\tif (Object.keys(Object.assign({}, test3)).join('') !==\n\t\t\t\t'abcdefghijklmnopqrst') {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t} catch (err) {\n\t\t// We don't expect any of the above to throw, but better to be safe.\n\t\treturn false;\n\t}\n}\n\nmodule.exports = shouldUseNative() ? Object.assign : function (target, source) {\n\tvar from;\n\tvar to = toObject(target);\n\tvar symbols;\n\n\tfor (var s = 1; s < arguments.length; s++) {\n\t\tfrom = Object(arguments[s]);\n\n\t\tfor (var key in from) {\n\t\t\tif (hasOwnProperty.call(from, key)) {\n\t\t\t\tto[key] = from[key];\n\t\t\t}\n\t\t}\n\n\t\tif (getOwnPropertySymbols) {\n\t\t\tsymbols = getOwnPropertySymbols(from);\n\t\t\tfor (var i = 0; i < symbols.length; i++) {\n\t\t\t\tif (propIsEnumerable.call(from, symbols[i])) {\n\t\t\t\t\tto[symbols[i]] = from[symbols[i]];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn to;\n};\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\n\nvar _react = _interopRequireWildcard(require(\"react\"));\n\nvar _propTypes = _interopRequireDefault(require(\"prop-types\"));\n\nvar _cropperjs = _interopRequireDefault(require(\"cropperjs\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }\n\nfunction _typeof(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nfunction _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nvar optionProps = ['dragMode', 'aspectRatio', 'data', 'crop', // unchangeable props start from here\n'viewMode', 'preview', 'responsive', 'restore', 'checkCrossOrigin', 'checkOrientation', 'modal', 'guides', 'center', 'highlight', 'background', 'autoCrop', 'autoCropArea', 'movable', 'rotatable', 'scalable', 'zoomable', 'zoomOnTouch', 'zoomOnWheel', 'wheelZoomRatio', 'cropBoxMovable', 'cropBoxResizable', 'toggleDragModeOnDblclick', 'minContainerWidth', 'minContainerHeight', 'minCanvasWidth', 'minCanvasHeight', 'minCropBoxWidth', 'minCropBoxHeight', 'ready', 'cropstart', 'cropmove', 'cropend', 'zoom'];\nvar unchangeableProps = optionProps.slice(4);\n\nvar ReactCropper =\n/*#__PURE__*/\nfunction (_Component) {\n _inherits(ReactCropper, _Component);\n\n function ReactCropper() {\n _classCallCheck(this, ReactCropper);\n\n return _possibleConstructorReturn(this, _getPrototypeOf(ReactCropper).apply(this, arguments));\n }\n\n _createClass(ReactCropper, [{\n key: \"componentDidMount\",\n value: function componentDidMount() {\n var _this = this;\n\n var options = Object.keys(this.props).filter(function (propKey) {\n return optionProps.indexOf(propKey) !== -1;\n }).reduce(function (prevOptions, propKey) {\n return _extends({}, prevOptions, _defineProperty({}, propKey, _this.props[propKey]));\n }, {});\n this.cropper = new _cropperjs.default(this.img, options);\n }\n }, {\n key: \"UNSAFE_componentWillReceiveProps\",\n value: function UNSAFE_componentWillReceiveProps(nextProps) {\n var _this2 = this;\n\n if (nextProps.src !== this.props.src) {\n this.cropper.reset().clear().replace(nextProps.src);\n }\n\n if (nextProps.aspectRatio !== this.props.aspectRatio) {\n this.setAspectRatio(nextProps.aspectRatio);\n }\n\n if (nextProps.data !== this.props.data) {\n this.setData(nextProps.data);\n }\n\n if (nextProps.dragMode !== this.props.dragMode) {\n this.setDragMode(nextProps.dragMode);\n }\n\n if (nextProps.cropBoxData !== this.props.cropBoxData) {\n this.setCropBoxData(nextProps.cropBoxData);\n }\n\n if (nextProps.canvasData !== this.props.canvasData) {\n this.setCanvasData(nextProps.canvasData);\n }\n\n if (nextProps.moveTo !== this.props.moveTo) {\n if (nextProps.moveTo.length > 1) {\n this.moveTo(nextProps.moveTo[0], nextProps.moveTo[1]);\n } else {\n this.moveTo(nextProps.moveTo[0]);\n }\n }\n\n if (nextProps.zoomTo !== this.props.zoomTo) {\n this.zoomTo(nextProps.zoomTo);\n }\n\n if (nextProps.rotateTo !== this.props.rotateTo) {\n this.rotateTo(nextProps.rotateTo);\n }\n\n if (nextProps.scaleX !== this.props.scaleX) {\n this.scaleX(nextProps.scaleX);\n }\n\n if (nextProps.scaleY !== this.props.scaleY) {\n this.scaleY(nextProps.scaleY);\n }\n\n if (nextProps.enable !== this.props.enable) {\n if (nextProps.enable) {\n this.enable();\n } else {\n this.disable();\n }\n }\n\n Object.keys(nextProps).forEach(function (propKey) {\n var isDifferentVal = nextProps[propKey] !== _this2.props[propKey];\n var isUnchangeableProps = unchangeableProps.indexOf(propKey) !== -1;\n\n if (typeof nextProps[propKey] === 'function' && typeof _this2.props[propKey] === 'function') {\n isDifferentVal = nextProps[propKey].toString() !== _this2.props[propKey].toString();\n }\n\n if (isDifferentVal && isUnchangeableProps) {\n throw new Error(\"prop: \".concat(propKey, \" can't be change after componentDidMount\"));\n }\n });\n }\n }, {\n key: \"componentWillUnmount\",\n value: function componentWillUnmount() {\n if (this.img) {\n // Destroy the cropper, this makes sure events such as resize are cleaned up and do not leak\n this.cropper.destroy();\n delete this.img;\n delete this.cropper;\n }\n }\n }, {\n key: \"setDragMode\",\n value: function setDragMode(mode) {\n return this.cropper.setDragMode(mode);\n }\n }, {\n key: \"setAspectRatio\",\n value: function setAspectRatio(aspectRatio) {\n return this.cropper.setAspectRatio(aspectRatio);\n }\n }, {\n key: \"getCroppedCanvas\",\n value: function getCroppedCanvas(options) {\n return this.cropper.getCroppedCanvas(options);\n }\n }, {\n key: \"setCropBoxData\",\n value: function setCropBoxData(data) {\n return this.cropper.setCropBoxData(data);\n }\n }, {\n key: \"getCropBoxData\",\n value: function getCropBoxData() {\n return this.cropper.getCropBoxData();\n }\n }, {\n key: \"setCanvasData\",\n value: function setCanvasData(data) {\n return this.cropper.setCanvasData(data);\n }\n }, {\n key: \"getCanvasData\",\n value: function getCanvasData() {\n return this.cropper.getCanvasData();\n }\n }, {\n key: \"getImageData\",\n value: function getImageData() {\n return this.cropper.getImageData();\n }\n }, {\n key: \"getContainerData\",\n value: function getContainerData() {\n return this.cropper.getContainerData();\n }\n }, {\n key: \"setData\",\n value: function setData(data) {\n return this.cropper.setData(data);\n }\n }, {\n key: \"getData\",\n value: function getData(rounded) {\n return this.cropper.getData(rounded);\n }\n }, {\n key: \"crop\",\n value: function crop() {\n return this.cropper.crop();\n }\n }, {\n key: \"move\",\n value: function move(offsetX, offsetY) {\n return this.cropper.move(offsetX, offsetY);\n }\n }, {\n key: \"moveTo\",\n value: function moveTo(x, y) {\n return this.cropper.moveTo(x, y);\n }\n }, {\n key: \"zoom\",\n value: function zoom(ratio) {\n return this.cropper.zoom(ratio);\n }\n }, {\n key: \"zoomTo\",\n value: function zoomTo(ratio) {\n return this.cropper.zoomTo(ratio);\n }\n }, {\n key: \"rotate\",\n value: function rotate(degree) {\n return this.cropper.rotate(degree);\n }\n }, {\n key: \"rotateTo\",\n value: function rotateTo(degree) {\n return this.cropper.rotateTo(degree);\n }\n }, {\n key: \"enable\",\n value: function enable() {\n return this.cropper.enable();\n }\n }, {\n key: \"disable\",\n value: function disable() {\n return this.cropper.disable();\n }\n }, {\n key: \"reset\",\n value: function reset() {\n return this.cropper.reset();\n }\n }, {\n key: \"clear\",\n value: function clear() {\n return this.cropper.clear();\n }\n }, {\n key: \"replace\",\n value: function replace(url, onlyColorChanged) {\n return this.cropper.replace(url, onlyColorChanged);\n }\n }, {\n key: \"scale\",\n value: function scale(scaleX, scaleY) {\n return this.cropper.scale(scaleX, scaleY);\n }\n }, {\n key: \"scaleX\",\n value: function scaleX(_scaleX) {\n return this.cropper.scaleX(_scaleX);\n }\n }, {\n key: \"scaleY\",\n value: function scaleY(_scaleY) {\n return this.cropper.scaleY(_scaleY);\n }\n }, {\n key: \"render\",\n value: function render() {\n var _this3 = this;\n\n var _this$props = this.props,\n src = _this$props.src,\n alt = _this$props.alt,\n crossOrigin = _this$props.crossOrigin,\n style = _this$props.style,\n className = _this$props.className;\n return _react.default.createElement(\"div\", {\n style: style,\n className: className\n }, _react.default.createElement(\"img\", {\n crossOrigin: crossOrigin,\n ref: function ref(img) {\n _this3.img = img;\n },\n src: src,\n alt: alt === undefined ? 'picture' : alt,\n style: {\n opacity: 0\n }\n }));\n }\n }]);\n\n return ReactCropper;\n}(_react.Component);\n\nReactCropper.propTypes = {\n style: _propTypes.default.object,\n // eslint-disable-line react/forbid-prop-types\n className: _propTypes.default.string,\n // react cropper options\n crossOrigin: _propTypes.default.string,\n src: _propTypes.default.string,\n alt: _propTypes.default.string,\n // props of option can be changed after componentDidmount\n aspectRatio: _propTypes.default.number,\n dragMode: _propTypes.default.oneOf(['crop', 'move', 'none']),\n data: _propTypes.default.shape({\n x: _propTypes.default.number,\n y: _propTypes.default.number,\n width: _propTypes.default.number,\n height: _propTypes.default.number,\n rotate: _propTypes.default.number,\n scaleX: _propTypes.default.number,\n scaleY: _propTypes.default.number\n }),\n scaleX: _propTypes.default.number,\n scaleY: _propTypes.default.number,\n enable: _propTypes.default.bool,\n cropBoxData: _propTypes.default.shape({\n left: _propTypes.default.number,\n top: _propTypes.default.number,\n width: _propTypes.default.number,\n height: _propTypes.default.number\n }),\n canvasData: _propTypes.default.shape({\n left: _propTypes.default.number,\n top: _propTypes.default.number,\n width: _propTypes.default.number,\n height: _propTypes.default.number\n }),\n zoomTo: _propTypes.default.number,\n moveTo: _propTypes.default.arrayOf(_propTypes.default.number),\n rotateTo: _propTypes.default.number,\n // cropperjs options\n // https://github.com/fengyuanchen/cropperjs#options\n // aspectRatio, dragMode, data\n viewMode: _propTypes.default.oneOf([0, 1, 2, 3]),\n preview: _propTypes.default.string,\n responsive: _propTypes.default.bool,\n restore: _propTypes.default.bool,\n checkCrossOrigin: _propTypes.default.bool,\n checkOrientation: _propTypes.default.bool,\n modal: _propTypes.default.bool,\n guides: _propTypes.default.bool,\n center: _propTypes.default.bool,\n highlight: _propTypes.default.bool,\n background: _propTypes.default.bool,\n autoCrop: _propTypes.default.bool,\n autoCropArea: _propTypes.default.number,\n movable: _propTypes.default.bool,\n rotatable: _propTypes.default.bool,\n scalable: _propTypes.default.bool,\n zoomable: _propTypes.default.bool,\n zoomOnTouch: _propTypes.default.bool,\n zoomOnWheel: _propTypes.default.bool,\n wheelZoomRatio: _propTypes.default.number,\n cropBoxMovable: _propTypes.default.bool,\n cropBoxResizable: _propTypes.default.bool,\n toggleDragModeOnDblclick: _propTypes.default.bool,\n minContainerWidth: _propTypes.default.number,\n minContainerHeight: _propTypes.default.number,\n minCanvasWidth: _propTypes.default.number,\n minCanvasHeight: _propTypes.default.number,\n minCropBoxWidth: _propTypes.default.number,\n minCropBoxHeight: _propTypes.default.number,\n ready: _propTypes.default.func,\n cropstart: _propTypes.default.func,\n cropmove: _propTypes.default.func,\n cropend: _propTypes.default.func,\n crop: _propTypes.default.func,\n zoom: _propTypes.default.func\n};\nReactCropper.defaultProps = {\n src: null,\n dragMode: 'crop',\n data: null,\n scaleX: 1,\n scaleY: 1,\n enable: true,\n zoomTo: 1,\n rotateTo: 0\n};\nvar _default = ReactCropper;\nexports.default = _default;\n","/** @license React v16.13.1\n * react-is.development.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\n\n\nif (process.env.NODE_ENV !== \"production\") {\n (function() {\n'use strict';\n\n// The Symbol used to tag the ReactElement-like types. If there is no native Symbol\n// nor polyfill, then a plain number is used for performance.\nvar hasSymbol = typeof Symbol === 'function' && Symbol.for;\nvar REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;\nvar REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;\nvar REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;\nvar REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;\nvar REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;\nvar REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;\nvar REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary\n// (unstable) APIs that have been removed. Can we remove the symbols?\n\nvar REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;\nvar REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;\nvar REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;\nvar REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;\nvar REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;\nvar REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;\nvar REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;\nvar REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9;\nvar REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;\nvar REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;\nvar REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;\n\nfunction isValidElementType(type) {\n return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.\n type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE);\n}\n\nfunction typeOf(object) {\n if (typeof object === 'object' && object !== null) {\n var $$typeof = object.$$typeof;\n\n switch ($$typeof) {\n case REACT_ELEMENT_TYPE:\n var type = object.type;\n\n switch (type) {\n case REACT_ASYNC_MODE_TYPE:\n case REACT_CONCURRENT_MODE_TYPE:\n case REACT_FRAGMENT_TYPE:\n case REACT_PROFILER_TYPE:\n case REACT_STRICT_MODE_TYPE:\n case REACT_SUSPENSE_TYPE:\n return type;\n\n default:\n var $$typeofType = type && type.$$typeof;\n\n switch ($$typeofType) {\n case REACT_CONTEXT_TYPE:\n case REACT_FORWARD_REF_TYPE:\n case REACT_LAZY_TYPE:\n case REACT_MEMO_TYPE:\n case REACT_PROVIDER_TYPE:\n return $$typeofType;\n\n default:\n return $$typeof;\n }\n\n }\n\n case REACT_PORTAL_TYPE:\n return $$typeof;\n }\n }\n\n return undefined;\n} // AsyncMode is deprecated along with isAsyncMode\n\nvar AsyncMode = REACT_ASYNC_MODE_TYPE;\nvar ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;\nvar ContextConsumer = REACT_CONTEXT_TYPE;\nvar ContextProvider = REACT_PROVIDER_TYPE;\nvar Element = REACT_ELEMENT_TYPE;\nvar ForwardRef = REACT_FORWARD_REF_TYPE;\nvar Fragment = REACT_FRAGMENT_TYPE;\nvar Lazy = REACT_LAZY_TYPE;\nvar Memo = REACT_MEMO_TYPE;\nvar Portal = REACT_PORTAL_TYPE;\nvar Profiler = REACT_PROFILER_TYPE;\nvar StrictMode = REACT_STRICT_MODE_TYPE;\nvar Suspense = REACT_SUSPENSE_TYPE;\nvar hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated\n\nfunction isAsyncMode(object) {\n {\n if (!hasWarnedAboutDeprecatedIsAsyncMode) {\n hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint\n\n console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.');\n }\n }\n\n return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;\n}\nfunction isConcurrentMode(object) {\n return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;\n}\nfunction isContextConsumer(object) {\n return typeOf(object) === REACT_CONTEXT_TYPE;\n}\nfunction isContextProvider(object) {\n return typeOf(object) === REACT_PROVIDER_TYPE;\n}\nfunction isElement(object) {\n return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;\n}\nfunction isForwardRef(object) {\n return typeOf(object) === REACT_FORWARD_REF_TYPE;\n}\nfunction isFragment(object) {\n return typeOf(object) === REACT_FRAGMENT_TYPE;\n}\nfunction isLazy(object) {\n return typeOf(object) === REACT_LAZY_TYPE;\n}\nfunction isMemo(object) {\n return typeOf(object) === REACT_MEMO_TYPE;\n}\nfunction isPortal(object) {\n return typeOf(object) === REACT_PORTAL_TYPE;\n}\nfunction isProfiler(object) {\n return typeOf(object) === REACT_PROFILER_TYPE;\n}\nfunction isStrictMode(object) {\n return typeOf(object) === REACT_STRICT_MODE_TYPE;\n}\nfunction isSuspense(object) {\n return typeOf(object) === REACT_SUSPENSE_TYPE;\n}\n\nexports.AsyncMode = AsyncMode;\nexports.ConcurrentMode = ConcurrentMode;\nexports.ContextConsumer = ContextConsumer;\nexports.ContextProvider = ContextProvider;\nexports.Element = Element;\nexports.ForwardRef = ForwardRef;\nexports.Fragment = Fragment;\nexports.Lazy = Lazy;\nexports.Memo = Memo;\nexports.Portal = Portal;\nexports.Profiler = Profiler;\nexports.StrictMode = StrictMode;\nexports.Suspense = Suspense;\nexports.isAsyncMode = isAsyncMode;\nexports.isConcurrentMode = isConcurrentMode;\nexports.isContextConsumer = isContextConsumer;\nexports.isContextProvider = isContextProvider;\nexports.isElement = isElement;\nexports.isForwardRef = isForwardRef;\nexports.isFragment = isFragment;\nexports.isLazy = isLazy;\nexports.isMemo = isMemo;\nexports.isPortal = isPortal;\nexports.isProfiler = isProfiler;\nexports.isStrictMode = isStrictMode;\nexports.isSuspense = isSuspense;\nexports.isValidElementType = isValidElementType;\nexports.typeOf = typeOf;\n })();\n}\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/react-is.production.min.js');\n} else {\n module.exports = require('./cjs/react-is.development.js');\n}\n","import { registerBlockType } from '@wordpress/blocks'; \r\nimport { BlockAlignmentToolbar, BlockControls, InspectorControls, MediaUpload, MediaUploadCheck } from '@wordpress/block-editor';\r\nimport { Button, Toolbar, IconButton, Panel, PanelBody, PanelRow, TextControl, DateTimePicker, Icon } from '@wordpress/components';\r\nimport ServerSideRender from '@wordpress/server-side-render';\r\nimport { element, Fragment, useState, useEffect } from '@wordpress/element';\r\nimport { __experimentalGetSettings } from '@wordpress/date';\r\nimport { withState } from '@wordpress/compose';\r\nimport Cropper from 'react-cropper';\r\n\r\n\r\nconst el = React.createElement;\r\nconst cropperRef = React.createRef();\r\n\r\nconst soIcon = el('svg', { className: 'soIcon', width: '166.000000pt', height: '155.000000pt', preserveAspectRatio:\"xMidYMid meet\", viewBox:\"0 0 166.000000 155.000000\" },\r\n\tel('g', {transform:\"translate(0.000000,155.000000) scale(0.100000,-0.100000)\", fill:\"#000000\", stroke:\"none\"},\r\n\t el('path', { d: \"M880 774 l0 -779 98 95 c339 330 682 677 682 691 0 15 -748 759 -771 767 -5 2 -9 -301 -9 -774z\" } ),\r\n\t el('path', { d: \"M0 767 c0 -13 751 -757 764 -757 3 0 6 173 6 385 l0 385 -385 0 c-315 0 -385 -2 -385 -13z\" } )\r\n\t)\r\n);\r\n\r\nconst sSmallIcon = () => (\r\n <Icon icon={ <svg width=\"25\" height=\"25\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <g>\r\n <path stroke=\"null\" id=\"svg_1\" fill-rule=\"evenodd\" fill=\"#010101\" d=\"m14.953703,6.452965c0,0.410933 0.333676,0.744479 0.74461,0.744479c0.410868,0 0.744544,-0.333578 0.744544,-0.744479c0,-0.410966 -0.333676,-0.744544 -0.744544,-0.744544c-0.410966,0 -0.74461,0.333578 -0.74461,0.744544zm-7.44495,4.020342l0,0.818949c0,0.369339 0.300702,0.670008 0.670041,0.670008l8.264031,0l-2.847197,-2.799309c-0.238228,-0.238326 -0.619432,-0.238326 -0.857267,0l-0.601765,0.592587l-1.518916,-1.485975c-0.238195,-0.238326 -0.666894,-0.238326 -0.902139,0l-2.206788,2.203739zm-2.680195,5.062573c0,0.658142 0.533096,1.191172 1.19114,1.191172l11.912085,0c0.65811,0 1.19114,-0.53303 1.19114,-1.191172l0,-11.316449c0,-0.658142 -0.53303,-1.191205 -1.19114,-1.191205l-11.912052,0c-0.658077,0 -1.19114,0.533096 -1.19114,1.191205l0,11.316449l-0.000033,0zm2.144248,-11.018599l10.005933,0c0.363307,0 0.655225,0.291787 0.655225,0.655192l0,7.325804c0,0.363242 -0.291918,0.655127 -0.655225,0.655127l-10.005933,0c-0.363275,0 -0.655258,-0.291885 -0.655258,-0.655127l0,-7.325804c-0.000033,-0.363406 0.291983,-0.655192 0.655258,-0.655192z\" clip-rule=\"evenodd\"/>\r\n </g>\r\n</svg> } />\r\n);\r\n\r\nconst sMediumIcon = () => (\r\n <Icon icon={ <svg width=\"25\" height=\"25\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <g>\r\n <path stroke=\"null\" id=\"svg_1\" fill-rule=\"evenodd\" fill=\"#010101\" d=\"m14.802511,7.322292c0,0.515244 0.418376,0.933455 0.93362,0.933455c0.515161,0 0.933537,-0.418253 0.933537,-0.933455c0,-0.515285 -0.418376,-0.933537 -0.933537,-0.933537c-0.515285,0 -0.93362,0.418253 -0.93362,0.933537zm-9.334758,5.040856l0,1.02683c0,0.46309 0.377032,0.840081 0.840122,0.840081l10.361752,0l-3.569923,-3.509879c-0.298699,-0.298822 -0.776667,-0.298822 -1.074873,0l-0.754515,0.743008l-1.904474,-1.863171c-0.298658,-0.298822 -0.836177,-0.298822 -1.131136,0l-2.766953,2.763131zm-3.360529,6.347644c0,0.825204 0.668415,1.493537 1.493496,1.493537l14.935818,0c0.825162,0 1.493496,-0.668333 1.493496,-1.493537l0,-14.188988c0,-0.825204 -0.668333,-1.493578 -1.493496,-1.493578l-14.935777,0c-0.825121,0 -1.493496,0.668415 -1.493496,1.493578l0,14.188988l-0.000041,0zm2.688539,-13.815532l12.545814,0c0.455528,0 0.821546,0.365853 0.821546,0.821505l0,9.185367c0,0.455446 -0.366017,0.821423 -0.821546,0.821423l-12.545814,0c-0.455487,0 -0.821587,-0.365976 -0.821587,-0.821423l0,-9.185367c-0.000041,-0.455652 0.3661,-0.821505 0.821587,-0.821505z\" clip-rule=\"evenodd\"/>\r\n </g>\r\n</svg> } />\r\n);\r\n\r\nconst sWideIcon = () => (\r\n <Icon icon={ <svg width=\"25\" height=\"25\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <g>\r\n <path stroke=\"null\" id=\"svg_1\" fill-rule=\"evenodd\" fill=\"#010101\" d=\"m16.730116,7.974287c0,0.593476 0.481901,1.075188 1.075377,1.075188c0.593382,0 1.075282,-0.481759 1.075282,-1.075188c0,-0.593524 -0.481901,-1.075282 -1.075282,-1.075282c-0.593524,0 -1.075377,0.481759 -1.075377,1.075282zm-10.752113,5.80624l0,1.18274c0,0.533404 0.434279,0.967636 0.967683,0.967636l11.935042,0l-4.111967,-4.042806c-0.344052,-0.344194 -0.894593,-0.344194 -1.238078,0l-0.869078,0.855823l-2.193642,-2.146067c-0.344005,-0.344194 -0.963139,-0.344194 -1.302883,0l-3.187077,3.182675zm-3.87078,7.311446c0,0.950499 0.769905,1.72031 1.720262,1.72031l17.203617,0c0.950452,0 1.720262,-0.76981 1.720262,-1.72031l0,-16.343391c0,-0.950499 -0.76981,-1.720357 -1.720262,-1.720357l-17.20357,0c-0.950405,0 -1.720262,0.769905 -1.720262,1.720357l0,16.343391l-0.000047,0zm3.096756,-15.913231l14.450724,0c0.524694,0 0.946286,0.421403 0.946286,0.946239l0,10.580039c0,0.5246 -0.421592,0.946144 -0.946286,0.946144l-14.450724,0c-0.524647,0 -0.946334,-0.421545 -0.946334,-0.946144l0,-10.580039c-0.000047,-0.524836 0.421687,-0.946239 0.946334,-0.946239z\" clip-rule=\"evenodd\"/>\r\n </g>\r\n</svg> } />\r\n);\r\n\r\nregisterBlockType( 'squareoffs/blocks', {\r\n title: 'SquareOffs',\r\n icon: soIcon,\r\n category: 'embed',\r\n attributes: {\r\n\t soAlignment: {\r\n\t \ttype: 'string',\r\n\t default : 'left'\r\n\t },\r\n\t soID: {\r\n\t \ttype: 'number'\r\n\t },\r\n\t soSize: {\r\n\t \ttype: 'string',\r\n\t default : 'wide'\r\n\t },\r\n\t soStep: {\r\n\t \ttype: 'number',\r\n\t default: 0\r\n\t },\r\n \tquestion: {type: 'string'},\r\n \tside_1_title: {type: 'string'},\r\n \tside_2_title: {type: 'string'},\r\n \tside_1_defense: {type: 'string'},\r\n \tside_2_defense: {type: 'string'},\r\n \tside_1_photo: {type: 'string'},\r\n \tside_1_photo_raw: {type: 'string'},\r\n \tside_2_photo: {type: 'string'},\r\n \tside_2_photo_raw: {type: 'string'},\r\n \tend_date: {type: 'string'},\r\n \tcategory_uuid: {type: 'string'},\r\n \ttag_list: {type: 'string'},\r\n \tcover_photo: {type: 'string'},\r\n \tcover_photo_raw: {type: 'string'},\r\n \tcover_photo_mime: {type: 'string'},\r\n\t side1MediaID :{type:'string'},\r\n\t side2MediaID :{type:'string'},\r\n\t coverPhotoMediaID :{type:'string'},\r\n\t showRequired :{type:'number'},\r\n\t},\r\n edit: function(props) {\r\n\t\tconst [dateTimePickerFocus, setDateTimePickerFocus] = useState(false);\r\n\t\tconst [createSoStateDone, setCreateSoStateDone] = useState(false);\r\n\r\n\t\tuseEffect(() => {\r\n\t\t console.log(\"CB: \",dateTimePickerFocus);\r\n\t\t console.log(\"DONE: \",createSoStateDone);\r\n\t\t }, [dateTimePickerFocus, createSoStateDone]);\r\n\r\n\r\n\t\tconst fetchStep = 4;\r\n\t\tconst finalStep = 5;\r\n \tconst handleEndDateFocus = (event) => {\r\n \t\tevent.preventDefault();\r\n \t\tevent.stopPropagation();\r\n \t \tsetDateTimePickerFocus(true);\r\n \t};\r\n\r\n \tconst closeDatePicker = (event) => {\r\n\t\t\tevent.preventDefault();\r\n \t\tevent.stopPropagation();\r\n \t\tsetDateTimePickerFocus(false);\r\n \t};\r\n\r\n \tfunction updateSOStep(event) {\r\n\t event.preventDefault();\r\n\t console.log(props.attributes.soStep,\" == \",fetchStep);\r\n\t var proceed = false;\r\n\t console.log(props.attributes);\r\n\t if(props.attributes.soStep == 1){\r\n\t \tif(props.attributes.question && props.attributes.side_1_title && props.attributes.side_2_title) {\r\n\t \t\tproceed = true;\r\n\t\t }else{\r\n\t\t \tprops.setAttributes({showRequired:1});\r\n\t\t \tconsole.log(\"dddd\");\r\n\t\t }\r\n\t\t }else if(props.attributes.soStep == 3){\r\n\t\t\t if(props.attributes.category_uuid) {\r\n\t\t \tproceed = true;\r\n\t\t }else{\r\n\t\t \tprops.setAttributes({showRequired:3});\r\n\t\t }\r\n\t\t }else if(props.attributes.soStep == 0 || props.attributes.soStep == 2) proceed = true;\r\n\r\n\t if(proceed === true){\r\n\t\t if(parseInt(props.attributes.soStep) + 1 == fetchStep){\r\n\t\t \tif(props.attributes.question && props.attributes.side_1_title && props.attributes.side_2_title && props.attributes.category_uuid){\r\n\t\t \t\tcreateSquareOffs();\r\n\t\t \t\tprops.setAttributes({soStep: parseInt(props.attributes.soStep) + parseInt(1)});\r\n\t\t \t}\r\n\t\t }else{\r\n\t\t \tprops.setAttributes({soStep: parseInt(props.attributes.soStep) + parseInt(1)});\r\n\t\t }\r\n\t\t }\r\n\t }\r\n\r\n\t \r\n\t async function createSquareOffs(){\r\n\t \tvar form_data = new FormData();\r\n\t\t\tfor ( var key in props.attributes ) {\r\n\t\t\t form_data.append(key, props.attributes[key]);\r\n\t\t\t}\r\n\r\n\t\t\tform_data.append('action', 'soCreateSquareOffs');\r\n\t \tconsole.log(\"fetching...\");\r\n\t \tconsole.log(form_data);\r\n\t \tawait fetch( window.ajaxurl, {\r\n \t method: 'POST',\r\n \t body: form_data\r\n \t })\r\n\t\t \t.then(response => response.json())\r\n\t \t\t\t.then(data => doneCreatingSquareOffs(data));\r\n\t }\r\n\t function doneCreatingSquareOffs(data){\r\n\t \tconsole.log(data);\r\n\t \tprops.setAttributes({soID: data.external_id});\r\n\t \tprops.setAttributes({soStep: finalStep});\r\n\t }\r\n\t function backSOStep(event){\r\n\t \tevent.preventDefault();\r\n\t \tconsole.log(props.attributes);\r\n\t \tprops.setAttributes({soStep: parseInt(props.attributes.soStep) - parseInt(1)});\r\n\t }\r\n \tfunction sOStepExisting(event) {\r\n\t event.preventDefault();\r\n\t props.setAttributes({soStep: 10});\r\n\t }\r\n \tfunction sOStepCancel(event) {\r\n\t event.preventDefault();\r\n\t props.setAttributes({soStep: 0});\r\n\t }\r\n \tfunction injectSOShortcode(event) {\r\n\t\t if(props.attributes.soID && props.attributes.soSize && props.attributes.soAlignment) props.setAttributes({soStep: finalStep});\r\n\t }\r\n\r\n\t\tconst soUpdateSOID = ( event ) => {\r\n\t\t\tevent.preventDefault();\r\n\t\t\tif(event.key){\r\n\t\t\t\tif(\"Enter\" == event.key) props.setAttributes({soID: parseInt(event.target.value)});\r\n\t\t\t}else props.setAttributes({soID: parseInt(event.target.value)});\r\n\t\t};\r\n\t\tconst onChangeAlignment = ( newAlignment ) => {\r\n props.setAttributes( { soAlignment: newAlignment === undefined ? 'none' : newAlignment } );\r\n injectSOShortcode();\r\n };\r\n\r\n\t\tconst changeToSmall = () => {\r\n props.setAttributes( { soSize: 'small' } );\r\n injectSOShortcode();\r\n };\r\n\t\tconst changeToMedium = () => {\r\n props.setAttributes( { soSize: 'medium' } );\r\n injectSOShortcode();\r\n };\r\n\t\tconst changeToWide = () => {\r\n props.setAttributes( { soSize: 'wide' } );\r\n injectSOShortcode();\r\n };\r\n\r\nfunction _crop(){\r\n // image in dataUrl\r\n console.log(cropperRef.current.getCroppedCanvas().toDataURL());\r\n }\r\n\t \r\n\t return (\r\n\t\t <div class={'soContainer '+ props.className} >\r\n\t\t\t { props.attributes.soStep == finalStep && props.attributes.soID \r\n\t\t\t \t? \r\n\t\t\t\t \t<div>\r\n\t\t\t\t\t \t<Fragment>\r\n\t\t\t\t\t \t\t<InspectorControls>\r\n\t\t\t\t\t \t\t\t<PanelBody title=\"SquareOffs Settings\" initialOpen={true}>\r\n\t\t\t\t\t \t\t\t\t<PanelRow>\r\n\t\t\t\t\t \t\t\t\t\t<TextControl\r\n\t\t\t\t\t \t\t\t\t\tlabel=\"SquareOff ID\"\r\n\t\t\t\t\t \t\t\t\t\tonKeyUp={soUpdateSOID}\r\n\t\t\t\t\t \t\t\t\t\tonBlur={soUpdateSOID}\r\n\t\t\t\t\t \t\t\t\t\tdefaultValue={props.attributes.soID}\r\n\t\t\t\t\t \t\t\t\t\t/>\r\n\t\t\t\t\t \t\t\t\t</PanelRow>\r\n\t\t\t\t\t \t\t\t</PanelBody>\r\n\t\t\t\t\t \t\t</InspectorControls>\r\n\t\t\t\t\t \t</Fragment>\r\n\t\t\t\t\t \r\n\t\t\t\t\t \t<BlockControls>\r\n\t\t <BlockAlignmentToolbar\r\n\t\t \tcontrols={['left', 'center', 'right']}\r\n\t\t value={props.attributes.soAlignment}\r\n\t\t onChange={ onChangeAlignment }\r\n\t\t />\r\n\t\t\t <Toolbar>\r\n\t\t\t\t\t\t\t\t <IconButton\r\n\t\t\t\t\t\t\t\t icon= {sSmallIcon}\r\n\t\t\t\t\t\t\t\t label=\"Small\"\r\n\t\t\t\t\t\t\t\t value=\"small\"\r\n\t\t\t\t\t\t\t\t onClick={changeToSmall}\r\n\t\t\t\t\t\t\t\t />\r\n\t\t\t\t\t\t\t\t <IconButton\r\n\t\t\t\t\t\t\t\t icon={sMediumIcon}\r\n\t\t\t\t\t\t\t\t label=\"Medium\"\r\n\t\t\t\t\t\t\t\t value=\"medium\"\r\n\t\t\t\t\t\t\t\t onClick={ changeToMedium }\r\n\t\t\t\t\t\t\t\t />\r\n\t\t\t\t\t\t\t\t <IconButton\r\n\t\t\t\t\t\t\t\t icon={sWideIcon}\r\n\t\t\t\t\t\t\t\t label=\"Wide\"\r\n\t\t\t\t\t\t\t\t value=\"wide\"\r\n\t\t\t\t\t\t\t\t onClick={ changeToWide }\r\n\t\t\t\t\t\t\t\t />\r\n\t\t\t\t\t\t\t\t</Toolbar>\r\n\t\t\t\t\t\t\t</BlockControls>\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t : \r\n\t\t\t\t\t null\r\n\t\t\t }\r\n\t\t\t { props.attributes.soStep == finalStep\r\n\t\t\t \t? \r\n\t\t\t \t\t<div>\r\n\t\t\t\t \t\t<div class=\"soClickHandle\"></div>\r\n\t\t\t\t \t\t<ServerSideRender \r\n\t\t\t\t\t \t\tblock='squareoffs/blocks'\r\n\t \t\t\t\t attributes={ {\r\n\t \t\t\t\t \tsoID:props.attributes.soID,\r\n\t \t\t\t\t \tsoSize:props.attributes.soSize,\r\n\t \t\t\t\t \tsoAlignment:props.attributes.soAlignment\r\n\t \t\t\t\t } }\r\n \t\t\t\t \t/>\r\n\t\t\t\t \t</div>\r\n\t\t\t\t : \r\n\t\t\t\t\t<div class={'components-placeholder soCont'+props.attributes.soStep}>\r\n\t\t\t\t \t<img class=\"squareOffsLogo\" src=\"https://squareoffs.com/assets/Logo-343c6a748ac336ca96afdf9d72fdeb3d70f1478434f3566ae459fd1707da8d18.svg\" />\r\n\t\t\t\t \t{ props.attributes.soStep == 0 ?\r\n\t\t\t\t\t \t<div class=\"soStep soStep0\">\r\n\t\t\t\t\t \t\t<Button isPrimary onClick={updateSOStep}>Create new SquareOff</Button>\r\n\t\t\t\t\t \t\t<Button isSecondary onClick={sOStepExisting}>Insert Existing SquareOff</Button>\r\n\t\t\t\t\t \t</div>\r\n\t\t\t\t\t \t: null\r\n\t\t\t\t\t }\r\n\t\t\t\t\t { props.attributes.soStep == 10 ?\r\n\t\t\t\t\t \t<div class=\"soStep soStep10\">\r\n\t\t\t\t\t \t\t<h2>Insert Existing SquareOff</h2>\r\n\t\t\t\t\t \t\t<p><input onChange={soUpdateSOID} type=\"text\" defaultValue={props.attributes.soID} placeholder=\"SquareOff ID\"></input></p>\r\n\t\t\t\t\t \t\t<p><Button isPrimary onClick={injectSOShortcode}>Embed</Button>\r\n\t\t\t\t\t \t\t<Button isSecondary onClick={sOStepCancel}>Cancel</Button></p>\r\n\t\t\t\t\t \t</div>\r\n\t\t\t\t\t \t: null\r\n\t\t\t\t\t }\r\n\t\t\t\t\t { props.attributes.soStep == 1 ?\r\n\t\t\t\t\t \t<div class=\"soStep soStep1\">\r\n\t\t\t\t\t \t\t{ !props.attributes.cover_photo_raw ?<p class=\"soCoverPhoto\"><img src={window.soVars.soURL + 'assets/16x9.png'}/></p> :null }\r\n\t\t\t\t\t\t\t\t\t<Cropper\r\n\t\t\t\t\t\t\t\t\tref={cropperRef}\r\n\t\t\t\t\t\t\t\t\tsrc={ props.attributes.cover_photo_raw }\r\n\t\t\t\t\t\t\t\t\tstyle={{height: 'auto', width: '100%'}}\r\n\t\t\t\t\t\t\t\t\t// Cropper.js options\r\n\t\t\t\t\t\t\t\t\taspectRatio={16 / 9}\r\n\t\t\t\t\t\t\t\t\tguides={true}\r\n\t\t\t\t\t\t\t\t\tviewMode={1}\r\n\t\t\t\t\t\t\t\t\tcrop={() => {props.setAttributes({cover_photo: cropperRef.current.getCroppedCanvas().toDataURL(props.attributes.cover_photo_mime)})}} />\t\t\t\t \t\t\r\n\r\n\t\t\t\t\t \t\t<MediaUploadCheck>\r\n\t\t\t \t\t\t\t\t<MediaUpload\r\n\t\t\t \t\t\t\t\t\tonSelect={ ( media ) => {props.setAttributes({cover_photo_mime:media.mime}) ;props.setAttributes({cover_photo_raw:media.url}) }}\r\n\t\t\t \t\t\t\t\t\tallowedTypes='image'\r\n\t\t\t \t\t\t\t\t\tvalue={ props.attributes.coverPhotoMediaID }\r\n\t\t\t \t\t\t\t\t\trender={ ( { open } ) => (\r\n\t\t\t \t\t\t\t\t\t\t<Button isPrimary onClick={ open }>\r\n\t\t\t \t\t\t\t\t\t\t\tAdd a Cover Photo (max. 5Mb)\r\n\t\t\t \t\t\t\t\t\t\t</Button>\r\n\t\t\t \t\t\t\t\t\t) }\r\n\t\t\t \t\t\t\t\t/>\r\n\t\t\t \t\t\t\t</MediaUploadCheck>\r\n\r\n\t\t\t\t\t \t\t<label>What is your question?</label>\r\n\t\t\t\t\t \t\t<p><textarea type=\"text\" class={props.attributes.showRequired == 1 && !props.attributes.question ?'required':''} value={props.attributes.question} onChange={ ( event ) => props.setAttributes({question:event.target.value}) } placeholder=\"*What is your question?\" maxLength=\"100\"></textarea></p>\r\n\t\t\t\t\t \t\t<label>Side 1 Answer</label>\r\n\t\t\t\t\t \t\t<p><textarea type=\"text\" class={props.attributes.showRequired == 1 && !props.attributes.side_1_title ?'required':''} value={ props.attributes.side_1_title} onChange={ ( event ) => props.setAttributes({side_1_title:event.target.value}) } placeholder=\"*Side 1 Answer\" maxLength=\"20\"></textarea></p>\r\n\t\t\t\t\t \t\t<label>Side 2 Answer</label>\r\n\t\t\t\t\t \t\t<p><textarea type=\"text\" class={props.attributes.showRequired == 1 && !props.attributes.side_2_title ?'required':''} value={ props.attributes.side_2_title} onChange={ ( event ) => props.setAttributes({side_2_title:event.target.value}) } placeholder=\"*Side 2 Answer\" maxLength=\"20\"></textarea></p>\r\n\t\t\t\t\t \t</div>\r\n\t\t\t\t\t \t: null\r\n\t\t\t\t\t }\r\n\t\t\t\t\t { props.attributes.soStep == 2 ?\r\n\t\t\t\t\t \t<div class=\"soStep soStep3\">\r\n\t\t\t\t\t \t\t<h2>Add a defense for each side (optional)</h2>\r\n\t\t\t\t\t \t\t<label>Side 1</label>\r\n\t\t\t\t\t \t\t<p><textarea type=\"text\" value={ props.attributes.side_1_defense } onChange={(event) =>{props.setAttributes({side_1_defense:event.target.value})}} placeholder=\"Add more info, stats, or links to defend this side (optinal).\" maxLength=\"600\"></textarea></p>\r\n\t\t\t\t\t \t\t{props.attributes.side_1_photo ? <p class=\"soPhoto\"><i class=\"removePhoto\" onClick={(event) => {props.setAttributes({side_1_photo:null});}}>x</i><img src={props.attributes.side_1_photo}/></p>:null}\r\n\r\n\t\t\t\t\t \t\t<MediaUploadCheck>\r\n\t\t\t \t\t\t\t\t<MediaUpload\r\n\t\t\t \t\t\t\t\t\tonSelect={ ( media ) => props.setAttributes({side_1_photo:media.url}) }\r\n\t\t\t \t\t\t\t\t\tallowedTypes='image'\r\n\t\t\t \t\t\t\t\t\tvalue={ props.attributes.side1MediaID }\r\n\t\t\t \t\t\t\t\t\trender={ ( { open } ) => (\r\n\t\t\t \t\t\t\t\t\t\t<Button isSecondary onClick={ open }>\r\n\t\t\t \t\t\t\t\t\t\t\tAdd a photo for side 1 (max. 5Mb)\r\n\t\t\t \t\t\t\t\t\t\t</Button>\r\n\t\t\t \t\t\t\t\t\t) }\r\n\t\t\t \t\t\t\t\t/>\r\n\t\t\t \t\t\t\t</MediaUploadCheck>\r\n\t\t\t \t\t\t\t<p><br/></p>\r\n\t\t\t \t\t\t\t<label>Side 2</label>\r\n\t\t\t\t\t \t\t<p><textarea type=\"text\" value={ props.attributes.side_2_defense } onChange={(event) =>{props.setAttributes({side_2_defense:event.target.value})}} placeholder=\"Add more info, stats, or links to defend this side (optinal).\" maxLength=\"600\"></textarea></p>\r\n\t\t\t\t\t \t\t{props.attributes.side_2_photo ? <p class=\"soPhoto\"><i class=\"removePhoto\" onClick={(event) => {props.setAttributes({side_2_photo:null});}}>x</i><img src={props.attributes.side_2_photo}/></p>:null}\r\n\r\n\t\t\t\t\t \t\t<MediaUploadCheck>\r\n\t\t\t \t\t\t\t\t<MediaUpload\r\n\t\t\t \t\t\t\t\t\tonSelect={ ( media ) => props.setAttributes({side_2_photo:media.url}) }\r\n\t\t\t \t\t\t\t\t\tallowedTypes='image'\r\n\t\t\t \t\t\t\t\t\tvalue={ props.attributes.side2MediaID }\r\n\t\t\t \t\t\t\t\t\trender={ ( { open } ) => (\r\n\t\t\t \t\t\t\t\t\t\t<Button isSecondary onClick={ open }>\r\n\t\t\t \t\t\t\t\t\t\t\tAdd a photo for side 2 (max. 5Mb)\r\n\t\t\t \t\t\t\t\t\t\t</Button>\r\n\t\t\t \t\t\t\t\t\t) }\r\n\t\t\t \t\t\t\t\t/>\r\n\t\t\t \t\t\t\t</MediaUploadCheck>\r\n\t\t\t\t\t \t</div>\r\n\t\t\t\t\t \t: null\r\n\t\t\t\t\t }\r\n\t\t\t\t\t { props.attributes.soStep == 3 ?\r\n\t\t\t\t\t \t<div class=\"soStep soStep4\">\r\n\t\t\t\t\t \t\t<h2>Details</h2>\r\n\t\t\t\t\t\t \t\r\n\t\t\t\t\t\t \t<label for=\"socategory\">Category</label>\r\n\t\t\t\t\t\t \t<p><select id=\"socategory\" class={props.attributes.showRequired == 3 && !props.attributes.category_uuid ?'required':''} value={props.attributes.category_uuid} onChange={(event) =>{props.setAttributes({category_uuid:event.target.value})}}>\r\n\t\t\t\t\t\t \t\t<option value=\"\">Category</option>\r\n\t\t\t\t\t\t \t\t<option value=\"e5e6883a-6e9c-4b7e-b247-43629ce4a5db\">Life</option>\r\n\t\t\t\t\t\t \t\t<option value=\"a6840d90-1f50-4e8a-98d0-c1c1c5134a78\">News</option>\r\n\t\t\t\t\t\t \t\t<option value=\"6c806976-e20c-4666-9d33-45896567c155\">Sports</option>\r\n\t\t\t\t\t\t \t</select></p>\r\n\t\t\t\t\t\t \t\r\n\t\t\t\t\t\t \t<label for=\"soTags\">Tags</label>\r\n\t\t\t\t\t \t\t<p><textarea type=\"text\" id=\"soTags\" value={props.attributes.tag_list} onChange={(event) =>{props.setAttributes({tag_list:event.target.value})}} placeholder=\"Comma separated Tags\" maxLength=\"100\"></textarea></p>\r\n\r\n\t\t\t\t\t\t\t\t<label for=\"endDate\">End Date</label>\r\n\t\t\t\t\t\t \t\t<p><input type=\"text\" id=\"endDate\" value={ props.attributes.end_date } onFocus={handleEndDateFocus} /></p>\r\n\t\t\t\t\t\t \t\t{dateTimePickerFocus == true \r\n\t\t\t\t\t\t \t\t\t? (\r\n\t\t\t\t\t\t \t\t\t<div class=\"DateTimePicker\">\r\n\t\t\t\t\t\t\t\t \t\t<DateTimePicker\r\n\t\t\t\t\t\t\t\t \t\t currentDate={ props.attributes.end_date }\r\n\t\t\t\t\t\t\t\t \t\t onChange={ ( date ) => props.setAttributes( {end_date: date } ) }\r\n\t\t\t\t\t\t\t\t \t\t is12Hour={ true }\r\n\t\t\t\t\t\t\t\t \t\t/>\r\n\t\t\t\t\t\t\t\t \t\t<Button isPrimary onClick={closeDatePicker}>OK</Button>\r\n\t\t\t\t\t\t\t \t\t</div>\r\n\t\t\t\t\t\t\t \t\t)\r\n\t\t\t\t\t\t\t \t\t:null\r\n\t\t\t\t\t\t\t \t}\r\n\r\n\t\t\t \t\t\t\t<label for=\"soSize\">Size</label>\r\n\t\t\t \t\t\t\t<div class=\"soRadioSizes\">\r\n\t\t\t \t\t\t\t\t<div>\r\n\t\t\t \t\t\t\t\t\t<i class=\"small\" onClick={(event) => {props.setAttributes({soSize:'small'})}}></i>\r\n\t\t\t \t\t\t\t\t\t<input type=\"radio\" value=\"small\" checked={props.attributes.soSize === 'small'} onChange={(event) =>{props.setAttributes({soSize:event.target.value})}} />\r\n\t\t\t \t\t\t\t\t</div>\r\n\t\t\t \t\t\t\t\t<div>\r\n\t\t\t \t\t\t\t\t\t<i class=\"medium\" onClick={(event) => {props.setAttributes({soSize:'medium'})}}></i>\r\n\t\t\t \t\t\t\t\t\t<input type=\"radio\" value=\"medium\" checked={props.attributes.soSize === 'medium'} onChange={(event) =>{props.setAttributes({soSize:event.target.value})}} />\r\n\t\t\t \t\t\t\t\t</div>\r\n\t\t\t \t\t\t\t\t<div>\r\n\t\t\t \t\t\t\t\t\t<i class=\"wide\" onClick={(event) => {props.setAttributes({soSize:'wide'})}}></i>\r\n\t\t\t \t\t\t\t\t\t<input type=\"radio\" value=\"wide\" checked={props.attributes.soSize === 'wide'} onChange={(event) =>{props.setAttributes({soSize:event.target.value})}} />\r\n\t\t\t \t\t\t\t\t</div>\r\n\t\t\t \t\t\t\t</div>\r\n\t\t\t\t\t \t</div>\r\n\t\t\t\t\t \t: null\r\n\t\t\t\t\t }\r\n\t\t\t\t\t { props.attributes.soStep == fetchStep ?\r\n\t\t\t\t\t \t<div class=\"soStep soStep5\" id={props.attributes.soStep}>\r\n\t\t\t\t\t \t\t<p>Please wait while we're creating your SquareOff...</p>\r\n\t\t\t\t\t \t</div>\r\n\t\t\t\t\t \t: null\r\n\t\t\t\t\t }\r\n\t\t\t\t\t { props.attributes.soStep !== 0 && props.attributes.soStep !== fetchStep && props.attributes.soStep !== finalStep && props.attributes.soStep !=10 ?\r\n\t\t\t\t\t \t<div class=\"btnControls\">\r\n\t\t\t\t\t \t\t<Button isPrimary onClick={updateSOStep}>{props.attributes.soStep == fetchStep - 1 ? 'Submit':'Next'}</Button>\r\n\t\t\t\t\t \t\t{ props.attributes.soStep >1 ? <Button isSecondary onClick={backSOStep}>Back</Button> : null }\r\n\t\t\t\t\t\t \t<Button isTertiary onClick={sOStepCancel}>Cancel</Button>\r\n\t\t\t\t\t \t</div>\r\n\t\t\t\t\t \t: null\r\n\t\t\t\t\t }\r\n\t\t\t\t </div>\r\n\t\t\t }\r\n\t\t </div>\r\n\t\t);\r\n \t},\r\n save: function() {\r\n \treturn null;\r\n },\r\n\r\n} );\r\n\r\n// export default Cropper;\r\n","(function() { module.exports = this[\"regeneratorRuntime\"]; }());","(function() { module.exports = this[\"wp\"][\"blockEditor\"]; }());","(function() { module.exports = this[\"wp\"][\"blocks\"]; }());","(function() { module.exports = this[\"wp\"][\"components\"]; }());","(function() { module.exports = this[\"wp\"][\"compose\"]; }());","(function() { module.exports = this[\"wp\"][\"date\"]; }());","(function() { module.exports = this[\"wp\"][\"element\"]; }());","(function() { module.exports = this[\"wp\"][\"serverSideRender\"]; }());","(function() { module.exports = this[\"React\"]; }());"],"sourceRoot":""}1 {"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./node_modules/@babel/runtime/helpers/arrayLikeToArray.js","webpack:///./node_modules/@babel/runtime/helpers/arrayWithHoles.js","webpack:///./node_modules/@babel/runtime/helpers/asyncToGenerator.js","webpack:///./node_modules/@babel/runtime/helpers/iterableToArrayLimit.js","webpack:///./node_modules/@babel/runtime/helpers/nonIterableRest.js","webpack:///./node_modules/@babel/runtime/helpers/slicedToArray.js","webpack:///./node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js","webpack:///./node_modules/cropperjs/dist/cropper.js","webpack:///./node_modules/prop-types/checkPropTypes.js","webpack:///./node_modules/prop-types/factoryWithTypeCheckers.js","webpack:///./node_modules/prop-types/index.js","webpack:///./node_modules/prop-types/lib/ReactPropTypesSecret.js","webpack:///./node_modules/prop-types/node_modules/object-assign/index.js","webpack:///./node_modules/react-cropper/dist/react-cropper.js","webpack:///./node_modules/react-is/cjs/react-is.development.js","webpack:///./node_modules/react-is/index.js","webpack:///./src/index.js","webpack:///external {\"this\":\"regeneratorRuntime\"}","webpack:///external {\"this\":[\"wp\",\"blockEditor\"]}","webpack:///external {\"this\":[\"wp\",\"blocks\"]}","webpack:///external {\"this\":[\"wp\",\"components\"]}","webpack:///external {\"this\":[\"wp\",\"compose\"]}","webpack:///external {\"this\":[\"wp\",\"date\"]}","webpack:///external {\"this\":[\"wp\",\"element\"]}","webpack:///external {\"this\":[\"wp\",\"serverSideRender\"]}","webpack:///external {\"this\":\"React\"}"],"names":["el","React","createElement","cropperRef","createRef","soIconx","className","width","height","preserveAspectRatio","viewBox","transform","fill","stroke","d","soIcon","sSmallIcon","sMediumIcon","sWideIcon","registerBlockType","title","icon","category","attributes","soAlignment","type","default","soID","soSize","soStep","question","side_1_title","side_2_title","side_1_defense","side_2_defense","side_1_photo","side_1_photo_raw","side_2_photo","side_2_photo_raw","end_date","category_uuid","tag_list","cover_photo","cover_photo_raw","cover_photo_mime","side1MediaID","side2MediaID","coverPhotoMediaID","showRequired","edit","props","useState","dateTimePickerFocus","setDateTimePickerFocus","createSoStateDone","setCreateSoStateDone","useEffect","console","log","fetchStep","finalStep","handleEndDateFocus","event","preventDefault","stopPropagation","closeDatePicker","updateSOStep","proceed","setAttributes","parseInt","createSquareOffs","form_data","FormData","key","append","fetch","window","ajaxurl","method","body","then","response","json","data","doneCreatingSquareOffs","external_id","backSOStep","sOStepExisting","sOStepCancel","injectSOShortcode","soUpdateSOID","target","value","onChangeAlignment","newAlignment","undefined","changeToSmall","changeToMedium","changeToWide","_crop","current","getCroppedCanvas","toDataURL","soVars","soURL","media","mime","url","open","date"],"mappings":";QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;;;;;AClFA;AACA;;AAEA,wCAAwC,SAAS;AACjD;AACA;;AAEA;AACA;;AAEA,mC;;;;;;;;;;;ACVA;AACA;AACA;;AAEA,iC;;;;;;;;;;;ACJA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,KAAK;AACL;AACA;;AAEA,mC;;;;;;;;;;;ACpCA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,6CAA6C,+BAA+B;AAC5E;;AAEA;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;;AAEA,uC;;;;;;;;;;;AC3BA;AACA;AACA;;AAEA,kC;;;;;;;;;;;ACJA,qBAAqB,mBAAO,CAAC,iFAAkB;;AAE/C,2BAA2B,mBAAO,CAAC,6FAAwB;;AAE3D,iCAAiC,mBAAO,CAAC,yGAA8B;;AAEvE,sBAAsB,mBAAO,CAAC,mFAAmB;;AAEjD;AACA;AACA;;AAEA,gC;;;;;;;;;;;ACZA,uBAAuB,mBAAO,CAAC,qFAAoB;;AAEnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,6C;;;;;;;;;;;ACXA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,EAAE,KAA4D;AAC9D,EAAE,SACqD;AACvD,CAAC,oBAAoB;;AAErB;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,mBAAmB,kBAAkB;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA;;AAEA;AACA,mBAAmB,sBAAsB;AACzC;;AAEA;AACA;AACA;AACA,SAAS;AACT,OAAO;AACP;AACA,OAAO;AACP;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,mDAAmD,gBAAgB;;AAEnE;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,4BAA4B;;AAE5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B;;AAE/B;AACA;AACA;AACA;AACA;AACA;AACA,iDAAiD;;AAEjD;AACA,qDAAqD;;AAErD;AACA;AACA,8BAA8B;;AAE9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B;;AAE1B,oCAAoC;;AAEpC;AACA;AACA,gDAAgD;AAChD,wCAAwC;AACxC;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa,EAAE;AACf,eAAe,QAAQ;AACvB;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa,EAAE;AACf,eAAe,QAAQ;AACvB;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa,EAAE;AACf,eAAe,QAAQ;AACvB;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa,EAAE;AACf,eAAe,QAAQ;AACvB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,EAAE;AACf,eAAe,QAAQ;AACvB;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,aAAa,EAAE;AACf,eAAe,QAAQ;AACvB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,EAAE;AACf,eAAe,MAAM;AACrB;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa,EAAE;AACf,aAAa,SAAS;AACtB,eAAe,EAAE;AACjB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa,EAAE;AACf,aAAa,EAAE;AACf,eAAe,OAAO;AACtB;;AAEA;AACA,0FAA0F,aAAa;AACvG;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA,OAAO;AACP;;AAEA;AACA;AACA,sCAAsC,GAAG;AACzC;AACA;AACA,gBAAgB;AAChB,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB,eAAe,OAAO;AACtB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,QAAQ;AACrB,aAAa,OAAO;AACpB;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;AACL;AACA;AACA;AACA,aAAa,QAAQ;AACrB,aAAa,OAAO;AACpB,eAAe,QAAQ;AACvB;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa,QAAQ;AACrB,aAAa,OAAO;AACpB;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,aAAa,QAAQ;AACrB,aAAa,OAAO;AACpB;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,QAAQ;AACrB,aAAa,OAAO;AACpB,aAAa,QAAQ;AACrB;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,OAAO;AACP;AACA,KAAK;;;AAGL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,OAAO;AACpB,eAAe,OAAO;AACtB;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa,QAAQ;AACrB,aAAa,OAAO;AACpB,eAAe,OAAO;AACtB;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa,QAAQ;AACrB,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,aAAa,QAAQ;AACrB,aAAa,OAAO;AACpB;;AAEA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA,4CAA4C;AAC5C;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA,YAAY;AACZ,mBAAmB,QAAQ;AAC3B;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;;AAEA;AACA,GAAG;AACH;AACA;AACA,aAAa,QAAQ;AACrB,aAAa,OAAO;AACpB,aAAa,SAAS;AACtB,aAAa,OAAO;AACpB;;;AAGA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;AACL;AACA;AACA;AACA,aAAa,QAAQ;AACrB,aAAa,OAAO;AACpB,aAAa,SAAS;AACtB,aAAa,OAAO;AACpB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,0DAA0D;;AAE1D;AACA;AACA;;AAEA,gFAAgF,eAAe;AAC/F;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,KAAK;AACL;AACA;AACA;AACA,aAAa,QAAQ;AACrB,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB,eAAe,QAAQ;AACvB;;AAEA;AACA,cAAc;;AAEd;AACA;AACA;AACA;AACA;AACA,OAAO;AACP,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa,QAAQ;AACrB,eAAe,OAAO;AACtB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,OAAO;AACpB,eAAe,QAAQ;AACvB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,OAAO;AACpB,eAAe,OAAO;AACtB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,OAAO;AACpB,eAAe,OAAO;AACtB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,KAAK;;;AAGL;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,OAAO;AACpB,eAAe,OAAO;AACtB;;AAEA;AACA,qCAAqC;;AAErC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,aAAa,OAAO;AACpB,aAAa,QAAQ;AACrB,eAAe,OAAO;AACtB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,aAAa,OAAO;AACpB,eAAe,OAAO;AACtB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB,eAAe,OAAO;AACtB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,OAAO;AACP;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,OAAO;AACpB,eAAe,OAAO;AACtB;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,iBAAiB;AAC9B,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB,eAAe,kBAAkB;AACjC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,qFAAqF;AACrF;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,SAAS;AACtB,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB,eAAe,OAAO;AACtB;;AAEA;AACA;AACA;;AAEA,uBAAuB,YAAY;AACnC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa,OAAO;AACpB,eAAe,YAAY;AAC3B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,aAAa,YAAY;AACzB,aAAa,OAAO;AACpB,eAAe,OAAO;AACtB;;AAEA;AACA,oBAAoB;;AAEpB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,sCAAsC;AACtC;AACA;AACA;AACA,aAAa,YAAY;AACzB,eAAe,OAAO;AACtB;;AAEA;AACA;AACA,oBAAoB;;AAEpB;AACA;AACA;AACA,mBAAmB;;AAEnB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA,mBAAmB,aAAa;AAChC;;AAEA;AACA;AACA;AACA;AACA,2BAA2B;;AAE3B,sEAAsE;;AAEtE;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa,OAAO;AACpB,eAAe,OAAO;AACtB;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,OAAO;AACP;AACA,OAAO;AACP;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC;AACvC,wCAAwC;AACxC,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,WAAW;AACX;AACA,WAAW;AACX;AACA;;AAEA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;;AAEP;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA,oCAAoC;;AAEpC;AACA,gHAAgH;;AAEhH;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC;AACzC,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,6LAA6L;;AAE7L;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,WAAW;AACX;AACA,WAAW;AACX;AACA;;AAEA;AACA;AACA,WAAW;AACX;AACA;AACA,SAAS;;;AAGT;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;;AAEP;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA;AACA,gDAAgD;;AAEhD;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,2CAA2C,gBAAgB,iBAAiB,2BAA2B,4BAA4B,8BAA8B,+BAA+B,sCAAsC;AACtO;AACA;AACA,OAAO;AACP,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,OAAO;AACP,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT,OAAO;AACP;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,8DAA8D;;AAE9D;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA,WAAW;AACX;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA,6BAA6B;;AAE7B;AACA;AACA;;AAEA;AACA;AACA;AACA,OAAO;;AAEP;AACA;AACA,OAAO;AACP;AACA,OAAO;AACP;AACA;;AAEA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT,OAAO;AACP;AACA;AACA;;AAEA;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,OAAO;AACP;AACA,OAAO;;;AAGP;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA;AACA;AACA,iDAAiD;AACjD,SAAS;AACT,OAAO;AACP,mDAAmD;AACnD;;AAEA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT,OAAO;AACP;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;;AAEjB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;;AAEA;AACA;AACA;AACA,eAAe;AACf;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe;AACf;AACA;AACA,aAAa;AACb;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe;AACf;AACA;AACA,aAAa;AACb;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW;AACX;AACA;;AAEA;AACA;AACA;AACA,eAAe;AACf;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW;AACX;AACA;AACA;;AAEA;AACA;AACA,WAAW;;;AAGX;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;;;AAGP;AACA;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,KAAK;AACL;AACA;AACA;AACA,kCAAkC;AAClC,mCAAmC;AACnC,oCAAoC;AACpC;;AAEA;AACA;AACA;AACA;;AAEA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,qCAAqC;;AAErC;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB,eAAe,QAAQ;AACvB,iBAAiB,QAAQ;AACzB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,iBAAiB,QAAQ;AACzB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB,eAAe,MAAM;AACrB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;;AAEA;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,MAAM;AACrB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;;AAEZ;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB,iBAAiB,QAAQ;AACzB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,QAAQ;AACvB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,iBAAiB,OAAO;AACxB;AACA;AACA,mCAAmC;AACnC,KAAK;;AAEL;AACA;AACA,iBAAiB,OAAO;AACxB;AACA;AACA,mCAAmC;AACnC,KAAK;;AAEL;AACA;AACA,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;;AAEA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO,YAAY;AAClC,iBAAiB,kBAAkB;AACnC;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,oFAAoF;;AAEpF;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,OAAO;;AAEP;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,OAAO;;;AAGP;AACA,uCAAuC;;AAEvC;AACA;AACA;AACA,oBAAoB;;AAEpB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;;AAEA,qDAAqD;;AAErD;AACA;AACA;AACA,OAAO;AACP;;;AAGA;AACA;AACA,OAAO;AACP;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB,iBAAiB,QAAQ;AACzB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,OAAO,YAAY;AAClC;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA,8BAA8B;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA,4BAA4B;;AAE5B;AACA,iCAAiC;;AAEjC;AACA;AACA,WAAW;;;AAGX;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,SAAS;;;AAGT;AACA;AACA;AACA,SAAS;;;AAGT;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;;AAEA;AACA,SAAS;AACT;;;AAGA;AACA;AACA;AACA,uBAAuB;AACvB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,UAAU;;;AAGV;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,uCAAuC;AACvC;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW;;;AAGX;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA,2BAA2B;AAC3B;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;;AAEA;AACA,UAAU;;;AAGV;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,oCAAoC;AACpC;;AAEA;AACA,8CAA8C,+BAA+B,8BAA8B,4BAA4B,2BAA2B,eAAe,uBAAuB,WAAW,gBAAgB;AACnO;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,+BAA+B;;AAE/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC;;AAElC,wCAAwC;;AAExC,6DAA6D;;AAE7D;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,WAAW;AACX;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,mBAAmB,QAAQ;AAC3B;;AAEA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,OAAO;AACxB;;AAEA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA,GAAG;;AAEH;;AAEA;;AAEA,CAAC;;;;;;;;;;;;;AC/hHD;AACA;AACA;AACA;AACA;AACA;;AAEa;;AAEb;;AAEA,IAAI,IAAqC;AACzC,6BAA6B,mBAAO,CAAC,yFAA4B;AACjE;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,UAAU;AACrB;AACA;AACA;AACA,MAAM,IAAqC;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4GAA4G;AAC5G;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,2DAA2D;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,IAAqC;AAC3C;AACA;AACA;;AAEA;;;;;;;;;;;;;ACrGA;AACA;AACA;AACA;AACA;AACA;;AAEa;;AAEb,cAAc,mBAAO,CAAC,kDAAU;AAChC,aAAa,mBAAO,CAAC,oFAAe;;AAEpC,2BAA2B,mBAAO,CAAC,yFAA4B;AAC/D,qBAAqB,mBAAO,CAAC,qEAAkB;;AAE/C;AACA;;AAEA,IAAI,IAAqC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,0CAA0C;;AAE1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,QAAQ;AACrB,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV,6BAA6B;AAC7B,QAAQ;AACR;AACA;AACA;AACA;AACA,+BAA+B,KAAK;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,4BAA4B;AAC5B,OAAO;AACP;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,QAAQ,IAAqC;AAC7C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,UAAU,KAAqC;AACxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB,sBAAsB;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,UAAU,IAAqC;AAC/C;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,qBAAqB,2BAA2B;AAChD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,MAAM,KAAqC,4FAA4F,SAAM;AAC7I;AACA;;AAEA,mBAAmB,gCAAgC;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,qBAAqB,gCAAgC;AACrD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;;;;;;;;;;;AC9kBA;AACA;AACA;AACA;AACA;AACA;;AAEA,IAAI,IAAqC;AACzC,gBAAgB,mBAAO,CAAC,kDAAU;;AAElC;AACA;AACA;AACA,mBAAmB,mBAAO,CAAC,uFAA2B;AACtD,CAAC,MAAM,EAIN;;;;;;;;;;;;;AClBD;AACA;AACA;AACA;AACA;AACA;;AAEa;;AAEb;;AAEA;;;;;;;;;;;;;ACXA;AACA;AACA;AACA;AACA;;AAEa;AACb;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,gCAAgC;AAChC;AACA;AACA;AACA;;AAEA;AACA;AACA,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH,kCAAkC;AAClC;AACA;AACA;;AAEA;AACA,EAAE;AACF;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,gBAAgB,sBAAsB;AACtC;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,kBAAkB,oBAAoB;AACtC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;;;;;;;;;;;ACzFa;;AAEb;AACA;AACA,CAAC;AACD;;AAEA,qCAAqC,mBAAO,CAAC,oBAAO;;AAEpD,wCAAwC,mBAAO,CAAC,sDAAY;;AAE5D,wCAAwC,mBAAO,CAAC,2DAAW;;AAE3D,sCAAsC,uCAAuC,gBAAgB;;AAE7F,uCAAuC,6BAA6B,YAAY,EAAE,OAAO,iBAAiB,mBAAmB,uBAAuB,sDAAsD,sHAAsH,4BAA4B,0CAA0C,EAAE,OAAO,wBAAwB,EAAE,EAAE,EAAE,EAAE,sBAAsB,eAAe,EAAE;;AAEtd,uBAAuB,2EAA2E,kCAAkC,mBAAmB,GAAG,EAAE,OAAO,kCAAkC,8HAA8H,GAAG,EAAE,qBAAqB;;AAE7V,2CAA2C,kBAAkB,kCAAkC,qEAAqE,EAAE,EAAE,OAAO,kBAAkB,EAAE,YAAY;;AAE/M,qBAAqB,gDAAgD,gBAAgB,sBAAsB,OAAO,2BAA2B,0BAA0B,yDAAyD,2BAA2B,EAAE,EAAE,EAAE,eAAe,GAAG,wCAAwC;;AAE3T,iDAAiD,0CAA0C,0DAA0D,EAAE;;AAEvJ,2CAA2C,gBAAgB,kBAAkB,OAAO,2BAA2B,wDAAwD,gCAAgC,uDAAuD,2DAA2D,EAAE;;AAE3T,6DAA6D,sEAAsE,8DAA8D,oBAAoB;;AAErN,iDAAiD,0EAA0E,aAAa,EAAE,qCAAqC;;AAE/K,uCAAuC,uBAAuB,uFAAuF,EAAE,aAAa;;AAEpK,6BAA6B,gGAAgG,gDAAgD,GAAG,2BAA2B;;AAE3M,0CAA0C,+DAA+D,2EAA2E,EAAE,yEAAyE,eAAe,sDAAsD,EAAE,EAAE,uDAAuD;;AAE/X,gCAAgC,4EAA4E,iBAAiB,UAAU,GAAG,8BAA8B;;AAExK;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,OAAO;AACP,0BAA0B,iCAAiC;AAC3D,OAAO,IAAI;AACX;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,OAAO;AACP;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA,GAAG;;AAEH;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;AC/YA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEa;;;;AAIb,IAAI,IAAqC;AACzC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0EAA0E;AAC1E;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gDAAgD;;AAEhD;AACA;AACA;AACA,iDAAiD;;AAEjD;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAC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","file":"index.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"./src/index.js\");\n","function _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n\n for (var i = 0, arr2 = new Array(len); i < len; i++) {\n arr2[i] = arr[i];\n }\n\n return arr2;\n}\n\nmodule.exports = _arrayLikeToArray;","function _arrayWithHoles(arr) {\n if (Array.isArray(arr)) return arr;\n}\n\nmodule.exports = _arrayWithHoles;","function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {\n try {\n var info = gen[key](arg);\n var value = info.value;\n } catch (error) {\n reject(error);\n return;\n }\n\n if (info.done) {\n resolve(value);\n } else {\n Promise.resolve(value).then(_next, _throw);\n }\n}\n\nfunction _asyncToGenerator(fn) {\n return function () {\n var self = this,\n args = arguments;\n return new Promise(function (resolve, reject) {\n var gen = fn.apply(self, args);\n\n function _next(value) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value);\n }\n\n function _throw(err) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err);\n }\n\n _next(undefined);\n });\n };\n}\n\nmodule.exports = _asyncToGenerator;","function _iterableToArrayLimit(arr, i) {\n if (typeof Symbol === \"undefined\" || !(Symbol.iterator in Object(arr))) return;\n var _arr = [];\n var _n = true;\n var _d = false;\n var _e = undefined;\n\n try {\n for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {\n _arr.push(_s.value);\n\n if (i && _arr.length === i) break;\n }\n } catch (err) {\n _d = true;\n _e = err;\n } finally {\n try {\n if (!_n && _i[\"return\"] != null) _i[\"return\"]();\n } finally {\n if (_d) throw _e;\n }\n }\n\n return _arr;\n}\n\nmodule.exports = _iterableToArrayLimit;","function _nonIterableRest() {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\n\nmodule.exports = _nonIterableRest;","var arrayWithHoles = require(\"./arrayWithHoles\");\n\nvar iterableToArrayLimit = require(\"./iterableToArrayLimit\");\n\nvar unsupportedIterableToArray = require(\"./unsupportedIterableToArray\");\n\nvar nonIterableRest = require(\"./nonIterableRest\");\n\nfunction _slicedToArray(arr, i) {\n return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest();\n}\n\nmodule.exports = _slicedToArray;","var arrayLikeToArray = require(\"./arrayLikeToArray\");\n\nfunction _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(o);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);\n}\n\nmodule.exports = _unsupportedIterableToArray;","/*!\n * Cropper.js v1.5.6\n * https://fengyuanchen.github.io/cropperjs\n *\n * Copyright 2015-present Chen Fengyuan\n * Released under the MIT license\n *\n * Date: 2019-10-04T04:33:48.372Z\n */\n\n(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n typeof define === 'function' && define.amd ? define(factory) :\n (global = global || self, global.Cropper = factory());\n}(this, function () { 'use strict';\n\n function _typeof(obj) {\n if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n _typeof = function (obj) {\n return typeof obj;\n };\n } else {\n _typeof = function (obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n }\n\n return _typeof(obj);\n }\n\n function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n }\n\n function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n }\n\n function _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n }\n\n function _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n }\n\n function ownKeys(object, enumerableOnly) {\n var keys = Object.keys(object);\n\n if (Object.getOwnPropertySymbols) {\n var symbols = Object.getOwnPropertySymbols(object);\n if (enumerableOnly) symbols = symbols.filter(function (sym) {\n return Object.getOwnPropertyDescriptor(object, sym).enumerable;\n });\n keys.push.apply(keys, symbols);\n }\n\n return keys;\n }\n\n function _objectSpread2(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i] != null ? arguments[i] : {};\n\n if (i % 2) {\n ownKeys(source, true).forEach(function (key) {\n _defineProperty(target, key, source[key]);\n });\n } else if (Object.getOwnPropertyDescriptors) {\n Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));\n } else {\n ownKeys(source).forEach(function (key) {\n Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));\n });\n }\n }\n\n return target;\n }\n\n function _toConsumableArray(arr) {\n return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();\n }\n\n function _arrayWithoutHoles(arr) {\n if (Array.isArray(arr)) {\n for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];\n\n return arr2;\n }\n }\n\n function _iterableToArray(iter) {\n if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === \"[object Arguments]\") return Array.from(iter);\n }\n\n function _nonIterableSpread() {\n throw new TypeError(\"Invalid attempt to spread non-iterable instance\");\n }\n\n var IS_BROWSER = typeof window !== 'undefined' && typeof window.document !== 'undefined';\n var WINDOW = IS_BROWSER ? window : {};\n var IS_TOUCH_DEVICE = IS_BROWSER ? 'ontouchstart' in WINDOW.document.documentElement : false;\n var HAS_POINTER_EVENT = IS_BROWSER ? 'PointerEvent' in WINDOW : false;\n var NAMESPACE = 'cropper'; // Actions\n\n var ACTION_ALL = 'all';\n var ACTION_CROP = 'crop';\n var ACTION_MOVE = 'move';\n var ACTION_ZOOM = 'zoom';\n var ACTION_EAST = 'e';\n var ACTION_WEST = 'w';\n var ACTION_SOUTH = 's';\n var ACTION_NORTH = 'n';\n var ACTION_NORTH_EAST = 'ne';\n var ACTION_NORTH_WEST = 'nw';\n var ACTION_SOUTH_EAST = 'se';\n var ACTION_SOUTH_WEST = 'sw'; // Classes\n\n var CLASS_CROP = \"\".concat(NAMESPACE, \"-crop\");\n var CLASS_DISABLED = \"\".concat(NAMESPACE, \"-disabled\");\n var CLASS_HIDDEN = \"\".concat(NAMESPACE, \"-hidden\");\n var CLASS_HIDE = \"\".concat(NAMESPACE, \"-hide\");\n var CLASS_INVISIBLE = \"\".concat(NAMESPACE, \"-invisible\");\n var CLASS_MODAL = \"\".concat(NAMESPACE, \"-modal\");\n var CLASS_MOVE = \"\".concat(NAMESPACE, \"-move\"); // Data keys\n\n var DATA_ACTION = \"\".concat(NAMESPACE, \"Action\");\n var DATA_PREVIEW = \"\".concat(NAMESPACE, \"Preview\"); // Drag modes\n\n var DRAG_MODE_CROP = 'crop';\n var DRAG_MODE_MOVE = 'move';\n var DRAG_MODE_NONE = 'none'; // Events\n\n var EVENT_CROP = 'crop';\n var EVENT_CROP_END = 'cropend';\n var EVENT_CROP_MOVE = 'cropmove';\n var EVENT_CROP_START = 'cropstart';\n var EVENT_DBLCLICK = 'dblclick';\n var EVENT_TOUCH_START = IS_TOUCH_DEVICE ? 'touchstart' : 'mousedown';\n var EVENT_TOUCH_MOVE = IS_TOUCH_DEVICE ? 'touchmove' : 'mousemove';\n var EVENT_TOUCH_END = IS_TOUCH_DEVICE ? 'touchend touchcancel' : 'mouseup';\n var EVENT_POINTER_DOWN = HAS_POINTER_EVENT ? 'pointerdown' : EVENT_TOUCH_START;\n var EVENT_POINTER_MOVE = HAS_POINTER_EVENT ? 'pointermove' : EVENT_TOUCH_MOVE;\n var EVENT_POINTER_UP = HAS_POINTER_EVENT ? 'pointerup pointercancel' : EVENT_TOUCH_END;\n var EVENT_READY = 'ready';\n var EVENT_RESIZE = 'resize';\n var EVENT_WHEEL = 'wheel';\n var EVENT_ZOOM = 'zoom'; // Mime types\n\n var MIME_TYPE_JPEG = 'image/jpeg'; // RegExps\n\n var REGEXP_ACTIONS = /^e|w|s|n|se|sw|ne|nw|all|crop|move|zoom$/;\n var REGEXP_DATA_URL = /^data:/;\n var REGEXP_DATA_URL_JPEG = /^data:image\\/jpeg;base64,/;\n var REGEXP_TAG_NAME = /^img|canvas$/i; // Misc\n // Inspired by the default width and height of a canvas element.\n\n var MIN_CONTAINER_WIDTH = 200;\n var MIN_CONTAINER_HEIGHT = 100;\n\n var DEFAULTS = {\n // Define the view mode of the cropper\n viewMode: 0,\n // 0, 1, 2, 3\n // Define the dragging mode of the cropper\n dragMode: DRAG_MODE_CROP,\n // 'crop', 'move' or 'none'\n // Define the initial aspect ratio of the crop box\n initialAspectRatio: NaN,\n // Define the aspect ratio of the crop box\n aspectRatio: NaN,\n // An object with the previous cropping result data\n data: null,\n // A selector for adding extra containers to preview\n preview: '',\n // Re-render the cropper when resize the window\n responsive: true,\n // Restore the cropped area after resize the window\n restore: true,\n // Check if the current image is a cross-origin image\n checkCrossOrigin: true,\n // Check the current image's Exif Orientation information\n checkOrientation: true,\n // Show the black modal\n modal: true,\n // Show the dashed lines for guiding\n guides: true,\n // Show the center indicator for guiding\n center: true,\n // Show the white modal to highlight the crop box\n highlight: true,\n // Show the grid background\n background: true,\n // Enable to crop the image automatically when initialize\n autoCrop: true,\n // Define the percentage of automatic cropping area when initializes\n autoCropArea: 0.8,\n // Enable to move the image\n movable: true,\n // Enable to rotate the image\n rotatable: true,\n // Enable to scale the image\n scalable: true,\n // Enable to zoom the image\n zoomable: true,\n // Enable to zoom the image by dragging touch\n zoomOnTouch: true,\n // Enable to zoom the image by wheeling mouse\n zoomOnWheel: true,\n // Define zoom ratio when zoom the image by wheeling mouse\n wheelZoomRatio: 0.1,\n // Enable to move the crop box\n cropBoxMovable: true,\n // Enable to resize the crop box\n cropBoxResizable: true,\n // Toggle drag mode between \"crop\" and \"move\" when click twice on the cropper\n toggleDragModeOnDblclick: true,\n // Size limitation\n minCanvasWidth: 0,\n minCanvasHeight: 0,\n minCropBoxWidth: 0,\n minCropBoxHeight: 0,\n minContainerWidth: 200,\n minContainerHeight: 100,\n // Shortcuts of events\n ready: null,\n cropstart: null,\n cropmove: null,\n cropend: null,\n crop: null,\n zoom: null\n };\n\n var TEMPLATE = '<div class=\"cropper-container\" touch-action=\"none\">' + '<div class=\"cropper-wrap-box\">' + '<div class=\"cropper-canvas\"></div>' + '</div>' + '<div class=\"cropper-drag-box\"></div>' + '<div class=\"cropper-crop-box\">' + '<span class=\"cropper-view-box\"></span>' + '<span class=\"cropper-dashed dashed-h\"></span>' + '<span class=\"cropper-dashed dashed-v\"></span>' + '<span class=\"cropper-center\"></span>' + '<span class=\"cropper-face\"></span>' + '<span class=\"cropper-line line-e\" data-cropper-action=\"e\"></span>' + '<span class=\"cropper-line line-n\" data-cropper-action=\"n\"></span>' + '<span class=\"cropper-line line-w\" data-cropper-action=\"w\"></span>' + '<span class=\"cropper-line line-s\" data-cropper-action=\"s\"></span>' + '<span class=\"cropper-point point-e\" data-cropper-action=\"e\"></span>' + '<span class=\"cropper-point point-n\" data-cropper-action=\"n\"></span>' + '<span class=\"cropper-point point-w\" data-cropper-action=\"w\"></span>' + '<span class=\"cropper-point point-s\" data-cropper-action=\"s\"></span>' + '<span class=\"cropper-point point-ne\" data-cropper-action=\"ne\"></span>' + '<span class=\"cropper-point point-nw\" data-cropper-action=\"nw\"></span>' + '<span class=\"cropper-point point-sw\" data-cropper-action=\"sw\"></span>' + '<span class=\"cropper-point point-se\" data-cropper-action=\"se\"></span>' + '</div>' + '</div>';\n\n /**\n * Check if the given value is not a number.\n */\n\n var isNaN = Number.isNaN || WINDOW.isNaN;\n /**\n * Check if the given value is a number.\n * @param {*} value - The value to check.\n * @returns {boolean} Returns `true` if the given value is a number, else `false`.\n */\n\n function isNumber(value) {\n return typeof value === 'number' && !isNaN(value);\n }\n /**\n * Check if the given value is a positive number.\n * @param {*} value - The value to check.\n * @returns {boolean} Returns `true` if the given value is a positive number, else `false`.\n */\n\n var isPositiveNumber = function isPositiveNumber(value) {\n return value > 0 && value < Infinity;\n };\n /**\n * Check if the given value is undefined.\n * @param {*} value - The value to check.\n * @returns {boolean} Returns `true` if the given value is undefined, else `false`.\n */\n\n function isUndefined(value) {\n return typeof value === 'undefined';\n }\n /**\n * Check if the given value is an object.\n * @param {*} value - The value to check.\n * @returns {boolean} Returns `true` if the given value is an object, else `false`.\n */\n\n function isObject(value) {\n return _typeof(value) === 'object' && value !== null;\n }\n var hasOwnProperty = Object.prototype.hasOwnProperty;\n /**\n * Check if the given value is a plain object.\n * @param {*} value - The value to check.\n * @returns {boolean} Returns `true` if the given value is a plain object, else `false`.\n */\n\n function isPlainObject(value) {\n if (!isObject(value)) {\n return false;\n }\n\n try {\n var _constructor = value.constructor;\n var prototype = _constructor.prototype;\n return _constructor && prototype && hasOwnProperty.call(prototype, 'isPrototypeOf');\n } catch (error) {\n return false;\n }\n }\n /**\n * Check if the given value is a function.\n * @param {*} value - The value to check.\n * @returns {boolean} Returns `true` if the given value is a function, else `false`.\n */\n\n function isFunction(value) {\n return typeof value === 'function';\n }\n var slice = Array.prototype.slice;\n /**\n * Convert array-like or iterable object to an array.\n * @param {*} value - The value to convert.\n * @returns {Array} Returns a new array.\n */\n\n function toArray(value) {\n return Array.from ? Array.from(value) : slice.call(value);\n }\n /**\n * Iterate the given data.\n * @param {*} data - The data to iterate.\n * @param {Function} callback - The process function for each element.\n * @returns {*} The original data.\n */\n\n function forEach(data, callback) {\n if (data && isFunction(callback)) {\n if (Array.isArray(data) || isNumber(data.length)\n /* array-like */\n ) {\n toArray(data).forEach(function (value, key) {\n callback.call(data, value, key, data);\n });\n } else if (isObject(data)) {\n Object.keys(data).forEach(function (key) {\n callback.call(data, data[key], key, data);\n });\n }\n }\n\n return data;\n }\n /**\n * Extend the given object.\n * @param {*} target - The target object to extend.\n * @param {*} args - The rest objects for merging to the target object.\n * @returns {Object} The extended object.\n */\n\n var assign = Object.assign || function assign(target) {\n for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n\n if (isObject(target) && args.length > 0) {\n args.forEach(function (arg) {\n if (isObject(arg)) {\n Object.keys(arg).forEach(function (key) {\n target[key] = arg[key];\n });\n }\n });\n }\n\n return target;\n };\n var REGEXP_DECIMALS = /\\.\\d*(?:0|9){12}\\d*$/;\n /**\n * Normalize decimal number.\n * Check out {@link http://0.30000000000000004.com/}\n * @param {number} value - The value to normalize.\n * @param {number} [times=100000000000] - The times for normalizing.\n * @returns {number} Returns the normalized number.\n */\n\n function normalizeDecimalNumber(value) {\n var times = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 100000000000;\n return REGEXP_DECIMALS.test(value) ? Math.round(value * times) / times : value;\n }\n var REGEXP_SUFFIX = /^width|height|left|top|marginLeft|marginTop$/;\n /**\n * Apply styles to the given element.\n * @param {Element} element - The target element.\n * @param {Object} styles - The styles for applying.\n */\n\n function setStyle(element, styles) {\n var style = element.style;\n forEach(styles, function (value, property) {\n if (REGEXP_SUFFIX.test(property) && isNumber(value)) {\n value = \"\".concat(value, \"px\");\n }\n\n style[property] = value;\n });\n }\n /**\n * Check if the given element has a special class.\n * @param {Element} element - The element to check.\n * @param {string} value - The class to search.\n * @returns {boolean} Returns `true` if the special class was found.\n */\n\n function hasClass(element, value) {\n return element.classList ? element.classList.contains(value) : element.className.indexOf(value) > -1;\n }\n /**\n * Add classes to the given element.\n * @param {Element} element - The target element.\n * @param {string} value - The classes to be added.\n */\n\n function addClass(element, value) {\n if (!value) {\n return;\n }\n\n if (isNumber(element.length)) {\n forEach(element, function (elem) {\n addClass(elem, value);\n });\n return;\n }\n\n if (element.classList) {\n element.classList.add(value);\n return;\n }\n\n var className = element.className.trim();\n\n if (!className) {\n element.className = value;\n } else if (className.indexOf(value) < 0) {\n element.className = \"\".concat(className, \" \").concat(value);\n }\n }\n /**\n * Remove classes from the given element.\n * @param {Element} element - The target element.\n * @param {string} value - The classes to be removed.\n */\n\n function removeClass(element, value) {\n if (!value) {\n return;\n }\n\n if (isNumber(element.length)) {\n forEach(element, function (elem) {\n removeClass(elem, value);\n });\n return;\n }\n\n if (element.classList) {\n element.classList.remove(value);\n return;\n }\n\n if (element.className.indexOf(value) >= 0) {\n element.className = element.className.replace(value, '');\n }\n }\n /**\n * Add or remove classes from the given element.\n * @param {Element} element - The target element.\n * @param {string} value - The classes to be toggled.\n * @param {boolean} added - Add only.\n */\n\n function toggleClass(element, value, added) {\n if (!value) {\n return;\n }\n\n if (isNumber(element.length)) {\n forEach(element, function (elem) {\n toggleClass(elem, value, added);\n });\n return;\n } // IE10-11 doesn't support the second parameter of `classList.toggle`\n\n\n if (added) {\n addClass(element, value);\n } else {\n removeClass(element, value);\n }\n }\n var REGEXP_CAMEL_CASE = /([a-z\\d])([A-Z])/g;\n /**\n * Transform the given string from camelCase to kebab-case\n * @param {string} value - The value to transform.\n * @returns {string} The transformed value.\n */\n\n function toParamCase(value) {\n return value.replace(REGEXP_CAMEL_CASE, '$1-$2').toLowerCase();\n }\n /**\n * Get data from the given element.\n * @param {Element} element - The target element.\n * @param {string} name - The data key to get.\n * @returns {string} The data value.\n */\n\n function getData(element, name) {\n if (isObject(element[name])) {\n return element[name];\n }\n\n if (element.dataset) {\n return element.dataset[name];\n }\n\n return element.getAttribute(\"data-\".concat(toParamCase(name)));\n }\n /**\n * Set data to the given element.\n * @param {Element} element - The target element.\n * @param {string} name - The data key to set.\n * @param {string} data - The data value.\n */\n\n function setData(element, name, data) {\n if (isObject(data)) {\n element[name] = data;\n } else if (element.dataset) {\n element.dataset[name] = data;\n } else {\n element.setAttribute(\"data-\".concat(toParamCase(name)), data);\n }\n }\n /**\n * Remove data from the given element.\n * @param {Element} element - The target element.\n * @param {string} name - The data key to remove.\n */\n\n function removeData(element, name) {\n if (isObject(element[name])) {\n try {\n delete element[name];\n } catch (error) {\n element[name] = undefined;\n }\n } else if (element.dataset) {\n // #128 Safari not allows to delete dataset property\n try {\n delete element.dataset[name];\n } catch (error) {\n element.dataset[name] = undefined;\n }\n } else {\n element.removeAttribute(\"data-\".concat(toParamCase(name)));\n }\n }\n var REGEXP_SPACES = /\\s\\s*/;\n\n var onceSupported = function () {\n var supported = false;\n\n if (IS_BROWSER) {\n var once = false;\n\n var listener = function listener() {};\n\n var options = Object.defineProperty({}, 'once', {\n get: function get() {\n supported = true;\n return once;\n },\n\n /**\n * This setter can fix a `TypeError` in strict mode\n * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Getter_only}\n * @param {boolean} value - The value to set\n */\n set: function set(value) {\n once = value;\n }\n });\n WINDOW.addEventListener('test', listener, options);\n WINDOW.removeEventListener('test', listener, options);\n }\n\n return supported;\n }();\n /**\n * Remove event listener from the target element.\n * @param {Element} element - The event target.\n * @param {string} type - The event type(s).\n * @param {Function} listener - The event listener.\n * @param {Object} options - The event options.\n */\n\n\n function removeListener(element, type, listener) {\n var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};\n var handler = listener;\n type.trim().split(REGEXP_SPACES).forEach(function (event) {\n if (!onceSupported) {\n var listeners = element.listeners;\n\n if (listeners && listeners[event] && listeners[event][listener]) {\n handler = listeners[event][listener];\n delete listeners[event][listener];\n\n if (Object.keys(listeners[event]).length === 0) {\n delete listeners[event];\n }\n\n if (Object.keys(listeners).length === 0) {\n delete element.listeners;\n }\n }\n }\n\n element.removeEventListener(event, handler, options);\n });\n }\n /**\n * Add event listener to the target element.\n * @param {Element} element - The event target.\n * @param {string} type - The event type(s).\n * @param {Function} listener - The event listener.\n * @param {Object} options - The event options.\n */\n\n function addListener(element, type, listener) {\n var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};\n var _handler = listener;\n type.trim().split(REGEXP_SPACES).forEach(function (event) {\n if (options.once && !onceSupported) {\n var _element$listeners = element.listeners,\n listeners = _element$listeners === void 0 ? {} : _element$listeners;\n\n _handler = function handler() {\n delete listeners[event][listener];\n element.removeEventListener(event, _handler, options);\n\n for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n\n listener.apply(element, args);\n };\n\n if (!listeners[event]) {\n listeners[event] = {};\n }\n\n if (listeners[event][listener]) {\n element.removeEventListener(event, listeners[event][listener], options);\n }\n\n listeners[event][listener] = _handler;\n element.listeners = listeners;\n }\n\n element.addEventListener(event, _handler, options);\n });\n }\n /**\n * Dispatch event on the target element.\n * @param {Element} element - The event target.\n * @param {string} type - The event type(s).\n * @param {Object} data - The additional event data.\n * @returns {boolean} Indicate if the event is default prevented or not.\n */\n\n function dispatchEvent(element, type, data) {\n var event; // Event and CustomEvent on IE9-11 are global objects, not constructors\n\n if (isFunction(Event) && isFunction(CustomEvent)) {\n event = new CustomEvent(type, {\n detail: data,\n bubbles: true,\n cancelable: true\n });\n } else {\n event = document.createEvent('CustomEvent');\n event.initCustomEvent(type, true, true, data);\n }\n\n return element.dispatchEvent(event);\n }\n /**\n * Get the offset base on the document.\n * @param {Element} element - The target element.\n * @returns {Object} The offset data.\n */\n\n function getOffset(element) {\n var box = element.getBoundingClientRect();\n return {\n left: box.left + (window.pageXOffset - document.documentElement.clientLeft),\n top: box.top + (window.pageYOffset - document.documentElement.clientTop)\n };\n }\n var location = WINDOW.location;\n var REGEXP_ORIGINS = /^(\\w+:)\\/\\/([^:/?#]*):?(\\d*)/i;\n /**\n * Check if the given URL is a cross origin URL.\n * @param {string} url - The target URL.\n * @returns {boolean} Returns `true` if the given URL is a cross origin URL, else `false`.\n */\n\n function isCrossOriginURL(url) {\n var parts = url.match(REGEXP_ORIGINS);\n return parts !== null && (parts[1] !== location.protocol || parts[2] !== location.hostname || parts[3] !== location.port);\n }\n /**\n * Add timestamp to the given URL.\n * @param {string} url - The target URL.\n * @returns {string} The result URL.\n */\n\n function addTimestamp(url) {\n var timestamp = \"timestamp=\".concat(new Date().getTime());\n return url + (url.indexOf('?') === -1 ? '?' : '&') + timestamp;\n }\n /**\n * Get transforms base on the given object.\n * @param {Object} obj - The target object.\n * @returns {string} A string contains transform values.\n */\n\n function getTransforms(_ref) {\n var rotate = _ref.rotate,\n scaleX = _ref.scaleX,\n scaleY = _ref.scaleY,\n translateX = _ref.translateX,\n translateY = _ref.translateY;\n var values = [];\n\n if (isNumber(translateX) && translateX !== 0) {\n values.push(\"translateX(\".concat(translateX, \"px)\"));\n }\n\n if (isNumber(translateY) && translateY !== 0) {\n values.push(\"translateY(\".concat(translateY, \"px)\"));\n } // Rotate should come first before scale to match orientation transform\n\n\n if (isNumber(rotate) && rotate !== 0) {\n values.push(\"rotate(\".concat(rotate, \"deg)\"));\n }\n\n if (isNumber(scaleX) && scaleX !== 1) {\n values.push(\"scaleX(\".concat(scaleX, \")\"));\n }\n\n if (isNumber(scaleY) && scaleY !== 1) {\n values.push(\"scaleY(\".concat(scaleY, \")\"));\n }\n\n var transform = values.length ? values.join(' ') : 'none';\n return {\n WebkitTransform: transform,\n msTransform: transform,\n transform: transform\n };\n }\n /**\n * Get the max ratio of a group of pointers.\n * @param {string} pointers - The target pointers.\n * @returns {number} The result ratio.\n */\n\n function getMaxZoomRatio(pointers) {\n var pointers2 = _objectSpread2({}, pointers);\n\n var ratios = [];\n forEach(pointers, function (pointer, pointerId) {\n delete pointers2[pointerId];\n forEach(pointers2, function (pointer2) {\n var x1 = Math.abs(pointer.startX - pointer2.startX);\n var y1 = Math.abs(pointer.startY - pointer2.startY);\n var x2 = Math.abs(pointer.endX - pointer2.endX);\n var y2 = Math.abs(pointer.endY - pointer2.endY);\n var z1 = Math.sqrt(x1 * x1 + y1 * y1);\n var z2 = Math.sqrt(x2 * x2 + y2 * y2);\n var ratio = (z2 - z1) / z1;\n ratios.push(ratio);\n });\n });\n ratios.sort(function (a, b) {\n return Math.abs(a) < Math.abs(b);\n });\n return ratios[0];\n }\n /**\n * Get a pointer from an event object.\n * @param {Object} event - The target event object.\n * @param {boolean} endOnly - Indicates if only returns the end point coordinate or not.\n * @returns {Object} The result pointer contains start and/or end point coordinates.\n */\n\n function getPointer(_ref2, endOnly) {\n var pageX = _ref2.pageX,\n pageY = _ref2.pageY;\n var end = {\n endX: pageX,\n endY: pageY\n };\n return endOnly ? end : _objectSpread2({\n startX: pageX,\n startY: pageY\n }, end);\n }\n /**\n * Get the center point coordinate of a group of pointers.\n * @param {Object} pointers - The target pointers.\n * @returns {Object} The center point coordinate.\n */\n\n function getPointersCenter(pointers) {\n var pageX = 0;\n var pageY = 0;\n var count = 0;\n forEach(pointers, function (_ref3) {\n var startX = _ref3.startX,\n startY = _ref3.startY;\n pageX += startX;\n pageY += startY;\n count += 1;\n });\n pageX /= count;\n pageY /= count;\n return {\n pageX: pageX,\n pageY: pageY\n };\n }\n /**\n * Get the max sizes in a rectangle under the given aspect ratio.\n * @param {Object} data - The original sizes.\n * @param {string} [type='contain'] - The adjust type.\n * @returns {Object} The result sizes.\n */\n\n function getAdjustedSizes(_ref4) // or 'cover'\n {\n var aspectRatio = _ref4.aspectRatio,\n height = _ref4.height,\n width = _ref4.width;\n var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'contain';\n var isValidWidth = isPositiveNumber(width);\n var isValidHeight = isPositiveNumber(height);\n\n if (isValidWidth && isValidHeight) {\n var adjustedWidth = height * aspectRatio;\n\n if (type === 'contain' && adjustedWidth > width || type === 'cover' && adjustedWidth < width) {\n height = width / aspectRatio;\n } else {\n width = height * aspectRatio;\n }\n } else if (isValidWidth) {\n height = width / aspectRatio;\n } else if (isValidHeight) {\n width = height * aspectRatio;\n }\n\n return {\n width: width,\n height: height\n };\n }\n /**\n * Get the new sizes of a rectangle after rotated.\n * @param {Object} data - The original sizes.\n * @returns {Object} The result sizes.\n */\n\n function getRotatedSizes(_ref5) {\n var width = _ref5.width,\n height = _ref5.height,\n degree = _ref5.degree;\n degree = Math.abs(degree) % 180;\n\n if (degree === 90) {\n return {\n width: height,\n height: width\n };\n }\n\n var arc = degree % 90 * Math.PI / 180;\n var sinArc = Math.sin(arc);\n var cosArc = Math.cos(arc);\n var newWidth = width * cosArc + height * sinArc;\n var newHeight = width * sinArc + height * cosArc;\n return degree > 90 ? {\n width: newHeight,\n height: newWidth\n } : {\n width: newWidth,\n height: newHeight\n };\n }\n /**\n * Get a canvas which drew the given image.\n * @param {HTMLImageElement} image - The image for drawing.\n * @param {Object} imageData - The image data.\n * @param {Object} canvasData - The canvas data.\n * @param {Object} options - The options.\n * @returns {HTMLCanvasElement} The result canvas.\n */\n\n function getSourceCanvas(image, _ref6, _ref7, _ref8) {\n var imageAspectRatio = _ref6.aspectRatio,\n imageNaturalWidth = _ref6.naturalWidth,\n imageNaturalHeight = _ref6.naturalHeight,\n _ref6$rotate = _ref6.rotate,\n rotate = _ref6$rotate === void 0 ? 0 : _ref6$rotate,\n _ref6$scaleX = _ref6.scaleX,\n scaleX = _ref6$scaleX === void 0 ? 1 : _ref6$scaleX,\n _ref6$scaleY = _ref6.scaleY,\n scaleY = _ref6$scaleY === void 0 ? 1 : _ref6$scaleY;\n var aspectRatio = _ref7.aspectRatio,\n naturalWidth = _ref7.naturalWidth,\n naturalHeight = _ref7.naturalHeight;\n var _ref8$fillColor = _ref8.fillColor,\n fillColor = _ref8$fillColor === void 0 ? 'transparent' : _ref8$fillColor,\n _ref8$imageSmoothingE = _ref8.imageSmoothingEnabled,\n imageSmoothingEnabled = _ref8$imageSmoothingE === void 0 ? true : _ref8$imageSmoothingE,\n _ref8$imageSmoothingQ = _ref8.imageSmoothingQuality,\n imageSmoothingQuality = _ref8$imageSmoothingQ === void 0 ? 'low' : _ref8$imageSmoothingQ,\n _ref8$maxWidth = _ref8.maxWidth,\n maxWidth = _ref8$maxWidth === void 0 ? Infinity : _ref8$maxWidth,\n _ref8$maxHeight = _ref8.maxHeight,\n maxHeight = _ref8$maxHeight === void 0 ? Infinity : _ref8$maxHeight,\n _ref8$minWidth = _ref8.minWidth,\n minWidth = _ref8$minWidth === void 0 ? 0 : _ref8$minWidth,\n _ref8$minHeight = _ref8.minHeight,\n minHeight = _ref8$minHeight === void 0 ? 0 : _ref8$minHeight;\n var canvas = document.createElement('canvas');\n var context = canvas.getContext('2d');\n var maxSizes = getAdjustedSizes({\n aspectRatio: aspectRatio,\n width: maxWidth,\n height: maxHeight\n });\n var minSizes = getAdjustedSizes({\n aspectRatio: aspectRatio,\n width: minWidth,\n height: minHeight\n }, 'cover');\n var width = Math.min(maxSizes.width, Math.max(minSizes.width, naturalWidth));\n var height = Math.min(maxSizes.height, Math.max(minSizes.height, naturalHeight)); // Note: should always use image's natural sizes for drawing as\n // imageData.naturalWidth === canvasData.naturalHeight when rotate % 180 === 90\n\n var destMaxSizes = getAdjustedSizes({\n aspectRatio: imageAspectRatio,\n width: maxWidth,\n height: maxHeight\n });\n var destMinSizes = getAdjustedSizes({\n aspectRatio: imageAspectRatio,\n width: minWidth,\n height: minHeight\n }, 'cover');\n var destWidth = Math.min(destMaxSizes.width, Math.max(destMinSizes.width, imageNaturalWidth));\n var destHeight = Math.min(destMaxSizes.height, Math.max(destMinSizes.height, imageNaturalHeight));\n var params = [-destWidth / 2, -destHeight / 2, destWidth, destHeight];\n canvas.width = normalizeDecimalNumber(width);\n canvas.height = normalizeDecimalNumber(height);\n context.fillStyle = fillColor;\n context.fillRect(0, 0, width, height);\n context.save();\n context.translate(width / 2, height / 2);\n context.rotate(rotate * Math.PI / 180);\n context.scale(scaleX, scaleY);\n context.imageSmoothingEnabled = imageSmoothingEnabled;\n context.imageSmoothingQuality = imageSmoothingQuality;\n context.drawImage.apply(context, [image].concat(_toConsumableArray(params.map(function (param) {\n return Math.floor(normalizeDecimalNumber(param));\n }))));\n context.restore();\n return canvas;\n }\n var fromCharCode = String.fromCharCode;\n /**\n * Get string from char code in data view.\n * @param {DataView} dataView - The data view for read.\n * @param {number} start - The start index.\n * @param {number} length - The read length.\n * @returns {string} The read result.\n */\n\n function getStringFromCharCode(dataView, start, length) {\n var str = '';\n length += start;\n\n for (var i = start; i < length; i += 1) {\n str += fromCharCode(dataView.getUint8(i));\n }\n\n return str;\n }\n var REGEXP_DATA_URL_HEAD = /^data:.*,/;\n /**\n * Transform Data URL to array buffer.\n * @param {string} dataURL - The Data URL to transform.\n * @returns {ArrayBuffer} The result array buffer.\n */\n\n function dataURLToArrayBuffer(dataURL) {\n var base64 = dataURL.replace(REGEXP_DATA_URL_HEAD, '');\n var binary = atob(base64);\n var arrayBuffer = new ArrayBuffer(binary.length);\n var uint8 = new Uint8Array(arrayBuffer);\n forEach(uint8, function (value, i) {\n uint8[i] = binary.charCodeAt(i);\n });\n return arrayBuffer;\n }\n /**\n * Transform array buffer to Data URL.\n * @param {ArrayBuffer} arrayBuffer - The array buffer to transform.\n * @param {string} mimeType - The mime type of the Data URL.\n * @returns {string} The result Data URL.\n */\n\n function arrayBufferToDataURL(arrayBuffer, mimeType) {\n var chunks = []; // Chunk Typed Array for better performance (#435)\n\n var chunkSize = 8192;\n var uint8 = new Uint8Array(arrayBuffer);\n\n while (uint8.length > 0) {\n // XXX: Babel's `toConsumableArray` helper will throw error in IE or Safari 9\n // eslint-disable-next-line prefer-spread\n chunks.push(fromCharCode.apply(null, toArray(uint8.subarray(0, chunkSize))));\n uint8 = uint8.subarray(chunkSize);\n }\n\n return \"data:\".concat(mimeType, \";base64,\").concat(btoa(chunks.join('')));\n }\n /**\n * Get orientation value from given array buffer.\n * @param {ArrayBuffer} arrayBuffer - The array buffer to read.\n * @returns {number} The read orientation value.\n */\n\n function resetAndGetOrientation(arrayBuffer) {\n var dataView = new DataView(arrayBuffer);\n var orientation; // Ignores range error when the image does not have correct Exif information\n\n try {\n var littleEndian;\n var app1Start;\n var ifdStart; // Only handle JPEG image (start by 0xFFD8)\n\n if (dataView.getUint8(0) === 0xFF && dataView.getUint8(1) === 0xD8) {\n var length = dataView.byteLength;\n var offset = 2;\n\n while (offset + 1 < length) {\n if (dataView.getUint8(offset) === 0xFF && dataView.getUint8(offset + 1) === 0xE1) {\n app1Start = offset;\n break;\n }\n\n offset += 1;\n }\n }\n\n if (app1Start) {\n var exifIDCode = app1Start + 4;\n var tiffOffset = app1Start + 10;\n\n if (getStringFromCharCode(dataView, exifIDCode, 4) === 'Exif') {\n var endianness = dataView.getUint16(tiffOffset);\n littleEndian = endianness === 0x4949;\n\n if (littleEndian || endianness === 0x4D4D\n /* bigEndian */\n ) {\n if (dataView.getUint16(tiffOffset + 2, littleEndian) === 0x002A) {\n var firstIFDOffset = dataView.getUint32(tiffOffset + 4, littleEndian);\n\n if (firstIFDOffset >= 0x00000008) {\n ifdStart = tiffOffset + firstIFDOffset;\n }\n }\n }\n }\n }\n\n if (ifdStart) {\n var _length = dataView.getUint16(ifdStart, littleEndian);\n\n var _offset;\n\n var i;\n\n for (i = 0; i < _length; i += 1) {\n _offset = ifdStart + i * 12 + 2;\n\n if (dataView.getUint16(_offset, littleEndian) === 0x0112\n /* Orientation */\n ) {\n // 8 is the offset of the current tag's value\n _offset += 8; // Get the original orientation value\n\n orientation = dataView.getUint16(_offset, littleEndian); // Override the orientation with its default value\n\n dataView.setUint16(_offset, 1, littleEndian);\n break;\n }\n }\n }\n } catch (error) {\n orientation = 1;\n }\n\n return orientation;\n }\n /**\n * Parse Exif Orientation value.\n * @param {number} orientation - The orientation to parse.\n * @returns {Object} The parsed result.\n */\n\n function parseOrientation(orientation) {\n var rotate = 0;\n var scaleX = 1;\n var scaleY = 1;\n\n switch (orientation) {\n // Flip horizontal\n case 2:\n scaleX = -1;\n break;\n // Rotate left 180°\n\n case 3:\n rotate = -180;\n break;\n // Flip vertical\n\n case 4:\n scaleY = -1;\n break;\n // Flip vertical and rotate right 90°\n\n case 5:\n rotate = 90;\n scaleY = -1;\n break;\n // Rotate right 90°\n\n case 6:\n rotate = 90;\n break;\n // Flip horizontal and rotate right 90°\n\n case 7:\n rotate = 90;\n scaleX = -1;\n break;\n // Rotate left 90°\n\n case 8:\n rotate = -90;\n break;\n\n default:\n }\n\n return {\n rotate: rotate,\n scaleX: scaleX,\n scaleY: scaleY\n };\n }\n\n var render = {\n render: function render() {\n this.initContainer();\n this.initCanvas();\n this.initCropBox();\n this.renderCanvas();\n\n if (this.cropped) {\n this.renderCropBox();\n }\n },\n initContainer: function initContainer() {\n var element = this.element,\n options = this.options,\n container = this.container,\n cropper = this.cropper;\n addClass(cropper, CLASS_HIDDEN);\n removeClass(element, CLASS_HIDDEN);\n var containerData = {\n width: Math.max(container.offsetWidth, Number(options.minContainerWidth) || 200),\n height: Math.max(container.offsetHeight, Number(options.minContainerHeight) || 100)\n };\n this.containerData = containerData;\n setStyle(cropper, {\n width: containerData.width,\n height: containerData.height\n });\n addClass(element, CLASS_HIDDEN);\n removeClass(cropper, CLASS_HIDDEN);\n },\n // Canvas (image wrapper)\n initCanvas: function initCanvas() {\n var containerData = this.containerData,\n imageData = this.imageData;\n var viewMode = this.options.viewMode;\n var rotated = Math.abs(imageData.rotate) % 180 === 90;\n var naturalWidth = rotated ? imageData.naturalHeight : imageData.naturalWidth;\n var naturalHeight = rotated ? imageData.naturalWidth : imageData.naturalHeight;\n var aspectRatio = naturalWidth / naturalHeight;\n var canvasWidth = containerData.width;\n var canvasHeight = containerData.height;\n\n if (containerData.height * aspectRatio > containerData.width) {\n if (viewMode === 3) {\n canvasWidth = containerData.height * aspectRatio;\n } else {\n canvasHeight = containerData.width / aspectRatio;\n }\n } else if (viewMode === 3) {\n canvasHeight = containerData.width / aspectRatio;\n } else {\n canvasWidth = containerData.height * aspectRatio;\n }\n\n var canvasData = {\n aspectRatio: aspectRatio,\n naturalWidth: naturalWidth,\n naturalHeight: naturalHeight,\n width: canvasWidth,\n height: canvasHeight\n };\n canvasData.left = (containerData.width - canvasWidth) / 2;\n canvasData.top = (containerData.height - canvasHeight) / 2;\n canvasData.oldLeft = canvasData.left;\n canvasData.oldTop = canvasData.top;\n this.canvasData = canvasData;\n this.limited = viewMode === 1 || viewMode === 2;\n this.limitCanvas(true, true);\n this.initialImageData = assign({}, imageData);\n this.initialCanvasData = assign({}, canvasData);\n },\n limitCanvas: function limitCanvas(sizeLimited, positionLimited) {\n var options = this.options,\n containerData = this.containerData,\n canvasData = this.canvasData,\n cropBoxData = this.cropBoxData;\n var viewMode = options.viewMode;\n var aspectRatio = canvasData.aspectRatio;\n var cropped = this.cropped && cropBoxData;\n\n if (sizeLimited) {\n var minCanvasWidth = Number(options.minCanvasWidth) || 0;\n var minCanvasHeight = Number(options.minCanvasHeight) || 0;\n\n if (viewMode > 1) {\n minCanvasWidth = Math.max(minCanvasWidth, containerData.width);\n minCanvasHeight = Math.max(minCanvasHeight, containerData.height);\n\n if (viewMode === 3) {\n if (minCanvasHeight * aspectRatio > minCanvasWidth) {\n minCanvasWidth = minCanvasHeight * aspectRatio;\n } else {\n minCanvasHeight = minCanvasWidth / aspectRatio;\n }\n }\n } else if (viewMode > 0) {\n if (minCanvasWidth) {\n minCanvasWidth = Math.max(minCanvasWidth, cropped ? cropBoxData.width : 0);\n } else if (minCanvasHeight) {\n minCanvasHeight = Math.max(minCanvasHeight, cropped ? cropBoxData.height : 0);\n } else if (cropped) {\n minCanvasWidth = cropBoxData.width;\n minCanvasHeight = cropBoxData.height;\n\n if (minCanvasHeight * aspectRatio > minCanvasWidth) {\n minCanvasWidth = minCanvasHeight * aspectRatio;\n } else {\n minCanvasHeight = minCanvasWidth / aspectRatio;\n }\n }\n }\n\n var _getAdjustedSizes = getAdjustedSizes({\n aspectRatio: aspectRatio,\n width: minCanvasWidth,\n height: minCanvasHeight\n });\n\n minCanvasWidth = _getAdjustedSizes.width;\n minCanvasHeight = _getAdjustedSizes.height;\n canvasData.minWidth = minCanvasWidth;\n canvasData.minHeight = minCanvasHeight;\n canvasData.maxWidth = Infinity;\n canvasData.maxHeight = Infinity;\n }\n\n if (positionLimited) {\n if (viewMode > (cropped ? 0 : 1)) {\n var newCanvasLeft = containerData.width - canvasData.width;\n var newCanvasTop = containerData.height - canvasData.height;\n canvasData.minLeft = Math.min(0, newCanvasLeft);\n canvasData.minTop = Math.min(0, newCanvasTop);\n canvasData.maxLeft = Math.max(0, newCanvasLeft);\n canvasData.maxTop = Math.max(0, newCanvasTop);\n\n if (cropped && this.limited) {\n canvasData.minLeft = Math.min(cropBoxData.left, cropBoxData.left + (cropBoxData.width - canvasData.width));\n canvasData.minTop = Math.min(cropBoxData.top, cropBoxData.top + (cropBoxData.height - canvasData.height));\n canvasData.maxLeft = cropBoxData.left;\n canvasData.maxTop = cropBoxData.top;\n\n if (viewMode === 2) {\n if (canvasData.width >= containerData.width) {\n canvasData.minLeft = Math.min(0, newCanvasLeft);\n canvasData.maxLeft = Math.max(0, newCanvasLeft);\n }\n\n if (canvasData.height >= containerData.height) {\n canvasData.minTop = Math.min(0, newCanvasTop);\n canvasData.maxTop = Math.max(0, newCanvasTop);\n }\n }\n }\n } else {\n canvasData.minLeft = -canvasData.width;\n canvasData.minTop = -canvasData.height;\n canvasData.maxLeft = containerData.width;\n canvasData.maxTop = containerData.height;\n }\n }\n },\n renderCanvas: function renderCanvas(changed, transformed) {\n var canvasData = this.canvasData,\n imageData = this.imageData;\n\n if (transformed) {\n var _getRotatedSizes = getRotatedSizes({\n width: imageData.naturalWidth * Math.abs(imageData.scaleX || 1),\n height: imageData.naturalHeight * Math.abs(imageData.scaleY || 1),\n degree: imageData.rotate || 0\n }),\n naturalWidth = _getRotatedSizes.width,\n naturalHeight = _getRotatedSizes.height;\n\n var width = canvasData.width * (naturalWidth / canvasData.naturalWidth);\n var height = canvasData.height * (naturalHeight / canvasData.naturalHeight);\n canvasData.left -= (width - canvasData.width) / 2;\n canvasData.top -= (height - canvasData.height) / 2;\n canvasData.width = width;\n canvasData.height = height;\n canvasData.aspectRatio = naturalWidth / naturalHeight;\n canvasData.naturalWidth = naturalWidth;\n canvasData.naturalHeight = naturalHeight;\n this.limitCanvas(true, false);\n }\n\n if (canvasData.width > canvasData.maxWidth || canvasData.width < canvasData.minWidth) {\n canvasData.left = canvasData.oldLeft;\n }\n\n if (canvasData.height > canvasData.maxHeight || canvasData.height < canvasData.minHeight) {\n canvasData.top = canvasData.oldTop;\n }\n\n canvasData.width = Math.min(Math.max(canvasData.width, canvasData.minWidth), canvasData.maxWidth);\n canvasData.height = Math.min(Math.max(canvasData.height, canvasData.minHeight), canvasData.maxHeight);\n this.limitCanvas(false, true);\n canvasData.left = Math.min(Math.max(canvasData.left, canvasData.minLeft), canvasData.maxLeft);\n canvasData.top = Math.min(Math.max(canvasData.top, canvasData.minTop), canvasData.maxTop);\n canvasData.oldLeft = canvasData.left;\n canvasData.oldTop = canvasData.top;\n setStyle(this.canvas, assign({\n width: canvasData.width,\n height: canvasData.height\n }, getTransforms({\n translateX: canvasData.left,\n translateY: canvasData.top\n })));\n this.renderImage(changed);\n\n if (this.cropped && this.limited) {\n this.limitCropBox(true, true);\n }\n },\n renderImage: function renderImage(changed) {\n var canvasData = this.canvasData,\n imageData = this.imageData;\n var width = imageData.naturalWidth * (canvasData.width / canvasData.naturalWidth);\n var height = imageData.naturalHeight * (canvasData.height / canvasData.naturalHeight);\n assign(imageData, {\n width: width,\n height: height,\n left: (canvasData.width - width) / 2,\n top: (canvasData.height - height) / 2\n });\n setStyle(this.image, assign({\n width: imageData.width,\n height: imageData.height\n }, getTransforms(assign({\n translateX: imageData.left,\n translateY: imageData.top\n }, imageData))));\n\n if (changed) {\n this.output();\n }\n },\n initCropBox: function initCropBox() {\n var options = this.options,\n canvasData = this.canvasData;\n var aspectRatio = options.aspectRatio || options.initialAspectRatio;\n var autoCropArea = Number(options.autoCropArea) || 0.8;\n var cropBoxData = {\n width: canvasData.width,\n height: canvasData.height\n };\n\n if (aspectRatio) {\n if (canvasData.height * aspectRatio > canvasData.width) {\n cropBoxData.height = cropBoxData.width / aspectRatio;\n } else {\n cropBoxData.width = cropBoxData.height * aspectRatio;\n }\n }\n\n this.cropBoxData = cropBoxData;\n this.limitCropBox(true, true); // Initialize auto crop area\n\n cropBoxData.width = Math.min(Math.max(cropBoxData.width, cropBoxData.minWidth), cropBoxData.maxWidth);\n cropBoxData.height = Math.min(Math.max(cropBoxData.height, cropBoxData.minHeight), cropBoxData.maxHeight); // The width/height of auto crop area must large than \"minWidth/Height\"\n\n cropBoxData.width = Math.max(cropBoxData.minWidth, cropBoxData.width * autoCropArea);\n cropBoxData.height = Math.max(cropBoxData.minHeight, cropBoxData.height * autoCropArea);\n cropBoxData.left = canvasData.left + (canvasData.width - cropBoxData.width) / 2;\n cropBoxData.top = canvasData.top + (canvasData.height - cropBoxData.height) / 2;\n cropBoxData.oldLeft = cropBoxData.left;\n cropBoxData.oldTop = cropBoxData.top;\n this.initialCropBoxData = assign({}, cropBoxData);\n },\n limitCropBox: function limitCropBox(sizeLimited, positionLimited) {\n var options = this.options,\n containerData = this.containerData,\n canvasData = this.canvasData,\n cropBoxData = this.cropBoxData,\n limited = this.limited;\n var aspectRatio = options.aspectRatio;\n\n if (sizeLimited) {\n var minCropBoxWidth = Number(options.minCropBoxWidth) || 0;\n var minCropBoxHeight = Number(options.minCropBoxHeight) || 0;\n var maxCropBoxWidth = limited ? Math.min(containerData.width, canvasData.width, canvasData.width + canvasData.left, containerData.width - canvasData.left) : containerData.width;\n var maxCropBoxHeight = limited ? Math.min(containerData.height, canvasData.height, canvasData.height + canvasData.top, containerData.height - canvasData.top) : containerData.height; // The min/maxCropBoxWidth/Height must be less than container's width/height\n\n minCropBoxWidth = Math.min(minCropBoxWidth, containerData.width);\n minCropBoxHeight = Math.min(minCropBoxHeight, containerData.height);\n\n if (aspectRatio) {\n if (minCropBoxWidth && minCropBoxHeight) {\n if (minCropBoxHeight * aspectRatio > minCropBoxWidth) {\n minCropBoxHeight = minCropBoxWidth / aspectRatio;\n } else {\n minCropBoxWidth = minCropBoxHeight * aspectRatio;\n }\n } else if (minCropBoxWidth) {\n minCropBoxHeight = minCropBoxWidth / aspectRatio;\n } else if (minCropBoxHeight) {\n minCropBoxWidth = minCropBoxHeight * aspectRatio;\n }\n\n if (maxCropBoxHeight * aspectRatio > maxCropBoxWidth) {\n maxCropBoxHeight = maxCropBoxWidth / aspectRatio;\n } else {\n maxCropBoxWidth = maxCropBoxHeight * aspectRatio;\n }\n } // The minWidth/Height must be less than maxWidth/Height\n\n\n cropBoxData.minWidth = Math.min(minCropBoxWidth, maxCropBoxWidth);\n cropBoxData.minHeight = Math.min(minCropBoxHeight, maxCropBoxHeight);\n cropBoxData.maxWidth = maxCropBoxWidth;\n cropBoxData.maxHeight = maxCropBoxHeight;\n }\n\n if (positionLimited) {\n if (limited) {\n cropBoxData.minLeft = Math.max(0, canvasData.left);\n cropBoxData.minTop = Math.max(0, canvasData.top);\n cropBoxData.maxLeft = Math.min(containerData.width, canvasData.left + canvasData.width) - cropBoxData.width;\n cropBoxData.maxTop = Math.min(containerData.height, canvasData.top + canvasData.height) - cropBoxData.height;\n } else {\n cropBoxData.minLeft = 0;\n cropBoxData.minTop = 0;\n cropBoxData.maxLeft = containerData.width - cropBoxData.width;\n cropBoxData.maxTop = containerData.height - cropBoxData.height;\n }\n }\n },\n renderCropBox: function renderCropBox() {\n var options = this.options,\n containerData = this.containerData,\n cropBoxData = this.cropBoxData;\n\n if (cropBoxData.width > cropBoxData.maxWidth || cropBoxData.width < cropBoxData.minWidth) {\n cropBoxData.left = cropBoxData.oldLeft;\n }\n\n if (cropBoxData.height > cropBoxData.maxHeight || cropBoxData.height < cropBoxData.minHeight) {\n cropBoxData.top = cropBoxData.oldTop;\n }\n\n cropBoxData.width = Math.min(Math.max(cropBoxData.width, cropBoxData.minWidth), cropBoxData.maxWidth);\n cropBoxData.height = Math.min(Math.max(cropBoxData.height, cropBoxData.minHeight), cropBoxData.maxHeight);\n this.limitCropBox(false, true);\n cropBoxData.left = Math.min(Math.max(cropBoxData.left, cropBoxData.minLeft), cropBoxData.maxLeft);\n cropBoxData.top = Math.min(Math.max(cropBoxData.top, cropBoxData.minTop), cropBoxData.maxTop);\n cropBoxData.oldLeft = cropBoxData.left;\n cropBoxData.oldTop = cropBoxData.top;\n\n if (options.movable && options.cropBoxMovable) {\n // Turn to move the canvas when the crop box is equal to the container\n setData(this.face, DATA_ACTION, cropBoxData.width >= containerData.width && cropBoxData.height >= containerData.height ? ACTION_MOVE : ACTION_ALL);\n }\n\n setStyle(this.cropBox, assign({\n width: cropBoxData.width,\n height: cropBoxData.height\n }, getTransforms({\n translateX: cropBoxData.left,\n translateY: cropBoxData.top\n })));\n\n if (this.cropped && this.limited) {\n this.limitCanvas(true, true);\n }\n\n if (!this.disabled) {\n this.output();\n }\n },\n output: function output() {\n this.preview();\n dispatchEvent(this.element, EVENT_CROP, this.getData());\n }\n };\n\n var preview = {\n initPreview: function initPreview() {\n var element = this.element,\n crossOrigin = this.crossOrigin;\n var preview = this.options.preview;\n var url = crossOrigin ? this.crossOriginUrl : this.url;\n var alt = element.alt || 'The image to preview';\n var image = document.createElement('img');\n\n if (crossOrigin) {\n image.crossOrigin = crossOrigin;\n }\n\n image.src = url;\n image.alt = alt;\n this.viewBox.appendChild(image);\n this.viewBoxImage = image;\n\n if (!preview) {\n return;\n }\n\n var previews = preview;\n\n if (typeof preview === 'string') {\n previews = element.ownerDocument.querySelectorAll(preview);\n } else if (preview.querySelector) {\n previews = [preview];\n }\n\n this.previews = previews;\n forEach(previews, function (el) {\n var img = document.createElement('img'); // Save the original size for recover\n\n setData(el, DATA_PREVIEW, {\n width: el.offsetWidth,\n height: el.offsetHeight,\n html: el.innerHTML\n });\n\n if (crossOrigin) {\n img.crossOrigin = crossOrigin;\n }\n\n img.src = url;\n img.alt = alt;\n /**\n * Override img element styles\n * Add `display:block` to avoid margin top issue\n * Add `height:auto` to override `height` attribute on IE8\n * (Occur only when margin-top <= -height)\n */\n\n img.style.cssText = 'display:block;' + 'width:100%;' + 'height:auto;' + 'min-width:0!important;' + 'min-height:0!important;' + 'max-width:none!important;' + 'max-height:none!important;' + 'image-orientation:0deg!important;\"';\n el.innerHTML = '';\n el.appendChild(img);\n });\n },\n resetPreview: function resetPreview() {\n forEach(this.previews, function (element) {\n var data = getData(element, DATA_PREVIEW);\n setStyle(element, {\n width: data.width,\n height: data.height\n });\n element.innerHTML = data.html;\n removeData(element, DATA_PREVIEW);\n });\n },\n preview: function preview() {\n var imageData = this.imageData,\n canvasData = this.canvasData,\n cropBoxData = this.cropBoxData;\n var cropBoxWidth = cropBoxData.width,\n cropBoxHeight = cropBoxData.height;\n var width = imageData.width,\n height = imageData.height;\n var left = cropBoxData.left - canvasData.left - imageData.left;\n var top = cropBoxData.top - canvasData.top - imageData.top;\n\n if (!this.cropped || this.disabled) {\n return;\n }\n\n setStyle(this.viewBoxImage, assign({\n width: width,\n height: height\n }, getTransforms(assign({\n translateX: -left,\n translateY: -top\n }, imageData))));\n forEach(this.previews, function (element) {\n var data = getData(element, DATA_PREVIEW);\n var originalWidth = data.width;\n var originalHeight = data.height;\n var newWidth = originalWidth;\n var newHeight = originalHeight;\n var ratio = 1;\n\n if (cropBoxWidth) {\n ratio = originalWidth / cropBoxWidth;\n newHeight = cropBoxHeight * ratio;\n }\n\n if (cropBoxHeight && newHeight > originalHeight) {\n ratio = originalHeight / cropBoxHeight;\n newWidth = cropBoxWidth * ratio;\n newHeight = originalHeight;\n }\n\n setStyle(element, {\n width: newWidth,\n height: newHeight\n });\n setStyle(element.getElementsByTagName('img')[0], assign({\n width: width * ratio,\n height: height * ratio\n }, getTransforms(assign({\n translateX: -left * ratio,\n translateY: -top * ratio\n }, imageData))));\n });\n }\n };\n\n var events = {\n bind: function bind() {\n var element = this.element,\n options = this.options,\n cropper = this.cropper;\n\n if (isFunction(options.cropstart)) {\n addListener(element, EVENT_CROP_START, options.cropstart);\n }\n\n if (isFunction(options.cropmove)) {\n addListener(element, EVENT_CROP_MOVE, options.cropmove);\n }\n\n if (isFunction(options.cropend)) {\n addListener(element, EVENT_CROP_END, options.cropend);\n }\n\n if (isFunction(options.crop)) {\n addListener(element, EVENT_CROP, options.crop);\n }\n\n if (isFunction(options.zoom)) {\n addListener(element, EVENT_ZOOM, options.zoom);\n }\n\n addListener(cropper, EVENT_POINTER_DOWN, this.onCropStart = this.cropStart.bind(this));\n\n if (options.zoomable && options.zoomOnWheel) {\n addListener(cropper, EVENT_WHEEL, this.onWheel = this.wheel.bind(this), {\n passive: false,\n capture: true\n });\n }\n\n if (options.toggleDragModeOnDblclick) {\n addListener(cropper, EVENT_DBLCLICK, this.onDblclick = this.dblclick.bind(this));\n }\n\n addListener(element.ownerDocument, EVENT_POINTER_MOVE, this.onCropMove = this.cropMove.bind(this));\n addListener(element.ownerDocument, EVENT_POINTER_UP, this.onCropEnd = this.cropEnd.bind(this));\n\n if (options.responsive) {\n addListener(window, EVENT_RESIZE, this.onResize = this.resize.bind(this));\n }\n },\n unbind: function unbind() {\n var element = this.element,\n options = this.options,\n cropper = this.cropper;\n\n if (isFunction(options.cropstart)) {\n removeListener(element, EVENT_CROP_START, options.cropstart);\n }\n\n if (isFunction(options.cropmove)) {\n removeListener(element, EVENT_CROP_MOVE, options.cropmove);\n }\n\n if (isFunction(options.cropend)) {\n removeListener(element, EVENT_CROP_END, options.cropend);\n }\n\n if (isFunction(options.crop)) {\n removeListener(element, EVENT_CROP, options.crop);\n }\n\n if (isFunction(options.zoom)) {\n removeListener(element, EVENT_ZOOM, options.zoom);\n }\n\n removeListener(cropper, EVENT_POINTER_DOWN, this.onCropStart);\n\n if (options.zoomable && options.zoomOnWheel) {\n removeListener(cropper, EVENT_WHEEL, this.onWheel, {\n passive: false,\n capture: true\n });\n }\n\n if (options.toggleDragModeOnDblclick) {\n removeListener(cropper, EVENT_DBLCLICK, this.onDblclick);\n }\n\n removeListener(element.ownerDocument, EVENT_POINTER_MOVE, this.onCropMove);\n removeListener(element.ownerDocument, EVENT_POINTER_UP, this.onCropEnd);\n\n if (options.responsive) {\n removeListener(window, EVENT_RESIZE, this.onResize);\n }\n }\n };\n\n var handlers = {\n resize: function resize() {\n var options = this.options,\n container = this.container,\n containerData = this.containerData;\n var minContainerWidth = Number(options.minContainerWidth) || MIN_CONTAINER_WIDTH;\n var minContainerHeight = Number(options.minContainerHeight) || MIN_CONTAINER_HEIGHT;\n\n if (this.disabled || containerData.width <= minContainerWidth || containerData.height <= minContainerHeight) {\n return;\n }\n\n var ratio = container.offsetWidth / containerData.width; // Resize when width changed or height changed\n\n if (ratio !== 1 || container.offsetHeight !== containerData.height) {\n var canvasData;\n var cropBoxData;\n\n if (options.restore) {\n canvasData = this.getCanvasData();\n cropBoxData = this.getCropBoxData();\n }\n\n this.render();\n\n if (options.restore) {\n this.setCanvasData(forEach(canvasData, function (n, i) {\n canvasData[i] = n * ratio;\n }));\n this.setCropBoxData(forEach(cropBoxData, function (n, i) {\n cropBoxData[i] = n * ratio;\n }));\n }\n }\n },\n dblclick: function dblclick() {\n if (this.disabled || this.options.dragMode === DRAG_MODE_NONE) {\n return;\n }\n\n this.setDragMode(hasClass(this.dragBox, CLASS_CROP) ? DRAG_MODE_MOVE : DRAG_MODE_CROP);\n },\n wheel: function wheel(event) {\n var _this = this;\n\n var ratio = Number(this.options.wheelZoomRatio) || 0.1;\n var delta = 1;\n\n if (this.disabled) {\n return;\n }\n\n event.preventDefault(); // Limit wheel speed to prevent zoom too fast (#21)\n\n if (this.wheeling) {\n return;\n }\n\n this.wheeling = true;\n setTimeout(function () {\n _this.wheeling = false;\n }, 50);\n\n if (event.deltaY) {\n delta = event.deltaY > 0 ? 1 : -1;\n } else if (event.wheelDelta) {\n delta = -event.wheelDelta / 120;\n } else if (event.detail) {\n delta = event.detail > 0 ? 1 : -1;\n }\n\n this.zoom(-delta * ratio, event);\n },\n cropStart: function cropStart(event) {\n var buttons = event.buttons,\n button = event.button;\n\n if (this.disabled // Handle mouse event and pointer event and ignore touch event\n || (event.type === 'mousedown' || event.type === 'pointerdown' && event.pointerType === 'mouse') && ( // No primary button (Usually the left button)\n isNumber(buttons) && buttons !== 1 || isNumber(button) && button !== 0 // Open context menu\n || event.ctrlKey)) {\n return;\n }\n\n var options = this.options,\n pointers = this.pointers;\n var action;\n\n if (event.changedTouches) {\n // Handle touch event\n forEach(event.changedTouches, function (touch) {\n pointers[touch.identifier] = getPointer(touch);\n });\n } else {\n // Handle mouse event and pointer event\n pointers[event.pointerId || 0] = getPointer(event);\n }\n\n if (Object.keys(pointers).length > 1 && options.zoomable && options.zoomOnTouch) {\n action = ACTION_ZOOM;\n } else {\n action = getData(event.target, DATA_ACTION);\n }\n\n if (!REGEXP_ACTIONS.test(action)) {\n return;\n }\n\n if (dispatchEvent(this.element, EVENT_CROP_START, {\n originalEvent: event,\n action: action\n }) === false) {\n return;\n } // This line is required for preventing page zooming in iOS browsers\n\n\n event.preventDefault();\n this.action = action;\n this.cropping = false;\n\n if (action === ACTION_CROP) {\n this.cropping = true;\n addClass(this.dragBox, CLASS_MODAL);\n }\n },\n cropMove: function cropMove(event) {\n var action = this.action;\n\n if (this.disabled || !action) {\n return;\n }\n\n var pointers = this.pointers;\n event.preventDefault();\n\n if (dispatchEvent(this.element, EVENT_CROP_MOVE, {\n originalEvent: event,\n action: action\n }) === false) {\n return;\n }\n\n if (event.changedTouches) {\n forEach(event.changedTouches, function (touch) {\n // The first parameter should not be undefined (#432)\n assign(pointers[touch.identifier] || {}, getPointer(touch, true));\n });\n } else {\n assign(pointers[event.pointerId || 0] || {}, getPointer(event, true));\n }\n\n this.change(event);\n },\n cropEnd: function cropEnd(event) {\n if (this.disabled) {\n return;\n }\n\n var action = this.action,\n pointers = this.pointers;\n\n if (event.changedTouches) {\n forEach(event.changedTouches, function (touch) {\n delete pointers[touch.identifier];\n });\n } else {\n delete pointers[event.pointerId || 0];\n }\n\n if (!action) {\n return;\n }\n\n event.preventDefault();\n\n if (!Object.keys(pointers).length) {\n this.action = '';\n }\n\n if (this.cropping) {\n this.cropping = false;\n toggleClass(this.dragBox, CLASS_MODAL, this.cropped && this.options.modal);\n }\n\n dispatchEvent(this.element, EVENT_CROP_END, {\n originalEvent: event,\n action: action\n });\n }\n };\n\n var change = {\n change: function change(event) {\n var options = this.options,\n canvasData = this.canvasData,\n containerData = this.containerData,\n cropBoxData = this.cropBoxData,\n pointers = this.pointers;\n var action = this.action;\n var aspectRatio = options.aspectRatio;\n var left = cropBoxData.left,\n top = cropBoxData.top,\n width = cropBoxData.width,\n height = cropBoxData.height;\n var right = left + width;\n var bottom = top + height;\n var minLeft = 0;\n var minTop = 0;\n var maxWidth = containerData.width;\n var maxHeight = containerData.height;\n var renderable = true;\n var offset; // Locking aspect ratio in \"free mode\" by holding shift key\n\n if (!aspectRatio && event.shiftKey) {\n aspectRatio = width && height ? width / height : 1;\n }\n\n if (this.limited) {\n minLeft = cropBoxData.minLeft;\n minTop = cropBoxData.minTop;\n maxWidth = minLeft + Math.min(containerData.width, canvasData.width, canvasData.left + canvasData.width);\n maxHeight = minTop + Math.min(containerData.height, canvasData.height, canvasData.top + canvasData.height);\n }\n\n var pointer = pointers[Object.keys(pointers)[0]];\n var range = {\n x: pointer.endX - pointer.startX,\n y: pointer.endY - pointer.startY\n };\n\n var check = function check(side) {\n switch (side) {\n case ACTION_EAST:\n if (right + range.x > maxWidth) {\n range.x = maxWidth - right;\n }\n\n break;\n\n case ACTION_WEST:\n if (left + range.x < minLeft) {\n range.x = minLeft - left;\n }\n\n break;\n\n case ACTION_NORTH:\n if (top + range.y < minTop) {\n range.y = minTop - top;\n }\n\n break;\n\n case ACTION_SOUTH:\n if (bottom + range.y > maxHeight) {\n range.y = maxHeight - bottom;\n }\n\n break;\n\n default:\n }\n };\n\n switch (action) {\n // Move crop box\n case ACTION_ALL:\n left += range.x;\n top += range.y;\n break;\n // Resize crop box\n\n case ACTION_EAST:\n if (range.x >= 0 && (right >= maxWidth || aspectRatio && (top <= minTop || bottom >= maxHeight))) {\n renderable = false;\n break;\n }\n\n check(ACTION_EAST);\n width += range.x;\n\n if (width < 0) {\n action = ACTION_WEST;\n width = -width;\n left -= width;\n }\n\n if (aspectRatio) {\n height = width / aspectRatio;\n top += (cropBoxData.height - height) / 2;\n }\n\n break;\n\n case ACTION_NORTH:\n if (range.y <= 0 && (top <= minTop || aspectRatio && (left <= minLeft || right >= maxWidth))) {\n renderable = false;\n break;\n }\n\n check(ACTION_NORTH);\n height -= range.y;\n top += range.y;\n\n if (height < 0) {\n action = ACTION_SOUTH;\n height = -height;\n top -= height;\n }\n\n if (aspectRatio) {\n width = height * aspectRatio;\n left += (cropBoxData.width - width) / 2;\n }\n\n break;\n\n case ACTION_WEST:\n if (range.x <= 0 && (left <= minLeft || aspectRatio && (top <= minTop || bottom >= maxHeight))) {\n renderable = false;\n break;\n }\n\n check(ACTION_WEST);\n width -= range.x;\n left += range.x;\n\n if (width < 0) {\n action = ACTION_EAST;\n width = -width;\n left -= width;\n }\n\n if (aspectRatio) {\n height = width / aspectRatio;\n top += (cropBoxData.height - height) / 2;\n }\n\n break;\n\n case ACTION_SOUTH:\n if (range.y >= 0 && (bottom >= maxHeight || aspectRatio && (left <= minLeft || right >= maxWidth))) {\n renderable = false;\n break;\n }\n\n check(ACTION_SOUTH);\n height += range.y;\n\n if (height < 0) {\n action = ACTION_NORTH;\n height = -height;\n top -= height;\n }\n\n if (aspectRatio) {\n width = height * aspectRatio;\n left += (cropBoxData.width - width) / 2;\n }\n\n break;\n\n case ACTION_NORTH_EAST:\n if (aspectRatio) {\n if (range.y <= 0 && (top <= minTop || right >= maxWidth)) {\n renderable = false;\n break;\n }\n\n check(ACTION_NORTH);\n height -= range.y;\n top += range.y;\n width = height * aspectRatio;\n } else {\n check(ACTION_NORTH);\n check(ACTION_EAST);\n\n if (range.x >= 0) {\n if (right < maxWidth) {\n width += range.x;\n } else if (range.y <= 0 && top <= minTop) {\n renderable = false;\n }\n } else {\n width += range.x;\n }\n\n if (range.y <= 0) {\n if (top > minTop) {\n height -= range.y;\n top += range.y;\n }\n } else {\n height -= range.y;\n top += range.y;\n }\n }\n\n if (width < 0 && height < 0) {\n action = ACTION_SOUTH_WEST;\n height = -height;\n width = -width;\n top -= height;\n left -= width;\n } else if (width < 0) {\n action = ACTION_NORTH_WEST;\n width = -width;\n left -= width;\n } else if (height < 0) {\n action = ACTION_SOUTH_EAST;\n height = -height;\n top -= height;\n }\n\n break;\n\n case ACTION_NORTH_WEST:\n if (aspectRatio) {\n if (range.y <= 0 && (top <= minTop || left <= minLeft)) {\n renderable = false;\n break;\n }\n\n check(ACTION_NORTH);\n height -= range.y;\n top += range.y;\n width = height * aspectRatio;\n left += cropBoxData.width - width;\n } else {\n check(ACTION_NORTH);\n check(ACTION_WEST);\n\n if (range.x <= 0) {\n if (left > minLeft) {\n width -= range.x;\n left += range.x;\n } else if (range.y <= 0 && top <= minTop) {\n renderable = false;\n }\n } else {\n width -= range.x;\n left += range.x;\n }\n\n if (range.y <= 0) {\n if (top > minTop) {\n height -= range.y;\n top += range.y;\n }\n } else {\n height -= range.y;\n top += range.y;\n }\n }\n\n if (width < 0 && height < 0) {\n action = ACTION_SOUTH_EAST;\n height = -height;\n width = -width;\n top -= height;\n left -= width;\n } else if (width < 0) {\n action = ACTION_NORTH_EAST;\n width = -width;\n left -= width;\n } else if (height < 0) {\n action = ACTION_SOUTH_WEST;\n height = -height;\n top -= height;\n }\n\n break;\n\n case ACTION_SOUTH_WEST:\n if (aspectRatio) {\n if (range.x <= 0 && (left <= minLeft || bottom >= maxHeight)) {\n renderable = false;\n break;\n }\n\n check(ACTION_WEST);\n width -= range.x;\n left += range.x;\n height = width / aspectRatio;\n } else {\n check(ACTION_SOUTH);\n check(ACTION_WEST);\n\n if (range.x <= 0) {\n if (left > minLeft) {\n width -= range.x;\n left += range.x;\n } else if (range.y >= 0 && bottom >= maxHeight) {\n renderable = false;\n }\n } else {\n width -= range.x;\n left += range.x;\n }\n\n if (range.y >= 0) {\n if (bottom < maxHeight) {\n height += range.y;\n }\n } else {\n height += range.y;\n }\n }\n\n if (width < 0 && height < 0) {\n action = ACTION_NORTH_EAST;\n height = -height;\n width = -width;\n top -= height;\n left -= width;\n } else if (width < 0) {\n action = ACTION_SOUTH_EAST;\n width = -width;\n left -= width;\n } else if (height < 0) {\n action = ACTION_NORTH_WEST;\n height = -height;\n top -= height;\n }\n\n break;\n\n case ACTION_SOUTH_EAST:\n if (aspectRatio) {\n if (range.x >= 0 && (right >= maxWidth || bottom >= maxHeight)) {\n renderable = false;\n break;\n }\n\n check(ACTION_EAST);\n width += range.x;\n height = width / aspectRatio;\n } else {\n check(ACTION_SOUTH);\n check(ACTION_EAST);\n\n if (range.x >= 0) {\n if (right < maxWidth) {\n width += range.x;\n } else if (range.y >= 0 && bottom >= maxHeight) {\n renderable = false;\n }\n } else {\n width += range.x;\n }\n\n if (range.y >= 0) {\n if (bottom < maxHeight) {\n height += range.y;\n }\n } else {\n height += range.y;\n }\n }\n\n if (width < 0 && height < 0) {\n action = ACTION_NORTH_WEST;\n height = -height;\n width = -width;\n top -= height;\n left -= width;\n } else if (width < 0) {\n action = ACTION_SOUTH_WEST;\n width = -width;\n left -= width;\n } else if (height < 0) {\n action = ACTION_NORTH_EAST;\n height = -height;\n top -= height;\n }\n\n break;\n // Move canvas\n\n case ACTION_MOVE:\n this.move(range.x, range.y);\n renderable = false;\n break;\n // Zoom canvas\n\n case ACTION_ZOOM:\n this.zoom(getMaxZoomRatio(pointers), event);\n renderable = false;\n break;\n // Create crop box\n\n case ACTION_CROP:\n if (!range.x || !range.y) {\n renderable = false;\n break;\n }\n\n offset = getOffset(this.cropper);\n left = pointer.startX - offset.left;\n top = pointer.startY - offset.top;\n width = cropBoxData.minWidth;\n height = cropBoxData.minHeight;\n\n if (range.x > 0) {\n action = range.y > 0 ? ACTION_SOUTH_EAST : ACTION_NORTH_EAST;\n } else if (range.x < 0) {\n left -= width;\n action = range.y > 0 ? ACTION_SOUTH_WEST : ACTION_NORTH_WEST;\n }\n\n if (range.y < 0) {\n top -= height;\n } // Show the crop box if is hidden\n\n\n if (!this.cropped) {\n removeClass(this.cropBox, CLASS_HIDDEN);\n this.cropped = true;\n\n if (this.limited) {\n this.limitCropBox(true, true);\n }\n }\n\n break;\n\n default:\n }\n\n if (renderable) {\n cropBoxData.width = width;\n cropBoxData.height = height;\n cropBoxData.left = left;\n cropBoxData.top = top;\n this.action = action;\n this.renderCropBox();\n } // Override\n\n\n forEach(pointers, function (p) {\n p.startX = p.endX;\n p.startY = p.endY;\n });\n }\n };\n\n var methods = {\n // Show the crop box manually\n crop: function crop() {\n if (this.ready && !this.cropped && !this.disabled) {\n this.cropped = true;\n this.limitCropBox(true, true);\n\n if (this.options.modal) {\n addClass(this.dragBox, CLASS_MODAL);\n }\n\n removeClass(this.cropBox, CLASS_HIDDEN);\n this.setCropBoxData(this.initialCropBoxData);\n }\n\n return this;\n },\n // Reset the image and crop box to their initial states\n reset: function reset() {\n if (this.ready && !this.disabled) {\n this.imageData = assign({}, this.initialImageData);\n this.canvasData = assign({}, this.initialCanvasData);\n this.cropBoxData = assign({}, this.initialCropBoxData);\n this.renderCanvas();\n\n if (this.cropped) {\n this.renderCropBox();\n }\n }\n\n return this;\n },\n // Clear the crop box\n clear: function clear() {\n if (this.cropped && !this.disabled) {\n assign(this.cropBoxData, {\n left: 0,\n top: 0,\n width: 0,\n height: 0\n });\n this.cropped = false;\n this.renderCropBox();\n this.limitCanvas(true, true); // Render canvas after crop box rendered\n\n this.renderCanvas();\n removeClass(this.dragBox, CLASS_MODAL);\n addClass(this.cropBox, CLASS_HIDDEN);\n }\n\n return this;\n },\n\n /**\n * Replace the image's src and rebuild the cropper\n * @param {string} url - The new URL.\n * @param {boolean} [hasSameSize] - Indicate if the new image has the same size as the old one.\n * @returns {Cropper} this\n */\n replace: function replace(url) {\n var hasSameSize = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n\n if (!this.disabled && url) {\n if (this.isImg) {\n this.element.src = url;\n }\n\n if (hasSameSize) {\n this.url = url;\n this.image.src = url;\n\n if (this.ready) {\n this.viewBoxImage.src = url;\n forEach(this.previews, function (element) {\n element.getElementsByTagName('img')[0].src = url;\n });\n }\n } else {\n if (this.isImg) {\n this.replaced = true;\n }\n\n this.options.data = null;\n this.uncreate();\n this.load(url);\n }\n }\n\n return this;\n },\n // Enable (unfreeze) the cropper\n enable: function enable() {\n if (this.ready && this.disabled) {\n this.disabled = false;\n removeClass(this.cropper, CLASS_DISABLED);\n }\n\n return this;\n },\n // Disable (freeze) the cropper\n disable: function disable() {\n if (this.ready && !this.disabled) {\n this.disabled = true;\n addClass(this.cropper, CLASS_DISABLED);\n }\n\n return this;\n },\n\n /**\n * Destroy the cropper and remove the instance from the image\n * @returns {Cropper} this\n */\n destroy: function destroy() {\n var element = this.element;\n\n if (!element[NAMESPACE]) {\n return this;\n }\n\n element[NAMESPACE] = undefined;\n\n if (this.isImg && this.replaced) {\n element.src = this.originalUrl;\n }\n\n this.uncreate();\n return this;\n },\n\n /**\n * Move the canvas with relative offsets\n * @param {number} offsetX - The relative offset distance on the x-axis.\n * @param {number} [offsetY=offsetX] - The relative offset distance on the y-axis.\n * @returns {Cropper} this\n */\n move: function move(offsetX) {\n var offsetY = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : offsetX;\n var _this$canvasData = this.canvasData,\n left = _this$canvasData.left,\n top = _this$canvasData.top;\n return this.moveTo(isUndefined(offsetX) ? offsetX : left + Number(offsetX), isUndefined(offsetY) ? offsetY : top + Number(offsetY));\n },\n\n /**\n * Move the canvas to an absolute point\n * @param {number} x - The x-axis coordinate.\n * @param {number} [y=x] - The y-axis coordinate.\n * @returns {Cropper} this\n */\n moveTo: function moveTo(x) {\n var y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : x;\n var canvasData = this.canvasData;\n var changed = false;\n x = Number(x);\n y = Number(y);\n\n if (this.ready && !this.disabled && this.options.movable) {\n if (isNumber(x)) {\n canvasData.left = x;\n changed = true;\n }\n\n if (isNumber(y)) {\n canvasData.top = y;\n changed = true;\n }\n\n if (changed) {\n this.renderCanvas(true);\n }\n }\n\n return this;\n },\n\n /**\n * Zoom the canvas with a relative ratio\n * @param {number} ratio - The target ratio.\n * @param {Event} _originalEvent - The original event if any.\n * @returns {Cropper} this\n */\n zoom: function zoom(ratio, _originalEvent) {\n var canvasData = this.canvasData;\n ratio = Number(ratio);\n\n if (ratio < 0) {\n ratio = 1 / (1 - ratio);\n } else {\n ratio = 1 + ratio;\n }\n\n return this.zoomTo(canvasData.width * ratio / canvasData.naturalWidth, null, _originalEvent);\n },\n\n /**\n * Zoom the canvas to an absolute ratio\n * @param {number} ratio - The target ratio.\n * @param {Object} pivot - The zoom pivot point coordinate.\n * @param {Event} _originalEvent - The original event if any.\n * @returns {Cropper} this\n */\n zoomTo: function zoomTo(ratio, pivot, _originalEvent) {\n var options = this.options,\n canvasData = this.canvasData;\n var width = canvasData.width,\n height = canvasData.height,\n naturalWidth = canvasData.naturalWidth,\n naturalHeight = canvasData.naturalHeight;\n ratio = Number(ratio);\n\n if (ratio >= 0 && this.ready && !this.disabled && options.zoomable) {\n var newWidth = naturalWidth * ratio;\n var newHeight = naturalHeight * ratio;\n\n if (dispatchEvent(this.element, EVENT_ZOOM, {\n ratio: ratio,\n oldRatio: width / naturalWidth,\n originalEvent: _originalEvent\n }) === false) {\n return this;\n }\n\n if (_originalEvent) {\n var pointers = this.pointers;\n var offset = getOffset(this.cropper);\n var center = pointers && Object.keys(pointers).length ? getPointersCenter(pointers) : {\n pageX: _originalEvent.pageX,\n pageY: _originalEvent.pageY\n }; // Zoom from the triggering point of the event\n\n canvasData.left -= (newWidth - width) * ((center.pageX - offset.left - canvasData.left) / width);\n canvasData.top -= (newHeight - height) * ((center.pageY - offset.top - canvasData.top) / height);\n } else if (isPlainObject(pivot) && isNumber(pivot.x) && isNumber(pivot.y)) {\n canvasData.left -= (newWidth - width) * ((pivot.x - canvasData.left) / width);\n canvasData.top -= (newHeight - height) * ((pivot.y - canvasData.top) / height);\n } else {\n // Zoom from the center of the canvas\n canvasData.left -= (newWidth - width) / 2;\n canvasData.top -= (newHeight - height) / 2;\n }\n\n canvasData.width = newWidth;\n canvasData.height = newHeight;\n this.renderCanvas(true);\n }\n\n return this;\n },\n\n /**\n * Rotate the canvas with a relative degree\n * @param {number} degree - The rotate degree.\n * @returns {Cropper} this\n */\n rotate: function rotate(degree) {\n return this.rotateTo((this.imageData.rotate || 0) + Number(degree));\n },\n\n /**\n * Rotate the canvas to an absolute degree\n * @param {number} degree - The rotate degree.\n * @returns {Cropper} this\n */\n rotateTo: function rotateTo(degree) {\n degree = Number(degree);\n\n if (isNumber(degree) && this.ready && !this.disabled && this.options.rotatable) {\n this.imageData.rotate = degree % 360;\n this.renderCanvas(true, true);\n }\n\n return this;\n },\n\n /**\n * Scale the image on the x-axis.\n * @param {number} scaleX - The scale ratio on the x-axis.\n * @returns {Cropper} this\n */\n scaleX: function scaleX(_scaleX) {\n var scaleY = this.imageData.scaleY;\n return this.scale(_scaleX, isNumber(scaleY) ? scaleY : 1);\n },\n\n /**\n * Scale the image on the y-axis.\n * @param {number} scaleY - The scale ratio on the y-axis.\n * @returns {Cropper} this\n */\n scaleY: function scaleY(_scaleY) {\n var scaleX = this.imageData.scaleX;\n return this.scale(isNumber(scaleX) ? scaleX : 1, _scaleY);\n },\n\n /**\n * Scale the image\n * @param {number} scaleX - The scale ratio on the x-axis.\n * @param {number} [scaleY=scaleX] - The scale ratio on the y-axis.\n * @returns {Cropper} this\n */\n scale: function scale(scaleX) {\n var scaleY = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : scaleX;\n var imageData = this.imageData;\n var transformed = false;\n scaleX = Number(scaleX);\n scaleY = Number(scaleY);\n\n if (this.ready && !this.disabled && this.options.scalable) {\n if (isNumber(scaleX)) {\n imageData.scaleX = scaleX;\n transformed = true;\n }\n\n if (isNumber(scaleY)) {\n imageData.scaleY = scaleY;\n transformed = true;\n }\n\n if (transformed) {\n this.renderCanvas(true, true);\n }\n }\n\n return this;\n },\n\n /**\n * Get the cropped area position and size data (base on the original image)\n * @param {boolean} [rounded=false] - Indicate if round the data values or not.\n * @returns {Object} The result cropped data.\n */\n getData: function getData() {\n var rounded = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n var options = this.options,\n imageData = this.imageData,\n canvasData = this.canvasData,\n cropBoxData = this.cropBoxData;\n var data;\n\n if (this.ready && this.cropped) {\n data = {\n x: cropBoxData.left - canvasData.left,\n y: cropBoxData.top - canvasData.top,\n width: cropBoxData.width,\n height: cropBoxData.height\n };\n var ratio = imageData.width / imageData.naturalWidth;\n forEach(data, function (n, i) {\n data[i] = n / ratio;\n });\n\n if (rounded) {\n // In case rounding off leads to extra 1px in right or bottom border\n // we should round the top-left corner and the dimension (#343).\n var bottom = Math.round(data.y + data.height);\n var right = Math.round(data.x + data.width);\n data.x = Math.round(data.x);\n data.y = Math.round(data.y);\n data.width = right - data.x;\n data.height = bottom - data.y;\n }\n } else {\n data = {\n x: 0,\n y: 0,\n width: 0,\n height: 0\n };\n }\n\n if (options.rotatable) {\n data.rotate = imageData.rotate || 0;\n }\n\n if (options.scalable) {\n data.scaleX = imageData.scaleX || 1;\n data.scaleY = imageData.scaleY || 1;\n }\n\n return data;\n },\n\n /**\n * Set the cropped area position and size with new data\n * @param {Object} data - The new data.\n * @returns {Cropper} this\n */\n setData: function setData(data) {\n var options = this.options,\n imageData = this.imageData,\n canvasData = this.canvasData;\n var cropBoxData = {};\n\n if (this.ready && !this.disabled && isPlainObject(data)) {\n var transformed = false;\n\n if (options.rotatable) {\n if (isNumber(data.rotate) && data.rotate !== imageData.rotate) {\n imageData.rotate = data.rotate;\n transformed = true;\n }\n }\n\n if (options.scalable) {\n if (isNumber(data.scaleX) && data.scaleX !== imageData.scaleX) {\n imageData.scaleX = data.scaleX;\n transformed = true;\n }\n\n if (isNumber(data.scaleY) && data.scaleY !== imageData.scaleY) {\n imageData.scaleY = data.scaleY;\n transformed = true;\n }\n }\n\n if (transformed) {\n this.renderCanvas(true, true);\n }\n\n var ratio = imageData.width / imageData.naturalWidth;\n\n if (isNumber(data.x)) {\n cropBoxData.left = data.x * ratio + canvasData.left;\n }\n\n if (isNumber(data.y)) {\n cropBoxData.top = data.y * ratio + canvasData.top;\n }\n\n if (isNumber(data.width)) {\n cropBoxData.width = data.width * ratio;\n }\n\n if (isNumber(data.height)) {\n cropBoxData.height = data.height * ratio;\n }\n\n this.setCropBoxData(cropBoxData);\n }\n\n return this;\n },\n\n /**\n * Get the container size data.\n * @returns {Object} The result container data.\n */\n getContainerData: function getContainerData() {\n return this.ready ? assign({}, this.containerData) : {};\n },\n\n /**\n * Get the image position and size data.\n * @returns {Object} The result image data.\n */\n getImageData: function getImageData() {\n return this.sized ? assign({}, this.imageData) : {};\n },\n\n /**\n * Get the canvas position and size data.\n * @returns {Object} The result canvas data.\n */\n getCanvasData: function getCanvasData() {\n var canvasData = this.canvasData;\n var data = {};\n\n if (this.ready) {\n forEach(['left', 'top', 'width', 'height', 'naturalWidth', 'naturalHeight'], function (n) {\n data[n] = canvasData[n];\n });\n }\n\n return data;\n },\n\n /**\n * Set the canvas position and size with new data.\n * @param {Object} data - The new canvas data.\n * @returns {Cropper} this\n */\n setCanvasData: function setCanvasData(data) {\n var canvasData = this.canvasData;\n var aspectRatio = canvasData.aspectRatio;\n\n if (this.ready && !this.disabled && isPlainObject(data)) {\n if (isNumber(data.left)) {\n canvasData.left = data.left;\n }\n\n if (isNumber(data.top)) {\n canvasData.top = data.top;\n }\n\n if (isNumber(data.width)) {\n canvasData.width = data.width;\n canvasData.height = data.width / aspectRatio;\n } else if (isNumber(data.height)) {\n canvasData.height = data.height;\n canvasData.width = data.height * aspectRatio;\n }\n\n this.renderCanvas(true);\n }\n\n return this;\n },\n\n /**\n * Get the crop box position and size data.\n * @returns {Object} The result crop box data.\n */\n getCropBoxData: function getCropBoxData() {\n var cropBoxData = this.cropBoxData;\n var data;\n\n if (this.ready && this.cropped) {\n data = {\n left: cropBoxData.left,\n top: cropBoxData.top,\n width: cropBoxData.width,\n height: cropBoxData.height\n };\n }\n\n return data || {};\n },\n\n /**\n * Set the crop box position and size with new data.\n * @param {Object} data - The new crop box data.\n * @returns {Cropper} this\n */\n setCropBoxData: function setCropBoxData(data) {\n var cropBoxData = this.cropBoxData;\n var aspectRatio = this.options.aspectRatio;\n var widthChanged;\n var heightChanged;\n\n if (this.ready && this.cropped && !this.disabled && isPlainObject(data)) {\n if (isNumber(data.left)) {\n cropBoxData.left = data.left;\n }\n\n if (isNumber(data.top)) {\n cropBoxData.top = data.top;\n }\n\n if (isNumber(data.width) && data.width !== cropBoxData.width) {\n widthChanged = true;\n cropBoxData.width = data.width;\n }\n\n if (isNumber(data.height) && data.height !== cropBoxData.height) {\n heightChanged = true;\n cropBoxData.height = data.height;\n }\n\n if (aspectRatio) {\n if (widthChanged) {\n cropBoxData.height = cropBoxData.width / aspectRatio;\n } else if (heightChanged) {\n cropBoxData.width = cropBoxData.height * aspectRatio;\n }\n }\n\n this.renderCropBox();\n }\n\n return this;\n },\n\n /**\n * Get a canvas drawn the cropped image.\n * @param {Object} [options={}] - The config options.\n * @returns {HTMLCanvasElement} - The result canvas.\n */\n getCroppedCanvas: function getCroppedCanvas() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n if (!this.ready || !window.HTMLCanvasElement) {\n return null;\n }\n\n var canvasData = this.canvasData;\n var source = getSourceCanvas(this.image, this.imageData, canvasData, options); // Returns the source canvas if it is not cropped.\n\n if (!this.cropped) {\n return source;\n }\n\n var _this$getData = this.getData(),\n initialX = _this$getData.x,\n initialY = _this$getData.y,\n initialWidth = _this$getData.width,\n initialHeight = _this$getData.height;\n\n var ratio = source.width / Math.floor(canvasData.naturalWidth);\n\n if (ratio !== 1) {\n initialX *= ratio;\n initialY *= ratio;\n initialWidth *= ratio;\n initialHeight *= ratio;\n }\n\n var aspectRatio = initialWidth / initialHeight;\n var maxSizes = getAdjustedSizes({\n aspectRatio: aspectRatio,\n width: options.maxWidth || Infinity,\n height: options.maxHeight || Infinity\n });\n var minSizes = getAdjustedSizes({\n aspectRatio: aspectRatio,\n width: options.minWidth || 0,\n height: options.minHeight || 0\n }, 'cover');\n\n var _getAdjustedSizes = getAdjustedSizes({\n aspectRatio: aspectRatio,\n width: options.width || (ratio !== 1 ? source.width : initialWidth),\n height: options.height || (ratio !== 1 ? source.height : initialHeight)\n }),\n width = _getAdjustedSizes.width,\n height = _getAdjustedSizes.height;\n\n width = Math.min(maxSizes.width, Math.max(minSizes.width, width));\n height = Math.min(maxSizes.height, Math.max(minSizes.height, height));\n var canvas = document.createElement('canvas');\n var context = canvas.getContext('2d');\n canvas.width = normalizeDecimalNumber(width);\n canvas.height = normalizeDecimalNumber(height);\n context.fillStyle = options.fillColor || 'transparent';\n context.fillRect(0, 0, width, height);\n var _options$imageSmoothi = options.imageSmoothingEnabled,\n imageSmoothingEnabled = _options$imageSmoothi === void 0 ? true : _options$imageSmoothi,\n imageSmoothingQuality = options.imageSmoothingQuality;\n context.imageSmoothingEnabled = imageSmoothingEnabled;\n\n if (imageSmoothingQuality) {\n context.imageSmoothingQuality = imageSmoothingQuality;\n } // https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D.drawImage\n\n\n var sourceWidth = source.width;\n var sourceHeight = source.height; // Source canvas parameters\n\n var srcX = initialX;\n var srcY = initialY;\n var srcWidth;\n var srcHeight; // Destination canvas parameters\n\n var dstX;\n var dstY;\n var dstWidth;\n var dstHeight;\n\n if (srcX <= -initialWidth || srcX > sourceWidth) {\n srcX = 0;\n srcWidth = 0;\n dstX = 0;\n dstWidth = 0;\n } else if (srcX <= 0) {\n dstX = -srcX;\n srcX = 0;\n srcWidth = Math.min(sourceWidth, initialWidth + srcX);\n dstWidth = srcWidth;\n } else if (srcX <= sourceWidth) {\n dstX = 0;\n srcWidth = Math.min(initialWidth, sourceWidth - srcX);\n dstWidth = srcWidth;\n }\n\n if (srcWidth <= 0 || srcY <= -initialHeight || srcY > sourceHeight) {\n srcY = 0;\n srcHeight = 0;\n dstY = 0;\n dstHeight = 0;\n } else if (srcY <= 0) {\n dstY = -srcY;\n srcY = 0;\n srcHeight = Math.min(sourceHeight, initialHeight + srcY);\n dstHeight = srcHeight;\n } else if (srcY <= sourceHeight) {\n dstY = 0;\n srcHeight = Math.min(initialHeight, sourceHeight - srcY);\n dstHeight = srcHeight;\n }\n\n var params = [srcX, srcY, srcWidth, srcHeight]; // Avoid \"IndexSizeError\"\n\n if (dstWidth > 0 && dstHeight > 0) {\n var scale = width / initialWidth;\n params.push(dstX * scale, dstY * scale, dstWidth * scale, dstHeight * scale);\n } // All the numerical parameters should be integer for `drawImage`\n // https://github.com/fengyuanchen/cropper/issues/476\n\n\n context.drawImage.apply(context, [source].concat(_toConsumableArray(params.map(function (param) {\n return Math.floor(normalizeDecimalNumber(param));\n }))));\n return canvas;\n },\n\n /**\n * Change the aspect ratio of the crop box.\n * @param {number} aspectRatio - The new aspect ratio.\n * @returns {Cropper} this\n */\n setAspectRatio: function setAspectRatio(aspectRatio) {\n var options = this.options;\n\n if (!this.disabled && !isUndefined(aspectRatio)) {\n // 0 -> NaN\n options.aspectRatio = Math.max(0, aspectRatio) || NaN;\n\n if (this.ready) {\n this.initCropBox();\n\n if (this.cropped) {\n this.renderCropBox();\n }\n }\n }\n\n return this;\n },\n\n /**\n * Change the drag mode.\n * @param {string} mode - The new drag mode.\n * @returns {Cropper} this\n */\n setDragMode: function setDragMode(mode) {\n var options = this.options,\n dragBox = this.dragBox,\n face = this.face;\n\n if (this.ready && !this.disabled) {\n var croppable = mode === DRAG_MODE_CROP;\n var movable = options.movable && mode === DRAG_MODE_MOVE;\n mode = croppable || movable ? mode : DRAG_MODE_NONE;\n options.dragMode = mode;\n setData(dragBox, DATA_ACTION, mode);\n toggleClass(dragBox, CLASS_CROP, croppable);\n toggleClass(dragBox, CLASS_MOVE, movable);\n\n if (!options.cropBoxMovable) {\n // Sync drag mode to crop box when it is not movable\n setData(face, DATA_ACTION, mode);\n toggleClass(face, CLASS_CROP, croppable);\n toggleClass(face, CLASS_MOVE, movable);\n }\n }\n\n return this;\n }\n };\n\n var AnotherCropper = WINDOW.Cropper;\n\n var Cropper =\n /*#__PURE__*/\n function () {\n /**\n * Create a new Cropper.\n * @param {Element} element - The target element for cropping.\n * @param {Object} [options={}] - The configuration options.\n */\n function Cropper(element) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n _classCallCheck(this, Cropper);\n\n if (!element || !REGEXP_TAG_NAME.test(element.tagName)) {\n throw new Error('The first argument is required and must be an <img> or <canvas> element.');\n }\n\n this.element = element;\n this.options = assign({}, DEFAULTS, isPlainObject(options) && options);\n this.cropped = false;\n this.disabled = false;\n this.pointers = {};\n this.ready = false;\n this.reloading = false;\n this.replaced = false;\n this.sized = false;\n this.sizing = false;\n this.init();\n }\n\n _createClass(Cropper, [{\n key: \"init\",\n value: function init() {\n var element = this.element;\n var tagName = element.tagName.toLowerCase();\n var url;\n\n if (element[NAMESPACE]) {\n return;\n }\n\n element[NAMESPACE] = this;\n\n if (tagName === 'img') {\n this.isImg = true; // e.g.: \"img/picture.jpg\"\n\n url = element.getAttribute('src') || '';\n this.originalUrl = url; // Stop when it's a blank image\n\n if (!url) {\n return;\n } // e.g.: \"http://example.com/img/picture.jpg\"\n\n\n url = element.src;\n } else if (tagName === 'canvas' && window.HTMLCanvasElement) {\n url = element.toDataURL();\n }\n\n this.load(url);\n }\n }, {\n key: \"load\",\n value: function load(url) {\n var _this = this;\n\n if (!url) {\n return;\n }\n\n this.url = url;\n this.imageData = {};\n var element = this.element,\n options = this.options;\n\n if (!options.rotatable && !options.scalable) {\n options.checkOrientation = false;\n } // Only IE10+ supports Typed Arrays\n\n\n if (!options.checkOrientation || !window.ArrayBuffer) {\n this.clone();\n return;\n } // Detect the mime type of the image directly if it is a Data URL\n\n\n if (REGEXP_DATA_URL.test(url)) {\n // Read ArrayBuffer from Data URL of JPEG images directly for better performance\n if (REGEXP_DATA_URL_JPEG.test(url)) {\n this.read(dataURLToArrayBuffer(url));\n } else {\n // Only a JPEG image may contains Exif Orientation information,\n // the rest types of Data URLs are not necessary to check orientation at all.\n this.clone();\n }\n\n return;\n } // 1. Detect the mime type of the image by a XMLHttpRequest.\n // 2. Load the image as ArrayBuffer for reading orientation if its a JPEG image.\n\n\n var xhr = new XMLHttpRequest();\n var clone = this.clone.bind(this);\n this.reloading = true;\n this.xhr = xhr; // 1. Cross origin requests are only supported for protocol schemes:\n // http, https, data, chrome, chrome-extension.\n // 2. Access to XMLHttpRequest from a Data URL will be blocked by CORS policy\n // in some browsers as IE11 and Safari.\n\n xhr.onabort = clone;\n xhr.onerror = clone;\n xhr.ontimeout = clone;\n\n xhr.onprogress = function () {\n // Abort the request directly if it not a JPEG image for better performance\n if (xhr.getResponseHeader('content-type') !== MIME_TYPE_JPEG) {\n xhr.abort();\n }\n };\n\n xhr.onload = function () {\n _this.read(xhr.response);\n };\n\n xhr.onloadend = function () {\n _this.reloading = false;\n _this.xhr = null;\n }; // Bust cache when there is a \"crossOrigin\" property to avoid browser cache error\n\n\n if (options.checkCrossOrigin && isCrossOriginURL(url) && element.crossOrigin) {\n url = addTimestamp(url);\n }\n\n xhr.open('GET', url);\n xhr.responseType = 'arraybuffer';\n xhr.withCredentials = element.crossOrigin === 'use-credentials';\n xhr.send();\n }\n }, {\n key: \"read\",\n value: function read(arrayBuffer) {\n var options = this.options,\n imageData = this.imageData; // Reset the orientation value to its default value 1\n // as some iOS browsers will render image with its orientation\n\n var orientation = resetAndGetOrientation(arrayBuffer);\n var rotate = 0;\n var scaleX = 1;\n var scaleY = 1;\n\n if (orientation > 1) {\n // Generate a new URL which has the default orientation value\n this.url = arrayBufferToDataURL(arrayBuffer, MIME_TYPE_JPEG);\n\n var _parseOrientation = parseOrientation(orientation);\n\n rotate = _parseOrientation.rotate;\n scaleX = _parseOrientation.scaleX;\n scaleY = _parseOrientation.scaleY;\n }\n\n if (options.rotatable) {\n imageData.rotate = rotate;\n }\n\n if (options.scalable) {\n imageData.scaleX = scaleX;\n imageData.scaleY = scaleY;\n }\n\n this.clone();\n }\n }, {\n key: \"clone\",\n value: function clone() {\n var element = this.element,\n url = this.url;\n var crossOrigin = element.crossOrigin;\n var crossOriginUrl = url;\n\n if (this.options.checkCrossOrigin && isCrossOriginURL(url)) {\n if (!crossOrigin) {\n crossOrigin = 'anonymous';\n } // Bust cache when there is not a \"crossOrigin\" property (#519)\n\n\n crossOriginUrl = addTimestamp(url);\n }\n\n this.crossOrigin = crossOrigin;\n this.crossOriginUrl = crossOriginUrl;\n var image = document.createElement('img');\n\n if (crossOrigin) {\n image.crossOrigin = crossOrigin;\n }\n\n image.src = crossOriginUrl || url;\n image.alt = element.alt || 'The image to crop';\n this.image = image;\n image.onload = this.start.bind(this);\n image.onerror = this.stop.bind(this);\n addClass(image, CLASS_HIDE);\n element.parentNode.insertBefore(image, element.nextSibling);\n }\n }, {\n key: \"start\",\n value: function start() {\n var _this2 = this;\n\n var image = this.image;\n image.onload = null;\n image.onerror = null;\n this.sizing = true; // Match all browsers that use WebKit as the layout engine in iOS devices,\n // such as Safari for iOS, Chrome for iOS, and in-app browsers.\n\n var isIOSWebKit = WINDOW.navigator && /(?:iPad|iPhone|iPod).*?AppleWebKit/i.test(WINDOW.navigator.userAgent);\n\n var done = function done(naturalWidth, naturalHeight) {\n assign(_this2.imageData, {\n naturalWidth: naturalWidth,\n naturalHeight: naturalHeight,\n aspectRatio: naturalWidth / naturalHeight\n });\n _this2.sizing = false;\n _this2.sized = true;\n\n _this2.build();\n }; // Most modern browsers (excepts iOS WebKit)\n\n\n if (image.naturalWidth && !isIOSWebKit) {\n done(image.naturalWidth, image.naturalHeight);\n return;\n }\n\n var sizingImage = document.createElement('img');\n var body = document.body || document.documentElement;\n this.sizingImage = sizingImage;\n\n sizingImage.onload = function () {\n done(sizingImage.width, sizingImage.height);\n\n if (!isIOSWebKit) {\n body.removeChild(sizingImage);\n }\n };\n\n sizingImage.src = image.src; // iOS WebKit will convert the image automatically\n // with its orientation once append it into DOM (#279)\n\n if (!isIOSWebKit) {\n sizingImage.style.cssText = 'left:0;' + 'max-height:none!important;' + 'max-width:none!important;' + 'min-height:0!important;' + 'min-width:0!important;' + 'opacity:0;' + 'position:absolute;' + 'top:0;' + 'z-index:-1;';\n body.appendChild(sizingImage);\n }\n }\n }, {\n key: \"stop\",\n value: function stop() {\n var image = this.image;\n image.onload = null;\n image.onerror = null;\n image.parentNode.removeChild(image);\n this.image = null;\n }\n }, {\n key: \"build\",\n value: function build() {\n if (!this.sized || this.ready) {\n return;\n }\n\n var element = this.element,\n options = this.options,\n image = this.image; // Create cropper elements\n\n var container = element.parentNode;\n var template = document.createElement('div');\n template.innerHTML = TEMPLATE;\n var cropper = template.querySelector(\".\".concat(NAMESPACE, \"-container\"));\n var canvas = cropper.querySelector(\".\".concat(NAMESPACE, \"-canvas\"));\n var dragBox = cropper.querySelector(\".\".concat(NAMESPACE, \"-drag-box\"));\n var cropBox = cropper.querySelector(\".\".concat(NAMESPACE, \"-crop-box\"));\n var face = cropBox.querySelector(\".\".concat(NAMESPACE, \"-face\"));\n this.container = container;\n this.cropper = cropper;\n this.canvas = canvas;\n this.dragBox = dragBox;\n this.cropBox = cropBox;\n this.viewBox = cropper.querySelector(\".\".concat(NAMESPACE, \"-view-box\"));\n this.face = face;\n canvas.appendChild(image); // Hide the original image\n\n addClass(element, CLASS_HIDDEN); // Inserts the cropper after to the current image\n\n container.insertBefore(cropper, element.nextSibling); // Show the image if is hidden\n\n if (!this.isImg) {\n removeClass(image, CLASS_HIDE);\n }\n\n this.initPreview();\n this.bind();\n options.initialAspectRatio = Math.max(0, options.initialAspectRatio) || NaN;\n options.aspectRatio = Math.max(0, options.aspectRatio) || NaN;\n options.viewMode = Math.max(0, Math.min(3, Math.round(options.viewMode))) || 0;\n addClass(cropBox, CLASS_HIDDEN);\n\n if (!options.guides) {\n addClass(cropBox.getElementsByClassName(\"\".concat(NAMESPACE, \"-dashed\")), CLASS_HIDDEN);\n }\n\n if (!options.center) {\n addClass(cropBox.getElementsByClassName(\"\".concat(NAMESPACE, \"-center\")), CLASS_HIDDEN);\n }\n\n if (options.background) {\n addClass(cropper, \"\".concat(NAMESPACE, \"-bg\"));\n }\n\n if (!options.highlight) {\n addClass(face, CLASS_INVISIBLE);\n }\n\n if (options.cropBoxMovable) {\n addClass(face, CLASS_MOVE);\n setData(face, DATA_ACTION, ACTION_ALL);\n }\n\n if (!options.cropBoxResizable) {\n addClass(cropBox.getElementsByClassName(\"\".concat(NAMESPACE, \"-line\")), CLASS_HIDDEN);\n addClass(cropBox.getElementsByClassName(\"\".concat(NAMESPACE, \"-point\")), CLASS_HIDDEN);\n }\n\n this.render();\n this.ready = true;\n this.setDragMode(options.dragMode);\n\n if (options.autoCrop) {\n this.crop();\n }\n\n this.setData(options.data);\n\n if (isFunction(options.ready)) {\n addListener(element, EVENT_READY, options.ready, {\n once: true\n });\n }\n\n dispatchEvent(element, EVENT_READY);\n }\n }, {\n key: \"unbuild\",\n value: function unbuild() {\n if (!this.ready) {\n return;\n }\n\n this.ready = false;\n this.unbind();\n this.resetPreview();\n this.cropper.parentNode.removeChild(this.cropper);\n removeClass(this.element, CLASS_HIDDEN);\n }\n }, {\n key: \"uncreate\",\n value: function uncreate() {\n if (this.ready) {\n this.unbuild();\n this.ready = false;\n this.cropped = false;\n } else if (this.sizing) {\n this.sizingImage.onload = null;\n this.sizing = false;\n this.sized = false;\n } else if (this.reloading) {\n this.xhr.onabort = null;\n this.xhr.abort();\n } else if (this.image) {\n this.stop();\n }\n }\n /**\n * Get the no conflict cropper class.\n * @returns {Cropper} The cropper class.\n */\n\n }], [{\n key: \"noConflict\",\n value: function noConflict() {\n window.Cropper = AnotherCropper;\n return Cropper;\n }\n /**\n * Change the default options.\n * @param {Object} options - The new default options.\n */\n\n }, {\n key: \"setDefaults\",\n value: function setDefaults(options) {\n assign(DEFAULTS, isPlainObject(options) && options);\n }\n }]);\n\n return Cropper;\n }();\n\n assign(Cropper.prototype, render, preview, events, handlers, change, methods);\n\n return Cropper;\n\n}));\n","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nvar printWarning = function() {};\n\nif (process.env.NODE_ENV !== 'production') {\n var ReactPropTypesSecret = require('./lib/ReactPropTypesSecret');\n var loggedTypeFailures = {};\n var has = Function.call.bind(Object.prototype.hasOwnProperty);\n\n printWarning = function(text) {\n var message = 'Warning: ' + text;\n if (typeof console !== 'undefined') {\n console.error(message);\n }\n try {\n // --- Welcome to debugging React ---\n // This error was thrown as a convenience so that you can use this stack\n // to find the callsite that caused this warning to fire.\n throw new Error(message);\n } catch (x) {}\n };\n}\n\n/**\n * Assert that the values match with the type specs.\n * Error messages are memorized and will only be shown once.\n *\n * @param {object} typeSpecs Map of name to a ReactPropType\n * @param {object} values Runtime values that need to be type-checked\n * @param {string} location e.g. \"prop\", \"context\", \"child context\"\n * @param {string} componentName Name of the component for error messages.\n * @param {?Function} getStack Returns the component stack.\n * @private\n */\nfunction checkPropTypes(typeSpecs, values, location, componentName, getStack) {\n if (process.env.NODE_ENV !== 'production') {\n for (var typeSpecName in typeSpecs) {\n if (has(typeSpecs, typeSpecName)) {\n var error;\n // Prop type validation may throw. In case they do, we don't want to\n // fail the render phase where it didn't fail before. So we log it.\n // After these have been cleaned up, we'll let them throw.\n try {\n // This is intentionally an invariant that gets caught. It's the same\n // behavior as without this statement except with a better message.\n if (typeof typeSpecs[typeSpecName] !== 'function') {\n var err = Error(\n (componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +\n 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.'\n );\n err.name = 'Invariant Violation';\n throw err;\n }\n error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);\n } catch (ex) {\n error = ex;\n }\n if (error && !(error instanceof Error)) {\n printWarning(\n (componentName || 'React class') + ': type specification of ' +\n location + ' `' + typeSpecName + '` is invalid; the type checker ' +\n 'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +\n 'You may have forgotten to pass an argument to the type checker ' +\n 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +\n 'shape all require an argument).'\n );\n }\n if (error instanceof Error && !(error.message in loggedTypeFailures)) {\n // Only monitor this failure once because there tends to be a lot of the\n // same error.\n loggedTypeFailures[error.message] = true;\n\n var stack = getStack ? getStack() : '';\n\n printWarning(\n 'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')\n );\n }\n }\n }\n }\n}\n\n/**\n * Resets warning cache when testing.\n *\n * @private\n */\ncheckPropTypes.resetWarningCache = function() {\n if (process.env.NODE_ENV !== 'production') {\n loggedTypeFailures = {};\n }\n}\n\nmodule.exports = checkPropTypes;\n","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nvar ReactIs = require('react-is');\nvar assign = require('object-assign');\n\nvar ReactPropTypesSecret = require('./lib/ReactPropTypesSecret');\nvar checkPropTypes = require('./checkPropTypes');\n\nvar has = Function.call.bind(Object.prototype.hasOwnProperty);\nvar printWarning = function() {};\n\nif (process.env.NODE_ENV !== 'production') {\n printWarning = function(text) {\n var message = 'Warning: ' + text;\n if (typeof console !== 'undefined') {\n console.error(message);\n }\n try {\n // --- Welcome to debugging React ---\n // This error was thrown as a convenience so that you can use this stack\n // to find the callsite that caused this warning to fire.\n throw new Error(message);\n } catch (x) {}\n };\n}\n\nfunction emptyFunctionThatReturnsNull() {\n return null;\n}\n\nmodule.exports = function(isValidElement, throwOnDirectAccess) {\n /* global Symbol */\n var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;\n var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.\n\n /**\n * Returns the iterator method function contained on the iterable object.\n *\n * Be sure to invoke the function with the iterable as context:\n *\n * var iteratorFn = getIteratorFn(myIterable);\n * if (iteratorFn) {\n * var iterator = iteratorFn.call(myIterable);\n * ...\n * }\n *\n * @param {?object} maybeIterable\n * @return {?function}\n */\n function getIteratorFn(maybeIterable) {\n var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);\n if (typeof iteratorFn === 'function') {\n return iteratorFn;\n }\n }\n\n /**\n * Collection of methods that allow declaration and validation of props that are\n * supplied to React components. Example usage:\n *\n * var Props = require('ReactPropTypes');\n * var MyArticle = React.createClass({\n * propTypes: {\n * // An optional string prop named \"description\".\n * description: Props.string,\n *\n * // A required enum prop named \"category\".\n * category: Props.oneOf(['News','Photos']).isRequired,\n *\n * // A prop named \"dialog\" that requires an instance of Dialog.\n * dialog: Props.instanceOf(Dialog).isRequired\n * },\n * render: function() { ... }\n * });\n *\n * A more formal specification of how these methods are used:\n *\n * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)\n * decl := ReactPropTypes.{type}(.isRequired)?\n *\n * Each and every declaration produces a function with the same signature. This\n * allows the creation of custom validation functions. For example:\n *\n * var MyLink = React.createClass({\n * propTypes: {\n * // An optional string or URI prop named \"href\".\n * href: function(props, propName, componentName) {\n * var propValue = props[propName];\n * if (propValue != null && typeof propValue !== 'string' &&\n * !(propValue instanceof URI)) {\n * return new Error(\n * 'Expected a string or an URI for ' + propName + ' in ' +\n * componentName\n * );\n * }\n * }\n * },\n * render: function() {...}\n * });\n *\n * @internal\n */\n\n var ANONYMOUS = '<<anonymous>>';\n\n // Important!\n // Keep this list in sync with production version in `./factoryWithThrowingShims.js`.\n var ReactPropTypes = {\n array: createPrimitiveTypeChecker('array'),\n bool: createPrimitiveTypeChecker('boolean'),\n func: createPrimitiveTypeChecker('function'),\n number: createPrimitiveTypeChecker('number'),\n object: createPrimitiveTypeChecker('object'),\n string: createPrimitiveTypeChecker('string'),\n symbol: createPrimitiveTypeChecker('symbol'),\n\n any: createAnyTypeChecker(),\n arrayOf: createArrayOfTypeChecker,\n element: createElementTypeChecker(),\n elementType: createElementTypeTypeChecker(),\n instanceOf: createInstanceTypeChecker,\n node: createNodeChecker(),\n objectOf: createObjectOfTypeChecker,\n oneOf: createEnumTypeChecker,\n oneOfType: createUnionTypeChecker,\n shape: createShapeTypeChecker,\n exact: createStrictShapeTypeChecker,\n };\n\n /**\n * inlined Object.is polyfill to avoid requiring consumers ship their own\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is\n */\n /*eslint-disable no-self-compare*/\n function is(x, y) {\n // SameValue algorithm\n if (x === y) {\n // Steps 1-5, 7-10\n // Steps 6.b-6.e: +0 != -0\n return x !== 0 || 1 / x === 1 / y;\n } else {\n // Step 6.a: NaN == NaN\n return x !== x && y !== y;\n }\n }\n /*eslint-enable no-self-compare*/\n\n /**\n * We use an Error-like object for backward compatibility as people may call\n * PropTypes directly and inspect their output. However, we don't use real\n * Errors anymore. We don't inspect their stack anyway, and creating them\n * is prohibitively expensive if they are created too often, such as what\n * happens in oneOfType() for any type before the one that matched.\n */\n function PropTypeError(message) {\n this.message = message;\n this.stack = '';\n }\n // Make `instanceof Error` still work for returned errors.\n PropTypeError.prototype = Error.prototype;\n\n function createChainableTypeChecker(validate) {\n if (process.env.NODE_ENV !== 'production') {\n var manualPropTypeCallCache = {};\n var manualPropTypeWarningCount = 0;\n }\n function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {\n componentName = componentName || ANONYMOUS;\n propFullName = propFullName || propName;\n\n if (secret !== ReactPropTypesSecret) {\n if (throwOnDirectAccess) {\n // New behavior only for users of `prop-types` package\n var err = new Error(\n 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +\n 'Use `PropTypes.checkPropTypes()` to call them. ' +\n 'Read more at http://fb.me/use-check-prop-types'\n );\n err.name = 'Invariant Violation';\n throw err;\n } else if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') {\n // Old behavior for people using React.PropTypes\n var cacheKey = componentName + ':' + propName;\n if (\n !manualPropTypeCallCache[cacheKey] &&\n // Avoid spamming the console because they are often not actionable except for lib authors\n manualPropTypeWarningCount < 3\n ) {\n printWarning(\n 'You are manually calling a React.PropTypes validation ' +\n 'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' +\n 'and will throw in the standalone `prop-types` package. ' +\n 'You may be seeing this warning due to a third-party PropTypes ' +\n 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.'\n );\n manualPropTypeCallCache[cacheKey] = true;\n manualPropTypeWarningCount++;\n }\n }\n }\n if (props[propName] == null) {\n if (isRequired) {\n if (props[propName] === null) {\n return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));\n }\n return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));\n }\n return null;\n } else {\n return validate(props, propName, componentName, location, propFullName);\n }\n }\n\n var chainedCheckType = checkType.bind(null, false);\n chainedCheckType.isRequired = checkType.bind(null, true);\n\n return chainedCheckType;\n }\n\n function createPrimitiveTypeChecker(expectedType) {\n function validate(props, propName, componentName, location, propFullName, secret) {\n var propValue = props[propName];\n var propType = getPropType(propValue);\n if (propType !== expectedType) {\n // `propValue` being instance of, say, date/regexp, pass the 'object'\n // check, but we can offer a more precise error message here rather than\n // 'of type `object`'.\n var preciseType = getPreciseType(propValue);\n\n return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));\n }\n return null;\n }\n return createChainableTypeChecker(validate);\n }\n\n function createAnyTypeChecker() {\n return createChainableTypeChecker(emptyFunctionThatReturnsNull);\n }\n\n function createArrayOfTypeChecker(typeChecker) {\n function validate(props, propName, componentName, location, propFullName) {\n if (typeof typeChecker !== 'function') {\n return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');\n }\n var propValue = props[propName];\n if (!Array.isArray(propValue)) {\n var propType = getPropType(propValue);\n return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));\n }\n for (var i = 0; i < propValue.length; i++) {\n var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret);\n if (error instanceof Error) {\n return error;\n }\n }\n return null;\n }\n return createChainableTypeChecker(validate);\n }\n\n function createElementTypeChecker() {\n function validate(props, propName, componentName, location, propFullName) {\n var propValue = props[propName];\n if (!isValidElement(propValue)) {\n var propType = getPropType(propValue);\n return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));\n }\n return null;\n }\n return createChainableTypeChecker(validate);\n }\n\n function createElementTypeTypeChecker() {\n function validate(props, propName, componentName, location, propFullName) {\n var propValue = props[propName];\n if (!ReactIs.isValidElementType(propValue)) {\n var propType = getPropType(propValue);\n return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement type.'));\n }\n return null;\n }\n return createChainableTypeChecker(validate);\n }\n\n function createInstanceTypeChecker(expectedClass) {\n function validate(props, propName, componentName, location, propFullName) {\n if (!(props[propName] instanceof expectedClass)) {\n var expectedClassName = expectedClass.name || ANONYMOUS;\n var actualClassName = getClassName(props[propName]);\n return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));\n }\n return null;\n }\n return createChainableTypeChecker(validate);\n }\n\n function createEnumTypeChecker(expectedValues) {\n if (!Array.isArray(expectedValues)) {\n if (process.env.NODE_ENV !== 'production') {\n if (arguments.length > 1) {\n printWarning(\n 'Invalid arguments supplied to oneOf, expected an array, got ' + arguments.length + ' arguments. ' +\n 'A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).'\n );\n } else {\n printWarning('Invalid argument supplied to oneOf, expected an array.');\n }\n }\n return emptyFunctionThatReturnsNull;\n }\n\n function validate(props, propName, componentName, location, propFullName) {\n var propValue = props[propName];\n for (var i = 0; i < expectedValues.length; i++) {\n if (is(propValue, expectedValues[i])) {\n return null;\n }\n }\n\n var valuesString = JSON.stringify(expectedValues, function replacer(key, value) {\n var type = getPreciseType(value);\n if (type === 'symbol') {\n return String(value);\n }\n return value;\n });\n return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + String(propValue) + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));\n }\n return createChainableTypeChecker(validate);\n }\n\n function createObjectOfTypeChecker(typeChecker) {\n function validate(props, propName, componentName, location, propFullName) {\n if (typeof typeChecker !== 'function') {\n return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');\n }\n var propValue = props[propName];\n var propType = getPropType(propValue);\n if (propType !== 'object') {\n return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));\n }\n for (var key in propValue) {\n if (has(propValue, key)) {\n var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);\n if (error instanceof Error) {\n return error;\n }\n }\n }\n return null;\n }\n return createChainableTypeChecker(validate);\n }\n\n function createUnionTypeChecker(arrayOfTypeCheckers) {\n if (!Array.isArray(arrayOfTypeCheckers)) {\n process.env.NODE_ENV !== 'production' ? printWarning('Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;\n return emptyFunctionThatReturnsNull;\n }\n\n for (var i = 0; i < arrayOfTypeCheckers.length; i++) {\n var checker = arrayOfTypeCheckers[i];\n if (typeof checker !== 'function') {\n printWarning(\n 'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' +\n 'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.'\n );\n return emptyFunctionThatReturnsNull;\n }\n }\n\n function validate(props, propName, componentName, location, propFullName) {\n for (var i = 0; i < arrayOfTypeCheckers.length; i++) {\n var checker = arrayOfTypeCheckers[i];\n if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret) == null) {\n return null;\n }\n }\n\n return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));\n }\n return createChainableTypeChecker(validate);\n }\n\n function createNodeChecker() {\n function validate(props, propName, componentName, location, propFullName) {\n if (!isNode(props[propName])) {\n return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));\n }\n return null;\n }\n return createChainableTypeChecker(validate);\n }\n\n function createShapeTypeChecker(shapeTypes) {\n function validate(props, propName, componentName, location, propFullName) {\n var propValue = props[propName];\n var propType = getPropType(propValue);\n if (propType !== 'object') {\n return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));\n }\n for (var key in shapeTypes) {\n var checker = shapeTypes[key];\n if (!checker) {\n continue;\n }\n var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);\n if (error) {\n return error;\n }\n }\n return null;\n }\n return createChainableTypeChecker(validate);\n }\n\n function createStrictShapeTypeChecker(shapeTypes) {\n function validate(props, propName, componentName, location, propFullName) {\n var propValue = props[propName];\n var propType = getPropType(propValue);\n if (propType !== 'object') {\n return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));\n }\n // We need to check all keys in case some are required but missing from\n // props.\n var allKeys = assign({}, props[propName], shapeTypes);\n for (var key in allKeys) {\n var checker = shapeTypes[key];\n if (!checker) {\n return new PropTypeError(\n 'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +\n '\\nBad object: ' + JSON.stringify(props[propName], null, ' ') +\n '\\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')\n );\n }\n var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);\n if (error) {\n return error;\n }\n }\n return null;\n }\n\n return createChainableTypeChecker(validate);\n }\n\n function isNode(propValue) {\n switch (typeof propValue) {\n case 'number':\n case 'string':\n case 'undefined':\n return true;\n case 'boolean':\n return !propValue;\n case 'object':\n if (Array.isArray(propValue)) {\n return propValue.every(isNode);\n }\n if (propValue === null || isValidElement(propValue)) {\n return true;\n }\n\n var iteratorFn = getIteratorFn(propValue);\n if (iteratorFn) {\n var iterator = iteratorFn.call(propValue);\n var step;\n if (iteratorFn !== propValue.entries) {\n while (!(step = iterator.next()).done) {\n if (!isNode(step.value)) {\n return false;\n }\n }\n } else {\n // Iterator will provide entry [k,v] tuples rather than values.\n while (!(step = iterator.next()).done) {\n var entry = step.value;\n if (entry) {\n if (!isNode(entry[1])) {\n return false;\n }\n }\n }\n }\n } else {\n return false;\n }\n\n return true;\n default:\n return false;\n }\n }\n\n function isSymbol(propType, propValue) {\n // Native Symbol.\n if (propType === 'symbol') {\n return true;\n }\n\n // falsy value can't be a Symbol\n if (!propValue) {\n return false;\n }\n\n // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'\n if (propValue['@@toStringTag'] === 'Symbol') {\n return true;\n }\n\n // Fallback for non-spec compliant Symbols which are polyfilled.\n if (typeof Symbol === 'function' && propValue instanceof Symbol) {\n return true;\n }\n\n return false;\n }\n\n // Equivalent of `typeof` but with special handling for array and regexp.\n function getPropType(propValue) {\n var propType = typeof propValue;\n if (Array.isArray(propValue)) {\n return 'array';\n }\n if (propValue instanceof RegExp) {\n // Old webkits (at least until Android 4.0) return 'function' rather than\n // 'object' for typeof a RegExp. We'll normalize this here so that /bla/\n // passes PropTypes.object.\n return 'object';\n }\n if (isSymbol(propType, propValue)) {\n return 'symbol';\n }\n return propType;\n }\n\n // This handles more types than `getPropType`. Only used for error messages.\n // See `createPrimitiveTypeChecker`.\n function getPreciseType(propValue) {\n if (typeof propValue === 'undefined' || propValue === null) {\n return '' + propValue;\n }\n var propType = getPropType(propValue);\n if (propType === 'object') {\n if (propValue instanceof Date) {\n return 'date';\n } else if (propValue instanceof RegExp) {\n return 'regexp';\n }\n }\n return propType;\n }\n\n // Returns a string that is postfixed to a warning about an invalid type.\n // For example, \"undefined\" or \"of type array\"\n function getPostfixForTypeWarning(value) {\n var type = getPreciseType(value);\n switch (type) {\n case 'array':\n case 'object':\n return 'an ' + type;\n case 'boolean':\n case 'date':\n case 'regexp':\n return 'a ' + type;\n default:\n return type;\n }\n }\n\n // Returns class name of the object, if any.\n function getClassName(propValue) {\n if (!propValue.constructor || !propValue.constructor.name) {\n return ANONYMOUS;\n }\n return propValue.constructor.name;\n }\n\n ReactPropTypes.checkPropTypes = checkPropTypes;\n ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache;\n ReactPropTypes.PropTypes = ReactPropTypes;\n\n return ReactPropTypes;\n};\n","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nif (process.env.NODE_ENV !== 'production') {\n var ReactIs = require('react-is');\n\n // By explicitly using `prop-types` you are opting into new development behavior.\n // http://fb.me/prop-types-in-prod\n var throwOnDirectAccess = true;\n module.exports = require('./factoryWithTypeCheckers')(ReactIs.isElement, throwOnDirectAccess);\n} else {\n // By explicitly using `prop-types` you are opting into new production behavior.\n // http://fb.me/prop-types-in-prod\n module.exports = require('./factoryWithThrowingShims')();\n}\n","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nvar ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';\n\nmodule.exports = ReactPropTypesSecret;\n","/*\nobject-assign\n(c) Sindre Sorhus\n@license MIT\n*/\n\n'use strict';\n/* eslint-disable no-unused-vars */\nvar getOwnPropertySymbols = Object.getOwnPropertySymbols;\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\nvar propIsEnumerable = Object.prototype.propertyIsEnumerable;\n\nfunction toObject(val) {\n\tif (val === null || val === undefined) {\n\t\tthrow new TypeError('Object.assign cannot be called with null or undefined');\n\t}\n\n\treturn Object(val);\n}\n\nfunction shouldUseNative() {\n\ttry {\n\t\tif (!Object.assign) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Detect buggy property enumeration order in older V8 versions.\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=4118\n\t\tvar test1 = new String('abc'); // eslint-disable-line no-new-wrappers\n\t\ttest1[5] = 'de';\n\t\tif (Object.getOwnPropertyNames(test1)[0] === '5') {\n\t\t\treturn false;\n\t\t}\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=3056\n\t\tvar test2 = {};\n\t\tfor (var i = 0; i < 10; i++) {\n\t\t\ttest2['_' + String.fromCharCode(i)] = i;\n\t\t}\n\t\tvar order2 = Object.getOwnPropertyNames(test2).map(function (n) {\n\t\t\treturn test2[n];\n\t\t});\n\t\tif (order2.join('') !== '0123456789') {\n\t\t\treturn false;\n\t\t}\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=3056\n\t\tvar test3 = {};\n\t\t'abcdefghijklmnopqrst'.split('').forEach(function (letter) {\n\t\t\ttest3[letter] = letter;\n\t\t});\n\t\tif (Object.keys(Object.assign({}, test3)).join('') !==\n\t\t\t\t'abcdefghijklmnopqrst') {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t} catch (err) {\n\t\t// We don't expect any of the above to throw, but better to be safe.\n\t\treturn false;\n\t}\n}\n\nmodule.exports = shouldUseNative() ? Object.assign : function (target, source) {\n\tvar from;\n\tvar to = toObject(target);\n\tvar symbols;\n\n\tfor (var s = 1; s < arguments.length; s++) {\n\t\tfrom = Object(arguments[s]);\n\n\t\tfor (var key in from) {\n\t\t\tif (hasOwnProperty.call(from, key)) {\n\t\t\t\tto[key] = from[key];\n\t\t\t}\n\t\t}\n\n\t\tif (getOwnPropertySymbols) {\n\t\t\tsymbols = getOwnPropertySymbols(from);\n\t\t\tfor (var i = 0; i < symbols.length; i++) {\n\t\t\t\tif (propIsEnumerable.call(from, symbols[i])) {\n\t\t\t\t\tto[symbols[i]] = from[symbols[i]];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn to;\n};\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\n\nvar _react = _interopRequireWildcard(require(\"react\"));\n\nvar _propTypes = _interopRequireDefault(require(\"prop-types\"));\n\nvar _cropperjs = _interopRequireDefault(require(\"cropperjs\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }\n\nfunction _typeof(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nfunction _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nvar optionProps = ['dragMode', 'aspectRatio', 'data', 'crop', // unchangeable props start from here\n'viewMode', 'preview', 'responsive', 'restore', 'checkCrossOrigin', 'checkOrientation', 'modal', 'guides', 'center', 'highlight', 'background', 'autoCrop', 'autoCropArea', 'movable', 'rotatable', 'scalable', 'zoomable', 'zoomOnTouch', 'zoomOnWheel', 'wheelZoomRatio', 'cropBoxMovable', 'cropBoxResizable', 'toggleDragModeOnDblclick', 'minContainerWidth', 'minContainerHeight', 'minCanvasWidth', 'minCanvasHeight', 'minCropBoxWidth', 'minCropBoxHeight', 'ready', 'cropstart', 'cropmove', 'cropend', 'zoom'];\nvar unchangeableProps = optionProps.slice(4);\n\nvar ReactCropper =\n/*#__PURE__*/\nfunction (_Component) {\n _inherits(ReactCropper, _Component);\n\n function ReactCropper() {\n _classCallCheck(this, ReactCropper);\n\n return _possibleConstructorReturn(this, _getPrototypeOf(ReactCropper).apply(this, arguments));\n }\n\n _createClass(ReactCropper, [{\n key: \"componentDidMount\",\n value: function componentDidMount() {\n var _this = this;\n\n var options = Object.keys(this.props).filter(function (propKey) {\n return optionProps.indexOf(propKey) !== -1;\n }).reduce(function (prevOptions, propKey) {\n return _extends({}, prevOptions, _defineProperty({}, propKey, _this.props[propKey]));\n }, {});\n this.cropper = new _cropperjs.default(this.img, options);\n }\n }, {\n key: \"UNSAFE_componentWillReceiveProps\",\n value: function UNSAFE_componentWillReceiveProps(nextProps) {\n var _this2 = this;\n\n if (nextProps.src !== this.props.src) {\n this.cropper.reset().clear().replace(nextProps.src);\n }\n\n if (nextProps.aspectRatio !== this.props.aspectRatio) {\n this.setAspectRatio(nextProps.aspectRatio);\n }\n\n if (nextProps.data !== this.props.data) {\n this.setData(nextProps.data);\n }\n\n if (nextProps.dragMode !== this.props.dragMode) {\n this.setDragMode(nextProps.dragMode);\n }\n\n if (nextProps.cropBoxData !== this.props.cropBoxData) {\n this.setCropBoxData(nextProps.cropBoxData);\n }\n\n if (nextProps.canvasData !== this.props.canvasData) {\n this.setCanvasData(nextProps.canvasData);\n }\n\n if (nextProps.moveTo !== this.props.moveTo) {\n if (nextProps.moveTo.length > 1) {\n this.moveTo(nextProps.moveTo[0], nextProps.moveTo[1]);\n } else {\n this.moveTo(nextProps.moveTo[0]);\n }\n }\n\n if (nextProps.zoomTo !== this.props.zoomTo) {\n this.zoomTo(nextProps.zoomTo);\n }\n\n if (nextProps.rotateTo !== this.props.rotateTo) {\n this.rotateTo(nextProps.rotateTo);\n }\n\n if (nextProps.scaleX !== this.props.scaleX) {\n this.scaleX(nextProps.scaleX);\n }\n\n if (nextProps.scaleY !== this.props.scaleY) {\n this.scaleY(nextProps.scaleY);\n }\n\n if (nextProps.enable !== this.props.enable) {\n if (nextProps.enable) {\n this.enable();\n } else {\n this.disable();\n }\n }\n\n Object.keys(nextProps).forEach(function (propKey) {\n var isDifferentVal = nextProps[propKey] !== _this2.props[propKey];\n var isUnchangeableProps = unchangeableProps.indexOf(propKey) !== -1;\n\n if (typeof nextProps[propKey] === 'function' && typeof _this2.props[propKey] === 'function') {\n isDifferentVal = nextProps[propKey].toString() !== _this2.props[propKey].toString();\n }\n\n if (isDifferentVal && isUnchangeableProps) {\n throw new Error(\"prop: \".concat(propKey, \" can't be change after componentDidMount\"));\n }\n });\n }\n }, {\n key: \"componentWillUnmount\",\n value: function componentWillUnmount() {\n if (this.img) {\n // Destroy the cropper, this makes sure events such as resize are cleaned up and do not leak\n this.cropper.destroy();\n delete this.img;\n delete this.cropper;\n }\n }\n }, {\n key: \"setDragMode\",\n value: function setDragMode(mode) {\n return this.cropper.setDragMode(mode);\n }\n }, {\n key: \"setAspectRatio\",\n value: function setAspectRatio(aspectRatio) {\n return this.cropper.setAspectRatio(aspectRatio);\n }\n }, {\n key: \"getCroppedCanvas\",\n value: function getCroppedCanvas(options) {\n return this.cropper.getCroppedCanvas(options);\n }\n }, {\n key: \"setCropBoxData\",\n value: function setCropBoxData(data) {\n return this.cropper.setCropBoxData(data);\n }\n }, {\n key: \"getCropBoxData\",\n value: function getCropBoxData() {\n return this.cropper.getCropBoxData();\n }\n }, {\n key: \"setCanvasData\",\n value: function setCanvasData(data) {\n return this.cropper.setCanvasData(data);\n }\n }, {\n key: \"getCanvasData\",\n value: function getCanvasData() {\n return this.cropper.getCanvasData();\n }\n }, {\n key: \"getImageData\",\n value: function getImageData() {\n return this.cropper.getImageData();\n }\n }, {\n key: \"getContainerData\",\n value: function getContainerData() {\n return this.cropper.getContainerData();\n }\n }, {\n key: \"setData\",\n value: function setData(data) {\n return this.cropper.setData(data);\n }\n }, {\n key: \"getData\",\n value: function getData(rounded) {\n return this.cropper.getData(rounded);\n }\n }, {\n key: \"crop\",\n value: function crop() {\n return this.cropper.crop();\n }\n }, {\n key: \"move\",\n value: function move(offsetX, offsetY) {\n return this.cropper.move(offsetX, offsetY);\n }\n }, {\n key: \"moveTo\",\n value: function moveTo(x, y) {\n return this.cropper.moveTo(x, y);\n }\n }, {\n key: \"zoom\",\n value: function zoom(ratio) {\n return this.cropper.zoom(ratio);\n }\n }, {\n key: \"zoomTo\",\n value: function zoomTo(ratio) {\n return this.cropper.zoomTo(ratio);\n }\n }, {\n key: \"rotate\",\n value: function rotate(degree) {\n return this.cropper.rotate(degree);\n }\n }, {\n key: \"rotateTo\",\n value: function rotateTo(degree) {\n return this.cropper.rotateTo(degree);\n }\n }, {\n key: \"enable\",\n value: function enable() {\n return this.cropper.enable();\n }\n }, {\n key: \"disable\",\n value: function disable() {\n return this.cropper.disable();\n }\n }, {\n key: \"reset\",\n value: function reset() {\n return this.cropper.reset();\n }\n }, {\n key: \"clear\",\n value: function clear() {\n return this.cropper.clear();\n }\n }, {\n key: \"replace\",\n value: function replace(url, onlyColorChanged) {\n return this.cropper.replace(url, onlyColorChanged);\n }\n }, {\n key: \"scale\",\n value: function scale(scaleX, scaleY) {\n return this.cropper.scale(scaleX, scaleY);\n }\n }, {\n key: \"scaleX\",\n value: function scaleX(_scaleX) {\n return this.cropper.scaleX(_scaleX);\n }\n }, {\n key: \"scaleY\",\n value: function scaleY(_scaleY) {\n return this.cropper.scaleY(_scaleY);\n }\n }, {\n key: \"render\",\n value: function render() {\n var _this3 = this;\n\n var _this$props = this.props,\n src = _this$props.src,\n alt = _this$props.alt,\n crossOrigin = _this$props.crossOrigin,\n style = _this$props.style,\n className = _this$props.className;\n return _react.default.createElement(\"div\", {\n style: style,\n className: className\n }, _react.default.createElement(\"img\", {\n crossOrigin: crossOrigin,\n ref: function ref(img) {\n _this3.img = img;\n },\n src: src,\n alt: alt === undefined ? 'picture' : alt,\n style: {\n opacity: 0\n }\n }));\n }\n }]);\n\n return ReactCropper;\n}(_react.Component);\n\nReactCropper.propTypes = {\n style: _propTypes.default.object,\n // eslint-disable-line react/forbid-prop-types\n className: _propTypes.default.string,\n // react cropper options\n crossOrigin: _propTypes.default.string,\n src: _propTypes.default.string,\n alt: _propTypes.default.string,\n // props of option can be changed after componentDidmount\n aspectRatio: _propTypes.default.number,\n dragMode: _propTypes.default.oneOf(['crop', 'move', 'none']),\n data: _propTypes.default.shape({\n x: _propTypes.default.number,\n y: _propTypes.default.number,\n width: _propTypes.default.number,\n height: _propTypes.default.number,\n rotate: _propTypes.default.number,\n scaleX: _propTypes.default.number,\n scaleY: _propTypes.default.number\n }),\n scaleX: _propTypes.default.number,\n scaleY: _propTypes.default.number,\n enable: _propTypes.default.bool,\n cropBoxData: _propTypes.default.shape({\n left: _propTypes.default.number,\n top: _propTypes.default.number,\n width: _propTypes.default.number,\n height: _propTypes.default.number\n }),\n canvasData: _propTypes.default.shape({\n left: _propTypes.default.number,\n top: _propTypes.default.number,\n width: _propTypes.default.number,\n height: _propTypes.default.number\n }),\n zoomTo: _propTypes.default.number,\n moveTo: _propTypes.default.arrayOf(_propTypes.default.number),\n rotateTo: _propTypes.default.number,\n // cropperjs options\n // https://github.com/fengyuanchen/cropperjs#options\n // aspectRatio, dragMode, data\n viewMode: _propTypes.default.oneOf([0, 1, 2, 3]),\n preview: _propTypes.default.string,\n responsive: _propTypes.default.bool,\n restore: _propTypes.default.bool,\n checkCrossOrigin: _propTypes.default.bool,\n checkOrientation: _propTypes.default.bool,\n modal: _propTypes.default.bool,\n guides: _propTypes.default.bool,\n center: _propTypes.default.bool,\n highlight: _propTypes.default.bool,\n background: _propTypes.default.bool,\n autoCrop: _propTypes.default.bool,\n autoCropArea: _propTypes.default.number,\n movable: _propTypes.default.bool,\n rotatable: _propTypes.default.bool,\n scalable: _propTypes.default.bool,\n zoomable: _propTypes.default.bool,\n zoomOnTouch: _propTypes.default.bool,\n zoomOnWheel: _propTypes.default.bool,\n wheelZoomRatio: _propTypes.default.number,\n cropBoxMovable: _propTypes.default.bool,\n cropBoxResizable: _propTypes.default.bool,\n toggleDragModeOnDblclick: _propTypes.default.bool,\n minContainerWidth: _propTypes.default.number,\n minContainerHeight: _propTypes.default.number,\n minCanvasWidth: _propTypes.default.number,\n minCanvasHeight: _propTypes.default.number,\n minCropBoxWidth: _propTypes.default.number,\n minCropBoxHeight: _propTypes.default.number,\n ready: _propTypes.default.func,\n cropstart: _propTypes.default.func,\n cropmove: _propTypes.default.func,\n cropend: _propTypes.default.func,\n crop: _propTypes.default.func,\n zoom: _propTypes.default.func\n};\nReactCropper.defaultProps = {\n src: null,\n dragMode: 'crop',\n data: null,\n scaleX: 1,\n scaleY: 1,\n enable: true,\n zoomTo: 1,\n rotateTo: 0\n};\nvar _default = ReactCropper;\nexports.default = _default;\n","/** @license React v16.13.1\n * react-is.development.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\n\n\nif (process.env.NODE_ENV !== \"production\") {\n (function() {\n'use strict';\n\n// The Symbol used to tag the ReactElement-like types. If there is no native Symbol\n// nor polyfill, then a plain number is used for performance.\nvar hasSymbol = typeof Symbol === 'function' && Symbol.for;\nvar REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;\nvar REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;\nvar REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;\nvar REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;\nvar REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;\nvar REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;\nvar REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary\n// (unstable) APIs that have been removed. Can we remove the symbols?\n\nvar REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;\nvar REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;\nvar REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;\nvar REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;\nvar REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;\nvar REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;\nvar REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;\nvar REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9;\nvar REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;\nvar REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;\nvar REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;\n\nfunction isValidElementType(type) {\n return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.\n type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE);\n}\n\nfunction typeOf(object) {\n if (typeof object === 'object' && object !== null) {\n var $$typeof = object.$$typeof;\n\n switch ($$typeof) {\n case REACT_ELEMENT_TYPE:\n var type = object.type;\n\n switch (type) {\n case REACT_ASYNC_MODE_TYPE:\n case REACT_CONCURRENT_MODE_TYPE:\n case REACT_FRAGMENT_TYPE:\n case REACT_PROFILER_TYPE:\n case REACT_STRICT_MODE_TYPE:\n case REACT_SUSPENSE_TYPE:\n return type;\n\n default:\n var $$typeofType = type && type.$$typeof;\n\n switch ($$typeofType) {\n case REACT_CONTEXT_TYPE:\n case REACT_FORWARD_REF_TYPE:\n case REACT_LAZY_TYPE:\n case REACT_MEMO_TYPE:\n case REACT_PROVIDER_TYPE:\n return $$typeofType;\n\n default:\n return $$typeof;\n }\n\n }\n\n case REACT_PORTAL_TYPE:\n return $$typeof;\n }\n }\n\n return undefined;\n} // AsyncMode is deprecated along with isAsyncMode\n\nvar AsyncMode = REACT_ASYNC_MODE_TYPE;\nvar ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;\nvar ContextConsumer = REACT_CONTEXT_TYPE;\nvar ContextProvider = REACT_PROVIDER_TYPE;\nvar Element = REACT_ELEMENT_TYPE;\nvar ForwardRef = REACT_FORWARD_REF_TYPE;\nvar Fragment = REACT_FRAGMENT_TYPE;\nvar Lazy = REACT_LAZY_TYPE;\nvar Memo = REACT_MEMO_TYPE;\nvar Portal = REACT_PORTAL_TYPE;\nvar Profiler = REACT_PROFILER_TYPE;\nvar StrictMode = REACT_STRICT_MODE_TYPE;\nvar Suspense = REACT_SUSPENSE_TYPE;\nvar hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated\n\nfunction isAsyncMode(object) {\n {\n if (!hasWarnedAboutDeprecatedIsAsyncMode) {\n hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint\n\n console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.');\n }\n }\n\n return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;\n}\nfunction isConcurrentMode(object) {\n return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;\n}\nfunction isContextConsumer(object) {\n return typeOf(object) === REACT_CONTEXT_TYPE;\n}\nfunction isContextProvider(object) {\n return typeOf(object) === REACT_PROVIDER_TYPE;\n}\nfunction isElement(object) {\n return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;\n}\nfunction isForwardRef(object) {\n return typeOf(object) === REACT_FORWARD_REF_TYPE;\n}\nfunction isFragment(object) {\n return typeOf(object) === REACT_FRAGMENT_TYPE;\n}\nfunction isLazy(object) {\n return typeOf(object) === REACT_LAZY_TYPE;\n}\nfunction isMemo(object) {\n return typeOf(object) === REACT_MEMO_TYPE;\n}\nfunction isPortal(object) {\n return typeOf(object) === REACT_PORTAL_TYPE;\n}\nfunction isProfiler(object) {\n return typeOf(object) === REACT_PROFILER_TYPE;\n}\nfunction isStrictMode(object) {\n return typeOf(object) === REACT_STRICT_MODE_TYPE;\n}\nfunction isSuspense(object) {\n return typeOf(object) === REACT_SUSPENSE_TYPE;\n}\n\nexports.AsyncMode = AsyncMode;\nexports.ConcurrentMode = ConcurrentMode;\nexports.ContextConsumer = ContextConsumer;\nexports.ContextProvider = ContextProvider;\nexports.Element = Element;\nexports.ForwardRef = ForwardRef;\nexports.Fragment = Fragment;\nexports.Lazy = Lazy;\nexports.Memo = Memo;\nexports.Portal = Portal;\nexports.Profiler = Profiler;\nexports.StrictMode = StrictMode;\nexports.Suspense = Suspense;\nexports.isAsyncMode = isAsyncMode;\nexports.isConcurrentMode = isConcurrentMode;\nexports.isContextConsumer = isContextConsumer;\nexports.isContextProvider = isContextProvider;\nexports.isElement = isElement;\nexports.isForwardRef = isForwardRef;\nexports.isFragment = isFragment;\nexports.isLazy = isLazy;\nexports.isMemo = isMemo;\nexports.isPortal = isPortal;\nexports.isProfiler = isProfiler;\nexports.isStrictMode = isStrictMode;\nexports.isSuspense = isSuspense;\nexports.isValidElementType = isValidElementType;\nexports.typeOf = typeOf;\n })();\n}\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/react-is.production.min.js');\n} else {\n module.exports = require('./cjs/react-is.development.js');\n}\n","import { registerBlockType } from '@wordpress/blocks'; \nimport { BlockAlignmentToolbar, BlockControls, InspectorControls, MediaUpload, MediaUploadCheck } from '@wordpress/block-editor';\nimport { Button, Toolbar, IconButton, Panel, PanelBody, PanelRow, TextControl, DateTimePicker, Icon } from '@wordpress/components';\nimport ServerSideRender from '@wordpress/server-side-render';\nimport { element, Fragment, useState, useEffect } from '@wordpress/element';\nimport { __experimentalGetSettings } from '@wordpress/date';\nimport { withState } from '@wordpress/compose';\nimport Cropper from 'react-cropper';\n\n\nconst el = React.createElement;\nconst cropperRef = React.createRef();\n\nconst soIconx = el('svg', { className: 'soIcon', width: '166.000000pt', height: '155.000000pt', preserveAspectRatio:\"xMidYMid meet\", viewBox:\"0 0 166.000000 155.000000\" },\n\tel('g', {transform:\"translate(0.000000,155.000000) scale(0.100000,-0.100000)\", fill:\"#000000\", stroke:\"none\"},\n\t el('path', { d: \"M880 774 l0 -779 98 95 c339 330 682 677 682 691 0 15 -748 759 -771 767 -5 2 -9 -301 -9 -774z\" } ),\n\t el('path', { d: \"M0 767 c0 -13 751 -757 764 -757 3 0 6 173 6 385 l0 385 -385 0 c-315 0 -385 -2 -385 -13z\" } )\n\t)\n);\n\nconst soIcon = () =>(\n\t<svg version=\"1.1\" id=\"Layer_1\" x=\"0px\" y=\"0px\" width=\"24px\" height=\"24px\" viewBox=\"0 0 24 24\" enable-background=\"new 0 0 24 24\">\n\t\t<polygon fill=\"#1F8978\" points=\"11.18,22.166 11.173,12 1.003,12 \"/>\n\t\t<polygon fill=\"#00AE95\" points=\"11.166,1.834 11.173,12 1.003,12 \"/>\n\t\t<polygon fill=\"#CE3D39\" points=\"12.822,22.166 12.829,12 22.998,12 \"/>\n\t\t<polygon fill=\"#F15C52\" points=\"12.836,1.834 12.829,12 22.998,12 \"/>\n\t</svg>\n);\n\nconst sSmallIcon = () => (\n <Icon icon={ <svg width=\"25\" height=\"25\" xmlns=\"http://www.w3.org/2000/svg\">\n <g>\n <path stroke=\"null\" id=\"svg_1\" fill-rule=\"evenodd\" fill=\"#010101\" d=\"m14.953703,6.452965c0,0.410933 0.333676,0.744479 0.74461,0.744479c0.410868,0 0.744544,-0.333578 0.744544,-0.744479c0,-0.410966 -0.333676,-0.744544 -0.744544,-0.744544c-0.410966,0 -0.74461,0.333578 -0.74461,0.744544zm-7.44495,4.020342l0,0.818949c0,0.369339 0.300702,0.670008 0.670041,0.670008l8.264031,0l-2.847197,-2.799309c-0.238228,-0.238326 -0.619432,-0.238326 -0.857267,0l-0.601765,0.592587l-1.518916,-1.485975c-0.238195,-0.238326 -0.666894,-0.238326 -0.902139,0l-2.206788,2.203739zm-2.680195,5.062573c0,0.658142 0.533096,1.191172 1.19114,1.191172l11.912085,0c0.65811,0 1.19114,-0.53303 1.19114,-1.191172l0,-11.316449c0,-0.658142 -0.53303,-1.191205 -1.19114,-1.191205l-11.912052,0c-0.658077,0 -1.19114,0.533096 -1.19114,1.191205l0,11.316449l-0.000033,0zm2.144248,-11.018599l10.005933,0c0.363307,0 0.655225,0.291787 0.655225,0.655192l0,7.325804c0,0.363242 -0.291918,0.655127 -0.655225,0.655127l-10.005933,0c-0.363275,0 -0.655258,-0.291885 -0.655258,-0.655127l0,-7.325804c-0.000033,-0.363406 0.291983,-0.655192 0.655258,-0.655192z\" clip-rule=\"evenodd\"/>\n </g>\n</svg> } />\n);\n\nconst sMediumIcon = () => (\n <Icon icon={ <svg width=\"25\" height=\"25\" xmlns=\"http://www.w3.org/2000/svg\">\n <g>\n <path stroke=\"null\" id=\"svg_1\" fill-rule=\"evenodd\" fill=\"#010101\" d=\"m14.802511,7.322292c0,0.515244 0.418376,0.933455 0.93362,0.933455c0.515161,0 0.933537,-0.418253 0.933537,-0.933455c0,-0.515285 -0.418376,-0.933537 -0.933537,-0.933537c-0.515285,0 -0.93362,0.418253 -0.93362,0.933537zm-9.334758,5.040856l0,1.02683c0,0.46309 0.377032,0.840081 0.840122,0.840081l10.361752,0l-3.569923,-3.509879c-0.298699,-0.298822 -0.776667,-0.298822 -1.074873,0l-0.754515,0.743008l-1.904474,-1.863171c-0.298658,-0.298822 -0.836177,-0.298822 -1.131136,0l-2.766953,2.763131zm-3.360529,6.347644c0,0.825204 0.668415,1.493537 1.493496,1.493537l14.935818,0c0.825162,0 1.493496,-0.668333 1.493496,-1.493537l0,-14.188988c0,-0.825204 -0.668333,-1.493578 -1.493496,-1.493578l-14.935777,0c-0.825121,0 -1.493496,0.668415 -1.493496,1.493578l0,14.188988l-0.000041,0zm2.688539,-13.815532l12.545814,0c0.455528,0 0.821546,0.365853 0.821546,0.821505l0,9.185367c0,0.455446 -0.366017,0.821423 -0.821546,0.821423l-12.545814,0c-0.455487,0 -0.821587,-0.365976 -0.821587,-0.821423l0,-9.185367c-0.000041,-0.455652 0.3661,-0.821505 0.821587,-0.821505z\" clip-rule=\"evenodd\"/>\n </g>\n</svg> } />\n);\n\nconst sWideIcon = () => (\n <Icon icon={ <svg width=\"25\" height=\"25\" xmlns=\"http://www.w3.org/2000/svg\">\n <g>\n <path stroke=\"null\" id=\"svg_1\" fill-rule=\"evenodd\" fill=\"#010101\" d=\"m16.730116,7.974287c0,0.593476 0.481901,1.075188 1.075377,1.075188c0.593382,0 1.075282,-0.481759 1.075282,-1.075188c0,-0.593524 -0.481901,-1.075282 -1.075282,-1.075282c-0.593524,0 -1.075377,0.481759 -1.075377,1.075282zm-10.752113,5.80624l0,1.18274c0,0.533404 0.434279,0.967636 0.967683,0.967636l11.935042,0l-4.111967,-4.042806c-0.344052,-0.344194 -0.894593,-0.344194 -1.238078,0l-0.869078,0.855823l-2.193642,-2.146067c-0.344005,-0.344194 -0.963139,-0.344194 -1.302883,0l-3.187077,3.182675zm-3.87078,7.311446c0,0.950499 0.769905,1.72031 1.720262,1.72031l17.203617,0c0.950452,0 1.720262,-0.76981 1.720262,-1.72031l0,-16.343391c0,-0.950499 -0.76981,-1.720357 -1.720262,-1.720357l-17.20357,0c-0.950405,0 -1.720262,0.769905 -1.720262,1.720357l0,16.343391l-0.000047,0zm3.096756,-15.913231l14.450724,0c0.524694,0 0.946286,0.421403 0.946286,0.946239l0,10.580039c0,0.5246 -0.421592,0.946144 -0.946286,0.946144l-14.450724,0c-0.524647,0 -0.946334,-0.421545 -0.946334,-0.946144l0,-10.580039c-0.000047,-0.524836 0.421687,-0.946239 0.946334,-0.946239z\" clip-rule=\"evenodd\"/>\n </g>\n</svg> } />\n);\n\nregisterBlockType( 'squareoffs/blocks', {\n title: 'SquareOffs',\n icon: soIcon,\n category: 'embed',\n attributes: {\n\t soAlignment: {\n\t \ttype: 'string',\n\t default : 'left'\n\t },\n\t soID: {\n\t type: 'number'\n\t },\n\t soSize: {\n\t \ttype: 'string',\n\t default : 'wide'\n\t },\n\t soStep: {\n\t \ttype: 'number',\n\t default: 0\n\t },\n \tquestion: {type: 'string'},\n \tside_1_title: {type: 'string'},\n \tside_2_title: {type: 'string'},\n \tside_1_defense: {type: 'string'},\n \tside_2_defense: {type: 'string'},\n \tside_1_photo: {type: 'string'},\n \tside_1_photo_raw: {type: 'string'},\n \tside_2_photo: {type: 'string'},\n \tside_2_photo_raw: {type: 'string'},\n \tend_date: {type: 'string'},\n \tcategory_uuid: {type: 'string'},\n \ttag_list: {type: 'string'},\n \tcover_photo: {type: 'string'},\n \tcover_photo_raw: {type: 'string'},\n \tcover_photo_mime: {type: 'string'},\n\t side1MediaID :{type:'string'},\n\t side2MediaID :{type:'string'},\n\t coverPhotoMediaID :{type:'string'},\n\t showRequired :{type:'number'},\n\t},\n edit: function(props) {\n\t\tconst [dateTimePickerFocus, setDateTimePickerFocus] = useState(false);\n\t\tconst [createSoStateDone, setCreateSoStateDone] = useState(false);\n\n\t\tuseEffect(() => {\n\t\t console.log(\"CB: \",dateTimePickerFocus);\n\t\t console.log(\"DONE: \",createSoStateDone);\n\t\t }, [dateTimePickerFocus, createSoStateDone]);\n\n\n\t\tconst fetchStep = 4;\n\t\tconst finalStep = 5;\n \tconst handleEndDateFocus = (event) => {\n \t\tevent.preventDefault();\n \t\tevent.stopPropagation();\n \t \tsetDateTimePickerFocus(true);\n \t};\n\n \tconst closeDatePicker = (event) => {\n\t\t\tevent.preventDefault();\n \t\tevent.stopPropagation();\n \t\tsetDateTimePickerFocus(false);\n \t};\n\n \tfunction updateSOStep(event) {\n\t event.preventDefault();\n\t console.log(props.attributes.soStep,\" == \",fetchStep);\n\t var proceed = false;\n\t console.log(props.attributes);\n\t if(props.attributes.soStep == 1){\n\t \tif(props.attributes.question && props.attributes.side_1_title && props.attributes.side_2_title) {\n\t \t\tproceed = true;\n\t\t }else{\n\t\t \tprops.setAttributes({showRequired:1});\n\t\t \tconsole.log(\"dddd\");\n\t\t }\n\t\t }else if(props.attributes.soStep == 3){\n\t\t\t if(props.attributes.category_uuid) {\n\t\t \tproceed = true;\n\t\t }else{\n\t\t \tprops.setAttributes({showRequired:3});\n\t\t }\n\t\t }else if(props.attributes.soStep == 0 || props.attributes.soStep == 2) proceed = true;\n\n\t if(proceed === true){\n\t\t if(parseInt(props.attributes.soStep) + 1 == fetchStep){\n\t\t \tif(props.attributes.question && props.attributes.side_1_title && props.attributes.side_2_title && props.attributes.category_uuid){\n\t\t \t\tcreateSquareOffs();\n\t\t \t\tprops.setAttributes({soStep: parseInt(props.attributes.soStep) + parseInt(1)});\n\t\t \t}\n\t\t }else{\n\t\t \tprops.setAttributes({soStep: parseInt(props.attributes.soStep) + parseInt(1)});\n\t\t }\n\t\t }\n\t }\n\n\t \n\t async function createSquareOffs(){\n\t \tvar form_data = new FormData();\n\t \t\n\t\t\tfor ( var key in props.attributes ) {\n\t\t\t form_data.append(key, props.attributes[key]);\n\t\t\t}\n\n\t\t\tform_data.append('action', 'soCreateSquareOffs');\n\t \tconsole.log(\"fetching...\");\n\t \tconsole.log(form_data);\n\t \tawait fetch( window.ajaxurl, {\n \t method: 'POST',\n \t body: form_data\n \t })\n\t\t \t.then(response => response.json())\n\t \t\t\t.then(data => doneCreatingSquareOffs(data));\n\t }\n\t function doneCreatingSquareOffs(data){\n\t \tconsole.log(data);\n\t \tprops.setAttributes({soID: data.external_id});\n\t \tprops.setAttributes({soStep: finalStep});\n\t \tprops.setAttributes({cover_photo: ''});\n\t }\n\t function backSOStep(event){\n\t \tevent.preventDefault();\n\t \tconsole.log(props.attributes);\n\t \tprops.setAttributes({soStep: parseInt(props.attributes.soStep) - parseInt(1)});\n\t }\n \tfunction sOStepExisting(event) {\n\t event.preventDefault();\n\t props.setAttributes({soStep: 10});\n\t }\n \tfunction sOStepCancel(event) {\n\t event.preventDefault();\n\t props.setAttributes({soStep: 0});\n\t }\n \tfunction injectSOShortcode(event) {\n\t\t if(props.attributes.soID && props.attributes.soSize && props.attributes.soAlignment) props.setAttributes({soStep: finalStep});\n\t }\n\n\t\tconst soUpdateSOID = ( event ) => {\n\t\t\tevent.preventDefault();\n\t\t\tif(event.key){\n\t\t\t\tif(\"Enter\" == event.key) props.setAttributes({soID: parseInt(event.target.value)});\n\t\t\t}else props.setAttributes({soID: parseInt(event.target.value)});\n\t\t};\n\t\tconst onChangeAlignment = ( newAlignment ) => {\n props.setAttributes( { soAlignment: newAlignment === undefined ? 'none' : newAlignment } );\n injectSOShortcode();\n };\n\n\t\tconst changeToSmall = () => {\n props.setAttributes( { soSize: 'small' } );\n injectSOShortcode();\n };\n\t\tconst changeToMedium = () => {\n props.setAttributes( { soSize: 'medium' } );\n injectSOShortcode();\n };\n\t\tconst changeToWide = () => {\n props.setAttributes( { soSize: 'wide' } );\n injectSOShortcode();\n };\n\nfunction _crop(){\n // image in dataUrl\n console.log(\"asdfsdf\",props.attributes);\n {props.setAttributes({cover_photo: cropperRef.current.getCroppedCanvas().toDataURL(props.attributes.cover_photo_mime)})}\n }\n\n\t return (\n\t\t <div class={'soContainer '+ props.className} >\n\t\t\t { props.attributes.soStep == finalStep && props.attributes.soID \n\t\t\t \t? \n\t\t\t\t \t<div>\n\t\t\t\t\t \t<Fragment>\n\t\t\t\t\t \t\t<InspectorControls>\n\t\t\t\t\t \t\t\t<PanelBody title=\"SquareOffs Settings\" initialOpen={true}>\n\t\t\t\t\t \t\t\t\t<PanelRow>\n\t\t\t\t\t \t\t\t\t\t<TextControl\n\t\t\t\t\t \t\t\t\t\tlabel=\"SquareOff ID\"\n\t\t\t\t\t \t\t\t\t\tonKeyUp={soUpdateSOID}\n\t\t\t\t\t \t\t\t\t\tonBlur={soUpdateSOID}\n\t\t\t\t\t \t\t\t\t\tdefaultValue={props.attributes.soID}\n\t\t\t\t\t \t\t\t\t\t/>\n\t\t\t\t\t \t\t\t\t</PanelRow>\n\t\t\t\t\t \t\t\t</PanelBody>\n\t\t\t\t\t \t\t</InspectorControls>\n\t\t\t\t\t \t</Fragment>\n\t\t\t\t\t \n\t\t\t\t\t \t<BlockControls>\n\t\t <BlockAlignmentToolbar\n\t\t \tcontrols={['left', 'center', 'right']}\n\t\t value={props.attributes.soAlignment}\n\t\t onChange={ onChangeAlignment }\n\t\t />\n\t\t\t <Toolbar>\n\t\t\t\t\t\t\t\t <IconButton\n\t\t\t\t\t\t\t\t icon= {sSmallIcon}\n\t\t\t\t\t\t\t\t label=\"Small\"\n\t\t\t\t\t\t\t\t value=\"small\"\n\t\t\t\t\t\t\t\t onClick={changeToSmall}\n\t\t\t\t\t\t\t\t />\n\t\t\t\t\t\t\t\t <IconButton\n\t\t\t\t\t\t\t\t icon={sMediumIcon}\n\t\t\t\t\t\t\t\t label=\"Medium\"\n\t\t\t\t\t\t\t\t value=\"medium\"\n\t\t\t\t\t\t\t\t onClick={ changeToMedium }\n\t\t\t\t\t\t\t\t />\n\t\t\t\t\t\t\t\t <IconButton\n\t\t\t\t\t\t\t\t icon={sWideIcon}\n\t\t\t\t\t\t\t\t label=\"Wide\"\n\t\t\t\t\t\t\t\t value=\"wide\"\n\t\t\t\t\t\t\t\t onClick={ changeToWide }\n\t\t\t\t\t\t\t\t />\n\t\t\t\t\t\t\t\t</Toolbar>\n\t\t\t\t\t\t\t</BlockControls>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t : \n\t\t\t\t\t null\n\t\t\t }\n\t\t\t { props.attributes.soStep == finalStep\n\t\t\t \t? \n\t\t\t \t\t<div>\n\t\t\t\t \t\t<div class=\"soClickHandle\"></div>\n\t\t\t\t \t\t<ServerSideRender \n\t\t\t\t\t \t\tblock='squareoffs/blocks'\n\t \t\t\t\t attributes={ {\n\t \t\t\t\t \tsoID:props.attributes.soID,\n\t \t\t\t\t \tsoSize:props.attributes.soSize,\n\t \t\t\t\t \tsoAlignment:props.attributes.soAlignment\n\t \t\t\t\t } }\n \t\t\t\t \t/>\n\t\t\t\t \t</div>\n\t\t\t\t : \n\t\t\t\t\t<div class={'components-placeholder soCont'+props.attributes.soStep}>\n\t\t\t\t \t<img class=\"squareOffsLogo\" src=\"https://squareoffs.com/assets/Logo-343c6a748ac336ca96afdf9d72fdeb3d70f1478434f3566ae459fd1707da8d18.svg\" />\n\t\t\t\t \t{ props.attributes.soStep == 0 ?\n\t\t\t\t\t \t<div class=\"soStep soStep0\">\n\t\t\t\t\t \t\t<Button isPrimary onClick={updateSOStep}>Create new SquareOff</Button>\n\t\t\t\t\t \t\t<Button isSecondary onClick={sOStepExisting}>Insert Existing SquareOff</Button>\n\t\t\t\t\t \t</div>\n\t\t\t\t\t \t: null\n\t\t\t\t\t }\n\t\t\t\t\t { props.attributes.soStep == 10 ?\n\t\t\t\t\t \t<div class=\"soStep soStep10\">\n\t\t\t\t\t \t\t<h2>Insert Existing SquareOff</h2>\n\t\t\t\t\t \t\t<p><input onChange={soUpdateSOID} type=\"text\" defaultValue={props.attributes.soID} placeholder=\"SquareOff ID\"></input></p>\n\t\t\t\t\t \t\t<p><Button isPrimary onClick={injectSOShortcode}>Embed</Button>\n\t\t\t\t\t \t\t<Button isSecondary onClick={sOStepCancel}>Cancel</Button></p>\n\t\t\t\t\t \t</div>\n\t\t\t\t\t \t: null\n\t\t\t\t\t }\n\t\t\t\t\t { props.attributes.soStep == 1 ?\n\t\t\t\t\t \t<div class=\"soStep soStep1\">\n\t\t\t\t\t \t\t{ !props.attributes.cover_photo_raw ?<p class=\"soCoverPhoto\"><img src={window.soVars.soURL + 'assets/16x9.png'}/></p> :null }\n\t\t\t\t\t\t\t\t{ props.attributes.cover_photo_raw && props.attributes.cover_photo_mime ?\n\t\t\t\t\t\t\t\t\t<Cropper\n\t\t\t\t\t\t\t\t\tref={cropperRef}\n\t\t\t\t\t\t\t\t\tsrc={ props.attributes.cover_photo_raw }\n\t\t\t\t\t\t\t\t\tstyle={{height: 'auto', width: '100%'}}\n\t\t\t\t\t\t\t\t\t// Cropper.js options\n\t\t\t\t\t\t\t\t\taspectRatio={16 / 9}\n\t\t\t\t\t\t\t\t\tguides={true}\n\t\t\t\t\t\t\t\t\tviewMode={1}\n\t\t\t\t\t\t\t\t\tcrop={_crop}\n\t\t\t\t\t\t\t\t\t/>\t\n\t\t\t\t\t\t\t\t: null }\t\t\t \t\t\n\n\t\t\t\t\t \t\t<MediaUploadCheck>\n\t\t\t \t\t\t\t\t<MediaUpload\n\t\t\t \t\t\t\t\t\tonSelect={ ( media ) => {props.setAttributes({cover_photo_mime:media.mime}); props.setAttributes({cover_photo_raw:media.url});}}\n\t\t\t \t\t\t\t\t\tallowedTypes='image'\n\t\t\t \t\t\t\t\t\tvalue={ props.attributes.coverPhotoMediaID }\n\t\t\t \t\t\t\t\t\trender={ ( { open } ) => (\n\t\t\t \t\t\t\t\t\t\t<Button isPrimary onClick={ open }>\n\t\t\t \t\t\t\t\t\t\t\tAdd a Cover Photo (max. 5Mb)\n\t\t\t \t\t\t\t\t\t\t</Button>\n\t\t\t \t\t\t\t\t\t) }\n\t\t\t \t\t\t\t\t/>\n\t\t\t \t\t\t\t</MediaUploadCheck>\n\t\t\t \t\t\t\t<p> </p>\n\t\t\t\t\t \t\t<label>What is your question? *</label>\n\t\t\t\t\t \t\t<p><textarea type=\"text\" class={props.attributes.showRequired == 1 && !props.attributes.question ?'required':''} value={props.attributes.question} onChange={ ( event ) => props.setAttributes({question:event.target.value}) } maxLength=\"100\"></textarea></p>\n\t\t\t\t\t \t\t<label>Side 1 Answer *</label>\n\t\t\t\t\t \t\t<p><textarea type=\"text\" class={props.attributes.showRequired == 1 && !props.attributes.side_1_title ?'required':''} value={ props.attributes.side_1_title} onChange={ ( event ) => props.setAttributes({side_1_title:event.target.value}) } maxLength=\"20\"></textarea></p>\n\t\t\t\t\t \t\t<label>Side 2 Answer *</label>\n\t\t\t\t\t \t\t<p><textarea type=\"text\" class={props.attributes.showRequired == 1 && !props.attributes.side_2_title ?'required':''} value={ props.attributes.side_2_title} onChange={ ( event ) => props.setAttributes({side_2_title:event.target.value}) } maxLength=\"20\"></textarea></p>\n\t\t\t\t\t \t</div>\n\t\t\t\t\t \t: null\n\t\t\t\t\t }\n\t\t\t\t\t { props.attributes.soStep == 2 ?\n\t\t\t\t\t \t<div class=\"soStep soStep3\">\n\t\t\t\t\t \t\t<h2>Add a defense for each side (optional)</h2>\n\t\t\t\t\t \t\t<label>Side 1</label>\n\t\t\t\t\t \t\t<p><textarea type=\"text\" value={ props.attributes.side_1_defense } onChange={(event) =>{props.setAttributes({side_1_defense:event.target.value})}} placeholder=\"Add more info, stats, or links to defend this side (optinal).\" maxLength=\"600\"></textarea></p>\n\t\t\t\t\t \t\t{props.attributes.side_1_photo ? <p class=\"soPhoto\"><i class=\"removePhoto\" onClick={(event) => {props.setAttributes({side_1_photo:null});}}>x</i><img src={props.attributes.side_1_photo}/></p>:null}\n\n\t\t\t\t\t \t\t<MediaUploadCheck>\n\t\t\t \t\t\t\t\t<MediaUpload\n\t\t\t \t\t\t\t\t\tonSelect={ ( media ) => props.setAttributes({side_1_photo:media.url}) }\n\t\t\t \t\t\t\t\t\tallowedTypes='image'\n\t\t\t \t\t\t\t\t\tvalue={ props.attributes.side1MediaID }\n\t\t\t \t\t\t\t\t\trender={ ( { open } ) => (\n\t\t\t \t\t\t\t\t\t\t<Button isSecondary onClick={ open }>\n\t\t\t \t\t\t\t\t\t\t\tAdd a photo for side 1 (max. 5Mb)\n\t\t\t \t\t\t\t\t\t\t</Button>\n\t\t\t \t\t\t\t\t\t) }\n\t\t\t \t\t\t\t\t/>\n\t\t\t \t\t\t\t</MediaUploadCheck>\n\t\t\t \t\t\t\t<p><br/></p>\n\t\t\t \t\t\t\t<label>Side 2</label>\n\t\t\t\t\t \t\t<p><textarea type=\"text\" value={ props.attributes.side_2_defense } onChange={(event) =>{props.setAttributes({side_2_defense:event.target.value})}} placeholder=\"Add more info, stats, or links to defend this side (optinal).\" maxLength=\"600\"></textarea></p>\n\t\t\t\t\t \t\t{props.attributes.side_2_photo ? <p class=\"soPhoto\"><i class=\"removePhoto\" onClick={(event) => {props.setAttributes({side_2_photo:null});}}>x</i><img src={props.attributes.side_2_photo}/></p>:null}\n\n\t\t\t\t\t \t\t<MediaUploadCheck>\n\t\t\t \t\t\t\t\t<MediaUpload\n\t\t\t \t\t\t\t\t\tonSelect={ ( media ) => props.setAttributes({side_2_photo:media.url}) }\n\t\t\t \t\t\t\t\t\tallowedTypes='image'\n\t\t\t \t\t\t\t\t\tvalue={ props.attributes.side2MediaID }\n\t\t\t \t\t\t\t\t\trender={ ( { open } ) => (\n\t\t\t \t\t\t\t\t\t\t<Button isSecondary onClick={ open }>\n\t\t\t \t\t\t\t\t\t\t\tAdd a photo for side 2 (max. 5Mb)\n\t\t\t \t\t\t\t\t\t\t</Button>\n\t\t\t \t\t\t\t\t\t) }\n\t\t\t \t\t\t\t\t/>\n\t\t\t \t\t\t\t</MediaUploadCheck>\n\t\t\t\t\t \t</div>\n\t\t\t\t\t \t: null\n\t\t\t\t\t }\n\t\t\t\t\t { props.attributes.soStep == 3 ?\n\t\t\t\t\t \t<div class=\"soStep soStep4\">\n\t\t\t\t\t \t\t<h2>Details</h2>\n\t\t\t\t\t\t \t\n\t\t\t\t\t\t \t<label for=\"socategory\">Category *</label>\n\t\t\t\t\t\t \t<p><select id=\"socategory\" class={props.attributes.showRequired == 3 && !props.attributes.category_uuid ?'required':''} value={props.attributes.category_uuid} onChange={(event) =>{props.setAttributes({category_uuid:event.target.value})}}>\n\t\t\t\t\t\t \t\t<option value=\"\"></option>\n\t\t\t\t\t\t \t\t<option value=\"a6840d90-1f50-4e8a-98d0-c1c1c5134a78\">News</option>\n\t\t\t\t\t\t \t\t<option value=\"6c806976-e20c-4666-9d33-45896567c155\">Sports</option>\n\t\t\t\t\t\t \t\t<option value=\"e5e6883a-6e9c-4b7e-b247-43629ce4a5db\">Life</option>\n\t\t\t\t\t\t \t</select></p>\n\t\t\t\t\t\t \t\n\t\t\t\t\t\t \t<label for=\"soTags\">Tags</label>\n\t\t\t\t\t \t\t<p><textarea type=\"text\" id=\"soTags\" value={props.attributes.tag_list} onChange={(event) =>{props.setAttributes({tag_list:event.target.value})}} placeholder=\"Comma-separated tags\" maxLength=\"100\"></textarea></p>\n\n\t\t\t\t\t\t\t\t<label for=\"endDate\">End Date</label>\n\t\t\t\t\t\t \t\t<p><input type=\"text\" id=\"endDate\" value={ props.attributes.end_date } onFocus={handleEndDateFocus} /></p>\n\t\t\t\t\t\t \t\t{dateTimePickerFocus == true \n\t\t\t\t\t\t \t\t\t? (\n\t\t\t\t\t\t \t\t\t<div class=\"DateTimePicker\">\n\t\t\t\t\t\t\t\t \t\t<DateTimePicker\n\t\t\t\t\t\t\t\t \t\t currentDate={ props.attributes.end_date }\n\t\t\t\t\t\t\t\t \t\t onChange={ ( date ) => props.setAttributes( {end_date: date } ) }\n\t\t\t\t\t\t\t\t \t\t is12Hour={ true }\n\t\t\t\t\t\t\t\t \t\t/>\n\t\t\t\t\t\t\t\t \t\t<Button isPrimary onClick={closeDatePicker}>OK</Button>\n\t\t\t\t\t\t\t \t\t</div>\n\t\t\t\t\t\t\t \t\t)\n\t\t\t\t\t\t\t \t\t:null\n\t\t\t\t\t\t\t \t}\n\n\t\t\t \t\t\t\t<label for=\"soSize\">Size</label>\n\t\t\t \t\t\t\t<div class=\"soRadioSizes\">\n\t\t\t \t\t\t\t\t<div>\n\t\t\t \t\t\t\t\t\t<i class=\"small\" onClick={(event) => {props.setAttributes({soSize:'small'})}}></i>\n\t\t\t \t\t\t\t\t\t<input type=\"radio\" value=\"small\" checked={props.attributes.soSize === 'small'} onChange={(event) =>{props.setAttributes({soSize:event.target.value})}} />\n\t\t\t \t\t\t\t\t</div>\n\t\t\t \t\t\t\t\t<div>\n\t\t\t \t\t\t\t\t\t<i class=\"medium\" onClick={(event) => {props.setAttributes({soSize:'medium'})}}></i>\n\t\t\t \t\t\t\t\t\t<input type=\"radio\" value=\"medium\" checked={props.attributes.soSize === 'medium'} onChange={(event) =>{props.setAttributes({soSize:event.target.value})}} />\n\t\t\t \t\t\t\t\t</div>\n\t\t\t \t\t\t\t\t<div>\n\t\t\t \t\t\t\t\t\t<i class=\"wide\" onClick={(event) => {props.setAttributes({soSize:'wide'})}}></i>\n\t\t\t \t\t\t\t\t\t<input type=\"radio\" value=\"wide\" checked={props.attributes.soSize === 'wide'} onChange={(event) =>{props.setAttributes({soSize:event.target.value})}} />\n\t\t\t \t\t\t\t\t</div>\n\t\t\t \t\t\t\t</div>\n\t\t\t \t\t\t\t<p><i>Small embed does not display the cover photo. By default, the cover photo will be displayed in all other embed sizes, Feeds, and SquareOffs.com.</i></p>\n\t\t\t\t\t \t</div>\n\t\t\t\t\t \t: null\n\t\t\t\t\t }\n\t\t\t\t\t { props.attributes.soStep == fetchStep ?\n\t\t\t\t\t \t<div class=\"soStep soStep5\" id={props.attributes.soStep}>\n\t\t\t\t\t \t\t<p>Please wait while we're creating your SquareOff...</p>\n\t\t\t\t\t \t</div>\n\t\t\t\t\t \t: null\n\t\t\t\t\t }\n\t\t\t\t\t { props.attributes.soStep !== 0 && props.attributes.soStep !== fetchStep && props.attributes.soStep !== finalStep && props.attributes.soStep !=10 ?\n\t\t\t\t\t \t<div class=\"btnControls\">\n\t\t\t\t\t \t\t<Button isPrimary onClick={updateSOStep}>{props.attributes.soStep == fetchStep - 1 ? 'Submit':'Next'}</Button>\n\t\t\t\t\t \t\t{ props.attributes.soStep >1 ? <Button isSecondary onClick={backSOStep}>Back</Button> : null }\n\t\t\t\t\t\t \t<Button isTertiary onClick={sOStepCancel}>Cancel</Button>\n\t\t\t\t\t \t</div>\n\t\t\t\t\t \t: null\n\t\t\t\t\t }\n\t\t\t\t </div>\n\t\t\t }\n\t\t </div>\n\t\t);\n \t}\n} );\n\n// export default Cropper;\n","(function() { module.exports = this[\"regeneratorRuntime\"]; }());","(function() { module.exports = this[\"wp\"][\"blockEditor\"]; }());","(function() { module.exports = this[\"wp\"][\"blocks\"]; }());","(function() { module.exports = this[\"wp\"][\"components\"]; }());","(function() { module.exports = this[\"wp\"][\"compose\"]; }());","(function() { module.exports = this[\"wp\"][\"date\"]; }());","(function() { module.exports = this[\"wp\"][\"element\"]; }());","(function() { module.exports = this[\"wp\"][\"serverSideRender\"]; }());","(function() { module.exports = this[\"React\"]; }());"],"sourceRoot":""} -
squareoffs/trunk/plugin.php
r2332611 r2339847 8 8 * Text Domain: squareoffs 9 9 * Domain Path: /languages 10 * Version: 2. 010 * Version: 2.1 11 11 * 12 12 * @package Squareoffs … … 106 106 'attributes' => [ 107 107 'soID' => [ 108 'type' => ' string',108 'type' => 'integer', 109 109 'default' => 0 110 110 ], -
squareoffs/trunk/readme.txt
r2332620 r2339847 6 6 Tested up to: 5.4.2 7 7 Requires PHP: 5.4 8 Stable tag: 2. 0.08 Stable tag: 2.1.0 9 9 License: GPLv2 or later 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 104 104 == Changelog == 105 105 106 = 2.1 = 107 * Fixes for adding a block in the Gutenberg editor 108 106 109 = 2.0 = 107 110 * Tested with Wordpress 5.4.2
Note: See TracChangeset
for help on using the changeset viewer.