text: !function(t){"function"==typeof define&&define.amd?define(["jquery"],t):t(jQuery)}(function(t){"use strict";var e=t(window),i=t(document),h=!0,a=!1,s=null,r=0/0,n=1/0,o="undefined",d="directive",g=".cropper",l=/^(e|n|w|s|ne|nw|sw|se|all|crop|move|zoom)$/,c=/^(x|y|width|height)$/,p=/^(naturalWidth|naturalHeight|width|height|aspectRatio|ratio)$/,u="cropper-modal",f="cropper-hidden",m="cropper-invisible",v="cropper-move",w="cropper-crop",x="cropper-disabled",b="mousedown touchstart",y="mousemove touchmove",$="mouseup mouseleave touchend touchleave touchcancel",D="wheel mousewheel DOMMouseScroll",W="resize"+g,H="dblclick",C="build"+g,k="built"+g,R="dragstart"+g,z="dragmove"+g,L="dragend"+g,Y=function(t){return"number"==typeof t},X=function(e,i){this.element=e,this.$element=t(e),this.defaults=t.extend({},X.DEFAULTS,t.isPlainObject(i)?i:{}),this.$original=s,this.ready=a,this.built=a,this.cropped=a,this.rotated=a,this.disabled=a,this.replaced=a,this.init()},I=Math.round,_=Math.sqrt,T=Math.min,E=Math.max,M=Math.abs,U=Math.sin,P=Math.cos,A=parseFloat;X.prototype={constructor:X,support:{canvas:t.isFunction(t("<canvas>")[0].getContext)},init:function(){var e=this.defaults;t.each(e,function(t,i){switch(t){case"aspectRatio":e[t]=M(A(i))||r;break;case"minWidth":case"minHeight":e[t]=M(A(i))||0;break;case"maxWidth":case"maxHeight":e[t]=M(A(i))||n}}),this.image={rotate:0},this.load()},load:function(){var e,i,s=this,r=this.$element,n=this.element,o=this.image;r.is("img")?i=r.attr("src"):r.is("canvas")&&this.support.canvas&&(i=n.toDataURL()),i&&(this.$clone&&this.$clone.remove(),this.replaced&&(this.replaced=a,o.rotate=0),this.$clone=e=t('<img src="'+i+'">'),e.one("load",function(){o.naturalWidth=this.naturalWidth||e.width(),o.naturalHeight=this.naturalHeight||e.height(),o.aspectRatio=o.naturalWidth/o.naturalHeight,s.url=i,s.ready=h,s.build()}),e.addClass(m).prependTo("body"))},build:function(){var e,a,s=this.$element,r=this.defaults;this.ready&&(this.built&&this.unbuild(),s.one(C,r.build),e=t.Event(C),s.trigger(e),e.isDefaultPrevented()||(this.$cropper=a=t(X.TEMPLATE),s.addClass(f),this.$clone.removeClass(m).prependTo(a),this.rotated||(this.$original=this.$clone.clone(),this.originalImage=t.extend({},this.image)),this.$container=s.parent(),this.$container.append(a),this.$canvas=a.find(".cropper-canvas"),this.$dragger=a.find(".cropper-dragger"),this.$viewer=a.find(".cropper-viewer"),r.autoCrop?this.cropped=h:this.$dragger.addClass(f),r.dragCrop&&this.setDragMode("crop"),r.modal&&this.$canvas.addClass(u),!r.dashed&&this.$dragger.find(".cropper-dashed").addClass(f),!r.movable&&this.$dragger.find(".cropper-face").addClass(f),!r.resizable&&this.$dragger.find(".cropper-line, .cropper-point").addClass(f),this.$scope=r.multiple?this.$cropper:i,this.addListeners(),this.initPreview(),this.built=h,this.update(),s.one(k,r.built),s.trigger(k)))},unbuild:function(){this.built&&(this.built=a,this.removeListeners(),this.$preview.empty(),this.$preview=s,this.$dragger=s,this.$canvas=s,this.$container=s,this.$cropper.remove(),this.$cropper=s)},update:function(t){this.initContainer(),this.initCropper(),this.initImage(),this.initDragger(),t?(this.setData(t,h),this.setDragMode("crop")):this.setData(this.defaults.data)},resize:function(){clearTimeout(this.resizing),this.resizing=setTimeout(t.proxy(this.update,this,this.getData()),200)},preview:function(){var e=this.image,i=this.dragger,h=e.width,a=e.height,s=i.left-e.left,r=i.top-e.top;this.$viewer.find("img").css({width:I(h),height:I(a),marginLeft:-I(s),marginTop:-I(r)}),this.$preview.each(function(){var e=t(this),n=e.width()/i.width;e.find("img").css({width:I(h*n),height:I(a*n),marginLeft:-I(s*n),marginTop:-I(r*n)})})},addListeners:function(){var i=this.defaults;this.$element.on(R,i.dragstart).on(z,i.dragmove).on(L,i.dragend),this.$cropper.on(b,this._dragstart=t.proxy(this.dragstart,this)).on(H,this._dblclick=t.proxy(this.dblclick,this)),i.zoomable&&this.$cropper.on(D,this._wheel=t.proxy(this.wheel,this)),this.$scope.on(y,this._dragmove=t.proxy(this.dragmove,this)).on($,this._dragend=t.proxy(this.dragend,this)),e.on(W,this._resize=t.proxy(this.resize,this))},removeListeners:function(){var t=this.defaults;this.$element.off(R,t.dragstart).off(z,t.dragmove).off(L,t.dragend),this.$cropper.off(b,this._dragstart).off(H,this._dblclick),t.zoomable&&this.$cropper.off(D,this._wheel),this.$scope.off(y,this._dragmove).off($,this._dragend),e.off(W,this._resize)},initPreview:function(){var e='<img src="'+this.url+'">';this.$preview=t(this.defaults.preview),this.$preview.html(e),this.$viewer.html(e)},initContainer:function(){var t=this.$container;this.container={width:E(t.width(),300),height:E(t.height(),150)}},initCropper:function(){var t,e=this.container,i=this.image;i.naturalWidth*e.height/i.naturalHeight-e.width>=0?(t={width:e.width,height:e.width/i.aspectRatio,left:0},t.top=(e.height-t.height)/2):(t={width:e.height*i.aspectRatio,height:e.height,top:0},t.left=(e.width-t.width)/2),this.$cropper.css({width:I(t.width),height:I(t.height),left:I(t.left),top:I(t.top)}),this.cropper=t},initImage:function(){var e=this.image,i=this.cropper,h={_width:i.width,_height:i.height,width:i.width,height:i.height,left:0,top:0,ratio:i.width/e.naturalWidth};this.defaultImage=t.extend({},e,h),e._width!==i.width||e._height!==i.height?t.extend(e,h):e=t.extend(h,e),this.image=e,this.renderImage()},renderImage:function(t){var e=this.image;"zoom"===t&&(e.left-=(e.width-e.oldWidth)/2,e.top-=(e.height-e.oldHeight)/2),e.left=T(E(e.left,e._width-e.width),0),e.top=T(E(e.top,e._height-e.height),0),this.$clone.css({width:I(e.width),height:I(e.height),marginLeft:I(e.left),marginTop:I(e.top)}),t&&(this.defaults.done(this.getData()),this.preview())},initDragger:function(){var e,i=this.defaults,h=this.cropper,a=i.aspectRatio||this.image.aspectRatio,s=this.image.ratio;e=h.height*a-h.width>=0?{height:h.width/a,width:h.width,left:0,top:(h.height-h.width/a)/2,maxWidth:h.width,maxHeight:h.width/a}:{height:h.height,width:h.height*a,left:(h.width-h.height*a)/2,top:0,maxWidth:h.height*a,maxHeight:h.height},e.minWidth=0,e.minHeight=0,i.aspectRatio?(isFinite(i.maxWidth)?(e.maxWidth=T(e.maxWidth,i.maxWidth*s),e.maxHeight=e.maxWidth/a):isFinite(i.maxHeight)&&(e.maxHeight=T(e.maxHeight,i.maxHeight*s),e.maxWidth=e.maxHeight*a),i.minWidth>0?(e.minWidth=E(0,i.minWidth*s),e.minHeight=e.minWidth/a):i.minHeight>0&&(e.minHeight=E(0,i.minHeight*s),e.minWidth=e.minHeight*a)):(e.maxWidth=T(e.maxWidth,i.maxWidth*s),e.maxHeight=T(e.maxHeight,i.maxHeight*s),e.minWidth=E(0,i.minWidth*s),e.minHeight=E(0,i.minHeight*s)),e.minWidth=T(e.maxWidth,e.minWidth),e.minHeight=T(e.maxHeight,e.minHeight),e.height*=.8,e.width*=.8,e.left=(h.width-e.width)/2,e.top=(h.height-e.height)/2,e.oldLeft=e.left,e.oldTop=e.top,this.defaultDragger=e,this.dragger=t.extend({},e)},renderDragger:function(){var t=this.dragger,e=this.cropper;t.width>t.maxWidth?(t.width=t.maxWidth,t.left=t.oldLeft):t.width<t.minWidth&&(t.width=t.minWidth,t.left=t.oldLeft),t.height>t.maxHeight?(t.height=t.maxHeight,t.top=t.oldTop):t.height<t.minHeight&&(t.height=t.minHeight,t.top=t.oldTop),t.left=T(E(t.left,0),e.width-t.width),t.top=T(E(t.top,0),e.height-t.height),t.oldLeft=t.left,t.oldTop=t.top,this.dragger=t,this.defaults.done(this.getData()),this.$dragger.css({width:I(t.width),height:I(t.height),left:I(t.left),top:I(t.top)}),this.preview()},reset:function(e){this.cropped&&(e&&(this.defaults.data={}),this.image=t.extend({},this.defaultImage),this.renderImage(),this.dragger=t.extend({},this.defaultDragger),this.setData(this.defaults.data))},clear:function(){this.cropped&&(this.cropped=a,this.setData({x:0,y:0,width:0,height:0}),this.$canvas.removeClass(u),this.$dragger.addClass(f))},destroy:function(){var t=this.$element;this.ready&&(this.unbuild(),t.removeClass(f).removeData("cropper"),this.rotated&&t.replaceWith(this.$original))},replace:function(e,i){var s,r=this,n=this.$element,o=this.element;e&&e!==this.url&&(i||(this.rotated=a,this.replaced=h),n.is("img")?(n.attr("src",e),this.load()):n.is("canvas")&&this.support.canvas&&(s=o.getContext("2d"),t('<img src="'+e+'">').one("load",function(){o.width=this.width,o.height=this.height,s.clearRect(0,0,o.width,o.height),s.drawImage(this,0,0),r.load()})))},setData:function(e,i){var h=this.cropper,a=this.dragger,r=this.image,n=this.defaults.aspectRatio;this.built&&typeof e!==o&&((e===s||t.isEmptyObject(e))&&(a=t.extend({},this.defaultDragger)),t.isPlainObject(e)&&!t.isEmptyObject(e)&&(i||(this.defaults.data=e),e=this.transformData(e),Y(e.x)&&e.x<=h.width-r.left&&(a.left=e.x+r.left),Y(e.y)&&e.y<=h.height-r.top&&(a.top=e.y+r.top),n?Y(e.width)&&e.width<=a.maxWidth&&e.width>=a.minWidth?(a.width=e.width,a.height=a.width/n):Y(e.height)&&e.height<=a.maxHeight&&e.height>=a.minHeight&&(a.height=e.height,a.width=a.height*n):(Y(e.width)&&e.width<=a.maxWidth&&e.width>=a.minWidth&&(a.width=e.width),Y(e.height)&&e.height<=a.maxHeight&&e.height>=a.minHeight&&(a.height=e.height))),this.dragger=a,this.renderDragger())},getData:function(){var t=this.dragger,e=this.image,i={};return this.built&&(i={x:t.left-e.left,y:t.top-e.top,width:t.width,height:t.height},i=this.transformData(i,h)),i},transformData:function(e,i){var h=this.image.ratio,a={};return t.each(e,function(t,e){e=A(e),c.test(t)&&!isNaN(e)&&(a[t]=i?I(e/h):e*h)}),a},setAspectRatio:function(t){var e="auto"===t;t=A(t),(e||!isNaN(t)&&t>0)&&(this.defaults.aspectRatio=e?r:t,this.built&&(this.initDragger(),this.renderDragger()))},getImageData:function(){var e={};return this.ready&&t.each(this.image,function(t,i){p.test(t)&&(e[t]=i)}),e},getDataURL:function(e,i){var h=t("<canvas>")[0],a=this.getData(),s="";return this.cropped&&this.support.canvas&&(h.width=a.width,h.height=a.height,h.getContext("2d").drawImage(this.$clone[0],a.x,a.y,a.width,a.height,0,0,a.width,a.height),s=h.toDataURL(e,i)),s},setDragMode:function(t){var e=this.$canvas,i=this.defaults,s=a,r=a;if(this.built&&!this.disabled){switch(t){case"crop":i.dragCrop&&(s=h,e.data(d,t));break;case"move":i.movable&&(r=h,e.data(d,t));break;default:e.removeData(d)}e.toggleClass(w,s).toggleClass(v,r)}},enable:function(){this.built&&(this.disabled=a,this.$cropper.removeClass(x))},disable:function(){this.built&&(this.disabled=h,this.$cropper.addClass(x))},rotate:function(t){var e=this.image;t=A(t)||0,this.built&&0!==t&&!this.disabled&&this.defaults.rotatable&&this.support.canvas&&(this.rotated=h,t=e.rotate=(e.rotate+t)%360,this.replace(this.getRotatedDataURL(t),!0))},getRotatedDataURL:function(e){var i=this.$original.clone(),h=t("<canvas>")[0],a=h.getContext("2d"),s=e*Math.PI/180,r=M(e)%180,n=r>90?180-r:r,o=n*Math.PI/180,d=this.originalImage,g=d.naturalWidth,l=d.naturalHeight,c=M(g*P(o)+l*U(o)),p=M(g*U(o)+l*P(o));return h.width=c,h.height=p,a.save(),a.translate(c/2,p/2),a.rotate(s),i.addClass(m).prependTo(this.$cropper),a.drawImage(i[0],-g/2,-l/2,g,l),a.restore(),h.toDataURL()},zoom:function(t){var e,i,h,a=this.image;t=A(t),this.built&&t&&!this.disabled&&this.defaults.zoomable&&(e=a.width*(1+t),i=a.height*(1+t),h=e/a._width,h>10||(1>h&&(e=a._width,i=a._height),this.setDragMode(1>=h?"crop":"move"),a.oldWidth=a.width,a.oldHeight=a.height,a.width=e,a.height=i,a.ratio=a.width/a.naturalWidth,this.renderImage("zoom")))},dblclick:function(){this.disabled||this.setDragMode(this.$canvas.hasClass(w)?"move":"crop")},wheel:function(t){var e,i=t.originalEvent,h=117.25,a=5,s=166.66665649414062,r=.1;this.disabled||(t.preventDefault(),i.deltaY?(e=i.deltaY,e=e%a===0?e/a:e%h===0?e/h:e/s):e=i.wheelDelta?-i.wheelDelta/120:i.detail?i.detail/3:0,this.zoom(e*r))},dragstart:function(e){var i,s,r,n=e.originalEvent.touches,o=e;if(!this.disabled){if(n){if(r=n.length,r>1){if(!this.defaults.zoomable||2!==r)return;o=n[1],this.startX2=o.pageX,this.startY2=o.pageY,i="zoom"}o=n[0]}if(i=i||t(o.target).data(d),l.test(i)){if(e.preventDefault(),s=t.Event(R),this.$element.trigger(s),s.isDefaultPrevented())return;this.directive=i,this.cropping=a,this.startX=o.pageX,this.startY=o.pageY,"crop"===i&&(this.cropping=h,this.$canvas.addClass(u))}}},dragmove:function(e){var i,h,a=e.originalEvent.touches,s=e;if(!this.disabled){if(a){if(h=a.length,h>1){if(!this.defaults.zoomable||2!==h)return;s=a[1],this.endX2=s.pageX,this.endY2=s.pageY}s=a[0]}if(this.directive){if(e.preventDefault(),i=t.Event(z),this.$element.trigger(i),i.isDefaultPrevented())return;this.endX=s.pageX,this.endY=s.pageY,this.dragging()}}},dragend:function(e){var i;if(!this.disabled&&this.directive){if(e.preventDefault(),i=t.Event(L),this.$element.trigger(i),i.isDefaultPrevented())return;this.cropping&&(this.cropping=a,this.$canvas.toggleClass(u,this.cropped&&this.defaults.modal)),this.directive=""}},dragging:function(){var t,e=this.directive,i=this.image,s=this.cropper,r=s.width,n=s.height,o=this.dragger,d=o.width,g=o.height,l=o.left,c=o.top,p=l+d,u=c+g,m=h,v=this.defaults,w=v.aspectRatio,x={x:this.endX-this.startX,y:this.endY-this.startY};switch(w&&(x.X=x.y*w,x.Y=x.x/w),e){case"all":l+=x.x,c+=x.y;break;case"e":if(x.x>=0&&(p>=r||w&&(0>=c||u>=n))){m=a;break}d+=x.x,w&&(g=d/w,c-=x.Y/2),0>d&&(e="w",d=0);break;case"n":if(x.y<=0&&(0>=c||w&&(0>=l||p>=r))){m=a;break}g-=x.y,c+=x.y,w&&(d=g*w,l+=x.X/2),0>g&&(e="s",g=0);break;case"w":if(x.x<=0&&(0>=l||w&&(0>=c||u>=n))){m=a;break}d-=x.x,l+=x.x,w&&(g=d/w,c+=x.Y/2),0>d&&(e="e",d=0);break;case"s":if(x.y>=0&&(u>=n||w&&(0>=l||p>=r))){m=a;break}g+=x.y,w&&(d=g*w,l-=x.X/2),0>g&&(e="n",g=0);break;case"ne":if(w){if(x.y<=0&&(0>=c||p>=r)){m=a;break}g-=x.y,c+=x.y,d=g*w}else x.x>=0?r>p?d+=x.x:x.y<=0&&0>=c&&(m=a):d+=x.x,x.y<=0?c>0&&(g-=x.y,c+=x.y):(g-=x.y,c+=x.y);0>g&&(e="sw",g=0,d=0);break;case"nw":if(w){if(x.y<=0&&(0>=c||0>=l)){m=a;break}g-=x.y,c+=x.y,d=g*w,l+=x.X}else x.x<=0?l>0?(d-=x.x,l+=x.x):x.y<=0&&0>=c&&(m=a):(d-=x.x,l+=x.x),x.y<=0?c>0&&(g-=x.y,c+=x.y):(g-=x.y,c+=x.y);0>g&&(e="se",g=0,d=0);break;case"sw":if(w){if(x.x<=0&&(0>=l||u>=n)){m=a;break}d-=x.x,l+=x.x,g=d/w}else x.x<=0?l>0?(d-=x.x,l+=x.x):x.y>=0&&u>=n&&(m=a):(d-=x.x,l+=x.x),x.y>=0?n>u&&(g+=x.y):g+=x.y;0>d&&(e="ne",g=0,d=0);break;case"se":if(w){if(x.x>=0&&(p>=r||u>=n)){m=a;break}d+=x.x,g=d/w}else x.x>=0?r>p?d+=x.x:x.y>=0&&u>=n&&(m=a):d+=x.x,x.y>=0?n>u&&(g+=x.y):g+=x.y;0>d&&(e="nw",g=0,d=0);break;case"move":i.left+=x.x,i.top+=x.y,this.renderImage("move"),m=a;break;case"zoom":v.zoomable&&(this.zoom(function(t,e,i,h,a,s){return(_(a*a+s*s)-_(i*i+h*h))/_(t*t+e*e)}(i.width,i.height,M(this.startX-this.startX2),M(this.startY-this.startY2),M(this.endX-this.endX2),M(this.endY-this.endY2))),this.endX2=this.startX2,this.endY2=this.startY2);break;case"crop":x.x&&x.y&&(t=this.$cropper.offset(),l=this.startX-t.left,c=this.startY-t.top,d=o.minWidth,g=o.minHeight,x.x>0?x.y>0?e="se":(e="ne",c-=g):x.y>0?(e="sw",l-=d):(e="nw",l-=d,c-=g),this.cropped||(this.cropped=h,this.$dragger.removeClass(f)))}m&&(o.width=d,o.height=g,o.left=l,o.top=c,this.directive=e,this.renderDragger()),this.startX=this.endX,this.startY=this.endY}},X.TEMPLATE=function(t,e){return e=e.split(","),t.replace(/\d+/g,function(t){return e[t]})}('<0 6="5-container"><0 6="5-canvas"></0><0 6="5-dragger"><1 6="5-viewer"></1><1 6="5-8 8-h"></1><1 6="5-8 8-v"></1><1 6="5-face" 3-2="all"></1><1 6="5-7 7-e" 3-2="e"></1><1 6="5-7 7-n" 3-2="n"></1><1 6="5-7 7-w" 3-2="w"></1><1 6="5-7 7-s" 3-2="s"></1><1 6="5-4 4-e" 3-2="e"></1><1 6="5-4 4-n" 3-2="n"></1><1 6="5-4 4-w" 3-2="w"></1><1 6="5-4 4-s" 3-2="s"></1><1 6="5-4 4-ne" 3-2="ne"></1><1 6="5-4 4-nw" 3-2="nw"></1><1 6="5-4 4-sw" 3-2="sw"></1><1 6="5-4 4-se" 3-2="se"></1></0></0>',"div,span,directive,data,point,cropper,class,line,dashed"),X.DEFAULTS={aspectRatio:"auto",data:{},done:t.noop,preview:"",multiple:a,autoCrop:h,dragCrop:h,dashed:h,modal:h,movable:h,resizable:h,zoomable:h,rotatable:h,minWidth:0,minHeight:0,maxWidth:n,maxHeight:n,build:s,built:s,dragstart:s,dragmove:s,dragend:s},X.setDefaults=function(e){t.extend(X.DEFAULTS,e)},X.other=t.fn.cropper,t.fn.cropper=function(e){var i,h=[].slice.call(arguments,1);return this.each(function(){var a,s=t(this),r=s.data("cropper");r||s.data("cropper",r=new X(this,e)),"string"==typeof e&&t.isFunction(a=r[e])&&(i=a.apply(r,h))}),typeof i!==o?i:this},t.fn.cropper.Constructor=X,t.fn.cropper.setDefaults=X.setDefaults,t.fn.cropper.noConflict=function(){return t.fn.cropper=X.other,this}}),function(){"use strict";angular.module("ngCropper",["ng"]).directive("ngCropper",["$q",function(t){function e(e,a){e=e||{};var s=t.defer(),r=[i(e)];return e.maximize&&r.push(h(e,a)),t.all(r).then(function(t){var e=t[t.length-1];s.resolve(e)}),s.promise}function i(e){var i=t.defer();return i.resolve(e),i.promise}function h(e,i){var h=t.defer();return a(i).then(function(t){e.data=t,h.resolve(e)}),h.promise}function a(e){var i=t.defer(),h=new Image;return h.onload=function(){i.resolve({width:h.width,height:h.height})},h.src=e.src,i.promise}return{restrict:"A",scope:{options:"=ngOptions"},link:function(t,i,h){var a=!1;t.$on(h.ngShow,function(){a||(a=!0,e(t.options,i[0]).then(function(t){i.cropper(t)}))}),t.$on(h.ngHide,function(){a&&(a=!1,i.cropper("destroy"))}),t.$watch("options.disabled",function(t){a&&(t&&i.cropper("disable"),t||i.cropper("enable"))})}}}]).service("Cropper",["$q",function(t){function e(e){var i=t.defer(),h=new Image;return h.onload=function(t){i.resolve(t.target)},h.src=e,i.promise}function i(t){var e=document.createElement("canvas");return e.width=t.width,e.height=t.height,e.style.display="none",document.body.appendChild(e),e}function h(t){t.parentElement.removeChild(t)}this.encode=function(e){var i=t.defer(),h=new FileReader;return h.onload=function(t){i.resolve(t.target.result)},h.readAsDataURL(e),i.promise},this.decode=function(t){for(var e=t.split(";")[0],i=e.split(":")[1],h=atob(t.split(",")[1]),a=new Uint8Array(h.length),s=0;s<h.length;s++)a[s]=h.charCodeAt(s);return new Blob([a],{type:i})},this.crop=function(a,s){var r=t.defer(),n=this.decode;return this.encode(a).then(e).then(function(t){var e=i(s),o=e.getContext("2d");o.drawImage(t,s.x,s.y,s.width,s.height,0,0,s.width,s.height);var d=e.toDataURL(a.type),g=n(d);r.resolve(g),h(e)}),r.promise},this.scale=function(a,s){var r=t.defer(),n=this.decode;return this.encode(a).then(e).then(function(t){var e,o,d,g=t.height,l=t.width;angular.isNumber(s)&&(e=s,o=g*e,d=l*e),angular.isObject(s)&&(e=l/g,o=s.height,d=s.width,o&&!d?d=o*e:d&&!o&&(o=d/e));var c=i(s),p=c.getContext("2d");c.height=o,c.width=d,p.drawImage(t,0,0,l,g,0,0,d,o);var u=c.toDataURL(a.type),f=n(u);r.resolve(f),h(c)}),r.promise}}])}();
  