const e=require("../../_util/type.js"),t=require("../../config-provider/hooks/useConfigInject.js"),n=require("../../_util/transition.js"),r=require("../../tooltip/index.js"),i=require("../../progress/index.js");let a=require("vue"),o=require("@antsoo-lib/icons");var s=()=>({prefixCls:String,locale:e.objectType(void 0),file:e.objectType(),items:e.arrayType(),listType:e.stringType(),isImgUrl:e.functionType(),showRemoveIcon:e.booleanType(),showDownloadIcon:e.booleanType(),showPreviewIcon:e.booleanType(),removeIcon:e.functionType(),downloadIcon:e.functionType(),previewIcon:e.functionType(),iconRender:e.functionType(),actionIconRender:e.functionType(),itemRender:e.functionType(),onPreview:e.functionType(),onClose:e.functionType(),onDownload:e.functionType(),progress:e.objectType()}),c=(0,a.defineComponent)({compatConfig:{MODE:3},name:`ListItem`,inheritAttrs:!1,props:s(),setup(e,{slots:s,attrs:c}){let l=(0,a.shallowRef)(!1),u=(0,a.shallowRef)();(0,a.onMounted)(()=>{u.value=setTimeout(()=>{l.value=!0},300)}),(0,a.onBeforeUnmount)(()=>{clearTimeout(u.value)});let d=(0,a.shallowRef)(e.file?.status);(0,a.watch)(()=>e.file?.status,e=>{e!==`removed`&&(d.value=e)});let{rootPrefixCls:f}=t.default(`upload`,e),p=(0,a.computed)(()=>n.getTransitionProps(`${f.value}-fade`));return()=>{let{prefixCls:t,locale:n,listType:u,file:f,items:m,progress:h,iconRender:g=s.iconRender,actionIconRender:_=s.actionIconRender,itemRender:v=s.itemRender,isImgUrl:y,showPreviewIcon:b,showRemoveIcon:x,showDownloadIcon:S,previewIcon:C=s.previewIcon,removeIcon:w=s.removeIcon,downloadIcon:T=s.downloadIcon,onPreview:E,onDownload:D,onClose:O}=e,{class:k,style:A}=c,j=g({file:f}),M=(0,a.createVNode)(`div`,{class:`${t}-text-icon`},[j]);if(u===`picture`||u===`picture-card`)if(d.value===`uploading`||!f.thumbUrl&&!f.url)M=(0,a.createVNode)(`div`,{class:{[`${t}-list-item-thumbnail`]:!0,[`${t}-list-item-file`]:d.value!==`uploading`}},[j]);else{let e=y?.(f)?(0,a.createVNode)(`img`,{src:f.thumbUrl||f.url,alt:f.name,class:`${t}-list-item-image`,crossorigin:f.crossOrigin},null):j;M=(0,a.createVNode)(`a`,{class:{[`${t}-list-item-thumbnail`]:!0,[`${t}-list-item-file`]:y&&!y(f)},onClick:e=>E(f,e),href:f.url||f.thumbUrl,target:`_blank`,rel:`noopener noreferrer`},[e])}let N={[`${t}-list-item`]:!0,[`${t}-list-item-${d.value}`]:!0},P=typeof f.linkProps==`string`?JSON.parse(f.linkProps):f.linkProps,F=x?_({customIcon:w?w({file:f}):(0,a.createVNode)(o.DeleteOutlined,null,null),callback:()=>O(f),prefixCls:t,title:n.removeFile}):null,I=S&&d.value===`done`?_({customIcon:T?T({file:f}):(0,a.createVNode)(o.DownloadOutlined,null,null),callback:()=>D(f),prefixCls:t,title:n.downloadFile}):null,L=u!==`picture-card`&&(0,a.createVNode)(`span`,{key:`download-delete`,class:[`${t}-list-item-actions`,{picture:u===`picture`}]},[I,F]),R=`${t}-list-item-name`,z=f.url?[(0,a.createVNode)(`a`,{key:`view`,target:`_blank`,rel:`noopener noreferrer`,class:R,title:f.name,...P,href:f.url,onClick:e=>E(f,e)},[f.name]),L]:[(0,a.createVNode)(`span`,{key:`view`,class:R,onClick:e=>E(f,e),title:f.name},[f.name]),L],B=b?(0,a.createVNode)(`a`,{href:f.url||f.thumbUrl,target:`_blank`,rel:`noopener noreferrer`,style:f.url||f.thumbUrl?void 0:{pointerEvents:`none`,opacity:.5},onClick:e=>E(f,e),title:n.previewFile},[C?C({file:f}):(0,a.createVNode)(o.EyeOutlined,null,null)]):null,V=u===`picture-card`&&d.value!==`uploading`&&(0,a.createVNode)(`span`,{class:`${t}-list-item-actions`},[B,d.value===`done`&&I,F]),H=(0,a.createVNode)(`div`,{class:N},[M,z,V,l.value&&(0,a.createVNode)(a.Transition,p.value,{default:()=>[(0,a.withDirectives)((0,a.createVNode)(`div`,{class:`${t}-list-item-progress`},[`percent`in f?(0,a.createVNode)(i.default,{...h,type:`line`,percent:f.percent},null):null]),[[a.vShow,d.value===`uploading`]])]})]),U={[`${t}-list-item-container`]:!0,[`${k}`]:!!k},W=f.response&&typeof f.response==`string`?f.response:f.error?.statusText||f.error?.message||n.uploadError,G=d.value===`error`?(0,a.createVNode)(r.default,{title:W,getPopupContainer:e=>e.parentNode},{default:()=>[H]}):H;return(0,a.createVNode)(`div`,{class:U,style:A},[v?v({originNode:G,file:f,fileList:m,actions:{download:D.bind(null,f),preview:E.bind(null,f),remove:O.bind(null,f)}}):G])}}});exports.default=c,exports.listItemProps=s;