@uicapivara/cp-image-crop
Version:
cp-image-crop
22 lines • 205 kB
JavaScript
!function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:r})},n.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},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="/dist/",n(n.s=7)}([function(t,e,n){n(13),t.exports=window.capivara},function(t,e){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){(function(n){var r,i;void 0===(i="function"==typeof(r=function(e){"function"!=typeof Promise&&function(e){function r(t,e){return function(){t.apply(e,arguments)}}function i(t){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof t)throw new TypeError("not a function");this._state=null,this._value=null,this._deferreds=[],u(t,r(s,this),r(a,this))}function o(t){var e=this;return null===this._state?void this._deferreds.push(t):void p(function(){var n=e._state?t.onFulfilled:t.onRejected;if(null!==n){var r;try{r=n(e._value)}catch(e){return void t.reject(e)}t.resolve(r)}else(e._state?t.resolve:t.reject)(e._value)})}function s(t){try{if(t===this)throw new TypeError("A promise cannot be resolved with itself.");if(t&&("object"==typeof t||"function"==typeof t)){var e=t.then;if("function"==typeof e)return void u(r(e,t),r(s,this),r(a,this))}this._state=!0,this._value=t,c.call(this)}catch(t){a.call(this,t)}}function a(t){this._state=!1,this._value=t,c.call(this)}function c(){for(var t=0,e=this._deferreds.length;e>t;t++)o.call(this,this._deferreds[t]);this._deferreds=null}function u(t,e,n){var r=!1;try{t(function(t){r||(r=!0,e(t))},function(t){r||(r=!0,n(t))})}catch(t){if(r)return;r=!0,n(t)}}var l=setTimeout,p="function"==typeof n&&n||function(t){l(t,1)},f=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};i.prototype.catch=function(t){return this.then(null,t)},i.prototype.then=function(t,e){var n=this;return new i(function(r,i){o.call(n,new function(t,e,n,r){this.onFulfilled="function"==typeof t?t:null,this.onRejected="function"==typeof e?e:null,this.resolve=n,this.reject=r}(t,e,r,i))})},i.all=function(){var t=Array.prototype.slice.call(1===arguments.length&&f(arguments[0])?arguments[0]:arguments);return new i(function(e,n){function r(o,s){try{if(s&&("object"==typeof s||"function"==typeof s)){var a=s.then;if("function"==typeof a)return void a.call(s,function(t){r(o,t)},n)}t[o]=s,0==--i&&e(t)}catch(t){n(t)}}if(0===t.length)return e([]);for(var i=t.length,o=0;o<t.length;o++)r(o,t[o])})},i.resolve=function(t){return t&&"object"==typeof t&&t.constructor===i?t:new i(function(e){e(t)})},i.reject=function(t){return new i(function(e,n){n(t)})},i.race=function(t){return new i(function(e,n){for(var r=0,i=t.length;i>r;r++)t[r].then(e,n)})},i._setImmediateFn=function(t){p=t},void 0!==t&&t.exports?t.exports=i:e.Promise||(e.Promise=i)}(this),"function"!=typeof window.CustomEvent&&function(){function t(t,e){e=e||{bubbles:!1,cancelable:!1,detail:void 0};var n=document.createEvent("CustomEvent");return n.initCustomEvent(t,e.bubbles,e.cancelable,e.detail),n}t.prototype=window.Event.prototype,window.CustomEvent=t}(),HTMLCanvasElement.prototype.toBlob||Object.defineProperty(HTMLCanvasElement.prototype,"toBlob",{value:function(t,e,n){for(var r=atob(this.toDataURL(e,n).split(",")[1]),i=r.length,o=new Uint8Array(i),s=0;s<i;s++)o[s]=r.charCodeAt(s);t(new Blob([o],{type:e||"image/png"}))}});var r,i,o,s=["Webkit","Moz","ms"],a=document.createElement("div").style,c=[1,8,3,6],u=[2,7,4,5];function l(t){if(t in a)return t;for(var e=t[0].toUpperCase()+t.slice(1),n=s.length;n--;)if((t=s[n]+e)in a)return t}function p(t,e){for(var n in t=t||{},e)e[n]&&e[n].constructor&&e[n].constructor===Object?(t[n]=t[n]||{},p(t[n],e[n])):t[n]=e[n];return t}function f(t){return p({},t)}function h(t){if("createEvent"in document){var e=document.createEvent("HTMLEvents");e.initEvent("change",!1,!0),t.dispatchEvent(e)}else t.fireEvent("onchange")}function d(t,e,n){if("string"==typeof e){var r=e;(e={})[r]=n}for(var i in e)t.style[i]=e[i]}function m(t,e){t.classList?t.classList.add(e):t.className+=" "+e}function v(t,e){for(var n in e)t.setAttribute(n,e[n])}function g(t){return parseInt(t,10)}function y(t,e){var n=t.naturalWidth,r=t.naturalHeight,i=e||w(t);if(i&&i>=5){var o=n;n=r,r=o}return{width:n,height:r}}i=l("transform"),r=l("transformOrigin"),o=l("userSelect");var _={translate3d:{suffix:", 0px"},translate:{suffix:""}},b=function(t,e,n){this.x=parseFloat(t),this.y=parseFloat(e),this.scale=parseFloat(n)};b.parse=function(t){return t.style?b.parse(t.style[i]):t.indexOf("matrix")>-1||t.indexOf("none")>-1?b.fromMatrix(t):b.fromString(t)},b.fromMatrix=function(t){var e=t.substring(7).split(",");return e.length&&"none"!==t||(e=[1,0,0,1,0,0]),new b(g(e[4]),g(e[5]),parseFloat(e[0]))},b.fromString=function(t){var e=t.split(") "),n=e[0].substring(z.globals.translate.length+1).split(","),r=e.length>1?e[1].substring(6):1,i=n.length>1?n[0]:0,o=n.length>1?n[1]:0;return new b(i,o,r)},b.prototype.toString=function(){var t=_[z.globals.translate].suffix||"";return z.globals.translate+"("+this.x+"px, "+this.y+"px"+t+") scale("+this.scale+")"};var E=function(t){if(!t||!t.style[r])return this.x=0,void(this.y=0);var e=t.style[r].split(" ");this.x=parseFloat(e[0]),this.y=parseFloat(e[1])};function w(t){return t.exifdata?t.exifdata.Orientation:1}function C(t,e,n){var r=e.width,i=e.height,o=t.getContext("2d");switch(t.width=e.width,t.height=e.height,o.save(),n){case 2:o.translate(r,0),o.scale(-1,1);break;case 3:o.translate(r,i),o.rotate(180*Math.PI/180);break;case 4:o.translate(0,i),o.scale(1,-1);break;case 5:t.width=i,t.height=r,o.rotate(90*Math.PI/180),o.scale(1,-1);break;case 6:t.width=i,t.height=r,o.rotate(90*Math.PI/180),o.translate(0,-i);break;case 7:t.width=i,t.height=r,o.rotate(-90*Math.PI/180),o.translate(-r,i),o.scale(1,-1);break;case 8:t.width=i,t.height=r,o.translate(0,r),o.rotate(-90*Math.PI/180)}o.drawImage(e,0,0,r,i),o.restore()}function A(){var t,e,n,r,s,a=this.options.viewport.type?"cr-vp-"+this.options.viewport.type:null;this.options.useCanvas=this.options.enableOrientation||T.call(this),this.data={},this.elements={},t=this.elements.boundary=document.createElement("div"),e=this.elements.viewport=document.createElement("div"),this.elements.img=document.createElement("img"),n=this.elements.overlay=document.createElement("div"),this.options.useCanvas?(this.elements.canvas=document.createElement("canvas"),this.elements.preview=this.elements.canvas):this.elements.preview=this.elements.img,m(t,"cr-boundary"),t.setAttribute("aria-dropeffect","none"),r=this.options.boundary.width,s=this.options.boundary.height,d(t,{width:r+(isNaN(r)?"":"px"),height:s+(isNaN(s)?"":"px")}),m(e,"cr-viewport"),a&&m(e,a),d(e,{width:this.options.viewport.width+"px",height:this.options.viewport.height+"px"}),e.setAttribute("tabindex",0),m(this.elements.preview,"cr-image"),v(this.elements.preview,{alt:"preview","aria-grabbed":"false"}),m(n,"cr-overlay"),this.element.appendChild(t),t.appendChild(this.elements.preview),t.appendChild(e),t.appendChild(n),m(this.element,"croppie-container"),this.options.customClass&&m(this.element,this.options.customClass),function(){var t,e,n,r,s,a=this,c=!1;function u(t,e){var n=a.elements.preview.getBoundingClientRect(),i=s.y+e,o=s.x+t;a.options.enforceBoundary?(r.top>n.top+e&&r.bottom<n.bottom+e&&(s.y=i),r.left>n.left+t&&r.right<n.right+t&&(s.x=o)):(s.y=i,s.x=o)}function l(t){a.elements.preview.setAttribute("aria-grabbed",t),a.elements.boundary.setAttribute("aria-dropeffect",t?"move":"none")}function p(n){if((void 0===n.button||0===n.button)&&(n.preventDefault(),!c)){if(c=!0,t=n.pageX,e=n.pageY,n.touches){var i=n.touches[0];t=i.pageX,e=i.pageY}l(c),s=b.parse(a.elements.preview),window.addEventListener("mousemove",f),window.addEventListener("touchmove",f),window.addEventListener("mouseup",m),window.addEventListener("touchend",m),document.body.style[o]="none",r=a.elements.viewport.getBoundingClientRect()}}function f(r){r.preventDefault();var o=r.pageX,c=r.pageY;if(r.touches){var l=r.touches[0];o=l.pageX,c=l.pageY}var p=o-t,f=c-e,m={};if("touchmove"===r.type&&r.touches.length>1){var v=r.touches[0],g=r.touches[1],y=Math.sqrt((v.pageX-g.pageX)*(v.pageX-g.pageX)+(v.pageY-g.pageY)*(v.pageY-g.pageY));n||(n=y/a._currentZoom);var _=y/n;return x.call(a,_),void h(a.elements.zoomer)}u(p,f),m[i]=s.toString(),d(a.elements.preview,m),O.call(a),e=c,t=o}function m(){l(c=!1),window.removeEventListener("mousemove",f),window.removeEventListener("touchmove",f),window.removeEventListener("mouseup",m),window.removeEventListener("touchend",m),document.body.style[o]="",S.call(a),P.call(a),n=0}a.elements.overlay.addEventListener("mousedown",p),a.elements.viewport.addEventListener("keydown",function(t){if(!t.shiftKey||38!==t.keyCode&&40!==t.keyCode){if(a.options.enableKeyMovement&&t.keyCode>=37&&t.keyCode<=40){t.preventDefault();var e=function(t){switch(t){case 37:return[1,0];case 38:return[0,1];case 39:return[-1,0];case 40:return[0,-1]}}(t.keyCode);s=b.parse(a.elements.preview),document.body.style[o]="none",r=a.elements.viewport.getBoundingClientRect(),function(t){var e={};u(t[0],t[1]),e[i]=s.toString(),d(a.elements.preview,e),O.call(a),document.body.style[o]="",S.call(a),P.call(a),n=0}(e)}}else{var c;c=38===t.keyCode?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(c)}}),a.elements.overlay.addEventListener("touchstart",p)}.call(this),this.options.enableZoom&&function(){var t=this,e=t.elements.zoomerWrap=document.createElement("div"),n=t.elements.zoomer=document.createElement("input");function r(){I.call(t,{value:parseFloat(n.value),origin:new E(t.elements.preview),viewportRect:t.elements.viewport.getBoundingClientRect(),transform:b.parse(t.elements.preview)})}function i(e){var n,i;if("ctrl"===t.options.mouseWheelZoom&&!0!==e.ctrlKey)return 0;n=e.wheelDelta?e.wheelDelta/1200:e.deltaY?e.deltaY/1060:e.detail?e.detail/-60:0,i=t._currentZoom+n*t._currentZoom,e.preventDefault(),x.call(t,i),r.call(t)}m(e,"cr-slider-wrap"),m(n,"cr-slider"),n.type="range",n.step="0.0001",n.value=1,n.style.display=t.options.showZoomer?"":"none",n.setAttribute("aria-label","zoom"),t.element.appendChild(e),e.appendChild(n),t._currentZoom=1,t.elements.zoomer.addEventListener("input",r),t.elements.zoomer.addEventListener("change",r),t.options.mouseWheelZoom&&(t.elements.boundary.addEventListener("mousewheel",i),t.elements.boundary.addEventListener("DOMMouseScroll",i))}.call(this),this.options.enableResize&&function(){var t,e,n,r,i,s,a,c=this,u=document.createElement("div"),l=!1,p=50;function f(s){if((void 0===s.button||0===s.button)&&(s.preventDefault(),!l)){var a=c.elements.overlay.getBoundingClientRect();if(l=!0,e=s.pageX,n=s.pageY,t=-1!==s.currentTarget.className.indexOf("vertical")?"v":"h",r=a.width,i=a.height,s.touches){var u=s.touches[0];e=u.pageX,n=u.pageY}window.addEventListener("mousemove",h),window.addEventListener("touchmove",h),window.addEventListener("mouseup",v),window.addEventListener("touchend",v),document.body.style[o]="none"}}function h(o){var s=o.pageX,a=o.pageY;if(o.preventDefault(),o.touches){var l=o.touches[0];s=l.pageX,a=l.pageY}var f=s-e,h=a-n,m=c.options.viewport.height+h,v=c.options.viewport.width+f;"v"===t&&m>=p&&m<=i?(d(u,{height:m+"px"}),c.options.boundary.height+=h,d(c.elements.boundary,{height:c.options.boundary.height+"px"}),c.options.viewport.height+=h,d(c.elements.viewport,{height:c.options.viewport.height+"px"})):"h"===t&&v>=p&&v<=r&&(d(u,{width:v+"px"}),c.options.boundary.width+=f,d(c.elements.boundary,{width:c.options.boundary.width+"px"}),c.options.viewport.width+=f,d(c.elements.viewport,{width:c.options.viewport.width+"px"})),O.call(c),B.call(c),S.call(c),P.call(c),n=a,e=s}function v(){l=!1,window.removeEventListener("mousemove",h),window.removeEventListener("touchmove",h),window.removeEventListener("mouseup",v),window.removeEventListener("touchend",v),document.body.style[o]=""}m(u,"cr-resizer"),d(u,{width:this.options.viewport.width+"px",height:this.options.viewport.height+"px"}),this.options.resizeControls.height&&(m(s=document.createElement("div"),"cr-resizer-vertical"),u.appendChild(s)),this.options.resizeControls.width&&(m(a=document.createElement("div"),"cr-resizer-horisontal"),u.appendChild(a)),s&&(s.addEventListener("mousedown",f),s.addEventListener("touchstart",f)),a&&(a.addEventListener("mousedown",f),a.addEventListener("touchstart",f)),this.elements.boundary.appendChild(u)}.call(this)}function T(){return this.options.enableExif&&window.EXIF}function x(t){if(this.options.enableZoom){var e=this.elements.zoomer,n=$(t,4);e.value=Math.max(e.min,Math.min(e.max,n))}}function I(t){var e=this,n=t?t.transform:b.parse(e.elements.preview),o=t?t.viewportRect:e.elements.viewport.getBoundingClientRect(),s=t?t.origin:new E(e.elements.preview);function a(){var t={};t[i]=n.toString(),t[r]=s.toString(),d(e.elements.preview,t)}if(e._currentZoom=t?t.value:e._currentZoom,n.scale=e._currentZoom,e.elements.zoomer.setAttribute("aria-valuenow",e._currentZoom),a(),e.options.enforceBoundary){var c=function(t){var e=this._currentZoom,n=t.width,r=t.height,i=this.elements.boundary.clientWidth/2,o=this.elements.boundary.clientHeight/2,s=this.elements.preview.getBoundingClientRect(),a=s.width,c=s.height,u=n/2,l=r/2,p=-1*(u/e-i),f=-1*(l/e-o),h=1/e*u,d=1/e*l;return{translate:{maxX:p,minX:p-(a*(1/e)-n*(1/e)),maxY:f,minY:f-(c*(1/e)-r*(1/e))},origin:{maxX:a*(1/e)-h,minX:h,maxY:c*(1/e)-d,minY:d}}}.call(e,o),u=c.translate,l=c.origin;n.x>=u.maxX&&(s.x=l.minX,n.x=u.maxX),n.x<=u.minX&&(s.x=l.maxX,n.x=u.minX),n.y>=u.maxY&&(s.y=l.minY,n.y=u.maxY),n.y<=u.minY&&(s.y=l.maxY,n.y=u.minY)}a(),M.call(e),P.call(e)}function S(){var t=this._currentZoom,e=this.elements.preview.getBoundingClientRect(),n=this.elements.viewport.getBoundingClientRect(),o=b.parse(this.elements.preview.style[i]),s=new E(this.elements.preview),a=n.top-e.top+n.height/2,c=n.left-e.left+n.width/2,u={},l={};u.y=a/t,u.x=c/t,l.y=(u.y-s.y)*(1-t),l.x=(u.x-s.x)*(1-t),o.x-=l.x,o.y-=l.y;var p={};p[r]=u.x+"px "+u.y+"px",p[i]=o.toString(),d(this.elements.preview,p)}function O(){if(this.elements){var t=this.elements.boundary.getBoundingClientRect(),e=this.elements.preview.getBoundingClientRect();d(this.elements.overlay,{width:e.width+"px",height:e.height+"px",top:e.top-t.top+"px",left:e.left-t.left+"px"})}}E.prototype.toString=function(){return this.x+"px "+this.y+"px"};var N,R,M=(N=O,500,function(){var t=this,e=arguments;clearTimeout(R),R=setTimeout(function(){R=null,N.apply(t,e)},500)});function P(){var t,e=this.get();j.call(this)&&(this.options.update.call(this,e),this.$&&"undefined"==typeof Prototype?this.$(this.element).trigger("update.croppie",e):(window.CustomEvent?t=new CustomEvent("update",{detail:e}):(t=document.createEvent("CustomEvent")).initCustomEvent("update",!0,!0,e),this.element.dispatchEvent(t)))}function j(){return this.elements.preview.offsetHeight>0&&this.elements.preview.offsetWidth>0}function k(){var t={},e=this.elements.preview,n=null,o=new b(0,0,1),s=new E;j.call(this)&&!this.data.bound&&(this.data.bound=!0,t[i]=o.toString(),t[r]=s.toString(),t.opacity=1,d(e,t),n=this.elements.preview.getBoundingClientRect(),this._originalImageWidth=n.width,this._originalImageHeight=n.height,this.data.orientation=w(this.elements.img),this.options.enableZoom?B.call(this,!0):this._currentZoom=1,o.scale=this._currentZoom,t[i]=o.toString(),d(e,t),this.data.points.length?function(t){if(4!==t.length)throw"Croppie - Invalid number of points supplied: "+t;var e=t[2]-t[0],n=this.elements.viewport.getBoundingClientRect(),o=this.elements.boundary.getBoundingClientRect(),s=n.left-o.left,a=n.top-o.top,c=n.width/e,u=t[1],l=t[0],p=-1*t[1]+a,f=-1*t[0]+s,h={};h[r]=l+"px "+u+"px",h[i]=new b(f,p,c).toString(),d(this.elements.preview,h),x.call(this,c),this._currentZoom=c}.call(this,this.data.points):function(){var t=this.elements.preview.getBoundingClientRect(),e=this.elements.viewport.getBoundingClientRect(),n=this.elements.boundary.getBoundingClientRect(),r=e.left-n.left,o=e.top-n.top,s=r-(t.width-e.width)/2,a=o-(t.height-e.height)/2,c=new b(s,a,this._currentZoom);d(this.elements.preview,i,c.toString())}.call(this),S.call(this),O.call(this))}function B(t){var e,n,r,i,o=0,s=this.options.maxZoom||1.5,a=this.elements.zoomer,c=parseFloat(a.value),u=this.elements.boundary.getBoundingClientRect(),l=y(this.elements.img,this.data.orientation),p=this.elements.viewport.getBoundingClientRect();this.options.enforceBoundary&&(r=p.width/l.width,i=p.height/l.height,o=Math.max(r,i)),o>=s&&(s=o+1),a.min=$(o,4),a.max=$(s,4),!t&&(c<a.min||c>a.max)?x.call(this,c<a.min?a.min:a.max):t&&(n=Math.max(u.width/l.width,u.height/l.height),e=null!==this.data.boundZoom?this.data.boundZoom:n,x.call(this,e)),h(a)}function L(t){var e=t.points,n=g(e[0]),r=g(e[1]),i=g(e[2])-n,o=g(e[3])-r,s=t.circle,a=document.createElement("canvas"),c=a.getContext("2d"),u=t.outputWidth||i,l=t.outputHeight||o;return t.outputWidth&&t.outputHeight,a.width=u,a.height=l,t.backgroundColor&&(c.fillStyle=t.backgroundColor,c.fillRect(0,0,u,l)),!1!==this.options.enforceBoundary&&(i=Math.min(i,this._originalImageWidth),o=Math.min(o,this._originalImageHeight)),c.drawImage(this.elements.preview,n,r,i,o,0,0,u,l),s&&(c.fillStyle="#fff",c.globalCompositeOperation="destination-in",c.beginPath(),c.arc(a.width/2,a.height/2,a.width/2,0,2*Math.PI,!0),c.closePath(),c.fill()),a}function U(t,e){var n,r,i,o,s=this,a=[],c=null,u=T.call(s);if("string"==typeof t)n=t,t={};else if(Array.isArray(t))a=t.slice();else{if(void 0===t&&s.data.url)return k.call(s),P.call(s),null;n=t.url,a=t.points||[],c=void 0===t.zoom?null:t.zoom}return s.data.bound=!1,s.data.url=n||s.data.url,s.data.boundZoom=c,(r=n,i=u,o=new Image,o.style.opacity=0,new Promise(function(t){function e(){o.style.opacity=1,setTimeout(function(){t(o)},1)}o.removeAttribute("crossOrigin"),r.match(/^https?:\/\/|^\/\//)&&o.setAttribute("crossOrigin","anonymous"),o.onload=function(){i?EXIF.getData(o,function(){e()}):e()},o.src=r})).then(function(n){if(function(t){this.elements.img.parentNode&&(Array.prototype.forEach.call(this.elements.img.classList,function(e){t.classList.add(e)}),this.elements.img.parentNode.replaceChild(t,this.elements.img),this.elements.preview=t),this.elements.img=t}.call(s,n),a.length)s.options.relative&&(a=[a[0]*n.naturalWidth/100,a[1]*n.naturalHeight/100,a[2]*n.naturalWidth/100,a[3]*n.naturalHeight/100]);else{var r,i,o=y(n),c=s.elements.viewport.getBoundingClientRect(),u=c.width/c.height;o.width/o.height>u?r=(i=o.height)*u:(r=o.width,i=o.height/u);var l=(o.width-r)/2,p=(o.height-i)/2,f=l+r,h=p+i;s.data.points=[l,p,f,h]}s.data.points=a.map(function(t){return parseFloat(t)}),s.options.useCanvas&&function(t){var e=this.elements.canvas,n=this.elements.img,r=e.getContext("2d"),i=T.call(this);t=this.options.enableOrientation&&t;(r.clearRect(0,0,e.width,e.height),e.width=n.width,e.height=n.height,i&&!t)?C(e,n,g(w(n)||0)):t&&C(e,n,t)}.call(s,t.orientation||1),k.call(s),P.call(s),e&&e()}).catch(function(t){console.error("Croppie:"+t)})}function $(t,e){return parseFloat(t).toFixed(e||0)}function D(){var t=this.elements.preview.getBoundingClientRect(),e=this.elements.viewport.getBoundingClientRect(),n=e.left-t.left,r=e.top-t.top,i=(e.width-this.elements.viewport.offsetWidth)/2,o=(e.height-this.elements.viewport.offsetHeight)/2,s=n+this.elements.viewport.offsetWidth+i,a=r+this.elements.viewport.offsetHeight+o,c=this._currentZoom;(c===1/0||isNaN(c))&&(c=1);var u=this.options.enforceBoundary?0:Number.NEGATIVE_INFINITY;return n=Math.max(u,n/c),r=Math.max(u,r/c),s=Math.max(u,s/c),a=Math.max(u,a/c),{points:[$(n),$(r),$(s),$(a)],zoom:c,orientation:this.data.orientation}}var F={type:"canvas",format:"png",quality:1},W=["jpeg","webp","png"];if(window.jQuery){var V=window.jQuery;V.fn.croppie=function(t){if("string"===typeof t){var e=Array.prototype.slice.call(arguments,1),n=V(this).data("croppie");return"get"===t?n.get():"result"===t?n.result.apply(n,e):"bind"===t?n.bind.apply(n,e):this.each(function(){var n=V(this).data("croppie");if(n){var r=n[t];if(!V.isFunction(r))throw"Croppie "+t+" method not found";r.apply(n,e),"destroy"===t&&V(this).removeData("croppie")}})}return this.each(function(){var e=new z(this,t);e.$=V,V(this).data("croppie",e)})}}function z(t,e){if(t.className.indexOf("croppie-container")>-1)throw new Error("Croppie: Can't initialize croppie more than once");if(this.element=t,this.options=p(f(z.defaults),e),"img"===this.element.tagName.toLowerCase()){var n=this.element;m(n,"cr-original-image"),v(n,{"aria-hidden":"true",alt:""});var r=document.createElement("div");this.element.parentNode.appendChild(r),r.appendChild(n),this.element=r,this.options.url=this.options.url||n.src}if(A.call(this),this.options.url){var i={url:this.options.url,points:this.options.points};delete this.options.url,delete this.options.points,U.call(this,i)}}z.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(){}},z.globals={translate:"translate3d"},p(z.prototype,{bind:function(t,e){return U.call(this,t,e)},get:function(){var t=D.call(this),e=t.points;return this.options.relative&&(e[0]/=this.elements.img.naturalWidth/100,e[1]/=this.elements.img.naturalHeight/100,e[2]/=this.elements.img.naturalWidth/100,e[3]/=this.elements.img.naturalHeight/100),t},result:function(t){return function(t){var e=this,n=D.call(e),r=p(f(F),f(t)),i="string"==typeof t?t:r.type||"base64",o=r.size||"viewport",s=r.format,a=r.quality,c=r.backgroundColor,u="boolean"==typeof r.circle?r.circle:"circle"===e.options.viewport.type,l=e.elements.viewport.getBoundingClientRect(),h=l.width/l.height;return"viewport"===o?(n.outputWidth=l.width,n.outputHeight=l.height):"object"==typeof o&&(o.width&&o.height?(n.outputWidth=o.width,n.outputHeight=o.height):o.width?(n.outputWidth=o.width,n.outputHeight=o.width/h):o.height&&(n.outputWidth=o.height*h,n.outputHeight=o.height)),W.indexOf(s)>-1&&(n.format="image/"+s,n.quality=a),n.circle=u,n.url=e.data.url,n.backgroundColor=c,new Promise(function(t,r){switch(i.toLowerCase()){case"rawcanvas":t(L.call(e,n));break;case"canvas":case"base64":t(function(t){return L.call(this,t).toDataURL(t.format,t.quality)}.call(e,n));break;case"blob":(function(t){var e=this;return new Promise(function(n,r){L.call(e,t).toBlob(function(t){n(t)},t.format,t.quality)})}).call(e,n).then(t);break;default:t(function(t){var e=t.points,n=document.createElement("div"),r=document.createElement("img"),i=e[2]-e[0],o=e[3]-e[1];return m(n,"croppie-result"),n.appendChild(r),d(r,{left:-1*e[0]+"px",top:-1*e[1]+"px"}),r.src=t.url,d(n,{width:i+"px",height:o+"px"}),n}.call(e,n))}})}.call(this,t)},refresh:function(){return function(){k.call(this)}.call(this)},setZoom:function(t){x.call(this,t),h(this.elements.zoomer)},rotate:function(t){(function(t){if(!this.options.useCanvas||!this.options.enableOrientation)throw"Croppie: Cannot rotate without enableOrientation && EXIF.js included";var e=this.elements.canvas;this.data.orientation=function(t,e){var n=c.indexOf(t)>-1?c:u,r=n.indexOf(t),i=e/90%n.length;return n[(n.length+r+i%n.length)%n.length]}(this.data.orientation,t),C(e,this.elements.img,this.data.orientation),B.call(this),I.call(this),copy=null}).call(this,t)},destroy:function(){return function(){var t,e;this.element.removeChild(this.elements.boundary),e="croppie-container",(t=this.element).classList?t.classList.remove(e):t.className=t.className.replace(e,""),this.options.enableZoom&&this.element.removeChild(this.elements.zoomerWrap),delete this.elements}.call(this)}}),e.Croppie=window.Croppie=z})?r.apply(e,[e]):r)||(t.exports=i)}).call(this,n(10).setImmediate)},function(t,e){t.exports='<div class="modal-instance" cp-class="{ \'circle\' : $ctrl.params.type == \'circle\' }">\n <span class="close" cp-click="$ctrl.close();">×</span>\n\n <div class="content-image-crop-edit" cp-show="$ctrl.mode == \'crop\'">\n <div class="content-left">\n <div id="cropElem"></div>\n </div>\n <div class="content-right">\n <div class="filter-custom" cp-repeat="filter in $ctrl.filters">\n <h3>[[filter.label]]</h3>\n <div class="range-slider">\n <input class="range-slider__range" cp-model="filter.value" type="range" cp-attr.min="filter.min" cp-attr.max="filter.max" cp-attr.step="filter.step"\n />\n <span class="range-slider__value">\n [[ filter.value ]][[ filter.measure ]]\n </span>\n </div>\n </div>\n <div class="modal-crop-footer-options">\n <a cp-click="$ctrl.destroyCrop()">Cancelar</a>\n <button type="button" class="btn-modal-crop btn-modal-save-crop" cp-click="$ctrl.saveCrop()">Salvar</button>\n </div>\n </div>\n </div>\n <div class="content-image-crop-edit small" cp-class="{\'empty\' : !$ctrl.params.image}" cp-show="$ctrl.mode == \'view\'">\n <div class="content-left">\n <img cp-show="$ctrl.params.image" cp-attr.src="$ctrl.params.image" class="image-view">\n <div class="image-drop-area" cp-show="!$ctrl.params.image">\n <svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"\n viewBox="0 0 58 58" style="enable-background:new 0 0 58 58;" xml:space="preserve">\n <g>\n <path d="M57,6H1C0.448,6,0,6.447,0,7v44c0,0.553,0.448,1,1,1h56c0.552,0,1-0.447,1-1V7C58,6.447,57.552,6,57,6z M56,50H2V8h54V50z"\n />\n <path d="M16,28.138c3.071,0,5.569-2.498,5.569-5.568C21.569,19.498,19.071,17,16,17s-5.569,2.498-5.569,5.569\n C10.431,25.64,12.929,28.138,16,28.138z M16,19c1.968,0,3.569,1.602,3.569,3.569S17.968,26.138,16,26.138s-3.569-1.601-3.569-3.568\n S14.032,19,16,19z" />\n <path d="M7,46c0.234,0,0.47-0.082,0.66-0.249l16.313-14.362l10.302,10.301c0.391,0.391,1.023,0.391,1.414,0s0.391-1.023,0-1.414\n l-4.807-4.807l9.181-10.054l11.261,10.323c0.407,0.373,1.04,0.345,1.413-0.062c0.373-0.407,0.346-1.04-0.062-1.413l-12-11\n c-0.196-0.179-0.457-0.268-0.72-0.262c-0.265,0.012-0.515,0.129-0.694,0.325l-9.794,10.727l-4.743-4.743\n c-0.374-0.373-0.972-0.392-1.368-0.044L6.339,44.249c-0.415,0.365-0.455,0.997-0.09,1.412C6.447,45.886,6.723,46,7,46z"\n />\n </g>\n </svg>\n <h2>Solte a imagem</h2>\n </div>\n </div>\n <div class="content-right">\n\n <h2 class="modal-text-upload">Fazer upload</h2>\n\n <div class="upload-divider">\n <svg class="detail" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 78.56 7.99">\n <path class="pathdetaillogin" d="M11.82,5A9.21,9.21,0,0,0,23.76,5a7.23,7.23,0,0,1,9.59,0,9.21,9.21,0,0,0,11.9,0,7.24,7.24,0,0,1,9.56,0,9.21,9.21,0,0,0,12,0,7,7,0,0,1,4.78-1.8A6.47,6.47,0,0,1,75.68,4.5c.48-.47.95-1,1.41-1.45a8.6,8.6,0,0,0-5.55-1.88,8.94,8.94,0,0,0-6,2.2,7.24,7.24,0,0,1-9.56,0A9.21,9.21,0,0,0,44,3.37a7.23,7.23,0,0,1-9.55,0,9.21,9.21,0,0,0-11.94,0,7.23,7.23,0,0,1-9.55,0,8.94,8.94,0,0,0-6-2.2A8.58,8.58,0,0,0,1.51,3c.46.49.93,1,1.41,1.45A6.46,6.46,0,0,1,7,3.17,7,7,0,0,1,11.82,5Z"\n transform="translate(-0.04 -0.16)"></path>\n </svg>\n </div>\n\n <div class="modal-crop-buttons" cp-class="{\'no-drive\': !$ctrl.params.drive}">\n <div class="item">\n <button class="btn-modal-crop" cp-click="$ctrl.chooseFile()">\n <svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"\n width="548.172px" height="548.172px" viewBox="0 0 548.172 548.172" style="enable-background:new 0 0 548.172 548.172;"\n xml:space="preserve">\n <g>\n <path d="M534.75,49.965c-8.945-8.945-19.694-13.422-32.261-13.422H45.681c-12.562,0-23.313,4.477-32.264,13.422\n C4.471,58.913,0,69.663,0,82.226v310.633c0,12.566,4.471,23.315,13.417,32.265c8.951,8.945,19.702,13.414,32.264,13.414h155.318\n c0,7.231-1.524,14.661-4.57,22.269c-3.044,7.614-6.09,14.273-9.136,19.981c-3.042,5.715-4.565,9.897-4.565,12.56\n c0,4.948,1.807,9.24,5.424,12.847c3.615,3.621,7.898,5.435,12.847,5.435h146.179c4.949,0,9.233-1.813,12.848-5.435\n c3.62-3.606,5.427-7.898,5.427-12.847c0-2.468-1.526-6.611-4.571-12.415c-3.046-5.801-6.092-12.566-9.134-20.267\n c-3.046-7.71-4.569-15.085-4.569-22.128h155.318c12.56,0,23.309-4.469,32.254-13.414c8.949-8.949,13.422-19.698,13.422-32.265\n V82.226C548.176,69.663,543.699,58.913,534.75,49.965z M511.627,319.768c0,2.475-0.903,4.613-2.711,6.424\n c-1.81,1.804-3.952,2.707-6.427,2.707H45.681c-2.473,0-4.615-0.903-6.423-2.707c-1.807-1.817-2.712-3.949-2.712-6.424V82.226\n c0-2.475,0.902-4.615,2.712-6.423c1.809-1.805,3.951-2.712,6.423-2.712h456.815c2.471,0,4.617,0.904,6.42,2.712\n c1.808,1.809,2.711,3.949,2.711,6.423V319.768L511.627,319.768z" />\n </g>\n </svg>\n Computador\n </button>\n <input type="file" style="display: none;" hidden accept="image/x-png,image/gif,image/jpeg">\n </div>\n <div class="item" cp-show="$ctrl.params.drive">\n <button class="btn-modal-crop" cp-click="$ctrl.openPickerGoogle()">\n <svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"\n viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">\n <polygon style="fill:#FFC107;" points="341.344,352 512,352 341.344,32 170.656,32 " />\n <polygon style="fill:#2196F3;" points="158.464,352 85.344,480 432,480 512,352 " />\n <polygon style="fill:#4CAF50;" points="170.656,32 0,330.656 85.344,480 253.056,186.496 " />\n </svg>\n Google drive\n </button>\n </div>\n </div>\n\n </div>\n </div>\n\n</div>'},function(t,e){t.exports='<div class="modal-instance" cp-class="{ \'circle\' : $ctrl.$constants.type == \'circle\' }">\n <span class="close" cp-click="$ctrl.close();">×</span>\n <img class="modal-content" onclick="event.stopPropagation();" cp-attr.src="$ctrl.image" />\n</div>'},function(t,e){},function(t,e){t.exports='<div class="image-crop-card"\n cp-style="$ctrl.getCropStyle()"\n cp-class="{ \'circle\' : $ctrl.$constants.type == \'circle\' }">\n <div class="image-crop-card-content">\n <img cp-show="$ctrl.$bindings.cpModel"\n cp-attr.src="$ctrl.$bindings.cpModel"\n cp-click="$ctrl.viewImage($ctrl.$bindings.cpModel)" />\n <img cp-show="!$ctrl.$bindings.cpModel"\n cp-attr.src="$ctrl.$constants.defaultImage"\n cp-click="$ctrl.viewImage($ctrl.$constants.defaultImage)" />\n <div class="backdrop-crop-button"\n cp-click="$ctrl.openModalEditImage()">\n <div class="backdrop-crop-button-container">\n <svg version="1.1"\n xmlns="http://www.w3.org/2000/svg"\n xmlns:xlink="http://www.w3.org/1999/xlink"\n x="0px"\n y="0px"\n viewBox="0 0 100 100"\n style="enable-background:new 0 0 100 100;"\n xml:space="preserve">\n <g>\n <g>\n <path d="M50,40c-8.285,0-15,6.718-15,15c0,8.285,6.715,15,15,15c8.283,0,15-6.715,15-15\n\t\t\tC65,46.718,58.283,40,50,40z M90,25H78c-1.65,0-3.428-1.28-3.949-2.846l-3.102-9.309C70.426,11.28,68.65,10,67,10H33\n\t\t\tc-1.65,0-3.428,1.28-3.949,2.846l-3.102,9.309C25.426,23.72,23.65,25,22,25H10C4.5,25,0,29.5,0,35v45c0,5.5,4.5,10,10,10h80\n\t\t\tc5.5,0,10-4.5,10-10V35C100,29.5,95.5,25,90,25z M50,80c-13.807,0-25-11.193-25-25c0-13.806,11.193-25,25-25\n\t\t\tc13.805,0,25,11.194,25,25C75,68.807,63.805,80,50,80z M86.5,41.993c-1.932,0-3.5-1.566-3.5-3.5c0-1.932,1.568-3.5,3.5-3.5\n\t\t\tc1.934,0,3.5,1.568,3.5,3.5C90,40.427,88.433,41.993,86.5,41.993z" />\n </g>\n </g>\n </svg>\n <label>Alterar</label>\n </div>\n </div>\n </div>\n</div>'},function(t,e,n){"use strict";n.r(e);var r,i=n(0),o=n.n(i),s=n(6),a=n.n(s),c=n(5),u=n.n(c),l=n(4),p=n.n(l),f=n(3),h=n.n(f);!function(t){function e(t){n(t)}function n(t){var e=window.outerHeight,n=window.outerWidth;r(t,{transform:"translate(-50%, -50%) scale("+Math.min(t.parentNode.clientWidth/n,t.parentNode.clientHeight/e)+")"})}function r(t,e){Object.keys(e).forEach(function(n){return t.style[n]=e[n]})}function i(t,e){r(e,{position:"relative"}),r(t,{position:"absolute",left:"50%",top:"50%",transform:"translate(-50%, -50%)","transform-origin":"center center"})}t.onResize=e,t.relativeImage=function(t){var r=t.parentNode;i(t,r),n(t);var o=function(){return e(t)};return window.addEventListener("resize",o),o},t.destroy=function(t){window.removeEventListener("resize",t)},t.applyRelativeSize=n,t.handlingCss=r,t.defaultStyle=i}(r||(r={}));var d=function(){function t(t,e){this.element=e,this.imageElement=e.querySelector("img"),this.funcListener=r.relativeImage(this.imageElement)}return t.prototype.modalParams=function(t){this.image=t.url,this.$constants=t.constants,this.modalInstance=t.modalInstance},t.prototype.$destroy=function(){r.destroy(this.funcListener)},t.prototype.close=function(){this.modalInstance.close()},t}(),m=(n(12),n(11),n(2)),v=function(){function t(t){this.apiKey=t.apiKey,this.clientId=t.clientId,this.onSelect=t.onSelect,gapi.client.setApiKey(this.apiKey),gapi.client.load("drive","v2",this._driveApiLoaded.bind(this)),google.load("picker","1",{callback:this._pickerApiLoaded.bind(this)})}return t.prototype.open=function(){gapi.auth.getToken()?this._showPicker():this._doAuth(!1,function(){this._showPicker()}.bind(this))},t.prototype._showPicker=function(){try{var t=gapi.auth.getToken().access_token;this.picker=(new google.picker.PickerBuilder).addView(google.picker.ViewId.DOCS_IMAGES).setAppId(this.clientId).setOAuthToken(t).setCallback(this._pickerCallback.bind(this)).build().setVisible(!0)}catch(t){}},t.prototype._pickerCallback=function(t){if(t[google.picker.Response.ACTION]==google.picker.Action.PICKED){var e=t[google.picker.Response.DOCUMENTS][0][google.picker.Document.ID];gapi.client.drive.files.get({fileId:e}).execute(this._fileGetCallback.bind(this))}},t.prototype._fileGetCallback=function(t){if(this.onSelect){var e=gapi.auth.getToken().access_token;t.downloadUrl+="&access_token="+e,this.onSelect(t)}},t.prototype._pickerApiLoaded=function(){},t.prototype._driveApiLoaded=function(){this._doAuth(!0)},t.prototype._doAuth=function(t,e){gapi.auth.authorize({client_id:this.clientId,scope:"https://www.googleapis.com/auth/photos https://www.googleapis.com/auth/drive.readonly",immediate:t},e)},t}(),g=function(){function t(t,e){this.$element=e,this.mode="view",this.contentElement=this.$element.querySelector(".content-image-crop-edit")}return t.prototype.$onInit=function(){this.setDefaultFilters()},t.prototype.setDefaultFilters=function(){this.filters=[{label:"Brilho",name:"brightness",value:1,min:0,max:2,step:.1,measure:""},{label:"Contraste",name:"contrast",value:1,min:0,max:2,step:.1,measure:""},{label:"Saturação",name:"grayscale",value:0,min:0,max:1,step:.1,measure:""},{label:"Matriz",name:"hue-rotate",value:0,min:-100,max:100,step:1,measure:"deg"}]},t.prototype.setImageCrop=function(t){this.inputFile.value="",this.editImage=t,this.createCrop(),this.mode="crop"},t.prototype.fileSelectFunc=function(t){t.stopPropagation(),t.preventDefault();var e=document.querySelector(".content-image-crop-edit.small .content-left"),n=t.target.files||t.dataTransfer.files;if(n[0]&&n[0].type.match("image/*")){var r=n[0],i=new FileReader;i.onload=function(){e.$scope.scope.$ctrl.setImageCrop(i.result)},i.readAsDataURL(r)}},t.prototype.dragOverFunc=function(t){var e=document.querySelector(".content-image-crop-edit.small .content-left");t.stopPropagation(),t.preventDefault(),setTimeout(function(){"dragover"==t.type?e.classList.add("hover"):e.classList.remove("hover")})},t.prototype.chooseFile=function(){this.$element.querySelector('input[type="file"]').click()},t.prototype.$onViewInit=function(){this.fileDrag=this.$element.querySelector(".content-image-crop-edit.small .content-left"),this.inputFile=this.$element.querySelector('input[type="file"]'),this.fileDrag.addEventListener("drop",this.fileSelectFunc),this.inputFile.addEventListener("change",this.fileSelectFunc),this.fileDrag.addEventListener("dragover",this.dragOverFunc),this.fileDrag.addEventListener("dragleave",this.dragOverFunc)},t.prototype.setFilterInElement=function(t){if(t){var e=this.filters.reduce(function(t,e){return t+(e.name+"(")+e.value+(e.measure||"")+") "},"");r.handlingCss(t,{filter:e})}},t.prototype.$onChanges=function(){"crop"==this.mode&&(this.setFilterInElement(document.querySelector("canvas.cr-image")),this.setFilterInElement(document.querySelector("div.cr-viewport")))},t.prototype.modalParams=function(t){this.params=t},t.prototype.$destroy=function(){this.fileDrag.removeEventListener("dragover",this.dragOverFunc),this.fileDrag.removeEventListener("dragleave",this.dragOverFunc)},t.prototype.close=function(){this.params.modalInstance.close()},t.prototype.ok=function(){this.params.modalInstance.ok(this.params.image)},t.prototype.createCrop=function(){var t={viewport:{width:170,height:170,type:"circle"==this.params.type?"circle":"square"},zoomOnWheel:!0,enableOrientation:!0,checkCrossOrigin:!1},e=Object.assign(t,this.params.crop);this.crop=new m.Croppie(document.getElementById("cropElem"),e),this.crop.bind({url:this.editImage}).then(function(){})},t.prototype.destroyCrop=function(){this.crop.destroy(),this.mode="view"},t.prototype.saveCrop=function(){var t=this;this.crop.result({type:"rawcanvas"}).then(function(e){var n=e.toDataURL("image/png"),r=document.createElement("canvas");r.width=e.width,r.height=e.height;var i=r.getContext("2d");i.filter=t.filters.reduce(function(t,e){return t+(e.name+"(")+e.value+(e.measure||"")+") "},"");var o=new Image;o.onload=function(){i.drawImage(o,0,0),t.saveImage(r.toDataURL("image/png")),t.destroyCrop(),t.ok()},o.src=n})},t.prototype.openPickerGoogle=function(){var t=this;new v({apiKey:this.params.drive.apiKey,clientId:this.params.drive.clientId,onSelect:function(e){t.setImageCrop(e.downloadUrl)}}).open()},t.prototype.saveImage=function(t){this.params.image=t},t}(),y=function(){function t(){this.$constants=this.$constants||{}}return t.prototype.$onViewInit=function(){this.appendDriverAPI()},t.prototype.insertScript=function(t,e){var n=document.createElement("script");n.type="text/javascript",n.src=t,e.appendChild(n)},t.prototype.appendDriverAPI=function(){if(this.$constants.drive&&this.$constants.drive.apiKey&&this.$constants.drive.clientId){var t="https://www.google.com/jsapi?key="+this.$constants.drive.apiKey,e=document.getElementsByTagName("head")[0];e.querySelector('script[src="'+t+'"]')||this.insertScript(t,e),e.querySelector('script[src="https://apis.google.com/js/client.js"]')||this.insertScript("https://apis.google.com/js/client.js",e)}},t.prototype.$onBuild=function(){this.appendDriverAPI()},t.prototype.getCropStyle=function(){return{width:this.$constants&&this.$constants.width?this.$constants.width:"170px",height:this.$constants&&this.$constants.height?this.$constants.height:"170px"}},t.prototype.createModal=function(t){return new function(e){var n=this,r=document.createElement("div");r.innerHTML=e.template,r.classList.add("modal-cp-image-crop"),document.body.appendChild(r);var i=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];window.removeEventListener("keyup",o),document.body.removeChild(r),n.onClose&&n.onClose.apply(n,t)},o=function(t){27===t.keyCode&&i()};t.keyboard&&window.addEventListener("keyup",o),e.controller&&(b.controller(r,e.controller),r.$scope.scope.$ctrl.modalParams&&(t.params.modalInstance=this,r.$scope.scope.$ctrl.modalParams(t.params))),this.close=i,this.ok=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];i.apply(void 0,t),n.onOK&&n.onOK.apply(n,t)}}(t)},t.prototype.viewImage=function(t){this.createModal({template:p.a,keyboard:!0,controller:d,params:{url:t||"",constants:this.$constants}})},t.prototype.openModalEditImage=function(){var t=this;this.createModal({template:h.a,controller:g,keyboard:!0,params:Object.assign(this.$constants,{image:this.$bindings.cpModel})}).onOK=function(e){t.saveImageInModel(e)}},t.prototype.saveImageInModel=function(t){this.$bindings.cpModel=t},t}(),_={template:a.a,style:u.a,constants:["crop","drive","width","height","type","defaultImage"],functions:[],bindings:["cpModel"],controller:y};o.a.component("cp-image-crop",_);var b=e.default=o.a},function(t,e){var n,r,i=t.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(t){if(n===setTimeout)return setTimeout(t,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(t){n=o}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(t){r=s}}();var c,u=[],l=!1,p=-1;function f(){l&&c&&(l=!1,c.length?u=c.concat(u):p=-1,u.length&&h())}function h(){if(!l){var t=a(f);l=!0;for(var e=u.length;e;){for(c=u,u=[];++p<e;)c&&c[p].run();p=-1,e=u.length}c=null,l=!1,function(t){if(r===clearTimeout)return clearTimeout(t);if((r===s||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(t);try{r(t)}catch(e){try{return r.call(null,t)}catch(e){return r.call(this,t)}}}(t)}}function d(t,e){this.fun=t,this.array=e}function m(){}i.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];u.push(new d(t,e)),1!==u.length||l||a(h)},d.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=m,i.addListener=m,i.once=m,i.off=m,i.removeListener=m,i.removeAllListeners=m,i.emit=m,i.prependListener=m,i.prependOnceListener=m,i.listeners=function(t){return[]},i.binding=function(t){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(t){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(t,e,n){(function(t,e){!function(t,n){"use strict";if(!t.setImmediate){var r,i,o,s,a,c=1,u={},l=!1,p=t.document,f=Object.getPrototypeOf&&Object.getPrototypeOf(t);f=f&&f.setTimeout?f:t,"[object process]"==={}.toString.call(t.process)?r=function(t){e.nextTick(function(){d(t)})}:function(){if(t.postMessage&&!t.importScripts){var e=!0,n=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage("","*"),t.onmessage=n,e}}()?(s="setImmediate$"+Math.random()+"$",a=function(e){e.source===t&&"string"==typeof e.data&&0===e.data.indexOf(s)&&d(+e.data.slice(s.length))},t.addEventListener?t.addEventListener("message",a,!1):t.attachEvent("onmessage",a),r=function(e){t.postMessage(s+e,"*")}):t.MessageChannel?((o=new MessageChannel).port1.onmessage=function(t){d(t.data)},r=function(t){o.port2.postMessage(t)}):p&&"onreadystatechange"in p.createElement("script")?(i=p.documentElement,r=function(t){var e=p.createElement("script");e.onreadystatechange=function(){d(t),e.onreadystatechange=null,i.removeChild(e),e=null},i.appendChild(e)}):r=function(t){setTimeout(d,0,t)},f.setImmediate=function(t){"function"!=typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),n=0;n<e.length;n++)e[n]=arguments[n+1];var i={callback:t,args:e};return u[c]=i,r(c),c++},f.clearImmediate=h}function h(t){delete u[t]}function d(t){if(l)setTimeout(d,0,t);else{var e=u[t];if(e){l=!0;try{!function(t){var e=t.callback,r=t.args;switch(r.length){case 0:e();break;case 1:e(r[0]);break;case 2:e(r[0],r[1]);break;case 3:e(r[0],r[1],r[2]);break;default:e.apply(n,r)}}(e)}finally{h(t),l=!1}}}}}("undefined"==typeof self?void 0===t?this:t:self)}).call(this,n(1),n(8))},function(t,e,n){(function(t){var r=Function.prototype.apply;function i(t,e){this._id=t,this._clearFn=e}e.setTimeout=function(){return new i(r.call(setTimeout,window,arguments),clearTimeout)},e.setInterval=function(){return new i(r.call(setInterval,window,arguments),clearInterval)},e.clearTimeout=e.clearInterval=function(t){t&&t.close()},i.prototype.unref=i.prototype.ref=function(){},i.prototype.close=function(){this._clearFn.call(window,this._id)},e.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},e.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},e._unrefActive=e.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout(function(){t._onTimeout&&t._onTimeout()},e))},n(9),e.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==t&&t.setImmediate||this&&this.setImmediate,e.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==t&&t.clearImmediate||this&&this.clearImmediate}).call(this,n(1))},function(t,e){},function(t,e){},function(module,exports,__webpack_require__){!function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:r})},n.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},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="/dist/",n(n.s="../src/index.ts")}({"../node_modules/lodash/lodash.js":
/*!****************************************!*\
!*** ../node_modules/lodash/lodash.js ***!
\****************************************/
/*! no static exports found */function(t,e,n){(function(t,r){var i;
/**
* @license
* Lodash <https://lodash.com/>
* Copyright JS Foundation and other contributors <https://js.foundation/>
* Released under MIT license <https://lodash.com/license>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
*/
/**
* @license
* Lodash <https://lodash.com/>
* Copyright JS Foundation and other contributors <https://js.foundation/>
* Released under MIT license <https://lodash.com/license>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
*/
(function(){var o,s=200,a="Expected a function",c="__lodash_hash_undefined__",u="__lodash_placeholder__",l=1,p=2,f=4,h=1,d=2,m=1,v=2,g=4,y=8,_=16,b=32,E=64,w=128,C=256,A=512,T=800,x=16,I=1/0,S=9007199254740991,O=1.7976931348623157e308,N=NaN,R=4294967295,M=R-1,P=R>>>1,j=[["ary",w],["bind",m],["bindKey",v],["curry",y],["curryRight",_],["flip",A],["partial",b],["partialRight",E],["rearg",C]],k="[object Arguments]",B="[object Array]",L="[object AsyncFunction]",U="[object Boolean]",$="[object Date]",D="[object DOMException]",F="[object Error]",W="[object Function]",V="[object GeneratorFunction]",z="[object Map]",H="[object Number]",K="[object Null]",Z="[object Object]",q="[object Proxy]",G="[object RegExp]",Y="[object Set]",X="[object String]",J="[object Symbol]",Q="[object Undefined]",tt="[object WeakMap]",et="[object ArrayBuffer]",nt="[object DataView]",rt="[object Float32Array]",it="[object Float64Array]",ot="[object Int8Array]",st="[object Int16Array]",at="[object Int32Array]",ct="[object Uint8Array]",ut="[object Uint8ClampedArray]",lt="[object Uint16Array]",pt="[object Uint32Array]",ft=/\b__p \+= '';/g,ht=/\b(__p \+=) '' \+/g,dt=/(__e\(.*?\)|\b__t\)) \+\n'';/g,mt=/&(?:amp|lt|gt|quot|#39);/g,vt=/[&<>"']/g,gt=RegExp(mt.source),yt=RegExp(vt.source),_t=/<%-([\s\S]+?)%>/g,bt=/<%([\s\S]+?)%>/g,Et=/<%=([\s\S]+?)%>/g,wt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ct=/^\w*$/,At=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Tt=/[\\^$.*+?()[\]{}|]/g,xt=RegExp(Tt.source),It=/^\s+|\s+$/g,St=/^\s+/,Ot=/\s+$/,Nt=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Rt=/\{\n\/\* \[wrapped with (.+)\] \*/,Mt=/,? & /,Pt=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,jt=/\\(\\)?/g,kt=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Bt=/\w