(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["uni_modules-vk-uview-ui-components-u-avatar-cropper-u-avatar-cropper~uni_modules-vk-uview-ui-compone~692890a9"],{1851:function(t,e,n){"use strict";var o=n("8bdb"),r=n("84d6"),i=n("1cb5");o({target:"Array",proto:!0},{fill:r}),i("fill")},c3fb:function(t,e,n){"use strict";(function(t){ /** * we-cropper v1.3.9 * (c) 2020 dlhandsome * @license MIT */ var o=n("f5bd").default;Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var r=o(n("fcf3"));n("f7a5"),n("bf0f"),n("a03a"),n("6a54"),n("e838"),n("5ef2"),n("c223"),n("7a76"),n("c9b5"),n("5c47"),n("a1c1"),n("0506"),n("2c10"),n("1851"),n("2797"),n("dc8a");var i=void 0,a=["touchstarted","touchmoved","touchended"];function c(t){var e=[],n=arguments.length-1;while(n-- >0)e[n]=arguments[n+1];a.forEach((function(n,o){void 0!==e[o]&&(t[n]=e[o])}))}function u(){return i||(i=uni.getSystemInfoSync()),i}var s={},h=u(),d=h.pixelRatio,f={id:{default:"cropper",get:function(){return s.id},set:function(t){"string"!==typeof t&&console.error("id:"+t+" is invalid"),s.id=t}},width:{default:750,get:function(){return s.width},set:function(t){"number"!==typeof t&&console.error("width:"+t+" is invalid"),s.width=t}},height:{default:750,get:function(){return s.height},set:function(t){"number"!==typeof t&&console.error("height:"+t+" is invalid"),s.height=t}},pixelRatio:{default:d,get:function(){return s.pixelRatio},set:function(t){"number"!==typeof t&&console.error("pixelRatio:"+t+" is invalid"),s.pixelRatio=t}},scale:{default:2.5,get:function(){return s.scale},set:function(t){"number"!==typeof t&&console.error("scale:"+t+" is invalid"),s.scale=t}},zoom:{default:5,get:function(){return s.zoom},set:function(t){"number"!==typeof t?console.error("zoom:"+t+" is invalid"):(t<0||t>10)&&console.error("zoom should be ranged in 0 ~ 10"),s.zoom=t}},src:{default:"",get:function(){return s.src},set:function(t){"string"!==typeof t&&console.error("src:"+t+" is invalid"),s.src=t}},cut:{default:{},get:function(){return s.cut},set:function(t){"object"!==(0,r.default)(t)&&console.error("cut:"+t+" is invalid"),s.cut=t}},boundStyle:{default:{},get:function(){return s.boundStyle},set:function(t){"object"!==(0,r.default)(t)&&console.error("boundStyle:"+t+" is invalid"),s.boundStyle=t}},onReady:{default:null,get:function(){return s.ready},set:function(t){s.ready=t}},onBeforeImageLoad:{default:null,get:function(){return s.beforeImageLoad},set:function(t){s.beforeImageLoad=t}},onImageLoad:{default:null,get:function(){return s.imageLoad},set:function(t){s.imageLoad=t}},onBeforeDraw:{default:null,get:function(){return s.beforeDraw},set:function(t){s.beforeDraw=t}}},l=u(),p=l.windowWidth;var v="undefined"!==typeof window?window:"undefined"!==typeof t?t:"undefined"!==typeof self?self:{};function g(t,e){return e={exports:{}},t(e,e.exports),e.exports}var y=g((function(t,e){e.isStr=function(t){return"string"===typeof t},e.isNum=function(t){return"number"===typeof t},e.isArr=Array.isArray,e.isUndef=function(t){return void 0===t},e.isTrue=function(t){return!0===t},e.isFalse=function(t){return!1===t},e.isFunc=function(t){return"function"===typeof t},e.isObj=e.isObject=function(t){return null!==t&&"object"===(0,r.default)(t)};var n=Object.prototype.toString;e.isPlainObject=function(t){return"[object Object]"===n.call(t)};var o=Object.prototype.hasOwnProperty;e.hasOwn=function(t,e){return o.call(t,e)},e.noop=function(t,e,n){},e.isValidArrayIndex=function(t){var e=parseFloat(String(t));return e>=0&&Math.floor(e)===e&&isFinite(t)}})),m=y.isFunc,x=y.isPlainObject,b=["ready","beforeImageLoad","beforeDraw","imageLoad"];function w(t){return function(e){var n=[],o=arguments.length-1;while(o-- >0)n[o]=arguments[o+1];return void 0===e&&(e={}),new Promise((function(o,r){e.success=function(t){o(t)},e.fail=function(t){r(t)},t.apply(void 0,[e].concat(n))}))}}function C(t,e){return void 0===e&&(e=!1),new Promise((function(n){t.draw(e,n)}))}var S=w(uni.getImageInfo),M=w(uni.canvasToTempFilePath),I=g((function(t,e){ /*! http://mths.be/base64 v0.1.0 by @mathias | MIT license */ (function(n){var o=e,i=t&&t.exports==o&&t,a="object"==(0,r.default)(v)&&v;a.global!==a&&a.window!==a||(n=a);var c=function(t){this.message=t};c.prototype=new Error,c.prototype.name="InvalidCharacterError";var u=function(t){throw new c(t)},s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",h=/[\t\n\f\r ]/g,d={encode:function(t){t=String(t),/[^\0-\xFF]/.test(t)&&u("The string to be encoded contains characters outside of the Latin1 range.");var e,n,o,r,i=t.length%3,a="",c=-1,h=t.length-i;while(++c>18&63)+s.charAt(r>>12&63)+s.charAt(r>>6&63)+s.charAt(63&r);return 2==i?(e=t.charCodeAt(c)<<8,n=t.charCodeAt(++c),r=e+n,a+=s.charAt(r>>10)+s.charAt(r>>4&63)+s.charAt(r<<2&63)+"="):1==i&&(r=t.charCodeAt(c),a+=s.charAt(r>>2)+s.charAt(r<<4&63)+"=="),a},decode:function(t){t=String(t).replace(h,"");var e=t.length;e%4==0&&(t=t.replace(/==?$/,""),e=t.length),(e%4==1||/[^+a-zA-Z0-9/]/.test(t))&&u("Invalid character: the string to be decoded is not correctly encoded.");var n,o,r=0,i="",a=-1;while(++a>(-2*r&6)));return i},version:"0.1.0"};if(o&&!o.nodeType)if(i)i.exports=d;else for(var f in d)d.hasOwnProperty(f)&&(o[f]=d[f]);else n.base64=d})(v)}));function T(t){var e="";if("string"===typeof t)e=t;else for(var n=0;n>8&255,r>>16&255,r>>24&255,0,0,0,0,54,0,0,0],a=[40,0,0,0,255&e,e>>8&255,e>>16&255,e>>24&255,255&n,n>>8&255,n>>16&255,n>>24&255,1,0,24,0,0,0,0,0,255&o,o>>8&255,o>>16&255,o>>24&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],c=(4-3*e%4)%4,u=t.data,s="",h=e<<2,d=n,f=String.fromCharCode;do{for(var l=h*(d-1),p="",v=0;v=2&&this.__twoTouchStart(n,o))},touchMove:function(t){var e=t.touches,n=e[0],o=e[1];this.src&&(c(this,null,!0),1===t.touches.length&&this.__oneTouchMove(n),t.touches.length>=2&&this.__twoTouchMove(n,o))},touchEnd:function(t){this.src&&(c(this,!1,!1,!0),this.__xtouchEnd())}};var O=function(t){var e={};return function(t,e){Object.defineProperties(t,e)}(this,f),Object.keys(f).forEach((function(t){e[t]=f[t].default})),Object.assign(this,e,t),this.prepare(),this.attachPage(),this.createCtx(),this.observer(),this.cutt(),this.methods(),this.init(),this.update(),this};O.prototype.init=function(){var t=this.src;return this.version="1.3.9","function"===typeof this.onReady&&this.onReady(this.ctx,this),t?this.pushOrign(t):this.updateCanvas(),c(this,!1,!1,!1),this.oldScale=1,this.newScale=1,this},Object.assign(O.prototype,j),O.prototype.prepare=function(){var t=this;t.attachPage=function(){var e=getCurrentPages(),n=e[e.length-1];Object.defineProperty(n,"wecropper",{get:function(){return console.warn("Instance will not be automatically bound to the page after v1.4.0\n\nPlease use a custom instance name instead\n\nExample: \nthis.mycropper = new WeCropper(options)\n\n// ...\nthis.mycropper.getCropperImage()"),t},configurable:!0})},t.createCtx=function(){var e=t.id,n=t.targetId;e?(t.ctx=t.ctx||uni.createCanvasContext(e),t.targetCtx=t.targetCtx||uni.createCanvasContext(n)):console.error("constructor: create canvas context failed, 'id' must be valuable")},t.deviceRadio=p/750},O.prototype.observer=function(){var t=this;t.on=function(e,n){return b.indexOf(e)>-1?m(n)&&("ready"===e?n(t):t["on"+function(t){return t.charAt(0).toUpperCase()+t.slice(1)}(e)]=n):console.error("event: "+e+" is invalid"),t}},O.prototype.methods=function(){var t=this,e=t.width,n=t.height,o=t.id,r=t.targetId,i=t.pixelRatio,a=t.cut,c=a.x;void 0===c&&(c=0);var u=a.y;void 0===u&&(u=0);var s=a.width;void 0===s&&(s=e);var h=a.height;void 0===h&&(h=n),t.updateCanvas=function(e){return t.croperTarget&&t.ctx.drawImage(t.croperTarget,t.imgLeft,t.imgTop,t.scaleWidth,t.scaleHeight),m(t.onBeforeDraw)&&t.onBeforeDraw(t.ctx,t),t.setBoundStyle(t.boundStyle),t.ctx.draw(!1,e),t},t.pushOrigin=t.pushOrign=function(e){return t.src=e,m(t.onBeforeImageLoad)&&t.onBeforeImageLoad(t.ctx,t),S({src:e}).then((function(e){var n=e.width/e.height,o=s/h;return t.croperTarget=e.path,n=r?r:t.scaleWidth+e-r<=a?r+a-t.scaleWidth:e,t.imgTop=n>=i?i:t.scaleHeight+n-i<=c?i+c-t.scaleHeight:n},t.setBoundStyle=function(o){void 0===o&&(o={});var u=o.color;void 0===u&&(u="#04b00f");var s=o.mask;void 0===s&&(s="rgba(0, 0, 0, 0.3)");var h=o.lineWidth;void 0===h&&(h=1);var d=h/2,f=[{start:{x:r-d,y:i+10-d},step1:{x:r-d,y:i-d},step2:{x:r+10-d,y:i-d}},{start:{x:r-d,y:i+c-10+d},step1:{x:r-d,y:i+c+d},step2:{x:r+10-d,y:i+c+d}},{start:{x:r+a-10+d,y:i-d},step1:{x:r+a+d,y:i-d},step2:{x:r+a+d,y:i+10-d}},{start:{x:r+a+d,y:i+c-10+d},step1:{x:r+a+d,y:i+c+d},step2:{x:r+a-10+d,y:i+c+d}}];t.ctx.beginPath(),t.ctx.setFillStyle(s),t.ctx.fillRect(0,0,r,n),t.ctx.fillRect(r,0,a,i),t.ctx.fillRect(r,i+c,a,n-i-c),t.ctx.fillRect(r+a,0,e-r-a,n),t.ctx.fill(),f.forEach((function(e){t.ctx.beginPath(),t.ctx.setStrokeStyle(u),t.ctx.setLineWidth(h),t.ctx.moveTo(e.start.x,e.start.y),t.ctx.lineTo(e.step1.x,e.step1.y),t.ctx.lineTo(e.step2.x,e.step2.y),t.ctx.stroke()}))}},O.prototype.update=function(){var t=this;t.src&&(t.__oneTouchStart=function(e){t.touchX0=Math.round(e.x),t.touchY0=Math.round(e.y)},t.__oneTouchMove=function(e){var n,o;if(t.touchended)return t.updateCanvas();n=Math.round(e.x-t.touchX0),o=Math.round(e.y-t.touchY0);var r=Math.round(t.rectX+n),i=Math.round(t.rectY+o);t.outsideBound(r,i),t.updateCanvas()},t.__twoTouchStart=function(e,n){var o,r,i;t.touchX1=Math.round(t.rectX+t.scaleWidth/2),t.touchY1=Math.round(t.rectY+t.scaleHeight/2),o=Math.round(n.x-e.x),r=Math.round(n.y-e.y),i=Math.round(Math.sqrt(o*o+r*r)),t.oldDistance=i},t.__twoTouchMove=function(e,n){var o=t.oldScale,r=t.oldDistance,i=t.scale,a=t.zoom;t.newScale=function(t,e,n,o,r){var i,a,c;return i=Math.round(r.x-o.x),a=Math.round(r.y-o.y),c=Math.round(Math.sqrt(i*i+a*a)),t+.001*n*(c-e)}(o,r,a,e,n),t.newScale<=1&&(t.newScale=1),t.newScale>=i&&(t.newScale=i),t.scaleWidth=Math.round(t.newScale*t.baseWidth),t.scaleHeight=Math.round(t.newScale*t.baseHeight);var c=Math.round(t.touchX1-t.scaleWidth/2),u=Math.round(t.touchY1-t.scaleHeight/2);t.outsideBound(c,u),t.updateCanvas()},t.__xtouchEnd=function(){t.oldScale=t.newScale,t.rectX=t.imgLeft,t.rectY=t.imgTop})};var P=O;e.default=P}).call(this,n("0ee4"))}}]);