New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

vue-advanced-cropper

Package Overview
Dependencies
Maintainers
1
Versions
117
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-advanced-cropper - npm Package Compare versions

Comparing version 0.13.2 to 0.14.0

54

dist/index.umd.js

@@ -1,52 +0,2 @@

(function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vue")):"function"==typeof define&&define.amd?define(["exports","vue"],t):(e=e||self,t(e["vue-advanced-cropper"]={},e.Vue))})(this,function(e,t){'use strict';var _=Math.max,M=Math.pow,T=Math.min,L=String.fromCharCode;function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){for(var n,a=0;a<t.length;a++)n=t[a],n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}function a(e,t,i){return t&&n(e.prototype,t),i&&n(e,i),e}function o(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function s(e){for(var t=1;t<arguments.length;t++){var n=null==arguments[t]?{}:arguments[t],a=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(a=a.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),a.forEach(function(t){o(e,t,n[t])})}return e}function r(e){return h(e)||c(e)||l()}function h(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}}function c(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}function l(){throw new TypeError("Invalid attempt to spread non-iterable instance")}/**
* Returns a function, that, as long as it continues to be invoked, will not
* be triggered. The function will be called after it stops being called for
* N milliseconds. If `immediate` is passed, trigger the function on the
* leading edge, instead of the trailing. The function also has a property 'clear'
* that is a function which will clear the timer to prevent previously scheduled executions.
*
* @source underscore.js
* @see http://unscriptable.com/2009/03/20/debouncing-javascript-methods/
* @param {Function} function to wrap
* @param {Number} timeout in ms (`100`)
* @param {Boolean} whether to execute at the beginning (`false`)
* @api public
*/function d(e,t,i){function n(){var c=Date.now()-r;c<t&&0<=c?a=setTimeout(n,t-c):(a=null,!i&&(h=e.apply(s,o),s=o=null))}var a,o,s,r,h;null==t&&(t=100);var c=function(){s=this,o=arguments,r=Date.now();var c=i&&!a;return a||(a=setTimeout(n,t)),c&&(h=e.apply(s,o),s=o=null),h};return c.clear=function(){a&&(clearTimeout(a),a=null)},c.flush=function(){a&&(h=e.apply(s,o),s=o=null,clearTimeout(a),a=null)},c}function m(e,t){var i,n;return e&&t?(i="".concat(e).concat(t[0].toUpperCase()).concat(t.slice(1)),n="".concat(e,"-").concat(t)):(i=e||t,n=e||t),{name:i,classname:n}}function p(e){return /^data:/.test(e)||/^blob:/.test(e)}function g(e){if(p(e))return!1;var t=window.location,i=/(\w+:)?(?:\/\/)([\w.-]+)?(?::(\d+))?\/?/,n=i.exec(e)||[],a={protocol:n[1]||"",host:n[2]||"",port:n[3]||""},o=function(e){return{"http:":80,"https:":443}[e]},s=function(e){return e.port||o(e.protocol||t.protocol)};return(a.protocol||a.host||a.port)&&!!!(a.protocol&&a.protocol==t.protocol&&a.host&&a.host==t.host&&a.host&&s(a)==s(t))}function u(e){return"undefined"==typeof e}function f(e){var t="timestamp=".concat(new Date().getTime());return e+(-1===e.indexOf("?")?"?":"&")+t}function v(e,t,i){var n=Math.PI,a=i.flipped,o=i.orientation,s=t.naturalWidth,r=t.naturalHeight,h=e.getContext("2d");return e.width=s,e.height=r,h.save(),a&&(e.width=r,e.height=s),2==o?(h.translate(s,0),h.scale(-1,1)):3==o?(h.translate(s,r),h.rotate(1*n)):4==o?(h.translate(0,r),h.scale(1,-1)):5==o?(h.rotate(90/180*n),h.scale(1,-1)):6==o?(h.rotate(90/180*n),h.translate(0,-r)):7==o?(h.rotate(270/180*n),h.translate(-s,r),h.scale(1,-1)):8==o&&(h.translate(0,s),h.rotate(270/180*n)),h.drawImage(t,0,0,s,r),h.restore(),e}function w(e){var t={orientation:e};return e&&(2===e?t.scaleX=-1:3===e?t.rotate=-180:4===e?t.scaleY=-1:5===e?(t.rotate=90,t.scaleY=-1):6===e?t.rotate=90:7===e?(t.rotate=90,t.scaleX=-1):8===e?t.rotate=-90:void 0),(90===t.rotate||-90===t.rotate)&&(t.flipped=!0),t}function y(e){var t=e.rotate,i=e.scaleX,n=e.scaleY,a="";return(t||i||n)&&(t&&(a+=" rotate(".concat(t,"deg) ")),i&&(a+=" scaleX(".concat(i,") ")),n&&(a+=" scaleY(".concat(n,") "))),a}function x(e){return new Promise(function(t){b(e).then(function(e){t(e?{arrayBuffer:e,orientation:E(e)}:{arrayBuffer:null,orientation:null})}).catch(function(e){console.warn(e),t({arrayBuffer:null,orientation:null})})})}function b(e){return new Promise(function(t,i){try{if(!e)i("Error: the image is empty");else// Data URL
if(/^data:/i.test(e))t(z(e));else if(/^blob:/i.test(e)){var n=new FileReader;n.onload=function(i){t(i.target.result)},C(e,function(e){n.readAsArrayBuffer(e)})}else{var a=new XMLHttpRequest;a.onreadystatechange=function(){4!==this.readyState||(200===this.status||0===this.status?t(this.response):i("Warning: could not load an image to parse its orientation"),a=null)},a.onprogress=function(){"image/jpeg"!==a.getResponseHeader("content-type")&&a.abort()},a.withCredentials=!1,a.open("GET",e,!0),a.responseType="arraybuffer",a.send(null)}}catch(t){i(t)}})}function C(e,t){var i=new XMLHttpRequest;i.open("GET",e,!0),i.responseType="blob",i.onload=function(){(200==this.status||0===this.status)&&t(this.response)},i.send()}function z(e){e=e.replace(/^data:([^;]+);base64,/gmi,"");for(var t=atob(e),n=t.length,a=new ArrayBuffer(n),o=new Uint8Array(a),s=0;s<n;s++)o[s]=t.charCodeAt(s);return a}function S(e,t,n){var a,o="";for(a=t,n+=t;a<n;a++)o+=L(e.getUint8(a));return o}function E(e){try{var t,n,a,o,s,r,h=new DataView(e);// Only handle JPEG image (start by 0xFFD8)
if(255===h.getUint8(0)&&216===h.getUint8(1))for(var c=h.byteLength,l=2;l+1<c;){if(255===h.getUint8(l)&&225===h.getUint8(l+1)){s=l;break}l++}if(s&&(n=s+4,a=s+10,"Exif"===S(h,n,4))){var d=h.getUint16(a);if(o=18761===d,(o||19789===d)&&42===h.getUint16(a+2,o)/* bigEndian */){var m=h.getUint32(a+4,o);8<=m&&(r=a+m)}}if(r)for(var p,g=h.getUint16(r,o),u=0;u<g;u++)if(p=r+12*u+2,274===h.getUint16(p,o)/* Orientation */){p+=8,t=h.getUint16(p,o),h.setUint16(p,1,o);break}return t}catch(e){return null}}function W(e){for(var t=[],i=8192,n=new Uint8Array(e)// Chunk Typed Array for better performance (#435)
;0<n.length;){var a=n.subarray(0,i);t.push(L.apply(null,Array.from?Array.from(a):Array.slice(a))),n=n.subarray(i)}return"data:image/jpeg;base64,".concat(btoa(t.join("")))}function H(e,t,i){return e.width+i*(t.left+t.right)}function $(e,t,i){return e.height+i*(t.top+t.bottom)}function R(e,t,i,n,a,o){var r=Math.abs,h=Math.floor,c=Math.ceil,l=i.minHeight,d=i.minWidth,m=i.maxHeight,p=i.maxWidth,g=s({},e),u=H(t,g,n),f=$(t,g,n);0>u&&(0>g.left&&0>g.right?(g.left=-(t.width-d)/(g.left/g.right),g.right=-(t.width-d)/(g.right/g.left)):0>g.left?g.left=-(t.width-d)/n:0>g.right&&(g.right=-(t.width-d)/n)),0>f&&(0>g.top&&0>g.bottom?(g.top=-(t.height-l)/(g.top/g.bottom),g.bottom=-(t.height-l)/(g.bottom/g.top)):0>g.top?g.top=-(t.height-l):0>g.bottom&&(g.bottom=-(t.height-l)));var v={width:1/0,height:1/0};// If ratio is not broken, resize all directions independently
if(g.right+g.left&&(c(t.left+t.width+n*g.right)>a.width&&(v.width=T(v.width,r(h(a.width-(t.left+t.width))/(n*g.right)))),0>t.left-n*g.left&&(v.width=T(v.width,r(t.left/(n*g.left)))),u<d&&(v.width=T(v.width,r((t.width-d)/((g.right+g.left)*n)))),u>p&&(v.width=T(v.width,r((p-t.width)/((g.right+g.left)*n))))),g.top+g.bottom&&(c(t.top+t.height+n*g.bottom)>a.height&&(v.height=T(v.height,r(h(a.height-(t.top+t.height))/(n*g.bottom)))),0>t.top-n*g.top&&(v.height=T(v.height,r(t.top/(n*g.top)))),f<l&&(v.height=T(v.height,r((t.height-l)/((g.top+g.bottom)*n)))),f>m&&(v.height=T(v.height,r((m-t.height)/((g.top+g.bottom)*n))))),v.width<M(10,-1)&&(v.width=0),v.height<M(10,-1)&&(v.height=0),!o)v.width!==1/0&&re.forEach(function(e){g[e]*=v.width}),v.height!==1/0&&he.forEach(function(e){g[e]*=v.height});else{var w;v.height<v.width?w=v.height:g.right+g.left&&(w=v.width),(v.height!==1/0||v.width!==1/0)&&ce.forEach(function(e){g[e]*=w})}return g}function D(e,t,i){function n(n){return console.warn("The arguments will be passed to the prop '".concat(t,"' as an single object {").concat(Object.keys(n).join(","),"} in the future releases. You should change the interface of your function.")),e.apply(void 0,r(i(n)))}return function(t){if(1<e.length)return n(t);try{return e(t)}catch(i){return n(t)}}}t=t&&t.hasOwnProperty("default")?t["default"]:t;var P=function(e,t){return t={exports:{}},e(t,t.exports),t.exports}(function(e){/*!
Copyright (c) 2017 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/ /* global define */(function(){function t(){for(var e,n=[],a=0;a<arguments.length;a++)if(e=arguments[a],e){var o=typeof e;if("string"===o||"number"===o)n.push(e);else if(Array.isArray(e)&&e.length){var s=t.apply(null,e);s&&n.push(s)}else if("object"===o)for(var r in e)i.call(e,r)&&e[r]&&n.push(r)}return n.join(" ")}var i={}.hasOwnProperty;e.exports?(t.default=t,e.exports=t):window.classNames=t})()}),A=function(e){return function(t,i){if(!t)return e;var n;"string"==typeof t?n=t:i=t;var a=e;return n&&(a+="__"+n),a+(i?Object.keys(i).reduce(function(e,t){var n=i[t];return n&&(e+=" "+("boolean"==typeof n?a+"--"+t:a+"--"+t+"_"+n)),e},""):"")}};/**
* BEM class name factory.
*
* @typedef {Function} Bem
* @param {String|Object} [elementOrMods] Element name or hash object with mods
* @param {Object} [mods] Hash object with mods
* @returns {String}
*/ /**
* Returns BEM class name factory.
*
* @param {String} componentName Block name
* @returns {Bem}
*/d.debounce=d;var Y=function e(t,n,a){i(this,e),this.nativeEvent=t,this.directions=n,this.params=a},X=function e(t,n){i(this,e),this.nativeEvent=t,this.directions=n},k=/*#__PURE__*/function(){function e(t,n,a,o,s){i(this,e),this.nativeEvent=t,this.position=a,this.previousPosition=o,this.element=n,this.anchor=s}return a(e,[{key:"shift",value:function(){var e=this.element,t=this.anchor,i=this.position,n=e.getBoundingClientRect(),a=n.left,o=n.top;return{left:i.left-a-t.left,top:i.top-o-t.top}}}]),e}(),I={name:"DraggableElement",mixins:[{beforeMount:function(){window.addEventListener("mouseup",this.onMouseUp,{passive:!1}),window.addEventListener("mousemove",this.onMouseMove,{passive:!1}),window.addEventListener("touchmove",this.onTouchMove,{passive:!1}),window.addEventListener("touchend",this.onTouchEnd,{passive:!1})},beforeDestroy:function(){window.removeEventListener("mouseup",this.onMouseUp),window.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("touchmove",this.onTouchMove),window.removeEventListener("touchend",this.onTouchEnd)},mounted:function(){if(!this.$refs.draggable)throw new Error("You should add ref \"draggable\" to your root element to use draggable mixin");this.touches=[],this.draggingAnchor=[],this.hovered=!1},methods:{onMouseOver:function(){this.hovered||(this.hovered=!0,this.$emit("enter"))},onMouseLeave:function(){this.hovered&&(this.hovered=!1,this.$emit("leave"))},onTouchStart:function(t){t.cancelable&&(this.touches=r(t.touches),!this.hovered&&this.$emit("enter"),t.touches.length&&this.initAnchor(this.touches.reduce(function(e,i){return{clientX:e.clientX+i.clientX/t.touches.length,clientY:e.clientY+i.clientY/t.touches.length}},{clientX:0,clientY:0})),t.preventDefault&&t.preventDefault(),t.stopPropagation())},onTouchEnd:function(){this.processEnd()},onTouchMove:function(t){this.touches.length&&(this.processMove(t,t.touches),t.preventDefault&&t.preventDefault(),t.stopPropagation&&t.stopPropagation())},onMouseDown:function(t){var e={fake:!0,clientX:t.clientX,clientY:t.clientY};this.touches=[e],this.initAnchor(e),t.stopPropagation()},onMouseMove:function(t){this.touches.length&&(this.processMove(t,[{fake:!0,clientX:t.clientX,clientY:t.clientY}]),t.preventDefault&&t.preventDefault())},onMouseUp:function(){this.touches=[]},initAnchor:function(e){var t=this.$refs.draggable,i=t.getBoundingClientRect(),n=i.left,a=i.right,o=i.bottom,s=i.top;this.anchor={left:e.clientX-n,top:e.clientY-s,bottom:o-e.clientY,right:a-e.clientX}},processMove:function(e,t){var i=r(t);if(this.touches.length){if(1===this.touches.length&&1===i.length){var n=this.$refs.draggable;this.$emit("drag",new k(e,n,{left:i[0].clientX,top:i[0].clientY},{left:this.touches[0].clientX,top:this.touches[0].clientY},this.anchor))}this.touches=i}},processEnd:function(){this.touches=[],this.hovered&&(this.$emit("leave"),this.hovered=!1)}}}],props:{classname:{type:String}}},B=function(e,t,i,n,a,o/* server only */,s,r,h,c){"boolean"!=typeof s&&(h=r,r=s,s=!1);// Vue.extend constructor export interop.
var l="function"==typeof i?i.options:i;// render functions
e&&e.render&&(l.render=e.render,l.staticRenderFns=e.staticRenderFns,l._compiled=!0,a&&(l.functional=!0)),n&&(l._scopeId=n);var d;if(o?(d=function(e){e=e||// cached call
this.$vnode&&this.$vnode.ssrContext||// stateful
this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,e||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),t&&t.call(this,h(e)),e&&e._registeredComponents&&e._registeredComponents.add(o)},l._ssrRegister=d):t&&(d=s?function(){t.call(this,c(this.$root.$options.shadowRoot))}:function(e){t.call(this,r(e))}),d)if(l.functional){// register for functional component in vue file
var m=l.render;l.render=function(e,t){return d.call(t),m(e,t)}}else{// inject component registration as beforeCreate hook
var p=l.beforeCreate;l.beforeCreate=p?[].concat(p,d):[d]}return i},U=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{ref:"draggable",class:e.classname,on:{touchstart:e.onTouchStart,mousedown:e.onMouseDown,mouseover:e.onMouseOver,mouseleave:e.onMouseLeave}},[e._t("default")],2)};U._withStripped=!0;/* style */var F=B({render:U,staticRenderFns:[]},void 0,I,void 0,!1,void 0,void 0,void 0),O=A("vue-handler-wrapper"),N={name:"HandlerWrapper",components:{DraggableElement:F},props:{horizontalPosition:{type:String},verticalPosition:{type:String},classname:{type:String}},computed:{classnames:function(){var e;if(this.horizontalPosition||this.verticalPosition){var t=m(this.horizontalPosition,this.verticalPosition);e=P(this.classname,O(o({},t.classname,!0)))}else e=P(this.classname,O());return{default:e,draggable:O("draggable")}}}},q=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{class:e.classnames.default},[i("DraggableElement",{class:e.classnames.draggable,on:{drag:function(t){return e.$emit("drag",t)},leave:function(){return e.$emit("leave")},enter:function(){return e.$emit("enter")}}},[e._t("default")],2)],1)};/* scoped */q._withStripped=!0;/* style */var j=B({render:q,staticRenderFns:[]},void 0,N,void 0,!1,void 0,void 0,void 0),G=A("vue-line-wrapper"),K={name:"LineWrapper",components:{DraggableElement:F},props:{position:{type:String,required:!0}},computed:{classname:function(){return G(o({},this.position,!0))}}},V=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("DraggableElement",{class:e.classname,on:{drag:function(t){return e.$emit("drag",t)},leave:function(){return e.$emit("leave")},enter:function(){return e.$emit("enter")}}},[e._t("default")],2)};/* scoped */V._withStripped=!0;/* style */var J=B({render:V,staticRenderFns:[]},void 0,K,void 0,!1,void 0,void 0,void 0),Z=A("vue-bounding-box"),Q=["east","west",null],ee=["south","north",null],te={name:"BoundingBox",props:{classname:{type:String},handlers:{type:Object,default:function(){return{eastNorth:!0,north:!0,westNorth:!0,west:!0,westSouth:!0,south:!0,eastSouth:!0,east:!0}}},handlerComponent:{type:[Object,String]},handlersClassnames:{type:Object,default:function(){return{}}},lines:{type:Object,default:function(){return{west:!0,north:!0,east:!0,south:!0}}},lineComponent:{type:[Object,String]},linesClassnames:{type:Object,default:function(){return{}}}},data:function(){var e=[];return Q.forEach(function(t){ee.forEach(function(i){if(t!==i){var n=m(t,i),a=n.name,o=n.classname;e.push({name:a,classname:o,verticalDirection:i,horizontalDirection:t})}})}),{points:e}},computed:{classnames:function(){var e=this.handlersClassnames,t=this.linesClassnames;return{default:P(Z(),this.classname),handlers:e,lines:t}},lineNodes:function(){var e=this,t=[];return this.points.forEach(function(i){i.horizontalDirection&&i.verticalDirection||!e.lines[i.name]||t.push({name:i.name,component:e.lineComponent,classname:P(e.classnames.lines.default,e.classnames.lines[i.name]),hoverClassname:e.classnames.lines.hover,verticalDirection:i.verticalDirection,horizontalDirection:i.horizontalDirection})}),t},handlerNodes:function(){var e=this,t=[];return this.points.forEach(function(i){e.handlers[i.name]&&t.push({name:i.name,component:e.handlerComponent,classname:P(e.classnames.handlers.default,e.classnames.handlers[i.name]),hoverClassname:e.classnames.handlers.hover,verticalDirection:i.verticalDirection,horizontalDirection:i.horizontalDirection})}),t}},beforeMount:function(){window.addEventListener("mouseup",this.onMouseUp,{passive:!1}),window.addEventListener("mousemove",this.onMouseMove,{passive:!1}),window.addEventListener("touchmove",this.onTouchMove,{passive:!1}),window.addEventListener("touchend",this.onTouchEnd,{passive:!1})},beforeDestroy:function(){window.removeEventListener("mouseup",this.onMouseUp),window.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("touchmove",this.onTouchMove),window.removeEventListener("touchend",this.onTouchEnd)},mounted:function(){this.touches=[],this.draggingAnchor=[]},methods:{onHandlerDrag:function(e,t,i){var n=e.shift(),a=n.left,o=n.top,s={left:0,right:0,top:0,bottom:0};"west"===t?s.left-=a:"east"==t&&(s.right+=a),"north"===i?s.top-=o:"south"==i&&(s.bottom+=o);var r;!i&&t?r="width":i&&!t&&(r="height"),this.$emit("resize",new Y(e.nativeEvent,s,{allowedDirections:{left:"west"===t||!t,right:"east"===t||!t,bottom:"south"===i||!i,top:"north"===i||!i},preserveAspectRatio:e.nativeEvent.shiftKey,respectDirection:r}))}}},ie=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{ref:"box",class:e.classnames.default},[e._t("default"),e._v(" "),i("div",e._l(e.lineNodes,function(t){return i(t.component,{key:t.name,tag:"component",attrs:{classname:t.classname,"hover-classname":t.hoverClassname,position:t.name},on:{drag:function(i){return e.onHandlerDrag(i,t.horizontalDirection,t.verticalDirection)}}})}),1),e._v(" "),i("div",e._l(e.handlerNodes,function(t){return i(t.component,{key:t.name,tag:"component",attrs:{classname:t.classname,"hover-classname":t.hoverClassname,"horizontal-position":t.horizontalDirection,"vertical-position":t.verticalDirection},on:{drag:function(i){return e.onHandlerDrag(i,t.horizontalDirection,t.verticalDirection)}}})}),1)],2)};/* scoped */ie._withStripped=!0;/* style */var ne=B({render:ie,staticRenderFns:[]},void 0,te,void 0,!1,void 0,void 0,void 0),ae=A("vue-draggable-area"),oe=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{ref:"container",on:{touchstart:e.onTouchStart,mousedown:e.onMouseDown}},[e._t("default")],2)};/* scoped */oe._withStripped=!0;/* style */var se=B({render:oe,staticRenderFns:[]},void 0,{name:"DraggableArea",computed:{classnames:function(){return{default:P(ae(),this.classname)}}},beforeMount:function(){window.addEventListener("mouseup",this.onMouseUp,{passive:!1}),window.addEventListener("mousemove",this.onMouseMove,{passive:!1}),window.addEventListener("touchmove",this.onTouchMove,{passive:!1}),window.addEventListener("touchend",this.onTouchEnd,{passive:!1})},beforeDestroy:function(){window.removeEventListener("mouseup",this.onMouseUp),window.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("touchmove",this.onTouchMove),window.removeEventListener("touchend",this.onTouchEnd)},mounted:function(){this.touches=[],this.draggingAnchor=[]},methods:{onTouchStart:function(t){t.cancelable&&(this.touches=r(t.touches),t.touches.length&&this.initAnchor(this.touches.reduce(function(e,i){return{clientX:e.clientX+i.clientX/t.touches.length,clientY:e.clientY+i.clientY/t.touches.length}},{clientX:0,clientY:0})),t.preventDefault&&t.preventDefault(),t.stopPropagation())},onTouchEnd:function(){this.processEnd()},onTouchMove:function(t){this.touches.length&&(this.processMove(t,t.touches),t.preventDefault&&t.preventDefault(),t.stopPropagation&&t.stopPropagation())},onMouseDown:function(t){var e={fake:!0,clientX:t.clientX,clientY:t.clientY};this.touches=[e],this.initAnchor(e),t.stopPropagation()},onMouseMove:function(t){this.touches.length&&(this.processMove(t,[{fake:!0,clientX:t.clientX,clientY:t.clientY}]),t.preventDefault&&t.cancelable&&t.preventDefault())},onMouseUp:function(){this.touches=[]},initAnchor:function(e){var t=this.$refs.container,i=t.getBoundingClientRect(),n=i.left,a=i.top;this.anchor={x:e.clientX-n,y:e.clientY-a}},processMove:function(e,t){var i=this,n=r(t);if(this.touches.length){var a=this.$refs.container,o=a.getBoundingClientRect(),s=o.left,h=o.top;if(1===this.touches.length&&1===n.length)this.$emit("move",new X(e,{left:n[0].clientX-s-this.anchor.x,top:n[0].clientY-h-this.anchor.y}));else if(1<this.touches.length&&this.touches.length===n.length){var c=n.map(function(e,t){return{x:e.clientX-i.touches[t].clientX,y:e.clientY-i.touches[t].clientY,position:{clientX:e.clientX,clientY:e.clientY},length:Math.sqrt(M(e.clientX-i.touches[t].clientX,2)+M(e.clientY-i.touches[t].clientY,2))}}),l=c.reduce(function(e,t){return e+t.length},0),d={left:c.reduce(function(e,t,i){return e+(1-t.length/l)*n[i].clientX},0),top:c.reduce(function(e,t,i){return e+(1-t.length/l)*n[i].clientY},0)},m={top:0,bottom:0,left:0,right:0};c.forEach(function(e,t){.25<e.length/l&&(n[t].clientY>d.top?m.bottom+=e.y:m.top-=e.y,n[t].clientX>d.left?m.right+=e.x:m.left-=e.x)}),this.$emit("resize",new Y(e,m))}this.touches=n}},processEnd:function(){this.touches=[]}}},void 0,!1,void 0,void 0,void 0),re=["left","right"],he=["top","bottom"],ce=["left","right","top","bottom"],le=A("vue-preview-result"),de={name:"PreviewResult",props:{img:{type:Object},classname:{type:String},imageClassname:{type:String},resultCoordinates:{type:Object,default:function(){return{width:0,height:0,left:0,top:0}}},stencilCoordinates:{type:Object,default:function(){return{width:0,height:0,left:0,top:0}}}},computed:{classnames:function(){return{default:P(le(),this.classname),image:P(le("image"),this.imageClassname),wrapper:le("wrapper")}},wrapperStyle:function(){return{width:"".concat(this.stencilCoordinates.width,"px"),height:"".concat(this.stencilCoordinates.height,"px"),left:"calc(50% - ".concat(this.stencilCoordinates.width/2,"px)"),top:"calc(50% - ".concat(this.stencilCoordinates.height/2,"px)")}},imageStyle:function(){var e=this.img.transforms,t=this.img.size.width,i=this.img.size.height,n=this.stencilCoordinates.height/this.resultCoordinates.height,a=i*n,o=t*n,s=e.flipped,r={width:"".concat(o,"px"),height:"".concat(a,"px")};return s?(r.width="".concat(a,"px"),r.height="".concat(o,"px"),r.left="".concat(-this.stencilCoordinates.left-(a-o)/2,"px"),r.top="".concat(-this.stencilCoordinates.top-(o-a)/2,"px")):(r.width="".concat(o,"px"),r.height="".concat(a,"px"),r.left="".concat(-this.stencilCoordinates.left,"px"),r.top="".concat(-this.stencilCoordinates.top,"px")),r.transform=y(e),r}}},me=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{class:e.classnames.default},[i("div",{ref:"wrapper",class:e.classnames.wrapper,style:e.wrapperStyle},[i("img",{ref:"image",class:e.classnames.image,style:e.imageStyle,attrs:{src:e.img.src}})])])};/* scoped */me._withStripped=!0;/* style */var pe=B({render:me,staticRenderFns:[]},void 0,de,void 0,!1,void 0,void 0,void 0),ge=A("vue-square-handler"),ue={name:"SimpleHandler",components:{HandlerWrapper:j},props:{classname:{type:String},hoverClassname:{type:String},horizontalPosition:{type:String},verticalPosition:{type:String}},computed:{classnames:function(){return{default:P(ge(o({},this.position,!0)),this.classname,this.hover&&this.hoverClassname)}}},methods:{onDrag:function(e){this.$emit("drag",e)},onEnter:function(){this.hover=!0},onLeave:function(){this.hover=!1}}},fe=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("HandlerWrapper",{attrs:{"vertical-position":e.verticalPosition,"horizontal-position":e.horizontalPosition},on:{drag:e.onDrag}},[i("div",{class:e.classnames.default})])};/* scoped */fe._withStripped=!0;/* style */var ve=B({render:fe,staticRenderFns:[]},void 0,ue,void 0,!1,void 0,void 0,void 0),we=A("vue-simple-line"),ye={name:"SimpleLine",components:{LineWrapper:J},props:{classname:{type:String},hoverClassname:{type:String},position:{type:String}},data:function(){return{hover:!1}},computed:{classnames:function(){return{default:P(we(o({},this.position,!0)),this.classname,this.hover&&this.hoverClassname)}}},methods:{onDrag:function(e){this.$emit("drag",e)},onEnter:function(){this.hover=!0},onLeave:function(){this.hover=!1}}},xe=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("LineWrapper",{attrs:{position:e.position},on:{enter:e.onEnter,leave:e.onLeave,drag:e.onDrag}},[i("div",{class:e.classnames.default})])};/* scoped */xe._withStripped=!0;/* style */var be=B({render:xe,staticRenderFns:[]},void 0,ye,void 0,!1,void 0,void 0,void 0),Ce=A("vue-rectangle-stencil"),ze={name:"RectangleStencil",components:{PreviewResult:pe,BoundingBox:ne,DraggableArea:se},props:{img:{type:Object},resultCoordinates:{type:Object},stencilCoordinates:{type:Object},handlers:{type:Object},handlerComponent:{type:[Object,String],default:function(){return ve}},handlersClassnames:{type:Object,default:function(){return{}}},lines:{type:Object},lineComponent:{type:[Object,String],default:function(){return be}},linesClassnames:{type:Object,default:function(){return{}}},classname:{type:String},previewClassname:{type:String},boundingBoxClassname:{type:String},aspectRatio:{type:[Number,String]},minAspectRatio:{type:[Number,String]},maxAspectRatio:{type:[Number,String]}},computed:{classes:function(){return{stencil:P(Ce(),this.classname),preview:P(Ce("preview"),this.previewClassname),boundingBox:P(Ce("bounding-box"),this.boundingBoxClassname)}},style:function(){var e=this.stencilCoordinates,t=e.height,i=e.width,n=e.left,a=e.top;return{width:"".concat(i,"px"),height:"".concat(t,"px"),left:"".concat(n,"px"),top:"".concat(a,"px")}}},methods:{onMove:function(e){this.$emit("move",e)},onResize:function(e){this.$emit("resize",e)},aspectRatios:function(){return{minimum:this.aspectRatio||this.minAspectRatio,maximum:this.aspectRatio||this.maxAspectRatio}}}},Se=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{class:e.classes.stencil,style:e.style},[i("BoundingBox",{attrs:{classname:e.classes.boundingBox,handlers:e.handlers,"handler-component":e.handlerComponent,"handlers-classnames":e.handlersClassnames,lines:e.lines,"line-component":e.lineComponent,"lines-classnames":e.linesClassnames},on:{resize:e.onResize}},[i("DraggableArea",{on:{move:e.onMove}},[i("PreviewResult",{attrs:{img:e.img,classname:e.classes.preview,"result-coordinates":e.resultCoordinates,"stencil-coordinates":e.stencilCoordinates}})],1)],1)],1)};/* scoped */Se._withStripped=!0;/* style */var Ee=B({render:Se,staticRenderFns:[]},void 0,ze,void 0,!1,void 0,void 0,void 0),We=A("vue-circle-stencil"),He={name:"CircleStencil",components:{PreviewResult:pe,BoundingBox:ne,DraggableArea:se},props:{img:{type:Object},stencilClass:{type:String},resultCoordinates:{type:Object},stencilCoordinates:{type:Object},handlers:{type:Object,default:function(){return{eastNorth:!0,westNorth:!0,westSouth:!0,eastSouth:!0}}},handlerComponent:{type:[Object,String],default:function(){return ve}},handlersClassnames:{type:Object,default:function(){return{}}},lines:{type:Object},lineComponent:{type:[Object,String],default:function(){return be}},linesClassnames:{type:Object,default:function(){return{}}},classname:{type:String},previewClassname:{type:String},boundingBoxClassname:{type:String}},computed:{classes:function(){return{stencil:P(We(),this.classname),preview:P(We("preview"),this.previewClassname),boundingBox:P(We("bounding-box"),this.boundingBox)}},style:function(){var e=this.stencilCoordinates,t=e.height,i=e.width,n=e.left,a=e.top;return{width:"".concat(i,"px"),height:"".concat(t,"px"),left:"".concat(n,"px"),top:"".concat(a,"px")}}},methods:{onMove:function(e){this.$emit("move",e)},onResize:function(e){this.$emit("resize",e)},aspectRatios:function(){return{minimum:1,maximum:1}}}},$e=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{class:e.classes.stencil,style:e.style},[i("BoundingBox",{attrs:{classname:e.classes.boundingBox,handlers:e.handlers,"handler-component":e.handlerComponent,"handlers-classnames":e.handlersClassnames,lines:e.lines,"line-component":e.lineComponent,"lines-classnames":e.linesClassnames},on:{resize:e.onResize}},[i("DraggableArea",{on:{move:e.onMove}},[i("PreviewResult",{attrs:{img:e.img,classname:e.classes.preview,"result-coordinates":e.resultCoordinates,"stencil-coordinates":e.stencilCoordinates}})],1)],1)],1)};/* scoped */$e._withStripped=!0;/* style */var Re=B({render:$e,staticRenderFns:[]},void 0,He,void 0,!1,void 0,void 0,void 0),De=A("vue-advanced-cropper"),_e={name:"Cropper",props:{src:{type:String,default:null},resizeAlgorithm:{type:Function,default:function(e){var t=Math.round,i=e.coordinates,n=e.restrictions,a=e.imageSize,o=e.coefficient,r=e.aspectRatio,h=e.resizeEvent,c=s({},i,{right:i.left+i.width,bottom:i.top+i.height}),l=h.params||{},d=s({},h.directions),m=l.allowedDirections||{left:!0,right:!0,bottom:!0,top:!0};Object.keys(m).forEach(function(e){m[e]||(d[e]=0)});var p=H(c,d,o),g=$(c,d,o);d=R(d,c,n,o,a),p=H(c,d,o),g=$(c,d,o);// Checks ratio:
var u=null;if(l.preserveAspectRatio?u=c.width/c.height:r.minimum&&p/g<r.minimum?u=r.minimum:r.maximum&&p/g>r.maximum&&(u=r.maximum),u){var f=l.respectDirection;if(f||(c.width>c.height?f="width":f="height"),"width"===f){var v=c.height-p/u;m.top&&m.bottom?(d.bottom=-v/(2*o),d.top=-v/(2*o)):m.top?d.top=-v/o:m.bottom?d.bottom=-v/o:m.right?d.right=0:m.left&&(d.left=0)}else if("height"===f){var w=c.width-g*u;m.left&&m.right?(d.left=-w/(2*o),d.right=-w/(2*o)):m.left?d.left=-w/o:m.right?d.right=-w/o:m.top?d.top=0:m.bottom&&(d.bottom=0)}else ce.forEach(function(e){d[e]*=0})}// 3. Third step: check if desired box with correct aspect ratios break some limits and fit to this conditions
return d=R(d,c,n,o,a,u),{width:i.width+o*(t(d.right)+t(d.left)),height:i.height+o*(t(d.top)+t(d.bottom)),left:_(0,i.left-o*t(d.left)),top:_(0,i.top-o*t(d.top))}}},moveAlgorithm:{type:Function,default:function(e){var t=e.coordinates,i=e.imageSize,n=e.coefficient,a=e.moveEvent,o=s({},a.directions),r={left:t.left+n*o.left,top:t.top+n*o.top,width:t.width,height:t.height};return 0>r.left&&(r.left=0),r.left+r.width>i.width&&(r.left=_(0,i.width-r.width)),0>r.top&&(r.top=0),r.top+r.height>i.height&&(r.top=_(0,i.height-r.height)),r}// eslint-disable-next-line no-unused-vars
},defaultSize:{type:Function,default:// eslint-disable-next-line no-unused-vars
function(e){var t,i,n=e.cropper,a=e.image,o=e.minWidth,s=e.minHeight,r=e.maxWidth,h=e.maxHeight,c=e.imageWidth,l=e.imageHeight,d=e.props;return h>r?(t=_(s,.8*h),i=_(o,.8*r)):(i=_(o,.8*r),t=_(s,.8*h)),{height:t,width:i}}},defaultPosition:{type:Function,default:// eslint-disable-next-line no-unused-vars
function(e){var t=e.cropper,i=e.image,n=e.stencilWidth,a=e.stencilHeight,o=e.imageWidth,s=e.imageHeight,r=e.props;return{left:o/2-n/2,top:s/2-a/2}}},areaSize:{type:Function,default:function(e){var t=e.cropper,i=e.image,n=e.imageWidth,a=e.imageHeight,o=t.clientHeight,s=t.clientWidth,r=o,h=n*o/a;return h>s&&(h=s,r=a*s/n),{width:h,height:r}}},restrictions:{type:Function,default:function(e){var t=e.minWidth,i=e.minHeight,n=e.maxWidth,a=e.maxHeight,o=e.imageWidth,s=e.imageHeight;return{minWidth:t/100*o,minHeight:i/100*s,maxWidth:n?n/100*o:o,maxHeight:a?a/100*s:s}}},minWidth:{type:[Number,String],default:10},minHeight:{type:[Number,String],default:10},maxWidth:{type:[Number,String]},maxHeight:{type:[Number,String]},stencilComponent:{type:[Object,String],default:function(){return Ee}},stencilProps:{type:Object,default:function(){return{}}},classname:{type:String},imageClassname:{type:String},areaClassname:{type:String},backgroundClassname:{type:String},debounce:{type:Number,default:500},canvas:{type:Boolean,default:!0},checkCrossOrigin:{type:Boolean,default:!0},checkOrientation:{type:Boolean,default:!0},transitionTime:{type:Number,default:300}},data:function(){return{boundarySize:{width:null,height:null},imageLoaded:!1,imageAttributes:{crossOrigin:!1,src:null},imageTransforms:{rotate:null,scaleX:null,scaleY:null},imageSize:{width:null,height:null},coordinates:{left:0,top:0,width:0,height:0},frozenDirections:{width:!1,height:!1}}},computed:{coefficient:function(){return this.imageSize.width?this.imageSize.width/this.boundarySize.width:0},classes:function(){return{cropper:P(De(),this.classname),image:P(De("image"),this.imageClassname),area:P(De("area"),this.areaClassname),stretcher:P(De("stretcher")),background:P(De("background"),this.backgroundClassname)}},stencilCoordinates:function(){var e=this.coordinates,t=e.width,i=e.height,n=e.left,a=e.top;return{width:t/this.coefficient,height:i/this.coefficient,left:n/this.coefficient,top:a/this.coefficient}},wrapperStyle:function(){return{width:"".concat(this.stencilCoordinates.width,"px"),height:"".concat(this.stencilCoordinates.height,"px"),left:"".concat(this.stencilCoordinates.left,"px"),top:"".concat(this.stencilCoordinates.top,"px")}},areaStyle:function(){return{width:this.boundarySize.width?"".concat(this.boundarySize.width,"px"):"auto",height:this.boundarySize.height?"".concat(this.boundarySize.height,"px"):"auto",opacity:this.imageLoaded?1:0,transition:"opacity ".concat(this.transitionTime,"ms")}},imageStyle:function(){var e={left:"50%",top:"50%",transform:"translate(-50%, -50%)"+y(this.imageTransforms)},t=this.imageTransforms.flipped;return t?(e.width="".concat(this.boundarySize.height,"px"),e.height="".concat(this.boundarySize.width,"px")):(e.width="".concat(this.boundarySize.width,"px"),e.height="".concat(this.boundarySize.height,"px")),e},stencilRestrictions:function(){var e=D(this.restrictions,"restrictions",function(e){return[e.minWidth,e.minHeight,e.maxWidth,e.maxHeight,e.imageWidth,e.imageHeight]})({minWidth:+this.minWidth,minHeight:+this.minHeight,maxWidth:+this.maxWidth,maxHeight:+this.maxHeight,imageWidth:this.imageSize.width,imageHeight:this.imageSize.height,props:this.$props});return this.minWidth>this.imageSize.width&&(console.warn("Warning: minimum width (".concat(e.minWidth,"px) greater that the image width (").concat(this.imageSize.width,"px). It is set equal to the image width and width resizing was blocked")),e.minWidth=this.imageSize.width,e.widthFrozen=!0),this.minHeight>this.imageSize.height&&(console.warn("Warning: minimum height (".concat(e.minHeight,"px) greater that the image height (").concat(this.imageSize.height,"px). It is set equal to the image height and height resizing was blocked")),e.minHeight=this.imageSize.height,e.heightFrozen=!0),e.minWidth>e.maxWidth&&(console.warn("Warning: maximum width (".concat(e.maxWidth,"px) fewer that the minimum width (").concat(e.minWidth,"px). It is set equal to the minimum width and width resizing was blocked")),e.maxWidth=e.minWidth,e.widthFrozen=!0),e.minHeight>e.maxHeight&&(console.warn("Warning: maximum height (".concat(e.maxHeight,"px) fewer that the minimum height (").concat(e.minHeight,"px). It is set equal to the minimum height and height resizing was blocked")),e.maxHeight=e.minHeight,e.heightFrozen=!0),(!e.maxWidth||e.maxWidth>this.imageSize.width)&&(e.maxWidth=this.imageSize.width),(!e.maxHeight||e.maxHeight>this.imageSize.height)&&(e.maxHeight=this.imageSize.height),e}},watch:{src:function(){this.onChangeImage()},minWidth:function(){this.resetCoordinates()},maxWidth:function(){this.resetCoordinates()},minHeight:function(){this.resetCoordinates()},maxHeight:function(){this.resetCoordinates()}},mounted:function(){var e=this;this.debouncedUpdate=d(this.update,this.debounce),window.addEventListener("resize",this.refreshImage),window.addEventListener("orientationchange",this.refreshImage),this.$refs.image.addEventListener("load",function(){e.$refs.image&&e.refreshImage().then(e.resetCoordinates)}),this.onChangeImage()},destroyed:function(){window.removeEventListener("resize",this.refreshImage),window.removeEventListener("orientationchange",this.refreshImage)},methods:{// External methods
getResult:function(){return this.canvas&&this.src?(this.updateCanvas(this.coordinates),{coordinates:s({},this.coordinates),canvas:this.$refs.canvas}):{coordinates:s({},this.coordinates)}},// Internal methods
getArea:function(){return this.$refs.area},getStencil:function(){return this.$refs.stencil},updateCanvas:function(e){// This function can be asynchronously called because it's debounced
// Therefore there is workaround to prevent processing after the component was unmounted
if(this.$refs.canvas){var t=this.$refs.image,i=this.checkOrientation?v(this.$refs.sourceCanvas,t,this.imageTransforms):t,n=this.$refs.canvas;n.width=e.width,n.height=e.height;var a=n.getContext("2d");a.drawImage(i,e.left,e.top,e.width,e.height,0,0,e.width,e.height)}},update:function(){this.$emit("change",this.getResult())},onChangeCoordinates:function(e){var t=!(1<arguments.length&&arguments[1]!==void 0)||arguments[1];this.coordinates=e,this.$listeners&&this.$listeners.change&&(t?this.debouncedUpdate():this.update())},onChangeImage:function(){var e=this;if(this.imageLoaded=!1,this.delayedTransforms=null,this.src){var t=g(this.src);t&&this.canvas&&this.checkCrossOrigin&&(this.imageAttributes.crossOrigin="anonymous"),setTimeout(function(){e.checkOrientation?x(t?f(e.src):e.src).then(e.onParseImage):e.onParseImage({})},this.transitionTime)}else this.clearImage()},onParseImage:function(e){var i=this,n=e.arrayBuffer,a=e.orientation;this.imageAttributes.src=n&&a&&p(this.src)?W(n):this.src,this.imageTransforms=w(a),t.nextTick(function(){var e=i.$refs.image;e&&e.complete&&i.refreshImage().then(i.resetCoordinates)})},onResize:function(e){this.frozenDirections.width&&(e.directions.left=0,e.directions.right=0),this.frozenDirections.height&&(e.directions.top=0,e.directions.bottom=0),this.onChangeCoordinates(this.resizeAlgorithm({coordinates:this.coordinates,restrictions:this.stencilRestrictions,imageSize:this.imageSize,coefficient:this.coefficient,aspectRatio:this.stencilAspectRatios(),resizeEvent:e}))},onMove:function(e){this.onChangeCoordinates(this.moveAlgorithm({coordinates:this.coordinates,imageSize:this.imageSize,coefficient:this.coefficient,moveEvent:e}))},defaultCoordinates:function(){var e=this.stencilAspectRatios(),t=this.stencilRestrictions,i=t.minWidth,n=t.minHeight,a=t.maxWidth,o=t.maxHeight,s=this.imageSize,r={};if(!e.minimum&&!e.maximum)r.height=n,r.width=i;else{var h={width:{maximum:e.minimum?T(o,i/e.minimum):o,minimum:e.maximum?_(n,i/e.maximum):n},height:{maximum:e.maximum?T(a,n*e.maximum):a,minimum:e.mininum?_(i,n*e.mininum):i}};if(h.width.maximum>=h.width.minimum)r.width=i,r.height=h.width.minimum;else if(h.height.maximum>=h.height.minimum)r.height=n,r.width=h.height.minimum;else throw"Error: current aspect ratio is incompatible with minimum/maximum height and width settings. Can't setup default coordinates"}return r.left=s.width/2-r.width/2,r.top=s.height/2-r.height/2,r},setCoordinates:function(e){var i=this;t.nextTick(function(){return i.imageLoaded?void i.applyTransforms(e):void(i.delayedTransforms=e)})},applyTransforms:function(e){var t=this,i=this.imageSize,n=this.coefficient,a=this.stencilAspectRatios(),o=function(e,a){return t.moveAlgorithm({coordinates:e,imageSize:i,coefficient:n,moveEvent:new X(null,{left:(a.left-e.left)/n,top:(a.top-e.top)/n})})},r=function(e,s){var r=t.defaultCoordinates();return r=t.resizeAlgorithm({coordinates:r,restrictions:t.stencilRestrictions,imageSize:i,coefficient:n,aspectRatio:a,resizeEvent:new Y(null,{left:(s.width-r.width)/(2*n),right:(s.width-r.width)/(2*n),top:(s.height-r.height)/(2*n),bottom:(s.height-r.height)/(2*n)})}),o(r,{left:e.left,top:e.top})},h=this.coordinates;return e.forEach||(e=[e]),e.forEach(function(e){var i={};i="function"==typeof e?e(s({},h),t.imageSize):e,u(i.width)&&u(i.height)||(h=r(h,s({},h,i))),u(i.left)&&u(i.top)||(h=o(h,s({},h,i)))}),this.onChangeCoordinates(h,!1),h},resetCoordinates:function(){var e=this;// This function can be asynchronously called after completion of refreshing image promise
// Therefore there is a workaround to prevent processing after the component was unmounted
if(this.$refs.image){var t=this.$refs.cropper,i=this.$refs.image,n=this.stencilRestrictions,a=n.minWidth,o=n.minHeight,h=n.maxWidth,c=n.maxHeight,l=n.widthFrozen,d=n.heightFrozen;this.frozenDirections.width=!!l,this.frozenDirections.height=!!d;var m=D(this.defaultSize,"defaultSize",function(e){return[e.cropper,e.image,{minWidth:e.minWidth,minHeight:e.minHeight,maxWidth:e.maxWidth,maxHeight:e.maxHeight},e.imageWidth,e.imageHeight,e.props]})(s({cropper:t,image:i,imageWidth:this.imageSize.width,imageHeight:this.imageSize.height,props:this.$props},this.stencilRestrictions));(m.width<a||m.height<o||m.width>h||m.height>c)&&console.warn("Warning: default size breaking size restrictions. Check your defaultSize function");var p=[m,function(n){return s({},D(e.defaultPosition,"defaultPosition",function(e){return[e.cropper,e.image,e.stencilWidth,e.stencilHeight,e.imageWidth,e.imageHeight,e.props]})({cropper:t,image:i,stencilWidth:n.width,stencilHeight:n.height,imageWidth:e.imageSize.width,imageHeight:e.imageSize.height,props:e.$props}))}];this.delayedTransforms&&p.push.apply(p,r(Array.isArray(this.delayedTransforms)?this.delayedTransforms:[this.delayedTransforms])),this.applyTransforms(p),this.delayedTransforms=null,this.imageLoaded=!0}},clearImage:function(){var e=this.$refs.stretcher;this.imageLoaded=!1,this.onChangeCoordinates({left:0,top:0,width:0,height:0},!1),setTimeout(function(){e.style.height="auto",e.style.width="auto"},this.transitionTime)},refreshImage:function(){var e=this;if(this.src){var i=this.$refs.image,n=this.$refs.stretcher;this.imageTransforms.flipped?(this.imageSize.height=i.naturalWidth,this.imageSize.width=i.naturalHeight):(this.imageSize.height=i.naturalHeight,this.imageSize.width=i.naturalWidth);var a=this.imageSize.width/this.imageSize.height;return this.imageSize.height>this.imageSize.width?(n.style.height="".concat(this.imageSize.height,"px"),n.style.width="".concat(n.clientHeight*a,"px"),n.clientWidth/n.clientHeight!=a&&(n.style.height="".concat(n.clientWidth/a,"px"))):(n.style.width="".concat(this.imageSize.width,"px"),n.style.height="".concat(n.clientWidth/a,"px"),n.clientHeight/n.clientWidth!=a&&(n.style.width="".concat(n.clientHeight*a,"px"))),new Promise(function(i){var n=e.$refs.cropper,a=e.$refs.image;t.nextTick(function(){var t=D(e.areaSize,"areaSize",function(e){return[e.cropper,e.image,e.imageWidth,e.imageHeight]})({cropper:n,image:a,imageWidth:e.imageSize.width,imageHeight:e.imageSize.height}),o=t.height,s=t.width;o&&(e.boundarySize.height=o),s&&(e.boundarySize.width=s),i()})})}},stencilAspectRatios:function(){return this.$refs.stencil.aspectRatios?this.$refs.stencil.aspectRatios():{minimum:this.stencilProps.aspectRatio||this.stencilProps.minAspectRatio,maximum:this.stencilProps.aspectRatio||this.stencilProps.maxAspectRatio}}}},Me=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{ref:"cropper",class:e.classes.cropper},[i("div",{class:e.classes.background,style:e.areaStyle}),e._v(" "),i("div",{ref:"stretcher",class:e.classes.stretcher}),e._v(" "),i("div",{ref:"area",class:e.classes.area,style:e.areaStyle},[i("img",{ref:"image",class:e.classes.image,style:e.imageStyle,attrs:{crossOrigin:e.imageAttributes.crossOrigin,src:e.imageAttributes.src}}),e._v(" "),i(e.stencilComponent,e._b({ref:"stencil",tag:"component",attrs:{img:{src:e.imageAttributes.src,size:e.imageSize,transforms:e.imageTransforms},"result-coordinates":e.coordinates,"stencil-coordinates":e.stencilCoordinates},on:{resize:e.onResize,move:e.onMove}},"component",e.stencilProps,!1)),e._v(" "),e.canvas?i("canvas",{ref:"canvas",style:{display:"none"}}):e._e(),e._v(" "),e.canvas?i("canvas",{ref:"sourceCanvas",style:{display:"none"}}):e._e()],1)])};/* scoped */Me._withStripped=!0;/* style */var Te=B({render:Me,staticRenderFns:[]},void 0,_e,void 0,!1,void 0,void 0,void 0),Le=A("vue-preview-image"),Pe={name:"PreviewImage",props:{img:{type:String},classname:{type:String},imageClassname:{type:String},width:{type:Number},height:{type:Number},top:{type:Number},left:{type:Number},previewWidth:{type:Number,required:!0},previewHeight:{type:Number,required:!0}},data:function(){return{imageSize:{width:0,height:0}}},computed:{classnames:function(){return{default:P(Le(),this.classname),image:P(Le("image"),this.imageClassname)}},wrapperStyle:function(){return{width:"".concat(this.previewWidth,"px"),height:"".concat(this.previewHeight,"px")}},imageStyle:function(){var e=this.previewHeight/this.height,t=this.imageSize.height*e,i=this.imageSize.width*e;return{width:"".concat(i,"px"),height:"".concat(t,"px"),left:"".concat(-this.left*e,"px"),top:"".concat(-this.top*e,"px")}}},watch:{img:function(){this.onChangeImage()}},mounted:function(){this.onChangeImage()},methods:{refreshImage:function(){var e=this.$refs.image;this.imageSize.height=e.naturalHeight,this.imageSize.width=e.naturalWidth},onChangeImage:function(){var e=this,t=this.$refs.image;t.complete?this.refreshImage():t.addEventListener("load",function(){e.refreshImage()})}}},Ae=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{class:e.classnames.default,style:e.wrapperStyle},[i("img",{ref:"image",class:e.classnames.image,style:e.imageStyle,attrs:{src:e.img}})])};/* scoped */Ae._withStripped=!0;/* style */var Ye=B({render:Ae,staticRenderFns:[]},void 0,Pe,void 0,!1,void 0,void 0,void 0);/* scoped */t.component("cropper",Te),t.component("rectangle-stencil",Ee),t.component("circle-stencil",Re),t.component("simple-handler",ve),t.component("simple-line",be),e.BoundingBox=ne,e.CircleStencil=Re,e.Cropper=Te,e.DragEvent=k,e.DraggableArea=se,e.DraggableElement=F,e.HandlerWrapper=j,e.LineWrapper=J,e.MoveEvent=X,e.PreviewImage=Ye,e.PreviewResult=pe,e.RectangleStencil=Ee,e.ResizeEvent=Y,e.SimpleHandler=ve,e.SimpleLine=be,Object.defineProperty(e,"__esModule",{value:!0})});
(function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vue")):"function"==typeof define&&define.amd?define(["exports","vue"],t):(e=e||self,t(e["vue-advanced-cropper"]={},e.Vue))})(this,function(e,t){'use strict';var Y=Math.abs,X=Math.max,I=Math.min,k=Math.ceil,B=String.fromCharCode;function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){for(var o,a=0;a<t.length;a++)o=t[a],o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}function a(e,t,i){return t&&o(e.prototype,t),i&&o(e,i),e}function n(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function s(e){for(var t=1;t<arguments.length;t++){var o=null==arguments[t]?{}:arguments[t],a=Object.keys(o);"function"==typeof Object.getOwnPropertySymbols&&(a=a.concat(Object.getOwnPropertySymbols(o).filter(function(e){return Object.getOwnPropertyDescriptor(o,e).enumerable}))),a.forEach(function(t){n(e,t,o[t])})}return e}function r(e){return l(e)||c(e)||h()}function l(e){if(Array.isArray(e)){for(var t=0,o=Array(e.length);t<e.length;t++)o[t]=e[t];return o}}function c(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}function h(){throw new TypeError("Invalid attempt to spread non-iterable instance")}function d(e,t,i){function o(){var c=Date.now()-r;c<t&&0<=c?a=setTimeout(o,t-c):(a=null,!i&&(l=e.apply(s,n),s=n=null))}var a,n,s,r,l;null==t&&(t=100);var c=function(){s=this,n=arguments,r=Date.now();var c=i&&!a;return a||(a=setTimeout(o,t)),c&&(l=e.apply(s,n),s=n=null),l};return c.clear=function(){a&&(clearTimeout(a),a=null)},c.flush=function(){a&&(l=e.apply(s,n),s=n=null,clearTimeout(a),a=null)},c}function m(e,t){var i,o;return e&&t?(i="".concat(e).concat(t[0].toUpperCase()).concat(t.slice(1)),o="".concat(e,"-").concat(t)):(i=e||t,o=e||t),{name:i,classname:o}}function p(e){return /^data:/.test(e)||/^blob:/.test(e)}function g(e){if(p(e))return!1;var t=window.location,i=/(\w+:)?(?:\/\/)([\w.-]+)?(?::(\d+))?\/?/,o=i.exec(e)||[],a={protocol:o[1]||"",host:o[2]||"",port:o[3]||""},n=function(e){return{"http:":80,"https:":443}[e]},s=function(e){return e.port||n(e.protocol||t.protocol)};return(a.protocol||a.host||a.port)&&!!!(a.protocol&&a.protocol==t.protocol&&a.host&&a.host==t.host&&a.host&&s(a)==s(t))}function f(e){return"undefined"==typeof e}function u(e){var t="timestamp=".concat(new Date().getTime());return e+(-1===e.indexOf("?")?"?":"&")+t}function v(e,t){var i=Math.pow;return Math.sqrt(i(e.x-t.x,2)+i(e.y-t.y,2))}function w(e,t,i){var o=Math.PI,a=i.flipped,n=i.orientation,s=t.naturalWidth,r=t.naturalHeight,l=e.getContext("2d");return e.width=s,e.height=r,l.save(),a&&(e.width=r,e.height=s),2==n?(l.translate(s,0),l.scale(-1,1)):3==n?(l.translate(s,r),l.rotate(1*o)):4==n?(l.translate(0,r),l.scale(1,-1)):5==n?(l.rotate(90/180*o),l.scale(1,-1)):6==n?(l.rotate(90/180*o),l.translate(0,-r)):7==n?(l.rotate(270/180*o),l.translate(-s,r),l.scale(1,-1)):8==n&&(l.translate(0,s),l.rotate(270/180*o)),l.drawImage(t,0,0,s,r),l.restore(),e}function y(e){var t={orientation:e};return e&&(2===e?t.scaleX=-1:3===e?t.rotate=-180:4===e?t.scaleY=-1:5===e?(t.rotate=90,t.scaleY=-1):6===e?t.rotate=90:7===e?(t.rotate=90,t.scaleX=-1):8===e?t.rotate=-90:void 0),(90===t.rotate||-90===t.rotate)&&(t.flipped=!0),t}function b(e){var t=e.rotate,i=e.scaleX,o=e.scaleY,a="";return(t||i||o)&&(t&&(a+=" rotate(".concat(t,"deg) ")),i&&(a+=" scaleX(".concat(i,") ")),o&&(a+=" scaleY(".concat(o,") "))),a}function x(e){return new Promise(function(t){C(e).then(function(e){t(e?{arrayBuffer:e,orientation:W(e)}:{arrayBuffer:null,orientation:null})}).catch(function(e){console.warn(e),t({arrayBuffer:null,orientation:null})})})}function C(e){return new Promise(function(t,i){try{if(!e)i("Error: the image is empty");else if(/^data:/i.test(e))t(S(e));else if(/^blob:/i.test(e)){var o=new FileReader;o.onload=function(i){t(i.target.result)},z(e,function(e){o.readAsArrayBuffer(e)})}else{var a=new XMLHttpRequest;a.onreadystatechange=function(){4!==this.readyState||(200===this.status||0===this.status?t(this.response):i("Warning: could not load an image to parse its orientation"),a=null)},a.onprogress=function(){"image/jpeg"!==a.getResponseHeader("content-type")&&a.abort()},a.withCredentials=!1,a.open("GET",e,!0),a.responseType="arraybuffer",a.send(null)}}catch(t){i(t)}})}function z(e,t){var i=new XMLHttpRequest;i.open("GET",e,!0),i.responseType="blob",i.onload=function(){(200==this.status||0===this.status)&&t(this.response)},i.send()}function S(e){e=e.replace(/^data:([^;]+);base64,/gmi,"");for(var t=atob(e),o=t.length,a=new ArrayBuffer(o),n=new Uint8Array(a),s=0;s<o;s++)n[s]=t.charCodeAt(s);return a}function E(e,t,o){var a,n="";for(a=t,o+=t;a<o;a++)n+=B(e.getUint8(a));return n}function W(e){try{var t,o,a,n,s,r,l=new DataView(e);if(255===l.getUint8(0)&&216===l.getUint8(1))for(var c=l.byteLength,h=2;h+1<c;){if(255===l.getUint8(h)&&225===l.getUint8(h+1)){s=h;break}h++}if(s&&(o=s+4,a=s+10,"Exif"===E(l,o,4))){var d=l.getUint16(a);if(n=18761===d,(n||19789===d)&&42===l.getUint16(a+2,n)){var m=l.getUint32(a+4,n);8<=m&&(r=a+m)}}if(r)for(var p,g=l.getUint16(r,n),f=0;f<g;f++)if(p=r+12*f+2,274===l.getUint16(p,n)){p+=8,t=l.getUint16(p,n),l.setUint16(p,1,n);break}return t}catch(e){return null}}function T(e){for(var t=[],i=8192,o=new Uint8Array(e);0<o.length;){var a=o.subarray(0,i);t.push(B.apply(null,Array.from?Array.from(a):Array.slice(a))),o=o.subarray(i)}return"data:image/jpeg;base64,".concat(btoa(t.join("")))}function R(e,t){return e.width+(t.left+t.right)}function M(e,t){return e.height+(t.top+t.bottom)}function H(e,t,i){return{left:"left"in i?-I(0,k(e.left-i.left)-t.left):0,top:"top"in i?-I(0,k(e.top-i.top)-t.top):0,bottom:"bottom"in i?-I(0,i.bottom-(e.bottom+t.bottom)):0,right:"right"in i?-I(0,i.right-(e.right+t.right)):0}}function D(e){var t=e.directions,i=e.coordinates,o=e.restrictions,a=e.preserveAspectRatio,n=e.stopOnBreak,l=e.mode,c=void 0===l?"crop":l,h=e.allowedArea,d=void 0===h?{}:h,m=s({},t),p=R(i,m),g=M(i,m);0>p&&(0>m.left&&0>m.right?(m.left=-(i.width-o.minWidth)/(m.left/m.right),m.right=-(i.width-o.minWidth)/(m.right/m.left)):0>m.left?m.left=-(i.width-o.minWidth):0>m.right&&(m.right=-(i.width-o.minWidth))),0>g&&(0>m.top&&0>m.bottom?(m.top=-(i.height-o.minHeight)/(m.top/m.bottom),m.bottom=-(i.height-o.minHeight)/(m.bottom/m.top)):0>m.top?m.top=-(i.height-o.minHeight):0>m.bottom&&(m.bottom=-(i.height-o.minHeight)));var f=H(i,m,d);"move"===c&&(0<f.left&&0===f.right?(m.right+=f.left,m.left-=f.left):0<f.right&&0===f.left&&(m.left+=f.right,m.right-=f.right),0<f.top&&0===f.bottom?(m.bottom+=f.top,m.top-=f.top):0<f.bottom&&0===f.top&&(m.top+=f.bottom,m.bottom-=f.bottom),f=H(i,m,d));var u={width:1/0,height:1/0};if(we.forEach(function(e){u[e]=f[e]&&m[e]?X(0,1-f[e]/m[e]):1/0}),a){var v=I.apply(Math,r(we.map(function(e){return u[e]})));v!==1/0&&we.forEach(function(e){m[e]*=v})}else ue.forEach(function(e){var t=n?I(u.top,u.bottom):u[e];t!==1/0&&(m[e]*=t)}),ve.forEach(function(e){var t=n?I(u.top,u.bottom):u[e];t!==1/0&&(m[e]*=t)});if(p=R(i,m),g=M(i,m),m.right+m.left&&(p>o.maxWidth?u.width=(o.maxWidth-i.width)/(m.right+m.left):p<o.minWidth&&(u.width=(o.minWidth-i.width)/(m.right+m.left))),m.bottom+m.top&&(g>o.maxHeight?u.height=(o.maxHeight-i.height)/(m.bottom+m.top):g<o.minHeight&&(u.height=(o.minHeight-i.height)/(m.bottom+m.top))),a){var w=I(u.width,u.height);w!==1/0&&we.forEach(function(e){m[e]*=w})}else u.width!==1/0&&ue.forEach(function(e){m[e]*=u.width}),u.height!==1/0&&ve.forEach(function(e){m[e]*=u.height});return m}function $(e,t,i,o,a){var n;return i.minimum&&e/t<i.minimum?n=i.minimum:i.maximum&&e/t>i.maximum?n=i.maximum:a&&(n=o.width/o.height),n}function _(e){var t=e.coordinates,i=e.allowedArea,o=void 0===i?{}:i,a=e.moveEvent,n=s({},a.directions),r={left:t.left+n.left,top:t.top+n.top,width:t.width,height:t.height};return"left"in o&&r.left<o.left&&(r.left=o.left),"right"in o&&r.left+r.width>o.right&&(r.left=X(0,o.right-r.width)),"top"in o&&r.top<o.top&&(r.top=o.top),"bottom"in o&&r.top+r.height>o.bottom&&(r.top=X(0,o.bottom-r.height)),r}function A(e){var t=e.coordinates,i=e.stencilCoordinates,o=e.worldTransforms,a=e.coefficient,n=e.imageSize,r=s({},o),l={width:r.scale*t.width/a,height:r.scale*t.height/a,left:i.left,top:i.top};r.shift.left-=t.left*r.scale+r.shift.left-i.left*a,r.shift.top-=t.top*r.scale+r.shift.top-i.top*a;var c=1;l.width>n.width/a&&(c=I(c,n.width/a/l.width)),l.height>n.height/a&&(c=I(c,n.height/a/l.height)),1!==c&&(r.scale*=c,l.left+=l.width*(1-c)/2,l.top+=l.height*(1-c)/2,r.shift.left=l.left*a-t.left*r.scale,r.shift.top=l.top*a-t.top*r.scale,l.width*=c,l.height*=c),0>l.left&&(r.shift.left-=l.left*a,l.left=0),0>l.top&&(r.shift.top-=l.top*a,l.top=0),l.left+l.width>n.width/a&&(r.shift.left-=(l.left+l.width)*a-n.width,l.left=n.width/a-l.width),l.top+l.height>n.height/a&&(r.shift.top-=(l.top+l.height)*a-n.height,l.top=n.height/a-l.height);var h={width:n.width*r.scale,height:n.height*r.scale};return 0<r.shift.left&&(l.left-=r.shift.left/a,r.shift.left=0),r.shift.left<n.width-h.width&&(l.left-=(r.shift.left-(n.width-h.width))/a,r.shift.left=n.width-h.width),0<r.shift.top&&(l.top-=r.shift.top/a,r.shift.top=0),r.shift.top<n.height-h.height&&(l.top-=(r.shift.top-(n.height-h.height))/a,r.shift.top=n.height-h.height),{stencilCoordinates:l,worldTransforms:r}}function P(e){var t=e.manipulateImageEvent,i=e.coordinates,o=e.stencilRestrictions,a=e.coefficient,n=e.stencilCoordinates,r=e.worldTransforms,l=e.imageSize,c=e.frozenDirections,h=t.scale,d=t.move,m=s({},r),p={width:l.width*m.scale,height:l.height*m.scale},g={left:d.left||0,top:d.top||0},f=1,u=1;if(!c.width&&!c.height&&1e-3<Y(h.factor-1)){var v=Y(1-f)/2,w=o.maxWidth,y=o.maxHeight,b=o.minWidth,x=o.minHeight;f=h.factor,m.scale/f<1+v&&(f=m.scale);var C=i.width*f,z=i.height*f,S={minWidth:C<b+v,minHeight:z<x+v,maxWidth:C>w-v,maxHeight:z>y-v};if(S.minWidth&&(f=b/i.width),S.minHeight&&(f=x/i.height),S.maxHeight||S.maxWidth){var E=f;S.maxWidth&&S.maxHeight?E=I(y/i.height,i.width):S.maxHeight?E=y/i.height:S.maxWidth&&(E=w/i.width),u=E/f}var W={width:p.width*(1-1/f),height:p.height*(1-1/f)};g.left+=W.width*Y((m.shift.left-h.center.left*a)/p.width),g.top+=W.height*Y((m.shift.top-h.center.top*a)/p.height),p.width/=f,p.height/=f}0<k(m.shift.left+g.left)?g.left=-m.shift.left:m.shift.left+g.left<l.width-p.width&&(g.left=l.width-p.width-m.shift.left),0<k(m.shift.top+g.top)?g.top=-m.shift.top:m.shift.top+g.top<l.height-p.height&&(g.top=l.height-p.height-m.shift.top),m.shift.left+=g.left,m.shift.top+=g.top,m.scale/=f;var T={left:0,top:0};return l.width!==i.width&&(T.left=n.width*(1-u)*(i.left/(l.width-i.width))),l.height!==i.height&&(T.top=n.height*(1-u)*(i.top/(l.height-i.height))),{coordinates:{width:i.width*f*u,height:i.height*f*u,left:(n.left-m.shift.left/a+T.left)*a/m.scale,top:(n.top-m.shift.top/a+T.top)*a/m.scale},worldTransforms:m}}function L(e,t,i){function o(o){return console.warn("The arguments will be passed to the prop '".concat(t,"' as an single object {").concat(Object.keys(o).join(","),"} in the future releases. You should change the interface of your function.")),e.apply(void 0,r(i(o)))}return function(t){if(1<e.length)return o(t);try{return e(t)}catch(i){return o(t)}}}t=t&&t.hasOwnProperty("default")?t["default"]:t;var U=function(e,t){return t={exports:{}},e(t,t.exports),t.exports}(function(e){(function(){function t(){for(var e,o=[],a=0;a<arguments.length;a++)if(e=arguments[a],e){var n=typeof e;if("string"===n||"number"===n)o.push(e);else if(Array.isArray(e)&&e.length){var s=t.apply(null,e);s&&o.push(s)}else if("object"===n)for(var r in e)i.call(e,r)&&e[r]&&o.push(r)}return o.join(" ")}var i={}.hasOwnProperty;e.exports?(t.default=t,e.exports=t):window.classNames=t})()}),F=function(e){return function(t,i){if(!t)return e;var o;"string"==typeof t?o=t:i=t;var a=e;return o&&(a+="__"+o),a+(i?Object.keys(i).reduce(function(e,t){var o=i[t];return o&&(e+=" "+("boolean"==typeof o?a+"--"+t:a+"--"+t+"_"+o)),e},""):"")}};d.debounce=d;var O=function e(t){var o=1<arguments.length&&arguments[1]!==void 0?arguments[1]:{},a=2<arguments.length&&arguments[2]!==void 0?arguments[2]:{},n=3<arguments.length&&arguments[3]!==void 0?arguments[3]:{};i(this,e),this.nativeEvent=t,this.move=o,this.scale=a,this.params=n},q=function e(t,o){var a=2<arguments.length&&arguments[2]!==void 0?arguments[2]:{};i(this,e),this.nativeEvent=t,this.directions=o,this.params=a},N=function e(t,o){i(this,e),this.nativeEvent=t,this.directions=o},j=function(){function e(t,o,a,n,s){i(this,e),this.nativeEvent=t,this.position=a,this.previousPosition=n,this.element=o,this.anchor=s}return a(e,[{key:"shift",value:function(){var e=this.element,t=this.anchor,i=this.position,o=e.getBoundingClientRect(),a=o.left,n=o.top;return{left:i.left-a-t.left,top:i.top-n-t.top}}}]),e}(),G={name:"DraggableElement",mixins:[{beforeMount:function(){window.addEventListener("mouseup",this.onMouseUp,{passive:!1}),window.addEventListener("mousemove",this.onMouseMove,{passive:!1}),window.addEventListener("touchmove",this.onTouchMove,{passive:!1}),window.addEventListener("touchend",this.onTouchEnd,{passive:!1})},beforeDestroy:function(){window.removeEventListener("mouseup",this.onMouseUp),window.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("touchmove",this.onTouchMove),window.removeEventListener("touchend",this.onTouchEnd)},mounted:function(){if(!this.$refs.draggable)throw new Error("You should add ref \"draggable\" to your root element to use draggable mixin");this.touches=[],this.draggingAnchor=[],this.hovered=!1},methods:{onMouseOver:function(){this.hovered||(this.hovered=!0,this.$emit("enter"))},onMouseLeave:function(){this.hovered&&(this.hovered=!1,this.$emit("leave"))},onTouchStart:function(t){t.cancelable&&!this.disabled&&1===t.touches.length&&(this.touches=r(t.touches),!this.hovered&&this.$emit("enter"),t.touches.length&&this.initAnchor(this.touches.reduce(function(e,i){return{clientX:e.clientX+i.clientX/t.touches.length,clientY:e.clientY+i.clientY/t.touches.length}},{clientX:0,clientY:0})),t.preventDefault&&t.preventDefault(),t.stopPropagation())},onTouchEnd:function(){this.processEnd()},onTouchMove:function(t){this.touches.length&&(this.processMove(t,t.touches),t.preventDefault&&t.preventDefault(),t.stopPropagation&&t.stopPropagation())},onMouseDown:function(t){if(!this.disabled){var e={fake:!0,clientX:t.clientX,clientY:t.clientY};this.touches=[e],this.initAnchor(e),t.stopPropagation()}},onMouseMove:function(t){this.touches.length&&(this.processMove(t,[{fake:!0,clientX:t.clientX,clientY:t.clientY}]),t.preventDefault&&t.preventDefault())},onMouseUp:function(){this.touches=[]},initAnchor:function(e){var t=this.$refs.draggable,i=t.getBoundingClientRect(),o=i.left,a=i.right,n=i.bottom,s=i.top;this.anchor={left:e.clientX-o,top:e.clientY-s,bottom:n-e.clientY,right:a-e.clientX}},processMove:function(e,t){var i=r(t);if(this.touches.length){if(1===this.touches.length&&1===i.length){var o=this.$refs.draggable;this.$emit("drag",new j(e,o,{left:i[0].clientX,top:i[0].clientY},{left:this.touches[0].clientX,top:this.touches[0].clientY},this.anchor))}this.touches=i}},processEnd:function(){this.touches=[],this.hovered&&(this.$emit("leave"),this.hovered=!1)}}}],props:{classname:{type:String}}},Z=function(e,t,i,o,a,n,s,r,l,c){"boolean"!=typeof s&&(l=r,r=s,s=!1);var h="function"==typeof i?i.options:i;e&&e.render&&(h.render=e.render,h.staticRenderFns=e.staticRenderFns,h._compiled=!0,a&&(h.functional=!0)),o&&(h._scopeId=o);var d;if(n?(d=function(e){e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,e||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),t&&t.call(this,l(e)),e&&e._registeredComponents&&e._registeredComponents.add(n)},h._ssrRegister=d):t&&(d=s?function(){t.call(this,c(this.$root.$options.shadowRoot))}:function(e){t.call(this,r(e))}),d)if(h.functional){var m=h.render;h.render=function(e,t){return d.call(t),m(e,t)}}else{var p=h.beforeCreate;h.beforeCreate=p?[].concat(p,d):[d]}return i},K=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{ref:"draggable",class:e.classname,on:{touchstart:e.onTouchStart,mousedown:e.onMouseDown,mouseover:e.onMouseOver,mouseleave:e.onMouseLeave}},[e._t("default")],2)};K._withStripped=!0;var V=Z({render:K,staticRenderFns:[]},void 0,G,void 0,!1,void 0,void 0,void 0),Q=F("vue-handler-wrapper"),J={name:"HandlerWrapper",components:{DraggableElement:V},props:{horizontalPosition:{type:String},verticalPosition:{type:String},classname:{type:String},disabled:{type:Boolean,default:!1}},computed:{classnames:function(){var e;if(this.horizontalPosition||this.verticalPosition){var t,i=m(this.horizontalPosition,this.verticalPosition);e=U(this.classname,Q((t={},n(t,i.classname,!0),n(t,"disabled",this.disabled),t)))}else e=U(this.classname,Q({disabled:this.disabled}));return{default:e,draggable:Q("draggable")}}}},ee=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{class:e.classnames.default},[i("DraggableElement",{class:e.classnames.draggable,attrs:{disabled:e.disabled},on:{drag:function(t){return e.$emit("drag",t)},leave:function(){return e.$emit("leave")},enter:function(){return e.$emit("enter")}}},[e._t("default")],2)],1)};ee._withStripped=!0;var te=Z({render:ee,staticRenderFns:[]},void 0,J,void 0,!1,void 0,void 0,void 0),ie=F("vue-line-wrapper"),oe={name:"LineWrapper",components:{DraggableElement:V},props:{position:{type:String,required:!0},disabled:{type:Boolean,default:!1}},computed:{classname:function(){var e;return ie((e={},n(e,this.position,!0),n(e,"disabled",this.disabled),e))}}},ae=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("DraggableElement",{class:e.classname,attrs:{disabled:e.disabled},on:{drag:function(t){return e.$emit("drag",t)},leave:function(){return e.$emit("leave")},enter:function(){return e.$emit("enter")}}},[e._t("default")],2)};ae._withStripped=!0;var ne=Z({render:ae,staticRenderFns:[]},void 0,oe,void 0,!1,void 0,void 0,void 0),se=F("vue-bounding-box"),re=["east","west",null],le=["south","north",null],ce={name:"BoundingBox",props:{classname:{type:String},handlers:{type:Object,default:function(){return{eastNorth:!0,north:!0,westNorth:!0,west:!0,westSouth:!0,south:!0,eastSouth:!0,east:!0}}},handlerComponent:{type:[Object,String]},handlersClassnames:{type:Object,default:function(){return{}}},lines:{type:Object,default:function(){return{west:!0,north:!0,east:!0,south:!0}}},lineComponent:{type:[Object,String]},linesClassnames:{type:Object,default:function(){return{}}},scalable:{type:Boolean,default:!0}},data:function(){var e=[];return re.forEach(function(t){le.forEach(function(i){if(t!==i){var o=m(t,i),a=o.name,n=o.classname;e.push({name:a,classname:n,verticalDirection:i,horizontalDirection:t})}})}),{points:e}},computed:{classnames:function(){var e=this.handlersClassnames,t=this.linesClassnames;return{default:U(se(),this.classname),handlers:e,lines:t}},lineNodes:function(){var e=this,t=[];return this.points.forEach(function(i){i.horizontalDirection&&i.verticalDirection||!e.lines[i.name]||t.push({name:i.name,component:e.lineComponent,classname:U(e.classnames.lines.default,e.classnames.lines[i.name],!e.scalable&&e.classnames.lines.disabled),hoverClassname:e.classnames.lines.hover,verticalDirection:i.verticalDirection,horizontalDirection:i.horizontalDirection,disabled:!e.scalable})}),t},handlerNodes:function(){var e=this,t=[];return this.points.forEach(function(i){e.handlers[i.name]&&t.push({name:i.name,component:e.handlerComponent,classname:U(e.classnames.handlers.default,e.classnames.handlers[i.name]),hoverClassname:e.classnames.handlers.hover,verticalDirection:i.verticalDirection,horizontalDirection:i.horizontalDirection,disabled:!e.scalable})}),t}},beforeMount:function(){window.addEventListener("mouseup",this.onMouseUp,{passive:!1}),window.addEventListener("mousemove",this.onMouseMove,{passive:!1}),window.addEventListener("touchmove",this.onTouchMove,{passive:!1}),window.addEventListener("touchend",this.onTouchEnd,{passive:!1})},beforeDestroy:function(){window.removeEventListener("mouseup",this.onMouseUp),window.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("touchmove",this.onTouchMove),window.removeEventListener("touchend",this.onTouchEnd)},mounted:function(){this.touches=[],this.draggingAnchor=[]},methods:{onHandlerDrag:function(e,t,i){var o=e.shift(),a=o.left,n=o.top,s={left:0,right:0,top:0,bottom:0};"west"===t?s.left-=a:"east"==t&&(s.right+=a),"north"===i?s.top-=n:"south"==i&&(s.bottom+=n);var r;!i&&t?r="width":i&&!t&&(r="height"),this.scalable&&this.$emit("resize",new q(e.nativeEvent,s,{allowedDirections:{left:"west"===t||!t,right:"east"===t||!t,bottom:"south"===i||!i,top:"north"===i||!i},preserveAspectRatio:e.nativeEvent.shiftKey,respectDirection:r}))}}},he=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{ref:"box",class:e.classnames.default},[e._t("default"),e._v(" "),i("div",e._l(e.lineNodes,function(t){return i(t.component,{key:t.name,tag:"component",attrs:{classname:t.classname,"hover-classname":t.hoverClassname,position:t.name,disabled:t.disabled},on:{drag:function(i){return e.onHandlerDrag(i,t.horizontalDirection,t.verticalDirection)}}})}),1),e._v(" "),i("div",e._l(e.handlerNodes,function(t){return i(t.component,{key:t.name,tag:"component",attrs:{classname:t.classname,"hover-classname":t.hoverClassname,"horizontal-position":t.horizontalDirection,"vertical-position":t.verticalDirection,disabled:t.disabled},on:{drag:function(i){return e.onHandlerDrag(i,t.horizontalDirection,t.verticalDirection)}}})}),1)],2)};he._withStripped=!0;var de=Z({render:he,staticRenderFns:[]},void 0,ce,void 0,!1,void 0,void 0,void 0),me=F("vue-draggable-area"),pe={name:"DraggableArea",props:{movable:{type:Boolean,default:!0},activationDistance:{type:Number,default:10}},computed:{classnames:function(){return{default:U(me(),this.classname)}}},beforeMount:function(){window.addEventListener("mouseup",this.onMouseUp,{passive:!1}),window.addEventListener("mousemove",this.onMouseMove,{passive:!1}),window.addEventListener("touchmove",this.onTouchMove,{passive:!1}),window.addEventListener("touchend",this.onTouchEnd,{passive:!1})},beforeDestroy:function(){window.removeEventListener("mouseup",this.onMouseUp),window.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("touchmove",this.onTouchMove),window.removeEventListener("touchend",this.onTouchEnd)},mounted:function(){this.touches=[],this.touchStarted=!1},methods:{onTouchStart:function(t){if(t.cancelable){var e=this.movable&&1===t.touches.length;e&&(this.touches=r(t.touches)),(this.touchStarted||e)&&(t.preventDefault(),t.stopPropagation())}},onTouchEnd:function(){this.touchStarted=!1,this.processEnd()},onTouchMove:function(t){1<=this.touches.length&&(this.touchStarted?(this.processMove(t,t.touches),t.preventDefault(),t.stopPropagation()):v({x:this.touches[0].clientX,y:this.touches[0].clientY},{x:t.touches[0].clientX,y:t.touches[0].clientY})>this.activationDistance&&(this.initAnchor({clientX:t.touches[0].clientX,clientY:t.touches[0].clientY}),this.touchStarted=!0))},onMouseDown:function(t){if(this.movable){var e={fake:!0,clientX:t.clientX,clientY:t.clientY};this.touches=[e],this.initAnchor(e),t.stopPropagation()}},onMouseMove:function(t){this.touches.length&&(this.processMove(t,[{fake:!0,clientX:t.clientX,clientY:t.clientY}]),t.preventDefault&&t.cancelable&&t.preventDefault(),t.stopPropagation())},onMouseUp:function(){this.touches=[]},initAnchor:function(e){var t=this.$refs.container,i=t.getBoundingClientRect(),o=i.left,a=i.top;this.anchor={x:e.clientX-o,y:e.clientY-a}},processMove:function(e,t){var i=r(t);if(this.touches.length){var o=this.$refs.container,a=o.getBoundingClientRect(),n=a.left,s=a.top;1===this.touches.length&&1===i.length&&this.$emit("move",new N(e,{left:i[0].clientX-n-this.anchor.x,top:i[0].clientY-s-this.anchor.y}))}},processEnd:function(){this.touches=[]}}},ge=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{ref:"container",on:{touchstart:e.onTouchStart,mousedown:e.onMouseDown}},[e._t("default")],2)};ge._withStripped=!0;var fe=Z({render:ge,staticRenderFns:[]},void 0,pe,void 0,!1,void 0,void 0,void 0),ue=["left","right"],ve=["top","bottom"],we=["left","right","top","bottom"],ye=F("vue-preview-result"),be={name:"PreviewResult",props:{img:{type:Object},classname:{type:String},imageClassname:{type:String},resultCoordinates:{type:Object,default:function(){return{width:0,height:0,left:0,top:0}}},stencilCoordinates:{type:Object,default:function(){return{width:0,height:0,left:0,top:0}}}},computed:{classnames:function(){return{default:U(ye(),this.classname),image:U(ye("image"),this.imageClassname),wrapper:ye("wrapper")}},wrapperStyle:function(){return{width:"".concat(this.stencilCoordinates.width,"px"),height:"".concat(this.stencilCoordinates.height,"px"),left:"calc(50% - ".concat(this.stencilCoordinates.width/2,"px)"),top:"calc(50% - ".concat(this.stencilCoordinates.height/2,"px)")}},imageStyle:function(){var e=this.img.transforms,t=this.img.size.width,i=this.img.size.height,o=this.img.coefficient,a=i/o,n=t/o,s=e.flipped,r={width:"".concat(n,"px"),height:"".concat(a,"px")};return s?(r.width="".concat(a,"px"),r.height="".concat(n,"px"),r.left="".concat(-this.stencilCoordinates.left-(a-n)/2+e.translateX,"px"),r.top="".concat(-this.stencilCoordinates.top-(n-a)/2+e.translateY,"px")):(r.width="".concat(n,"px"),r.height="".concat(a,"px"),r.left="".concat(-this.stencilCoordinates.left+e.translateX,"px"),r.top="".concat(-this.stencilCoordinates.top+e.translateY,"px")),r.transform=b(e),r}}},xe=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{class:e.classnames.default},[i("div",{ref:"wrapper",class:e.classnames.wrapper,style:e.wrapperStyle},[i("img",{ref:"image",class:e.classnames.image,style:e.imageStyle,attrs:{src:e.img.src}})])])};xe._withStripped=!0;var Ce=Z({render:xe,staticRenderFns:[]},void 0,be,void 0,!1,void 0,void 0,void 0),ze={name:"CropperWrapper",props:{touchMove:{type:Boolean},mouseMove:{type:Boolean},touchResize:{type:Boolean},wheelResize:{type:Boolean},wheelZoomRatio:{type:Number,default:.1}},beforeMount:function(){window.addEventListener("mouseup",this.onMouseUp,{passive:!1}),window.addEventListener("mousemove",this.onMouseMove,{passive:!1}),window.addEventListener("touchmove",this.onTouchMove,{passive:!1}),window.addEventListener("touchend",this.onTouchEnd,{passive:!1})},beforeDestroy:function(){window.removeEventListener("mouseup",this.onMouseUp),window.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("touchmove",this.onTouchMove),window.removeEventListener("touchend",this.onTouchEnd)},mounted:function(){this.touches=[],this.draggingAnchor=[]},methods:{onTouchStart:function(t){if(t.cancelable&&(this.touchMove||this.touchResize&&1<t.touches.length)){var e=this.$refs.container,i=e.getBoundingClientRect(),o=i.left,a=i.top,n=i.bottom,s=i.right;this.touches=r(t.touches).filter(function(e){return e.clientX>o&&e.clientX<s&&e.clientY>a&&e.clientY<n}),this.oldGeometricProperties=this.calculateGeometricProperties(this.touches),t.preventDefault&&t.preventDefault(),t.stopPropagation()}},onTouchEnd:function(t){0===t.touches.length&&this.processEnd()},onTouchMove:function(t){var e=this;if(this.touches.length){var i=r(t.touches).filter(function(t){return!t.identifier||e.touches.find(function(e){return e.identifier===t.identifier})});this.processMove(t,i),t.preventDefault&&t.preventDefault(),t.stopPropagation&&t.stopPropagation()}},onMouseDown:function(t){if(this.mouseMove&&"buttons"in t&&1===t.buttons){var e={fake:!0,clientX:t.clientX,clientY:t.clientY};this.touches=[e],this.initAnchor(e),t.stopPropagation()}},onMouseMove:function(t){this.touches.length&&(this.processMove(t,[{fake:!0,clientX:t.clientX,clientY:t.clientY}]),t.preventDefault&&t.cancelable&&t.preventDefault())},onMouseUp:function(){this.touches=[]},initAnchor:function(e){var t=this.$refs.container,i=t.getBoundingClientRect(),o=i.left,a=i.top;this.anchor={x:e.clientX-o,y:e.clientY-a}},calculateGeometricProperties:function(e){var t=this.$refs.container,i=t.getBoundingClientRect(),o=i.left,a=i.top,n={left:0,top:0},s=0;return e.forEach(function(t){n.left+=(t.clientX-o)/e.length,n.top+=(t.clientY-a)/e.length}),e.forEach(function(e){s+=v({x:n.left,y:n.top},{x:e.clientX-o,y:e.clientY-a})}),{centerMass:n,spread:s,count:e.length}},processMove:function(e,t){if(this.touches.length){if(1===this.touches.length&&1===t.length&&this.touchMove)this.$emit("move",new O(e,{left:t[0].clientX-this.touches[0].clientX,top:t[0].clientY-this.touches[0].clientY}));else if(1<this.touches.length&&this.touchResize){var i=this.oldGeometricProperties,o=this.calculateGeometricProperties(t);i.count===o.count&&1<i.count&&this.$emit("resize",new O(e,{left:o.centerMass.left-i.centerMass.left,top:o.centerMass.top-i.centerMass.top},{factor:i.spread/o.spread,center:o.centerMass})),this.oldGeometricProperties=o}this.touches=t}},processEnd:function(){this.touches=[]},onWheel:function(e){if(this.wheelResize){var t=this.$refs.container,i=t.getBoundingClientRect(),o=i.left,a=i.top,n=1+this.wheelZoomRatio*Math.sign(e.deltaY||e.detail||e.wheelDelta),s={left:e.clientX-o,top:e.clientY-a};this.$emit("resize",new O(e,{},{factor:n,center:s})),e.preventDefault(),e.stopPropagation()}}}},Se=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{ref:"container",on:{touchstart:e.onTouchStart,mousedown:e.onMouseDown,wheel:e.onWheel}},[e._t("default")],2)};Se._withStripped=!0;var Ee=Z({render:Se,staticRenderFns:[]},void 0,ze,void 0,!1,void 0,void 0,void 0),We=F("vue-square-handler"),Te={name:"SimpleHandler",components:{HandlerWrapper:te},props:{classname:{type:String},hoverClassname:{type:String},horizontalPosition:{type:String},verticalPosition:{type:String},disabled:{type:Boolean,default:!1}},computed:{classnames:function(){return{default:U(We(n({},this.position,!0)),this.classname,this.hover&&this.hoverClassname)}}},methods:{onDrag:function(e){this.$emit("drag",e)},onEnter:function(){this.hover=!0},onLeave:function(){this.hover=!1}}},Re=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("HandlerWrapper",{attrs:{"vertical-position":e.verticalPosition,"horizontal-position":e.horizontalPosition,disabled:e.disabled},on:{drag:e.onDrag}},[i("div",{class:e.classnames.default})])};Re._withStripped=!0;var Me=Z({render:Re,staticRenderFns:[]},void 0,Te,void 0,!1,void 0,void 0,void 0),He=F("vue-simple-line"),De={name:"SimpleLine",components:{LineWrapper:ne},props:{classname:{type:String},hoverClassname:{type:String},position:{type:String},disabled:{type:Boolean,default:!1}},data:function(){return{hover:!1}},computed:{classnames:function(){return{default:U(He(n({},this.position,!0)),this.classname,this.hover&&this.hoverClassname)}}},methods:{onDrag:function(e){this.$emit("drag",e)},onEnter:function(){this.hover=!0},onLeave:function(){this.hover=!1}}},$e=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("LineWrapper",{attrs:{position:e.position,disabled:e.disabled},on:{enter:e.onEnter,leave:e.onLeave,drag:e.onDrag}},[i("div",{class:e.classnames.default})])};$e._withStripped=!0;var _e=Z({render:$e,staticRenderFns:[]},void 0,De,void 0,!1,void 0,void 0,void 0),Ae=F("vue-rectangle-stencil"),Pe={name:"RectangleStencil",components:{PreviewResult:Ce,BoundingBox:de,DraggableArea:fe},props:{img:{type:Object},resultCoordinates:{type:Object},stencilCoordinates:{type:Object},handlers:{type:Object},handlerComponent:{type:[Object,String],default:function(){return Me}},handlersClassnames:{type:Object,default:function(){return{}}},lines:{type:Object},lineComponent:{type:[Object,String],default:function(){return _e}},linesClassnames:{type:Object,default:function(){return{}}},classname:{type:String},previewClassname:{type:String},boundingBoxClassname:{type:String},aspectRatio:{type:[Number,String]},minAspectRatio:{type:[Number,String]},maxAspectRatio:{type:[Number,String]},movable:{type:Boolean,default:!0},scalable:{type:Boolean,default:!0}},computed:{classes:function(){return{stencil:U(Ae({movable:this.movable}),this.classname),preview:U(Ae("preview"),this.previewClassname),boundingBox:U(Ae("bounding-box"),this.boundingBoxClassname)}},style:function(){var e=this.stencilCoordinates,t=e.height,i=e.width,o=e.left,a=e.top;return{width:"".concat(i,"px"),height:"".concat(t,"px"),left:"".concat(o,"px"),top:"".concat(a,"px")}}},methods:{onMove:function(e){this.$emit("move",e)},onResize:function(e){this.$emit("resize",e)},aspectRatios:function(){return{minimum:this.aspectRatio||this.minAspectRatio,maximum:this.aspectRatio||this.maxAspectRatio}}}},Le=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{class:e.classes.stencil,style:e.style},[i("BoundingBox",{attrs:{classname:e.classes.boundingBox,handlers:e.handlers,"handler-component":e.handlerComponent,"handlers-classnames":e.handlersClassnames,lines:e.lines,"line-component":e.lineComponent,"lines-classnames":e.linesClassnames,scalable:e.scalable},on:{resize:e.onResize}},[i("DraggableArea",{attrs:{movable:e.movable},on:{move:e.onMove}},[i("PreviewResult",{attrs:{img:e.img,classname:e.classes.preview,"result-coordinates":e.resultCoordinates,"stencil-coordinates":e.stencilCoordinates}})],1)],1)],1)};Le._withStripped=!0;var Ye=Z({render:Le,staticRenderFns:[]},void 0,Pe,void 0,!1,void 0,void 0,void 0),Xe=F("vue-circle-stencil"),Ie={name:"CircleStencil",components:{PreviewResult:Ce,BoundingBox:de,DraggableArea:fe},props:{img:{type:Object},stencilClass:{type:String},resultCoordinates:{type:Object},stencilCoordinates:{type:Object},handlers:{type:Object,default:function(){return{eastNorth:!0,westNorth:!0,westSouth:!0,eastSouth:!0}}},handlerComponent:{type:[Object,String],default:function(){return Me}},handlersClassnames:{type:Object,default:function(){return{}}},lines:{type:Object},lineComponent:{type:[Object,String],default:function(){return _e}},linesClassnames:{type:Object,default:function(){return{}}},classname:{type:String},previewClassname:{type:String},boundingBoxClassname:{type:String},movable:{type:Boolean,default:!0},scalable:{type:Boolean,default:!0}},computed:{classes:function(){return{stencil:U(Xe(),this.classname),preview:U(Xe("preview"),this.previewClassname),boundingBox:U(Xe("bounding-box"),this.boundingBox)}},style:function(){var e=this.stencilCoordinates,t=e.height,i=e.width,o=e.left,a=e.top;return{width:"".concat(i,"px"),height:"".concat(t,"px"),left:"".concat(o,"px"),top:"".concat(a,"px")}}},methods:{onMove:function(e){this.$emit("move",e)},onResize:function(e){this.$emit("resize",e)},aspectRatios:function(){return{minimum:1,maximum:1}}}},ke=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{class:e.classes.stencil,style:e.style},[i("BoundingBox",{attrs:{classname:e.classes.boundingBox,handlers:e.handlers,"handler-component":e.handlerComponent,"handlers-classnames":e.handlersClassnames,lines:e.lines,"line-component":e.lineComponent,"lines-classnames":e.linesClassnames,scalable:e.scalable},on:{resize:e.onResize}},[i("DraggableArea",{attrs:{movable:e.movable},on:{move:e.onMove}},[i("PreviewResult",{attrs:{img:e.img,classname:e.classes.preview,"result-coordinates":e.resultCoordinates,"stencil-coordinates":e.stencilCoordinates}})],1)],1)],1)};ke._withStripped=!0;var Be=Z({render:ke,staticRenderFns:[]},void 0,Ie,void 0,!1,void 0,void 0,void 0),Ue=F("vue-advanced-cropper"),Fe={name:"Cropper",components:{CropperWrapper:Ee},props:{src:{type:String,default:null},resizeAlgorithm:{type:Function,default:function(e){var t=e.coordinates,i=e.restrictions,o=e.allowedArea,a=e.aspectRatio,n=e.resizeEvent,r=s({},t,{right:t.left+t.width,bottom:t.top+t.height}),l=n.params||{},c=s({},n.directions),h=l.allowedDirections||{left:!0,right:!0,bottom:!0,top:!0};we.forEach(function(e){h[e]||(c[e]=0)}),c=D({directions:c,restrictions:i,coordinates:r,allowedArea:o,stopOnBreak:l.stopOnBreak});var d=R(r,c),m=M(r,c),p=$(d,m,a,r,l.preserveAspectRatio);if(p){var g=l.respectDirection;if(g||(r.width>=r.height||1==p?g="width":g="height"),"width"===g){var f=d/p-r.height;h.top&&h.bottom?(c.bottom=f/2,c.top=f/2):h.bottom?c.bottom=f:h.top?c.top=f:h.right?c.right=0:h.left&&(c.left=0)}else if("height"===g){var u=r.width-m*p;h.left&&h.right?(c.left=-u/2,c.right=-u/2):h.left?c.left=-u:h.right?c.right=-u:h.top?c.top=0:h.bottom&&(c.bottom=0)}c=D({directions:c,restrictions:i,coordinates:r,allowedArea:o,preserveAspectRatio:!0,mode:l.compensate&&!l.stopOnBreak?"move":"crop"})}return d=R(r,c),m=M(r,c),p=$(d,m,a,r,l.preserveAspectRatio),1e-3<Y(p-d/m)&&(console.error("Something went wrong and ratio was broken: ".concat(d/m," instead of ").concat(p)),we.forEach(function(e){h[e]||(c[e]=0)})),_({coordinates:{width:t.width+c.right+c.left,height:t.height+c.top+c.bottom,left:t.left,top:t.top},allowedArea:o,moveEvent:new N({},{left:-c.left,top:-c.top})})}},moveAlgorithm:{type:Function,default:_},defaultSize:{type:Function,default:function(e){var t,i,o=e.cropper,a=e.image,n=e.minWidth,s=e.minHeight,r=e.maxWidth,l=e.maxHeight,c=e.imageWidth,h=e.imageHeight,d=e.aspectRatio,m=e.props,p=c,g=h,f=c>h?d.maximum:d.minimum;return(c/h>d.maximum||c/h<d.minimum)&&(1>=f?(g=h,p=g*d.maximum):(p=c,g=p/d.minimum)),t=I(l,X(s,.8*g)),i=I(r,X(n,.8*p)),{height:t,width:i}}},defaultPosition:{type:Function,default:function(e){var t=e.cropper,i=e.image,o=e.stencilWidth,a=e.stencilHeight,n=e.imageWidth,s=e.imageHeight,r=e.props;return{left:n/2-o/2,top:s/2-a/2}}},areaSize:{type:Function,default:function(e){var t=e.cropper,i=e.image,o=e.imageWidth,a=e.imageHeight,n=t.clientHeight,s=t.clientWidth,r=n,l=o*n/a;return l>s&&(l=s,r=a*s/o),{width:l,height:r}}},restrictions:{type:Function,default:function(e){var t=e.minWidth,i=e.minHeight,o=e.maxWidth,a=e.maxHeight,n=e.imageWidth,s=e.imageHeight;return{minWidth:t/100*n,minHeight:i/100*s,maxWidth:o?o/100*n:n,maxHeight:a?a/100*s:s}}},minWidth:{type:[Number,String],default:10},minHeight:{type:[Number,String],default:10},maxWidth:{type:[Number,String]},maxHeight:{type:[Number,String]},stencilComponent:{type:[Object,String],default:function(){return Ye}},stencilProps:{type:Object,default:function(){return{}}},classname:{type:String},imageClassname:{type:String},areaClassname:{type:String},backgroundClassname:{type:String},debounce:{type:Number,default:500},canvas:{type:Boolean,default:!0},checkCrossOrigin:{type:Boolean,default:!0},checkOrientation:{type:Boolean,default:!0},transitionTime:{type:Number,default:300},wheelResize:{type:Boolean,default:!0},touchResize:{type:Boolean,default:!0},touchMove:{type:Boolean,default:!0},mouseMove:{type:Boolean,default:!0}},data:function(){return{boundarySize:{width:null,height:null},imageLoaded:!1,imageAttributes:{crossOrigin:!1,src:null},basicImageTransforms:{rotate:null,scaleX:null,scaleY:null},imageSize:{width:null,height:null},coordinates:{left:0,top:0,width:0,height:0},stencilCoordinates:{left:0,top:0,width:0,height:0},frozenDirections:{width:!1,height:!1},worldTransforms:{scale:1,shift:{left:0,top:0}}}},computed:{imageTransforms:function(){return s({},this.basicImageTransforms,{scaleX:(this.basicImageTransforms.scaleX||1)*this.worldTransforms.scale,scaleY:(this.basicImageTransforms.scaleY||1)*this.worldTransforms.scale,translateX:this.worldTransforms.shift.left/this.coefficient+(this.imageSize.width*this.worldTransforms.scale-this.imageSize.width)/2/this.coefficient,translateY:this.worldTransforms.shift.top/this.coefficient+(this.imageSize.height*this.worldTransforms.scale-this.imageSize.height)/2/this.coefficient})},coefficient:function(){return this.imageSize.width?this.imageSize.width/this.boundarySize.width:0},classes:function(){return{cropper:U(Ue(),this.classname),image:U(Ue("image"),this.imageClassname),area:U(Ue("area"),this.areaClassname),stretcher:U(Ue("stretcher")),background:U(Ue("background"),this.backgroundClassname),imageWrapper:U(Ue("image-wrapper")),cropperWrapper:U(Ue("cropper-wrapper"))}},wrapperStyle:function(){return{width:"".concat(this.stencilCoordinates.width,"px"),height:"".concat(this.stencilCoordinates.height,"px"),left:"".concat(this.stencilCoordinates.left,"px"),top:"".concat(this.stencilCoordinates.top,"px")}},areaStyle:function(){return{width:this.boundarySize.width?"".concat(this.boundarySize.width,"px"):"auto",height:this.boundarySize.height?"".concat(this.boundarySize.height,"px"):"auto",opacity:this.imageLoaded?1:0,transition:"opacity ".concat(this.transitionTime,"ms")}},imageStyle:function(){var e={left:"calc(50% + ".concat(this.imageTransforms.translateX,"px)"),top:"calc(50% + ".concat(this.imageTransforms.translateY,"px)"),transform:"translate(-50%, -50%)"+b(this.imageTransforms)},t=this.imageTransforms.flipped;return t?(e.width="".concat(this.boundarySize.height,"px"),e.height="".concat(this.boundarySize.width,"px")):(e.width="".concat(this.boundarySize.width,"px"),e.height="".concat(this.boundarySize.height,"px")),e},stencilRestrictions:function(){var e=L(this.restrictions,"restrictions",function(e){return[e.minWidth,e.minHeight,e.maxWidth,e.maxHeight,e.imageWidth,e.imageHeight]})({minWidth:+this.minWidth,minHeight:+this.minHeight,maxWidth:+this.maxWidth,maxHeight:+this.maxHeight,imageWidth:this.imageSize.width,imageHeight:this.imageSize.height,props:this.$props});return this.minWidth>this.imageSize.width&&(console.warn("Warning: minimum width (".concat(e.minWidth,"px) greater that the image width (").concat(this.imageSize.width,"px). It is set equal to the image width and width resizing was blocked")),e.minWidth=this.imageSize.width,e.widthFrozen=!0),this.minHeight>this.imageSize.height&&(console.warn("Warning: minimum height (".concat(e.minHeight,"px) greater that the image height (").concat(this.imageSize.height,"px). It is set equal to the image height and height resizing was blocked")),e.minHeight=this.imageSize.height,e.heightFrozen=!0),e.minWidth>e.maxWidth&&(console.warn("Warning: maximum width (".concat(e.maxWidth,"px) fewer that the minimum width (").concat(e.minWidth,"px). It is set equal to the minimum width and width resizing was blocked")),e.maxWidth=e.minWidth,e.widthFrozen=!0),e.minHeight>e.maxHeight&&(console.warn("Warning: maximum height (".concat(e.maxHeight,"px) fewer that the minimum height (").concat(e.minHeight,"px). It is set equal to the minimum height and height resizing was blocked")),e.maxHeight=e.minHeight,e.heightFrozen=!0),(!e.maxWidth||e.maxWidth>this.imageSize.width)&&(e.maxWidth=this.imageSize.width),(!e.maxHeight||e.maxHeight>this.imageSize.height)&&(e.maxHeight=this.imageSize.height),e}},watch:{src:function(){this.onChangeImage()},minWidth:function(){this.resetCoordinates()},maxWidth:function(){this.resetCoordinates()},minHeight:function(){this.resetCoordinates()},maxHeight:function(){this.resetCoordinates()}},mounted:function(){var e=this;this.debouncedUpdate=d(this.update,this.debounce),window.addEventListener("resize",this.onResizeWindow),window.addEventListener("orientationchange",this.onResizeWindow),this.$refs.image.addEventListener("load",function(){e.$refs.image&&e.refreshImage().then(e.resetCoordinates)}),this.onChangeImage()},destroyed:function(){window.removeEventListener("resize",this.refreshImage),window.removeEventListener("orientationchange",this.refreshImage)},methods:{getResult:function(){return this.canvas&&this.src?(this.updateCanvas(this.coordinates),{coordinates:s({},this.coordinates),canvas:this.$refs.canvas}):{coordinates:s({},this.coordinates)}},getArea:function(){return this.$refs.area},getStencil:function(){return this.$refs.stencil},autoZoom:function(e){var t=A({coordinates:e,stencilCoordinates:this.stencilCoordinates,worldTransforms:this.worldTransforms,coefficient:this.coefficient,imageSize:this.imageSize}),i=t.worldTransforms,o=t.stencilCoordinates;this.worldTransforms=i,this.stencilCoordinates=o},updateStencilCoordinates:function(e){var t=e.width,i=e.height,o=e.left,a=e.top;this.stencilCoordinates={width:this.worldTransforms.scale*t/this.coefficient,height:this.worldTransforms.scale*i/this.coefficient,left:(o*this.worldTransforms.scale+this.worldTransforms.shift.left)/this.coefficient,top:(a*this.worldTransforms.scale+this.worldTransforms.shift.top)/this.coefficient}},updateCanvas:function(e){if(this.$refs.canvas){var t=this.$refs.image,i=this.checkOrientation?w(this.$refs.sourceCanvas,t,this.imageTransforms):t,o=this.$refs.canvas;o.width=e.width,o.height=e.height;var a=o.getContext("2d");a.drawImage(i,e.left,e.top,e.width,e.height,0,0,e.width,e.height)}},update:function(){this.$emit("change",this.getResult())},onResizeWindow:function(){var e=this,t=this.$refs.image;this.src&&t&&this.refreshImage().then(function(){e.updateStencilCoordinates(e.coordinates)})},onChangeCoordinates:function(e){var t=!(1<arguments.length&&arguments[1]!==void 0)||arguments[1];this.coordinates=e,this.$listeners&&this.$listeners.change&&(t?this.debouncedUpdate():this.update())},onChangeImage:function(){var e=this;if(this.imageLoaded=!1,this.delayedTransforms=null,this.src){var t=g(this.src);t&&this.canvas&&this.checkCrossOrigin&&(this.imageAttributes.crossOrigin="anonymous"),setTimeout(function(){e.checkOrientation?x(t?u(e.src):e.src).then(e.onParseImage):e.onParseImage({})},this.transitionTime)}else this.clearImage()},onParseImage:function(e){var i=this,o=e.arrayBuffer,a=e.orientation;this.imageAttributes.src=o&&a&&p(this.src)?T(o):this.src,this.basicImageTransforms=y(a),t.nextTick(function(){var e=i.$refs.image;e&&e.complete&&i.refreshImage().then(i.resetCoordinates)})},onResize:function(e){var t=this;this.frozenDirections.width&&(e.directions.left=0,e.directions.right=0),this.frozenDirections.height&&(e.directions.top=0,e.directions.bottom=0),we.forEach(function(i){e.directions[i]/=t.worldTransforms.scale/t.coefficient}),this.onChangeCoordinates(this.resizeAlgorithm({coordinates:this.coordinates,restrictions:this.stencilRestrictions,allowedArea:this.allowedArea(),aspectRatio:this.stencilAspectRatios(),resizeEvent:e})),this.updateStencilCoordinates(this.coordinates)},onManipulateImage:function(e){e.move.left&&(e.move.left*=this.coefficient),e.move.top&&(e.move.top*=this.coefficient);var t=P({manipulateImageEvent:e,coordinates:this.coordinates,coefficient:this.coefficient,stencilRestrictions:this.stencilRestrictions,imageSize:this.imageSize,frozenDirections:this.frozenDirections,stencilCoordinates:this.stencilCoordinates,worldTransforms:this.worldTransforms}),i=t.worldTransforms,o=t.coordinates;this.worldTransforms=i,this.onChangeCoordinates(o),this.updateStencilCoordinates(o)},onMove:function(e){var t=this;we.forEach(function(i){e.directions[i]/=t.worldTransforms.scale/t.coefficient}),this.onChangeCoordinates(this.moveAlgorithm({coordinates:this.coordinates,allowedArea:this.allowedArea(),moveEvent:e})),this.updateStencilCoordinates(this.coordinates)},defaultCoordinates:function(){var e=this.stencilAspectRatios(),t=this.stencilRestrictions,i=t.minWidth,o=t.minHeight,a=t.maxWidth,n=t.maxHeight,s=this.imageSize,r={};if(!e.minimum&&!e.maximum)r.height=o,r.width=i;else{var l={width:{maximum:e.minimum?I(n,i/e.minimum):n,minimum:e.maximum?X(o,i/e.maximum):o},height:{maximum:e.maximum?I(a,o*e.maximum):a,minimum:e.minimum?X(i,o*e.minimum):i}};if(l.width.maximum>=l.width.minimum)r.width=i,r.height=l.width.minimum;else if(l.height.maximum>=l.height.minimum)r.height=o,r.width=l.height.minimum;else throw"Error: current aspect ratio is incompatible with minimum/maximum height and width settings. Can't setup default coordinates"}return r.left=s.width/2-r.width/2,r.top=s.height/2-r.height/2,r},setCoordinates:function(e){var i=this,o=1<arguments.length&&arguments[1]!==void 0?arguments[1]:{},a=o.autoZoom;t.nextTick(function(){return i.imageLoaded?void i.applyTransforms(e,!(void 0!==a)||a):void(i.delayedTransforms=e)})},applyTransforms:function(e){var t=this,i=!!(1<arguments.length&&void 0!==arguments[1])&&arguments[1],o=this.stencilAspectRatios(),a={left:0,top:0,right:this.imageSize.width,bottom:this.imageSize.height},n=function(e,i){return t.moveAlgorithm({coordinates:e,allowedArea:a,moveEvent:new N(null,{left:i.left-e.left,top:i.top-e.top})})},r=function(e,i){var s=t.defaultCoordinates();return s=t.resizeAlgorithm({coordinates:s,restrictions:t.stencilRestrictions,allowedArea:a,aspectRatio:o,resizeEvent:new q(null,{left:(i.width-s.width)/2,right:(i.width-s.width)/2,top:(i.height-s.height)/2,bottom:(i.height-s.height)/2})}),n(s,{left:e.left,top:e.top})},l=this.coordinates;return Array.isArray(e)||(e=[e]),e.forEach(function(e){var i={};i="function"==typeof e?e(s({},l),t.imageSize):e,f(i.width)&&f(i.height)||(l=r(l,s({},l,i))),f(i.left)&&f(i.top)||(l=n(l,s({},l,i)))}),i&&1<this.worldTransforms.scale?this.autoZoom(l):(1<this.worldTransforms.scale&&this.resetWorldTransforms(),this.updateStencilCoordinates(l)),this.onChangeCoordinates(l,!1),l},resetWorldTransforms:function(){this.worldTransforms={scale:1,shift:{left:0,top:0}}},resetCoordinates:function(){var e=this;if(this.$refs.image){var t=this.$refs.cropper,i=this.$refs.image,o=this.stencilRestrictions,a=o.minWidth,n=o.minHeight,l=o.maxWidth,c=o.maxHeight,h=o.widthFrozen,d=o.heightFrozen;this.frozenDirections.width=!!h,this.frozenDirections.height=!!d;var m=L(this.defaultSize,"defaultSize",function(e){return[e.cropper,e.image,{minWidth:e.minWidth,minHeight:e.minHeight,maxWidth:e.maxWidth,maxHeight:e.maxHeight},e.imageWidth,e.imageHeight,e.props]})(s({cropper:t,image:i,imageWidth:this.imageSize.width,imageHeight:this.imageSize.height,props:this.$props,aspectRatio:this.stencilAspectRatios()},this.stencilRestrictions));(m.width<a||m.height<n||m.width>l||m.height>c)&&console.warn("Warning: default size breaking size restrictions. Check your defaultSize function",m,this.stencilRestrictions);var p=[m,function(o){return s({},L(e.defaultPosition,"defaultPosition",function(e){return[e.cropper,e.image,e.stencilWidth,e.stencilHeight,e.imageWidth,e.imageHeight,e.props]})({cropper:t,image:i,stencilWidth:o.width,stencilHeight:o.height,imageWidth:e.imageSize.width,imageHeight:e.imageSize.height,props:e.$props}))}];this.delayedTransforms&&p.push.apply(p,r(Array.isArray(this.delayedTransforms)?this.delayedTransforms:[this.delayedTransforms])),this.resetWorldTransforms(),this.applyTransforms(p),this.delayedTransforms=null,this.imageLoaded=!0}},clearImage:function(){var e=this.$refs.stretcher;this.imageLoaded=!1,this.onChangeCoordinates({left:0,top:0,width:0,height:0},!1),setTimeout(function(){e.style.height="auto",e.style.width="auto"},this.transitionTime)},refreshImage:function(){var e=this;return new Promise(function(i,o){var a=e.$refs.image,n=e.$refs.cropper;if(e.src&&a){var s=e.$refs.stretcher;e.imageTransforms.flipped?(e.imageSize.height=a.naturalWidth,e.imageSize.width=a.naturalHeight):(e.imageSize.height=a.naturalHeight,e.imageSize.width=a.naturalWidth);var r=e.imageSize.width/e.imageSize.height;e.imageSize.height>e.imageSize.width?(s.style.height="".concat(e.imageSize.height,"px"),s.style.width="".concat(s.clientHeight*r,"px"),s.clientWidth/s.clientHeight!=r&&(s.style.height="".concat(s.clientWidth/r,"px"))):(s.style.width="".concat(e.imageSize.width,"px"),s.style.height="".concat(s.clientWidth/r,"px"),s.clientHeight/s.clientWidth!=r&&(s.style.width="".concat(s.clientHeight*r,"px"))),t.nextTick(function(){var t=L(e.areaSize,"areaSize",function(e){return[e.cropper,e.image,e.imageWidth,e.imageHeight]})({cropper:n,image:a,imageWidth:e.imageSize.width,imageHeight:e.imageSize.height}),o=t.height,s=t.width;o&&(e.boundarySize.height=o),s&&(e.boundarySize.width=s),i()})}else o()})},allowedArea:function(){return{left:-this.worldTransforms.shift.left/this.worldTransforms.scale,top:-this.worldTransforms.shift.top/this.worldTransforms.scale,right:(this.boundarySize.width-this.worldTransforms.shift.left/this.coefficient)/this.worldTransforms.scale*this.coefficient,bottom:(this.boundarySize.height-this.worldTransforms.shift.top/this.coefficient)/this.worldTransforms.scale*this.coefficient}},stencilAspectRatios:function(){return this.$refs.stencil.aspectRatios?this.$refs.stencil.aspectRatios():{minimum:this.stencilProps.aspectRatio||this.stencilProps.minAspectRatio,maximum:this.stencilProps.aspectRatio||this.stencilProps.maxAspectRatio}}}},Oe=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{ref:"cropper",class:e.classes.cropper},[i("div",{class:e.classes.background,style:e.areaStyle}),e._v(" "),i("div",{ref:"stretcher",class:e.classes.stretcher}),e._v(" "),i("div",{ref:"area",class:e.classes.area,style:e.areaStyle},[i("CropperWrapper",{class:e.classes.cropperWrapper,attrs:{"wheel-resize":e.wheelResize,"touch-resize":e.touchResize,"touch-move":e.touchMove&&1<e.worldTransforms.scale,"mouse-move":e.touchMove&&1<e.worldTransforms.scale},on:{move:e.onManipulateImage,resize:e.onManipulateImage}},[i("div",{class:e.classes.imageWrapper},[i("img",{ref:"image",class:e.classes.image,style:e.imageStyle,attrs:{crossOrigin:e.imageAttributes.crossOrigin,src:e.imageAttributes.src},on:{mousedown:function(e){e.preventDefault()}}})]),e._v(" "),i(e.stencilComponent,e._b({ref:"stencil",tag:"component",attrs:{img:{src:e.imageAttributes.src,size:e.imageSize,transforms:e.imageTransforms,coefficient:e.coefficient},"result-coordinates":e.coordinates,"stencil-coordinates":e.stencilCoordinates},on:{resize:e.onResize,move:e.onMove}},"component",e.stencilProps,!1)),e._v(" "),e.canvas?i("canvas",{ref:"canvas",style:{display:"none"}}):e._e(),e._v(" "),e.canvas?i("canvas",{ref:"sourceCanvas",style:{display:"none"}}):e._e()],1)],1)])};Oe._withStripped=!0;var qe=Z({render:Oe,staticRenderFns:[]},void 0,Fe,void 0,!1,void 0,void 0,void 0),Ne=F("vue-preview-image"),je={name:"PreviewImage",props:{img:{type:String},classname:{type:String},imageClassname:{type:String},width:{type:Number},height:{type:Number},top:{type:Number},left:{type:Number},previewWidth:{type:Number,required:!0},previewHeight:{type:Number,required:!0}},data:function(){return{imageSize:{width:0,height:0}}},computed:{classnames:function(){return{default:U(Ne(),this.classname),image:U(Ne("image"),this.imageClassname)}},wrapperStyle:function(){return{width:"".concat(this.previewWidth,"px"),height:"".concat(this.previewHeight,"px")}},imageStyle:function(){var e=this.previewHeight/this.height,t=this.imageSize.height*e,i=this.imageSize.width*e;return{width:"".concat(i,"px"),height:"".concat(t,"px"),left:"".concat(-this.left*e,"px"),top:"".concat(-this.top*e,"px")}}},watch:{img:function(){this.onChangeImage()}},mounted:function(){this.onChangeImage()},methods:{refreshImage:function(){var e=this.$refs.image;this.imageSize.height=e.naturalHeight,this.imageSize.width=e.naturalWidth},onChangeImage:function(){var e=this,t=this.$refs.image;t.complete?this.refreshImage():t.addEventListener("load",function(){e.refreshImage()})}}},Ge=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{class:e.classnames.default,style:e.wrapperStyle},[i("img",{ref:"image",class:e.classnames.image,style:e.imageStyle,attrs:{src:e.img}})])};Ge._withStripped=!0;var Ze=Z({render:Ge,staticRenderFns:[]},void 0,je,void 0,!1,void 0,void 0,void 0);t.component("cropper",qe),t.component("rectangle-stencil",Ye),t.component("circle-stencil",Be),t.component("simple-handler",Me),t.component("simple-line",_e),e.BoundingBox=de,e.CircleStencil=Be,e.Cropper=qe,e.DragEvent=j,e.DraggableArea=fe,e.DraggableElement=V,e.HandlerWrapper=te,e.LineWrapper=ne,e.MoveEvent=N,e.PreviewImage=Ze,e.PreviewResult=Ce,e.RectangleStencil=Ye,e.ResizeEvent=q,e.SimpleHandler=Me,e.SimpleLine=_e,Object.defineProperty(e,"__esModule",{value:!0})});

@@ -81,2 +31,2 @@ function styleInject(id, css) {

};
styleInject("vue-advanced-cropper", ".vue-advanced-cropper { text-align: center; position: relative; overflow: hidden; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; max-height: 100%; max-width: 100%;}.vue-advanced-cropper__stretcher { pointer-events: none; position: relative; max-width: 100%; max-height: 100%;}.vue-advanced-cropper__image { opacity: 0.5; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; position: absolute; -webkit-transform-origin: center; transform-origin: center; max-width: unset !important;}.vue-advanced-cropper__area { position: absolute; left: 50%; -webkit-transform: translate(-50%, -50%); transform: translate(-50%, -50%); top: 50%;}.vue-advanced-cropper__background { position: absolute; background: black; top: 50%; left: 50%; -webkit-transform: translate(-50%, -50%); transform: translate(-50%, -50%);}.vue-advanced-cropper__stencil-wrapper { position: absolute;}/*# sourceMappingURL=Cropper.vue.map */.vue-square-handler { display: block; background: white; height: 10px; width: 10px;}/*# sourceMappingURL=SimpleHandler.vue.map */.vue-handler-wrapper { position: absolute; -webkit-transform: translate(-50%, -50%); transform: translate(-50%, -50%);}.vue-handler-wrapper__draggable { width: 30px; height: 30px; display: -webkit-box; display: -ms-flexbox; display: flex; -webkit-box-align: center; -ms-flex-align: center; align-items: center; -webkit-box-pack: center; -ms-flex-pack: center; justify-content: center;}.vue-handler-wrapper--west-north { left: 0; top: 0; cursor: nw-resize;}.vue-handler-wrapper--north { left: 50%; top: 0; cursor: n-resize;}.vue-handler-wrapper--east-north { left: 100%; top: 0; cursor: ne-resize;}.vue-handler-wrapper--east { left: 100%; top: 50%; cursor: e-resize;}.vue-handler-wrapper--east-south { left: 100%; top: 100%; cursor: se-resize;}.vue-handler-wrapper--south { left: 50%; top: 100%; cursor: s-resize;}.vue-handler-wrapper--west-south { left: 0; top: 100%; cursor: sw-resize;}.vue-handler-wrapper--west { left: 0; top: 50%; cursor: w-resize;}/*# sourceMappingURL=HandlerWrapper.vue.map */.vue-line-wrapper { background: none; position: absolute; display: -webkit-box; display: -ms-flexbox; display: flex; -webkit-box-align: center; -ms-flex-align: center; align-items: center; -webkit-box-pack: center; -ms-flex-pack: center; justify-content: center;}.vue-line-wrapper--north, .vue-line-wrapper--south { height: 12px; width: 100%; left: 0; -webkit-transform: translateY(-50%); transform: translateY(-50%);}.vue-line-wrapper--north { top: 0; cursor: n-resize;}.vue-line-wrapper--south { top: 100%; cursor: s-resize;}.vue-line-wrapper--east, .vue-line-wrapper--west { width: 12px; height: 100%; -webkit-transform: translateX(-50%); transform: translateX(-50%); top: 0;}.vue-line-wrapper--east { left: 100%; cursor: e-resize;}.vue-line-wrapper--west { left: 0; cursor: w-resize;}/*# sourceMappingURL=LineWrapper.vue.map */.vue-bounding-box { position: relative; height: 100%; width: 100%;}.vue-bounding-box__line { position: absolute;}.vue-bounding-box__line--north { top: 0; width: 100%; cursor: n-resize;}.vue-bounding-box__line--east { left: 100%; top: 0; height: 100%; cursor: e-resize;}.vue-bounding-box__line--south { top: 100%; width: 100%; cursor: s-resize;}.vue-bounding-box__line--west { left: 0; top: 0; height: 100%; cursor: w-resize;}/*# sourceMappingURL=BoundingBox.vue.map */.vue-draggable-area { position: relative;}/*# sourceMappingURL=DraggableArea.vue.map */.vue-preview-result { overflow: hidden; -webkit-box-sizing: border-box; box-sizing: border-box; position: absolute; height: 100%; width: 100%;}.vue-preview-result__wrapper { position: absolute;}.vue-preview-result__image { pointer-events: none; position: absolute; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; -webkit-transform-origin: center; transform-origin: center; max-width: unset !important;}/*# sourceMappingURL=PreviewResult.vue.map */.vue-preview-image { overflow: hidden; position: relative;}.vue-preview-image__image { pointer-events: none; position: absolute; max-width: unset !important;}/*# sourceMappingURL=PreviewImage.vue.map */.vue-simple-line { background: none; -webkit-transition: border 0.5s; transition: border 0.5s; border-color: rgba(255, 255, 255, 0.3); border-width: 0; border-style: solid;}.vue-simple-line--south, .vue-simple-line--north { height: 0; width: 100%;}.vue-simple-line--east, .vue-simple-line--west { height: 100%; width: 0;}.vue-simple-line--east { border-right-width: 1px;}.vue-simple-line--west { border-left-width: 1px;}.vue-simple-line--south { border-top-width: 1px;}.vue-simple-line--north { border-bottom-width: 1px;}.vue-simple-line--hover { opacity: 1; border-color: white;}/*# sourceMappingURL=SimpleLine.vue.map */.vue-circle-stencil { position: absolute; height: 100%; width: 100%; -webkit-box-sizing: content-box; box-sizing: content-box; cursor: move;}.vue-circle-stencil__preview { border-radius: 50%;}/*# sourceMappingURL=CircleStencil.vue.map */.vue-rectangle-stencil { position: absolute; height: 100%; width: 100%; -webkit-box-sizing: border-box; box-sizing: border-box; cursor: move;}/*# sourceMappingURL=RectangleStencil.vue.map */");//# sourceMappingURL=index.umd.js.map
styleInject("vue-advanced-cropper", ".vue-advanced-cropper { text-align: center; position: relative; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; max-height: 100%; max-width: 100%;}.vue-advanced-cropper__stretcher { pointer-events: none; position: relative; max-width: 100%; max-height: 100%;}.vue-advanced-cropper__image { opacity: 0.5; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; position: absolute; -webkit-transform-origin: center; transform-origin: center; max-width: unset !important;}.vue-advanced-cropper__area { position: absolute; left: 50%; -webkit-transform: translate(-50%, -50%); transform: translate(-50%, -50%); top: 50%;}.vue-advanced-cropper__background { position: absolute; background: black; top: 50%; left: 50%; -webkit-transform: translate(-50%, -50%); transform: translate(-50%, -50%);}.vue-advanced-cropper__cropper-wrapper { width: 100%; height: 100%;}.vue-advanced-cropper__image-wrapper { overflow: hidden; position: absolute; width: 100%; height: 100%;}.vue-advanced-cropper__stencil-wrapper { position: absolute;}/*# sourceMappingURL=Cropper.vue.map */.vue-square-handler { display: block; background: white; height: 10px; width: 10px;}/*# sourceMappingURL=SimpleHandler.vue.map */.vue-circle-stencil { position: absolute; height: 100%; width: 100%; -webkit-box-sizing: content-box; box-sizing: content-box; cursor: move;}.vue-circle-stencil__preview { border-radius: 50%;}/*# sourceMappingURL=CircleStencil.vue.map */.vue-rectangle-stencil { position: absolute; height: 100%; width: 100%; -webkit-box-sizing: border-box; box-sizing: border-box;}.vue-rectangle-stencil--movable { cursor: move;}/*# sourceMappingURL=RectangleStencil.vue.map */.vue-simple-line { background: none; -webkit-transition: border 0.5s; transition: border 0.5s; border-color: rgba(255, 255, 255, 0.3); border-width: 0; border-style: solid;}.vue-simple-line--south, .vue-simple-line--north { height: 0; width: 100%;}.vue-simple-line--east, .vue-simple-line--west { height: 100%; width: 0;}.vue-simple-line--east { border-right-width: 1px;}.vue-simple-line--west { border-left-width: 1px;}.vue-simple-line--south { border-top-width: 1px;}.vue-simple-line--north { border-bottom-width: 1px;}.vue-simple-line--hover { opacity: 1; border-color: white;}/*# sourceMappingURL=SimpleLine.vue.map */.vue-preview-result { overflow: hidden; -webkit-box-sizing: border-box; box-sizing: border-box; position: absolute; height: 100%; width: 100%;}.vue-preview-result__wrapper { position: absolute;}.vue-preview-result__image { pointer-events: none; position: absolute; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; -webkit-transform-origin: center; transform-origin: center; max-width: unset !important;}/*# sourceMappingURL=PreviewResult.vue.map */.vue-preview-image { overflow: hidden; position: relative;}.vue-preview-image__image { pointer-events: none; position: absolute; max-width: unset !important;}/*# sourceMappingURL=PreviewImage.vue.map */.vue-line-wrapper { background: none; position: absolute; display: -webkit-box; display: -ms-flexbox; display: flex; -webkit-box-align: center; -ms-flex-align: center; align-items: center; -webkit-box-pack: center; -ms-flex-pack: center; justify-content: center;}.vue-line-wrapper--north, .vue-line-wrapper--south { height: 12px; width: 100%; left: 0; -webkit-transform: translateY(-50%); transform: translateY(-50%);}.vue-line-wrapper--north { top: 0; cursor: n-resize;}.vue-line-wrapper--south { top: 100%; cursor: s-resize;}.vue-line-wrapper--east, .vue-line-wrapper--west { width: 12px; height: 100%; -webkit-transform: translateX(-50%); transform: translateX(-50%); top: 0;}.vue-line-wrapper--east { left: 100%; cursor: e-resize;}.vue-line-wrapper--west { left: 0; cursor: w-resize;}.vue-line-wrapper--disabled { cursor: auto;}/*# sourceMappingURL=LineWrapper.vue.map */.vue-bounding-box { position: relative; height: 100%; width: 100%;}/*# sourceMappingURL=BoundingBox.vue.map */.vue-handler-wrapper { position: absolute; -webkit-transform: translate(-50%, -50%); transform: translate(-50%, -50%);}.vue-handler-wrapper__draggable { width: 30px; height: 30px; display: -webkit-box; display: -ms-flexbox; display: flex; -webkit-box-align: center; -ms-flex-align: center; align-items: center; -webkit-box-pack: center; -ms-flex-pack: center; justify-content: center;}.vue-handler-wrapper--west-north { left: 0; top: 0; cursor: nw-resize;}.vue-handler-wrapper--north { left: 50%; top: 0; cursor: n-resize;}.vue-handler-wrapper--east-north { left: 100%; top: 0; cursor: ne-resize;}.vue-handler-wrapper--east { left: 100%; top: 50%; cursor: e-resize;}.vue-handler-wrapper--east-south { left: 100%; top: 100%; cursor: se-resize;}.vue-handler-wrapper--south { left: 50%; top: 100%; cursor: s-resize;}.vue-handler-wrapper--west-south { left: 0; top: 100%; cursor: sw-resize;}.vue-handler-wrapper--west { left: 0; top: 50%; cursor: w-resize;}.vue-handler-wrapper--disabled { cursor: auto;}/*# sourceMappingURL=HandlerWrapper.vue.map */.vue-draggable-area { position: relative;}/*# sourceMappingURL=DraggableArea.vue.map */");//# sourceMappingURL=index.umd.js.map

2

package.json
{
"name": "vue-advanced-cropper",
"version": "0.13.2",
"version": "0.14.0",
"description": "The advanced library to create your own croppers suited for any website design",

@@ -5,0 +5,0 @@ "author": "Norserium",

@@ -5,3 +5,3 @@ # Vue Advanced Cropper

[Documentation / Examples](https://norserium.github.io/vue-advanced-cropper/).
[Documentation](https://norserium.github.io/vue-advanced-cropper/) / [Examples](https://norserium.github.io/vue-advanced-cropper/tutorials/recipes.html) / [Sandbox](https://codesandbox.io/s/vue-avanced-cropper-basic-jfy5w)

@@ -8,0 +8,0 @@ [![NPM](https://img.shields.io/npm/v/vue-advanced-cropper.svg)](https://www.npmjs.com/package/vue-advanced-cropper)

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc