SHARE
TWEET

Untitled

a guest Nov 14th, 2017 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. !function(a,b){"function"===typeof define&&define.amd?define(["exports"],b):b("object"===typeof exports&&"string"!==typeof exports.nodeName?exports:a.commonJsStrict={})}(this,function(a){function g(a){if(a in c)return a;for(var d=a[0].toUpperCase()+a.slice(1),e=b.length;e--;)if(a=b[e]+d,a in c)return a}function h(a,b){a=a||{};for(var c in b)b[c]&&b[c].constructor&&b[c].constructor===Object?(a[c]=a[c]||{},h(a[c],b[c])):a[c]=b[c];return a}function i(a,b,c){var d;return function(){var e=this,f=arguments,g=function(){d=null,c||a.apply(e,f)},h=c&&!d;clearTimeout(d),d=setTimeout(g,b),h&&a.apply(e,f)}}function j(a){if("createEvent"in document){var b=document.createEvent("HTMLEvents");b.initEvent("change",!1,!0),a.dispatchEvent(b)}else a.fireEvent("onchange")}function k(a,b,c){if("string"===typeof b){var d=b;b={},b[d]=c}for(var e in b)a.style[e]=b[e]}function l(a,b){a.classList?a.classList.add(b):a.className+=" "+b}function m(a,b){a.classList?a.classList.remove(b):a.className=a.className.replace(b,"")}function n(a,b){for(var c in b)a.setAttribute(c,b[c])}function o(a){return parseInt(a,10)}function p(a,b,c){var d=b||new Image;return d.style.opacity=0,new Promise(function(b){function e(){setTimeout(function(){b(d)},1)}return d.src===a?void e():(d.exifdata=null,d.removeAttribute("crossOrigin"),a.match(/^https?:\/\/|^\/\//)&&d.setAttribute("crossOrigin","anonymous"),d.onload=function(){c?EXIF.getData(d,function(){e()}):e()},void(d.src=a))})}function q(a){var b=a.naturalWidth,c=a.naturalHeight;if(a.exifdata&&a.exifdata.Orientation>=5){var d=b;b=c,c=d}return{width:b,height:c}}function u(a){return a.exifdata.Orientation}function v(a,b,c){var d=b.width,e=b.height,f=a.getContext("2d");switch(a.width=b.width,a.height=b.height,f.save(),c){case 2:f.translate(d,0),f.scale(-1,1);break;case 3:f.translate(d,e),f.rotate(180*Math.PI/180);break;case 4:f.translate(0,e),f.scale(1,-1);break;case 5:a.width=e,a.height=d,f.rotate(90*Math.PI/180),f.scale(1,-1);break;case 6:a.width=e,a.height=d,f.rotate(90*Math.PI/180),f.translate(0,-e);break;case 7:a.width=e,a.height=d,f.rotate(-90*Math.PI/180),f.translate(-d,e),f.scale(1,-1);break;case 8:a.width=e,a.height=d,f.translate(0,d),f.rotate(-90*Math.PI/180)}f.drawImage(b,0,0,d,e),f.restore()}function w(){var d,e,f,g,h,i,a=this,b="croppie-container",c=a.options.viewport.type?"cr-vp-"+a.options.viewport.type:null;a.options.useCanvas=a.options.enableOrientation||x.call(a),a.data={},a.elements={},d=a.elements.boundary=document.createElement("div"),f=a.elements.viewport=document.createElement("div"),e=a.elements.img=document.createElement("img"),g=a.elements.overlay=document.createElement("div"),a.options.useCanvas?(a.elements.canvas=document.createElement("canvas"),a.elements.preview=a.elements.canvas):a.elements.preview=a.elements.img,l(d,"cr-boundary"),d.setAttribute("aria-dropeffect","none"),h=a.options.boundary.width,i=a.options.boundary.height,k(d,{width:h+(isNaN(h)?"":"px"),height:i+(isNaN(i)?"":"px")}),l(f,"cr-viewport"),c&&l(f,c),k(f,{width:a.options.viewport.width+"px",height:a.options.viewport.height+"px"}),f.setAttribute("tabindex",0),l(a.elements.preview,"cr-image"),n(a.elements.preview,{alt:"preview","aria-grabbed":"false"}),l(g,"cr-overlay"),a.element.appendChild(d),d.appendChild(a.elements.preview),d.appendChild(f),d.appendChild(g),l(a.element,b),a.options.customClass&&l(a.element,a.options.customClass),E.call(this),a.options.enableZoom&&A.call(a),a.options.enableResize&&y.call(a)}function x(){return this.options.enableExif&&window.EXIF}function y(){function o(b){if((void 0===b.button||0===b.button)&&(b.preventDefault(),!c)){var h=a.elements.overlay.getBoundingClientRect();if(c=!0,e=b.pageX,g=b.pageY,d=-1!==b.currentTarget.className.indexOf("vertical")?"v":"h",i=h.width,j=h.height,b.touches){var k=b.touches[0];e=k.pageX,g=k.pageY}window.addEventListener("mousemove",p),window.addEventListener("touchmove",p),window.addEventListener("mouseup",q),window.addEventListener("touchend",q),document.body.style[f]="none"}}function p(c){var f=c.pageX,l=c.pageY;if(c.preventDefault(),c.touches){var m=c.touches[0];f=m.pageX,l=m.pageY}var n=f-e,o=l-g,p=a.options.viewport.height+o,q=a.options.viewport.width+n;"v"===d&&p>=h&&p<=j?(k(b,{height:p+"px"}),a.options.boundary.height+=o,k(a.elements.boundary,{height:a.options.boundary.height+"px"}),a.options.viewport.height+=o,k(a.elements.viewport,{height:a.options.viewport.height+"px"})):"h"===d&&q>=h&&q<=i&&(k(b,{width:q+"px"}),a.options.boundary.width+=n,k(a.elements.boundary,{width:a.options.boundary.width+"px"}),a.options.viewport.width+=n,k(a.elements.viewport,{width:a.options.viewport.width+"px"})),F.call(a),K.call(a),D.call(a),H.call(a),g=l,e=f}function q(){c=!1,window.removeEventListener("mousemove",p),window.removeEventListener("touchmove",p),window.removeEventListener("mouseup",q),window.removeEventListener("touchend",q),document.body.style[f]=""}var d,e,g,i,j,m,n,a=this,b=document.createElement("div"),c=!1,h=50;l(b,"cr-resizer"),k(b,{width:this.options.viewport.width+"px",height:this.options.viewport.height+"px"}),this.options.resizeControls.height&&(m=document.createElement("div"),l(m,"cr-resizer-vertical"),b.appendChild(m)),this.options.resizeControls.width&&(n=document.createElement("div"),l(n,"cr-resizer-horisontal"),b.appendChild(n)),m&&m.addEventListener("mousedown",o),n&&n.addEventListener("mousedown",o),this.elements.boundary.appendChild(b)}function z(a){if(this.options.enableZoom){var b=this.elements.zoomer,c=T(a,4);b.value=Math.max(b.min,Math.min(b.max,c))}}function A(){function d(){B.call(a,{value:parseFloat(c.value),origin:new t(a.elements.preview),viewportRect:a.elements.viewport.getBoundingClientRect(),transform:s.parse(a.elements.preview)})}function e(b){var c,e;c=b.wheelDelta?b.wheelDelta/1200:b.deltaY?b.deltaY/1060:b.detail?b.detail/-60:0,e=a._currentZoom+c*a._currentZoom,b.preventDefault(),z.call(a,e),d.call(a)}var a=this,b=a.elements.zoomerWrap=document.createElement("div"),c=a.elements.zoomer=document.createElement("input");l(b,"cr-slider-wrap"),l(c,"cr-slider"),c.type="range",c.step="0.0001",c.value=1,c.style.display=a.options.showZoomer?"":"none",c.setAttribute("aria-label","zoom"),a.element.appendChild(b),b.appendChild(c),a._currentZoom=1,a.elements.zoomer.addEventListener("input",d),a.elements.zoomer.addEventListener("change",d),a.options.mouseWheelZoom&&(a.elements.boundary.addEventListener("mousewheel",e),a.elements.boundary.addEventListener("DOMMouseScroll",e))}function B(a){function h(){var a={};a[e]=c.toString(),a[d]=g.toString(),k(b.elements.preview,a)}var b=this,c=a?a.transform:s.parse(b.elements.preview),f=a?a.viewportRect:b.elements.viewport.getBoundingClientRect(),g=a?a.origin:new t(b.elements.preview);if(b._currentZoom=a?a.value:b._currentZoom,c.scale=b._currentZoom,b.elements.zoomer.setAttribute("aria-valuenow",b._currentZoom),h(),b.options.enforceBoundary){var i=C.call(b,f),j=i.translate,l=i.origin;c.x>=j.maxX&&(g.x=l.minX,c.x=j.maxX),c.x<=j.minX&&(g.x=l.maxX,c.x=j.minX),c.y>=j.maxY&&(g.y=l.minY,c.y=j.maxY),c.y<=j.minY&&(g.y=l.maxY,c.y=j.minY)}h(),G.call(b),H.call(b)}function C(a){var b=this,c=b._currentZoom,d=a.width,e=a.height,f=b.elements.boundary.clientWidth/2,g=b.elements.boundary.clientHeight/2,h=b.elements.preview.getBoundingClientRect(),i=h.width,j=h.height,k=d/2,l=e/2,m=-1*(k/c-f),n=m-(i*(1/c)-d*(1/c)),o=-1*(l/c-g),p=o-(j*(1/c)-e*(1/c)),q=1/c*k,r=i*(1/c)-q,s=1/c*l,t=j*(1/c)-s;return{translate:{maxX:m,minX:n,maxY:o,minY:p},origin:{maxX:r,minX:q,maxY:t,minY:s}}}function D(){var a=this,b=a._currentZoom,c=a.elements.preview.getBoundingClientRect(),f=a.elements.viewport.getBoundingClientRect(),g=s.parse(a.elements.preview.style[e]),h=new t(a.elements.preview),i=f.top-c.top+f.height/2,j=f.left-c.left+f.width/2,l={},m={};l.y=i/b,l.x=j/b,m.y=(l.y-h.y)*(1-b),m.x=(l.x-h.x)*(1-b),g.x-=m.x,g.y-=m.y;var n={};n[d]=l.x+"px "+l.y+"px",n[e]=g.toString(),k(a.elements.preview,n)}function E(){function l(b,c){var d=a.elements.preview.getBoundingClientRect(),e=i.y+c,f=i.x+b;a.options.enforceBoundary?(h.top>d.top+c&&h.bottom<d.bottom+c&&(i.y=e),h.left>d.left+b&&h.right<d.right+b&&(i.x=f)):(i.y=e,i.x=f)}function m(b){a.elements.preview.setAttribute("aria-grabbed",b),a.elements.boundary.setAttribute("aria-dropeffect",b?"move":"none")}function n(b){function l(a){switch(a){case c:return[1,0];case d:return[0,1];case e:return[-1,0];case g:return[0,-1]}}var c=37,d=38,e=39,g=40;if(!b.shiftKey||b.keyCode!=d&&b.keyCode!=g){if(a.options.enableKeyMovement&&b.keyCode>=37&&b.keyCode<=40){b.preventDefault();var k=l(b.keyCode);i=s.parse(a.elements.preview),document.body.style[f]="none",h=a.elements.viewport.getBoundingClientRect(),o(k)}}else{var j=0;j=b.keyCode==d?parseFloat(a.elements.zoomer.value,10)+parseFloat(a.elements.zoomer.step,10):parseFloat(a.elements.zoomer.value,10)-parseFloat(a.elements.zoomer.step,10),a.setZoom(j)}}function o(b){var c=b[0],d=b[1],h={};l(c,d),h[e]=i.toString(),k(a.elements.preview,h),F.call(a),document.body.style[f]="",D.call(a),H.call(a),g=0}function p(e){if((void 0===e.button||0===e.button)&&(e.preventDefault(),!b)){if(b=!0,c=e.pageX,d=e.pageY,e.touches){var g=e.touches[0];c=g.pageX,d=g.pageY}m(b),i=s.parse(a.elements.preview),window.addEventListener("mousemove",q),window.addEventListener("touchmove",q),window.addEventListener("mouseup",r),window.addEventListener("touchend",r),document.body.style[f]="none",h=a.elements.viewport.getBoundingClientRect()}}function q(b){b.preventDefault();var f=b.pageX,h=b.pageY;if(b.touches){var m=b.touches[0];f=m.pageX,h=m.pageY}var n=f-c,o=h-d,p={};if("touchmove"==b.type&&b.touches.length>1){var q=b.touches[0],r=b.touches[1],s=Math.sqrt((q.pageX-r.pageX)*(q.pageX-r.pageX)+(q.pageY-r.pageY)*(q.pageY-r.pageY));g||(g=s/a._currentZoom);var t=s/g;return z.call(a,t),void j(a.elements.zoomer)}l(n,o),p[e]=i.toString(),k(a.elements.preview,p),F.call(a),d=h,c=f}function r(){b=!1,m(b),window.removeEventListener("mousemove",q),window.removeEventListener("touchmove",q),window.removeEventListener("mouseup",r),window.removeEventListener("touchend",r),document.body.style[f]="",D.call(a),H.call(a),g=0}var c,d,g,h,i,a=this,b=!1;a.elements.overlay.addEventListener("mousedown",p),a.elements.viewport.addEventListener("keydown",n),a.elements.overlay.addEventListener("touchstart",p)}function F(){var a=this,b=a.elements.boundary.getBoundingClientRect(),c=a.elements.preview.getBoundingClientRect();k(a.elements.overlay,{width:c.width+"px",height:c.height+"px",top:c.top-b.top+"px",left:c.left-b.left+"px"})}function H(){var c,a=this,b=a.get();if(I.call(a))if(a.options.update.call(a,b),a.$&&"undefined"==typeof Prototype)a.$(a.element).trigger("update",b);else{var c;window.CustomEvent?c=new CustomEvent("update",{detail:b}):(c=document.createEvent("CustomEvent"),c.initCustomEvent("update",!0,!0,b)),a.element.dispatchEvent(c)}}function I(){return this.elements.preview.offsetHeight>0&&this.elements.preview.offsetWidth>0}function J(){var a=this,b=1,c={},f=a.elements.preview,g=null,h=new s(0,0,b),i=new t,j=I.call(a);j&&!a.data.bound&&(a.data.bound=!0,c[e]=h.toString(),c[d]=i.toString(),c.opacity=1,k(f,c),g=a.elements.preview.getBoundingClientRect(),a._originalImageWidth=g.width,a._originalImageHeight=g.height,a.options.enableZoom?K.call(a,!0):a._currentZoom=b,h.scale=a._currentZoom,c[e]=h.toString(),k(f,c),a.data.points.length?L.call(a,a.data.points):M.call(a),D.call(a),F.call(a))}function K(a){var e,f,m,n,b=this,c=0,d=1.5,g=b.elements.zoomer,h=parseFloat(g.value),i=b.elements.boundary.getBoundingClientRect(),k=b.elements.preview.getBoundingClientRect(),l=b.elements.viewport.getBoundingClientRect();b.options.enforceBoundary&&(m=l.width/(a?k.width:k.width/h),n=l.height/(a?k.height:k.height/h),c=Math.max(m,n)),c>=d&&(d=c+1),g.min=T(c,4),g.max=T(d,4),a&&(f=Math.max(i.width/k.width,i.height/k.height),e=null!==b.data.boundZoom?b.data.boundZoom:f,z.call(b,e)),j(g)}function L(a){if(4!=a.length)throw"Croppie - Invalid number of points supplied: "+a;var b=this,c=a[2]-a[0],f=b.elements.viewport.getBoundingClientRect(),g=b.elements.boundary.getBoundingClientRect(),h={left:f.left-g.left,top:f.top-g.top},i=f.width/c,j=a[1],l=a[0],m=-1*a[1]+h.top,n=-1*a[0]+h.left,o={};o[d]=l+"px "+j+"px",o[e]=new s(n,m,i).toString(),k(b.elements.preview,o),z.call(b,i),b._currentZoom=i}function M(){var a=this,b=a.elements.preview.getBoundingClientRect(),c=a.elements.viewport.getBoundingClientRect(),d=a.elements.boundary.getBoundingClientRect(),f=c.left-d.left,g=c.top-d.top,h=f-(b.width-c.width)/2,i=g-(b.height-c.height)/2,j=new s(h,i,a._currentZoom);k(a.elements.preview,e,j.toString())}function N(a){var b=this,c=b.elements.canvas,d=b.elements.img,e=c.getContext("2d"),f=x.call(b),a=b.options.enableOrientation&&a;if(e.clearRect(0,0,c.width,c.height),c.width=d.width,c.height=d.height,f&&!a){var g=u(d);v(c,d,o(g||0,10))}else a&&v(c,d,a)}function O(a){var b=this,c=a.points,d=o(c[0]),e=o(c[1]),f=o(c[2]),g=o(c[3]),h=f-d,i=g-e,j=a.circle,k=document.createElement("canvas"),l=k.getContext("2d"),m=h,n=i,p=0,q=0,r=m,s=n,t=a.outputWidth&&a.outputHeight,u=1,v=1;return t&&(r=a.outputWidth,s=a.outputHeight,u=r/m,v=s/n),k.width=r,k.height=s,a.backgroundColor&&(l.fillStyle=a.backgroundColor,l.fillRect(0,0,r,s)),b.options.enforceBoundary?(h=Math.min(h,b._originalImageWidth),i=Math.min(i,b._originalImageHeight)):(d<0&&(p=Math.abs(d),d=0),e<0&&(q=Math.abs(e),e=0),f>b._originalImageWidth&&(h=b._originalImageWidth-d,m=h),g>b._originalImageHeight&&(i=b._originalImageHeight-e,n=i)),(1!==u||1!==v)&&(p*=u,q*=v,m*=u,n*=v),l.drawImage(this.elements.preview,d,e,h,i,p,q,m,n),j&&(l.fillStyle="#fff",l.globalCompositeOperation="destination-in",l.beginPath(),l.arc(m/2,n/2,m/2,0,2*Math.PI,!0),l.closePath(),l.fill()),k}function P(a){var b=a.points,c=document.createElement("div"),d=document.createElement("img"),e=b[2]-b[0],f=b[3]-b[1];return l(c,"croppie-result"),c.appendChild(d),k(d,{left:-1*b[0]+"px",top:-1*b[1]+"px"}),d.src=a.url,k(c,{width:e+"px",height:f+"px"}),c}function Q(a){return O.call(this,a).toDataURL(a.format,a.quality)}function R(a){var b=this;return new Promise(function(c){O.call(b,a).toBlob(function(a){c(a)},a.format,a.quality)})}function S(a,b){var d,c=this,e=[],f=null,g=x.call(c);if("string"===typeof a)d=a,a={};else if(Array.isArray(a))e=a.slice();else{if("undefined"==typeof a&&c.data.url)return J.call(c),H.call(c),null;d=a.url,e=a.points||[],f="undefined"===typeof a.zoom?null:a.zoom}return c.data.bound=!1,c.data.url=d||c.data.url,c.data.boundZoom=f,p(d,c.elements.img,g).then(function(d){if(e.length)c.options.relative&&(e=[e[0]*d.naturalWidth/100,e[1]*d.naturalHeight/100,e[2]*d.naturalWidth/100,e[3]*d.naturalHeight/100]);else{var j,k,f=q(d),g=c.elements.viewport.getBoundingClientRect(),h=g.width/g.height,i=f.width/f.height;i>h?(k=f.height,j=k*h):(j=f.width,k=j/h);var l=(f.width-j)/2,m=(f.height-k)/2,n=l+j,o=m+k;c.data.points=[l,m,n,o]}c.data.points=e.map(function(a){return parseFloat(a)}),c.options.useCanvas&&N.call(c,a.orientation||1),J.call(c),H.call(c),b&&b()})}function T(a,b){return parseFloat(a).toFixed(b||0)}function U(){var a=this,b=a.elements.preview.getBoundingClientRect(),c=a.elements.viewport.getBoundingClientRect(),d=c.left-b.left,e=c.top-b.top,f=(c.width-a.elements.viewport.offsetWidth)/2,g=(c.height-a.elements.viewport.offsetHeight)/2,h=d+a.elements.viewport.offsetWidth+f,i=e+a.elements.viewport.offsetHeight+g,j=a._currentZoom;(1/0===j||isNaN(j))&&(j=1);var k=a.options.enforceBoundary?0:Number.NEGATIVE_INFINITY;return d=Math.max(k,d/j),e=Math.max(k,e/j),h=Math.max(k,h/j),i=Math.max(k,i/j),{points:[T(d),T(e),T(h),T(i)],zoom:j}}function X(a){var n,b=this,c=U.call(b),d=h(V,h({},a)),e="string"===typeof a?a:d.type||"base64",f=d.size||"viewport",g=d.format,i=d.quality,j=d.backgroundColor,k="boolean"===typeof d.circle?d.circle:"circle"===b.options.viewport.type,l=b.elements.viewport.getBoundingClientRect(),m=l.width/l.height;return"viewport"===f?(c.outputWidth=l.width,c.outputHeight=l.height):"object"===typeof f&&(f.width&&f.height?(c.outputWidth=f.width,c.outputHeight=f.height):f.width?(c.outputWidth=f.width,c.outputHeight=f.width/m):f.height&&(c.outputWidth=f.height*m,c.outputHeight=f.height)),W.indexOf(g)>-1&&(c.format="image/"+g,c.quality=i),c.circle=k,c.url=b.data.url,c.backgroundColor=j,n=new Promise(function(a){switch(e.toLowerCase()){case"rawcanvas":a(O.call(b,c));break;case"canvas":case"base64":a(Q.call(b,c));break;case"blob":R.call(b,c).then(a);break;default:a(P.call(b,c))}})}function Y(){J.call(this)}function Z(a){if(!this.options.useCanvas)throw"Croppie: Cannot rotate without enableOrientation";var b=this,c=b.elements.canvas,d=document.createElement("canvas"),e=1;d.width=c.width,d.height=c.height;var f=d.getContext("2d");f.drawImage(c,0,0),(90===a||-270===a)&&(e=6),(-90===a||270===a)&&(e=8),(180===a||-180===a)&&(e=3),v(c,d,e),B.call(b),d=null}function $(){var a=this;a.element.removeChild(a.elements.boundary),m(a.element,"croppie-container"),a.options.enableZoom&&a.element.removeChild(a.elements.zoomerWrap),delete a.elements}function ab(a,b){if(this.element=a,this.options=h(h({},ab.defaults),b),"img"===this.element.tagName.toLowerCase()){var c=this.element;l(c,"cr-original-image"),n(c,{"aria-hidden":"true",alt:""});var d=document.createElement("div");this.element.parentNode.appendChild(d),d.appendChild(c),this.element=d,this.options.url=this.options.url||c.src}if(w.call(this),this.options.url){var e={url:this.options.url,points:this.options.points};delete this.options.url,delete this.options.points,S.call(this,e)}}"function"!==typeof Promise&&!function(a){function b(a,b){return function(){a.apply(b,arguments)}}function c(a){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof a)throw new TypeError("not a function");this._state=null,this._value=null,this._deferreds=[],i(a,b(e,this),b(f,this))}function d(a){var b=this;return null===this._state?void this._deferreds.push(a):void k(function(){var c=b._state?a.onFulfilled:a.onRejected;if(null===c)return void(b._state?a.resolve:a.reject)(b._value);var d;try{d=c(b._value)}catch(e){return void a.reject(e)}a.resolve(d)})}function e(a){try{if(a===this)throw new TypeError("A promise cannot be resolved with itself.");if(a&&("object"==typeof a||"function"==typeof a)){var c=a.then;if("function"==typeof c)return void i(b(c,a),b(e,this),b(f,this))}this._state=!0,this._value=a,g.call(this)}catch(d){f.call(this,d)}}function f(a){this._state=!1,this._value=a,g.call(this)}function g(){for(var a=0,b=this._deferreds.length;b>a;a++)d.call(this,this._deferreds[a]);this._deferreds=null}function h(a,b,c,d){this.onFulfilled="function"==typeof a?a:null,this.onRejected="function"==typeof b?b:null,this.resolve=c,this.reject=d}function i(a,b,c){var d=!1;try{a(function(a){d||(d=!0,b(a))},function(a){d||(d=!0,c(a))})}catch(e){if(d)return;d=!0,c(e)}}var j=setTimeout,k="function"==typeof setImmediate&&setImmediate||function(a){j(a,1)},l=Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)};c.prototype["catch"]=function(a){return this.then(null,a)},c.prototype.then=function(a,b){var e=this;return new c(function(c,f){d.call(e,new h(a,b,c,f))})},c.all=function(){var a=Array.prototype.slice.call(1===arguments.length&&l(arguments[0])?arguments[0]:arguments);return new c(function(b,c){function d(f,g){try{if(g&&("object"==typeof g||"function"==typeof g)){var h=g.then;if("function"==typeof h)return void h.call(g,function(a){d(f,a)},c)}a[f]=g,0===--e&&b(a)}catch(i){c(i)}}if(0===a.length)return b([]);for(var e=a.length,f=0;f<a.length;f++)d(f,a[f])})},c.resolve=function(a){return a&&"object"==typeof a&&a.constructor===c?a:new c(function(b){b(a)})},c.reject=function(a){return new c(function(b,c){c(a)})},c.race=function(a){return new c(function(b,c){for(var d=0,e=a.length;e>d;d++)a[d].then(b,c)})},c._setImmediateFn=function(a){k=a},"undefined"!=typeof module&&module.exports?module.exports=c:a.Promise||(a.Promise=c)}(this),"function"!==typeof window.CustomEvent&&!function(){function a(a,b){b=b||{bubbles:!1,cancelable:!1,detail:void 0};var c=document.createEvent("CustomEvent");return c.initCustomEvent(a,b.bubbles,b.cancelable,b.detail),c}a.prototype=window.Event.prototype,window.CustomEvent=a}(),HTMLCanvasElement.prototype.toBlob||Object.defineProperty(HTMLCanvasElement.prototype,"toBlob",{value:function(a,b,c){for(var d=atob(this.toDataURL(b,c).split(",")[1]),e=d.length,f=new Uint8Array(e),g=0;g<e;g++)f[g]=d.charCodeAt(g);a(new Blob([f],{type:b||"image/png"}))}});var d,e,f,b=["Webkit","Moz","ms"],c=document.createElement("div").style;e=g("transform"),d=g("transformOrigin"),f=g("userSelect");var r={translate3d:{suffix:", 0px"},translate:{suffix:""}},s=function(a,b,c){this.x=parseFloat(a),this.y=parseFloat(b),this.scale=parseFloat(c)};s.parse=function(a){return a.style?s.parse(a.style[e]):a.indexOf("matrix")>-1||a.indexOf("none")>-1?s.fromMatrix(a):s.fromString(a)},s.fromMatrix=function(a){var b=a.substring(7).split(",");return b.length&&"none"!==a||(b=[1,0,0,1,0,0]),new s(o(b[4]),o(b[5]),parseFloat(b[0]))},s.fromString=function(a){var b=a.split(") "),c=b[0].substring(ab.globals.translate.length+1).split(","),d=b.length>1?b[1].substring(6):1,e=c.length>1?c[0]:0,f=c.length>1?c[1]:0;return new s(e,f,d)},s.prototype.toString=function(){var a=r[ab.globals.translate].suffix||"";return ab.globals.translate+"("+this.x+"px, "+this.y+"px"+a+") scale("+this.scale+")"};var t=function(a){if(!a||!a.style[d])return this.x=0,void(this.y=0);var b=a.style[d].split(" ");this.x=parseFloat(b[0]),this.y=parseFloat(b[1])};t.prototype.toString=function(){return this.x+"px "+this.y+"px"};var G=i(F,500),V={type:"canvas",format:"png",quality:1},W=["jpeg","webp","png"];if(window.jQuery){var _=window.jQuery;_.fn.croppie=function(a){var b=typeof a;if("string"===b){var c=Array.prototype.slice.call(arguments,1),d=_(this).data("croppie");return"get"===a?d.get():"result"===a?d.result.apply(d,c):"bind"===a?d.bind.apply(d,c):this.each(function(){var b=_(this).data("croppie");if(b){var d=b[a];if(!_.isFunction(d))throw"Croppie "+a+" method not found";d.apply(b,c),"destroy"===a&&_(this).removeData("croppie")}})}return this.each(function(){var b=new ab(this,a);b.$=_,_(this).data("croppie",b)})}}ab.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(){}},ab.globals={translate:"translate3d"},h(ab.prototype,{bind:function(a,b){return S.call(this,a,b)},get:function(){var a=U.call(this),b=a.points;return this.options.relative&&(b[0]/=this.elements.img.naturalWidth/100,b[1]/=this.elements.img.naturalHeight/100,b[2]/=this.elements.img.naturalWidth/100,b[3]/=this.elements.img.naturalHeight/100),a},result:function(a){return X.call(this,a)},refresh:function(){return Y.call(this)},setZoom:function(a){z.call(this,a),j(this.elements.zoomer)},rotate:function(a){Z.call(this,a)},destroy:function(){return $.call(this)}}),a.Croppie=window.Croppie=ab,"object"===typeof module&&module.exports&&(module.exports=ab)});
RAW Paste Data
Top