vue-photo-zoom-pro
Version:
Vue picture magnifier
2 lines (1 loc) • 26.5 kB
JavaScript
var VuePhotoZoomPro=function(t){"use strict";function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},e(t)}var n=require("../internals/descriptors"),o=require("../internals/global"),r=require("../internals/function-uncurry-this"),i=require("../internals/is-forced"),s=require("../internals/redefine"),l=require("../internals/has-own-property"),u=require("../internals/inherit-if-required"),a=require("../internals/object-is-prototype-of"),c=require("../internals/is-symbol"),h=require("../internals/to-primitive"),f=require("../internals/fails"),p=require("../internals/object-get-own-property-names").f,d=require("../internals/object-get-own-property-descriptor").f,m=require("../internals/object-define-property").f,g=require("../internals/this-number-value"),y=require("../internals/string-trim").trim,v="Number",b=o.Number,_=b.prototype,w=o.TypeError,x=r("".slice),S=r("".charCodeAt),I=function(t){var e=h(t,"number");return"bigint"==typeof e?e:k(e)},k=function(t){var e,n,o,r,i,s,l,u,a=h(t,"number");if(c(a))throw w("Cannot convert a Symbol value to a number");if("string"==typeof a&&a.length>2)if(a=y(a),43===(e=S(a,0))||45===e){if(88===(n=S(a,2))||120===n)return NaN}else if(48===e){switch(S(a,1)){case 66:case 98:o=2,r=49;break;case 79:case 111:o=8,r=55;break;default:return+a}for(s=(i=x(a,2)).length,l=0;l<s;l++)if((u=S(i,l))<48||u>r)return NaN;return parseInt(i,o)}return+a};if(i(v,!b(" 0o1")||!b("0b1")||b("+0x1"))){for(var R,z=function(t){var e=arguments.length<1?0:b(I(t)),n=this;return a(_,n)&&f((function(){g(n)}))?u(Object(e),n,z):e},P=n?p(b):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,isFinite,isInteger,isNaN,isSafeInteger,parseFloat,parseInt,fromString,range".split(","),N=0;P.length>N;N++)l(b,R=P[N])&&!l(z,R)&&m(z,R,d(b,R));z.prototype=_,_.constructor=z,s(o,v,z)}var E=require("../internals/export"),$=require("../internals/object-assign");E({target:"Object",stat:!0,forced:Object.assign!==$},{assign:$});var O={name:"VuePhotoZoomProMask",props:{width:{type:Number,default:0},height:{type:Number,default:0},selector:{type:Object,default:function(){return{left:0,top:0,width:0,height:0}}},maskColor:{type:String,default:""}},computed:{topStyle:function(){var t=this.selector;return{width:"".concat(this.width,"px"),height:"".concat(t.top,"px")}},leftStyle:function(){var t=this.selector;return{width:"".concat(t.left,"px"),height:"".concat(t.height,"px")}},rightStyle:function(){var t=this.selector;return{width:"".concat(this.width-t.left-t.width,"px"),height:"".concat(t.height,"px")}},bottomStyle:function(){var t=this.selector;return{width:"".concat(this.width,"px"),height:"".concat(this.height-t.top-t.height,"px")}},maskStyle:function(){return{backgroundColor:this.maskColor}}}};function C(t){if(W(t)){const e={};for(let n=0;n<t.length;n++){const o=t[n],r=Y(o)?F(o):C(o);if(r)for(const t in r)e[t]=r[t]}return e}return Y(t)||X(t)?t:void 0}const q=/;(?![^(]*\))/g,M=/:([^]+)/,j=/\/\*.*?\*\//gs;function F(t){const e={};return t.replace(j,"").split(q).forEach((t=>{if(t){const n=t.split(M);n.length>1&&(e[n[0].trim()]=n[1].trim())}})),e}function Z(t){let e="";if(Y(t))e=t;else if(W(t))for(let n=0;n<t.length;n++){const o=Z(t[n]);o&&(e+=o+" ")}else if(X(t))for(const n in t)t[n]&&(e+=n+" ");return e.trim()}const H={},T=[],A=()=>{},V=/^on[^a-z]/,U=t=>V.test(t),L=Object.assign,W=Array.isArray,B=t=>"function"==typeof t,Y=t=>"string"==typeof t,X=t=>null!==t&&"object"==typeof t,D=Object.prototype.toString,G=t=>D.call(t),J=t=>{const e=Object.create(null);return n=>e[n]||(e[n]=t(n))},K=/-(\w)/g,Q=J((t=>t.replace(K,((t,e)=>e?e.toUpperCase():"")))),tt=J((t=>t.charAt(0).toUpperCase()+t.slice(1))),et=(t,e)=>!Object.is(t,e);const nt=t=>(t.w&it)>0,ot=t=>(t.n&it)>0;let rt=0,it=1;let st;class lt{constructor(t,e=null,n){this.fn=t,this.scheduler=e,this.active=!0,this.deps=[],this.parent=void 0,function(t,e){e&&e.active&&e.effects.push(t)}(this,n)}run(){if(!this.active)return this.fn();let t=st,e=at;for(;t;){if(t===this)return;t=t.parent}try{return this.parent=st,st=this,at=!0,it=1<<++rt,rt<=30?(({deps:t})=>{if(t.length)for(let e=0;e<t.length;e++)t[e].w|=it})(this):ut(this),this.fn()}finally{rt<=30&&(t=>{const{deps:e}=t;if(e.length){let n=0;for(let o=0;o<e.length;o++){const r=e[o];nt(r)&&!ot(r)?r.delete(t):e[n++]=r,r.w&=~it,r.n&=~it}e.length=n}})(this),it=1<<--rt,st=this.parent,at=e,this.parent=void 0,this.deferStop&&this.stop()}}stop(){st===this?this.deferStop=!0:this.active&&(ut(this),this.onStop&&this.onStop(),this.active=!1)}}function ut(t){const{deps:e}=t;if(e.length){for(let n=0;n<e.length;n++)e[n].delete(t);e.length=0}}let at=!0;function ct(t){return ht(t)?ct(t.__v_raw):!(!t||!t.__v_isReactive)}function ht(t){return!(!t||!t.__v_isReadonly)}function ft(t){return!(!t||!t.__v_isShallow)}function pt(t){return ct(t)||ht(t)}function dt(t){return((t,e,n)=>{Object.defineProperty(t,e,{configurable:!0,enumerable:!1,value:n})})(t,"__v_skip",!0),t}function mt(t){return!(!t||!0!==t.__v_isRef)}const gt={get:(t,e,n)=>{return mt(o=Reflect.get(t,e,n))?o.value:o;var o},set:(t,e,n,o)=>{const r=t[e];return mt(r)&&!mt(n)?(r.value=n,!0):Reflect.set(t,e,n,o)}};function yt(t,e,n,o){let r;try{r=o?t(...o):t()}catch(t){bt(t,e,n)}return r}function vt(t,e,n,o){if(B(t)){const i=yt(t,e,n,o);return i&&(X(r=i)&&B(r.then)&&B(r.catch))&&i.catch((t=>{bt(t,e,n)})),i}var r;const i=[];for(let r=0;r<t.length;r++)i.push(vt(t[r],e,n,o));return i}function bt(t,e,n,o=!0){if(e){let o=e.parent;const r=e.proxy,i=n;for(;o;){const e=o.ec;if(e)for(let n=0;n<e.length;n++)if(!1===e[n](t,r,i))return;o=o.parent}const s=e.appContext.config.errorHandler;if(s)return void yt(s,null,10,[t,r,i])}}let _t=!1,wt=!1;const xt=[];let St=0;const It=[];let kt=null,Rt=0;const zt=Promise.resolve();let Pt=null;function Nt(t){const e=Pt||zt;return t?e.then(this?t.bind(this):t):e}function Et(t){xt.length&&xt.includes(t,_t&&t.allowRecurse?St+1:St)||(null==t.id?xt.push(t):xt.splice(function(t){let e=St+1,n=xt.length;for(;e<n;){const o=e+n>>>1;Ot(xt[o])<t?e=o+1:n=o}return e}(t.id),0,t),$t())}function $t(){_t||wt||(wt=!0,Pt=zt.then(qt))}const Ot=t=>null==t.id?1/0:t.id,Ct=(t,e)=>{const n=Ot(t)-Ot(e);if(0===n){if(t.pre&&!e.pre)return-1;if(e.pre&&!t.pre)return 1}return n};function qt(t){wt=!1,_t=!0,xt.sort(Ct);try{for(St=0;St<xt.length;St++){const t=xt[St];t&&!1!==t.active&&yt(t,null,14)}}finally{St=0,xt.length=0,function(t){if(It.length){const t=[...new Set(It)];if(It.length=0,kt)return void kt.push(...t);for(kt=t,kt.sort(((t,e)=>Ot(t)-Ot(e))),Rt=0;Rt<kt.length;Rt++)kt[Rt]();kt=null,Rt=0}}(),_t=!1,Pt=null,(xt.length||It.length)&&qt()}}const Mt=jt("component:updated");function jt(t){return t=>{}}let Ft=null,Zt=null;function Ht(t){const e=Ft;return Ft=t,Zt=t&&t.type.__scopeId||null,e}function Tt(t,e=Ft,n){if(!e)return t;if(t._n)return t;const o=(...n)=>{o._d&&pe(-1);const r=Ht(e);let i;try{i=t(...n)}finally{Ht(r),o._d&&pe(1)}return __VUE_PROD_DEVTOOLS__&&Mt(e),i};return o._n=!0,o._c=!0,o._d=!0,o}const At={};function Vt(t,e,n){const o=this.proxy,r=Y(t)?t.includes(".")?function(t,e){const n=e.split(".");return()=>{let e=t;for(let t=0;t<n.length&&e;t++)e=e[n[t]];return e}}(o,t):()=>o[t]:t.bind(o,o);let i;B(e)?i=e:(i=e.handler,n=e);const s=Pe;Ne(this);const l=function(t,e,{immediate:n,deep:o,flush:r}=H){const i=Pe;let s,l,u=!1,a=!1;if(mt(t)?(s=()=>t.value,u=ft(t)):ct(t)?(s=()=>t,o=!0):W(t)?(a=!0,u=t.some((t=>ct(t)||ft(t))),s=()=>t.map((t=>mt(t)?t.value:ct(t)?Ut(t):B(t)?yt(t,i,2):void 0))):s=B(t)?e?()=>yt(t,i,2):()=>{if(!i||!i.isUnmounted)return l&&l(),vt(t,i,3,[c])}:A,e&&o){const t=s;s=()=>Ut(t())}let c=t=>{l=d.onStop=()=>{yt(t,i,4)}},h=a?new Array(t.length).fill(At):At;const f=()=>{if(d.active)if(e){const t=d.run();(o||u||(a?t.some(((t,e)=>et(t,h[e]))):et(t,h)))&&(l&&l(),vt(e,i,3,[t,h===At?void 0:a&&h[0]===At?[]:h,c]),h=t)}else d.run()};let p;f.allowRecurse=!!e,"sync"===r?p=f:"post"===r?p=()=>ie(f,i&&i.suspense):(f.pre=!0,i&&(f.id=i.uid),p=()=>Et(f));const d=new lt(s,p);return e?n?f():h=d.run():"post"===r?ie(d.run.bind(d),i&&i.suspense):d.run(),()=>{d.stop(),i&&i.scope&&((t,e)=>{const n=t.indexOf(e);n>-1&&t.splice(n,1)})(i.scope.effects,d)}}(r,i.bind(o),n);return s?Ne(s):Ee(),l}function Ut(t,e){if(!X(t)||t.__v_skip)return t;if((e=e||new Set).has(t))return t;if(e.add(t),mt(t))Ut(t.value,e);else if(W(t))for(let n=0;n<t.length;n++)Ut(t[n],e);else if("[object Set]"===G(t)||(t=>"[object Map]"===G(t))(t))t.forEach((t=>{Ut(t,e)}));else if((t=>"[object Object]"===G(t))(t))for(const n in t)Ut(t[n],e);return t}function Lt(t,e){const n=Ft;if(null===n)return t;const o=$e(n)||n.proxy,r=t.dirs||(t.dirs=[]);for(let t=0;t<e.length;t++){let[n,i,s,l=H]=e[t];n&&(B(n)&&(n={mounted:n,updated:n}),n.deep&&Ut(i),r.push({dir:n,instance:o,value:i,oldValue:void 0,arg:s,modifiers:l}))}return t}const Wt="components";function Bt(t,e){return function(t,e,n=!0,o=!1){const r=Ft||Pe;if(r){const n=r.type;if(t===Wt){const t=function(t,e=!0){return B(t)?t.displayName||t.name:t.name||e&&t.__name}(n,!1);if(t&&(t===e||t===Q(e)||t===tt(Q(e))))return n}const i=Xt(r[t]||n[t],e)||Xt(r.appContext[t],e);return!i&&o?n:i}}(Wt,t,!0,e)||t}const Yt=Symbol();function Xt(t,e){return t&&(t[e]||t[Q(e)]||t[tt(Q(e))])}function Dt(t,e,n={},o,r){if(Ft.isCE||Ft.parent&&Ft.parent.type.__asyncLoader&&Ft.parent.isCE)return"default"!==e&&(n.name=e),xe("slot",n,o&&o());let i=t[e];i&&i._c&&(i._d=!1),he();const s=i&&Gt(i(n)),l=ge(se,{key:n.key||s&&s.key||`_${e}`},s||(o?o():[]),s&&1===t._?64:-2);return!r&&l.scopeId&&(l.slotScopeIds=[l.scopeId+"-s"]),i&&i._c&&(i._d=!0),l}function Gt(t){return t.some((t=>!ye(t)||t.type!==ue&&!(t.type===se&&!Gt(t.children))))?t:null}const Jt=t=>t?4&t.vnode.shapeFlag?$e(t)||t.proxy:Jt(t.parent):null,Kt=L(Object.create(null),{$:t=>t,$el:t=>t.vnode.el,$data:t=>t.data,$props:t=>t.props,$attrs:t=>t.attrs,$slots:t=>t.slots,$refs:t=>t.refs,$parent:t=>Jt(t.parent),$root:t=>Jt(t.root),$emit:t=>t.emit,$options:t=>__VUE_OPTIONS_API__?function(t){const e=t.type,{mixins:n,extends:o}=e,{mixins:r,optionsCache:i,config:{optionMergeStrategies:s}}=t.appContext,l=i.get(e);let u;l?u=l:r.length||n||o?(u={},r.length&&r.forEach((t=>Qt(u,t,s,!0))),Qt(u,e,s)):u=e;X(e)&&i.set(e,u);return u}(t):t.type,$forceUpdate:t=>t.f||(t.f=()=>Et(t.update)),$nextTick:t=>t.n||(t.n=Nt.bind(t.proxy)),$watch:t=>__VUE_OPTIONS_API__?Vt.bind(t):A});function Qt(t,e,n,o=!1){const{mixins:r,extends:i}=e;i&&Qt(t,i,n,!0),r&&r.forEach((e=>Qt(t,e,n,!0)));for(const r in e)if(o&&"expose"===r);else{const o=te[r]||n&&n[r];t[r]=o?o(t[r],e[r]):e[r]}return t}const te={data:ee,props:re,emits:re,methods:re,computed:re,beforeCreate:oe,created:oe,beforeMount:oe,mounted:oe,beforeUpdate:oe,updated:oe,beforeDestroy:oe,beforeUnmount:oe,destroyed:oe,unmounted:oe,activated:oe,deactivated:oe,errorCaptured:oe,serverPrefetch:oe,components:re,directives:re,watch:function(t,e){if(!t)return e;if(!e)return t;const n=L(Object.create(null),t);for(const o in e)n[o]=oe(t[o],e[o]);return n},provide:ee,inject:function(t,e){return re(ne(t),ne(e))}};function ee(t,e){return e?t?function(){return L(B(t)?t.call(this,this):t,B(e)?e.call(this,this):e)}:e:t}function ne(t){if(W(t)){const e={};for(let n=0;n<t.length;n++)e[t[n]]=t[n];return e}return t}function oe(t,e){return t?[...new Set([].concat(t,e))]:e}function re(t,e){return t?L(L(Object.create(null),t),e):e}const ie=function(t,e){var n;e&&e.pendingBranch?W(t)?e.effects.push(...t):e.effects.push(t):(W(n=t)?It.push(...n):kt&&kt.includes(n,n.allowRecurse?Rt+1:Rt)||It.push(n),$t())},se=Symbol(void 0),le=Symbol(void 0),ue=Symbol(void 0),ae=[];let ce=null;function he(t=!1){ae.push(ce=t?null:[])}let fe=1;function pe(t){fe+=t}function de(t){return t.dynamicChildren=fe>0?ce||T:null,ae.pop(),ce=ae[ae.length-1]||null,fe>0&&ce&&ce.push(t),t}function me(t,e,n,o,r,i){return de(we(t,e,n,o,r,i,!0))}function ge(t,e,n,o,r){return de(xe(t,e,n,o,r,!0))}function ye(t){return!!t&&!0===t.__v_isVNode}const ve="__vInternal",be=({key:t})=>null!=t?t:null,_e=({ref:t,ref_key:e,ref_for:n})=>null!=t?Y(t)||mt(t)||B(t)?{i:Ft,r:t,k:e,f:!!n}:t:null;function we(t,e=null,n=null,o=0,r=null,i=(t===se?0:1),s=!1,l=!1){const u={__v_isVNode:!0,__v_skip:!0,type:t,props:e,key:e&&be(e),ref:e&&_e(e),scopeId:Zt,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetAnchor:null,staticCount:0,shapeFlag:i,patchFlag:o,dynamicProps:r,dynamicChildren:null,appContext:null,ctx:Ft};return l?(Re(u,n),128&i&&t.normalize(u)):n&&(u.shapeFlag|=Y(n)?8:16),fe>0&&!s&&ce&&(u.patchFlag>0||6&i)&&32!==u.patchFlag&&ce.push(u),u}const xe=function(t,e=null,n=null,o=0,r=null,i=!1){t&&t!==Yt||(t=ue);if(ye(t)){const o=Se(t,e,!0);return n&&Re(o,n),fe>0&&!i&&ce&&(6&o.shapeFlag?ce[ce.indexOf(t)]=o:ce.push(o)),o.patchFlag|=-2,o}s=t,B(s)&&"__vccOpts"in s&&(t=t.__vccOpts);var s;if(e){e=function(t){return t?pt(t)||ve in t?L({},t):t:null}(e);let{class:t,style:n}=e;t&&!Y(t)&&(e.class=Z(t)),X(n)&&(pt(n)&&!W(n)&&(n=L({},n)),e.style=C(n))}const l=Y(t)?1:(t=>t.__isSuspense)(t)?128:(t=>t.__isTeleport)(t)?64:X(t)?4:B(t)?2:0;return we(t,e,n,o,r,l,i,!0)};function Se(t,e,n=!1){const{props:o,ref:r,patchFlag:i,children:s}=t,l=e?ze(o||{},e):o;return{__v_isVNode:!0,__v_skip:!0,type:t.type,props:l,key:l&&be(l),ref:e&&e.ref?n&&r?W(r)?r.concat(_e(e)):[r,_e(e)]:_e(e):r,scopeId:t.scopeId,slotScopeIds:t.slotScopeIds,children:s,target:t.target,targetAnchor:t.targetAnchor,staticCount:t.staticCount,shapeFlag:t.shapeFlag,patchFlag:e&&t.type!==se?-1===i?16:16|i:i,dynamicProps:t.dynamicProps,dynamicChildren:t.dynamicChildren,appContext:t.appContext,dirs:t.dirs,transition:t.transition,component:t.component,suspense:t.suspense,ssContent:t.ssContent&&Se(t.ssContent),ssFallback:t.ssFallback&&Se(t.ssFallback),el:t.el,anchor:t.anchor,ctx:t.ctx}}function Ie(t=" ",e=0){return xe(le,null,t,e)}function ke(t="",e=!1){return e?(he(),ge(ue,null,t)):xe(ue,null,t)}function Re(t,e){let n=0;const{shapeFlag:o}=t;if(null==e)e=null;else if(W(e))n=16;else if("object"==typeof e){if(65&o){const n=e.default;return void(n&&(n._c&&(n._d=!1),Re(t,n()),n._c&&(n._d=!0)))}{n=32;const o=e._;o||ve in e?3===o&&Ft&&(1===Ft.slots._?e._=1:(e._=2,t.patchFlag|=1024)):e._ctx=Ft}}else B(e)?(e={default:e,_ctx:Ft},n=32):(e=String(e),64&o?(n=16,e=[Ie(e)]):n=8);t.children=e,t.shapeFlag|=n}function ze(...t){const e={};for(let n=0;n<t.length;n++){const o=t[n];for(const t in o)if("class"===t)e.class!==o.class&&(e.class=Z([e.class,o.class]));else if("style"===t)e.style=C([e.style,o.style]);else if(U(t)){const n=e[t],r=o[t];!r||n===r||W(n)&&n.includes(r)||(e[t]=n?[].concat(n,r):r)}else""!==t&&(e[t]=o[t])}return e}let Pe=null;const Ne=t=>{Pe=t,t.scope.on()},Ee=()=>{Pe&&Pe.scope.off(),Pe=null};function $e(t){if(t.exposed)return t.exposeProxy||(t.exposeProxy=new Proxy(ct(e=dt(t.exposed))?e:new Proxy(e,gt),{get:(e,n)=>n in e?e[n]:n in Kt?Kt[n](t):void 0,has:(t,e)=>e in t||e in Kt}));var e}const Oe={beforeMount(t,{value:e},{transition:n}){t._vod="none"===t.style.display?"":t.style.display,n&&e?n.beforeEnter(t):Ce(t,e)},mounted(t,{value:e},{transition:n}){n&&e&&n.enter(t)},updated(t,{value:e,oldValue:n},{transition:o}){!e!=!n&&(o?e?(o.beforeEnter(t),Ce(t,!0),o.enter(t)):o.leave(t,(()=>{Ce(t,!1)})):Ce(t,e))},beforeUnmount(t,{value:e}){Ce(t,e)}};function Ce(t,e){t.style.display=e?t._vod:"none"}O.render=function(t,e,n,o,r,i){return he(),me("div",{class:"mask",style:C(i.maskStyle)},[we("div",{class:"block top",style:C(i.topStyle)},null,4),we("div",{class:"block left",style:C(i.leftStyle)},null,4),we("div",{class:"block right",style:C(i.rightStyle)},null,4),we("div",{class:"block bottom",style:C(i.bottomStyle)},null,4)],4)},O.__scopeId="data-v-15e50313";var qe=require("../internals/export"),Me=require("../internals/global"),je=require("../internals/fails"),Fe=require("../internals/is-array"),Ze=require("../internals/is-object"),He=require("../internals/to-object"),Te=require("../internals/length-of-array-like"),Ae=require("../internals/create-property"),Ve=require("../internals/array-species-create"),Ue=require("../internals/array-method-has-species-support"),Le=require("../internals/well-known-symbol"),We=require("../internals/engine-v8-version"),Be=Le("isConcatSpreadable"),Ye=9007199254740991,Xe="Maximum allowed index exceeded",De=Me.TypeError,Ge=We>=51||!je((function(){var t=[];return t[Be]=!1,t.concat()[0]!==t})),Je=Ue("concat"),Ke=function(t){if(!Ze(t))return!1;var e=t[Be];return void 0!==e?!!e:Fe(t)};qe({target:"Array",proto:!0,forced:!Ge||!Je},{concat:function(t){var e,n,o,r,i,s=He(this),l=Ve(s,0),u=0;for(e=-1,o=arguments.length;e<o;e++)if(Ke(i=-1===e?s:arguments[e])){if(u+(r=Te(i))>Ye)throw De(Xe);for(n=0;n<r;n++,u++)n in i&&Ae(l,u,i[n])}else{if(u>=Ye)throw De(Xe);Ae(l,u++,i)}return l.length=u,l}});var Qe={name:"VuePhotoZoomProZoomer",props:{left:{type:Number,default:0},top:{type:Number,default:0},scale:{type:Number,default:2},zoomRegion:{type:Object,default:function(){return{width:0,height:0}}},width:{type:Number,default:0},height:{type:Number,default:0}},computed:{zoomerStyle:function(){return{width:"".concat(this.width,"px"),height:"".concat(this.height,"px")}},positionStyle:function(){return{transform:"translate3d(".concat(-this.left,"px, ").concat(-this.top,"px, 0)")}},zoomedStyle:function(){var t=this.zoomRegion;return{transform:"scale(".concat(this.scale,") translateZ(0)"),width:"".concat(t.width,"px"),height:"".concat(t.height,"px")}}}};Qe.render=function(t,e,n,o,r,i){return he(),me("div",{class:"zoomer",style:C(i.zoomerStyle)},[we("div",{class:"position",style:C(i.positionStyle)},[t.$slots.default?(he(),me("div",{key:0,class:"custom-zoomer",style:C(i.zoomedStyle)},[Dt(t.$slots,"default")],4)):ke("",!0)],4)],4)},Qe.__scopeId="data-v-1bae271a";var tn={name:"VuePhotoZommProSelector",props:{left:{type:Number,default:0},top:{type:Number,default:0},width:{type:Number,default:0},height:{type:Number,default:0},type:{type:String,default:"square"}},computed:{selectorStyle:function(){return{width:"".concat(this.width,"px"),height:"".concat(this.height,"px"),transform:"translate3d(".concat(this.left,"px, ").concat(this.top,"px, 0)")}}}};tn.render=function(t,e,n,o,r,i){return he(),me("div",{class:Z(["selector",n.type]),style:C(i.selectorStyle)},[Dt(t.$slots,"default")],6)},tn.__scopeId="data-v-3c631a3a";var en={name:"ImgPreview",props:{url:{type:String,default:""}}},nn=["src"];en.render=function(t,e,n,o,r,i){return he(),me("img",ze({class:"img-preview",style:{display:"block",width:"100%"},src:n.url},t.$attrs),null,16,nn)};var on={name:"ImgZoomer",props:{url:{type:String,default:""}}},rn=["src"];on.render=function(t,e,n,o,r,i){return he(),me("img",ze({class:"img-zoomer",style:{display:"block",width:"100%",height:"100%"},src:n.url},t.$attrs),null,16,rn)};function sn(t,e,n){var o=n;return Math.min(Math.max(t,e),o)}var ln=function(t,e){return{x:sn(t.x,e.left,e.right),y:sn(t.y,e.top,e.bottom)}},un=function(t,e,n,o){return{left:n,top:o,right:t-n,bottom:e-o}},an=function(t,e){var n=document.createElement("img");n.addEventListener("load",(function(){return e(null,n)})),n.addEventListener("error",e),n.src=t};function cn(t,e,n,o,r){var i=t.getContext("2d"),s=90*r*Math.PI/180,l=e.width,u=e.height;switch(r){case 0:t.width=l,t.height=u,i.drawImage(e,0,0,l,u),t.style.width=n+"px",t.style.height=o+"px";break;case 1:t.width=u,t.height=l,i.rotate(s),i.drawImage(e,0,-u,l,u),t.style.width=o+"px",t.style.height=n+"px";break;case 2:t.width=l,t.height=u,i.rotate(s),i.drawImage(e,0,0,-l,-u),t.style.width=n+"px",t.style.height=o+"px";break;case 3:t.width=u,t.height=l,i.rotate(s),i.drawImage(e,-l,0,l,u),t.style.width=o+"px",t.style.height=n+"px"}}var hn={name:"CanvasPreview",props:{url:{type:String,default:""},rotate:{type:Number,default:0},width:{type:Number,default:0},height:{type:Number,default:0}},computed:{step:function(){return parseInt(this.rotate%360/90,10)}},watch:{step:function(t){this.handleRotate(t)},url:{handler:function(t){var e=this;an(t,(function(t,n){t||(e.$img=n,e.handleRotate(e.step))}))},immediate:!0}},mounted:function(){this.$canvas=this.$refs.canvas},methods:{handleRotate:function(t){cn(this.$canvas,this.$img,this.width||this.$img.width,this.height||this.$img.height,t)}}};hn.render=function(t,e,n,o,r,i){return he(),me("canvas",ze({ref:"canvas",class:"canvas-preview"},t.$attrs),null,16)};var fn={name:"CanvasZoomer",props:{url:{type:String,default:""},rotate:{type:Number,default:0},width:{type:Number,default:0},height:{type:Number,default:0}},computed:{step:function(){return parseInt(this.rotate%360/90,10)}},watch:{step:function(t){this.handleRotate(t)},url:{handler:function(t){var e=this;an(t,(function(t,n){t||(e.$img=n,e.handleRotate(e.step))}))},immediate:!0}},mounted:function(){this.$canvas=this.$refs.canvas},methods:{handleRotate:function(t){cn(this.$canvas,this.$img,this.width||this.$img.width,this.height||this.$img.height,t)}}};fn.render=function(t,e,n,o,r,i){return he(),me("canvas",ze({ref:"canvas",class:"canvas-zoomer"},t.$attrs),null,16)};var pn={name:"VuePhotoZoomPro",components:{PhotoMask:O,Selector:tn,Zoomer:Qe,ImgPreview:en,ImgZoomer:on},props:{width:{type:Number,default:168},height:{type:Number,default:-1},url:{type:String,default:""},highUrl:{type:String,default:""},type:{type:String,default:"square",validator:function(t){return-1!==["circle","square"].indexOf(t)}},scale:{type:Number,default:2},selector:{type:[Boolean,Object],default:!0},outZoomer:{type:[Boolean,Object],default:!1},disabledReactive:{type:Boolean,default:!1},disabledEvent:{type:Boolean,default:!1},mask:{type:Boolean,default:!1},maskColor:{type:String,default:""}},data:function(){return{mouseEnterFlag:!1,outZoomerTop:0,mouse:{x:0,y:0},zoomRegionRect:{left:0,top:0,width:0,height:0}}},computed:{selectorOptions:function(){return"object"===e(this.selector)?this.selector:{release:!1}},outZoomerOptions:function(){return"object"===e(this.outZoomer)?this.outZoomer:{sticky:!1}},selectorWidth:function(){return this.width},selectorHeight:function(){return this.height>-1?this.height:this.width},selectorHalfWidth:function(){return this.selectorWidth/2},selectorHalfHeight:function(){return this.selectorHeight/2},zoomerWidth:function(){return this.outZoomer?this.selectorWidth*this.scale:this.selectorWidth},zoomerHeight:function(){return this.outZoomer?this.selectorHeight*this.scale:this.selectorHeight},zoomerHalfWidth:function(){return this.zoomerWidth/2},zoomerHalfHeight:function(){return this.zoomerHeight/2},zoomRegionAbsolute:function(){var t,e,n,o=this.zoomRegionRect,r=(t=document,n=t.body,{scrollTop:(e=t.documentElement).scrollTop||window.pageYOffset||n.scrollTop,scrollLeft:e.scrollLeft||window.pageXOffset||n.scrollLeft});return{left:o.left+r.scrollLeft,top:o.top+r.scrollTop}},pointBound:function(){var t=this.zoomRegionRect;return un(t.width,t.height,this.selectorHalfWidth,this.selectorHalfHeight)},vPointBound:function(){var t=this.zoomRegionRect,e=this.scale;return un(t.width*e,t.height*e,this.zoomerHalfWidth,this.zoomerHalfHeight)},point:function(){var t=this.mouse;return this.selectorOptions.release?t:ln(t,this.pointBound)},vPoint:function(){var t=this.mouse,e=this.scale,n={x:t.x*e,y:t.y*e};return this.selectorOptions.release?n:ln(n,this.vPointBound)},selectorProps:function(){var t=this.point;return{width:this.selectorWidth,height:this.selectorHeight,left:t.x-this.selectorHalfWidth,top:t.y-this.selectorHalfHeight}},zoomerProps:function(){var t=this.vPoint;return{scale:this.scale,zoomRegion:this.zoomRegionRect,width:this.zoomerWidth,height:this.zoomerHeight,left:t.x-this.zoomerHalfWidth,top:t.y-this.zoomerHalfHeight}},outZoomerPosition:function(){return{top:"".concat(this.outZoomerTop,"px")}}},watch:{scale:function(){this.handleMouseMove(this.pointerInfo)},zoomRegionRect:{handler:function(){this.$emit("update",this.zoomRegionRect)},deep:!0}},mounted:function(){this.$zoomRegion=this.$refs.zoomRegion,this.update(),this.$emit("created")},methods:{handleMouseEnter:function(){this.mouseEnter()},handleMouseMove:function(t){if(t=this.pointerInfo=t||this.pointerInfo){var e=t.pageY,n=this.zoomRegionAbsolute;this.mouseMove(t.pageX-n.left,e-n.top),this.outZoomer&&this.outZoomerOptions.sticky&&(this.outZoomerTop=Math.max(e-t.clientY,0))}},handleMouseLeave:function(){this.mouseLeave()},mouseEnter:function(){!this.disabledReactive&&this.update(),this.mouseEnterFlag=!0},mouseMove:function(t,e){!this.disabledReactive&&this.update();var n=this.mouse;n.x=t,n.y=e},mouseLeave:function(){this.mouseEnterFlag=!1},update:function(){var t,e,n;Object.assign(this.zoomRegionRect,(e=(t=this.$zoomRegion).getBoundingClientRect(),n=-1!==navigator.userAgent.indexOf("MSIE")&&"HTML"===t.tagName?-t.scrollTop:e.top,{left:e.left,top:n,right:e.right,bottom:e.bottom,width:e.right-e.left,height:e.bottom-n}))}}};return pn.render=function(t,e,n,o,r,i){var s=Bt("PhotoMask"),l=Bt("ImgZoomer"),u=Bt("Zoomer"),a=Bt("Selector"),c=Bt("ImgPreview");return he(),me("div",{ref:"zoomRegion",class:"vue-photo-zoom-pro",onMouseenter:e[0]||(e[0]=function(t){return!n.disabledEvent&&i.handleMouseEnter(t)}),onMousemove:e[1]||(e[1]=function(t){return!n.disabledEvent&&i.handleMouseMove(t)}),onMouseleave:e[2]||(e[2]=function(t){return!n.disabledEvent&&i.handleMouseLeave(t)})},[n.mask?Lt((he(),ge(s,{key:0,width:r.zoomRegionRect.width,height:r.zoomRegionRect.height,"mask-color":n.maskColor,selector:i.selectorProps},null,8,["width","height","mask-color","selector"])),[[Oe,r.mouseEnterFlag]]):ke("",!0),n.selector?Lt((he(),ge(a,ze({key:1},i.selectorProps,{type:n.type}),{default:Tt((function(){return[n.outZoomer?ke("",!0):(he(),ge(u,ze({key:0,class:"inner-zoomer"},i.zoomerProps),{default:Tt((function(){return[n.highUrl||n.url?(he(),ge(l,{key:0,url:n.highUrl||n.url},null,8,["url"])):ke("",!0),Dt(t.$slots,"zoomer")]})),_:3},16)),Dt(t.$slots,"selector")]})),_:3},16,["type"])),[[Oe,r.mouseEnterFlag]]):ke("",!0),n.outZoomer?Lt((he(),ge(u,ze({key:2,class:"out-zoomer"},i.zoomerProps,{style:i.outZoomerPosition}),{default:Tt((function(){return[n.highUrl||n.url?(he(),ge(l,{key:0,url:n.highUrl||n.url},null,8,["url"])):ke("",!0),Dt(t.$slots,"zoomer")]})),_:3},16,["style"])),[[Oe,r.mouseEnterFlag]]):ke("",!0),n.url?(he(),ge(c,{key:3,url:n.url},null,8,["url"])):ke("",!0),Dt(t.$slots,"default")],544)},pn.__scopeId="data-v-61213061",t.CanvasPreview=hn,t.CanvasZoomer=fn,t.ImgPreview=en,t.ImgZoomer=on,t.default=pn,Object.defineProperty(t,"__esModule",{value:!0}),t}({});