index.c8071b5b.js 56 KB

123456789101112
  1. import{m as N,aS as S,d as U,t as F,k as q,bl as Me,bm as fe,an as Oe,bn as ge,K as me,bo as xe,b4 as se,v as L,x as M,A as C,B as c,y as A,J as Y,z as W,a2 as D,I as k,C as X,D as E,au as qe,H as $,_ as K,L as ve,bp as ee,bq as We,aT as j,br as x,a4 as Ee,f as te,aq as Ie,ar as we,c as b,bs as He,G as z,bt as Xe,bu as Te,F as Ye,bv as $e,bw as Be,W as Ue,a5 as Z,bx as Re,w as ie,a9 as Fe,b8 as ze,by as De,i as Ne,p as Pe,bz as Ke,at as oe,bA as re,a0 as ae,a1 as ne,b as je,aD as Ve,bi as _,b1 as Qe,bd as Ge,be as le,bB as Je,bC as Ze,a as J,bD as ye,aZ as he}from"./index.cae74add.js";const be=Symbol("uploadContextKey"),_e=N({type:{type:String,default:"line",values:["line","circle","dashboard"]},percentage:{type:Number,default:0,validator:e=>e>=0&&e<=100},status:{type:String,default:"",values:["","success","exception","warning"]},indeterminate:{type:Boolean,default:!1},duration:{type:Number,default:3},strokeWidth:{type:Number,default:6},strokeLinecap:{type:S(String),default:"round"},textInside:{type:Boolean,default:!1},width:{type:Number,default:126},showText:{type:Boolean,default:!0},color:{type:S([String,Array,Function]),default:""},format:{type:S(Function),default:e=>`${e}%`}}),et=["aria-valuenow"],tt={viewBox:"0 0 100 100"},st=["d","stroke","stroke-width"],it=["d","stroke","opacity","stroke-linecap","stroke-width"],ot={key:0},rt={name:"ElProgress"},at=U({...rt,props:_e,setup(e){const t=e,s={success:"#13ce66",exception:"#ff4949",warning:"#e6a23c",default:"#20a0ff"},i=F("progress"),r=q(()=>({width:`${t.percentage}%`,animationDuration:`${t.duration}s`,backgroundColor:O(t.percentage)})),o=q(()=>(t.strokeWidth/t.width*100).toFixed(1)),a=q(()=>["circle","dashboard"].includes(t.type)?Number.parseInt(`${50-Number.parseFloat(o.value)/2}`,10):0),p=q(()=>{const w=a.value,I=t.type==="dashboard";return`
  2. M 50 50
  3. m 0 ${I?"":"-"}${w}
  4. a ${w} ${w} 0 1 1 0 ${I?"-":""}${w*2}
  5. a ${w} ${w} 0 1 1 0 ${I?"":"-"}${w*2}
  6. `}),d=q(()=>2*Math.PI*a.value),f=q(()=>t.type==="dashboard"?.75:1),n=q(()=>`${-1*d.value*(1-f.value)/2}px`),g=q(()=>({strokeDasharray:`${d.value*f.value}px, ${d.value}px`,strokeDashoffset:n.value})),h=q(()=>({strokeDasharray:`${d.value*f.value*(t.percentage/100)}px, ${d.value}px`,strokeDashoffset:n.value,transition:"stroke-dasharray 0.6s ease 0s, stroke 0.6s ease, opacity ease 0.6s"})),l=q(()=>{let w;return t.color?w=O(t.percentage):w=s[t.status]||s.default,w}),u=q(()=>t.status==="warning"?Me:t.type==="line"?t.status==="success"?fe:Oe:t.status==="success"?ge:me),v=q(()=>t.type==="line"?12+t.strokeWidth*.4:t.width*.111111+2),y=q(()=>t.format(t.percentage));function m(w){const I=100/w.length;return w.map((T,B)=>se(T)?{color:T,percentage:(B+1)*I}:T).sort((T,B)=>T.percentage-B.percentage)}const O=w=>{var I;const{color:H}=t;if(xe(H))return H(w);if(se(H))return H;{const T=m(H);for(const B of T)if(B.percentage>w)return B.color;return(I=T[T.length-1])==null?void 0:I.color}};return(w,I)=>(L(),M("div",{class:C([c(i).b(),c(i).m(w.type),c(i).is(w.status),{[c(i).m("without-text")]:!w.showText,[c(i).m("text-inside")]:w.textInside}]),role:"progressbar","aria-valuenow":w.percentage,"aria-valuemin":"0","aria-valuemax":"100"},[w.type==="line"?(L(),M("div",{key:0,class:C(c(i).b("bar"))},[A("div",{class:C(c(i).be("bar","outer")),style:Y({height:`${w.strokeWidth}px`})},[A("div",{class:C([c(i).be("bar","inner"),{[c(i).bem("bar","inner","indeterminate")]:w.indeterminate}]),style:Y(c(r))},[(w.showText||w.$slots.default)&&w.textInside?(L(),M("div",{key:0,class:C(c(i).be("bar","innerText"))},[W(w.$slots,"default",{percentage:w.percentage},()=>[A("span",null,D(c(y)),1)])],2)):k("v-if",!0)],6)],6)],2)):(L(),M("div",{key:1,class:C(c(i).b("circle")),style:Y({height:`${w.width}px`,width:`${w.width}px`})},[(L(),M("svg",tt,[A("path",{class:C(c(i).be("circle","track")),d:c(p),stroke:`var(${c(i).cssVarName("fill-color-light")}, #e5e9f2)`,"stroke-width":c(o),fill:"none",style:Y(c(g))},null,14,st),A("path",{class:C(c(i).be("circle","path")),d:c(p),stroke:c(l),fill:"none",opacity:w.percentage?1:0,"stroke-linecap":w.strokeLinecap,"stroke-width":c(o),style:Y(c(h))},null,14,it)]))],6)),(w.showText||w.$slots.default)&&!w.textInside?(L(),M("div",{key:2,class:C(c(i).e("text")),style:Y({fontSize:`${c(v)}px`})},[W(w.$slots,"default",{percentage:w.percentage},()=>[w.status?(L(),X(c($),{key:1},{default:E(()=>[(L(),X(qe(c(u))))]),_:1})):(L(),M("span",ot,D(c(y)),1))])],6)):k("v-if",!0)],10,et))}});var nt=K(at,[["__file","/home/runner/work/element-plus/element-plus/packages/components/progress/src/progress.vue"]]);const lt=ve(nt),ht="ElUpload";class ct extends Error{constructor(t,s,i,r){super(t),this.name="UploadAjaxError",this.status=s,this.method=i,this.url=r}}function ce(e,t,s){let i;return s.response?i=`${s.response.error||s.response}`:s.responseText?i=`${s.responseText}`:i=`fail to ${t.method} ${e} ${s.status}`,new ct(i,s.status,t.method,e)}function pt(e){const t=e.responseText||e.response;if(!t)return t;try{return JSON.parse(t)}catch{return t}}const ut=e=>{typeof XMLHttpRequest>"u"&&ee(ht,"XMLHttpRequest is undefined");const t=new XMLHttpRequest,s=e.action;t.upload&&t.upload.addEventListener("progress",o=>{const a=o;a.percent=o.total>0?o.loaded/o.total*100:0,e.onProgress(a)});const i=new FormData;if(e.data)for(const[o,a]of Object.entries(e.data))Array.isArray(a)?i.append(o,...a):i.append(o,a);i.append(e.filename,e.file,e.file.name),t.addEventListener("error",()=>{e.onError(ce(s,e,t))}),t.addEventListener("load",()=>{if(t.status<200||t.status>=300)return e.onError(ce(s,e,t));e.onSuccess(pt(t))}),t.open(e.method,s,!0),e.withCredentials&&"withCredentials"in t&&(t.withCredentials=!0);const r=e.headers||{};if(r instanceof Headers)r.forEach((o,a)=>t.setRequestHeader(a,o));else for(const[o,a]of Object.entries(r))We(a)||t.setRequestHeader(o,String(a));return t.send(i),t},Le=["text","picture","picture-card"];let dt=1;const Ce=()=>Date.now()+dt++,Ae=N({action:{type:String,default:"#"},headers:{type:S(Object)},method:{type:String,default:"post"},data:{type:Object,default:()=>j({})},multiple:{type:Boolean,default:!1},name:{type:String,default:"file"},drag:{type:Boolean,default:!1},withCredentials:Boolean,showFileList:{type:Boolean,default:!0},accept:{type:String,default:""},type:{type:String,default:"select"},fileList:{type:S(Array),default:()=>j([])},autoUpload:{type:Boolean,default:!0},listType:{type:String,values:Le,default:"text"},httpRequest:{type:S(Function),default:ut},disabled:Boolean,limit:Number}),ft=N({...Ae,beforeUpload:{type:S(Function),default:x},beforeRemove:{type:S(Function)},onRemove:{type:S(Function),default:x},onChange:{type:S(Function),default:x},onPreview:{type:S(Function),default:x},onSuccess:{type:S(Function),default:x},onProgress:{type:S(Function),default:x},onError:{type:S(Function),default:x},onExceed:{type:S(Function),default:x}}),gt=N({files:{type:S(Array),default:()=>j([])},disabled:{type:Boolean,default:!1},handlePreview:{type:S(Function),default:x},listType:{type:String,values:Le,default:"text"}}),mt={remove:e=>!!e},vt=["onKeydown"],wt=["src"],yt=["onClick"],bt=["onClick"],Lt=["onClick"],Ct={name:"ElUploadList"},At=U({...Ct,props:gt,emits:mt,setup(e,{emit:t}){const s=e,{t:i}=Ee(),r=F("upload"),o=F("icon"),a=F("list"),p=te(!1),d=n=>{s.handlePreview(n)},f=n=>{t("remove",n)};return(n,g)=>(L(),X($e,{tag:"ul",class:C([c(r).b("list"),c(r).bm("list",n.listType),c(r).is("disabled",n.disabled)]),name:c(a).b()},{default:E(()=>[(L(!0),M(Ye,null,Ie(n.files,h=>(L(),M("li",{key:h.uid||h.name,class:C([c(r).be("list","item"),c(r).is(h.status),{focusing:p.value}]),tabindex:"0",onKeydown:we(l=>!n.disabled&&f(h),["delete"]),onFocus:g[0]||(g[0]=l=>p.value=!0),onBlur:g[1]||(g[1]=l=>p.value=!1),onClick:g[2]||(g[2]=l=>p.value=!1)},[W(n.$slots,"default",{file:h},()=>[n.listType==="picture"||h.status!=="uploading"&&n.listType==="picture-card"?(L(),M("img",{key:0,class:C(c(r).be("list","item-thumbnail")),src:h.url,alt:""},null,10,wt)):k("v-if",!0),n.listType!=="picture"&&(h.status==="uploading"||n.listType!=="picture-card")?(L(),M("div",{key:1,class:C(c(r).be("list","item-info"))},[A("a",{class:C(c(r).be("list","item-name")),onClick:z(l=>d(h),["prevent"])},[b(c($),{class:C(c(o).m("document"))},{default:E(()=>[b(c(He))]),_:1},8,["class"]),A("span",{class:C(c(r).be("list","item-file-name"))},D(h.name),3)],10,yt),h.status==="uploading"?(L(),X(c(lt),{key:0,type:n.listType==="picture-card"?"circle":"line","stroke-width":n.listType==="picture-card"?6:2,percentage:Number(h.percentage),style:Y(n.listType==="picture-card"?"":"margin-top: 0.5rem")},null,8,["type","stroke-width","percentage","style"])):k("v-if",!0)],2)):k("v-if",!0),A("label",{class:C(c(r).be("list","item-status-label"))},[n.listType==="text"?(L(),X(c($),{key:0,class:C([c(o).m("upload-success"),c(o).m("circle-check")])},{default:E(()=>[b(c(fe))]),_:1},8,["class"])):["picture-card","picture"].includes(n.listType)?(L(),X(c($),{key:1,class:C([c(o).m("upload-success"),c(o).m("check")])},{default:E(()=>[b(c(ge))]),_:1},8,["class"])):k("v-if",!0)],2),n.disabled?k("v-if",!0):(L(),X(c($),{key:2,class:C(c(o).m("close")),onClick:l=>f(h)},{default:E(()=>[b(c(me))]),_:2},1032,["class","onClick"])),k(" Due to close btn only appears when li gets focused disappears after li gets blurred, thus keyboard navigation can never reach close btn"),k(" This is a bug which needs to be fixed "),k(" TODO: Fix the incorrect navigation interaction "),n.disabled?k("v-if",!0):(L(),M("i",{key:3,class:C(c(o).m("close-tip"))},D(c(i)("el.upload.deleteTip")),3)),n.listType==="picture-card"?(L(),M("span",{key:4,class:C(c(r).be("list","item-actions"))},[A("span",{class:C(c(r).be("list","item-preview")),onClick:l=>n.handlePreview(h)},[b(c($),{class:C(c(o).m("zoom-in"))},{default:E(()=>[b(c(Xe))]),_:1},8,["class"])],10,bt),n.disabled?k("v-if",!0):(L(),M("span",{key:0,class:C(c(r).be("list","item-delete")),onClick:l=>f(h)},[b(c($),{class:C(c(o).m("delete"))},{default:E(()=>[b(c(Te))]),_:1},8,["class"])],10,Lt))],2)):k("v-if",!0)])],42,vt))),128)),W(n.$slots,"append")]),_:3},8,["class","name"]))}});var pe=K(At,[["__file","/home/runner/work/element-plus/element-plus/packages/components/upload/src/upload-list.vue"]]);const kt=N({disabled:{type:Boolean,default:!1}}),St={file:e=>Be(e)},Mt=["onDrop","onDragover"],Ot={name:"ElUploadDrag"},xt=U({...Ot,props:kt,emits:St,setup(e,{emit:t}){const s=e,i="ElUploadDrag",r=Ue(be);r||ee(i,"usage: <el-upload><el-upload-dragger /></el-upload>");const o=F("upload"),a=te(!1),p=f=>{if(s.disabled)return;a.value=!1;const n=Array.from(f.dataTransfer.files),g=r.accept.value;if(!g){t("file",n);return}const h=n.filter(l=>{const{type:u,name:v}=l,y=v.includes(".")?`.${v.split(".").pop()}`:"",m=u.replace(/\/.*$/,"");return g.split(",").map(O=>O.trim()).filter(O=>O).some(O=>O.startsWith(".")?y===O:/\/\*$/.test(O)?m===O.replace(/\/\*$/,""):/^[^/]+\/[^/]+$/.test(O)?u===O:!1)});t("file",h)},d=()=>{s.disabled||(a.value=!0)};return(f,n)=>(L(),M("div",{class:C([c(o).b("dragger"),c(o).is("dragover",a.value)]),onDrop:z(p,["prevent"]),onDragover:z(d,["prevent"]),onDragleave:n[0]||(n[0]=z(g=>a.value=!1,["prevent"]))},[W(f.$slots,"default")],42,Mt))}});var qt=K(xt,[["__file","/home/runner/work/element-plus/element-plus/packages/components/upload/src/upload-dragger.vue"]]);const Wt=N({...Ae,fileList:{type:S(Array),default:()=>j([])},beforeUpload:{type:S(Function),default:x},onRemove:{type:S(Function),default:x},onStart:{type:S(Function),default:x},onSuccess:{type:S(Function),default:x},onProgress:{type:S(Function),default:x},onError:{type:S(Function),default:x},onExceed:{type:S(Function),default:x}}),Et=["onKeydown"],It=["name","multiple","accept"],Ht={name:"ElUploadContent",inheritAttrs:!1},Xt=U({...Ht,props:Wt,setup(e,{expose:t}){const s=e,i=F("upload"),r=Z({}),o=Z(),a=l=>{if(l.length===0)return;const{autoUpload:u,limit:v,fileList:y,multiple:m,onStart:O,onExceed:w}=s;if(v&&y.length+l.length>v){w(l,y);return}m||(l=l.slice(0,1));for(const I of l){const H=I;H.uid=Ce(),O(H),u&&p(H)}},p=async l=>{if(o.value.value="",!s.beforeUpload)return d(l);let u;try{u=await s.beforeUpload(l)}catch{u=!1}if(u===!1){s.onRemove(l);return}let v=l;u instanceof Blob&&(u instanceof File?v=u:v=new File([u],l.name,{type:l.type})),d(Object.assign(v,{uid:l.uid}))},d=l=>{const{headers:u,data:v,method:y,withCredentials:m,name:O,action:w,onProgress:I,onSuccess:H,onError:T,httpRequest:B}=s,{uid:V}=l,Q={headers:u||{},withCredentials:m,file:l,data:v,method:y,filename:O,action:w,onProgress:P=>{I(P,l)},onSuccess:P=>{H(P,l),delete r.value[V]},onError:P=>{T(P,l),delete r.value[V]}},G=B(Q);r.value[V]=G,G instanceof Promise&&G.then(Q.onSuccess,Q.onError)},f=l=>{const u=l.target.files;!u||a(Array.from(u))},n=()=>{s.disabled||(o.value.value="",o.value.click())},g=()=>{n()};return t({abort:l=>{Re(r.value).filter(l?([v])=>String(l.uid)===v:()=>!0).forEach(([v,y])=>{y instanceof XMLHttpRequest&&y.abort(),delete r.value[v]})},upload:p}),(l,u)=>(L(),M("div",{class:C([c(i).b(),c(i).m(l.listType),c(i).is("drag",l.drag)]),tabindex:"0",onClick:n,onKeydown:we(z(g,["self"]),["enter","space"])},[l.drag?(L(),X(qt,{key:0,disabled:l.disabled,onFile:a},{default:E(()=>[W(l.$slots,"default")]),_:3},8,["disabled"])):W(l.$slots,"default",{key:1}),A("input",{ref_key:"inputRef",ref:o,class:C(c(i).e("input")),name:l.name,multiple:l.multiple,accept:l.accept,type:"file",onChange:f,onClick:u[0]||(u[0]=z(()=>{},["stop"]))},null,42,It)],42,Et))}});var ue=K(Xt,[["__file","/home/runner/work/element-plus/element-plus/packages/components/upload/src/upload-content.vue"]]);const de="ElUpload",Tt=e=>{var t;(t=e.url)!=null&&t.startsWith("blob:")&&URL.revokeObjectURL(e.url)},Yt=(e,t)=>{const s=te([]),i=h=>s.value.find(l=>l.uid===h.uid);function r(h){var l;(l=t.value)==null||l.abort(h)}function o(h=["ready","uploading","success","fail"]){s.value=s.value.filter(l=>!h.includes(l.status))}const a=(h,l)=>{const u=i(l);!u||(u.status="fail",s.value.splice(s.value.indexOf(u),1),e.onError(h,u,s.value),e.onChange(u,s.value))},p=(h,l)=>{const u=i(l);!u||(e.onProgress(h,u,s.value),u.status="uploading",u.percentage=Math.round(h.percent))},d=(h,l)=>{const u=i(l);!u||(u.status="success",u.response=h,e.onSuccess(h,u,s.value),e.onChange(u,s.value))},f=h=>{const l={name:h.name,percentage:0,status:"ready",size:h.size,raw:h,uid:h.uid};if(e.listType==="picture-card"||e.listType==="picture")try{l.url=URL.createObjectURL(h)}catch(u){Fe(de,u.message),e.onError(u,l,s.value)}s.value.push(l),e.onChange(l,s.value)},n=async h=>{const l=h instanceof File?i(h):h;l||ee(de,"file to be removed not found");const u=v=>{r(v);const y=s.value;y.splice(y.indexOf(v),1),e.onRemove(v,y),Tt(v)};e.beforeRemove?await e.beforeRemove(l,s.value)!==!1&&u(l):u(l)};function g(){s.value.filter(({status:h})=>h==="ready").forEach(({raw:h})=>{var l;return h&&((l=t.value)==null?void 0:l.upload(h))})}return ie(()=>e.listType,h=>{h!=="picture-card"&&h!=="picture"||(s.value=s.value.map(l=>{const{raw:u,url:v}=l;if(!v&&u)try{l.url=URL.createObjectURL(u)}catch(y){e.onError(y,l,s.value)}return l}))}),ie(()=>e.fileList,h=>{for(const l of h)l.uid||(l.uid=Ce()),l.status||(l.status="success");s.value=h},{immediate:!0,deep:!0}),{abort:r,clearFiles:o,handleError:a,handleProgress:p,handleStart:f,handleSuccess:d,handleRemove:n,submit:g,uploadFiles:s}},$t={name:"ElUpload"},Bt=U({...$t,props:ft,setup(e,{expose:t}){const s=e,i=ze(),r=De(),o=Z(),{abort:a,submit:p,clearFiles:d,uploadFiles:f,handleStart:n,handleError:g,handleRemove:h,handleSuccess:l,handleProgress:u}=Yt(s,o),v=q(()=>s.listType==="picture-card"),y=q(()=>({...s,onStart:n,onProgress:u,onSuccess:l,onError:g,onRemove:h}));return Ne(()=>{f.value.forEach(({url:m})=>{m!=null&&m.startsWith("blob:")&&URL.revokeObjectURL(m)})}),Pe(be,{accept:Ke(s,"accept")}),t({abort:a,submit:p,clearFiles:d,handleStart:n,handleRemove:h}),(m,O)=>(L(),M("div",null,[c(v)&&m.showFileList?(L(),X(pe,{key:0,disabled:c(r),"list-type":m.listType,files:c(f),"handle-preview":m.onPreview,onRemove:c(h)},oe({append:E(()=>[m.listType==="picture-card"?(L(),X(ue,re({key:0,ref_key:"uploadRef",ref:o},c(y)),{default:E(()=>[c(i).trigger?W(m.$slots,"trigger",{key:0}):k("v-if",!0),!c(i).trigger&&c(i).default?W(m.$slots,"default",{key:1}):k("v-if",!0)]),_:3},16)):k("v-if",!0)]),_:2},[m.$slots.file?{name:"default",fn:E(({file:w})=>[W(m.$slots,"file",{file:w})])}:void 0]),1032,["disabled","list-type","files","handle-preview","onRemove"])):k("v-if",!0),m.listType!=="picture-card"?(L(),X(ue,re({key:1,ref_key:"uploadRef",ref:o},c(y)),{default:E(()=>[c(i).trigger?W(m.$slots,"trigger",{key:0}):k("v-if",!0),!c(i).trigger&&c(i).default?W(m.$slots,"default",{key:1}):k("v-if",!0)]),_:3},16)):k("v-if",!0),m.$slots.trigger?W(m.$slots,"default",{key:2}):k("v-if",!0),W(m.$slots,"tip"),!c(v)&&m.showFileList?(L(),X(pe,{key:3,disabled:c(r),"list-type":m.listType,files:c(f),"handle-preview":m.onPreview,onRemove:c(h)},oe({_:2},[m.$slots.file?{name:"default",fn:E(({file:w})=>[W(m.$slots,"file",{file:w})])}:void 0]),1032,["disabled","list-type","files","handle-preview","onRemove"])):k("v-if",!0)]))}});var Ut=K(Bt,[["__file","/home/runner/work/element-plus/element-plus/packages/components/upload/src/upload.vue"]]);const Rt=ve(Ut),Ft="_uploadSection_cslsh_1",zt="_uploadClass_cslsh_11",Dt="_previewImg_cslsh_34",Nt="_operation_cslsh_44",R={uploadSection:Ft,uploadClass:zt,"avatar-upload-preview_range":"_avatar-upload-preview_range_cslsh_19","avatar-upload-preview":"_avatar-upload-preview_cslsh_19",previewImg:Dt,operation:Nt,"icon-rate":"_icon-rate_cslsh_54","vue-cropper":"_vue-cropper_cslsh_61","el-dialog":"_el-dialog_cslsh_65","el-dialog__header":"_el-dialog__header_cslsh_68","el-dialog__title":"_el-dialog__title_cslsh_72","el-dialog__headerbtn":"_el-dialog__headerbtn_cslsh_75","el-dialog__close":"_el-dialog__close_cslsh_75","el-dialog__body":"_el-dialog__body_cslsh_78"},Pt="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAAA4CAMAAAB6xg5AAAAAAXNSR0IArs4c6QAAAsRQTFRFAAAAAP8AAP//AICAAP+AAP//AKqqVaqqVf+qAL+/QL+/M8yZKqqqKtWqJNu2IN+/HMaqM8yZM8yzLtGiLtG5Kr+qJMikML+fMM+vM8ymLMixKcKjKcKtKcytJ8SnJ86xMcSnL8aqLsitLMqwKsOqKcWtMMenMMevLsmqLcOtLcutLMWoK8aqKcilKcisMMisL8moLsSqLcysLMeuK8iqL8qsLcaqLMisK8moK8muMMqqL8usLMmsL8yqLsmrLcqpLcqtLcaqK8ipLcepK8apK8msLcerLMmqLMaoLMmrLsepLcWoLcapLMaqLsipLsisLsWqLMepLMeqLsirLcerLsarLsmrLceqLcqqLMisLsmqLserLcesLciqLcmrLcipLcisLcaqLMepLMesLMaqLsiqLsirLMirLMipLcerLcmrLciqLMepLseqLsmqLcipLcirLMepLcapLcepLMeqLMiqLsiqLsipLceqLcerLcipLsiqLsepLcepLceqLcirLMirLMeqLcerLcirLcepLcisLserLsiqLcerLceqLcirLMepLcerLciqLMeqLceqLciqLcirLceqLMepLseqLserLcaqLciqLceqLceqLceqLMiqLsiqLcirLceqLcepLceqLcaqLciqLsaqLMepLsiqLceqLcerLceqLciqLseqLcerLceqLceqLciqLceqLceqLciqLceqLcaqLcirLMeqLceqLceqLcerLciqLcepLceqLciqLMeqLMeqLceqLceqLcirLceqLciqLceqLMeqLMerLMaqLceqLcirLceqLceqLceqLceqLceqLMiqLMeqLceqLcepLceqLceqLMeqLMeqLcaqLceqLceqLceqLceqLMepLMeqLceqLcaqLceqLciqLcepLceqLcerLceqLMeqLMiqLciqLceqLcirLceqkeY/1AAAAOt0Uk5TAAEBAgICAwMDBAQFBgYHCAkKCgsLDA4QEBQXGRkZGhoaGxwdHh8gICEiIiMkJSUlJicoKSorLS4vLzAxNDw9Pj4/QURHR0lLTExNT1BRU1NUVldYW15eYGBiY2RlZmdra2xubm9vcHN0dnZ4ent7fX2AgoOEioqMjY6PkJGSk5SVlpqdnp+goqSlpqepqqyur7CxsrOztLS1tre4uLm6u7y9vb2+vr+/wMLExcrMzM3O0NLU1NXV1tfY2dnZ2tvb3N3e3t/g4OHj4+Tl5+jq6+zt7u7w8fLz8/T19vf39/j5+fr6+/z9/f3+/ne0wvQAAAMbSURBVEjHnZb5W0xRGMdfyVjSqMiSfUsGCZUoS4WyZkkiS6Hs+55s2RIp+74rW5aIsmUP2WWUBoWS6fwT7n3vzG3uzD1z79z3p3M+53w/zzxz3nOeC2BrheUVHfME5RVYSQh55krf0Hz2xkTL2jS3nWF9J2FrODU/vYSI14853IZ0nEXT8lFVhFozcEeGVYHTJ3qeFDeWFowk1ipcWrCVltUu9XWpZScpUH2g5O958HusCgZQ8jqmcTRRMVgPkaTgOHp0Iz5bz5WptRRBAkBEqejK066YDk5+W2nt3wsCN1p7nGDiTfcTidJAKG2pFKDJHak88Qc/2lIeQJpknsQB7BBfqQyDgdJ58kQNqtiDGelsFSJ5wA4z0ncFAmyWISDbVfQ+eEyPVRSXG4fnfKmCn+Lh16uHtGZWWw5akY/zqpzDqWlp86oF9vUNAtF4waTq32w/Pp/nqdWCOi5WBBucBB2uXlVlKahNF/yeanFJjI3MC2KsCSaKXLNxelw6AnAUBxPAmSqIN75OwxasWTjCuG05d60BZmIDdwFvmuCRA+IGi7XcO7asIfdU3MJpb1AxPVkSAbCEJhiLtEUmD7LaIxnK9QNzOn6hbgAeWorgdg0WutwwQdn4mMJVrifVOPG8TyiC+QhXCk8VWazhXsT5a4ISdIQmCGBZs+/Cc23Lwl5mO8UF5Y4sizTbO42Fdjo5glfI1psJtiC9K0eQiyzFTHAI6XU5gufIEs0ESUiz5Qh0NVk2y0ywCHd+liMg3VjWXS+EfVjYRtYpkCkIUwXsOLJweYLTCDt9NEFfeiDbJ0+gx06CfoU8+RqMxKdCnoCc5bDXBcP8sg8HDhCZAu4zgqn+8Weyzq8Lon56UAW6AJEXybdIvoC86WuR935JbBCQb6PM8iFaYpOA6Hd7mcQ7J/8jNgoI+ZMUwn29OA/eVia+xbqAdeSe2nMy5xd1XVIgVUZBmcK83sEgeKFQ8N74HycrFOzlz1ihYAx/zBcV5TPteEGrAgX5d+4mndbhms35mxrhR3rkpQob0n+vTK5rcd0cO/aUW+5qQfI/vbBmnVf4WssAAAAASUVORK5CYII=",ke={};ke.getData=e=>new Promise((t,s)=>{let i={};Kt(e).then(r=>{i.arrayBuffer=r,i.orientation=Gt(r),t(i)}).catch(r=>{s(r)})});function Kt(e){let t=null;return new Promise((s,i)=>{if(e.src)if(/^data\:/i.test(e.src))t=Vt(e.src),s(t);else if(/^blob\:/i.test(e.src)){var r=new FileReader;r.onload=function(a){t=a.target.result,s(t)},jt(e.src,function(a){r.readAsArrayBuffer(a)})}else{var o=new XMLHttpRequest;o.onload=function(){if(this.status==200||this.status===0)t=o.response,s(t);else throw"Could not load image";o=null},o.open("GET",e.src,!0),o.responseType="arraybuffer",o.send(null)}else i("img error")})}function jt(e,t){var s=new XMLHttpRequest;s.open("GET",e,!0),s.responseType="blob",s.onload=function(i){(this.status==200||this.status===0)&&t(this.response)},s.send()}function Vt(e){e=e.replace(/^data\:([^\;]+)\;base64,/gmi,"");for(var t=atob(e),s=t.length,i=new ArrayBuffer(s),r=new Uint8Array(i),o=0;o<s;o++)r[o]=t.charCodeAt(o);return i}function Qt(e,t,s){var i="",r;for(r=t,s+=t;r<s;r++)i+=String.fromCharCode(e.getUint8(r));return i}function Gt(e){var t=new DataView(e),s=t.byteLength,i,r,o,a,p,d,f,n,g,h;if(t.getUint8(0)===255&&t.getUint8(1)===216)for(g=2;g<s;){if(t.getUint8(g)===255&&t.getUint8(g+1)===225){f=g;break}g++}if(f&&(r=f+4,o=f+10,Qt(t,r,4)==="Exif"&&(d=t.getUint16(o),p=d===18761,(p||d===19789)&&t.getUint16(o+2,p)===42&&(a=t.getUint32(o+4,p),a>=8&&(n=o+a)))),n){for(s=t.getUint16(n,p),h=0;h<s;h++)if(g=n+h*12+2,t.getUint16(g,p)===274){g+=8,i=t.getUint16(g,p);break}}return i}var Jt=(e,t)=>{const s=e.__vccOpts||e;for(const[i,r]of t)s[i]=r;return s};const Zt=U({data:function(){return{w:0,h:0,scale:1,x:0,y:0,loading:!0,trueWidth:0,trueHeight:0,move:!0,moveX:0,moveY:0,crop:!1,cropping:!1,cropW:0,cropH:0,cropOldW:0,cropOldH:0,canChangeX:!1,canChangeY:!1,changeCropTypeX:1,changeCropTypeY:1,cropX:0,cropY:0,cropChangeX:0,cropChangeY:0,cropOffsertX:0,cropOffsertY:0,support:"",touches:[],touchNow:!1,rotate:0,isIos:!1,orientation:0,imgs:"",coe:.2,scaling:!1,scalingSet:"",coeStatus:"",isCanShow:!0}},props:{img:{type:[String,Blob,null,File],default:""},outputSize:{type:Number,default:1},outputType:{type:String,default:"jpeg"},info:{type:Boolean,default:!0},canScale:{type:Boolean,default:!0},autoCrop:{type:Boolean,default:!1},autoCropWidth:{type:[Number,String],default:0},autoCropHeight:{type:[Number,String],default:0},fixed:{type:Boolean,default:!1},fixedNumber:{type:Array,default:()=>[1,1]},fixedBox:{type:Boolean,default:!1},full:{type:Boolean,default:!1},canMove:{type:Boolean,default:!0},canMoveBox:{type:Boolean,default:!0},original:{type:Boolean,default:!1},centerBox:{type:Boolean,default:!1},high:{type:Boolean,default:!0},infoTrue:{type:Boolean,default:!1},maxImgSize:{type:[Number,String],default:2e3},enlarge:{type:[Number,String],default:1},preW:{type:[Number,String],default:0},mode:{type:String,default:"contain"},limitMinSize:{type:[Number,Array,String],default:()=>10}},computed:{cropInfo(){let e={};if(e.top=this.cropOffsertY>21?"-21px":"0px",e.width=this.cropW>0?this.cropW:0,e.height=this.cropH>0?this.cropH:0,this.infoTrue){let t=1;this.high&&!this.full&&(t=window.devicePixelRatio),this.enlarge!==1&!this.full&&(t=Math.abs(Number(this.enlarge))),e.width=e.width*t,e.height=e.height*t,this.full&&(e.width=e.width/this.scale,e.height=e.height/this.scale)}return e.width=e.width.toFixed(0),e.height=e.height.toFixed(0),e},isIE(){return!!window.ActiveXObject||"ActiveXObject"in window},passive(){return this.isIE?null:{passive:!1}}},watch:{img(){this.checkedImg()},imgs(e){e!==""&&this.reload()},cropW(){this.showPreview()},cropH(){this.showPreview()},cropOffsertX(){this.showPreview()},cropOffsertY(){this.showPreview()},scale(e,t){this.showPreview()},x(){this.showPreview()},y(){this.showPreview()},autoCrop(e){e&&this.goAutoCrop()},autoCropWidth(){this.autoCrop&&this.goAutoCrop()},autoCropHeight(){this.autoCrop&&this.goAutoCrop()},mode(){this.checkedImg()},rotate(){this.showPreview(),this.autoCrop?this.goAutoCrop(this.cropW,this.cropH):(this.cropW>0||this.cropH>0)&&this.goAutoCrop(this.cropW,this.cropH)}},methods:{getVersion(e){var t=navigator.userAgent.split(" "),s="";let i=0;const r=new RegExp(e,"i");for(var o=0;o<t.length;o++)r.test(t[o])&&(s=t[o]);return s?i=s.split("/")[1].split("."):i=["0","0","0"],i},checkOrientationImage(e,t,s,i){if(this.getVersion("chrome")[0]>=81)t=-1;else if(this.getVersion("safari")[0]>=605){const a=this.getVersion("version");a[0]>13&&a[1]>1&&(t=-1)}else{const a=navigator.userAgent.toLowerCase().match(/cpu iphone os (.*?) like mac os/);if(a){let p=a[1];p=p.split("_"),(p[0]>13||p[0]>=13&&p[1]>=4)&&(t=-1)}}let r=document.createElement("canvas"),o=r.getContext("2d");switch(o.save(),t){case 2:r.width=s,r.height=i,o.translate(s,0),o.scale(-1,1);break;case 3:r.width=s,r.height=i,o.translate(s/2,i/2),o.rotate(180*Math.PI/180),o.translate(-s/2,-i/2);break;case 4:r.width=s,r.height=i,o.translate(0,i),o.scale(1,-1);break;case 5:r.height=s,r.width=i,o.rotate(.5*Math.PI),o.scale(1,-1);break;case 6:r.width=i,r.height=s,o.translate(i/2,s/2),o.rotate(90*Math.PI/180),o.translate(-s/2,-i/2);break;case 7:r.height=s,r.width=i,o.rotate(.5*Math.PI),o.translate(s,-i),o.scale(-1,1);break;case 8:r.height=s,r.width=i,o.translate(i/2,s/2),o.rotate(-90*Math.PI/180),o.translate(-s/2,-i/2);break;default:r.width=s,r.height=i}o.drawImage(e,0,0,s,i),o.restore(),r.toBlob(a=>{let p=URL.createObjectURL(a);URL.revokeObjectURL(this.imgs),this.imgs=p},"image/"+this.outputType,1)},checkedImg(){if(this.img===null||this.img===""){this.imgs="",this.clearCrop();return}this.loading=!0,this.scale=1,this.rotate=0,this.clearCrop();let e=new Image;if(e.onload=()=>{if(this.img==="")return this.$emit("img-load","error"),!1;let s=e.width,i=e.height;ke.getData(e).then(r=>{this.orientation=r.orientation||1;let o=Number(this.maxImgSize);if(!this.orientation&&s<o&i<o){this.imgs=this.img;return}s>o&&(i=i/s*o,s=o),i>o&&(s=s/i*o,i=o),this.checkOrientationImage(e,this.orientation,s,i)})},e.onerror=()=>{this.$emit("img-load","error")},this.img.substr(0,4)!=="data"&&(e.crossOrigin=""),this.isIE){var t=new XMLHttpRequest;t.onload=function(){var s=URL.createObjectURL(this.response);e.src=s},t.open("GET",this.img,!0),t.responseType="blob",t.send()}else e.src=this.img},startMove(e){if(e.preventDefault(),this.move&&!this.crop){if(!this.canMove)return!1;this.moveX=("clientX"in e?e.clientX:e.touches[0].clientX)-this.x,this.moveY=("clientY"in e?e.clientY:e.touches[0].clientY)-this.y,e.touches?(window.addEventListener("touchmove",this.moveImg),window.addEventListener("touchend",this.leaveImg),e.touches.length==2&&(this.touches=e.touches,window.addEventListener("touchmove",this.touchScale),window.addEventListener("touchend",this.cancelTouchScale))):(window.addEventListener("mousemove",this.moveImg),window.addEventListener("mouseup",this.leaveImg)),this.$emit("imgMoving",{moving:!0,axis:this.getImgAxis()}),this.$emit("img-moving",{moving:!0,axis:this.getImgAxis()})}else this.cropping=!0,window.addEventListener("mousemove",this.createCrop),window.addEventListener("mouseup",this.endCrop),window.addEventListener("touchmove",this.createCrop),window.addEventListener("touchend",this.endCrop),this.cropOffsertX=e.offsetX?e.offsetX:e.touches[0].pageX-this.$refs.cropper.offsetLeft,this.cropOffsertY=e.offsetY?e.offsetY:e.touches[0].pageY-this.$refs.cropper.offsetTop,this.cropX="clientX"in e?e.clientX:e.touches[0].clientX,this.cropY="clientY"in e?e.clientY:e.touches[0].clientY,this.cropChangeX=this.cropOffsertX,this.cropChangeY=this.cropOffsertY,this.cropW=0,this.cropH=0},touchScale(e){e.preventDefault();let t=this.scale;var s={x:this.touches[0].clientX,y:this.touches[0].clientY},i={x:e.touches[0].clientX,y:e.touches[0].clientY},r={x:this.touches[1].clientX,y:this.touches[1].clientY},o={x:e.touches[1].clientX,y:e.touches[1].clientY},a=Math.sqrt(Math.pow(s.x-r.x,2)+Math.pow(s.y-r.y,2)),p=Math.sqrt(Math.pow(i.x-o.x,2)+Math.pow(i.y-o.y,2)),d=p-a,f=1;f=f/this.trueWidth>f/this.trueHeight?f/this.trueHeight:f/this.trueWidth,f=f>.1?.1:f;var n=f*d;if(!this.touchNow){if(this.touchNow=!0,d>0?t+=Math.abs(n):d<0&&t>Math.abs(n)&&(t-=Math.abs(n)),this.touches=e.touches,setTimeout(()=>{this.touchNow=!1},8),!this.checkoutImgAxis(this.x,this.y,t))return!1;this.scale=t}},cancelTouchScale(e){window.removeEventListener("touchmove",this.touchScale)},moveImg(e){if(e.preventDefault(),e.touches&&e.touches.length===2)return this.touches=e.touches,window.addEventListener("touchmove",this.touchScale),window.addEventListener("touchend",this.cancelTouchScale),window.removeEventListener("touchmove",this.moveImg),!1;let t="clientX"in e?e.clientX:e.touches[0].clientX,s="clientY"in e?e.clientY:e.touches[0].clientY,i,r;i=t-this.moveX,r=s-this.moveY,this.$nextTick(()=>{if(this.centerBox){let o=this.getImgAxis(i,r,this.scale),a=this.getCropAxis(),p=this.trueHeight*this.scale,d=this.trueWidth*this.scale,f,n,g,h;switch(this.rotate){case 1:case-1:case 3:case-3:f=this.cropOffsertX-this.trueWidth*(1-this.scale)/2+(p-d)/2,n=this.cropOffsertY-this.trueHeight*(1-this.scale)/2+(d-p)/2,g=f-p+this.cropW,h=n-d+this.cropH;break;default:f=this.cropOffsertX-this.trueWidth*(1-this.scale)/2,n=this.cropOffsertY-this.trueHeight*(1-this.scale)/2,g=f-d+this.cropW,h=n-p+this.cropH;break}o.x1>=a.x1&&(i=f),o.y1>=a.y1&&(r=n),o.x2<=a.x2&&(i=g),o.y2<=a.y2&&(r=h)}this.x=i,this.y=r,this.$emit("imgMoving",{moving:!0,axis:this.getImgAxis()}),this.$emit("img-moving",{moving:!0,axis:this.getImgAxis()})})},leaveImg(e){window.removeEventListener("mousemove",this.moveImg),window.removeEventListener("touchmove",this.moveImg),window.removeEventListener("mouseup",this.leaveImg),window.removeEventListener("touchend",this.leaveImg),this.$emit("imgMoving",{moving:!1,axis:this.getImgAxis()}),this.$emit("img-moving",{moving:!1,axis:this.getImgAxis()})},scaleImg(){this.canScale&&window.addEventListener(this.support,this.changeSize,this.passive)},cancelScale(){this.canScale&&window.removeEventListener(this.support,this.changeSize)},changeSize(e){e.preventDefault();let t=this.scale;var s=e.deltaY||e.wheelDelta,i=navigator.userAgent.indexOf("Firefox");s=i>0?s*30:s,this.isIE&&(s=-s);var r=this.coe;r=r/this.trueWidth>r/this.trueHeight?r/this.trueHeight:r/this.trueWidth;var o=r*s;o<0?t+=Math.abs(o):t>Math.abs(o)&&(t-=Math.abs(o));let a=o<0?"add":"reduce";if(a!==this.coeStatus&&(this.coeStatus=a,this.coe=.2),this.scaling||(this.scalingSet=setTimeout(()=>{this.scaling=!1,this.coe=this.coe+=.01},50)),this.scaling=!0,!this.checkoutImgAxis(this.x,this.y,t))return!1;this.scale=t},changeScale(e){let t=this.scale;e=e||1;var s=20;if(s=s/this.trueWidth>s/this.trueHeight?s/this.trueHeight:s/this.trueWidth,e=e*s,e>0?t+=Math.abs(e):t>Math.abs(e)&&(t-=Math.abs(e)),!this.checkoutImgAxis(this.x,this.y,t))return!1;this.scale=t},createCrop(e){e.preventDefault();var t="clientX"in e?e.clientX:e.touches?e.touches[0].clientX:0,s="clientY"in e?e.clientY:e.touches?e.touches[0].clientY:0;this.$nextTick(()=>{var i=t-this.cropX,r=s-this.cropY;if(i>0?(this.cropW=i+this.cropChangeX>this.w?this.w-this.cropChangeX:i,this.cropOffsertX=this.cropChangeX):(this.cropW=this.w-this.cropChangeX+Math.abs(i)>this.w?this.cropChangeX:Math.abs(i),this.cropOffsertX=this.cropChangeX+i>0?this.cropChangeX+i:0),!this.fixed)r>0?(this.cropH=r+this.cropChangeY>this.h?this.h-this.cropChangeY:r,this.cropOffsertY=this.cropChangeY):(this.cropH=this.h-this.cropChangeY+Math.abs(r)>this.h?this.cropChangeY:Math.abs(r),this.cropOffsertY=this.cropChangeY+r>0?this.cropChangeY+r:0);else{var o=this.cropW/this.fixedNumber[0]*this.fixedNumber[1];o+this.cropOffsertY>this.h?(this.cropH=this.h-this.cropOffsertY,this.cropW=this.cropH/this.fixedNumber[1]*this.fixedNumber[0],i>0?this.cropOffsertX=this.cropChangeX:this.cropOffsertX=this.cropChangeX-this.cropW):this.cropH=o,this.cropOffsertY=this.cropOffsertY}})},changeCropSize(e,t,s,i,r){e.preventDefault(),window.addEventListener("mousemove",this.changeCropNow),window.addEventListener("mouseup",this.changeCropEnd),window.addEventListener("touchmove",this.changeCropNow),window.addEventListener("touchend",this.changeCropEnd),this.canChangeX=t,this.canChangeY=s,this.changeCropTypeX=i,this.changeCropTypeY=r,this.cropX="clientX"in e?e.clientX:e.touches[0].clientX,this.cropY="clientY"in e?e.clientY:e.touches[0].clientY,this.cropOldW=this.cropW,this.cropOldH=this.cropH,this.cropChangeX=this.cropOffsertX,this.cropChangeY=this.cropOffsertY,this.fixed&&this.canChangeX&&this.canChangeY&&(this.canChangeY=0),this.$emit("change-crop-size",{width:this.cropW,height:this.cropH})},changeCropNow(e){e.preventDefault();var t="clientX"in e?e.clientX:e.touches?e.touches[0].clientX:0,s="clientY"in e?e.clientY:e.touches?e.touches[0].clientY:0;let i=this.w,r=this.h,o=0,a=0;if(this.centerBox){let p=this.getImgAxis(),d=p.x2,f=p.y2;o=p.x1>0?p.x1:0,a=p.y1>0?p.y1:0,i>d&&(i=d),r>f&&(r=f)}this.$nextTick(()=>{var p=t-this.cropX,d=s-this.cropY;if(this.canChangeX&&(this.changeCropTypeX===1?this.cropOldW-p>0?(this.cropW=i-this.cropChangeX-p<=i-o?this.cropOldW-p:this.cropOldW+this.cropChangeX-o,this.cropOffsertX=i-this.cropChangeX-p<=i-o?this.cropChangeX+p:o):(this.cropW=Math.abs(p)+this.cropChangeX<=i?Math.abs(p)-this.cropOldW:i-this.cropOldW-this.cropChangeX,this.cropOffsertX=this.cropChangeX+this.cropOldW):this.changeCropTypeX===2&&(this.cropOldW+p>0?(this.cropW=this.cropOldW+p+this.cropOffsertX<=i?this.cropOldW+p:i-this.cropOffsertX,this.cropOffsertX=this.cropChangeX):(this.cropW=i-this.cropChangeX+Math.abs(p+this.cropOldW)<=i-o?Math.abs(p+this.cropOldW):this.cropChangeX-o,this.cropOffsertX=i-this.cropChangeX+Math.abs(p+this.cropOldW)<=i-o?this.cropChangeX-Math.abs(p+this.cropOldW):o))),this.canChangeY&&(this.changeCropTypeY===1?this.cropOldH-d>0?(this.cropH=r-this.cropChangeY-d<=r-a?this.cropOldH-d:this.cropOldH+this.cropChangeY-a,this.cropOffsertY=r-this.cropChangeY-d<=r-a?this.cropChangeY+d:a):(this.cropH=Math.abs(d)+this.cropChangeY<=r?Math.abs(d)-this.cropOldH:r-this.cropOldH-this.cropChangeY,this.cropOffsertY=this.cropChangeY+this.cropOldH):this.changeCropTypeY===2&&(this.cropOldH+d>0?(this.cropH=this.cropOldH+d+this.cropOffsertY<=r?this.cropOldH+d:r-this.cropOffsertY,this.cropOffsertY=this.cropChangeY):(this.cropH=r-this.cropChangeY+Math.abs(d+this.cropOldH)<=r-a?Math.abs(d+this.cropOldH):this.cropChangeY-a,this.cropOffsertY=r-this.cropChangeY+Math.abs(d+this.cropOldH)<=r-a?this.cropChangeY-Math.abs(d+this.cropOldH):a))),this.canChangeX&&this.fixed){var f=this.cropW/this.fixedNumber[0]*this.fixedNumber[1];f+this.cropOffsertY>r?(this.cropH=r-this.cropOffsertY,this.cropW=this.cropH/this.fixedNumber[1]*this.fixedNumber[0]):this.cropH=f}if(this.canChangeY&&this.fixed){var n=this.cropH/this.fixedNumber[1]*this.fixedNumber[0];n+this.cropOffsertX>i?(this.cropW=i-this.cropOffsertX,this.cropH=this.cropW/this.fixedNumber[0]*this.fixedNumber[1]):this.cropW=n}})},checkCropLimitSize(){let{cropW:e,cropH:t,limitMinSize:s}=this,i=new Array;return Array.isArray[s]?i=s:i=[s,s],e=parseFloat(i[0]),t=parseFloat(i[1]),[e,t]},changeCropEnd(e){window.removeEventListener("mousemove",this.changeCropNow),window.removeEventListener("mouseup",this.changeCropEnd),window.removeEventListener("touchmove",this.changeCropNow),window.removeEventListener("touchend",this.changeCropEnd)},endCrop(){this.cropW===0&&this.cropH===0&&(this.cropping=!1),window.removeEventListener("mousemove",this.createCrop),window.removeEventListener("mouseup",this.endCrop),window.removeEventListener("touchmove",this.createCrop),window.removeEventListener("touchend",this.endCrop)},startCrop(){this.crop=!0},stopCrop(){this.crop=!1},clearCrop(){this.cropping=!1,this.cropW=0,this.cropH=0},cropMove(e){if(e.preventDefault(),!this.canMoveBox)return this.crop=!1,this.startMove(e),!1;if(e.touches&&e.touches.length===2)return this.crop=!1,this.startMove(e),this.leaveCrop(),!1;window.addEventListener("mousemove",this.moveCrop),window.addEventListener("mouseup",this.leaveCrop),window.addEventListener("touchmove",this.moveCrop),window.addEventListener("touchend",this.leaveCrop);let t="clientX"in e?e.clientX:e.touches[0].clientX,s="clientY"in e?e.clientY:e.touches[0].clientY,i,r;i=t-this.cropOffsertX,r=s-this.cropOffsertY,this.cropX=i,this.cropY=r,this.$emit("cropMoving",{moving:!0,axis:this.getCropAxis()}),this.$emit("crop-moving",{moving:!0,axis:this.getCropAxis()})},moveCrop(e,t){let s=0,i=0;e&&(e.preventDefault(),s="clientX"in e?e.clientX:e.touches[0].clientX,i="clientY"in e?e.clientY:e.touches[0].clientY),this.$nextTick(()=>{let r,o,a=s-this.cropX,p=i-this.cropY;if(t&&(a=this.cropOffsertX,p=this.cropOffsertY),a<=0?r=0:a+this.cropW>this.w?r=this.w-this.cropW:r=a,p<=0?o=0:p+this.cropH>this.h?o=this.h-this.cropH:o=p,this.centerBox){let d=this.getImgAxis();r<=d.x1&&(r=d.x1),r+this.cropW>d.x2&&(r=d.x2-this.cropW),o<=d.y1&&(o=d.y1),o+this.cropH>d.y2&&(o=d.y2-this.cropH)}this.cropOffsertX=r,this.cropOffsertY=o,this.$emit("cropMoving",{moving:!0,axis:this.getCropAxis()}),this.$emit("crop-moving",{moving:!0,axis:this.getCropAxis()})})},getImgAxis(e,t,s){e=e||this.x,t=t||this.y,s=s||this.scale;let i={x1:0,x2:0,y1:0,y2:0},r=this.trueWidth*s,o=this.trueHeight*s;switch(this.rotate){case 0:i.x1=e+this.trueWidth*(1-s)/2,i.x2=i.x1+this.trueWidth*s,i.y1=t+this.trueHeight*(1-s)/2,i.y2=i.y1+this.trueHeight*s;break;case 1:case-1:case 3:case-3:i.x1=e+this.trueWidth*(1-s)/2+(r-o)/2,i.x2=i.x1+this.trueHeight*s,i.y1=t+this.trueHeight*(1-s)/2+(o-r)/2,i.y2=i.y1+this.trueWidth*s;break;default:i.x1=e+this.trueWidth*(1-s)/2,i.x2=i.x1+this.trueWidth*s,i.y1=t+this.trueHeight*(1-s)/2,i.y2=i.y1+this.trueHeight*s;break}return i},getCropAxis(){let e={x1:0,x2:0,y1:0,y2:0};return e.x1=this.cropOffsertX,e.x2=e.x1+this.cropW,e.y1=this.cropOffsertY,e.y2=e.y1+this.cropH,e},leaveCrop(e){window.removeEventListener("mousemove",this.moveCrop),window.removeEventListener("mouseup",this.leaveCrop),window.removeEventListener("touchmove",this.moveCrop),window.removeEventListener("touchend",this.leaveCrop),this.$emit("cropMoving",{moving:!1,axis:this.getCropAxis()}),this.$emit("crop-moving",{moving:!1,axis:this.getCropAxis()})},getCropChecked(e){let t=document.createElement("canvas"),s=new Image,i=this.rotate,r=this.trueWidth,o=this.trueHeight,a=this.cropOffsertX,p=this.cropOffsertY;s.onload=()=>{if(this.cropW!==0){let n=t.getContext("2d"),g=1;this.high&!this.full&&(g=window.devicePixelRatio),this.enlarge!==1&!this.full&&(g=Math.abs(Number(this.enlarge)));let h=this.cropW*g,l=this.cropH*g,u=r*this.scale*g,v=o*this.scale*g,y=(this.x-a+this.trueWidth*(1-this.scale)/2)*g,m=(this.y-p+this.trueHeight*(1-this.scale)/2)*g;switch(f(h,l),n.save(),i){case 0:this.full?(f(h/this.scale,l/this.scale),n.drawImage(s,y/this.scale,m/this.scale,u/this.scale,v/this.scale)):n.drawImage(s,y,m,u,v);break;case 1:case-3:this.full?(f(h/this.scale,l/this.scale),y=y/this.scale+(u/this.scale-v/this.scale)/2,m=m/this.scale+(v/this.scale-u/this.scale)/2,n.rotate(i*90*Math.PI/180),n.drawImage(s,m,-y-v/this.scale,u/this.scale,v/this.scale)):(y=y+(u-v)/2,m=m+(v-u)/2,n.rotate(i*90*Math.PI/180),n.drawImage(s,m,-y-v,u,v));break;case 2:case-2:this.full?(f(h/this.scale,l/this.scale),n.rotate(i*90*Math.PI/180),y=y/this.scale,m=m/this.scale,n.drawImage(s,-y-u/this.scale,-m-v/this.scale,u/this.scale,v/this.scale)):(n.rotate(i*90*Math.PI/180),n.drawImage(s,-y-u,-m-v,u,v));break;case 3:case-1:this.full?(f(h/this.scale,l/this.scale),y=y/this.scale+(u/this.scale-v/this.scale)/2,m=m/this.scale+(v/this.scale-u/this.scale)/2,n.rotate(i*90*Math.PI/180),n.drawImage(s,-m-u/this.scale,y,u/this.scale,v/this.scale)):(y=y+(u-v)/2,m=m+(v-u)/2,n.rotate(i*90*Math.PI/180),n.drawImage(s,-m-u,y,u,v));break;default:this.full?(f(h/this.scale,l/this.scale),n.drawImage(s,y/this.scale,m/this.scale,u/this.scale,v/this.scale)):n.drawImage(s,y,m,u,v)}n.restore()}else{let n=r*this.scale,g=o*this.scale,h=t.getContext("2d");switch(h.save(),i){case 0:f(n,g),h.drawImage(s,0,0,n,g);break;case 1:case-3:f(g,n),h.rotate(i*90*Math.PI/180),h.drawImage(s,0,-g,n,g);break;case 2:case-2:f(n,g),h.rotate(i*90*Math.PI/180),h.drawImage(s,-n,-g,n,g);break;case 3:case-1:f(g,n),h.rotate(i*90*Math.PI/180),h.drawImage(s,-n,0,n,g);break;default:f(n,g),h.drawImage(s,0,0,n,g)}h.restore()}e(t)};var d=this.img.substr(0,4);d!=="data"&&(s.crossOrigin="Anonymous"),s.src=this.imgs;function f(n,g){t.width=Math.round(n),t.height=Math.round(g)}},getCropData(e){this.getCropChecked(t=>{e(t.toDataURL("image/"+this.outputType,this.outputSize))})},getCropBlob(e){this.getCropChecked(t=>{t.toBlob(s=>e(s),"image/"+this.outputType,this.outputSize)})},showPreview(){if(this.isCanShow)this.isCanShow=!1,setTimeout(()=>{this.isCanShow=!0},16);else return!1;let e=this.cropW,t=this.cropH,s=this.scale;var i={};i.div={width:`${e}px`,height:`${t}px`};let r=(this.x-this.cropOffsertX)/s,o=(this.y-this.cropOffsertY)/s,a=0;i.w=e,i.h=t,i.url=this.imgs,i.img={width:`${this.trueWidth}px`,height:`${this.trueHeight}px`,transform:`scale(${s})translate3d(${r}px, ${o}px, ${a}px)rotateZ(${this.rotate*90}deg)`},i.html=`
  7. <div class="show-preview" style="width: ${i.w}px; height: ${i.h}px,; overflow: hidden">
  8. <div style="width: ${e}px; height: ${t}px">
  9. <img src=${i.url} style="width: ${this.trueWidth}px; height: ${this.trueHeight}px; transform:
  10. scale(${s})translate3d(${r}px, ${o}px, ${a}px)rotateZ(${this.rotate*90}deg)">
  11. </div>
  12. </div>`,this.$emit("realTime",i),this.$emit("real-time",i)},reload(){let e=new Image;e.onload=()=>{this.w=parseFloat(window.getComputedStyle(this.$refs.cropper).width),this.h=parseFloat(window.getComputedStyle(this.$refs.cropper).height),this.trueWidth=e.width,this.trueHeight=e.height,this.original?this.scale=1:this.scale=this.checkedMode(),this.$nextTick(()=>{this.x=-(this.trueWidth-this.trueWidth*this.scale)/2+(this.w-this.trueWidth*this.scale)/2,this.y=-(this.trueHeight-this.trueHeight*this.scale)/2+(this.h-this.trueHeight*this.scale)/2,this.loading=!1,this.autoCrop&&this.goAutoCrop(),this.$emit("img-load","success"),this.$emit("imgLoad","success"),setTimeout(()=>{this.showPreview()},20)})},e.onerror=()=>{this.$emit("imgLoad","error"),this.$emit("img-load","error")},e.src=this.imgs},checkedMode(){let e=1,t=this.trueWidth,s=this.trueHeight;const i=this.mode.split(" ");switch(i[0]){case"contain":this.trueWidth>this.w&&(e=this.w/this.trueWidth),this.trueHeight*e>this.h&&(e=this.h/this.trueHeight);break;case"cover":t=this.w,e=t/this.trueWidth,s=s*e,s<this.h&&(s=this.h,e=s/this.trueHeight);break;default:try{let r=i[0];if(r.search("px")!==-1){r=r.replace("px",""),t=parseFloat(r);const o=t/this.trueWidth;let a=1,p=i[1];p.search("px")!==-1&&(p=p.replace("px",""),s=parseFloat(p),a=s/this.trueHeight),e=Math.min(o,a)}if(r.search("%")!==-1&&(r=r.replace("%",""),t=parseFloat(r)/100*this.w,e=t/this.trueWidth),i.length===2&&r==="auto"){let o=i[1];o.search("px")!==-1&&(o=o.replace("px",""),s=parseFloat(o),e=s/this.trueHeight),o.search("%")!==-1&&(o=o.replace("%",""),s=parseFloat(o)/100*this.h,e=s/this.trueHeight)}}catch{e=1}}return e},goAutoCrop(e,t){if(this.imgs===""||this.imgs===null)return;this.clearCrop(),this.cropping=!0;let s=this.w,i=this.h;if(this.centerBox){const a=Math.abs(this.rotate)%2>0;let p=(a?this.trueHeight:this.trueWidth)*this.scale,d=(a?this.trueWidth:this.trueHeight)*this.scale;s=p<s?p:s,i=d<i?d:i}var r=e||parseFloat(this.autoCropWidth),o=t||parseFloat(this.autoCropHeight);(r===0||o===0)&&(r=s*.8,o=i*.8),r=r>s?s:r,o=o>i?i:o,this.fixed&&(o=r/this.fixedNumber[0]*this.fixedNumber[1]),o>this.h&&(o=this.h,r=o/this.fixedNumber[1]*this.fixedNumber[0]),this.changeCrop(r,o)},changeCrop(e,t){if(this.centerBox){let s=this.getImgAxis();e>s.x2-s.x1&&(e=s.x2-s.x1,t=e/this.fixedNumber[0]*this.fixedNumber[1]),t>s.y2-s.y1&&(t=s.y2-s.y1,e=t/this.fixedNumber[1]*this.fixedNumber[0])}this.cropW=e,this.cropH=t,this.checkCropLimitSize(),this.$nextTick(()=>{this.cropOffsertX=(this.w-this.cropW)/2,this.cropOffsertY=(this.h-this.cropH)/2,this.centerBox&&this.moveCrop(null,!0)})},refresh(){this.img,this.imgs="",this.scale=1,this.crop=!1,this.rotate=0,this.w=0,this.h=0,this.trueWidth=0,this.trueHeight=0,this.clearCrop(),this.$nextTick(()=>{this.checkedImg()})},rotateLeft(){this.rotate=this.rotate<=-3?0:this.rotate-1},rotateRight(){this.rotate=this.rotate>=3?0:this.rotate+1},rotateClear(){this.rotate=0},checkoutImgAxis(e,t,s){e=e||this.x,t=t||this.y,s=s||this.scale;let i=!0;if(this.centerBox){let r=this.getImgAxis(e,t,s),o=this.getCropAxis();r.x1>=o.x1&&(i=!1),r.x2<=o.x2&&(i=!1),r.y1>=o.y1&&(i=!1),r.y2<=o.y2&&(i=!1)}return i}},mounted(){this.support="onwheel"in document.createElement("div")?"wheel":document.onmousewheel!==void 0?"mousewheel":"DOMMouseScroll";let e=this;var t=navigator.userAgent;this.isIOS=!!t.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/),HTMLCanvasElement.prototype.toBlob||Object.defineProperty(HTMLCanvasElement.prototype,"toBlob",{value:function(s,i,r){for(var o=atob(this.toDataURL(i,r).split(",")[1]),a=o.length,p=new Uint8Array(a),d=0;d<a;d++)p[d]=o.charCodeAt(d);s(new Blob([p],{type:e.type||"image/png"}))}}),this.showPreview(),this.checkedImg()},destroyed(){window.removeEventListener("mousemove",this.moveCrop),window.removeEventListener("mouseup",this.leaveCrop),window.removeEventListener("touchmove",this.moveCrop),window.removeEventListener("touchend",this.leaveCrop),this.cancelScale()}}),_t={key:0,class:"cropper-box"},es=["src"],ts={class:"cropper-view-box"},ss=["src"],is={key:1};function os(e,t,s,i,r,o){return L(),M("div",{class:"vue-cropper",ref:"cropper",onMouseover:t[28]||(t[28]=(...a)=>e.scaleImg&&e.scaleImg(...a)),onMouseout:t[29]||(t[29]=(...a)=>e.cancelScale&&e.cancelScale(...a))},[e.imgs?(L(),M("div",_t,[ae(A("div",{class:"cropper-box-canvas",style:Y({width:e.trueWidth+"px",height:e.trueHeight+"px",transform:"scale("+e.scale+","+e.scale+") translate3d("+e.x/e.scale+"px,"+e.y/e.scale+"px,0)rotateZ("+e.rotate*90+"deg)"})},[A("img",{src:e.imgs,alt:"cropper-img",ref:"cropperImg"},null,8,es)],4),[[ne,!e.loading]])])):k("",!0),A("div",{class:C(["cropper-drag-box",{"cropper-move":e.move&&!e.crop,"cropper-crop":e.crop,"cropper-modal":e.cropping}]),onMousedown:t[0]||(t[0]=(...a)=>e.startMove&&e.startMove(...a)),onTouchstart:t[1]||(t[1]=(...a)=>e.startMove&&e.startMove(...a))},null,34),ae(A("div",{class:"cropper-crop-box",style:Y({width:e.cropW+"px",height:e.cropH+"px",transform:"translate3d("+e.cropOffsertX+"px,"+e.cropOffsertY+"px,0)"})},[A("span",ts,[A("img",{style:Y({width:e.trueWidth+"px",height:e.trueHeight+"px",transform:"scale("+e.scale+","+e.scale+") translate3d("+(e.x-e.cropOffsertX)/e.scale+"px,"+(e.y-e.cropOffsertY)/e.scale+"px,0)rotateZ("+e.rotate*90+"deg)"}),src:e.imgs,alt:"cropper-img"},null,12,ss)]),A("span",{class:"cropper-face cropper-move",onMousedown:t[2]||(t[2]=(...a)=>e.cropMove&&e.cropMove(...a)),onTouchstart:t[3]||(t[3]=(...a)=>e.cropMove&&e.cropMove(...a))},null,32),e.info?(L(),M("span",{key:0,class:"crop-info",style:Y({top:e.cropInfo.top})},D(e.cropInfo.width)+" \xD7 "+D(e.cropInfo.height),5)):k("",!0),e.fixedBox?k("",!0):(L(),M("span",is,[A("span",{class:"crop-line line-w",onMousedown:t[4]||(t[4]=a=>e.changeCropSize(a,!1,!0,0,1)),onTouchstart:t[5]||(t[5]=a=>e.changeCropSize(a,!1,!0,0,1))},null,32),A("span",{class:"crop-line line-a",onMousedown:t[6]||(t[6]=a=>e.changeCropSize(a,!0,!1,1,0)),onTouchstart:t[7]||(t[7]=a=>e.changeCropSize(a,!0,!1,1,0))},null,32),A("span",{class:"crop-line line-s",onMousedown:t[8]||(t[8]=a=>e.changeCropSize(a,!1,!0,0,2)),onTouchstart:t[9]||(t[9]=a=>e.changeCropSize(a,!1,!0,0,2))},null,32),A("span",{class:"crop-line line-d",onMousedown:t[10]||(t[10]=a=>e.changeCropSize(a,!0,!1,2,0)),onTouchstart:t[11]||(t[11]=a=>e.changeCropSize(a,!0,!1,2,0))},null,32),A("span",{class:"crop-point point1",onMousedown:t[12]||(t[12]=a=>e.changeCropSize(a,!0,!0,1,1)),onTouchstart:t[13]||(t[13]=a=>e.changeCropSize(a,!0,!0,1,1))},null,32),A("span",{class:"crop-point point2",onMousedown:t[14]||(t[14]=a=>e.changeCropSize(a,!1,!0,0,1)),onTouchstart:t[15]||(t[15]=a=>e.changeCropSize(a,!1,!0,0,1))},null,32),A("span",{class:"crop-point point3",onMousedown:t[16]||(t[16]=a=>e.changeCropSize(a,!0,!0,2,1)),onTouchstart:t[17]||(t[17]=a=>e.changeCropSize(a,!0,!0,2,1))},null,32),A("span",{class:"crop-point point4",onMousedown:t[18]||(t[18]=a=>e.changeCropSize(a,!0,!1,1,0)),onTouchstart:t[19]||(t[19]=a=>e.changeCropSize(a,!0,!1,1,0))},null,32),A("span",{class:"crop-point point5",onMousedown:t[20]||(t[20]=a=>e.changeCropSize(a,!0,!1,2,0)),onTouchstart:t[21]||(t[21]=a=>e.changeCropSize(a,!0,!1,2,0))},null,32),A("span",{class:"crop-point point6",onMousedown:t[22]||(t[22]=a=>e.changeCropSize(a,!0,!0,1,2)),onTouchstart:t[23]||(t[23]=a=>e.changeCropSize(a,!0,!0,1,2))},null,32),A("span",{class:"crop-point point7",onMousedown:t[24]||(t[24]=a=>e.changeCropSize(a,!1,!0,0,2)),onTouchstart:t[25]||(t[25]=a=>e.changeCropSize(a,!1,!0,0,2))},null,32),A("span",{class:"crop-point point8",onMousedown:t[26]||(t[26]=a=>e.changeCropSize(a,!0,!0,2,2)),onTouchstart:t[27]||(t[27]=a=>e.changeCropSize(a,!0,!0,2,2))},null,32)]))],4),[[ne,e.cropping]])],544)}var Se=Jt(Zt,[["render",os],["__scopeId","data-v-be5e5ddc"]]);typeof window<"u"&&window.Vue&&window.Vue.createApp({}).component("VueCropper",Se);const rs="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAABBlJREFUaEPtmVuoVkUUx3/HFxWflFIQFPGCL0mBmhdCBEW8PqhkUSEmomjpiyTqiwpeUXxIFE1KyEIzCcUoBStQwhteMJTIEgzRoBTSXnoy/jIT6wyz9579fXt/ng8c2Jzz7Zm91v+/1po1M2s6aPPW0eb4eU4g8OArwERgODDIPH8Dv5vnHHASeNxsBFThgZnAXAdcoMu0L4EfgGPA/TIf+rHNEBDwxcCsRhQH39wD9gP7yhJphEBfYI+zeoj9Z+B7QJb9C3jg/vYAepvnbUBPzwwi61ONUpbAKOA40D9Q8BFwADifqhjoA7wJLARGBt/JAPNSZJUhIKusiwAX+MspynLGKBT1WCI3gJeK5KYSWOrCxsqThWSpKpu8uCAQmIsxhcBs4KtA6ADgbpXIjazNwBrz+1tgepauIgID3aQc4gQ8BAYDyut1tknAaaNgO7AqprCIgLKNwkftV2AO8FOdyI1sTe6Pze/3ImGcu5WYAXxtBMgqSpGtbLuBZU7hb8A44E8LIM8DZ4HX3OBtwOpWIne6XgR+BIa531uD+ZHpgbeAz91H14AJVexbGjTAEmCv+/ZfYDxwxcvK8oBCRyGkthLYGShPXSn9uLLjQ66ngCnupWRtyCOgsFH4qCnrjAC0V7EttqiFSqXEEggXwbzxYd+7wCfu5QVgbB6BLSbelYU0+8PWagJad7Qd901p/bZ+xELokNujqH8+cLCAwP/udOO8pbM8kDI+opKLwGjXsQLYlUXAZp+XgesJBGKhkkegaHyMgPX6DuCDLALKt1pts/r13gprBmiWnBiB5cCHrkNnB23+OoWQXKLdnxaL7kaC0paOgLaFim1fSgg14gGdHz5zio4Ab4QEZPXv3DnWA1I6jZ24mpnEKR6LeWAa8I3rUFqdGgsR6yb163D+S8EciCnTOwtUXvFWr5WAFMs9r7uN1KIMdAKkDPYkksmeWQh5rCqNXAVecGfaLAsXZQq7YqZ4oNMKGxFeOInDSZq6/OdN7qLJWiYLJafRFIvnkUsJoaKsFcOQvJClEiiztymbtUIMpbYSVRHImgNZ8vPmQKnNXCqBonHKUH7fkzKf7PhQtt1O2zTcFtXphg401gLvuNV5Y5HJa+hv+EgpLK+6s4C21GrRqkANoK3Ipg71EnQ0KOKK1KWaQXvxTZdVvKA/gH4GdFEtqQp+lRW2BEYljXBDNwaenpDqaJWWFj1Am4f9u/cBxWiVrZbirgeoG5kTAdpP3a71TJMsai+ve3zaoaq8ER5yVIj9AjgM/JNIpuUXHBbXWmBTBOgdQHUbFYJvAbqkuAl06ypXTBazavY6+OjplWj1rGEtveQLQehq1RPxdZtUPs/0mjUGcjIwFFDlTH/9/4+68kV3qrVrGdeKVbUW4F5o2xP4DzVSDEAyxtmHAAAAAElFTkSuQmCC",as=U({name:"cropper",props:{cropperNo:{type:Function,default:e=>{}},cropperOk:{type:Function,default:e=>{}},bucket:{type:String,default:"daya"}},data(){return{ossUploadUrl:"https://ks3-cn-beijing.ksyuncs.com/"+this.bucket,dataObj:{policy:"",signature:"",key:"",KSSAccessKeyId:"",acl:"public-read",name:""},visible:!1,img:null,options:{img:"",autoCrop:!0,autoCropWidth:180,autoCropHeight:180,fixedBox:!0,full:!1,enlarge:1,previewsCircle:!0,centerBox:!0,outputType:"png",title:"\u4FEE\u6539\u5934\u50CF",name:null},previews:{},url:{upload:"/sys/common/saveToImgByStr"},submitLoading:!1}},methods:{edit(e){const{options:t}=this;this.visible=!0,this.options=Object.assign({},t,e),console.log(this.options)},cancelHandel(){this.visible=!1,this.cropperNo()},okHandel(){this.$refs.cropperRef.getCropBlob(async e=>{this.submitLoading=!0;const t=this.options,s=(t.name?t.name.split(".")[0]:+new Date)+".png";try{let i=new Date().getTime()+s,r={filename:s,bucketName:this.bucket,postData:{filename:s,acl:"public-read",key:i,unknowValueField:[]}};const o=await je.post("/api-website/getUploadSign",{data:r});this.dataObj={policy:o.data.policy,signature:o.data.signature,key:i,KSSAccessKeyId:o.data.kssAccessKeyId,acl:"public-read",name:s};let a=new FormData;for(let d in this.dataObj)a.append(d,this.dataObj[d]);a.append("file",this.blobToFile(e,s),s),await Ve(this.ossUploadUrl,{method:"POST",data:a}),console.log(this.ossUploadUrl+"/"+i);const p=this.ossUploadUrl+"/"+i;this.cropperOk(p)}catch(i){_.error(i)}finally{this.submitLoading=!1,this.cancelHandel()}})},blobToFile(e,t){return e.lastModifiedDate=new Date,e.name=t,e},base64ToFile(e,t){let s=e.split(","),i=s[0].match(/:(.*?);/)[1],r=atob(s[1]),o=r.length,a=new Uint8Array(o);for(;o--;)a[o]=r.charCodeAt(o);return new File([a],t,{type:i})},realTime(e){this.previews=e},changeScale(e){e=e||1,this.$refs.cropperRef.changeScale(e)},rotateLeft(){this.$refs.cropperRef.rotateLeft()},rotateRight(){this.$refs.cropperRef.rotateRight()}},render(){return b(Qe,{modelValue:this.visible,"onUpdate:modelValue":e=>this.visible=e,appendToBody:!0,title:this.options.title,closeOnClickModal:!1,width:"900px"},{default:()=>[b(Ge,null,{default:()=>[b(le,{xs:24,md:12,style:{width:"350px"}},{default:()=>[b(Se,{ref:"cropperRef",img:this.options.img,info:!0,autoCrop:this.options.autoCrop,autoCropWidth:this.options.autoCropWidth,full:this.options.full,outputType:this.options.outputType,autoCropHeight:this.options.autoCropHeight,fixedBox:this.options.fixedBox,enlarge:this.options.enlarge,onRealTime:this.realTime,style:{height:"350px"}},null),b("div",{class:"flex pt-2"},[b("div",{onClick:()=>{this.changeScale(1)},class:"mr-2 cursor-pointer",title:"\u653E\u5927"},[b($,{size:30,color:"#333"},{default:()=>[b(Je,null,null)]})]),b("div",{onClick:()=>{this.changeScale(-1)},class:"mr-2 cursor-pointer",title:"\u7F29\u5C0F"},[b($,{size:30,color:"#333"},{default:()=>[b(Ze,null,null)]})]),b("div",{onClick:this.rotateRight,title:"\u5411\u53F3\u65CB\u8F6C",class:"cursor-pointer"},[b("img",{src:rs,class:"w-[30px] h-[30px]"},null)])])]}),b(le,{xs:24,md:12,style:{height:"350px"}},{default:()=>[b("div",{class:R.previewImg},[b("span",null,[J("\u9884\u89C8\u56FE\u7247")]),b("div",{class:this.options.previewsCircle?R["avatar-upload-preview"]:R["avatar-upload-preview_range"],style:{width:this.options.autoCropWidth+"px",height:this.options.autoCropHeight+"px"}},[b(ye,{src:this.previews.url,style:this.previews.img},null)])])]})]})],footer:()=>b("span",{class:"dialog-footer !text-center block"},[b(he,{onClick:this.cancelHandel,disabled:this.submitLoading},{default:()=>[J("\u53D6\u6D88")]}),b(he,{type:"primary",onClick:this.okHandel,loading:this.submitLoading},{default:()=>[J("\u4FDD \u5B58")]})])})}}),ls=U({name:"col-cropper",props:{modelValue:{type:String,default:""},options:{type:Object,default:{autoCrop:!0,enlarge:1,autoCropWidth:200,autoCropHeight:200,fixedBox:!0,previewsCircle:!0,title:"\u4E0A\u4F20\u56FE\u7247"}},showSize:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},bucket:{type:String,default:"daya"},size:{type:Number,default:5},accept:{type:String,default:".png,.jpg,.jpeg"},tips:{type:String,default:"\u8BF7\u4E0A\u4F20\u56FE\u7247"},extraTips:{type:String,default:"\u56FE\u7247\u6700\u5927\u4E0D\u80FD\u8D85\u8FC75MB"},cropUploadSuccess:{type:Function,default:e=>{}},domSize:{type:Object,default:{width:"150px",height:"85px"}}},data(){return{isStopRun:!1,loading:!1}},methods:{onDelete(){this.$emit("update:modelValue","")},async handleChange(e){if(this.isStopRun)return;this.loading=!0;const t=this.options;this.getBase64(e.file,s=>{const i=Object.assign({},t,{img:s,name:e.file.name});this.$refs.CropperModal.edit(i)})},beforeUpload(e){this.isStopRun=!1;var t=e.type;if(t.indexOf("image")<0)return _.warning("\u8BF7\u4E0A\u4F20\u56FE\u7247"),this.isStopRun=!0,!1;const s=this.size||0,i=e.size<s*1024*1024;return i||(_.error("\u56FE\u7247\u5927\u5C0F\u4E0D\u80FD\u8D85\u8FC7"+this.size+"MB!"),this.isStopRun=!0),i},error(){this.remove(),this.loading=!1},remove(){this.onDelete()},handleCropperSuccess(e){this.loading=!1,this.$emit("update:modelValue",e),this.cropUploadSuccess(e)},handleCropperClose(){this.loading=!1,this.remove()},getBase64(e,t){const s=new FileReader;s.addEventListener("load",()=>t(s.result)),s.readAsDataURL(e)}},render(){return b("div",{class:[R.colUpload,"w-full"],style:{lineHeight:0}},[b(Rt,{disabled:this.disabled,showFileList:!1,accept:this.accept,beforeUpload:this.beforeUpload,httpRequest:this.handleChange,ref:"uploadRef"},{default:()=>[b("div",{ref:"uploadDom",class:[R.uploadClass,"w-full"],style:{height:this.domSize.height,width:this.domSize.width}},[this.modelValue?b(ye,{src:this.modelValue,fit:"cover",style:{height:this.domSize.height,width:this.domSize.width},class:R.uploadSection},null):b("div",{class:[R.uploadSection,"flex items-center flex-col justify-center"],style:{height:this.domSize.height,width:this.domSize.width}},[b("img",{src:Pt,class:"w-8 h-7 mb-3"},null),b("p",null,[this.tips])])])]}),b("p",{class:"text-3 text-[#999999] leading-6 pt-1"},[this.extraTips]),b(as,{ref:"CropperModal",bucket:this.bucket,cropperNo:this.handleCropperClose,cropperOk:this.handleCropperSuccess},null)])}});export{ls as C,Rt as E,Pt as i};