21 lines
80 KiB
JavaScript
21 lines
80 KiB
JavaScript
import{F as w,z as y,R as Y,g as T,C as A,D as j,a2 as Ct,a3 as Et,aa as nt,a7 as kt,a8 as Yt,dy as Xt,S as Tt,bY as ie}from"./G_17LgpR.js";function Wt(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter((function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable}))),i.push.apply(i,s)}return i}function v(t){for(var e=1;e<arguments.length;e++){var i=arguments[e]!=null?arguments[e]:{};e%2?Wt(Object(i),!0).forEach((function(s){E(t,s,i[s])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):Wt(Object(i)).forEach((function(s){Object.defineProperty(t,s,Object.getOwnPropertyDescriptor(i,s))}))}return t}function E(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function ne(t,e){if(t==null)return{};var i,s,o=(function(a,h){if(a==null)return{};var r,c,l={},u=Object.keys(a);for(c=0;c<u.length;c++)r=u[c],h.indexOf(r)>=0||(l[r]=a[r]);return l})(t,e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);for(s=0;s<n.length;s++)i=n[s],e.indexOf(i)>=0||Object.prototype.propertyIsEnumerable.call(t,i)&&(o[i]=t[i])}return o}function k(t){return(function(e){if(Array.isArray(e))return ct(e)})(t)||(function(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)})(t)||(function(e,i){if(e){if(typeof e=="string")return ct(e,i);var s=Object.prototype.toString.call(e).slice(8,-1);if(s==="Object"&&e.constructor&&(s=e.constructor.name),s==="Map"||s==="Set")return Array.from(e);if(s==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s))return ct(e,i)}})(t)||(function(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|||
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)})()}function ct(t,e){(e==null||e>t.length)&&(e=t.length);for(var i=0,s=new Array(e);i<e;i++)s[i]=t[i];return s}var Ot,se,Q,z=(Ot=function(t){/*!
|
||
|
|
Copyright (c) 2018 Jed Watson.
|
||
|
|
Licensed under the MIT License (MIT), see
|
||
|
|
http://jedwatson.github.io/classnames
|
||
|
|
*/(function(){var e={}.hasOwnProperty;function i(){for(var s=[],o=0;o<arguments.length;o++){var n=arguments[o];if(n){var a=typeof n;if(a==="string"||a==="number")s.push(n);else if(Array.isArray(n)){if(n.length){var h=i.apply(null,n);h&&s.push(h)}}else if(a==="object")if(n.toString===Object.prototype.toString)for(var r in n)e.call(n,r)&&n[r]&&s.push(r);else s.push(n.toString())}}return s.join(" ")}t.exports?(i.default=i,t.exports=i):window.classNames=i})()},Ot(Q={path:se,exports:{},require:function(t,e){return(function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")})(e==null&&Q.path)}},Q.exports),Q.exports),O=function(t){return function(e,i){if(!e)return t;var s;typeof e=="string"?s=e:i=e;var o=t;return s&&(o+="__"+s),o+(i?Object.keys(i).reduce((function(n,a){var h=i[a];return h&&(n+=" "+(typeof h=="boolean"?o+"--"+a:o+"--"+a+"_"+h)),n}),""):"")}};function pt(t,e,i){var s,o,n,a,h;function r(){var l=Date.now()-a;l<e&&l>=0?s=setTimeout(r,e-l):(s=null,i||(h=t.apply(n,o),n=o=null))}e==null&&(e=100);var c=function(){n=this,o=arguments,a=Date.now();var l=i&&!s;return s||(s=setTimeout(r,e)),l&&(h=t.apply(n,o),n=o=null),h};return c.clear=function(){s&&(clearTimeout(s),s=null)},c.flush=function(){s&&(h=t.apply(n,o),n=o=null,clearTimeout(s),s=null)},c}pt.debounce=pt;var vt=pt,f=function(){return f=Object.assign||function(t){for(var e,i=1,s=arguments.length;i<s;i++)for(var o in e=arguments[i])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},f.apply(this,arguments)};/*! *****************************************************************************
|
||
|
|
Copyright (c) Microsoft Corporation.
|
||
|
|
|
||
|
|
Permission to use, copy, modify, and/or distribute this software for any
|
||
|
|
purpose with or without fee is hereby granted.
|
||
|
|
|
||
|
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||
|
|
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||
|
|
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||
|
|
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||
|
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||
|
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||
|
|
PERFORMANCE OF THIS SOFTWARE.
|
||
|
|
***************************************************************************** */function Ft(t,e){var i,s;return t&&e?(i=""+t+e[0].toUpperCase()+e.slice(1),s=t+"-"+e):(i=t||e,s=t||e),{name:i,classname:s}}function Ut(t){return/^blob:/.test(t)}function Dt(t){return Ut(t)||(function(e){return/^data:/.test(e)})(t)}function X(t){return!!(t&&t.constructor&&t.call&&t.apply)}function R(t){return t===void 0}function it(t){return typeof t=="object"&&t!==null}function bt(t,e,i){var s={};return it(t)?(Object.keys(e).forEach((function(o){R(t[o])?s[o]=e[o]:it(e[o])?it(t[o])?s[o]=bt(t[o],e[o],i[o]):s[o]=t[o]?e[o]:i[o]:e[o]===!0||e[o]===!1?s[o]=!!t[o]:s[o]=t[o]})),s):t?e:i}function K(t){var e=Number(t);return Number.isNaN(e)?t:e}function Ht(t){return typeof(t=="number"||(function(e){return typeof e=="object"&&e!==null})(t)&&toString.call(t)=="[object Number]")&&!Nt(t)}function Nt(t){return t!=t}function Zt(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}var V=function(t,e){t===void 0&&(t={}),e===void 0&&(e={}),this.type="manipulateImage",this.move=t,this.scale=e},oe=function(t,e){e===void 0&&(e={}),this.type="resize",this.directions=t,this.params=e},Rt=function(t){this.type="move",this.directions=t},re=(function(){function t(e,i,s,o,n){this.type="drag",this.nativeEvent=e,this.position=s,this.previousPosition=o,this.element=i,this.anchor=n}return t.prototype.shift=function(){var e=this,i=e.element,s=e.anchor,o=e.position;if(i){var n=i.getBoundingClientRect(),a=n.left,h=n.top;return{left:o.left-a-s.left,top:o.top-h-s.top}}return{left:0,top:0}},t})(),At={name:"DraggableElement",props:{classname:{type:String}},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})},beforeUnmount: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.hovered=!1},methods:{onMouseOver:function(){this.hovered||(this.hovered=!0,this.$emit("enter"))},onMouseLeave:function(){this.hovered&&!this.touches.length&&(this.hovered=!1,this.$emit("leave"))},onTouchStart:function(t){t.cancelable&&!this.disabled&&t.touches.length===1&&(this.touches=k(t.touches),this.hovered||(this.$emit("enter"),this.hovered=!0),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.processEnd()},initAnchor:function(t){var e=this.$refs.draggable.getBoundingClientRect(),i=e.left,s=e.right,o=e.bottom,n=e.top;this.anchor={left:t.clientX-i,top:t.clientY-n,bottom:o-t.clientY,right:s-t.clientX}},processMove:function(t,e){var i=k(e);if(this.touches.length){if(this.touches.length===1&&i.length===1){var s=this.$refs.draggable;this.$emit("drag",new re(t,s,{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.length&&this.$emit("drag-end"),this.hovered&&(this.$emit("leave"),this.hovered=!1),this.touches=[]}},emits:
|
||
|
|
`.concat(-this.coordinates.left/t-a.rotate.left-a.scale.left,"px,").concat(-this.coordinates.top/t-a.rotate.top-a.scale.top,"px) ")+Kt(e),this.transitions&&this.transitions.enabled&&(n.transition="".concat(this.transitions.time,"ms ").concat(this.transitions.timingFunction)),n}return{}},size:function(){return{width:this.width||this.calculatedSize.width,height:this.height||this.calculatedSize.height}},imageSize:function(){return{width:this.image.width||this.calculatedImageSize.width,height:this.image.height||this.calculatedImageSize.height}}},watch:{image:function(t){(t.width||t.height)&&this.onChangeImage()}},mounted:function(){var t=this;this.onChangeImage(),this.$refs.image.addEventListener("load",(function(){t.refreshImage()})),window.addEventListener("resize",this.refresh),window.addEventListener("orientationchange",this.refresh)},unmounted:function(){window.removeEventListener("resize",this.refresh),window.removeEventListener("orientationchange",this.refresh)},methods:{refreshImage:function(){var t=this.$refs.image;this.calculatedImageSize.height=t.naturalHeight,this.calculatedImageSize.width=t.naturalWidth},refresh:function(){var t=this.$refs.root;this.width||(this.calculatedSize.width=t.clientWidth),this.height||(this.calculatedSize.height=t.clientHeight)},onChangeImage:function(){var t=this.$refs.image;t&&t.complete&&this.refreshImage(),this.refresh()}}};te.render=function(t,e,i,s,o,n){return y(),w("div",{ref:"root",class:n.classes.root,style:n.style},[A("div",{ref:"wrapper",class:n.classes.wrapper,style:n.wrapperStyle},[kt(A("img",{ref:"image",src:i.image&&i.image.src,class:n.classes.image,style:n.imageStyle},null,14,["src"]),[[Yt,i.image&&i.image.src]])],6)],6)};var xt={components:{Preview:te},inheritAttrs:!1};xt.render=function(t,e,i,s,o,n){var a=T("preview");return y(),w(a,Xt(t.$attrs,{fill:!0}),null,16)};var ft=O("vue-rectangle-stencil"),ee={name:"RectangleStencil",components:{StencilPreview:xt,BoundingBox:Mt,DraggableArea:St},props:{image:{type:Object},coordinates:{type:Object},stencilCoordinates:{type:Object},handlers:{type:Object},handlersComponent:{type:[Object,String],default:function(){return at}},lines:{type:Object},linesComponent:{type:[Object,String],default:function(){return ht}},aspectRatio:{type:[Number,String]},minAspectRatio:{type:[Number,String]},maxAspectRatio:{type:[Number,String]},movable:{type:Boolean,default:!0},resizable:{type:Boolean,default:!0},transitions:{type:Object},movingClass:{type:String},resizingClass:{type:String},previewClass:{type:String},boundingBoxClass:{type:String},linesClasses:{type:Object,default:function(){return{}}},linesWrappersClasses:{type:Object,default:function(){return{}}},handlersClasses:{type:Object,default:function(){return{}}},handlersWrappersClasses:{type:Object,default:function(){return{}}}},data:function(){return{moving:!1,resizing:!1}},computed:{classes:function(){return{stencil:z(ft({movable:this.movable,moving:this.moving,resizing:this.resizing}),this.moving&&this.movingClass,this.resizing&&this.resizingClass),preview:z(ft("preview"),this.previewClass),boundingBox:z(ft("bounding-box"),this.boundingBoxClass)}},style:function(){var t=this.stencilCoordinates,e=t.height,i=t.width,s=t.left,o=t.top,n={width:"".concat(i,"px"),height:"".concat(e,"px"),transform:"translate(".concat(s,"px, ").concat(o,"px)")};return this.transitions&&this.transitions.enabled&&(n.transition="".concat(this.transitions.time,"ms ").concat(this.transitions.timingFunction)),n}},methods:{onMove:function(t){this.$emit("move",t),this.moving=!0},onMoveEnd:function(){this.$emit("move-end"),this.moving=!1},onResize:function(t){this.$emit("resize",t),this.resizing=!0},onResizeEnd:function(){this.$emit("resize-end"),this.resizing=!1},aspectRatios:function(){return{minimum:this.aspectRatio||this.minAspectRatio,maximum:this.aspectRatio||this.maxAspectRatio}}},emits:["resize","resize-end","move","move-end"]};ee.render=function(t,e,i,s,o,n){var a=T("stencil-preview"),h=T("draggable-area"),r=T("bounding-box");return y(),w("div",{class:n.classes.stencil,style:n.style},[A(r,{width:i.stencilCoo
|