(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,237855,59101,773934,27808,33199,297162,e=>{"use strict";var t=e.i(377397),r=e.i(162115),i=e.i(869931),s=e.i(942347);e.i(816688);var o=e.i(675066),l=e.i(151094),a=e.i(648404),n=e.i(935139),d=e.i(391185);let c=/^(https?|ftp):\/\//;var u=e.i(471981),p=e.i(390622),m=e.i(220365),f=e.i(805735),h=e.i(893936),g=e.i(627897),y=e.i(734962),x=e.i(81828),b=e.i(128984),v=e.i(534011);let w=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0;return(0,v.create)(r=>({files:e?[...e]:[],setFiles:e=>{r({files:e}),t?.(e)}}))},j=(0,s.createContext)(null);function k(e){let t=(0,s.useContext)(j);if(!t)throw Error("Missing FileContext.Provider in the tree");return(0,v.useStore)(t,e)}let C=()=>(0,s.useContext)(j),N=e=>{let{children:t,value:i,onChange:o}=e,l=(0,s.useRef)(void 0);return l.current||(l.current=w(i,o)),(0,r.jsx)(j.Provider,{value:l.current,children:t})};e.s(["FileContextProvider",0,N,"useFileStore",0,C,"useStore",()=>k],59101);var _=e.i(223314);let S=e=>{let t=1024*Number(e?.image_file_size_limit)*1024||0xa00000,r=1024*Number(e?.file_size_limit)*1024||0xf00000,i=1024*Number(e?.audio_file_size_limit)*1024||0x3200000;return{imgSizeLimit:t,docSizeLimit:r,audioSizeLimit:i,videoSizeLimit:1024*Number(e?.video_file_size_limit)*1024||0x6400000,maxFileUploadLimit:Number(e?.workflow_file_upload_limit)||10}},F=function(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],{t:r}=(0,o.useTranslation)(),{notify:i}=(0,y.useToastContext)(),l=C(),n=(0,h.useParams)(),{imgSizeLimit:d,docSizeLimit:c,audioSizeLimit:u,videoSizeLimit:v}=S(e.fileUploadConfig),w=(0,s.useCallback)((e,t)=>{switch(e){case p.SupportUploadFileTypes.image:if(t>d)return i({type:"error",message:r("fileUploader.uploadFromComputerLimit",{ns:"common",type:p.SupportUploadFileTypes.image,size:(0,b.formatFileSize)(d)})}),!1;return!0;case p.SupportUploadFileTypes.custom:case p.SupportUploadFileTypes.document:if(t>c)return i({type:"error",message:r("fileUploader.uploadFromComputerLimit",{ns:"common",type:p.SupportUploadFileTypes.document,size:(0,b.formatFileSize)(c)})}),!1;return!0;case p.SupportUploadFileTypes.audio:if(t>u)return i({type:"error",message:r("fileUploader.uploadFromComputerLimit",{ns:"common",type:p.SupportUploadFileTypes.audio,size:(0,b.formatFileSize)(u)})}),!1;return!0;case p.SupportUploadFileTypes.video:if(t>v)return i({type:"error",message:r("fileUploader.uploadFromComputerLimit",{ns:"common",type:p.SupportUploadFileTypes.video,size:(0,b.formatFileSize)(v)})}),!1;return!0;default:return!0}},[u,c,d,i,r,v]),j=(0,s.useCallback)(e=>{let{files:t,setFiles:r}=l.getState();r((0,f.produce)(t,t=>{t.push(e)}))},[l]),k=(0,s.useCallback)(e=>{let{files:t,setFiles:r}=l.getState();r((0,f.produce)(t,t=>{let r=t.findIndex(t=>t.id===e.id);r>-1&&(t[r]=e)}))},[l]),N=(0,s.useCallback)(e=>{let{files:t,setFiles:r}=l.getState();r(t.filter(t=>t.id!==e))},[l]),F=(0,s.useCallback)(e=>{let{files:t,setFiles:s}=l.getState(),o=t.findIndex(t=>t.id===e);if(o>-1){let e=t[o];s((0,f.produce)(t,e=>{e[o].progress=0})),(0,_.fileUpload)({file:e.originalFile,onProgressCallback:t=>{k({...e,progress:t})},onSuccessCallback:t=>{k({...e,uploadedId:t.id,progress:100})},onErrorCallback:t=>{i({type:"error",message:(0,_.getFileUploadErrorMessage)(t,r("fileUploader.uploadFromComputerUploadError",{ns:"common"}),r)}),k({...e,progress:-1})}},!!n.token)}},[l,i,r,k,n]),T=(0,s.useCallback)(e=>{let t=setInterval(()=>{let r=l.getState().files.find(t=>t.id===e);r&&r.progress<80&&r.progress>=0?k({...r,progress:r.progress+20}):clearTimeout(t)},200)},[l,k]),L=(0,s.useCallback)(t=>{let s=e.allowed_file_types,o={id:(0,g.v4)(),name:t,type:"",size:0,progress:0,transferMethod:a.TransferMethod.remote_url,supportFileType:"",url:t,isRemote:!0};j(o),T(o.id),(0,x.uploadRemoteFileInfo)(t,!!n.token).then(t=>{let l={...o,type:t.mime_type,size:t.size,progress:100,supportFileType:(0,_.getSupportFileType)(t.name,t.mime_type,s?.includes(p.SupportUploadFileTypes.custom)),uploadedId:t.id,url:t.url};(0,_.isAllowedFileExtension)(t.name,t.mime_type,e.allowed_file_types||[],e.allowed_file_extensions||[])||(i({type:"error",message:`${r("fileUploader.fileExtensionNotSupport",{ns:"common"})} ${l.type}`}),N(o.id)),w(l.supportFileType,l.size)?k(l):N(o.id)}).catch(()=>{i({type:"error",message:r("fileUploader.pasteFileLinkInvalid",{ns:"common"})}),N(o.id)})},[w,j,k,i,r,N,e?.allowed_file_types,e.allowed_file_extensions,T,n.token]),z=(0,s.useCallback)(m.noop,[]),E=(0,s.useCallback)(m.noop,[]),U=(0,s.useCallback)(()=>{let{setFiles:e}=l.getState();e([])},[l]),P=(0,s.useCallback)(s=>{if(!t&&!e.enabled)return void i({type:"error",message:r("fileUploader.uploadDisabled",{ns:"common"})});if(!(0,_.isAllowedFileExtension)(s.name,s.type,e.allowed_file_types||[],e.allowed_file_extensions||[]))return void i({type:"error",message:`${r("fileUploader.fileExtensionNotSupport",{ns:"common"})} ${s.type}`});let o=e.allowed_file_types;if(!w((0,_.getSupportFileType)(s.name,s.type,o?.includes(p.SupportUploadFileTypes.custom)),s.size))return;let l=new FileReader,d=s.type.startsWith("image");l.addEventListener("load",()=>{let e={id:(0,g.v4)(),name:s.name,type:s.type,size:s.size,progress:0,transferMethod:a.TransferMethod.local_file,supportFileType:(0,_.getSupportFileType)(s.name,s.type,o?.includes(p.SupportUploadFileTypes.custom)),originalFile:s,base64Url:d?l.result:""};j(e),(0,_.fileUpload)({file:e.originalFile,onProgressCallback:t=>{k({...e,progress:t})},onSuccessCallback:t=>{k({...e,uploadedId:t.id,progress:100})},onErrorCallback:t=>{i({type:"error",message:(0,_.getFileUploadErrorMessage)(t,r("fileUploader.uploadFromComputerUploadError",{ns:"common"}),r)}),k({...e,progress:-1})}},!!n.token)},!1),l.addEventListener("error",()=>{i({type:"error",message:r("fileUploader.uploadFromComputerReadError",{ns:"common"})})},!1),l.readAsDataURL(s)},[t,w,i,r,j,k,n.token,e?.allowed_file_types,e?.allowed_file_extensions,e?.enabled]),R=(0,s.useCallback)(e=>{let t=e.clipboardData?.files[0],r=e.clipboardData?.getData("text/plain");t&&!r&&(e.preventDefault(),P(t))},[P]),[I,M]=(0,s.useState)(!1),W=(0,s.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),M(!0)},[]),O=(0,s.useCallback)(e=>{e.preventDefault(),e.stopPropagation()},[]),A=(0,s.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),M(!1)},[]),D=(0,s.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),M(!1);let t=e.dataTransfer.files[0];t&&P(t)},[P]);return{handleAddFile:j,handleUpdateFile:k,handleRemoveFile:N,handleReUploadFile:F,handleLoadFileFromLink:L,handleLoadFileFromLinkSuccess:z,handleLoadFileFromLinkError:E,handleClearFiles:U,handleLocalFileUpload:P,handleClipboardPasteFile:R,isDragActive:I,handleDragFileEnter:W,handleDragFileOver:O,handleDragFileLeave:A,handleDropFile:D}};e.s(["useFile",0,F,"useFileSizeLimit",0,S],773934);let T=e=>{let{fileConfig:t}=e,i=k(e=>e.files),{handleLocalFileUpload:s}=F(t),o=t.allowed_file_types,l=(o?.includes(p.SupportUploadFileTypes.custom)?t.allowed_file_extensions||[]:(o?.map(e=>u.FILE_EXTS[e])||[]).flat().map(e=>`.${e}`)).join(",");return(0,r.jsx)("input",{className:"absolute inset-0 block w-full cursor-pointer text-[0] opacity-0 disabled:cursor-not-allowed",onClick:e=>e.target.value="",type:"file",onChange:e=>{let r=e.target.files;if(r)if(t.number_limits)for(let e=0;e=t?.number_limits),multiple:!!t.number_limits&&t.number_limits>1})},L=(0,s.memo)(e=>{let{showFromLink:t=!0,showFromLocal:a=!0,trigger:u,fileConfig:p}=e,{t:m}=(0,o.useTranslation)(),f=k(e=>e.files),[h,g]=(0,s.useState)(!1),[y,x]=(0,s.useState)(""),[b,v]=(0,s.useState)(!1),{handleLoadFileFromLink:w}=F(p),j=!!p.number_limits&&f.length>=p.number_limits,C=m("fileUploader.pasteFileLinkInputPlaceholder",{ns:"common"});return(0,r.jsxs)(d.PortalToFollowElem,{placement:"top",offset:4,open:h,onOpenChange:g,children:[(0,r.jsx)(d.PortalToFollowElemTrigger,{onClick:()=>g(e=>!e),asChild:!0,children:u(h)}),(0,r.jsx)(d.PortalToFollowElemContent,{className:"z-[1001]",children:(0,r.jsxs)("div",{className:"w-[280px] rounded-xl border-[0.5px] border-components-panel-border bg-components-panel-bg-blur p-3 shadow-lg",children:[t&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:(0,n.cn)("flex h-8 items-center rounded-lg border border-components-input-border-active bg-components-input-bg-active p-1 shadow-xs",b&&"border-components-input-border-destructive"),children:[(0,r.jsx)("input",{className:"mr-0.5 block grow appearance-none bg-transparent px-1 outline-none system-sm-regular",placeholder:C||"",value:y,onChange:e=>{v(!1),x(e.target.value.trim())},disabled:j}),(0,r.jsx)(l.default,{className:"shrink-0",size:"small",variant:"primary",disabled:!y||j,onClick:()=>{if(y){if(!c.test(y))return void v(!0);w(y),x("")}},children:m("operation.ok",{ns:"common"})})]}),b&&(0,r.jsx)("div",{className:"mt-0.5 text-text-destructive body-xs-regular",children:m("fileUploader.pasteFileLinkInvalid",{ns:"common"})})]}),t&&a&&(0,r.jsxs)("div",{className:"flex h-7 items-center p-2 text-text-quaternary system-2xs-medium-uppercase",children:[(0,r.jsx)("div",{className:"mr-2 h-px w-[93px] bg-gradient-to-l from-[rgba(16,24,40,0.08)]"}),"OR",(0,r.jsx)("div",{className:"ml-2 h-px w-[93px] bg-gradient-to-r from-[rgba(16,24,40,0.08)]"})]}),a&&(0,r.jsxs)(l.default,{className:"relative w-full",variant:"secondary-accent",disabled:j,children:[(0,r.jsx)(i.RiUploadCloud2Line,{className:"mr-1 h-4 w-4"}),m("fileUploader.uploadFromComputer",{ns:"common"}),(0,r.jsx)(T,{fileConfig:p})]})]})})]})});var z=e.i(387124);let E=e=>{let{isDisabled:t,fileConfig:d}=e,{t:c}=(0,o.useTranslation)(),u=k(e=>e.files),{handleRemoveFile:p,handleReUploadFile:m}=F(d),f=[{value:a.TransferMethod.local_file,label:c("fileUploader.uploadFromComputer",{ns:"common"}),icon:(0,r.jsx)(i.RiUploadCloud2Line,{className:"h-4 w-4"})},{value:a.TransferMethod.remote_url,label:c("fileUploader.pasteFileLink",{ns:"common"}),icon:(0,r.jsx)(i.RiLink,{className:"h-4 w-4"})}],h=(0,s.useCallback)((e,t)=>(0,r.jsxs)(l.default,{variant:"tertiary",className:(0,n.cn)("relative grow",t&&"bg-components-button-tertiary-bg-hover"),disabled:!!(d.number_limits&&u.length>=d.number_limits),children:[e.icon,(0,r.jsx)("span",{className:"ml-1",children:e.label}),e.value===a.TransferMethod.local_file&&(0,r.jsx)(T,{fileConfig:d})]},e.value),[d,u.length]),g=(0,s.useCallback)(e=>t=>h(e,t),[h]),y=(0,s.useCallback)(e=>e.value===a.TransferMethod.local_file&&d?.allowed_file_upload_methods?.includes(a.TransferMethod.local_file)?h(e):e.value===a.TransferMethod.remote_url&&d?.allowed_file_upload_methods?.includes(a.TransferMethod.remote_url)?(0,r.jsx)(L,{showFromLocal:!1,trigger:g(e),fileConfig:d},e.value):void 0,[h,g,d]);return(0,r.jsxs)("div",{children:[!t&&(0,r.jsx)("div",{className:"flex items-center space-x-1",children:f.map(y)}),(0,r.jsx)("div",{className:"mt-1 space-y-1",children:u.map(e=>(0,r.jsx)(z.default,{file:e,showDeleteAction:!t,showDownloadAction:!1,onRemove:()=>p(e.id),onReUpload:()=>m(e.id),canPreview:d.preview_config?.file_type_list?.includes(e.type),previewMode:d.preview_config?.mode},e.id))})]})};e.s(["default",0,e=>{let{value:t,onChange:i,fileConfig:s,isDisabled:o}=e;return(0,r.jsx)(N,{value:t,onChange:i,children:(0,r.jsx)(E,{isDisabled:o,fileConfig:s})})}],27808);var U=e.i(654313);let P=(0,s.memo)(e=>{let{fileConfig:t,readonly:o}=e,l=(0,s.useCallback)(e=>(0,r.jsx)(U.default,{size:"l",className:(0,n.cn)(e&&"bg-state-base-hover"),disabled:o,children:(0,r.jsx)(i.RiAttachmentLine,{className:"h-5 w-5"})}),[]);return o?l(!1):(0,r.jsx)(L,{trigger:l,fileConfig:t,showFromLocal:t?.allowed_file_upload_methods?.includes(a.TransferMethod.local_file),showFromLink:t?.allowed_file_upload_methods?.includes(a.TransferMethod.remote_url)})});e.s(["default",0,P],33199);var R=e.i(939050),I=e.i(593706);let M=e=>{let{url:t,title:i,onCancel:s}=e;return(0,I.useHotkeys)("esc",s),(0,R.createPortal)((0,r.jsxs)("div",{className:"fixed inset-0 z-[1000] flex items-center justify-center bg-black/80 p-8",onClick:e=>e.stopPropagation(),tabIndex:-1,children:[(0,r.jsx)("div",{children:(0,r.jsx)("audio",{controls:!0,title:i,autoPlay:!1,preload:"metadata",children:(0,r.jsx)("source",{type:"audio/mpeg",src:t,className:"max-h-full max-w-full"})})}),(0,r.jsx)("div",{className:"absolute right-6 top-6 flex h-8 w-8 cursor-pointer items-center justify-center rounded-lg bg-white/[0.08] backdrop-blur-[2px]",onClick:s,children:(0,r.jsx)("span",{className:"i-ri-close-line h-4 w-4 text-gray-500","data-testid":"close-btn"})})]}),document.body)},W=(0,e.i(266557).default)(()=>e.A(201201),{loadableGenerated:{modules:[661305]},ssr:!1}),O=e=>{let{url:t,title:i,onCancel:s}=e;return(0,I.useHotkeys)("esc",s),(0,R.createPortal)((0,r.jsxs)("div",{className:"fixed inset-0 z-[1000] flex items-center justify-center bg-black/80 p-8",onClick:e=>e.stopPropagation(),tabIndex:-1,children:[(0,r.jsx)("div",{children:(0,r.jsx)("video",{controls:!0,title:i,autoPlay:!1,preload:"metadata",children:(0,r.jsx)("source",{type:"video/mp4",src:t,className:"max-h-full max-w-full"})})}),(0,r.jsx)("div",{className:"absolute right-6 top-6 flex h-8 w-8 cursor-pointer items-center justify-center rounded-lg bg-white/[0.08] backdrop-blur-[2px]",onClick:s,children:(0,r.jsx)("span",{className:"i-ri-close-line h-4 w-4 text-gray-500","data-testid":"video-preview-close-btn"})})]}),document.body)};var A=e.i(584186),D=e.i(618403);let $=e=>{let{file:i,showDeleteAction:o,showDownloadAction:a=!0,onRemove:d,onReUpload:c,canPreview:u}=e,{id:p,name:m,type:f,progress:h,url:g,base64Url:y,isRemote:x}=i,[v,w]=(0,s.useState)(""),j=(0,_.getFileExtension)(m,f,x),k=-1===h,C=g||y;!C&&i?.originalFile&&(C=URL.createObjectURL(i.originalFile.slice()).toString());let N=g?`${g}&as_attachment=true`:y;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:(0,n.cn)("group/file-item relative h-[68px] w-[144px] rounded-lg border-[0.5px] border-components-panel-border bg-components-card-bg p-2 shadow-xs",!k&&"hover:bg-components-card-bg-alt",k&&"border border-state-destructive-border bg-state-destructive-hover",k&&"bg-state-destructive-hover-alt hover:border-[0.5px] hover:border-state-destructive-border"),children:[o&&(0,r.jsx)(l.default,{className:"absolute -right-1.5 -top-1.5 z-[11] hidden h-5 w-5 rounded-full p-0 group-hover/file-item:flex",onClick:()=>d?.(p),"data-testid":"delete-button",children:(0,r.jsx)("span",{className:"i-ri-close-line h-4 w-4 text-components-button-secondary-text"})}),(0,r.jsx)("div",{className:"mb-1 line-clamp-2 h-8 cursor-pointer break-all text-text-tertiary system-xs-medium",title:m,onClick:()=>u&&w(C||""),children:m}),(0,r.jsxs)("div",{className:"relative flex items-center justify-between",children:[(0,r.jsxs)("div",{className:"flex items-center text-text-tertiary system-2xs-medium-uppercase",children:[(0,r.jsx)(t.default,{size:"sm",type:(0,_.getFileAppearanceType)(m,f),className:"mr-1"}),j&&(0,r.jsxs)(r.Fragment,{children:[j,(0,r.jsx)("div",{className:"mx-1",children:"·"})]}),!!i.size&&(0,b.formatFileSize)(i.size)]}),a&&N&&(0,r.jsx)(U.default,{size:"m",className:"absolute -right-1 -top-1 hidden group-hover/file-item:flex",onClick:e=>{e.stopPropagation(),(0,D.downloadUrl)({url:N||"",fileName:m,target:"_blank"})},"data-testid":"download-button",children:(0,r.jsx)("span",{className:"i-ri-download-line h-3.5 w-3.5 text-text-tertiary"})}),h>=0&&!(0,_.fileIsUploaded)(i)&&(0,r.jsx)(A.default,{percentage:h,size:12,className:"shrink-0"}),k&&(0,r.jsx)("span",{className:"i-custom-vender-other-replay-line h-4 w-4 cursor-pointer text-text-tertiary",onClick:()=>c?.(p),"data-testid":"replay-icon",role:"button",tabIndex:0})]})]}),"audio"===f.split("/")[0]&&u&&v&&(0,r.jsx)(M,{title:m,url:v,onCancel:()=>w("")}),"video"===f.split("/")[0]&&u&&v&&(0,r.jsx)(O,{title:m,url:v,onCancel:()=>w("")}),"pdf"===f.split("/")[1]&&u&&v&&(0,r.jsx)(W,{url:v,onCancel:()=>{w("")}})]})};e.i(36860);var K=e.i(47481),H=e.i(998020),q=e.i(357e3);let B=e=>{let{file:t,showDeleteAction:o,showDownloadAction:a,canPreview:n,onRemove:d,onReUpload:c}=e,{id:u,progress:p,base64Url:m,url:f,name:h}=t,[g,y]=(0,s.useState)(""),x=f?`${f}&as_attachment=true`:m;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"group/file-image relative cursor-pointer",onClick:()=>n&&y(m||f||""),children:[o&&(0,r.jsx)(l.default,{className:"absolute -right-1.5 -top-1.5 z-[11] hidden h-5 w-5 rounded-full p-0 group-hover/file-image:flex",onClick:()=>d?.(u),children:(0,r.jsx)(i.RiCloseLine,{className:"h-4 w-4 text-components-button-secondary-text"})}),(0,r.jsx)(q.default,{className:"h-[68px] w-[68px] shadow-md",imageUrl:m||f||"",showDownloadAction:a}),p>=0&&!(0,_.fileIsUploaded)(t)&&(0,r.jsx)("div",{className:"absolute inset-0 z-10 flex items-center justify-center border-[2px] border-effects-image-frame bg-background-overlay-alt",children:(0,r.jsx)(A.default,{percentage:p,size:12,circleStrokeColor:"stroke-components-progress-white-border",circleFillColor:"fill-transparent",sectorFillColor:"fill-components-progress-white-progress"})}),-1===p&&(0,r.jsx)("div",{className:"absolute inset-0 z-10 flex items-center justify-center border-[2px] border-state-destructive-border bg-background-overlay-destructive",children:(0,r.jsx)(K.ReplayLine,{className:"h-5 w-5",onClick:()=>c?.(u)})}),a&&(0,r.jsx)("div",{className:"absolute inset-0.5 z-10 hidden bg-background-overlay-alt bg-opacity-[0.3] group-hover/file-image:block",children:(0,r.jsx)("div",{className:"absolute bottom-0.5 right-0.5 flex h-6 w-6 items-center justify-center rounded-lg bg-components-actionbar-bg shadow-md",onClick:e=>{e.stopPropagation(),(0,D.downloadUrl)({url:x||"",fileName:h,target:"_blank"})},children:(0,r.jsx)(i.RiDownloadLine,{className:"h-4 w-4 text-text-tertiary"})})})]}),g&&n&&(0,r.jsx)(H.default,{title:h,url:g,onCancel:()=>y("")})]})},Y=e=>{let{className:t,files:i,onReUpload:s,onRemove:o,showDeleteAction:l=!0,showDownloadAction:a=!1,canPreview:d=!0}=e;return(0,r.jsx)("div",{className:(0,n.cn)("flex flex-wrap gap-2",t),"data-testid":"file-list",children:i.map(e=>e.supportFileType===p.SupportUploadFileTypes.image?(0,r.jsx)(B,{file:e,showDeleteAction:l,showDownloadAction:a,onRemove:o,onReUpload:s,canPreview:d},e.id):(0,r.jsx)($,{file:e,showDeleteAction:l,showDownloadAction:a,onRemove:o,onReUpload:s,canPreview:d},e.id))})};e.s(["FileList",0,Y,"FileListInChatInput",0,e=>{let{fileConfig:t}=e,i=k(e=>e.files),{handleRemoveFile:s,handleReUploadFile:o}=F(t);return(0,r.jsx)(Y,{files:i,onReUpload:o,onRemove:s})}],297162),e.s([],237855)},149625,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;ttypeof window&&!!window.navigator&&/MSIE |Trident\/|Edge\//.test(window.navigator.userAgent),m=function(){return p?"_"+Math.random().toString(36).substr(2,12):void 0},f=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function, not "+typeof e);function t(e){if(!(this instanceof t))throw TypeError("Cannot call a class as a function");var r=function(e,t){if(!e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&("object"==typeof t||"function"==typeof t)?t:e}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r.inputRef=function(e){r.input=e,"function"==typeof r.props.inputRef&&r.props.inputRef(e)},r.placeHolderSizerRef=function(e){r.placeHolderSizer=e},r.sizerRef=function(e){r.sizer=e},r.state={inputWidth:e.minWidth,inputId:e.id||m(),prevId:e.id},r}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e),s(t,null,[{key:"getDerivedStateFromProps",value:function(e,t){var r=e.id;return r!==t.prevId?{inputId:r||m(),prevId:r}:null}}]),s(t,[{key:"componentDidMount",value:function(){this.mounted=!0,this.copyInputStyles(),this.updateInputWidth()}},{key:"componentDidUpdate",value:function(e,t){t.inputWidth!==this.state.inputWidth&&"function"==typeof this.props.onAutosize&&this.props.onAutosize(this.state.inputWidth),this.updateInputWidth()}},{key:"componentWillUnmount",value:function(){this.mounted=!1}},{key:"copyInputStyles",value:function(){if(this.mounted&&window.getComputedStyle){var e=this.input&&window.getComputedStyle(this.input);e&&(u(e,this.sizer),this.placeHolderSizer&&u(e,this.placeHolderSizer))}}},{key:"updateInputWidth",value:function(){if(this.mounted&&this.sizer&&void 0!==this.sizer.scrollWidth){var e=void 0;(e=(this.props.placeholder&&(!this.props.value||this.props.value&&this.props.placeholderIsMinWidth)?Math.max(this.sizer.scrollWidth,this.placeHolderSizer.scrollWidth)+2:this.sizer.scrollWidth+2)+("number"===this.props.type&&void 0===this.props.extraWidth?16:parseInt(this.props.extraWidth)||0))=0)&&Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i]);return r}(this.props,[]);return c.forEach(function(e){return delete s[e]}),s.className=this.props.inputClassName,s.id=this.state.inputId,s.style=r,l.default.createElement("div",{className:this.props.className,style:t},this.renderStyles(),l.default.createElement("input",i({},s,{ref:this.inputRef})),l.default.createElement("div",{ref:this.sizerRef,style:d},e),this.props.placeholder?l.default.createElement("div",{ref:this.placeHolderSizerRef,style:d},this.props.placeholder):null)}}]),t}(o.Component);f.propTypes={className:a.default.string,defaultValue:a.default.any,extraWidth:a.default.oneOfType([a.default.number,a.default.string]),id:a.default.string,injectStyles:a.default.bool,inputClassName:a.default.string,inputRef:a.default.func,inputStyle:a.default.object,minWidth:a.default.oneOfType([a.default.number,a.default.string]),onAutosize:a.default.func,onChange:a.default.func,placeholder:a.default.string,placeholderIsMinWidth:a.default.bool,style:a.default.object,value:a.default.any},f.defaultProps={minWidth:1,injectStyles:!0},r.default=f},522977,e=>{"use strict";var t=e.i(162115),r=e.i(942347),i=e.i(149625);e.i(816688);var s=e.i(675066),o=e.i(734962),l=e.i(935139);e.s(["default",0,e=>{let{items:a,onChange:n,disableAdd:d,disableRemove:c,customizedConfirmKey:u="Enter",isInWorkflow:p,placeholder:m,required:f=!1,inputClassName:h}=e,{t:g}=(0,s.useTranslation)(),{notify:y}=(0,o.useToastContext)(),[x,b]=(0,r.useState)(""),[v,w]=(0,r.useState)(!1),j="Tab"===u,k=(0,r.useCallback)(e=>{let t=e.trim();if(!t){f&&y({type:"error",message:g("segment.keywordEmpty",{ns:"datasetDocuments"})});return}a.find(e=>e===t)?y({type:"error",message:g("segment.keywordDuplicate",{ns:"datasetDocuments"})}):t.length>20?y({type:"error",message:g("segment.keywordError",{ns:"datasetDocuments"})}):(n([...a,t]),setTimeout(()=>{b("")}))},[a,n,y,g,f]);return(0,t.jsxs)("div",{className:(0,l.cn)("flex flex-wrap",!p&&"min-w-[200px]",j?"rounded-lg bg-components-input-bg-normal pb-1 pl-1":""),children:[(a||[]).map((e,r)=>(0,t.jsxs)("div",{className:(0,l.cn)("mr-1 mt-1 flex items-center rounded-md border border-divider-deep bg-components-badge-white-to-dark py-1 pl-1.5 pr-1 text-text-secondary system-xs-regular"),children:[e,!c&&(0,t.jsx)("div",{className:"flex h-4 w-4 cursor-pointer items-center justify-center",onClick:()=>{let e;(e=[...a]).splice(r,1),n(e)},children:(0,t.jsx)("span",{className:"i-ri-close-line ml-0.5 h-3.5 w-3.5 text-text-tertiary","data-testid":"remove-tag"})})]},e)),!d&&(0,t.jsxs)("div",{className:(0,l.cn)("group/tag-add mt-1 flex items-center gap-x-0.5",j?"":"rounded-md border border-dashed border-divider-deep px-1.5"),children:[!j&&!v&&(0,t.jsx)("span",{className:"i-ri-add-line h-3.5 w-3.5 text-text-placeholder group-hover/tag-add:text-text-secondary"}),(0,t.jsx)(i.default,{inputClassName:(0,l.cn)("appearance-none text-text-primary caret-[#295EFF] outline-none placeholder:text-text-placeholder group-hover/tag-add:placeholder:text-text-secondary",j?"bg-transparent":"",h),className:(0,l.cn)(!p&&"max-w-[300px]",p&&"max-w-[146px]","overflow-hidden rounded-md py-1 system-xs-regular",j&&"border border-transparent px-1.5",v&&j&&"border-dashed border-divider-deep"),onFocus:()=>w(!0),onBlur:()=>{k(x),w(!1)},value:x,onChange:e=>{b(e.target.value)},onKeyDown:e=>{j&&"Enter"===e.key&&b(`${x}↵`),e.key===u&&(j&&e.preventDefault(),k(x))},placeholder:m||(j?g("model.params.stop_sequencesPlaceholder",{ns:"common"}):g("segment.addKeyWord",{ns:"datasetDocuments"}))})]})]})}])},35305,(e,t,r)=>{"use strict";t.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},561227,(e,t,r)=>{"use strict";var i=e.r(35305);function s(){}function o(){}o.resetWarningCache=s,t.exports=function(){function e(e,t,r,s,o,l){if(l!==i){var a=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw a.name="Invariant Violation",a}}function t(){return e}e.isRequired=e;var r={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:o,resetWarningCache:s};return r.PropTypes=r,r}},304153,(e,t,r)=>{t.exports=e.r(561227)()},593706,e=>{"use strict";var t=e.i(942347);e.i(162115);let r=["shift","alt","meta","mod","ctrl","control"],i={esc:"escape",return:"enter",left:"arrowleft",right:"arrowright",up:"arrowup",down:"arrowdown",ShiftLeft:"shift",ShiftRight:"shift",AltLeft:"alt",AltRight:"alt",MetaLeft:"meta",MetaRight:"meta",OSLeft:"meta",OSRight:"meta",ControlLeft:"ctrl",ControlRight:"ctrl"};function s(e){return(i[e.trim()]||e.trim()).toLowerCase().replace(/key|digit|numpad/,"")}function o(e){return r.includes(e)}function l(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:",";return e.toLowerCase().split(t)}function a(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"+",i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:">",o=arguments.length>3&&void 0!==arguments[3]&&arguments[3],l=arguments.length>4?arguments[4]:void 0,a=arguments.length>5?arguments[5]:void 0,n=[],d=!1;(e=e.trim()).includes(i)?(d=!0,n=e.toLocaleLowerCase().split(i).map(e=>s(e))):n=e.toLocaleLowerCase().split(t).map(e=>s(e));let c={alt:n.includes("alt"),ctrl:n.includes("ctrl")||n.includes("control"),shift:n.includes("shift"),meta:n.includes("meta"),mod:n.includes("mod"),useKey:o},u=n.filter(e=>!r.includes(e));return{...c,keys:u,description:l,isSequence:d,hotkey:e,metadata:a}}"u">typeof document&&(document.addEventListener("keydown",e=>{void 0!==e.code&&c([s(e.code)])}),document.addEventListener("keyup",e=>{void 0!==e.code&&u([s(e.code)])})),"u">typeof window&&(window.addEventListener("blur",()=>{n.clear()}),window.addEventListener("contextmenu",()=>{setTimeout(()=>{n.clear()},0)}));let n=new Set;function d(e){return Array.isArray(e)}function c(e){let t=Array.isArray(e)?e:[e];n.has("meta")&&n.forEach(e=>{o(e)||n.delete(e.toLowerCase())}),t.forEach(e=>{n.add(e.toLowerCase())})}function u(e){let t=Array.isArray(e)?e:[e];"meta"===e?n.clear():t.forEach(e=>{n.delete(e.toLowerCase())})}let p=["input","textarea","select","searchbox","slider","spinbutton","menuitem","menuitemcheckbox","menuitemradio","option","radio","textbox"];function m(e){var t;let r,i,s=arguments.length>1&&void 0!==arguments[1]&&arguments[1],{target:o,composed:l}=e;return(t=o).tagName&&!t.tagName.startsWith("-")&&t.tagName.includes("-")&&l?(r=e.composedPath()[0]&&e.composedPath()[0].tagName,i=e.composedPath()[0]&&e.composedPath()[0].role):(r=o&&o.tagName,i=o&&o.role),d(s)?!!(r&&s&&s.some(e=>e.toLowerCase()===r.toLowerCase()||e===i)):!!(r&&s&&s)}let f=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],{alt:i,meta:o,mod:l,shift:a,ctrl:c,keys:u,useKey:p}=t,{code:m,key:f,ctrlKey:h,metaKey:g,shiftKey:y,altKey:x}=e,b=s(m);if(p&&u?.length===1&&u.includes(f.toLowerCase()))return!0;if(!u?.includes(b)&&!["ctrl","control","unknown","meta","alt","shift","os"].includes(b))return!1;if(!r){if(i!==x&&"alt"!==b||a!==y&&"shift"!==b)return!1;if(l){if(!g&&!h)return!1}else if(o!==g&&"meta"!==b&&"os"!==b||c!==h&&"ctrl"!==b&&"control"!==b)return!1}return!!(u&&1===u.length&&u.includes(b))||(u&&u.length>0?!!u.includes(b)&&function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:",";return(d(e)?e:e.split(t)).every(e=>n.has(e.trim().toLowerCase()))}(u):!u||0===u.length)},h=(0,t.createContext)(void 0),g=(0,t.createContext)({hotkeys:[],activeScopes:[],toggleScope:()=>{},enableScope:()=>{},disableScope:()=>{}}),y=e=>{e.stopPropagation(),e.preventDefault(),e.stopImmediatePropagation()},x="u">typeof window?t.useLayoutEffect:t.useEffect;function b(e,r,i,n){let b,v=(0,t.useRef)(null),w=(0,t.useRef)(!1),j=Array.isArray(i)?Array.isArray(n)?void 0:n:i,k=d(e)?e.join(j?.delimiter):e,C=Array.isArray(i)?i:Array.isArray(n)?n:void 0,N=(0,t.useCallback)(r,C??[]),_=(0,t.useRef)(N);C?_.current=N:_.current=r;let S=(function e(t,r){return t&&r&&"object"==typeof t&&"object"==typeof r?Object.keys(t).length===Object.keys(r).length&&Object.keys(t).reduce((i,s)=>i&&e(t[s],r[s]),!0):t===r}((b=(0,t.useRef)(void 0)).current,j)||(b.current=j),b.current),{activeScopes:F}=(0,t.useContext)(g),T=(0,t.useContext)(h);return x(()=>{var e;if(S?.enabled===!1||(e=S?.scopes,!((0!==F.length||!e)&&(!e||F.some(t=>e.includes(t))||F.includes("*")))))return;let t=[],r,i=function(e){let i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!(m(e,p)&&!m(e,S?.enableOnFormTags))){if(null!==v.current){let t=v.current.getRootNode();if((t instanceof Document||t instanceof ShadowRoot)&&t.activeElement!==v.current&&!v.current.contains(t.activeElement))return void y(e)}e.target?.isContentEditable&&!S?.enableOnContentEditable||l(k,S?.delimiter).forEach(l=>{if(l.includes(S?.splitKey??"+")&&l.includes(S?.sequenceSplitKey??">"))return void console.warn(`Hotkey ${l} contains both ${S?.splitKey??"+"} and ${S?.sequenceSplitKey??">"} which is not supported.`);let n=a(l,S?.splitKey,S?.sequenceSplitKey,S?.useKey,S?.description,S?.metadata);if(n.isSequence){r=setTimeout(()=>{t=[]},S?.sequenceTimeoutMs??1e3);let i=n.useKey?e.key:s(e.code);if(o(i.toLowerCase()))return;if(t.push(i),i!==n.keys?.[t.length-1]){t=[],r&&clearTimeout(r);return}t.length===n.keys?.length&&(_.current(e,n),r&&clearTimeout(r),t=[])}else if(f(e,n,S?.ignoreModifiers)||n.keys?.includes("*")){var d,c;if(S?.ignoreEventWhen?.(e)||i&&w.current)return;if(("function"==typeof(d=S?.preventDefault)&&d(e,n)||!0===d)&&e.preventDefault(),"function"==typeof(c=S?.enabled)?!c(e,n):!0!==c&&void 0!==c)return void y(e);_.current(e,n),i||(w.current=!0)}})}},n=e=>{void 0!==e.code&&(c(s(e.code)),(S?.keydown===void 0&&S?.keyup!==!0||S?.keydown)&&i(e))},d=e=>{void 0!==e.code&&(u(s(e.code)),w.current=!1,S?.keyup&&i(e,!0))},h=v.current||j?.document||document;return h.addEventListener("keyup",d,j?.eventListenerOptions),h.addEventListener("keydown",n,j?.eventListenerOptions),T&&l(k,S?.delimiter).forEach(e=>{T.addHotkey(a(e,S?.splitKey,S?.sequenceSplitKey,S?.useKey,S?.description,S?.metadata))}),()=>{h.removeEventListener("keyup",d,j?.eventListenerOptions),h.removeEventListener("keydown",n,j?.eventListenerOptions),T&&l(k,S?.delimiter).forEach(e=>{T.removeHotkey(a(e,S?.splitKey,S?.sequenceSplitKey,S?.useKey,S?.description,S?.metadata))}),t=[],r&&clearTimeout(r)}},[k,S,F]),v}e.s(["useHotkeys",()=>b])},998020,e=>{"use strict";var t=e.i(162115),r=e.i(220365),i=e.i(123980),s=e.i(942347),o=e.i(939050),l=e.i(593706),a=e.i(137667),n=e.i(421001),d=e.i(618403);e.s(["default",0,e=>{let{url:c,title:u,onCancel:p,onPrev:m,onNext:f}=e,[h,g]=(0,s.useState)(1),[y,x]=(0,s.useState)({x:0,y:0}),[b,v]=(0,s.useState)(!1),w=(0,s.useRef)(null),j=(0,s.useRef)({x:0,y:0}),[k,C]=(0,s.useState)(!1),N=()=>{g(e=>Math.min(1.2*e,15))},_=()=>{g(e=>{let t=Math.max(e/1.2,.5);return 1===t&&x({x:0,y:0}),t})},S=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"image/png",r=atob(e),i=[];for(let e=0;e{(async()=>{try{let e=c.split(",")[1],t=S(e,"image/png");await navigator.clipboard.write([new ClipboardItem({[t.type]:t})]),C(!0),a.default.notify({type:"success",message:(0,i.t)("operation.imageCopied",{ns:"common"})})}catch(e){console.error("Failed to copy image:",e),(0,d.downloadUrl)({url:c,fileName:`${u}.png`}),a.default.notify({type:"info",message:(0,i.t)("operation.imageDownloaded",{ns:"common"})})}})()},[u,c]),T=(0,s.useCallback)(e=>{e.deltaY<0?N():_()},[]),L=(0,s.useCallback)(e=>{h>1&&(v(!0),j.current={x:e.clientX-y.x,y:e.clientY-y.y})},[h,y]),z=(0,s.useCallback)(e=>{if(b&&h>1){let t=e.clientX-j.current.x,r=e.clientY-j.current.y,i=w.current?.getBoundingClientRect(),s=w.current?.parentElement?.getBoundingClientRect();if(i&&s){let e=(i.width*h-s.width)/2,o=(i.height*h-s.height)/2;x({x:Math.max(-e,Math.min(e,t)),y:Math.max(-o,Math.min(o,r))})}}},[b,h]),E=(0,s.useCallback)(()=>{v(!1)},[]);return(0,s.useEffect)(()=>(document.addEventListener("mouseup",E),()=>{document.removeEventListener("mouseup",E)}),[E]),(0,l.useHotkeys)("esc",p),(0,l.useHotkeys)("up",N),(0,l.useHotkeys)("down",_),(0,l.useHotkeys)("left",m||r.noop),(0,l.useHotkeys)("right",f||r.noop),(0,o.createPortal)((0,t.jsxs)("div",{className:"image-preview-container fixed inset-0 z-[1000] flex items-center justify-center bg-black/80 p-8",onClick:e=>e.stopPropagation(),onWheel:T,onMouseDown:L,onMouseMove:z,onMouseUp:E,style:{cursor:h>1?"move":"default"},tabIndex:-1,"data-testid":"image-preview-container",children:[(0,t.jsx)("img",{ref:w,alt:u,src:(e=>{try{return btoa(atob(e))===e}catch{return!1}})(c)?`data:image/png;base64,${c}`:c,className:"max-h-full max-w-full",style:{transform:`scale(${h}) translate(${y.x}px, ${y.y}px)`,transition:b?"none":"transform 0.2s ease-in-out"},"data-testid":"image-preview-image"}),(0,t.jsx)(n.default,{popupContent:(0,i.t)("operation.copyImage",{ns:"common"}),children:(0,t.jsx)("div",{className:"absolute right-48 top-6 flex h-8 w-8 cursor-pointer items-center justify-center rounded-lg",onClick:F,children:k?(0,t.jsx)("span",{className:"i-ri-file-copy-line h-4 w-4 text-green-500","data-testid":"image-preview-copied-icon"}):(0,t.jsx)("span",{className:"i-ri-file-copy-line h-4 w-4 text-gray-500","data-testid":"image-preview-copy-button"})})}),(0,t.jsx)(n.default,{popupContent:(0,i.t)("operation.zoomOut",{ns:"common"}),children:(0,t.jsx)("div",{className:"absolute right-40 top-6 flex h-8 w-8 cursor-pointer items-center justify-center rounded-lg",onClick:_,children:(0,t.jsx)("span",{className:"i-ri-zoom-out-line h-4 w-4 text-gray-500","data-testid":"image-preview-zoom-out-button"})})}),(0,t.jsx)(n.default,{popupContent:(0,i.t)("operation.zoomIn",{ns:"common"}),children:(0,t.jsx)("div",{className:"absolute right-32 top-6 flex h-8 w-8 cursor-pointer items-center justify-center rounded-lg",onClick:N,children:(0,t.jsx)("span",{className:"i-ri-zoom-in-line h-4 w-4 text-gray-500","data-testid":"image-preview-zoom-in-button"})})}),(0,t.jsx)(n.default,{popupContent:(0,i.t)("operation.download",{ns:"common"}),children:(0,t.jsx)("div",{className:"absolute right-24 top-6 flex h-8 w-8 cursor-pointer items-center justify-center rounded-lg",onClick:()=>{c.startsWith("http")||c.startsWith("https")||c.startsWith("data:image")?(0,d.downloadUrl)({url:c,fileName:u,target:"_blank"}):a.default.notify({type:"error",message:`Unable to open image: ${c}`})},children:(0,t.jsx)("span",{className:"i-ri-download-cloud-2-line h-4 w-4 text-gray-500","data-testid":"image-preview-download-button"})})}),(0,t.jsx)(n.default,{popupContent:(0,i.t)("operation.openInNewTab",{ns:"common"}),children:(0,t.jsx)("div",{className:"absolute right-16 top-6 flex h-8 w-8 cursor-pointer items-center justify-center rounded-lg",onClick:()=>{if(c.startsWith("http")||c.startsWith("https"))window.open(c,"_blank");else if(c.startsWith("data:image")){let e=window.open();e?.document.write(`${u}`)}else a.default.notify({type:"error",message:`Unable to open image: ${c}`})},children:(0,t.jsx)("span",{className:"i-ri-add-box-line h-4 w-4 text-gray-500","data-testid":"image-preview-open-in-tab-button"})})}),(0,t.jsx)(n.default,{popupContent:(0,i.t)("operation.cancel",{ns:"common"}),children:(0,t.jsx)("div",{className:"absolute right-6 top-6 flex h-8 w-8 cursor-pointer items-center justify-center rounded-lg bg-white/8 backdrop-blur-[2px]",onClick:p,children:(0,t.jsx)("span",{className:"i-ri-close-line h-4 w-4 text-gray-500","data-testid":"image-preview-close-button"})})})]}),document.body)}])},711284,e=>{"use strict";var t,r,i=((t={}).NewPage="new_page",t.CurrentPage="current_page",t),s=((r={}).moreLikeThis="moreLikeThis",r.opening="opening",r.suggested="suggested",r.text2speech="text2speech",r.speech2text="speech2text",r.citation="citation",r.moderation="moderation",r.file="file",r.annotationReply="annotationReply",r);e.s(["FeatureEnum",()=>s,"PreviewMode",()=>i])},47481,e=>{"use strict";var t=e.i(186571);e.s(["ReplayLine",()=>t.default])},584186,e=>{"use strict";var t=e.i(162115),r=e.i(942347),i=e.i(935139);let s=(0,r.memo)(e=>{let{className:r,percentage:s=0,size:o=12,circleStrokeWidth:l=1,circleStrokeColor:a="stroke-components-progress-brand-border",circleFillColor:n="fill-components-progress-brand-bg",sectorFillColor:d="fill-components-progress-brand-progress"}=e,c=o/2,u=o/2,p=s/101*360*Math.PI/180,m=u+c*Math.cos(p-Math.PI/2),f=u+c*Math.sin(p-Math.PI/2),h=` M ${u},${u} L ${u},${u-c} A ${c},${c} 0 ${+(s>50)} 1 ${m},${f} Z `;return(0,t.jsxs)("svg",{width:o+l,height:o+l,viewBox:`0 0 ${o+l} ${o+l}`,className:r,children:[(0,t.jsx)("circle",{className:(0,i.cn)(n,a),cx:u+l/2,cy:u+l/2,r:c,strokeWidth:l}),(0,t.jsx)("path",{className:(0,i.cn)(d),d:h,transform:`translate(${l/2}, ${l/2})`})]})});e.s(["default",0,s])},357e3,e=>{"use strict";var t=e.i(162115),r=e.i(935139);e.s(["default",0,e=>{let{imageUrl:i,className:s,alt:o,onLoad:l,onError:a,showDownloadAction:n}=e;return(0,t.jsx)("div",{className:(0,r.cn)("border-[2px] border-effects-image-frame shadow-xs",s),children:(0,t.jsx)("img",{className:(0,r.cn)("h-full w-full object-cover",n&&"cursor-pointer"),alt:o||"Preview",onLoad:l,onError:a,src:i})})}])},387124,e=>{"use strict";var t=e.i(162115),r=e.i(869931),i=e.i(942347),s=e.i(654313),o=e.i(711284);e.i(36860);var l=e.i(47481),a=e.i(998020),n=e.i(584186),d=e.i(390622),c=e.i(935139),u=e.i(618403),p=e.i(128984),m=e.i(357e3),f=e.i(377397),h=e.i(223314);let g=(0,i.memo)(e=>{let{file:g,showDeleteAction:y,showDownloadAction:x=!0,onRemove:b,onReUpload:v,canPreview:w,previewMode:j=o.PreviewMode.CurrentPage}=e,{id:k,name:C,type:N,progress:_,supportFileType:S,base64Url:F,url:T,isRemote:L}=g,z=(0,h.getFileExtension)(C,N,L),E=S===d.SupportUploadFileTypes.image,[U,P]=(0,i.useState)("");return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:(0,c.cn)("flex h-12 items-center rounded-lg border-[0.5px] border-components-panel-border bg-components-panel-on-panel-item-bg pr-3 shadow-xs",-1===_&&"border-state-destructive-border bg-state-destructive-hover",w&&j===o.PreviewMode.NewPage&&"cursor-pointer"),onClick:()=>{w&&j===o.PreviewMode.NewPage&&window.open(T||F||"","_blank")},children:[(0,t.jsxs)("div",{className:"flex h-12 w-12 items-center justify-center",children:[E&&(0,t.jsx)(m.default,{className:"h-8 w-8",imageUrl:F||T||""}),!E&&(0,t.jsx)(f.default,{type:(0,h.getFileAppearanceType)(C,N),size:"xl"})]}),(0,t.jsxs)("div",{className:"mr-1 w-0 grow",children:[(0,t.jsx)("div",{className:"system-xs-medium mb-0.5 flex items-center truncate text-text-secondary",title:g.name,children:(0,t.jsx)("div",{className:"truncate",children:C})}),(0,t.jsxs)("div",{className:"system-2xs-medium-uppercase flex items-center text-text-tertiary",children:[z&&(0,t.jsx)("span",{children:z.toLowerCase()}),z&&(0,t.jsx)("span",{className:"system-2xs-medium mx-1",children:"•"}),!!g.size&&(0,t.jsx)("span",{children:(0,p.formatFileSize)(g.size)})]})]}),(0,t.jsxs)("div",{className:"flex shrink-0 items-center",children:[_>=0&&!(0,h.fileIsUploaded)(g)&&(0,t.jsx)(n.default,{className:"mr-2.5",percentage:_}),-1===_&&(0,t.jsx)(s.default,{className:"mr-1",onClick:()=>v?.(k),children:(0,t.jsx)(l.ReplayLine,{className:"h-4 w-4 text-text-tertiary"})}),y&&(0,t.jsx)(s.default,{onClick:()=>b?.(k),children:(0,t.jsx)(r.RiDeleteBinLine,{className:"h-4 w-4"})}),w&&E&&(0,t.jsx)(s.default,{className:"mr-1",onClick:()=>P(T||""),children:(0,t.jsx)(r.RiEyeLine,{className:"h-4 w-4"})}),x&&(0,t.jsx)(s.default,{onClick:e=>{e.stopPropagation(),(0,u.downloadUrl)({url:T||F||"",fileName:C,target:"_blank"})},children:(0,t.jsx)(r.RiDownloadLine,{className:"h-4 w-4"})})]})]}),U&&w&&(0,t.jsx)(a.default,{title:C,url:U,onCancel:()=>P("")})]})});e.s(["default",0,g])}]);