telegram-tt/dist/6.2da507ad3650a1b3e6e0.js
Alexander Zinchuk 1264f0d24a [Build]
2021-06-23 16:33:23 +03:00

2 lines
26 KiB
JavaScript

(window.webpackJsonp=window.webpackJsonp||[]).push([[6],{190:function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},312:function(e,t,n){(function(i){var o,a;"undefined"!=typeof self&&self,void 0===(a="function"==typeof(o=function(){"function"!=typeof Promise&&function(t){function n(e,t){return function(){e.apply(t,arguments)}}function o(e){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof e)throw new TypeError("not a function");this._state=null,this._value=null,this._deferreds=[],c(e,n(r,this),n(s,this))}function a(e){var t=this;return null===this._state?void this._deferreds.push(e):void p((function(){var n=t._state?e.onFulfilled:e.onRejected;if(null!==n){var i;try{i=n(t._value)}catch(t){return void e.reject(t)}e.resolve(i)}else(t._state?e.resolve:e.reject)(t._value)}))}function r(e){try{if(e===this)throw new TypeError("A promise cannot be resolved with itself.");if(e&&("object"==typeof e||"function"==typeof e)){var t=e.then;if("function"==typeof t)return void c(n(t,e),n(r,this),n(s,this))}this._state=!0,this._value=e,l.call(this)}catch(e){s.call(this,e)}}function s(e){this._state=!1,this._value=e,l.call(this)}function l(){for(var e=0,t=this._deferreds.length;t>e;e++)a.call(this,this._deferreds[e]);this._deferreds=null}function h(e,t,n,i){this.onFulfilled="function"==typeof e?e:null,this.onRejected="function"==typeof t?t:null,this.resolve=n,this.reject=i}function c(e,t,n){var i=!1;try{e((function(e){i||(i=!0,t(e))}),(function(e){i||(i=!0,n(e))}))}catch(e){if(i)return;i=!0,n(e)}}var u=setTimeout,p="function"==typeof i&&i||function(e){u(e,1)},d=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};o.prototype.catch=function(e){return this.then(null,e)},o.prototype.then=function(e,t){var n=this;return new o((function(i,o){a.call(n,new h(e,t,i,o))}))},o.all=function(){var e=Array.prototype.slice.call(1===arguments.length&&d(arguments[0])?arguments[0]:arguments);return new o((function(t,n){function i(a,r){try{if(r&&("object"==typeof r||"function"==typeof r)){var s=r.then;if("function"==typeof s)return void s.call(r,(function(e){i(a,e)}),n)}e[a]=r,0==--o&&t(e)}catch(e){n(e)}}if(0===e.length)return t([]);for(var o=e.length,a=0;a<e.length;a++)i(a,e[a])}))},o.resolve=function(e){return e&&"object"==typeof e&&e.constructor===o?e:new o((function(t){t(e)}))},o.reject=function(e){return new o((function(t,n){n(e)}))},o.race=function(e){return new o((function(t,n){for(var i=0,o=e.length;o>i;i++)e[i].then(t,n)}))},o._setImmediateFn=function(e){p=e},e.exports?e.exports=o:t.Promise||(t.Promise=o)}(this),"function"!=typeof window.CustomEvent&&function(){function e(e,t){t=t||{bubbles:!1,cancelable:!1,detail:void 0};var n=document.createEvent("CustomEvent");return n.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),n}e.prototype=window.Event.prototype,window.CustomEvent=e}(),HTMLCanvasElement.prototype.toBlob||Object.defineProperty(HTMLCanvasElement.prototype,"toBlob",{value:function(e,t,n){for(var i=atob(this.toDataURL(t,n).split(",")[1]),o=i.length,a=new Uint8Array(o),r=0;r<o;r++)a[r]=i.charCodeAt(r);e(new Blob([a],{type:t||"image/png"}))}});var t,n,o,a=["Webkit","Moz","ms"],r=document.createElement("div").style,s=[1,8,3,6],l=[2,7,4,5];function h(e){if(e in r)return e;for(var t=e[0].toUpperCase()+e.slice(1),n=a.length;n--;)if((e=a[n]+t)in r)return e}function c(e,t){for(var n in e=e||{},t)t[n]&&t[n].constructor&&t[n].constructor===Object?(e[n]=e[n]||{},c(e[n],t[n])):e[n]=t[n];return e}function u(e){return c({},e)}function p(e){if("createEvent"in document){var t=document.createEvent("HTMLEvents");t.initEvent("change",!1,!0),e.dispatchEvent(t)}else e.fireEvent("onchange")}function d(e,t,n){if("string"==typeof t){var i=t;(t={})[i]=n}for(var o in t)e.style[o]=t[o]}function m(e,t){e.classList?e.classList.add(t):e.className+=" "+t}function f(e,t){for(var n in t)e.setAttribute(n,t[n])}function v(e){return parseInt(e,10)}function g(e,t){var n=e.naturalWidth,i=e.naturalHeight,o=t||x(e);if(o&&o>=5){var a=n;n=i,i=a}return{width:n,height:i}}n=h("transform"),t=h("transformOrigin"),o=h("userSelect");var w={translate3d:{suffix:", 0px"},translate:{suffix:""}},y=function(e,t,n){this.x=parseFloat(e),this.y=parseFloat(t),this.scale=parseFloat(n)};y.parse=function(e){return e.style?y.parse(e.style[n]):e.indexOf("matrix")>-1||e.indexOf("none")>-1?y.fromMatrix(e):y.fromString(e)},y.fromMatrix=function(e){var t=e.substring(7).split(",");return t.length&&"none"!==e||(t=[1,0,0,1,0,0]),new y(v(t[4]),v(t[5]),parseFloat(t[0]))},y.fromString=function(e){var t=e.split(") "),n=t[0].substring(re.globals.translate.length+1).split(","),i=t.length>1?t[1].substring(6):1,o=n.length>1?n[0]:0,a=n.length>1?n[1]:0;return new y(o,a,i)},y.prototype.toString=function(){var e=w[re.globals.translate].suffix||"";return re.globals.translate+"("+this.x+"px, "+this.y+"px"+e+") scale("+this.scale+")"};var b=function(e){if(!e||!e.style[t])return this.x=0,void(this.y=0);var n=e.style[t].split(" ");this.x=parseFloat(n[0]),this.y=parseFloat(n[1])};function x(e){return e.exifdata&&e.exifdata.Orientation?v(e.exifdata.Orientation):1}function C(e,t,n){var i=t.width,o=t.height,a=e.getContext("2d");switch(e.width=t.width,e.height=t.height,a.save(),n){case 2:a.translate(i,0),a.scale(-1,1);break;case 3:a.translate(i,o),a.rotate(180*Math.PI/180);break;case 4:a.translate(0,o),a.scale(1,-1);break;case 5:e.width=o,e.height=i,a.rotate(90*Math.PI/180),a.scale(1,-1);break;case 6:e.width=o,e.height=i,a.rotate(90*Math.PI/180),a.translate(0,-o);break;case 7:e.width=o,e.height=i,a.rotate(-90*Math.PI/180),a.translate(-i,o),a.scale(1,-1);break;case 8:e.width=o,e.height=i,a.translate(0,i),a.rotate(-90*Math.PI/180)}a.drawImage(t,0,0,i,o),a.restore()}function E(){var e,t,n,i,o,a,r=this.options.viewport.type?"cr-vp-"+this.options.viewport.type:null;this.options.useCanvas=this.options.enableOrientation||_.call(this),this.data={},this.elements={},e=this.elements.boundary=document.createElement("div"),n=this.elements.viewport=document.createElement("div"),t=this.elements.img=document.createElement("img"),i=this.elements.overlay=document.createElement("div"),this.options.useCanvas?(this.elements.canvas=document.createElement("canvas"),this.elements.preview=this.elements.canvas):this.elements.preview=t,m(e,"cr-boundary"),e.setAttribute("aria-dropeffect","none"),o=this.options.boundary.width,a=this.options.boundary.height,d(e,{width:o+(isNaN(o)?"":"px"),height:a+(isNaN(a)?"":"px")}),m(n,"cr-viewport"),r&&m(n,r),d(n,{width:this.options.viewport.width+"px",height:this.options.viewport.height+"px"}),n.setAttribute("tabindex",0),m(this.elements.preview,"cr-image"),f(this.elements.preview,{alt:"preview","aria-grabbed":"false"}),m(i,"cr-overlay"),this.element.appendChild(e),e.appendChild(this.elements.preview),e.appendChild(n),e.appendChild(i),m(this.element,"croppie-container"),this.options.customClass&&m(this.element,this.options.customClass),Z.call(this),this.options.enableZoom&&M.call(this),this.options.enableResize&&I.call(this)}function _(){return this.options.enableExif&&window.EXIF}function I(){var e,t,n,i,a,r,s,l=this,h=document.createElement("div"),c=!1;function u(r){if((void 0===r.button||0===r.button)&&(r.preventDefault(),!c)){var s=l.elements.overlay.getBoundingClientRect();if(c=!0,t=r.pageX,n=r.pageY,e=-1!==r.currentTarget.className.indexOf("vertical")?"v":"h",i=s.width,a=s.height,r.touches){var h=r.touches[0];t=h.pageX,n=h.pageY}window.addEventListener("mousemove",p),window.addEventListener("touchmove",p),window.addEventListener("mouseup",f),window.addEventListener("touchend",f),document.body.style[o]="none"}}function p(o){var r=o.pageX,s=o.pageY;if(o.preventDefault(),o.touches){var c=o.touches[0];r=c.pageX,s=c.pageY}var u=r-t,p=s-n,m=l.options.viewport.height+p,f=l.options.viewport.width+u;"v"===e&&m>=50&&m<=a?(d(h,{height:m+"px"}),l.options.boundary.height+=p,d(l.elements.boundary,{height:l.options.boundary.height+"px"}),l.options.viewport.height+=p,d(l.elements.viewport,{height:l.options.viewport.height+"px"})):"h"===e&&f>=50&&f<=i&&(d(h,{width:f+"px"}),l.options.boundary.width+=u,d(l.elements.boundary,{width:l.options.boundary.width+"px"}),l.options.viewport.width+=u,d(l.elements.viewport,{width:l.options.viewport.width+"px"})),k.call(l),S.call(l),B.call(l),j.call(l),n=s,t=r}function f(){c=!1,window.removeEventListener("mousemove",p),window.removeEventListener("touchmove",p),window.removeEventListener("mouseup",f),window.removeEventListener("touchend",f),document.body.style[o]=""}m(h,"cr-resizer"),d(h,{width:this.options.viewport.width+"px",height:this.options.viewport.height+"px"}),this.options.resizeControls.height&&(m(r=document.createElement("div"),"cr-resizer-vertical"),h.appendChild(r)),this.options.resizeControls.width&&(m(s=document.createElement("div"),"cr-resizer-horisontal"),h.appendChild(s)),r&&(r.addEventListener("mousedown",u),r.addEventListener("touchstart",u)),s&&(s.addEventListener("mousedown",u),s.addEventListener("touchstart",u)),this.elements.boundary.appendChild(h)}function L(e){if(this.options.enableZoom){var t=this.elements.zoomer,n=Q(e,4);t.value=Math.max(parseFloat(t.min),Math.min(parseFloat(t.max),n)).toString()}}function M(){var e=this,t=e.elements.zoomerWrap=document.createElement("div"),n=e.elements.zoomer=document.createElement("input");function i(){T.call(e,{value:parseFloat(n.value),origin:new b(e.elements.preview),viewportRect:e.elements.viewport.getBoundingClientRect(),transform:y.parse(e.elements.preview)})}function o(t){var n,o;if("ctrl"===e.options.mouseWheelZoom&&!0!==t.ctrlKey)return 0;n=t.wheelDelta?t.wheelDelta/1200:t.deltaY?t.deltaY/1060:t.detail?t.detail/-60:0,o=e._currentZoom+n*e._currentZoom,t.preventDefault(),L.call(e,o),i.call(e)}m(t,"cr-slider-wrap"),m(n,"cr-slider"),n.type="range",n.step="0.0001",n.value="1",n.style.display=e.options.showZoomer?"":"none",n.setAttribute("aria-label","zoom"),e.element.appendChild(t),t.appendChild(n),e._currentZoom=1,e.elements.zoomer.addEventListener("input",i),e.elements.zoomer.addEventListener("change",i),e.options.mouseWheelZoom&&(e.elements.boundary.addEventListener("mousewheel",o),e.elements.boundary.addEventListener("DOMMouseScroll",o))}function T(e){var i=this,o=e?e.transform:y.parse(i.elements.preview),a=e?e.viewportRect:i.elements.viewport.getBoundingClientRect(),r=e?e.origin:new b(i.elements.preview);function s(){var e={};e[n]=o.toString(),e[t]=r.toString(),d(i.elements.preview,e)}if(i._currentZoom=e?e.value:i._currentZoom,o.scale=i._currentZoom,i.elements.zoomer.setAttribute("aria-valuenow",i._currentZoom),s(),i.options.enforceBoundary){var l=R.call(i,a),h=l.translate,c=l.origin;o.x>=h.maxX&&(r.x=c.minX,o.x=h.maxX),o.x<=h.minX&&(r.x=c.maxX,o.x=h.minX),o.y>=h.maxY&&(r.y=c.minY,o.y=h.maxY),o.y<=h.minY&&(r.y=c.maxY,o.y=h.minY)}s(),Y.call(i),j.call(i)}function R(e){var t=this._currentZoom,n=e.width,i=e.height,o=this.elements.boundary.clientWidth/2,a=this.elements.boundary.clientHeight/2,r=this.elements.preview.getBoundingClientRect(),s=r.width,l=r.height,h=n/2,c=i/2,u=-1*(h/t-o),p=-1*(c/t-a),d=1/t*h,m=1/t*c;return{translate:{maxX:u,minX:u-(s*(1/t)-n*(1/t)),maxY:p,minY:p-(l*(1/t)-i*(1/t))},origin:{maxX:s*(1/t)-d,minX:d,maxY:l*(1/t)-m,minY:m}}}function B(e){var i=this._currentZoom,o=this.elements.preview.getBoundingClientRect(),a=this.elements.viewport.getBoundingClientRect(),r=y.parse(this.elements.preview.style[n]),s=new b(this.elements.preview),l=a.top-o.top+a.height/2,h=a.left-o.left+a.width/2,c={},u={};if(e){var p=s.x,m=s.y,f=r.x,v=r.y;c.y=p,c.x=m,r.y=f,r.x=v}else c.y=l/i,c.x=h/i,u.y=(c.y-s.y)*(1-i),u.x=(c.x-s.x)*(1-i),r.x-=u.x,r.y-=u.y;var g={};g[t]=c.x+"px "+c.y+"px",g[n]=r.toString(),d(this.elements.preview,g)}function Z(){var e,t,i,a,r,s=this,l=!1;function h(e,t){var n=s.elements.preview.getBoundingClientRect(),i=r.y+t,o=r.x+e;s.options.enforceBoundary?(a.top>n.top+t&&a.bottom<n.bottom+t&&(r.y=i),a.left>n.left+e&&a.right<n.right+e&&(r.x=o)):(r.y=i,r.x=o)}function c(e){s.elements.preview.setAttribute("aria-grabbed",e),s.elements.boundary.setAttribute("aria-dropeffect",e?"move":"none")}function u(n){if((void 0===n.button||0===n.button)&&(n.preventDefault(),!l)){if(l=!0,e=n.pageX,t=n.pageY,n.touches){var i=n.touches[0];e=i.pageX,t=i.pageY}c(l),r=y.parse(s.elements.preview),window.addEventListener("mousemove",m),window.addEventListener("touchmove",m),window.addEventListener("mouseup",f),window.addEventListener("touchend",f),document.body.style[o]="none",a=s.elements.viewport.getBoundingClientRect()}}function m(o){o.preventDefault();var a=o.pageX,l=o.pageY;if(o.touches){var c=o.touches[0];a=c.pageX,l=c.pageY}var u=a-e,m=l-t,f={};if("touchmove"===o.type&&o.touches.length>1){var v=o.touches[0],g=o.touches[1],w=Math.sqrt((v.pageX-g.pageX)*(v.pageX-g.pageX)+(v.pageY-g.pageY)*(v.pageY-g.pageY));i||(i=w/s._currentZoom);var y=w/i;return L.call(s,y),void p(s.elements.zoomer)}h(u,m),f[n]=r.toString(),d(s.elements.preview,f),k.call(s),t=l,e=a}function f(){c(l=!1),window.removeEventListener("mousemove",m),window.removeEventListener("touchmove",m),window.removeEventListener("mouseup",f),window.removeEventListener("touchend",f),document.body.style[o]="",B.call(s),j.call(s),i=0}s.elements.overlay.addEventListener("mousedown",u),s.elements.viewport.addEventListener("keydown",(function(e){var t;if(!e.shiftKey||38!==e.keyCode&&40!==e.keyCode){if(s.options.enableKeyMovement&&e.keyCode>=37&&e.keyCode<=40){e.preventDefault();var l=function(e){switch(e){case 37:return[1,0];case 38:return[0,1];case 39:return[-1,0];case 40:return[0,-1]}}(e.keyCode);r=y.parse(s.elements.preview),document.body.style[o]="none",a=s.elements.viewport.getBoundingClientRect(),function(e){var t=e[0],a=e[1],l={};h(t,a),l[n]=r.toString(),d(s.elements.preview,l),k.call(s),document.body.style[o]="",B.call(s),j.call(s),i=0}(l)}}else t=38===e.keyCode?parseFloat(s.elements.zoomer.value)+parseFloat(s.elements.zoomer.step):parseFloat(s.elements.zoomer.value)-parseFloat(s.elements.zoomer.step),s.setZoom(t)})),s.elements.overlay.addEventListener("touchstart",u)}function k(){if(this.elements){var e=this.elements.boundary.getBoundingClientRect(),t=this.elements.preview.getBoundingClientRect();d(this.elements.overlay,{width:t.width+"px",height:t.height+"px",top:t.top-e.top+"px",left:t.left-e.left+"px"})}}b.prototype.toString=function(){return this.x+"px "+this.y+"px"};var F,z,O,X,Y=(F=k,z=500,function(){var e=this,t=arguments,n=function(){X=null,O||F.apply(e,t)},i=O&&!X;clearTimeout(X),X=setTimeout(n,z),i&&F.apply(e,t)});function j(){var e,t=this.get();A.call(this)&&(this.options.update.call(this,t),this.$&&"undefined"==typeof Prototype?this.$(this.element).trigger("update.croppie",t):(window.CustomEvent?e=new CustomEvent("update",{detail:t}):(e=document.createEvent("CustomEvent")).initCustomEvent("update",!0,!0,t),this.element.dispatchEvent(e)))}function A(){return this.elements.preview.offsetHeight>0&&this.elements.preview.offsetWidth>0}function W(){var e,i={},o=this.elements.preview,a=new y(0,0,1),r=new b;A.call(this)&&!this.data.bound&&(this.data.bound=!0,i[n]=a.toString(),i[t]=r.toString(),i.opacity=1,d(o,i),e=this.elements.preview.getBoundingClientRect(),this._originalImageWidth=e.width,this._originalImageHeight=e.height,this.data.orientation=x(this.elements.img),this.options.enableZoom?S.call(this,!0):this._currentZoom=1,a.scale=this._currentZoom,i[n]=a.toString(),d(o,i),this.data.points.length?H.call(this,this.data.points):N.call(this),B.call(this),k.call(this))}function S(e){var t,n,i,o,a=Math.max(this.options.minZoom,0)||0,r=this.options.maxZoom||1.5,s=this.elements.zoomer,l=parseFloat(s.value),h=this.elements.boundary.getBoundingClientRect(),c=g(this.elements.img,this.data.orientation),u=this.elements.viewport.getBoundingClientRect();this.options.enforceBoundary&&(i=u.width/c.width,o=u.height/c.height,a=Math.max(i,o)),a>=r&&(r=a+1),s.min=Q(a,4),s.max=Q(r,4),!e&&(l<s.min||l>s.max)?L.call(this,l<s.min?s.min:s.max):e&&(n=Math.max(h.width/c.width,h.height/c.height),t=null!==this.data.boundZoom?this.data.boundZoom:n,L.call(this,t)),p(s)}function H(e){if(4!==e.length)throw"Croppie - Invalid number of points supplied: "+e;var i=e[2]-e[0],o=this.elements.viewport.getBoundingClientRect(),a=this.elements.boundary.getBoundingClientRect(),r=o.left-a.left,s=o.top-a.top,l=o.width/i,h=e[1],c=e[0],u=-1*e[1]+s,p=-1*e[0]+r,m={};m[t]=c+"px "+h+"px",m[n]=new y(p,u,l).toString(),d(this.elements.preview,m),L.call(this,l),this._currentZoom=l}function N(){var e=this.elements.preview.getBoundingClientRect(),t=this.elements.viewport.getBoundingClientRect(),i=this.elements.boundary.getBoundingClientRect(),o=t.left-i.left,a=t.top-i.top,r=o-(e.width-t.width)/2,s=a-(e.height-t.height)/2,l=new y(r,s,this._currentZoom);d(this.elements.preview,n,l.toString())}function P(e){var t=this.elements.canvas,n=this.elements.img;t.getContext("2d").clearRect(0,0,t.width,t.height),t.width=n.width,t.height=n.height,C(t,n,this.options.enableOrientation&&e||x(n))}function D(e){var t=e.points,n=v(t[0]),i=v(t[1]),o=v(t[2])-n,a=v(t[3])-i,r=e.circle,s=document.createElement("canvas"),l=s.getContext("2d"),h=e.outputWidth||o,c=e.outputHeight||a;s.width=h,s.height=c,e.backgroundColor&&(l.fillStyle=e.backgroundColor,l.fillRect(0,0,h,c));var u=n,p=i,d=o,m=a,f=0,g=0,w=h,y=c;return n<0&&(u=0,f=Math.abs(n)/o*h),d+u>this._originalImageWidth&&(w=(d=this._originalImageWidth-u)/o*h),i<0&&(p=0,g=Math.abs(i)/a*c),m+p>this._originalImageHeight&&(y=(m=this._originalImageHeight-p)/a*c),l.drawImage(this.elements.preview,u,p,d,m,f,g,w,y),r&&(l.fillStyle="#fff",l.globalCompositeOperation="destination-in",l.beginPath(),l.arc(s.width/2,s.height/2,s.width/2,0,2*Math.PI,!0),l.closePath(),l.fill()),s}function q(e){var t=e.points,n=document.createElement("div"),i=document.createElement("img"),o=t[2]-t[0],a=t[3]-t[1];return m(n,"croppie-result"),n.appendChild(i),d(i,{left:-1*t[0]+"px",top:-1*t[1]+"px"}),i.src=e.url,d(n,{width:o+"px",height:a+"px"}),n}function $(e){return D.call(this,e).toDataURL(e.format,e.quality)}function K(e){var t=this;return new Promise((function(n){D.call(t,e).toBlob((function(e){n(e)}),e.format,e.quality)}))}function U(e){this.elements.img.parentNode&&(Array.prototype.forEach.call(this.elements.img.classList,(function(t){e.classList.add(t)})),this.elements.img.parentNode.replaceChild(e,this.elements.img),this.elements.preview=e),this.elements.img=e}function J(e,t){var n,i,o,a,r=this,s=[],l=null,h=_.call(r);if("string"==typeof e)n=e,e={};else if(Array.isArray(e))s=e.slice();else{if(void 0===e&&r.data.url)return W.call(r),j.call(r),null;n=e.url,s=e.points||[],l=void 0===e.zoom?null:e.zoom}return r.data.bound=!1,r.data.url=n||r.data.url,r.data.boundZoom=l,(i=n,o=h,a=new Image,a.style.opacity="0",new Promise((function(e,t){function n(){a.style.opacity="1",setTimeout((function(){e(a)}),1)}a.removeAttribute("crossOrigin"),i.match(/^https?:\/\/|^\/\//)&&a.setAttribute("crossOrigin","anonymous"),a.onload=function(){o?EXIF.getData(a,(function(){n()})):n()},a.onerror=function(e){a.style.opacity=1,setTimeout((function(){t(e)}),1)},a.src=i}))).then((function(n){if(U.call(r,n),s.length)r.options.relative&&(s=[s[0]*n.naturalWidth/100,s[1]*n.naturalHeight/100,s[2]*n.naturalWidth/100,s[3]*n.naturalHeight/100]);else{var i,o,a=g(n),l=r.elements.viewport.getBoundingClientRect(),h=l.width/l.height;a.width/a.height>h?i=(o=a.height)*h:(i=a.width,o=a.height/h);var c=(a.width-i)/2,u=(a.height-o)/2,p=c+i,d=u+o;r.data.points=[c,u,p,d]}r.data.points=s.map((function(e){return parseFloat(e)})),r.options.useCanvas&&P.call(r,e.orientation),W.call(r),j.call(r),t&&t()}))}function Q(e,t){return parseFloat(e).toFixed(t||0)}function G(){var e=this.elements.preview.getBoundingClientRect(),t=this.elements.viewport.getBoundingClientRect(),n=t.left-e.left,i=t.top-e.top,o=(t.width-this.elements.viewport.offsetWidth)/2,a=(t.height-this.elements.viewport.offsetHeight)/2,r=n+this.elements.viewport.offsetWidth+o,s=i+this.elements.viewport.offsetHeight+a,l=this._currentZoom;(l===1/0||isNaN(l))&&(l=1);var h=this.options.enforceBoundary?0:Number.NEGATIVE_INFINITY;return n=Math.max(h,n/l),i=Math.max(h,i/l),r=Math.max(h,r/l),s=Math.max(h,s/l),{points:[Q(n),Q(i),Q(r),Q(s)],zoom:l,orientation:this.data.orientation}}var V={type:"canvas",format:"png",quality:1},ee=["jpeg","webp","png"];function te(e){var t=this,n=G.call(t),i=c(u(V),u(e)),o="string"==typeof e?e:i.type||"base64",a=i.size||"viewport",r=i.format,s=i.quality,l=i.backgroundColor,h="boolean"==typeof i.circle?i.circle:"circle"===t.options.viewport.type,p=t.elements.viewport.getBoundingClientRect(),d=p.width/p.height;return"viewport"===a?(n.outputWidth=p.width,n.outputHeight=p.height):"object"==typeof a&&(a.width&&a.height?(n.outputWidth=a.width,n.outputHeight=a.height):a.width?(n.outputWidth=a.width,n.outputHeight=a.width/d):a.height&&(n.outputWidth=a.height*d,n.outputHeight=a.height)),ee.indexOf(r)>-1&&(n.format="image/"+r,n.quality=s),n.circle=h,n.url=t.data.url,n.backgroundColor=l,new Promise((function(e){switch(o.toLowerCase()){case"rawcanvas":e(D.call(t,n));break;case"canvas":case"base64":e($.call(t,n));break;case"blob":K.call(t,n).then(e);break;default:e(q.call(t,n))}}))}function ne(){W.call(this)}function ie(e){if(!this.options.useCanvas||!this.options.enableOrientation)throw"Croppie: Cannot rotate without enableOrientation && EXIF.js included";var t,n,i,o,a,r=this.elements.canvas;this.data.orientation=(t=this.data.orientation,n=e,i=s.indexOf(t)>-1?s:l,o=i.indexOf(t),a=n/90%i.length,i[(i.length+o+a%i.length)%i.length]),C(r,this.elements.img,this.data.orientation),B.call(this,!0),S.call(this)}function oe(){var e,t;this.element.removeChild(this.elements.boundary),e=this.element,t="croppie-container",e.classList?e.classList.remove(t):e.className=e.className.replace(t,""),this.options.enableZoom&&this.element.removeChild(this.elements.zoomerWrap),delete this.elements}if(window.jQuery){var ae=window.jQuery;ae.fn.croppie=function(e){var t=typeof e;if("string"===t){var n=Array.prototype.slice.call(arguments,1),i=ae(this).data("croppie");return"get"===e?i.get():"result"===e?i.result.apply(i,n):"bind"===e?i.bind.apply(i,n):this.each((function(){var t=ae(this).data("croppie");if(t){var i=t[e];if(!ae.isFunction(i))throw"Croppie "+e+" method not found";i.apply(t,n),"destroy"===e&&ae(this).removeData("croppie")}}))}return this.each((function(){var t=new re(this,e);t.$=ae,ae(this).data("croppie",t)}))}}function re(e,t){if(e.className.indexOf("croppie-container")>-1)throw new Error("Croppie: Can't initialize croppie more than once");if(this.element=e,this.options=c(u(re.defaults),t),"img"===this.element.tagName.toLowerCase()){var n=this.element;m(n,"cr-original-image"),f(n,{"aria-hidden":"true",alt:""});var i=document.createElement("div");this.element.parentNode.appendChild(i),i.appendChild(n),this.element=i,this.options.url=this.options.url||n.src}if(E.call(this),this.options.url){var o={url:this.options.url,points:this.options.points};delete this.options.url,delete this.options.points,J.call(this,o)}}return re.defaults={viewport:{width:100,height:100,type:"square"},boundary:{},orientationControls:{enabled:!0,leftClass:"",rightClass:""},resizeControls:{width:!0,height:!0},customClass:"",showZoomer:!0,enableZoom:!0,enableResize:!1,mouseWheelZoom:!0,enableExif:!1,enforceBoundary:!0,enableOrientation:!1,enableKeyMovement:!0,update:function(){}},re.globals={translate:"translate3d"},c(re.prototype,{bind:function(e,t){return J.call(this,e,t)},get:function(){var e=G.call(this),t=e.points;return this.options.relative&&(t[0]/=this.elements.img.naturalWidth/100,t[1]/=this.elements.img.naturalHeight/100,t[2]/=this.elements.img.naturalWidth/100,t[3]/=this.elements.img.naturalHeight/100),e},result:function(e){return te.call(this,e)},refresh:function(){return ne.call(this)},setZoom:function(e){L.call(this,e),p(this.elements.zoomer)},rotate:function(e){ie.call(this,e)},destroy:function(){return oe.call(this)}}),re})?o.call(t,n,t,e):o)||(e.exports=a)}).call(this,n(313).setImmediate)},313:function(e,t,n){(function(e){var i=void 0!==e&&e||"undefined"!=typeof self&&self||window,o=Function.prototype.apply;function a(e,t){this._id=e,this._clearFn=t}t.setTimeout=function(){return new a(o.call(setTimeout,i,arguments),clearTimeout)},t.setInterval=function(){return new a(o.call(setInterval,i,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(e){e&&e.close()},a.prototype.unref=a.prototype.ref=function(){},a.prototype.close=function(){this._clearFn.call(i,this._id)},t.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},t.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},t._unrefActive=t.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout((function(){e._onTimeout&&e._onTimeout()}),t))},n(314),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||this&&this.clearImmediate}).call(this,n(190))},314:function(e,t,n){(function(e,t){!function(e,n){"use strict";if(!e.setImmediate){var i,o,a,r,s,l=1,h={},c=!1,u=e.document,p=Object.getPrototypeOf&&Object.getPrototypeOf(e);p=p&&p.setTimeout?p:e,"[object process]"==={}.toString.call(e.process)?i=function(e){t.nextTick((function(){m(e)}))}:!function(){if(e.postMessage&&!e.importScripts){var t=!0,n=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=n,t}}()?e.MessageChannel?((a=new MessageChannel).port1.onmessage=function(e){m(e.data)},i=function(e){a.port2.postMessage(e)}):u&&"onreadystatechange"in u.createElement("script")?(o=u.documentElement,i=function(e){var t=u.createElement("script");t.onreadystatechange=function(){m(e),t.onreadystatechange=null,o.removeChild(t),t=null},o.appendChild(t)}):i=function(e){setTimeout(m,0,e)}:(r="setImmediate$"+Math.random()+"$",s=function(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(r)&&m(+t.data.slice(r.length))},e.addEventListener?e.addEventListener("message",s,!1):e.attachEvent("onmessage",s),i=function(t){e.postMessage(r+t,"*")}),p.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),n=0;n<t.length;n++)t[n]=arguments[n+1];var o={callback:e,args:t};return h[l]=o,i(l),l++},p.clearImmediate=d}function d(e){delete h[e]}function m(e){if(c)setTimeout(m,0,e);else{var t=h[e];if(t){c=!0;try{!function(e){var t=e.callback,n=e.args;switch(n.length){case 0:t();break;case 1:t(n[0]);break;case 2:t(n[0],n[1]);break;case 3:t(n[0],n[1],n[2]);break;default:t.apply(void 0,n)}}(t)}finally{d(e),c=!1}}}}}("undefined"==typeof self?void 0===e?this:e:self)}).call(this,n(190),n(85))},315:function(e,t,n){}}]);
//# sourceMappingURL=6.2da507ad3650a1b3e6e0.js.map