import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import React from"react";import getFileUrl from"../../utils/getFileUrl.js";import"./CtrlFile.scss";export default function CtrlFile({currMod:e,updatePath:l,prop:_,value:i,inheritVal:t,deleteProp:a,updateProps:s,setGalleryOpen:r,setCurrentFile:c,setOnGalleryChange:n}){return _jsxs(React.Fragment,{children:[!1!==_.clearable&&i&&!t&&_jsx("div",{className:"ctrl-file__clear-btn",onClick:()=>{s(e.id,l,null)},children:"Clear"}),_jsx("div",{className:"ctrl-file__upload",children:_jsxs("div",{className:"ctrl-file__upload__btn",onClick:()=>{c(i),n((()=>_=>{s(e.id,l,_)})),r(_.accept??[])},children:[i&&(i.mime.includes("image")?_jsx("img",{className:"ctrl-file__upload__btn__img "+([".png",".svg",".eps"].includes(i.ext)?"ctrl-file__upload__btn__img--object-contain":"ctrl-file__upload__btn__img--object-cover"),alt:i.alternativeText,src:getFileUrl(i)}):_jsxs("div",{className:"ctrl-file__upload__btn__file",children:[_jsx("div",{className:"ctrl-file__upload__btn__file__name",children:i.name.split(".")[0].length>100?_jsxs("span",{title:i.name,children:[i.name.split(".")[0].slice(0,10),"..."]}):i.name.split(".")[0]}),_jsx("div",{className:"ctrl-file__upload__btn__file__ext",children:i.ext}),_jsx("div",{className:"ctrl-file__upload__btn__file__size",children:i.size<1e3?Math.round(i.size)+" KB":Math.round(i.size/100)/10+" MB"})]})),i&&_jsx("div",{className:"ctrl-file__upload__btn__active-box"}),_jsx("i",{className:"ctrl-file__upload__btn__icon fa-solid fa-sharp fa-circle-plus "+(i?"":"ctrl-file__upload__btn__icon--empty")})]})})]},e.id+l)}