import{f as B,r as l,e as u,b as O,d as D,u as E,b2 as x,ax as z,y as I,D as k,ay as $,ag as C,ae as M}from"./vendor-@vue.54cfd5db.js";import{C as T}from"./vendor-cropperjs.4212a228.js";import{c as P}from"./index.5dbe5867.js";import{u as W}from"./vendor-@vueuse.ed9fd59d.js";import{_ as j}from"./vendor-vue-esign.0fac9558.js";import"./vendor-vite-plugin-theme.cdb5aaa3.js";import"./vendor-tinycolor2.15555a92.js";import"./vendor-ant-design-vue.e9ebc554.js";import"./vendor-@babel.3008e59e.js";import"./vendor-@ant-design.73655db8.js";import"./vendor-vue.a16d50d1.js";import"./vendor-@amap.00a31695.js";import"./vendor-@ctrl.e36f0e92.js";import"./vendor-lodash-es.ed8922d2.js";import"./vendor-resize-observer-polyfill.e5ebf719.js";import"./vendor-async-validator.848b42ae.js";import"./vendor-scroll-into-view-if-needed.db58d6e4.js";import"./vendor-compute-scroll-into-view.c149e421.js";import"./vendor-dayjs.2aa0f259.js";import"./vendor-lodash.8c76eeb8.js";import"./vendor-dom-align.3b28689a.js";import"./vendor-moment.7e75546a.js";import"./vendor-vue-router.ad0ee5aa.js";import"./vendor-pinia.60e5b30e.js";import"./vendor-vue-demi.7cc19214.js";import"./vendor-crypto-js.ce2f82a9.js";import"./vendor-axios.6837fb6a.js";import"./vendor-qs.9c6d4952.js";import"./vendor-side-channel.852f6196.js";import"./vendor-es-errors.109e7893.js";import"./vendor-object-inspect.a19339a7.js";import"./vendor-side-channel-list.4eb79c5d.js";import"./vendor-side-channel-map.78013cdc.js";import"./vendor-get-intrinsic.009e6d91.js";import"./vendor-es-object-atoms.6b93c911.js";import"./vendor-math-intrinsics.9d903a04.js";import"./vendor-gopd.6af85623.js";import"./vendor-es-define-property.e29486e3.js";import"./vendor-has-symbols.e17f832c.js";import"./vendor-get-proto.d34ed19c.js";import"./vendor-dunder-proto.d7ff28e4.js";import"./vendor-call-bind-apply-helpers.6ae1c6b0.js";import"./vendor-function-bind.db802abf.js";import"./vendor-hasown.dde58836.js";import"./vendor-call-bound.baa752e5.js";import"./vendor-side-channel-weakmap.d8f21310.js";import"./vendor-@yoyoboot.494652c9.js";import"./vendor-rxjs.444d5020.js";import"./vendor-@microsoft.9e93d44a.js";import"./vendor-nprogress.9650c9fb.js";import"./vendor-@iconify.af65c3a5.js";import"./vendor-vue-types.1c81418c.js";import"./vendor-path-to-regexp.a7bc300e.js";import"./vendor-moment-timezone.58f75d45.js";import"./vendor-msal.027eacca.js";import"./vendor-mitt.f0b9d348.js";import"./vendor-xlsx.a360fe3f.js";import"./vendor-@zxcvbn-ts.ab4410b0.js";import"./vendor-mockjs.096a1dd8.js";import"./vendor-vite-plugin-mock.d52a7feb.js";const F={aspectRatio:1,zoomable:!0,zoomOnTouch:!0,zoomOnWheel:!0,cropBoxMovable:!0,cropBoxResizable:!0,toggleDragModeOnDblclick:!0,autoCrop:!0,background:!0,highlight:!0,center:!0,responsive:!0,restore:!0,checkCrossOrigin:!0,checkOrientation:!0,scalable:!0,modal:!0,guides:!0,movable:!0,rotatable:!0},N={src:{type:String,required:!0},alt:{type:String},circled:{type:Boolean,default:!1},realTimePreview:{type:Boolean,default:!0},height:{type:[String,Number],default:"360px"},crossorigin:{type:String,default:void 0},imageStyle:{type:Object,default:()=>({})},options:{type:Object,default:()=>({})}},U=B({name:"CropperImage",props:N,emits:["cropend","ready","cropendError"],setup(e,{attrs:d,emit:p}){const m=l(),o=l(),s=l(!1),{prefixCls:g}=P("cropper-image"),c=W(f,80),b=u(()=>({height:e.height,maxWidth:"100%",...e.imageStyle})),S=u(()=>[g,d.class,{[`${g}--circled`]:e.circled}]),R=u(()=>({height:`${e.height}`.replace(/px/,"")+"px"}));O(_),D(()=>{var t;(t=o.value)==null||t.destroy()});async function _(){const t=E(m);!t||(o.value=new T(t,{...F,ready:()=>{s.value=!0,f(),p("ready",o.value)},crop(){c()},zoom(){c()},cropmove(){c()},...e.options}))}function f(){e.realTimePreview&&h()}function h(){if(!o.value)return;let t=o.value.getData();(e.circled?w():o.value.getCroppedCanvas()).toBlob(r=>{if(!r)return;let i=new FileReader;i.readAsDataURL(r),i.onloadend=a=>{var v,y;p("cropend",{imgBase64:(y=(v=a.target)==null?void 0:v.result)!=null?y:"",imgInfo:t})},i.onerror=()=>{p("cropendError")}},"image/png")}function w(){const t=o.value.getCroppedCanvas(),n=document.createElement("canvas"),r=n.getContext("2d"),i=t.width,a=t.height;return n.width=i,n.height=a,r.imageSmoothingEnabled=!0,r.drawImage(t,0,0,i,a),r.globalCompositeOperation="destination-in",r.beginPath(),r.arc(i/2,a/2,Math.min(i,a)/2,0,2*Math.PI,!0),r.fill(),n}return{getClass:S,imgElRef:m,getWrapperStyle:R,getImageStyle:b,isReady:s,croppered:h}}}),q=["src","alt","crossorigin"];function A(e,d,p,m,o,s){return x(),z("div",{class:M(e.getClass),style:C(e.getWrapperStyle)},[I($("img",{ref:"imgElRef",src:e.src,alt:e.alt,crossorigin:e.crossorigin,style:C(e.getImageStyle)},null,12,q),[[k,e.isReady]])],6)}var Qe=j(U,[["render",A]]);export{Qe as default};
