ocr-upload-f7fa3dde.js 26 KB

1
  1. /* empty css */import{d as W,r as T,a as he,c as O,w as N,o as we,b as st,e as rt,f as pe,g as c,n as ce,m as ue,h as ct,i as Ie,j as ut,v as ze,_ as dt,u as vt,k as ft,l as fe,p as F,t as Re,q as mt,F as xe,s as me,x as oe,y as gt,z as ht,A as wt,B as bt}from"./app-4609564c.js";import{c as K,t as V,n as Z,m as G,u as Ee,a as Be,b as be,w as Le,d as Fe,e as xt,o as yt,f as Me,g as ye,i as $e,p as ke,h as H,j as ae,k as Ue,l as Ye,q as ge,r as de,s as ie,I as J,v as re,x as se,y as Xe,z as Ne,A as q,B as St,L as je,C as Ze,D as kt,E as He,P as We,H as Ct,F as Ge,G as Pt,J as _t,K as qe,M as It,N as Je,O as pt,Q as Oe,R as Te,S as zt}from"./request-415f0ddb.js";const[Ke,Se]=K("swipe"),Rt={loop:V,width:Z,height:Z,vertical:Boolean,autoplay:G(0),duration:G(500),touchable:V,lazyRender:Boolean,initialSwipe:G(0),indicatorColor:String,showIndicators:V,stopPropagation:V},Qe=Symbol(Ke);var $t=W({name:Ke,props:Rt,emits:["change","dragStart","dragEnd"],setup(e,{emit:l,slots:s}){const t=T(),r=T(),a=he({rect:null,width:0,height:0,offset:0,active:0,swiping:!1});let w=!1;const b=Ee(),{children:x,linkChildren:S}=Be(Qe),o=O(()=>x.length),m=O(()=>a[e.vertical?"height":"width"]),n=O(()=>e.vertical?b.deltaY.value:b.deltaX.value),g=O(()=>a.rect?(e.vertical?a.rect.height:a.rect.width)-m.value*o.value:0),i=O(()=>m.value?Math.ceil(Math.abs(g.value)/m.value):o.value),_=O(()=>o.value*m.value),f=O(()=>(a.active+o.value)%o.value),z=O(()=>{const v=e.vertical?"vertical":"horizontal";return b.direction.value===v}),L=O(()=>{const v={transitionDuration:"".concat(a.swiping?0:e.duration,"ms"),transform:"translate".concat(e.vertical?"Y":"X","(").concat(+a.offset.toFixed(2),"px)")};if(m.value){const p=e.vertical?"height":"width",R=e.vertical?"width":"height";v[p]="".concat(_.value,"px"),v[R]=e[R]?"".concat(e[R],"px"):""}return v}),C=v=>{const{active:p}=a;return v?e.loop?H(p+v,-1,o.value):H(p+v,0,i.value):p},A=(v,p=0)=>{let R=v*m.value;e.loop||(R=Math.min(R,-g.value));let j=p-R;return e.loop||(j=H(j,g.value,0)),j},y=({pace:v=0,offset:p=0,emitChange:R})=>{if(o.value<=1)return;const{active:j}=a,X=C(v),ve=A(X,p);if(e.loop){if(x[0]&&ve!==g.value){const Pe=ve<g.value;x[0].setOffset(Pe?_.value:0)}if(x[o.value-1]&&ve!==0){const Pe=ve>0;x[o.value-1].setOffset(Pe?-_.value:0)}}a.active=X,a.offset=ve,R&&X!==j&&l("change",f.value)},M=()=>{a.swiping=!0,a.active<=-1?y({pace:o.value}):a.active>=o.value&&y({pace:-o.value})},Q=()=>{M(),b.reset(),ye(()=>{a.swiping=!1,y({pace:-1,emitChange:!0})})},d=()=>{M(),b.reset(),ye(()=>{a.swiping=!1,y({pace:1,emitChange:!0})})};let k;const $=()=>clearTimeout(k),I=()=>{$(),+e.autoplay>0&&o.value>1&&(k=setTimeout(()=>{d(),I()},+e.autoplay))},E=(v=+e.initialSwipe)=>{if(!t.value)return;const p=()=>{var R,j;if(!$e(t)){const X={width:t.value.offsetWidth,height:t.value.offsetHeight};a.rect=X,a.width=+((R=e.width)!=null?R:X.width),a.height=+((j=e.height)!=null?j:X.height)}o.value&&(v=Math.min(o.value-1,v),v===-1&&(v=o.value-1)),a.active=v,a.swiping=!0,a.offset=A(v),x.forEach(X=>{X.setOffset(0)}),I()};$e(t)?ce().then(p):p()},U=()=>E(a.active);let ee;const te=v=>{!e.touchable||v.touches.length>1||(b.start(v),w=!1,ee=Date.now(),$(),M())},u=v=>{e.touchable&&a.swiping&&(b.move(v),z.value&&(!e.loop&&(a.active===0&&n.value>0||a.active===o.value-1&&n.value<0)||(ke(v,e.stopPropagation),y({offset:n.value}),w||(l("dragStart",{index:f.value}),w=!0))))},h=()=>{if(!e.touchable||!a.swiping)return;const v=Date.now()-ee,p=n.value/v;if((Math.abs(p)>.25||Math.abs(n.value)>m.value/2)&&z.value){const j=e.vertical?b.offsetY.value:b.offsetX.value;let X=0;e.loop?X=j>0?n.value>0?-1:1:0:X=-Math[n.value>0?"ceil":"floor"](n.value/m.value),y({pace:X,emitChange:!0})}else n.value&&y({pace:0});w=!1,a.swiping=!1,l("dragEnd",{index:f.value}),I()},P=(v,p={})=>{M(),b.reset(),ye(()=>{let R;e.loop&&v===o.value?R=a.active===0?0:v:R=v%o.value,p.immediate?ye(()=>{a.swiping=!1}):a.swiping=!1,y({pace:R-a.active,emitChange:!0})})},B=(v,p)=>{const R=p===f.value,j=R?{backgroundColor:e.indicatorColor}:void 0;return c("i",{style:j,class:Se("indicator",{active:R})},null)},Y=()=>{if(s.indicator)return s.indicator({active:f.value,total:o.value});if(e.showIndicators&&o.value>1)return c("div",{class:Se("indicators",{vertical:e.vertical})},[Array(o.value).fill("").map(B)])};return be({prev:Q,next:d,state:a,resize:U,swipeTo:P}),S({size:m,props:e,count:o,activeIndicator:f}),N(()=>e.initialSwipe,v=>E(+v)),N(o,()=>E(a.active)),N(()=>e.autoplay,I),N([Le,Fe,()=>e.width,()=>e.height],U),N(xt(),v=>{v==="visible"?I():$()}),we(E),st(()=>E(a.active)),yt(()=>E(a.active)),rt($),pe($),Me("touchmove",u,{target:r}),()=>{var v;return c("div",{ref:t,class:Se()},[c("div",{ref:r,style:L.value,class:Se("track",{vertical:e.vertical}),onTouchstartPassive:te,onTouchend:h,onTouchcancel:h},[(v=s.default)==null?void 0:v.call(s)]),Y()])}}});const Ot=ae($t),[Tt,Dt]=K("swipe-item");var Vt=W({name:Tt,setup(e,{slots:l}){let s;const t=he({offset:0,inited:!1,mounted:!1}),{parent:r,index:a}=Ue(Qe);if(!r){console.error("[Vant] <SwipeItem> must be a child component of <Swipe>.");return}const w=O(()=>{const S={},{vertical:o}=r.props;return r.size.value&&(S[o?"height":"width"]="".concat(r.size.value,"px")),t.offset&&(S.transform="translate".concat(o?"Y":"X","(").concat(t.offset,"px)")),S}),b=O(()=>{const{loop:S,lazyRender:o}=r.props;if(!o||s)return!0;if(!t.mounted)return!1;const m=r.activeIndicator.value,n=r.count.value-1,g=m===0&&S?n:m-1,i=m===n&&S?0:m+1;return s=a.value===m||a.value===g||a.value===i,s}),x=S=>{t.offset=S};return we(()=>{ce(()=>{t.mounted=!0})}),be({setOffset:x}),()=>{var S;return c("div",{class:Dt(),style:w.value},[b.value?(S=l.default)==null?void 0:S.call(l):null])}}});const At=ae(Vt),[et,Et]=K("radio-group"),Bt={shape:String,disabled:Boolean,iconSize:Z,direction:String,modelValue:ge,checkedColor:String},tt=Symbol(et);var Lt=W({name:et,props:Bt,emits:["change","update:modelValue"],setup(e,{emit:l,slots:s}){const{linkChildren:t}=Be(tt),r=a=>l("update:modelValue",a);return N(()=>e.modelValue,a=>l("change",a)),t({props:e,updateValue:r}),Ye(()=>e.modelValue),()=>{var a;return c("div",{class:Et([e.direction]),role:"radiogroup"},[(a=s.default)==null?void 0:a.call(s)])}}});const Ft=ae(Lt),at={name:ge,disabled:Boolean,iconSize:Z,modelValue:ge,checkedColor:String,labelPosition:String,labelDisabled:Boolean};var Mt=W({props:de({},at,{bem:ie(Function),role:String,shape:String,parent:Object,checked:Boolean,bindGroup:V,indeterminate:{type:Boolean,default:null}}),emits:["click","toggle"],setup(e,{emit:l,slots:s}){const t=T(),r=n=>{if(e.parent&&e.bindGroup)return e.parent.props[n]},a=O(()=>{if(e.parent&&e.bindGroup){const n=r("disabled")||e.disabled;if(e.role==="checkbox"){const g=r("modelValue").length,i=r("max"),_=i&&g>=+i;return n||_&&!e.checked}return n}return e.disabled}),w=O(()=>r("direction")),b=O(()=>{const n=e.checkedColor||r("checkedColor");if(n&&e.checked&&!a.value)return{borderColor:n,backgroundColor:n}}),x=O(()=>e.shape||r("shape")||"round"),S=n=>{const{target:g}=n,i=t.value,_=i===g||(i==null?void 0:i.contains(g));!a.value&&(_||!e.labelDisabled)&&l("toggle"),l("click",n)},o=()=>{var n,g;const{bem:i,checked:_,indeterminate:f}=e,z=e.iconSize||r("iconSize");return c("div",{ref:t,class:i("icon",[x.value,{disabled:a.value,checked:_,indeterminate:f}]),style:x.value!=="dot"?{fontSize:re(z)}:{width:re(z),height:re(z),borderColor:(n=b.value)==null?void 0:n.borderColor}},[s.icon?s.icon({checked:_,disabled:a.value}):x.value!=="dot"?c(J,{name:f?"minus":"success",style:b.value},null):c("div",{class:i("icon--dot__icon"),style:{backgroundColor:(g=b.value)==null?void 0:g.backgroundColor}},null)])},m=()=>{const{checked:n}=e;if(s.default)return c("span",{class:e.bem("label",[e.labelPosition,{disabled:a.value}])},[s.default({checked:n,disabled:a.value})])};return()=>{const n=e.labelPosition==="left"?[m(),o()]:[o(),m()];return c("div",{role:e.role,class:e.bem([{disabled:a.value,"label-disabled":e.labelDisabled},w.value]),tabindex:a.value?void 0:0,"aria-checked":e.checked,onClick:S},[n])}}});const Ut=de({},at,{shape:String}),[Yt,Xt]=K("radio");var Nt=W({name:Yt,props:Ut,emits:["update:modelValue"],setup(e,{emit:l,slots:s}){const{parent:t}=Ue(tt),r=()=>(t?t.props.modelValue:e.modelValue)===e.name,a=()=>{t?t.updateValue(e.name):l("update:modelValue",e.name)};return()=>c(Mt,ue({bem:Xt,role:"radio",parent:t,checked:r(),onToggle:a},e),se(s,["default","icon"]))}});const jt=ae(Nt),[Zt,le]=K("image"),Ht={src:String,alt:String,fit:String,position:String,round:Boolean,block:Boolean,width:Z,height:Z,radius:Z,lazyLoad:Boolean,iconSize:Z,showError:V,errorIcon:q("photo-fail"),iconPrefix:String,showLoading:V,loadingIcon:q("photo"),crossorigin:String,referrerpolicy:String};var Wt=W({name:Zt,props:Ht,emits:["load","error"],setup(e,{emit:l,slots:s}){const t=T(!1),r=T(!0),a=T(),{$Lazyload:w}=ct().proxy,b=O(()=>{const f={width:re(e.width),height:re(e.height)};return Xe(e.radius)&&(f.overflow="hidden",f.borderRadius=re(e.radius)),f});N(()=>e.src,()=>{t.value=!1,r.value=!0});const x=f=>{r.value&&(r.value=!1,l("load",f))},S=()=>{const f=new Event("load");Object.defineProperty(f,"target",{value:a.value,enumerable:!0}),x(f)},o=f=>{t.value=!0,r.value=!1,l("error",f)},m=(f,z,L)=>L?L():c(J,{name:f,size:e.iconSize,class:z,classPrefix:e.iconPrefix},null),n=()=>{if(r.value&&e.showLoading)return c("div",{class:le("loading")},[m(e.loadingIcon,le("loading-icon"),s.loading)]);if(t.value&&e.showError)return c("div",{class:le("error")},[m(e.errorIcon,le("error-icon"),s.error)])},g=()=>{if(t.value||!e.src)return;const f={alt:e.alt,class:le("img"),style:{objectFit:e.fit,objectPosition:e.position},crossorigin:e.crossorigin,referrerpolicy:e.referrerpolicy};return e.lazyLoad?Ie(c("img",ue({ref:a},f),null),[[ut("lazy"),e.src]]):c("img",ue({ref:a,src:e.src,onLoad:x,onError:o},f),null)},i=({el:f})=>{const z=()=>{f===a.value&&r.value&&S()};a.value?z():ce(z)},_=({el:f})=>{f===a.value&&!t.value&&o()};return w&&Ne&&(w.$on("loaded",i),w.$on("error",_),pe(()=>{w.$off("loaded",i),w.$off("error",_)})),we(()=>{ce(()=>{var f;(f=a.value)!=null&&f.complete&&!e.lazyLoad&&S()})}),()=>{var f;return c("div",{class:le({round:e.round,block:e.block}),style:b.value},[g(),n(),(f=s.default)==null?void 0:f.call(s)])}}});const ot=ae(Wt),De=e=>Math.sqrt((e[0].clientX-e[1].clientX)**2+(e[0].clientY-e[1].clientY)**2),Gt=e=>({x:(e[0].clientX+e[1].clientX)/2,y:(e[0].clientY+e[1].clientY)/2}),_e=K("image-preview")[1],Ve=2.6,qt={src:String,show:Boolean,active:Number,minZoom:ie(Z),maxZoom:ie(Z),rootWidth:ie(Number),rootHeight:ie(Number),disableZoom:Boolean,doubleScale:Boolean,closeOnClickImage:Boolean,closeOnClickOverlay:Boolean,vertical:Boolean};var Jt=W({props:qt,emits:["scale","close","longPress"],setup(e,{emit:l,slots:s}){const t=he({scale:1,moveX:0,moveY:0,moving:!1,zooming:!1,initializing:!1,imageRatio:0}),r=Ee(),a=T(),w=T(),b=T(!1),x=T(!1);let S=0;const o=O(()=>{const{scale:u,moveX:h,moveY:P,moving:B,zooming:Y,initializing:v}=t,p={transitionDuration:Y||B||v?"0s":".3s"};return(u!==1||x.value)&&(p.transform="matrix(".concat(u,", 0, 0, ").concat(u,", ").concat(h,", ").concat(P,")")),p}),m=O(()=>{if(t.imageRatio){const{rootWidth:u,rootHeight:h}=e,P=b.value?h/t.imageRatio:u;return Math.max(0,(t.scale*P-u)/2)}return 0}),n=O(()=>{if(t.imageRatio){const{rootWidth:u,rootHeight:h}=e,P=b.value?h:u*t.imageRatio;return Math.max(0,(t.scale*P-h)/2)}return 0}),g=(u,h)=>{var P;if(u=H(u,+e.minZoom,+e.maxZoom+1),u!==t.scale){const B=u/t.scale;if(t.scale=u,h){const Y=Ze((P=a.value)==null?void 0:P.$el),v={x:Y.width*.5,y:Y.height*.5},p=t.moveX-(h.x-Y.left-v.x)*(B-1),R=t.moveY-(h.y-Y.top-v.y)*(B-1);t.moveX=H(p,-m.value,m.value),t.moveY=H(R,-n.value,n.value)}else t.moveX=0,t.moveY=x.value?S:0;l("scale",{scale:u,index:e.active})}},i=()=>{g(1)},_=()=>{const u=t.scale>1?1:2;g(u,u===2||x.value?{x:r.startX.value,y:r.startY.value}:void 0)};let f,z,L,C,A,y,M,Q,d=!1;const k=u=>{const{touches:h}=u;if(f=h.length,f===2&&e.disableZoom)return;const{offsetX:P}=r;r.start(u),z=t.moveX,L=t.moveY,Q=Date.now(),d=!1,t.moving=f===1&&(t.scale!==1||x.value),t.zooming=f===2&&!P.value,t.zooming&&(C=t.scale,A=De(h))},$=u=>{const{touches:h}=u;if(r.move(u),t.moving){const{deltaX:P,deltaY:B}=r,Y=P.value+z,v=B.value+L;if((e.vertical?r.isVertical()&&Math.abs(v)>n.value:r.isHorizontal()&&Math.abs(Y)>m.value)&&!d){t.moving=!1;return}d=!0,ke(u,!0),t.moveX=H(Y,-m.value,m.value),t.moveY=H(v,-n.value,n.value)}if(t.zooming&&(ke(u,!0),h.length===2)){const P=De(h),B=C*P/A;y=Gt(h),g(B,y)}},I=u=>{var h;const P=(h=w.value)==null?void 0:h.$el;if(!P)return;const B=P.firstElementChild,Y=u.target===P,v=B==null?void 0:B.contains(u.target);!e.closeOnClickImage&&v||!e.closeOnClickOverlay&&Y||l("close")},E=u=>{if(f>1)return;const h=Date.now()-Q,P=250;r.isTap.value&&(h<P?e.doubleScale?M?(clearTimeout(M),M=null,_()):M=setTimeout(()=>{I(u),M=null},P):I(u):h>kt&&l("longPress"))},U=u=>{let h=!1;if((t.moving||t.zooming)&&(h=!0,t.moving&&z===t.moveX&&L===t.moveY&&(h=!1),!u.touches.length)){t.zooming&&(t.moveX=H(t.moveX,-m.value,m.value),t.moveY=H(t.moveY,-n.value,n.value),t.zooming=!1),t.moving=!1,z=0,L=0,C=1,t.scale<1&&i();const P=+e.maxZoom;t.scale>P&&g(P,y)}ke(u,h),E(u),r.reset()},ee=()=>{const{rootWidth:u,rootHeight:h}=e,P=h/u,{imageRatio:B}=t;b.value=t.imageRatio>P&&B<Ve,x.value=t.imageRatio>P&&B>=Ve,x.value&&(S=(B*u-h)/2,t.moveY=S,t.initializing=!0,St(()=>{t.initializing=!1})),i()},te=u=>{const{naturalWidth:h,naturalHeight:P}=u.target;t.imageRatio=P/h,ee()};return N(()=>e.active,i),N(()=>e.show,u=>{u||i()}),N(()=>[e.rootWidth,e.rootHeight],ee),Me("touchmove",$,{target:O(()=>{var u;return(u=w.value)==null?void 0:u.$el})}),be({resetScale:i}),()=>{const u={loading:()=>c(je,{type:"spinner"},null)};return c(At,{ref:w,class:_e("swipe-item"),onTouchstartPassive:k,onTouchend:U,onTouchcancel:U},{default:()=>[s.image?c("div",{class:_e("image-wrap")},[s.image({src:e.src,onLoad:te,style:o.value})]):c(ot,{ref:a,src:e.src,fit:"contain",class:_e("image",{vertical:b.value}),style:o.value,onLoad:te},u)]})}}});const[Kt,ne]=K("image-preview"),Qt=["show","teleport","transition","overlayStyle","closeOnPopstate"],ea={show:Boolean,loop:V,images:He(),minZoom:G(1/3),maxZoom:G(3),overlay:V,vertical:Boolean,closeable:Boolean,showIndex:V,className:ge,closeIcon:q("clear"),transition:String,beforeClose:Function,doubleScale:V,overlayClass:ge,overlayStyle:Object,swipeDuration:G(300),startPosition:G(0),showIndicators:Boolean,closeOnPopstate:V,closeOnClickImage:V,closeOnClickOverlay:V,closeIconPosition:q("top-right"),teleport:[String,Object]};var lt=W({name:Kt,props:ea,emits:["scale","close","closed","change","longPress","update:show"],setup(e,{emit:l,slots:s}){const t=T(),r=T(),a=he({active:0,rootWidth:0,rootHeight:0,disableZoom:!1}),w=()=>{if(t.value){const C=Ze(t.value.$el);a.rootWidth=C.width,a.rootHeight=C.height,t.value.resize()}},b=C=>l("scale",C),x=C=>l("update:show",C),S=()=>{Ge(e.beforeClose,{args:[a.active],done:()=>x(!1)})},o=C=>{C!==a.active&&(a.active=C,l("change",C))},m=()=>{if(e.showIndex)return c("div",{class:ne("index")},[s.index?s.index({index:a.active}):"".concat(a.active+1," / ").concat(e.images.length)])},n=()=>{if(s.cover)return c("div",{class:ne("cover")},[s.cover()])},g=()=>{a.disableZoom=!0},i=()=>{a.disableZoom=!1},_=()=>c(Ot,{ref:t,lazyRender:!0,loop:e.loop,class:ne("swipe"),vertical:e.vertical,duration:e.swipeDuration,initialSwipe:e.startPosition,showIndicators:e.showIndicators,indicatorColor:"white",onChange:o,onDragEnd:i,onDragStart:g},{default:()=>[e.images.map((C,A)=>c(Jt,{ref:y=>{A===a.active&&(r.value=y)},src:C,show:e.show,active:a.active,maxZoom:e.maxZoom,minZoom:e.minZoom,rootWidth:a.rootWidth,rootHeight:a.rootHeight,disableZoom:a.disableZoom,doubleScale:e.doubleScale,closeOnClickImage:e.closeOnClickImage,closeOnClickOverlay:e.closeOnClickOverlay,vertical:e.vertical,onScale:b,onClose:S,onLongPress:()=>l("longPress",{index:A})},{image:s.image}))]}),f=()=>{if(e.closeable)return c(J,{role:"button",name:e.closeIcon,class:[ne("close-icon",e.closeIconPosition),Ct],onClick:S},null)},z=()=>l("closed"),L=(C,A)=>{var y;return(y=t.value)==null?void 0:y.swipeTo(C,A)};return be({resetScale:()=>{var C;(C=r.value)==null||C.resetScale()},swipeTo:L}),we(w),N([Le,Fe],w),N(()=>e.startPosition,C=>o(+C)),N(()=>e.show,C=>{const{images:A,startPosition:y}=e;C?(o(+y),ce(()=>{w(),L(+y,{immediate:!0})})):l("close",{index:a.active,url:A[a.active]})}),()=>c(We,ue({class:[ne(),e.className],overlayClass:[ne("overlay"),e.overlayClass],onClosed:z,"onUpdate:show":x},se(e,Qt)),{default:()=>[f(),_(),m(),n()]})}});let Ce;const ta={loop:!0,images:[],maxZoom:3,minZoom:1/3,onScale:void 0,onClose:void 0,onChange:void 0,vertical:!1,teleport:"body",className:"",showIndex:!0,closeable:!1,closeIcon:"clear",transition:void 0,beforeClose:void 0,doubleScale:!0,overlayStyle:void 0,overlayClass:void 0,startPosition:0,swipeDuration:300,showIndicators:!1,closeOnPopstate:!0,closeOnClickOverlay:!0,closeIconPosition:"top-right"};function aa(){({instance:Ce}=Pt({setup(){const{state:e,toggle:l}=_t(),s=()=>{e.images=[]};return()=>c(lt,ue(e,{onClosed:s,"onUpdate:show":l}),null)}}))}const oa=(e,l=0)=>{if(Ne)return Ce||aa(),e=Array.isArray(e)?{images:e,startPosition:l}:e,Ce.open(de({},ta,e)),Ce};ae(lt);const[la,D,na]=K("uploader");function Ae(e,l){return new Promise(s=>{if(l==="file"){s();return}const t=new FileReader;t.onload=r=>{s(r.target.result)},l==="dataUrl"?t.readAsDataURL(e):l==="text"&&t.readAsText(e)})}function nt(e,l){return qe(e).some(s=>s.file?It(l)?l(s.file):s.file.size>+l:!1)}function ia(e,l){const s=[],t=[];return e.forEach(r=>{nt(r,l)?t.push(r):s.push(r)}),{valid:s,invalid:t}}const sa=/\.(jpeg|jpg|gif|png|svg|webp|jfif|bmp|dpg|avif)/i,ra=e=>sa.test(e);function it(e){return e.isImage?!0:e.file&&e.file.type?e.file.type.indexOf("image")===0:e.url?ra(e.url):typeof e.content=="string"?e.content.indexOf("data:image")===0:!1}var ca=W({props:{name:Z,item:ie(Object),index:Number,imageFit:String,lazyLoad:Boolean,deletable:Boolean,reupload:Boolean,previewSize:[Number,String,Array],beforeDelete:Function},emits:["delete","preview","reupload"],setup(e,{emit:l,slots:s}){const t=()=>{const{status:o,message:m}=e.item;if(o==="uploading"||o==="failed"){const n=o==="failed"?c(J,{name:"close",class:D("mask-icon")},null):c(je,{class:D("loading")},null),g=Xe(m)&&m!=="";return c("div",{class:D("mask")},[n,g&&c("div",{class:D("mask-message")},[m])])}},r=o=>{const{name:m,item:n,index:g,beforeDelete:i}=e;o.stopPropagation(),Ge(i,{args:[n,{name:m,index:g}],done:()=>l("delete")})},a=()=>l("preview"),w=()=>l("reupload"),b=()=>{if(e.deletable&&e.item.status!=="uploading"){const o=s["preview-delete"];return c("div",{role:"button",class:D("preview-delete",{shadow:!o}),tabindex:0,"aria-label":na("delete"),onClick:r},[o?o():c(J,{name:"cross",class:D("preview-delete-icon")},null)])}},x=()=>{if(s["preview-cover"]){const{index:o,item:m}=e;return c("div",{class:D("preview-cover")},[s["preview-cover"](de({index:o},m))])}},S=()=>{const{item:o,lazyLoad:m,imageFit:n,previewSize:g,reupload:i}=e;return it(o)?c(ot,{fit:n,src:o.objectUrl||o.content||o.url,class:D("preview-image"),width:Array.isArray(g)?g[0]:g,height:Array.isArray(g)?g[1]:g,lazyLoad:m,onClick:i?w:a},{default:x}):c("div",{class:D("file"),style:Je(e.previewSize)},[c(J,{class:D("file-icon"),name:"description"},null),c("div",{class:[D("file-name"),"van-ellipsis"]},[o.file?o.file.name:o.url]),x()])};return()=>c("div",{class:D("preview")},[S(),t(),b()])}});const ua={name:G(""),accept:q("image/*"),capture:String,multiple:Boolean,disabled:Boolean,readonly:Boolean,lazyLoad:Boolean,maxCount:G(1/0),imageFit:q("cover"),resultType:q("dataUrl"),uploadIcon:q("photograph"),uploadText:String,deletable:V,reupload:Boolean,afterRead:Function,showUpload:V,modelValue:He(),beforeRead:Function,beforeDelete:Function,previewSize:[Number,String,Array],previewImage:V,previewOptions:Object,previewFullImage:V,maxSize:{type:[Number,String,Function],default:1/0}};var da=W({name:la,props:ua,emits:["delete","oversize","clickUpload","closePreview","clickPreview","clickReupload","update:modelValue"],setup(e,{emit:l,slots:s}){const t=T(),r=[],a=T(-1),w=T(!1),b=(d=e.modelValue.length)=>({name:e.name,index:d}),x=()=>{t.value&&(t.value.value="")},S=d=>{if(x(),nt(d,e.maxSize))if(Array.isArray(d)){const k=ia(d,e.maxSize);if(d=k.valid,l("oversize",k.invalid,b()),!d.length)return}else{l("oversize",d,b());return}if(d=he(d),a.value>-1){const k=[...e.modelValue];k.splice(a.value,1,d),l("update:modelValue",k),a.value=-1}else l("update:modelValue",[...e.modelValue,...qe(d)]);e.afterRead&&e.afterRead(d,b())},o=d=>{const{maxCount:k,modelValue:$,resultType:I}=e;if(Array.isArray(d)){const E=+k-$.length;d.length>E&&(d=d.slice(0,E)),Promise.all(d.map(U=>Ae(U,I))).then(U=>{const ee=d.map((te,u)=>{const h={file:te,status:"",message:"",objectUrl:URL.createObjectURL(te)};return U[u]&&(h.content=U[u]),h});S(ee)})}else Ae(d,I).then(E=>{const U={file:d,status:"",message:"",objectUrl:URL.createObjectURL(d)};E&&(U.content=E),S(U)})},m=d=>{const{files:k}=d.target;if(e.disabled||!k||!k.length)return;const $=k.length===1?k[0]:[].slice.call(k);if(e.beforeRead){const I=e.beforeRead($,b());if(!I){x();return}if(pt(I)){I.then(E=>{o(E||$)}).catch(x);return}}o($)};let n;const g=()=>l("closePreview"),i=d=>{if(e.previewFullImage){const k=e.modelValue.filter(it),$=k.map(I=>(I.objectUrl&&!I.url&&I.status!=="failed"&&(I.url=I.objectUrl,r.push(I.url)),I.url)).filter(Boolean);n=oa(de({images:$,startPosition:k.indexOf(d),onClose:g},e.previewOptions))}},_=()=>{n&&n.close()},f=(d,k)=>{const $=e.modelValue.slice(0);$.splice(k,1),l("update:modelValue",$),l("delete",d,b(k))},z=d=>{w.value=!0,a.value=d,ce(()=>Q())},L=()=>{w.value||(a.value=-1),w.value=!1},C=(d,k)=>{const $=["imageFit","deletable","reupload","previewSize","beforeDelete"],I=de(se(e,$),se(d,$,!0));return c(ca,ue({item:d,index:k,onClick:()=>l(e.reupload?"clickReupload":"clickPreview",d,b(k)),onDelete:()=>f(d,k),onPreview:()=>i(d),onReupload:()=>z(k)},se(e,["name","lazyLoad"]),I),se(s,["preview-cover","preview-delete"]))},A=()=>{if(e.previewImage)return e.modelValue.map(C)},y=d=>l("clickUpload",d),M=()=>{const d=e.modelValue.length<+e.maxCount,k=e.readonly?null:c("input",{ref:t,type:"file",class:D("input"),accept:e.accept,capture:e.capture,multiple:e.multiple&&a.value===-1,disabled:e.disabled,onChange:m,onClick:L},null);return s.default?Ie(c("div",{class:D("input-wrapper"),onClick:y},[s.default(),k]),[[ze,d]]):Ie(c("div",{class:D("upload",{readonly:e.readonly}),style:Je(e.previewSize),onClick:y},[c(J,{name:e.uploadIcon,class:D("upload-icon")},null),e.uploadText&&c("span",{class:D("upload-text")},[e.uploadText]),k]),[[ze,e.showUpload&&d]])},Q=()=>{t.value&&!e.disabled&&t.value.click()};return pe(()=>{r.forEach(d=>URL.revokeObjectURL(d))}),be({chooseFile:Q,reuploadFile:z,closeImagePreview:_}),Ye(()=>e.modelValue),()=>c("div",{class:D()},[c("div",{class:D("wrapper",{disabled:e.disabled})},[A(),M()])])}});const va=ae(da);const fa="/assets/upload-7e4bd949.png";const ma={class:"px-4 py-8"},ga={class:"text-2xl mb-1 font-semibold text-[#232323]"},ha={class:"w-[230px] mx-auto mb-24 relative"},wa=["src"],ba={class:"absolute z-10 -top-3 -right-3 rounded-full bg-black w-[25px] h-[25px]"},xa={class:"px-4 pt-[42px] flex flex-col h-full"},ya={key:0,class:"flex-1 overflow-y-auto"},Sa={__name:"ocr-upload",setup(e){const l=vt(),s=ft(),t=T([]),r=()=>{t.value=[]},a=()=>{Oe("文件大小不能超过7M")},w=T(null),b=g=>{Te({url:"/get_barcode",method:"post",data:g}).then(i=>{i.code===1&&(zt("识别成功"),t.value=[],w.value=null,n.value="",m.value=!1)})},x=g=>{const i=new FormData;i.append("file",t.value[0].file),g&&i.append("message",JSON.stringify(g)),s.query.type==="RFID吊牌"||!s.query.type||g?b(i):Te({url:"/get_matio_id",method:"post",data:i}).then(_=>{var f;+_.code==1&&(_.matio_list.length?(w.value=_,m.value=!0):((f=_.matio_list)==null?void 0:f.length)===0&&Oe("未识别到制单信息, 请确认吊牌类别选择是否正确"))})},S=()=>{const g={matio_id:n.value,image_origin_path:w.value.image_origin_path,upload_time:w.value.upload_timestamp,barcode_type:s.query.type||"RFID吊牌",barcode:w.value.barcode};x(g)},o=T(localStorage.getItem("user"));we(()=>{o.value||l.push("/login?redirect=/")});const m=T(!1),n=T("");return(g,i)=>{var A;const _=va,f=J,z=jt,L=Ft,C=We;return oe(),fe(xe,null,[F("div",ma,[F("h1",ga," OCR "+Re(mt(s).query.type||"RFID吊牌")+"识别 ",1),i[8]||(i[8]=F("p",{class:"text-sm/[24px] text-[#666666] mb-[76px]"},"让数据录入更精准,更高效",-1)),t.value.length?(oe(),fe(xe,{key:1},[F("div",ha,[F("img",{class:"w-full",src:(A=t.value[0])==null?void 0:A.content,alt:""},null,8,wa),F("div",ba,[c(f,{name:"cross",class:"!absolute top-1/2 left-[13.5px] -translate-x-1/2 -translate-y-1/2",color:"#fff",size:14,onClick:r})])]),F("div",{class:"h-[42px] text-sm/[42px] text-center text-white font-medium bg-[#AE8877] w-full",onClick:i[2]||(i[2]=y=>x(null))}," 确认上传 ")],64)):(oe(),fe(xe,{key:0},[i[7]||(i[7]=F("div",{class:"mb-[95px] py-[34px] flex flex-col items-center"},[F("img",{class:"block w-[120px] h-[120px]",src:fa,alt:""}),F("p",{class:"w-[182px] text-center text-[#999] text-xs"}," *支持PNG、JPG、JPEG等格式 图片大小不超过7M ")],-1)),c(_,{class:"w-full mb-2.5",modelValue:t.value,"onUpdate:modelValue":i[0]||(i[0]=y=>t.value=y),"preview-image":!1,"max-size":7*1024*1024,onOversize:a},{default:me(()=>i[5]||(i[5]=[F("div",{class:"h-[42px] text-sm/[42px] text-center text-white font-medium bg-[#AE8877] w-full"}," 图片上传 ",-1)])),_:1},8,["modelValue"]),c(_,{class:"w-full mb-2.5",modelValue:t.value,"onUpdate:modelValue":i[1]||(i[1]=y=>t.value=y),capture:"camera","preview-image":!1,"max-size":7*1024*1024,onOversize:a},{default:me(()=>i[6]||(i[6]=[F("div",{class:"h-[42px] text-sm/[42px] text-center text-[#AE8877] font-medium border border-[#AE8877]"}," 拍照上传 ",-1)])),_:1},8,["modelValue"])],64))]),c(C,{show:m.value,"onUpdate:show":i[4]||(i[4]=y=>m.value=y),position:"bottom",overlay:!1,duration:0,style:{height:"100%",width:"100%",maxWidth:"100%"}},{default:me(()=>[F("div",xa,[i[9]||(i[9]=F("h1",{class:"text-2xl mb-2 font-semibold text-[#232323]"},"制单选择",-1)),w.value?(oe(),fe("div",ya,[c(L,{modelValue:n.value,"onUpdate:modelValue":i[3]||(i[3]=y=>n.value=y),shape:"dot"},{default:me(()=>[(oe(!0),fe(xe,null,gt(w.value.matio_list,(y,M)=>(oe(),wt(z,{key:M,name:y},{default:me(()=>[bt(Re(y),1)]),_:2},1032,["name"]))),128))]),_:1},8,["modelValue"])])):ht("v-if",!0),F("div",{onClick:S,class:"mb-8 mt-4 h-[42px] text-sm/[42px] text-center text-white font-medium bg-[#AE8877] w-full"}," 确认选择 ")])]),_:1},8,["show"])],64)}}},_a=dt(Sa,[["__file","D:/Alushixing/2023/goelia-ocr/src/pages/ocr-upload.vue"]]);export{_a as default};