image-process
Advanced tools
Comparing version 3.3.6 to 3.3.7
/*! | ||
* image-process v3.3.6 | ||
* image-process v3.3.7 | ||
* https://github.com/capricorncd/image-process-tools | ||
* Copyright © 2017-present, capricorncd | ||
* Released under the MIT License | ||
* Released on: 2019-02-01 22:55:13 | ||
* Released on: 2019-02-14 00:06:11 | ||
*/ | ||
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var n=e();for(var i in n)("object"==typeof exports?exports:t)[i]=n[i]}}(window,function(){return function(t){var e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(i,r,function(e){return t[e]}.bind(null,r));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=5)}([function(t,e,n){var i=n(1);"string"==typeof i&&(i=[[t.i,i,""]]);var r={hmr:!0,transform:void 0,insertInto:void 0};n(3)(i,r);i.locals&&(t.exports=i.locals)},function(t,e,n){(t.exports=n(2)(!1)).push([t.i,".zx-image-crop-container{position:fixed;top:0;left:0;width:100%;height:100%;background-color:rgba(0,0,0,0.95);}.zx-image-crop-container *{margin:0;padding:0}.zx-image-crop-container .__close{position:absolute;z-index:5;top:0;right:0;width:64px;height:64px;cursor:pointer;transition:all .5s;opacity:.6;-webkit-transform:rotate(45deg);transform:rotate(45deg);}.zx-image-crop-container .__close:before,.zx-image-crop-container .__close:after{content:'';position:absolute;background-color:#fff;border-radius:2px}.zx-image-crop-container .__close:before{top:31px;left:16px;width:32px;height:2px}.zx-image-crop-container .__close:after{top:16px;left:31px;width:2px;height:32px}.zx-image-crop-container .__close:hover{-webkit-transform:rotate(225deg);transform:rotate(225deg);opacity:.8}.zx-image-crop-container .zx-image-crop-wrapper{position:absolute;z-index:2;top:0;left:0;width:100%;height:100%;cursor:move;}.zx-image-crop-container .zx-image-crop-wrapper .crop-line-box{position:absolute;margin:0 auto;border-style:solid;border-color:rgba(0,0,0,0.5);box-sizing:content-box}.zx-image-crop-container .zx-image-target{position:absolute;z-index:1;top:0;left:0;}.zx-image-crop-container .zx-image-target.is-move{transition:-webkit-transform 0s;transition:transform 0s;transition:transform 0s, -webkit-transform 0s}.zx-image-crop-container .zx-crop-btns-wrapper{position:absolute;z-index:3;left:50%;width:100%;text-align:center;-webkit-transform:translateX(-50%);transform:translateX(-50%);}.zx-image-crop-container .zx-crop-btns-wrapper button{display:inline-block;padding:0 20px;height:32px;border-radius:4px;color:#fff;border:0;background-color:#4169e1;cursor:pointer;box-shadow:0 5px 10px rgba(0,0,0,0.5);}.zx-image-crop-container .zx-crop-btns-wrapper button.__submit{margin-left:10px}.zx-image-crop-container .zx-crop-btns-wrapper button.__rotate{margin-right:10px;background-color:#666}",""])},function(t,e){t.exports=function(t){var e=[];return e.toString=function(){return this.map(function(e){var n=function(t,e){var n=t[1]||"",i=t[3];if(!i)return n;if(e&&"function"==typeof btoa){var r=(a=i,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(a))))+" */"),o=i.sources.map(function(t){return"/*# sourceURL="+i.sourceRoot+t+" */"});return[n].concat(o).concat([r]).join("\n")}var a;return[n].join("\n")}(e,t);return e[2]?"@media "+e[2]+"{"+n+"}":n}).join("")},e.i=function(t,n){"string"==typeof t&&(t=[[null,t,""]]);for(var i={},r=0;r<this.length;r++){var o=this[r][0];"number"==typeof o&&(i[o]=!0)}for(r=0;r<t.length;r++){var a=t[r];"number"==typeof a[0]&&i[a[0]]||(n&&!a[2]?a[2]=n:n&&(a[2]="("+a[2]+") and ("+n+")"),e.push(a))}},e}},function(t,e,n){var i,r,o={},a=(i=function(){return window&&document&&document.all&&!window.atob},function(){return void 0===r&&(r=i.apply(this,arguments)),r}),s=function(t){var e={};return function(t,n){if("function"==typeof t)return t();if(void 0===e[t]){var i=function(t,e){return e?e.querySelector(t):document.querySelector(t)}.call(this,t,n);if(window.HTMLIFrameElement&&i instanceof window.HTMLIFrameElement)try{i=i.contentDocument.head}catch(t){i=null}e[t]=i}return e[t]}}(),c=null,l=0,u=[],h=n(4);function d(t,e){for(var n=0;n<t.length;n++){var i=t[n],r=o[i.id];if(r){r.refs++;for(var a=0;a<r.parts.length;a++)r.parts[a](i.parts[a]);for(;a<i.parts.length;a++)r.parts.push(y(i.parts[a],e))}else{var s=[];for(a=0;a<i.parts.length;a++)s.push(y(i.parts[a],e));o[i.id]={id:i.id,refs:1,parts:s}}}}function f(t,e){for(var n=[],i={},r=0;r<t.length;r++){var o=t[r],a=e.base?o[0]+e.base:o[0],s={css:o[1],media:o[2],sourceMap:o[3]};i[a]?i[a].parts.push(s):n.push(i[a]={id:a,parts:[s]})}return n}function p(t,e){var n=s(t.insertInto);if(!n)throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");var i=u[u.length-1];if("top"===t.insertAt)i?i.nextSibling?n.insertBefore(e,i.nextSibling):n.appendChild(e):n.insertBefore(e,n.firstChild),u.push(e);else if("bottom"===t.insertAt)n.appendChild(e);else{if("object"!=typeof t.insertAt||!t.insertAt.before)throw new Error("[Style Loader]\n\n Invalid value for parameter 'insertAt' ('options.insertAt') found.\n Must be 'top', 'bottom', or Object.\n (https://github.com/webpack-contrib/style-loader#insertat)\n");var r=s(t.insertAt.before,n);n.insertBefore(e,r)}}function g(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t);var e=u.indexOf(t);e>=0&&u.splice(e,1)}function v(t){var e=document.createElement("style");if(void 0===t.attrs.type&&(t.attrs.type="text/css"),void 0===t.attrs.nonce){var i=function(){0;return n.nc}();i&&(t.attrs.nonce=i)}return m(e,t.attrs),p(t,e),e}function m(t,e){Object.keys(e).forEach(function(n){t.setAttribute(n,e[n])})}function y(t,e){var n,i,r,o;if(e.transform&&t.css){if(!(o="function"==typeof e.transform?e.transform(t.css):e.transform.default(t.css)))return function(){};t.css=o}if(e.singleton){var a=l++;n=c||(c=v(e)),i=x.bind(null,n,a,!1),r=x.bind(null,n,a,!0)}else t.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=function(t){var e=document.createElement("link");return void 0===t.attrs.type&&(t.attrs.type="text/css"),t.attrs.rel="stylesheet",m(e,t.attrs),p(t,e),e}(e),i=function(t,e,n){var i=n.css,r=n.sourceMap,o=void 0===e.convertToAbsoluteUrls&&r;(e.convertToAbsoluteUrls||o)&&(i=h(i));r&&(i+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(r))))+" */");var a=new Blob([i],{type:"text/css"}),s=t.href;t.href=URL.createObjectURL(a),s&&URL.revokeObjectURL(s)}.bind(null,n,e),r=function(){g(n),n.href&&URL.revokeObjectURL(n.href)}):(n=v(e),i=function(t,e){var n=e.css,i=e.media;i&&t.setAttribute("media",i);if(t.styleSheet)t.styleSheet.cssText=n;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(n))}}.bind(null,n),r=function(){g(n)});return i(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;i(t=e)}else r()}}t.exports=function(t,e){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(e=e||{}).attrs="object"==typeof e.attrs?e.attrs:{},e.singleton||"boolean"==typeof e.singleton||(e.singleton=a()),e.insertInto||(e.insertInto="head"),e.insertAt||(e.insertAt="bottom");var n=f(t,e);return d(n,e),function(t){for(var i=[],r=0;r<n.length;r++){var a=n[r];(s=o[a.id]).refs--,i.push(s)}t&&d(f(t,e),e);for(r=0;r<i.length;r++){var s;if(0===(s=i[r]).refs){for(var c=0;c<s.parts.length;c++)s.parts[c]();delete o[s.id]}}}};var b,w=(b=[],function(t,e){return b[t]=e,b.filter(Boolean).join("\n")});function x(t,e,n,i){var r=n?"":i.css;if(t.styleSheet)t.styleSheet.cssText=w(e,r);else{var o=document.createTextNode(r),a=t.childNodes;a[e]&&t.removeChild(a[e]),a.length?t.insertBefore(o,a[e]):t.appendChild(o)}}},function(t,e){t.exports=function(t){var e="undefined"!=typeof window&&window.location;if(!e)throw new Error("fixUrls requires window.location");if(!t||"string"!=typeof t)return t;var n=e.protocol+"//"+e.host,i=n+e.pathname.replace(/\/[^\/]*$/,"/");return t.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,function(t,e){var r,o=e.trim().replace(/^"(.*)"$/,function(t,e){return e}).replace(/^'(.*)'$/,function(t,e){return e});return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(o)?t:(r=0===o.indexOf("//")?o:0===o.indexOf("/")?n+o:i+o.replace(/^\.\//,""),"url("+JSON.stringify(r)+")")})}},function(t,e,n){"use strict";n.r(e);var i={broadcast:{},on:function(t,e){t&&"string"==typeof t&&e&&"function"==typeof e&&(this.broadcast[t]||(this.broadcast[t]=[]),this.broadcast[t].push(e))},emit:function(t){var e=this.broadcast[t];if(e)for(var n=Array.prototype.slice.call(arguments,1),i=0;i<e.length;i++)try{e[i].apply(null,n)}catch(e){this.emit("error",{code:1,msg:"emit("+t+"): "+e.message,data:e})}},off:function(t){this.broadcast[t]&&(this.broadcast[t]=null,delete this.broadcast[t])}},r="undefined"==typeof document?{body:{},addEventListener:function(){},removeEventListener:function(){},activeElement:{blur:function(){},nodeName:""},querySelector:function(){return null},querySelectorAll:function(){return[]},getElementById:function(){return null},createEvent:function(){return{initEvent:function(){}}},createElement:function(){return{children:[],childNodes:[],style:{},setAttribute:function(){},getElementsByTagName:function(){return[]}}},location:{hash:""}}:document,o="undefined"==typeof window?{document:r,navigator:{userAgent:""},location:{},history:{},CustomEvent:function(){return this},addEventListener:function(){},removeEventListener:function(){},getComputedStyle:function(){return{getPropertyValue:function(){return""}}},Image:function(){},Date:function(){},screen:{},setTimeout:function(){},clearTimeout:function(){}}:window,a="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},s=navigator.userAgent,c={bitToKib:function(t){return t/1024},conversion:function(t){var e=c.bitToKib(t);return e>=1024?c.int(e/1024*100)/100+"M":c.int(e)+"KB"},toBlobData:function(t,e){var n=function(t){var e=t.split(","),n="";/data:(\w+\/\w+);base64/.test(e[0])&&(n=RegExp.$1);return{type:n,data:e[1]}}(t),i=o.atob(n.data);e=e||n.type;for(var r=new Uint8Array(i.length),a=0;a<i.length;a++)r[a]=i.charCodeAt(a);return new Blob([r],{type:e})},toBlobUrl:function(t){return(o.URL||o.webkitURL).createObjectURL(t)},ratio:function(t,e){return t/e},int:function(t){var e=parseInt(t);return isNaN(e)?0:e},slice:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t.length&&t[0]?Array.prototype.slice.call(t,e):[]},strToHump:function(t){return t?t.toString().replace(/-(\w)/g,function(t,e){return e.toUpperCase()}):""},isAndroid:function(){return s.toLowerCase().indexOf("android")>=0},isArray:function(t){return Array.isArray(t)},isObject:function(t){return t&&"object"===(void 0===t?"undefined":a(t))&&!c.isArray(t)},randomStr:function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"zximageprocess")+"_"+ +new Date}};var l=c,u=r,h={createElm:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"div",e=arguments[1],n=u.createElement(t);if(e&&e instanceof Object)for(var i in e)e.hasOwnProperty(i)&&n.setAttribute(i,e[i]);return n},createVdom:function(t){if(!t)return null;if("string"==typeof t)return u.createTextNode(t);var e=t.tag,n=t.attrs,i=t.child;if(!e&&!n&&!i)return null;var r=h.createElm(e||"div",n);if(Array.isArray(i)&&i.length){var o=void 0;i.forEach(function(t){(o=h.createVdom(t))&&r.appendChild(o)})}else i&&"string"==typeof i&&r.appendChild(u.createTextNode(i));return r},createCanvas:function(t,e){var n=this.createElm("canvas",{width:e.dw,height:e.dh});return n.getContext("2d").drawImage(t,e.sx,e.sy,e.sw,e.sh,e.dx,e.dy,e.dw,e.dh),n},getStyle:function(t,e){if(!h.isHTMLElement(t))return null;var n=o.getComputedStyle(t,null),i=null;if(e)try{i=n[l.strToHump(e)]}catch(t){}else i=n;return i},maxZIndex:function(){for(var t=u.getElementsByTagName("*"),e=void 0,n=void 0,i=void 0,r=[],o=0;o<t.length;o++)1===(e=t[o]).nodeType&&"static"!==(n=h.getStyle(e)||{}).position&&(i=l.int(n.zIndex))>0&&r.push(i);return l.int(Math.max.apply(null,r))},isHTMLElement:function(t){return t&&t instanceof HTMLElement},query:function(t){return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:u).querySelector(t)},lock:function(t){void 0===t&&(t=h.query("body")),h.isHTMLElement(t)&&(t.style.overflow="hidden")},unlock:function(t){void 0===t&&(t=h.query("body")),h.isHTMLElement(t)&&(t.style.overflow="")},addEvent:function(t,e,n){var i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(t&&e&&n)if(t.length)for(var r=0;r<t.length;r++)d(t[r],e,n,i);else d(t,e,n,i)},removeEvent:function(t,e,n){var i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(t&&e&&n)if(t.length)for(var r=0;r<t.length;r++)f(t[r],e,n,i);else f(t,e,n,i)}};function d(t,e,n,i){t.addEventListener?t.addEventListener(e,n,i):t.attachEvent?t.attachEvent(e,n):t["on"+e]=n}function f(t,e,n,i){t.removeEventListener?t.removeEventListener(e,n,i):t.detachEvent?t.detachEvent(e,n):t["on"+e]=null}var p=h,g={scaleInfo:function(t,e){var n=l.int(t.width),i=l.int(t.height),r=e.width,o=e.height,a=1;return n>0?(a=l.ratio(r,n),i=Math.floor(n*o/r)):i>0&&(a=l.ratio(o,i),n=Math.floor(i*r/o)),{sw:r,sh:o,scaling:a,dw:n,dh:i}},autoCropInfo:function(t,e,n){var i=l.int(n.width),r=l.int(n.height),o=1,a=0,s=0,c=t,u=e,h=t,d=e;return i>0&&r>0?(c=i,u=r,h=i,d=Math.floor(i*e/t),o=l.ratio(t,i),d>=r?(a=0,s=l.int((d-r)/2*o)):(o=l.ratio(e,r),h=Math.floor(r*t/e),a=l.int((h-i)/2*o),s=0)):i>0?(o=l.ratio(t,i),c=i,u=Math.floor(i*e/t)):r>0&&(o=l.ratio(e,r),c=Math.floor(r*t/e),u=r),{sx:a,sy:s,sw:c*o,sh:u*o,scaling:o,cw:c,ch:u}}},v=o.navigator,m=v.msPointerEnabled,y=v.pointerEnabled,b=!!("ontouchstart"in o||o.DocumentTouch&&document instanceof DocumentTouch),w=["mousedown","mousemove","mouseup"];m&&(w=["MSPointerDown","MSPointerMove","MSPointerUp"]),y&&(w=["pointerdown","pointermove","pointerup"]);var x={start:b?"touchstart":w[0],move:b?"touchmove":w[1],end:b?"touchend":w[2]};function E(t,e){return function(t,e){var n=_(t[0],t[1]);return _(e[0],e[1])/n}(e,(n=t.touches,l.slice(n).map(function(t){return{x:t.pageX,y:t.pageY}})));var n}function _(t,e){var n=t.x-e.x,i=t.y-e.y;return Math.sqrt(n*n+i*i)}var z=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}();var B={width:750,height:750,submitStyle:"",cancelStyle:"",submitText:"确 定",rotateText:"旋转90度"};var k=function(){function t(e){var n=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.cropRatio=1,this.visible=!1,this.$wrapper=null,this.$img=null,this.cropBoxPos={},this.translate={x:0,y:0},this.angle=0,this.options=Object.assign({},B,e),this._init(this.options),p.addEvent(o,"resize",function(t){n.initCropBosPosition()})}return z(t,[{key:"_init",value:function(t){p.addEvent(r,"selectstart",function(t){t.preventDefault()});var e={attrs:{class:"zx-image-crop-container",style:"z-index:"+(p.maxZIndex()+1)+";display:none;"},child:[{attrs:{class:"zx-image-crop-wrapper"},child:[{attrs:{class:"crop-line-box"}}]},{tag:"img",attrs:{class:"zx-image-target"}},{attrs:{class:"zx-crop-btns-wrapper"},child:[{tag:"button",attrs:{class:"__rotate",style:t.cancelStyle},child:t.rotateText},{tag:"button",attrs:{class:"__submit",style:t.submitStyle},child:t.submitText}]},{attrs:{class:"__close"}}]};this.$wrapper=p.createVdom(e),this.$body=p.query("body"),this.$body.appendChild(this.$wrapper),this.$img=p.query(".zx-image-target",this.$wrapper),this._initEvent(this.$img),this.initCropBosPosition()}},{key:"initCropBosPosition",value:function(t){t&&(this.options=Object.assign({},this.options,t));var e=this.options,n=o.innerWidth,i=o.innerHeight,r=Math.min(e.width,.8*n),a=e.height/e.width*r;a>.8*i&&(a=.8*i,r=e.width/e.height*a);var s=(i-a)/2,c=(n-r)/2,l=Math.max(s,c);this.cropRatio=e.width/r,this.cropBoxPos={winWidth:n,winHeight:i,width:r,height:a,borderWidth:l,top:s,left:c,bottom:s+a,right:c+r};var u=p.query(".crop-line-box",this.$wrapper);u.style.top=s-l+"px",u.style.left=c-l+"px",u.style.width=r+"px",u.style.height=a+"px",u.style.borderWidth=l+"px",p.query(".zx-crop-btns-wrapper",this.$wrapper).style.top=this.cropBoxPos.bottom+20+"px"}},{key:"_initEvent",value:function(){var t,e,n=this,o=void 0;o=m?r:p.query(".zx-image-crop-wrapper",this.$wrapper),this._move(o),t=o,e=function(t){var e=!!(n.angle%180),i=t.wheelDelta||-t.detail;n._scale(i,e)},p.addEvent(t,"mousewheel",e),p.addEvent(t,"DOMMouseScroll",e);var a=p.query(".__submit",this.$wrapper);p.addEvent(a,"click",function(t){n._submit()});var s=p.query(".__rotate",this.$wrapper);p.addEvent(s,"click",function(t){n._rotate()});var c=p.query(".__close",this.$wrapper);p.addEvent(c,"click",function(t){i.emit("crop-cancel"),n.hide()})}},{key:"_move",value:function(t){var e=this,n=this.$img,i=!1,o=!1,a={},s=0,c=[],u=!1;p.addEvent(t,x.start,function(t){var r,h;if(n.className="zx-image-target is-move",i=!0,o="touchstart"===t.type,u=!!(e.angle%180),o&&(s=t.touches.length),s>1&&(r=t,h=n.getBoundingClientRect(),c=l.slice(r.touches).map(function(t){return{x:t.pageX-h.left,y:t.pageY-h.top}})),!o&&"which"in t&&3===t.which)i=!1;else if(!o||1===t.targetTouches.length){o||l.isAndroid()||(t.preventDefault?t.preventDefault():t.returnValue=!1);var d=o?t.targetTouches[0].pageX:t.pageX||t.clientX,f=o?t.targetTouches[0].pageY:t.pageY||t.clientY,p=n.getBoundingClientRect(),g=e.translate;a={pageX:d,pageY:f,x:d-g.x,y:f-g.y,left:p.left,top:p.top}}}),p.addEvent(r,x.move,function(t){if(i)if(o||l.isAndroid()||(t.preventDefault?t.preventDefault():t.returnValue=!1),s>1){var n=E(t,c);e._scaleHandler(n>1,.02,u)}else e._handleMove(t,a,o,u)}),p.addEvent(r,x.end,function(t){n.className="zx-image-target",i=!1,o&&(s=t.touches.length)})}},{key:"_handleMove",value:function(t,e,n,i){var r=n?t.targetTouches[0].pageX:t.pageX||t.clientX,o=n?t.targetTouches[0].pageY:t.pageY||t.clientY,a={x:r-e.x,y:o-e.y};this._moveBoundary(a,i)}},{key:"_moveBoundary",value:function(t,e){var n=t.x,i=t.y,r=this.cropBoxPos,o=this.$img,a=o.getBoundingClientRect();if(e){var s=(r.winWidth+a.width-a.height-r.width)/2;s<=n&&(n=s);var c=(r.winHeight+a.height-a.width-r.height)/2;c<=i&&(i=c);var l=s+r.width-a.width;n<=l&&(n=l);var u=c+r.height-a.height;i<=u&&(i=u)}else n>r.left&&(n=r.left),n<=r.right-a.width&&(n=r.right-a.width),i>r.top&&(i=r.top),i<=r.bottom-a.height&&(i=r.bottom-a.height);this.translate.x=n,this.translate.y=i,o.style.transform="translateX("+this.translate.x+"px) translateY("+this.translate.y+"px) rotate("+this.angle+"deg)"}},{key:"_scale",value:function(t,e){this._scaleHandler(t>0,.1,e)}},{key:"_rotate",value:function(){var t=this.$img;this.angle+=90;var e=t.getBoundingClientRect(),n=!!(this.angle%180),i=this.cropBoxPos,r=e.height,o=e.width,a=void 0,s=void 0,c=void 0,l=void 0;if(n?(r<i.width&&(a=o*(s=i.width)/r),o<i.height&&(s=r*(a=i.height)/o),c=e.width,l=e.height):(r<i.width&&(s=o*(a=i.width)/r),o<i.height&&(s=r*(a=i.height)/o),c=e.height,l=e.width),a&&s){t.style.width=a+"px",t.style.height=s+"px";var u=c-a,h=l-s,d=this.translate;this.translate={x:d.x+u/2,y:d.y+h/2}}t.style.transform="translate("+this.translate.x+"px, "+this.translate.y+"px) rotate("+this.angle+"deg)"}},{key:"_scaleHandler",value:function(t,e,n){var i=this.$img,r=i.naturalWidth,o=i.width,a=i.height,s=this.cropBoxPos,c=void 0,l=void 0;if(t){if(l=(c=o*(1+e))*a/o,c>=3*r)return}else if(n){if(o<=s.height||a<=s.width)return void this._moveBoundary(this.translate,!0);l=(c=o*(1-e))*a/o,c<=s.height&&(l=(c=s.height)*a/o),l<=s.width&&(c=(l=s.width)*o/a)}else{if(o<=s.width||a<=s.height)return void this._moveBoundary(this.translate,!1);l=(c=o*(1-e))*a/o,c<=s.width&&(l=(c=s.width)*a/o),l<=s.height&&(c=(l=s.height)*o/a)}n?this._scaleByRotate(o,a,c,l):this._scaleByNotRotate(o,a,c,l)}},{key:"_scaleByRotate",value:function(t,e,n,i){var r=this.$img,o=t-n,a=e-i,s=this.translate;this.translate={x:s.x+o/2,y:s.y+a/2},r.style.width=n+"px",r.style.height=i+"px",this._moveBoundary(this.translate,!0)}},{key:"_scaleByNotRotate",value:function(t,e,n,i){var r=this.$img,o=t-n,a=e-i,s=this.translate;this.translate={x:s.x+o/2,y:s.y+a/2},r.style.width=n+"px",r.style.height=i+"px",this._moveBoundary(this.translate,!1)}},{key:"setImageSrc",value:function(t){if(this.$img&&t){if(this.show(),this.$img.src!==t){p.removeEvent(this.$img,"load",r),this.$img.setAttribute("style",""),this.angle=0,this.$img.src=t,p.addEvent(this.$img,"load",r);var e=this,n=e.cropBoxPos}}else i.emit("error",{code:21,message:"Failed to setImageSrc(url)"});function r(){var t=e.$img,i=n.winWidth/n.winHeight,r=t.naturalWidth,o=t.naturalHeight,a=r/o,s=void 0,c=void 0;a>i&&r>n.winWidth?c=o*(s=n.winWidth)/r:a<i&&o>n.winHeight?s=r*(c=n.winHeight)/o:(s=r,c=o);var l=n.width/n.height;a>l&&o<n.height?s=r*(c=n.height)/o:a<l&&r<n.width&&(c=o*(s=n.width)/r),t.style.width=s+"px",t.style.height=c+"px";var u=(n.winWidth-s)/2,h=(n.winHeight-c)/2;t.style.transform="translate("+u+"px, "+h+"px) rotate(0)",e.translate={x:u,y:h}}}},{key:"_submit",value:function(){var t=this.$img,e=this.options,n=this.cropRatio,r=this.cropBoxPos,o=t.getBoundingClientRect(),a=this.angle%360,s=a%180,c={angle:a,naturalWidth:s?t.naturalHeight:t.naturalWidth,naturalHeight:s?t.naturalWidth:t.naturalHeight,currentWidth:l.int(o.width*n),currentHeight:l.int(o.height*n),targetWidth:e.width,targetHeight:e.height,x:l.int((r.left-o.left)*n),y:l.int((r.top-o.top)*n)};i.emit("crop-submit",c),this.hide()}},{key:"show",value:function(){this.visible||(this.visible=!0,this.$wrapper.style.display="",p.lock(this.$body))}},{key:"hide",value:function(){this.visible&&(this.visible=!1,this.$wrapper.style.display="none",p.unlock(this.$body))}}]),t}(),S=null;function C(t,e,n,o){i.on("crop-cancel",function(t){o({code:22,message:"Clipping is cancelled"}),i.off("crop-submit"),i.off("crop-cancel")}),i.on("crop-submit",function(e){!function(t,e,n){var i=void 0;e.angle>0&&(i=function(t,e){var n=r.createElement("canvas"),i=n.getContext("2d"),o=t.width,a=t.height;switch(n.width=o,n.height=a,e){case 90:n.width=a,n.height=o,i.rotate(Math.PI/2),i.drawImage(t,0,-a,o,a);break;case 180:i.rotate(Math.PI),i.drawImage(t,-o,-a,o,a);break;case 270:n.width=a,n.height=o,i.rotate(3*Math.PI/2),i.drawImage(t,-o,0,o,a);break;default:i.drawImage(t,0,0,o,a)}return n}(t.element,e.angle),t.width=e.naturalWidth,t.height=e.naturalHeight,t.element=i);i=function(t,e){var n=g.scaleInfo(e,t),i=t.element,r=void 0,o=n.sw,a=n.sh;if(n.scaling>2){r=n.scaling;do{i=p.createCanvas(i,{dx:0,dy:0,dw:n.dw*r,dh:n.dh*r,sx:0,sy:0,sw:o,sh:a}),o=n.dw*r,a=n.dh*r,r-=1}while(r>2)}return i=p.createCanvas(i,{dx:0,dy:0,dw:n.dw,dh:n.dh,sx:0,sy:0,sw:o,sh:a})}(t,{width:e.currentWidth});var o=p.createCanvas(i,{sx:e.x,sy:e.y,sw:e.targetWidth,sh:e.targetHeight,dx:0,dy:0,dw:e.targetWidth,dh:e.targetHeight}),a=t.type,s=o.toDataURL(a),c=l.toBlobData(s,a);n&&n({element:o,type:a,width:o.width,height:o.height,blob:c,data:c,url:l.toBlobUrl(c),base64:s,size:c.size,raw:t})}(t,e,n),i.off("crop-submit"),i.off("crop-cancel")}),null===S?S=new k(e):S.initCropBosPosition(e),S.setImageSrc(t.base64)}function M(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(function(n,i){/^data:(.+?);base64/.test(t)?T(t,e,n,i):function(t){var e=new FileReader;return e.readAsDataURL(t),new Promise(function(t,n){e.onload=function(){t(this.result)},e.onerror=function(t){n(t)}})}(t).then(function(t){T(t,e,n,i)}).catch(function(t){i(t)})})}function T(t,e,n,i){var o,a,s=/^data:(.+?);base64/.test(t)?RegExp.$1:"image/jpeg",c=l.toBlobData(t,s),u=(o=t,(a=r.createElement("img")).src=o,a);u.onload=function(){var r={element:u,base64:t,width:u.naturalWidth||u.width,height:u.naturalHeight||u.height,type:c.type,size:c.size},o=e.width>0&&e.height>0;e.auto||!o?function(t,e,n){var i=void 0,r=void 0,o=void 0,a=void 0,s=void 0,c=void 0,u=void 0;if(i=g.autoCropInfo(t.width,t.height,e),r=t.element,o=2,a=i.sw,s=i.sh,c=i.sx,u=i.sy,i.scaling>o){o=i.scaling;do{r=$(r,{cw:i.cw*o,ch:i.ch*o,sx:c,sy:u,sw:a,sh:s}),a=r.width,s=r.height,c=u=0,o-=1}while(o>2)}var h=(r=$(r,{cw:i.cw,ch:i.ch,sx:c,sy:u,sw:a,sh:s})).toDataURL(t.type),d=l.toBlobData(h,t.type);n({element:r,type:d.type,width:i.cw,height:i.ch,blob:d,url:l.toBlobUrl(d),base64:h,size:d.size,raw:t})}(r,e,n):C(r,e,n,i)},u.onerror=function(t){i(t)}}function $(t,e){var n=r.createElement("canvas");return n.width=e.cw,n.height=e.ch,n.getContext("2d").drawImage(t,e.sx,e.sy,e.sw,e.sh,0,0,n.width,n.height),n}function L(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=function(t){var e=r.createElement("video");return e.src=t,e.autoplay=!0,e}(l.toBlobUrl(t));return new Promise(function(i,o){n.onerror=function(t){o(t),n=null},n.oncanplay=function(){var a={videoFile:t,videoWidth:n.videoWidth,videoHeight:n.videoHeight,duration:n.duration},s=function(t){arguments.length>1&&void 0!==arguments[1]&&arguments[1];t.pause();var e=r.createElement("canvas"),n=e.getContext("2d");e.width=t.videoWidth,e.height=t.videoHeight,n.drawImage(t,0,0,e.width,e.height);var i=null,o=null;try{i=e.toDataURL("image/jpeg")}catch(t){o={code:13,message:"截图失败,视频文件所在域与后台系统不同!",data:t}}return{base64:i,err:o}}(n),c=s.base64,l=s.err;if(l)return o(l),void(n=null);M(c,e).then(function(t){i(Object.assign({},a,t))}).catch(function(t){o(t)}),n=null}})}function R(t,e){return new Promise(function(n,i){var r=t.type;/^(image|video)/.test(r)?function(t,e,n,i,r){var o=l.bitToKib(t.size),a=1024*l.int(n.maxSize);if(a&&a<o)return void r({code:12,message:"The file is too large, exceeding the maximum limit of "+n.maxSize+"M."});switch(e){case"image":M(t,n).then(i).catch(r);break;case"video":L(t,n).then(i).catch(r)}}(t,RegExp.$1,e,n,i):i({code:7,message:"Incorrect file type"})})}n(0);n.d(e,"ZxImageProcess",function(){return A}),n.d(e,"handleMediaFile",function(){return R});var j=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}();var U={accept:"",auto:!1,width:0,height:0,selector:null,maxSize:50,error:function(){},success:function(){}},I={},A=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t);var n=Object.assign({},U,e);i.on("error",function(t){t.msg=t.message,n.error(t)}),i.on("success",function(t){n.success(t)}),this._init(n)}return j(t,[{key:"_init",value:function(t){t.selector&&("string"==typeof t.selector||p.isHTMLElement(t.selector))?(this.options=t,this.id=l.randomStr(),this.$body=p.query("body"),null!==this.$body?function(t,e){var n=e.selector,r=p.isHTMLElement(n)?n:p.query(n);if(null!==r){var o=p.createElm("input",{style:"display:none;",type:"file",accept:e.accept});t.$body.appendChild(o),p.addEvent(o,"click",function(t){o.value=""}),p.addEvent(o,"change",function(n){var r=o.files||[];if(0===r.length)i.emit("error",{code:4,message:"Any file is not selected!"});else{var a=r[0];t.file=a,R(a,e).then(function(t){i.emit("success",t)}).catch(function(t){i.emit("error",t)})}}),p.addEvent(r,"click",function(t){o.click()})}else i.emit("error",{code:3,message:"Element "+n+" is not found in document!"})}(this,t):i.emit("error",{code:2,message:"Failed to initialize, Element body is not found in document!"})):i.emit("error",{code:1,message:'The selector "'+t.selector+'" is not valid in initialization parameter.'})}},{key:"reCrop",value:function(){this.file?I.show():i.emit("error",{code:5,message:"请先选择图片文件"})}}]),t}();A.prototype.toBlobData=l.toBlobData,A.prototype.toBlobUrl=l.toBlobUrl,A.prototype.conversion=l.conversion,A.prototype.handleMediaFile=R}])}); | ||
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var n=e();for(var i in n)("object"==typeof exports?exports:t)[i]=n[i]}}(window,function(){return function(t){var e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(i,r,function(e){return t[e]}.bind(null,r));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=5)}([function(t,e,n){var i=n(1);"string"==typeof i&&(i=[[t.i,i,""]]);var r={hmr:!0,transform:void 0,insertInto:void 0};n(3)(i,r);i.locals&&(t.exports=i.locals)},function(t,e,n){(t.exports=n(2)(!1)).push([t.i,".zx-image-crop-container{position:fixed;top:0;left:0;width:100%;height:100%;background-color:rgba(0,0,0,0.95);}.zx-image-crop-container *{margin:0;padding:0}.zx-image-crop-container .__close{position:absolute;z-index:5;top:0;right:0;width:64px;height:64px;cursor:pointer;transition:all .5s;opacity:.6;-webkit-transform:rotate(45deg);transform:rotate(45deg);}.zx-image-crop-container .__close:before,.zx-image-crop-container .__close:after{content:'';position:absolute;background-color:#fff;border-radius:2px}.zx-image-crop-container .__close:before{top:31px;left:16px;width:32px;height:2px}.zx-image-crop-container .__close:after{top:16px;left:31px;width:2px;height:32px}.zx-image-crop-container .__close:hover{-webkit-transform:rotate(225deg);transform:rotate(225deg);opacity:.8}.zx-image-crop-container .zx-image-crop-wrapper{position:absolute;z-index:2;top:0;left:0;width:100%;height:100%;cursor:move;}.zx-image-crop-container .zx-image-crop-wrapper .crop-line-box{position:absolute;margin:0 auto;border-style:solid;border-color:rgba(0,0,0,0.5);box-sizing:content-box}.zx-image-crop-container .zx-image-target{position:absolute;z-index:1;top:0;left:0;}.zx-image-crop-container .zx-image-target.is-move{transition:-webkit-transform 0s;transition:transform 0s;transition:transform 0s, -webkit-transform 0s}.zx-image-crop-container .zx-crop-btns-wrapper{position:absolute;z-index:3;left:50%;width:100%;text-align:center;-webkit-transform:translateX(-50%);transform:translateX(-50%);}.zx-image-crop-container .zx-crop-btns-wrapper button{display:inline-block;padding:0 20px;height:32px;border-radius:4px;color:#fff;border:0;background-color:#4169e1;cursor:pointer;box-shadow:0 5px 10px rgba(0,0,0,0.5);}.zx-image-crop-container .zx-crop-btns-wrapper button.__submit{margin-left:10px}.zx-image-crop-container .zx-crop-btns-wrapper button.__rotate{margin-right:10px;background-color:#666}",""])},function(t,e){t.exports=function(t){var e=[];return e.toString=function(){return this.map(function(e){var n=function(t,e){var n=t[1]||"",i=t[3];if(!i)return n;if(e&&"function"==typeof btoa){var r=(a=i,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(a))))+" */"),o=i.sources.map(function(t){return"/*# sourceURL="+i.sourceRoot+t+" */"});return[n].concat(o).concat([r]).join("\n")}var a;return[n].join("\n")}(e,t);return e[2]?"@media "+e[2]+"{"+n+"}":n}).join("")},e.i=function(t,n){"string"==typeof t&&(t=[[null,t,""]]);for(var i={},r=0;r<this.length;r++){var o=this[r][0];"number"==typeof o&&(i[o]=!0)}for(r=0;r<t.length;r++){var a=t[r];"number"==typeof a[0]&&i[a[0]]||(n&&!a[2]?a[2]=n:n&&(a[2]="("+a[2]+") and ("+n+")"),e.push(a))}},e}},function(t,e,n){var i,r,o={},a=(i=function(){return window&&document&&document.all&&!window.atob},function(){return void 0===r&&(r=i.apply(this,arguments)),r}),s=function(t){var e={};return function(t,n){if("function"==typeof t)return t();if(void 0===e[t]){var i=function(t,e){return e?e.querySelector(t):document.querySelector(t)}.call(this,t,n);if(window.HTMLIFrameElement&&i instanceof window.HTMLIFrameElement)try{i=i.contentDocument.head}catch(t){i=null}e[t]=i}return e[t]}}(),c=null,l=0,u=[],h=n(4);function d(t,e){for(var n=0;n<t.length;n++){var i=t[n],r=o[i.id];if(r){r.refs++;for(var a=0;a<r.parts.length;a++)r.parts[a](i.parts[a]);for(;a<i.parts.length;a++)r.parts.push(y(i.parts[a],e))}else{var s=[];for(a=0;a<i.parts.length;a++)s.push(y(i.parts[a],e));o[i.id]={id:i.id,refs:1,parts:s}}}}function f(t,e){for(var n=[],i={},r=0;r<t.length;r++){var o=t[r],a=e.base?o[0]+e.base:o[0],s={css:o[1],media:o[2],sourceMap:o[3]};i[a]?i[a].parts.push(s):n.push(i[a]={id:a,parts:[s]})}return n}function p(t,e){var n=s(t.insertInto);if(!n)throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");var i=u[u.length-1];if("top"===t.insertAt)i?i.nextSibling?n.insertBefore(e,i.nextSibling):n.appendChild(e):n.insertBefore(e,n.firstChild),u.push(e);else if("bottom"===t.insertAt)n.appendChild(e);else{if("object"!=typeof t.insertAt||!t.insertAt.before)throw new Error("[Style Loader]\n\n Invalid value for parameter 'insertAt' ('options.insertAt') found.\n Must be 'top', 'bottom', or Object.\n (https://github.com/webpack-contrib/style-loader#insertat)\n");var r=s(t.insertAt.before,n);n.insertBefore(e,r)}}function g(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t);var e=u.indexOf(t);e>=0&&u.splice(e,1)}function v(t){var e=document.createElement("style");if(void 0===t.attrs.type&&(t.attrs.type="text/css"),void 0===t.attrs.nonce){var i=function(){0;return n.nc}();i&&(t.attrs.nonce=i)}return m(e,t.attrs),p(t,e),e}function m(t,e){Object.keys(e).forEach(function(n){t.setAttribute(n,e[n])})}function y(t,e){var n,i,r,o;if(e.transform&&t.css){if(!(o="function"==typeof e.transform?e.transform(t.css):e.transform.default(t.css)))return function(){};t.css=o}if(e.singleton){var a=l++;n=c||(c=v(e)),i=x.bind(null,n,a,!1),r=x.bind(null,n,a,!0)}else t.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=function(t){var e=document.createElement("link");return void 0===t.attrs.type&&(t.attrs.type="text/css"),t.attrs.rel="stylesheet",m(e,t.attrs),p(t,e),e}(e),i=function(t,e,n){var i=n.css,r=n.sourceMap,o=void 0===e.convertToAbsoluteUrls&&r;(e.convertToAbsoluteUrls||o)&&(i=h(i));r&&(i+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(r))))+" */");var a=new Blob([i],{type:"text/css"}),s=t.href;t.href=URL.createObjectURL(a),s&&URL.revokeObjectURL(s)}.bind(null,n,e),r=function(){g(n),n.href&&URL.revokeObjectURL(n.href)}):(n=v(e),i=function(t,e){var n=e.css,i=e.media;i&&t.setAttribute("media",i);if(t.styleSheet)t.styleSheet.cssText=n;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(n))}}.bind(null,n),r=function(){g(n)});return i(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;i(t=e)}else r()}}t.exports=function(t,e){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(e=e||{}).attrs="object"==typeof e.attrs?e.attrs:{},e.singleton||"boolean"==typeof e.singleton||(e.singleton=a()),e.insertInto||(e.insertInto="head"),e.insertAt||(e.insertAt="bottom");var n=f(t,e);return d(n,e),function(t){for(var i=[],r=0;r<n.length;r++){var a=n[r];(s=o[a.id]).refs--,i.push(s)}t&&d(f(t,e),e);for(r=0;r<i.length;r++){var s;if(0===(s=i[r]).refs){for(var c=0;c<s.parts.length;c++)s.parts[c]();delete o[s.id]}}}};var b,w=(b=[],function(t,e){return b[t]=e,b.filter(Boolean).join("\n")});function x(t,e,n,i){var r=n?"":i.css;if(t.styleSheet)t.styleSheet.cssText=w(e,r);else{var o=document.createTextNode(r),a=t.childNodes;a[e]&&t.removeChild(a[e]),a.length?t.insertBefore(o,a[e]):t.appendChild(o)}}},function(t,e){t.exports=function(t){var e="undefined"!=typeof window&&window.location;if(!e)throw new Error("fixUrls requires window.location");if(!t||"string"!=typeof t)return t;var n=e.protocol+"//"+e.host,i=n+e.pathname.replace(/\/[^\/]*$/,"/");return t.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,function(t,e){var r,o=e.trim().replace(/^"(.*)"$/,function(t,e){return e}).replace(/^'(.*)'$/,function(t,e){return e});return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(o)?t:(r=0===o.indexOf("//")?o:0===o.indexOf("/")?n+o:i+o.replace(/^\.\//,""),"url("+JSON.stringify(r)+")")})}},function(t,e,n){"use strict";n.r(e);var i={broadcast:{},on:function(t,e){t&&"string"==typeof t&&e&&"function"==typeof e&&(this.broadcast[t]||(this.broadcast[t]=[]),this.broadcast[t].push(e))},emit:function(t){var e=this.broadcast[t];if(e)for(var n=Array.prototype.slice.call(arguments,1),i=0;i<e.length;i++)try{e[i].apply(null,n)}catch(e){this.emit("error",{code:1,msg:"emit("+t+"): "+e.message,data:e})}},off:function(t){this.broadcast[t]&&(this.broadcast[t]=null,delete this.broadcast[t])}},r="undefined"==typeof document?{body:{},addEventListener:function(){},removeEventListener:function(){},activeElement:{blur:function(){},nodeName:""},querySelector:function(){return null},querySelectorAll:function(){return[]},getElementById:function(){return null},createEvent:function(){return{initEvent:function(){}}},createElement:function(){return{children:[],childNodes:[],style:{},setAttribute:function(){},getElementsByTagName:function(){return[]}}},location:{hash:""}}:document,o="undefined"==typeof window?{document:r,navigator:{userAgent:""},location:{},history:{},CustomEvent:function(){return this},addEventListener:function(){},removeEventListener:function(){},getComputedStyle:function(){return{getPropertyValue:function(){return""}}},Image:function(){},Date:function(){},screen:{},setTimeout:function(){},clearTimeout:function(){}}:window,a="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},s=navigator.userAgent,c={bitToKib:function(t){return t/1024},conversion:function(t){var e=c.bitToKib(t);return e>=1024?c.int(e/1024*100)/100+"M":c.int(e)+"KB"},toBlobData:function(t,e){var n=function(t){var e=t.split(","),n="";/data:(\w+\/\w+);base64/.test(e[0])&&(n=RegExp.$1);return{type:n,data:e[1]}}(t),i=o.atob(n.data);e=e||n.type;for(var r=new Uint8Array(i.length),a=0;a<i.length;a++)r[a]=i.charCodeAt(a);return new Blob([r],{type:e})},toBlobUrl:function(t){return(o.URL||o.webkitURL).createObjectURL(t)},ratio:function(t,e){return t/e},int:function(t){var e=parseInt(t);return isNaN(e)?0:e},slice:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t.length&&t[0]?Array.prototype.slice.call(t,e):[]},strToHump:function(t){return t?t.toString().replace(/-(\w)/g,function(t,e){return e.toUpperCase()}):""},isAndroid:function(){return s.toLowerCase().indexOf("android")>=0},isArray:function(t){return Array.isArray(t)},isObject:function(t){return t&&"object"===(void 0===t?"undefined":a(t))&&!c.isArray(t)},randomStr:function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"zximageprocess")+"_"+ +new Date}};var l=c,u=r,h={createElm:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"div",e=arguments[1],n=u.createElement(t);if(e&&e instanceof Object)for(var i in e)e.hasOwnProperty(i)&&n.setAttribute(i,e[i]);return n},createVdom:function(t){if(!t)return null;if("string"==typeof t)return u.createTextNode(t);var e=t.tag,n=t.attrs,i=t.child;if(!e&&!n&&!i)return null;var r=h.createElm(e||"div",n);if(Array.isArray(i)&&i.length){var o=void 0;i.forEach(function(t){(o=h.createVdom(t))&&r.appendChild(o)})}else i&&"string"==typeof i&&r.appendChild(u.createTextNode(i));return r},createCanvas:function(t,e){var n=this.createElm("canvas",{width:e.dw,height:e.dh});return n.getContext("2d").drawImage(t,e.sx,e.sy,e.sw,e.sh,e.dx,e.dy,e.dw,e.dh),n},getStyle:function(t,e){if(!h.isHTMLElement(t))return null;var n=o.getComputedStyle(t,null),i=null;if(e)try{i=n[l.strToHump(e)]}catch(t){}else i=n;return i},maxZIndex:function(){for(var t=u.getElementsByTagName("*"),e=void 0,n=void 0,i=void 0,r=[],o=0;o<t.length;o++)1===(e=t[o]).nodeType&&"static"!==(n=h.getStyle(e)||{}).position&&(i=l.int(n.zIndex))>0&&r.push(i);return l.int(Math.max.apply(null,r))},isHTMLElement:function(t){return t&&t instanceof HTMLElement},query:function(t){return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:u).querySelector(t)},lock:function(t){void 0===t&&(t=h.query("body")),h.isHTMLElement(t)&&(t.style.overflow="hidden")},unlock:function(t){void 0===t&&(t=h.query("body")),h.isHTMLElement(t)&&(t.style.overflow="")},addEvent:function(t,e,n){var i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(t&&e&&n)if(t.length)for(var r=0;r<t.length;r++)d(t[r],e,n,i);else d(t,e,n,i)},removeEvent:function(t,e,n){var i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(t&&e&&n)if(t.length)for(var r=0;r<t.length;r++)f(t[r],e,n,i);else f(t,e,n,i)}};function d(t,e,n,i){t.addEventListener?t.addEventListener(e,n,i):t.attachEvent?t.attachEvent(e,n):t["on"+e]=n}function f(t,e,n,i){t.removeEventListener?t.removeEventListener(e,n,i):t.detachEvent?t.detachEvent(e,n):t["on"+e]=null}var p=h,g={scaleInfo:function(t,e){var n=l.int(t.width),i=l.int(t.height),r=e.width,o=e.height,a=1;return n>0?(a=l.ratio(r,n),i=Math.floor(n*o/r)):i>0&&(a=l.ratio(o,i),n=Math.floor(i*r/o)),{sw:r,sh:o,scaling:a,dw:n,dh:i}},autoCropInfo:function(t,e,n){var i=l.int(n.width),r=l.int(n.height),o=1,a=0,s=0,c=t,u=e,h=t,d=e;return i>0&&r>0?(c=i,u=r,h=i,d=Math.floor(i*e/t),o=l.ratio(t,i),d>=r?(a=0,s=l.int((d-r)/2*o)):(o=l.ratio(e,r),h=Math.floor(r*t/e),a=l.int((h-i)/2*o),s=0)):i>0?(o=l.ratio(t,i),c=i,u=Math.floor(i*e/t)):r>0&&(o=l.ratio(e,r),c=Math.floor(r*t/e),u=r),{sx:a,sy:s,sw:c*o,sh:u*o,scaling:o,cw:c,ch:u}}},v=o.navigator,m=v.msPointerEnabled,y=v.pointerEnabled,b=!!("ontouchstart"in o||o.DocumentTouch&&document instanceof DocumentTouch),w=["mousedown","mousemove","mouseup"];m&&(w=["MSPointerDown","MSPointerMove","MSPointerUp"]),y&&(w=["pointerdown","pointermove","pointerup"]);var x={start:b?"touchstart":w[0],move:b?"touchmove":w[1],end:b?"touchend":w[2]};function E(t,e){return function(t,e){var n=_(t[0],t[1]);return _(e[0],e[1])/n}(e,(n=t.touches,l.slice(n).map(function(t){return{x:t.pageX,y:t.pageY}})));var n}function _(t,e){var n=t.x-e.x,i=t.y-e.y;return Math.sqrt(n*n+i*i)}var z=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}();var B={width:750,height:750,submitStyle:"",cancelStyle:"",submitText:"确 定",rotateText:"旋转90度"};var k=function(){function t(e){var n=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.cropRatio=1,this.visible=!1,this.$wrapper=null,this.$img=null,this.cropBoxPos={},this.translate={x:0,y:0},this.angle=0,this.options=Object.assign({},B,e),this._init(this.options),p.addEvent(o,"resize",function(t){n.initCropBosPosition()})}return z(t,[{key:"_init",value:function(t){var e={attrs:{class:"zx-image-crop-container",style:"z-index:"+(p.maxZIndex()+1)+";display:none;"},child:[{attrs:{class:"zx-image-crop-wrapper"},child:[{attrs:{class:"crop-line-box"}}]},{tag:"img",attrs:{class:"zx-image-target"}},{attrs:{class:"zx-crop-btns-wrapper"},child:[{tag:"button",attrs:{class:"__rotate",style:t.cancelStyle},child:t.rotateText},{tag:"button",attrs:{class:"__submit",style:t.submitStyle},child:t.submitText}]},{attrs:{class:"__close"}}]};this.$wrapper=p.createVdom(e),this.$body=p.query("body"),this.$body.appendChild(this.$wrapper),this.$img=p.query(".zx-image-target",this.$wrapper),this._initEvent(this.$img),this.initCropBosPosition(),p.addEvent(this.$wrapper,"selectstart",function(t){t.preventDefault()})}},{key:"initCropBosPosition",value:function(t){t&&(this.options=Object.assign({},this.options,t));var e=this.options,n=o.innerWidth,i=o.innerHeight,r=Math.min(e.width,.8*n),a=e.height/e.width*r;a>.8*i&&(a=.8*i,r=e.width/e.height*a);var s=(i-a)/2,c=(n-r)/2,l=Math.max(s,c);this.cropRatio=e.width/r,this.cropBoxPos={winWidth:n,winHeight:i,width:r,height:a,borderWidth:l,top:s,left:c,bottom:s+a,right:c+r};var u=p.query(".crop-line-box",this.$wrapper);u.style.top=s-l+"px",u.style.left=c-l+"px",u.style.width=r+"px",u.style.height=a+"px",u.style.borderWidth=l+"px",p.query(".zx-crop-btns-wrapper",this.$wrapper).style.top=this.cropBoxPos.bottom+20+"px"}},{key:"_initEvent",value:function(){var t,e,n=this,o=void 0;o=m?r:p.query(".zx-image-crop-wrapper",this.$wrapper),this._move(o),t=o,e=function(t){var e=!!(n.angle%180),i=t.wheelDelta||-t.detail;n._scale(i,e)},p.addEvent(t,"mousewheel",e),p.addEvent(t,"DOMMouseScroll",e);var a=p.query(".__submit",this.$wrapper);p.addEvent(a,"click",function(t){n._submit()});var s=p.query(".__rotate",this.$wrapper);p.addEvent(s,"click",function(t){n._rotate()});var c=p.query(".__close",this.$wrapper);p.addEvent(c,"click",function(t){i.emit("crop-cancel"),n.hide()})}},{key:"_move",value:function(t){var e=this,n=this.$img,i=!1,o=!1,a={},s=0,c=[],u=!1;p.addEvent(t,x.start,function(t){var r,h;if(n.className="zx-image-target is-move",i=!0,o="touchstart"===t.type,u=!!(e.angle%180),o&&(s=t.touches.length),s>1&&(r=t,h=n.getBoundingClientRect(),c=l.slice(r.touches).map(function(t){return{x:t.pageX-h.left,y:t.pageY-h.top}})),!o&&"which"in t&&3===t.which)i=!1;else if(!o||1===t.targetTouches.length){o||l.isAndroid()||(t.preventDefault?t.preventDefault():t.returnValue=!1);var d=o?t.targetTouches[0].pageX:t.pageX||t.clientX,f=o?t.targetTouches[0].pageY:t.pageY||t.clientY,p=n.getBoundingClientRect(),g=e.translate;a={pageX:d,pageY:f,x:d-g.x,y:f-g.y,left:p.left,top:p.top}}}),p.addEvent(r,x.move,function(t){if(i)if(o||l.isAndroid()||(t.preventDefault?t.preventDefault():t.returnValue=!1),s>1){var n=E(t,c);e._scaleHandler(n>1,.02,u)}else e._handleMove(t,a,o,u)}),p.addEvent(r,x.end,function(t){n.className="zx-image-target",i=!1,o&&(s=t.touches.length)})}},{key:"_handleMove",value:function(t,e,n,i){var r=n?t.targetTouches[0].pageX:t.pageX||t.clientX,o=n?t.targetTouches[0].pageY:t.pageY||t.clientY,a={x:r-e.x,y:o-e.y};this._moveBoundary(a,i)}},{key:"_moveBoundary",value:function(t,e){var n=t.x,i=t.y,r=this.cropBoxPos,o=this.$img,a=o.getBoundingClientRect();if(e){var s=(r.winWidth+a.width-a.height-r.width)/2;s<=n&&(n=s);var c=(r.winHeight+a.height-a.width-r.height)/2;c<=i&&(i=c);var l=s+r.width-a.width;n<=l&&(n=l);var u=c+r.height-a.height;i<=u&&(i=u)}else n>r.left&&(n=r.left),n<=r.right-a.width&&(n=r.right-a.width),i>r.top&&(i=r.top),i<=r.bottom-a.height&&(i=r.bottom-a.height);this.translate.x=n,this.translate.y=i,o.style.transform="translateX("+this.translate.x+"px) translateY("+this.translate.y+"px) rotate("+this.angle+"deg)"}},{key:"_scale",value:function(t,e){this._scaleHandler(t>0,.1,e)}},{key:"_rotate",value:function(){var t=this.$img;this.angle+=90;var e=t.getBoundingClientRect(),n=!!(this.angle%180),i=this.cropBoxPos,r=e.height,o=e.width,a=void 0,s=void 0,c=void 0,l=void 0;if(n?(r<i.width&&(a=o*(s=i.width)/r),o<i.height&&(s=r*(a=i.height)/o),c=e.width,l=e.height):(r<i.width&&(s=o*(a=i.width)/r),o<i.height&&(s=r*(a=i.height)/o),c=e.height,l=e.width),a&&s){t.style.width=a+"px",t.style.height=s+"px";var u=c-a,h=l-s,d=this.translate;this.translate={x:d.x+u/2,y:d.y+h/2}}t.style.transform="translate("+this.translate.x+"px, "+this.translate.y+"px) rotate("+this.angle+"deg)"}},{key:"_scaleHandler",value:function(t,e,n){var i=this.$img,r=i.naturalWidth,o=i.width,a=i.height,s=this.cropBoxPos,c=void 0,l=void 0;if(t){if(l=(c=o*(1+e))*a/o,c>=3*r)return}else if(n){if(o<=s.height||a<=s.width)return void this._moveBoundary(this.translate,!0);l=(c=o*(1-e))*a/o,c<=s.height&&(l=(c=s.height)*a/o),l<=s.width&&(c=(l=s.width)*o/a)}else{if(o<=s.width||a<=s.height)return void this._moveBoundary(this.translate,!1);l=(c=o*(1-e))*a/o,c<=s.width&&(l=(c=s.width)*a/o),l<=s.height&&(c=(l=s.height)*o/a)}n?this._scaleByRotate(o,a,c,l):this._scaleByNotRotate(o,a,c,l)}},{key:"_scaleByRotate",value:function(t,e,n,i){var r=this.$img,o=t-n,a=e-i,s=this.translate;this.translate={x:s.x+o/2,y:s.y+a/2},r.style.width=n+"px",r.style.height=i+"px",this._moveBoundary(this.translate,!0)}},{key:"_scaleByNotRotate",value:function(t,e,n,i){var r=this.$img,o=t-n,a=e-i,s=this.translate;this.translate={x:s.x+o/2,y:s.y+a/2},r.style.width=n+"px",r.style.height=i+"px",this._moveBoundary(this.translate,!1)}},{key:"setImageSrc",value:function(t){if(this.$img&&t){if(this.show(),this.$img.src!==t){p.removeEvent(this.$img,"load",r),this.$img.setAttribute("style",""),this.angle=0,this.$img.src=t,p.addEvent(this.$img,"load",r);var e=this,n=e.cropBoxPos}}else i.emit("error",{code:21,message:"Failed to setImageSrc(url)"});function r(){var t=e.$img,i=n.winWidth/n.winHeight,r=t.naturalWidth,o=t.naturalHeight,a=r/o,s=void 0,c=void 0;a>i&&r>n.winWidth?c=o*(s=n.winWidth)/r:a<i&&o>n.winHeight?s=r*(c=n.winHeight)/o:(s=r,c=o);var l=n.width/n.height;a>l&&o<n.height?s=r*(c=n.height)/o:a<l&&r<n.width&&(c=o*(s=n.width)/r),t.style.width=s+"px",t.style.height=c+"px";var u=(n.winWidth-s)/2,h=(n.winHeight-c)/2;t.style.transform="translate("+u+"px, "+h+"px) rotate(0)",e.translate={x:u,y:h}}}},{key:"_submit",value:function(){var t=this.$img,e=this.options,n=this.cropRatio,r=this.cropBoxPos,o=t.getBoundingClientRect(),a=this.angle%360,s=a%180,c={angle:a,naturalWidth:s?t.naturalHeight:t.naturalWidth,naturalHeight:s?t.naturalWidth:t.naturalHeight,currentWidth:l.int(o.width*n),currentHeight:l.int(o.height*n),targetWidth:e.width,targetHeight:e.height,x:l.int((r.left-o.left)*n),y:l.int((r.top-o.top)*n)};i.emit("crop-submit",c),this.hide()}},{key:"show",value:function(){this.visible||(this.visible=!0,this.$wrapper.style.display="",p.lock(this.$body))}},{key:"hide",value:function(){this.visible&&(this.visible=!1,this.$wrapper.style.display="none",p.unlock(this.$body))}}]),t}(),S=null;function C(t,e,n,o){i.on("crop-cancel",function(t){o({code:22,message:"Clipping is cancelled"}),i.off("crop-submit"),i.off("crop-cancel")}),i.on("crop-submit",function(e){!function(t,e,n){var i=void 0;e.angle>0&&(i=function(t,e){var n=r.createElement("canvas"),i=n.getContext("2d"),o=t.width,a=t.height;switch(n.width=o,n.height=a,e){case 90:n.width=a,n.height=o,i.rotate(Math.PI/2),i.drawImage(t,0,-a,o,a);break;case 180:i.rotate(Math.PI),i.drawImage(t,-o,-a,o,a);break;case 270:n.width=a,n.height=o,i.rotate(3*Math.PI/2),i.drawImage(t,-o,0,o,a);break;default:i.drawImage(t,0,0,o,a)}return n}(t.element,e.angle),t.width=e.naturalWidth,t.height=e.naturalHeight,t.element=i);i=function(t,e){var n=g.scaleInfo(e,t),i=t.element,r=void 0,o=n.sw,a=n.sh;if(n.scaling>2){r=n.scaling;do{i=p.createCanvas(i,{dx:0,dy:0,dw:n.dw*r,dh:n.dh*r,sx:0,sy:0,sw:o,sh:a}),o=n.dw*r,a=n.dh*r,r-=1}while(r>2)}return i=p.createCanvas(i,{dx:0,dy:0,dw:n.dw,dh:n.dh,sx:0,sy:0,sw:o,sh:a})}(t,{width:e.currentWidth});var o=p.createCanvas(i,{sx:e.x,sy:e.y,sw:e.targetWidth,sh:e.targetHeight,dx:0,dy:0,dw:e.targetWidth,dh:e.targetHeight}),a=t.type,s=o.toDataURL(a),c=l.toBlobData(s,a);n&&n({element:o,type:a,width:o.width,height:o.height,blob:c,data:c,url:l.toBlobUrl(c),base64:s,size:c.size,raw:t})}(t,e,n),i.off("crop-submit"),i.off("crop-cancel")}),null===S?S=new k(e):S.initCropBosPosition(e),S.setImageSrc(t.base64)}function M(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(function(n,i){/^data:(.+?);base64/.test(t)?T(t,e,n,i):function(t){var e=new FileReader;return e.readAsDataURL(t),new Promise(function(t,n){e.onload=function(){t(this.result)},e.onerror=function(t){n(t)}})}(t).then(function(t){T(t,e,n,i)}).catch(function(t){i(t)})})}function T(t,e,n,i){var o,a,s=/^data:(.+?);base64/.test(t)?RegExp.$1:"image/jpeg",c=l.toBlobData(t,s),u=(o=t,(a=r.createElement("img")).src=o,a);u.onload=function(){var r={element:u,base64:t,width:u.naturalWidth||u.width,height:u.naturalHeight||u.height,type:c.type,size:c.size},o=e.width>0&&e.height>0;e.auto||!o?function(t,e,n){var i=void 0,r=void 0,o=void 0,a=void 0,s=void 0,c=void 0,u=void 0;if(i=g.autoCropInfo(t.width,t.height,e),r=t.element,o=2,a=i.sw,s=i.sh,c=i.sx,u=i.sy,i.scaling>o){o=i.scaling;do{r=$(r,{cw:i.cw*o,ch:i.ch*o,sx:c,sy:u,sw:a,sh:s}),a=r.width,s=r.height,c=u=0,o-=1}while(o>2)}var h=(r=$(r,{cw:i.cw,ch:i.ch,sx:c,sy:u,sw:a,sh:s})).toDataURL(t.type),d=l.toBlobData(h,t.type);n({element:r,type:d.type,width:i.cw,height:i.ch,blob:d,url:l.toBlobUrl(d),base64:h,size:d.size,raw:t})}(r,e,n):C(r,e,n,i)},u.onerror=function(t){i(t)}}function $(t,e){var n=r.createElement("canvas");return n.width=e.cw,n.height=e.ch,n.getContext("2d").drawImage(t,e.sx,e.sy,e.sw,e.sh,0,0,n.width,n.height),n}function L(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=function(t){var e=r.createElement("video");return e.src=t,e.autoplay=!0,e}(l.toBlobUrl(t));return new Promise(function(i,o){n.onerror=function(t){o(t),n=null},n.oncanplay=function(){var a={videoFile:t,videoWidth:n.videoWidth,videoHeight:n.videoHeight,duration:n.duration},s=function(t){arguments.length>1&&void 0!==arguments[1]&&arguments[1];t.pause();var e=r.createElement("canvas"),n=e.getContext("2d");e.width=t.videoWidth,e.height=t.videoHeight,n.drawImage(t,0,0,e.width,e.height);var i=null,o=null;try{i=e.toDataURL("image/jpeg")}catch(t){o={code:13,message:"截图失败,视频文件所在域与后台系统不同!",data:t}}return{base64:i,err:o}}(n),c=s.base64,l=s.err;if(l)return o(l),void(n=null);M(c,e).then(function(t){i(Object.assign({},a,t))}).catch(function(t){o(t)}),n=null}})}function R(t,e){return new Promise(function(n,i){var r=t.type;/^(image|video)/.test(r)?function(t,e,n,i,r){var o=l.bitToKib(t.size),a=1024*l.int(n.maxSize);if(a&&a<o)return void r({code:12,message:"The file is too large, exceeding the maximum limit of "+n.maxSize+"M."});switch(e){case"image":M(t,n).then(i).catch(r);break;case"video":L(t,n).then(i).catch(r)}}(t,RegExp.$1,e,n,i):i({code:7,message:"Incorrect file type"})})}n(0);n.d(e,"ZxImageProcess",function(){return A}),n.d(e,"handleMediaFile",function(){return R});var j=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}();var U={accept:"",auto:!1,width:0,height:0,selector:null,maxSize:50,error:function(){},success:function(){}},I={},A=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t);var n=Object.assign({},U,e);i.on("error",function(t){t.msg=t.message,n.error(t)}),i.on("success",function(t){n.success(t)}),this._init(n)}return j(t,[{key:"_init",value:function(t){t.selector&&("string"==typeof t.selector||p.isHTMLElement(t.selector))?(this.options=t,this.id=l.randomStr(),this.$body=p.query("body"),null!==this.$body?function(t,e){var n=e.selector,r=p.isHTMLElement(n)?n:p.query(n);if(null!==r){var o=p.createElm("input",{style:"display:none;",type:"file",accept:e.accept});t.$body.appendChild(o),p.addEvent(o,"click",function(t){o.value=""}),p.addEvent(o,"change",function(n){var r=o.files||[];if(0===r.length)i.emit("error",{code:4,message:"Any file is not selected!"});else{var a=r[0];t.file=a,R(a,e).then(function(t){i.emit("success",t)}).catch(function(t){i.emit("error",t)})}}),p.addEvent(r,"click",function(t){o.click()})}else i.emit("error",{code:3,message:"Element "+n+" is not found in document!"})}(this,t):i.emit("error",{code:2,message:"Failed to initialize, Element body is not found in document!"})):i.emit("error",{code:1,message:'The selector "'+t.selector+'" is not valid in initialization parameter.'})}},{key:"reCrop",value:function(){this.file?I.show():i.emit("error",{code:5,message:"请先选择图片文件"})}}]),t}();A.prototype.toBlobData=l.toBlobData,A.prototype.toBlobUrl=l.toBlobUrl,A.prototype.conversion=l.conversion,A.prototype.handleMediaFile=R}])}); |
{ | ||
"name": "image-process", | ||
"version": "3.3.6", | ||
"version": "3.3.7", | ||
"author": "capricorncd", | ||
@@ -5,0 +5,0 @@ "github": "https://github.com/capricorncd", |
@@ -59,7 +59,2 @@ /** | ||
_init (opts) { | ||
// 禁用选中图片 | ||
dom.addEvent(document, 'selectstart', e => { | ||
e.preventDefault() | ||
}) | ||
// let zIndex = 1 | ||
@@ -131,2 +126,6 @@ let zIndex = dom.maxZIndex() + 1 | ||
this.initCropBosPosition() | ||
// 禁用$wrapper中的图片被选中 | ||
dom.addEvent(this.$wrapper, 'selectstart', e => { | ||
e.preventDefault() | ||
}) | ||
} | ||
@@ -133,0 +132,0 @@ |
95781